package i1; import busidol.mobile.tower.MainActivity; import com.google.android.gms.ads.RequestConfiguration; import com.igaworks.ssp.SSPErrorCode; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.Locale; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /* loaded from: classes.dex */ public class e { public static String A = null; public static String B = null; public static String C = null; public static String D = null; public static String E = null; public static String F = null; public static float G = 0.0f; public static float H = 0.0f; public static float I = 1280.0f; public static float J = 720.0f; public static Locale K = null; public static HashMap L = null; public static ArrayList M = null; public static String N = null; public static boolean O = false; public static String P = null; public static String Q = null; public static boolean R = false; public static String S = null; public static String T = null; public static String U = null; public static int V = 0; public static String W = null; public static String X = "1"; public static String Y = "5"; public static String Z; /* renamed from: a0, reason: collision with root package name */ public static String f10638a0; /* renamed from: b0, reason: collision with root package name */ public static String f10639b0; /* renamed from: c0, reason: collision with root package name */ public static String f10640c0; /* renamed from: d0, reason: collision with root package name */ public static String f10641d0; /* renamed from: e0, reason: collision with root package name */ public static ArrayList f10642e0; /* renamed from: w, reason: collision with root package name */ public static String f10643w; /* renamed from: x, reason: collision with root package name */ public static String f10644x; /* renamed from: y, reason: collision with root package name */ public static String f10645y; /* renamed from: z, reason: collision with root package name */ public static String f10646z; /* renamed from: a, reason: collision with root package name */ public k f10647a; /* renamed from: b, reason: collision with root package name */ public MainActivity f10648b; /* renamed from: c, reason: collision with root package name */ public l1.a f10649c; /* renamed from: j, reason: collision with root package name */ public JSONArray f10656j; /* renamed from: l, reason: collision with root package name */ public JSONArray f10658l; /* renamed from: m, reason: collision with root package name */ public ArrayList f10659m; /* renamed from: n, reason: collision with root package name */ public String f10660n; /* renamed from: o, reason: collision with root package name */ public boolean f10661o; /* renamed from: p, reason: collision with root package name */ public String f10662p; /* renamed from: q, reason: collision with root package name */ public String f10663q; /* renamed from: r, reason: collision with root package name */ public String f10664r; /* renamed from: s, reason: collision with root package name */ public String f10665s; /* renamed from: t, reason: collision with root package name */ public String f10666t; /* renamed from: u, reason: collision with root package name */ public q f10667u; /* renamed from: v, reason: collision with root package name */ public i f10668v; /* renamed from: d, reason: collision with root package name */ public String f10650d = "http://vass.hanafostv.com:8080/service/serviceAction.hm?m=purchasePpvProduct"; /* renamed from: e, reason: collision with root package name */ public String f10651e = "http://vass.hanafostv.com:8080/service/serviceAction.hm?m=checkPurchasePw"; /* renamed from: f, reason: collision with root package name */ public String f10652f = "http://vass.hanafostv.com:8080/service/serviceAction.hm?m=purchasePpxProduct"; /* renamed from: g, reason: collision with root package name */ public String f10653g = "http://vass.hanafostv.com:8080/service/serviceAction.hm?m=checkPurchasePpmProduct"; /* renamed from: h, reason: collision with root package name */ public String f10654h = "http://vass.hanafostv.com:8080/service/serviceAction.hm?m=cancelPurchasePpmProduct"; /* renamed from: i, reason: collision with root package name */ public String f10655i = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED; /* renamed from: k, reason: collision with root package name */ public int f10657k = SSPErrorCode.SERVER_TIMEOUT; class a extends p { a() { } @Override // i1.p, java.lang.Runnable public void run() { try { e.this.f10647a.f10739a.setSetting((JSONArray) a("array")); } catch (JSONException e10) { e10.printStackTrace(); } } } public e(k kVar) { this.f10647a = kVar; } public static String a(InputStream inputStream) { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); StringBuilder sb = new StringBuilder(); while (true) { String readLine = bufferedReader.readLine(); if (readLine == null) { inputStream.close(); return sb.toString(); } sb.append(readLine); } } public static boolean c() { return K.getLanguage().equals("ko"); } public static boolean d() { String str = f10643w; if (str == null) { return false; } return str.contains("test"); } public static void i(JSONArray jSONArray) { f10642e0 = new ArrayList(); for (int i10 = 0; i10 < jSONArray.length(); i10++) { f10642e0.add(jSONArray.getString(i10)); } } public void b() { k kVar = this.f10647a; this.f10649c = kVar.f10748j; this.f10648b = kVar.f10741c; String e10 = e(); if (e10 == null || e10.isEmpty()) { throw new g1.a(); } try { g(new JSONObject(e10)); } catch (JSONException e11) { e11.printStackTrace(); } L = this.f10649c.c("get_shop_list.php"); } public String e() { Throwable th; HttpURLConnection httpURLConnection; try { try { httpURLConnection = (HttpURLConnection) new URL("http://211.253.26.47:8093/TOWERDEFENCE_AMO/Android/define.json").openConnection(); try { httpURLConnection.setRequestMethod("POST"); httpURLConnection.setDoInput(true); httpURLConnection.setDoOutput(true); httpURLConnection.setConnectTimeout(this.f10657k); httpURLConnection.connect(); String a10 = a(httpURLConnection.getInputStream()); httpURLConnection.disconnect(); return a10; } catch (Exception unused) { throw new g1.a(); } catch (Throwable th2) { th = th2; if (httpURLConnection != null) { httpURLConnection.disconnect(); } throw th; } } catch (Exception unused2) { } } catch (Throwable th3) { th = th3; httpURLConnection = null; } } public void f() { this.f10659m = new ArrayList(); for (int i10 = 0; i10 < this.f10658l.length(); i10++) { if (this.f10658l.getJSONObject(i10).getString("model").equals(B)) { JSONArray jSONArray = this.f10658l.getJSONObject(i10).getJSONArray("keys"); for (int i11 = 0; i11 < jSONArray.length(); i11++) { this.f10659m.add(Integer.valueOf(jSONArray.getInt(i11))); } return; } } } public void g(JSONObject jSONObject) { F = jSONObject.getString("serverUrl"); h(jSONObject.getJSONArray("keyMap")); j(jSONObject.getJSONObject("webKeyMap")); k(jSONObject.getJSONArray("webSetting")); this.f10661o = jSONObject.getBoolean("bDeleteCache"); this.f10650d = jSONObject.getString("vassUrlPurchasePpv"); this.f10651e = jSONObject.getString("vassUrlPurchasePw"); this.f10652f = jSONObject.getString("vassUrlPurchasePpm"); this.f10653g = jSONObject.getString("vassUrlCheckPpm"); this.f10654h = jSONObject.getString("vassUrlCancelPpm"); this.f10655i = jSONObject.getString("vassUrlAdult"); this.f10660n = jSONObject.getString("webUrl"); this.f10657k = jSONObject.getInt("networkTimeout"); this.f10658l = jSONObject.getJSONArray("keyBlockModels"); f(); i(jSONObject.getJSONArray("pauseExitModels")); this.f10662p = jSONObject.getString("soundPath"); this.f10663q = jSONObject.getString("policyUrl"); this.f10664r = jSONObject.getString("termsUrlService"); this.f10665s = jSONObject.getString("termsUrlPersonal"); this.f10666t = jSONObject.getString("webClientId"); V = jSONObject.getInt("paymentTokenMin"); f10640c0 = jSONObject.getString("updateNoteKR"); f10641d0 = jSONObject.getString("updateNoteEN"); W = jSONObject.getString("appLinkUri"); MainActivity mainActivity = this.f10648b; G = mainActivity.f3341d / I; H = mainActivity.f3342e / J; X = jSONObject.getString("moreGameApp1"); Y = jSONObject.getString("moreGameApp2"); Z = jSONObject.getString("moreGameAppUrl1"); f10638a0 = jSONObject.getString("moreGameAppUrl2"); f10639b0 = jSONObject.getString("moreGameAppVisible"); N = jSONObject.getString("adRewardId"); O = jSONObject.getBoolean("adRewardOnFailed"); P = jSONObject.getString("adRewardOnFailedMsg"); Q = jSONObject.getString("adInterId"); R = jSONObject.getBoolean("adInterOnFailed"); S = jSONObject.getString("adInterOnFailedMsg"); T = jSONObject.getString("adpopcornRVID"); U = jSONObject.getString("adpopcornInterID"); } public void h(JSONArray jSONArray) { for (int i10 = 0; i10 < jSONArray.length(); i10++) { JSONObject jSONObject = jSONArray.getJSONObject(i10); JSONArray jSONArray2 = jSONObject.getJSONArray("models"); int i11 = 0; while (true) { if (i11 >= jSONArray2.length()) { break; } if (jSONArray2.getString(i11).equals(B)) { this.f10668v = new i(jSONObject); break; } i11++; } if (this.f10668v != null) { break; } } if (this.f10668v == null) { this.f10668v = new i(); } } public void j(JSONObject jSONObject) { this.f10667u = new q(jSONObject); } public void k(JSONArray jSONArray) { this.f10656j = jSONArray; a aVar = new a(); aVar.b("array", jSONArray); this.f10647a.f10744f.post(aVar); } }