/* 
 * Script decompiled by jagdecs2 v3.2
 * Decompiler opts:
 * --------------
 * t1LocalAnalyzer:true
 * t2LocalAnalyzer:true
 * beautifier:true
 * --------------
 * Made by mgi125 ;)
 */


void script_8509(int a0,int a1) {
	if (client_configs['cfg1578'].bitcfg4921 > 0) {
		return;
	}
	if ((int)cs2_configs['cfg2235'] != -1) {
		if (cs2method_10609((int)cs2_configs['cfg2235']) == 1) {
			script_7208("");
		} else {
			if (cs2_configs['cfg2873'] == 11) {
				return;
			}
		}
	}
	object v11 = "";
	int v17 = cs2_configs['cfg2231'];
	if (v17 == -1 && a0 != 80) {
		return;
	}
	if (script_8585(v17) == -1 || cs2method_10609(script_8585(v17)) == 1) {
		return;
	}
	if (script_2709() == 0) {
		if (a0 == 84) {
			cs2method_11102(script_8526(v17), 0, "Chat is not available until your Date of Birth is recorded. Please enter your DOB above.");
		}
		return;
	}
	if (cs2_configs['cfg2873'] != 8 && a0 != 84 && a0 != 80) {
		return;
	}
	int v20 = 0;
	int v21 = 0;
	int v7 = 0;
	int v24 = -1;
	int v5 = 0;
	int v10 = 0;
	int v4 = -1;
	int v15 = -1;
	int v16 = -1;
	int v23 = -1;
	int v19 = -1;
	int v1 = -1;
	switch (a0) {
		case 9:
			if (script_8627(v17) != -1) {
				script_1052(script_8629(v17), script_8627(v17), script_8609(v17), v17);
			}
			break;
		case 10:
			if (script_1036() != -1) {
				script_1051(0, v17, "");
			}
			break;
		case 12:
			int v14 = 150;
			int v6 = cs2method_10461(cs2method_10133(), script_8673(v17));
			if (v6 > 1500) {
				script_8676(v17, 0);
			}
			if (script_8675(v17) >= 7) {
				v14 = 600;
			} else if (script_8675(v17) >= 5) {
				v14 = 450;
			} else {
				if (script_8675(v17) >= 3) {
					v14 = 300;
				}
			}
			if (v6 >= v14) {
				script_8674(v17, cs2method_10133());
				script_8676(v17, cs2method_10060(script_8675(v17), 1));
				if (script_8623(v17) != -1) {
					script_1069(v17);
				}
				return;
			}
			break;
		case 102:
		case 103:
		case 98:
		case 99:
		case 96:
		case 97:
			if (cs2method_10862() == 1) {
				cs2_configs['cfg1028'] = script_1553(a0, script_8521(v17), cs2_configs['cfg1028']);
			}
			break;
		case 13:
			if (cs2_configs['cfg1652'] == 1) {
				cs2_configs['cfg1652'] = 0;
				int v26 = script_9666();
				/* 
					java.lang.RuntimeException: Stack underflow
						at mgi.tools.jagdecs2.CS2Stack.pop(CS2Stack.java:46)
						at mgi.tools.jagdecs2.FlowBlocksGenerator.processFlowBlock(FlowBlocksGenerator.java:191)
						at mgi.tools.jagdecs2.FlowBlocksGenerator.processGeneration(FlowBlocksGenerator.java:52)
						at mgi.tools.jagdecs2.FlowBlocksGenerator.generate(FlowBlocksGenerator.java:35)
						at mgi.tools.jagdecs2.CS2Decompiler.decompile(CS2Decompiler.java:77)
						at tests.Main.main(Main.java:69)
					
				 */
			}
			if (script_9666() == 1) {
				return;
			}
			if (cs2method_10265(script_8521(v17)) < 1) {
				if (script_1986() == 0) {
					script_8518();
				} else if (script_8853() > 1) {
					script_450(8, 0);
				} else {
					if (script_8846(1) == 1) {
						script_8182();
					}
				}
			} else {
				script_8522("", v17);
				cs2_configs['cfg1028'] = 0;
				if (script_8853() > 1) {
					script_450(8, 0);
				}
			}
			break;
		case 80:
			script_8511(v17);
			break;
		case 84:
			cs2_configs['cfg1028'] = cs2method_10265(cs2method_11053(script_8521(v17)));
			if (script_1983(v17) == 1) {
				return;
			}
			script_4590_struct(6,0,0) v22 = script_4590();
			int v2 = v22.intpart_5;
			int v3 = v22.intpart_4;
			int v13 = v22.intpart_3;
			int v12 = v22.intpart_2;
			int v0 = v22.intpart_1;
			int v18 = v22.intpart_0;
			if (client_configs['cfg3680'].bitcfg21242 == 0 && cs2method_10265(script_8521(v17)) <= 0) {
				script_8517(v17);
				switch (v17) {
					case 18:
						script_1050(0, v17, "");
						break;
					case 19:
						return;
					case 20:
						script_1050(2, v17, "");
						break;
					case 21:
						script_1050(8, v17, "");
						break;
					case 22:
						script_1050(10, v17, "");
						break;
					case 23:
						script_1050(0, v17, "");
						break;
					default:
						return;
				}
			} else {
				if (cs2method_10846(script_8521(v17), "/?") == 0) {
					script_8527(v17);
					script_8522("", v17);
					script_8517(v17);
					return;
				}
				if (cs2method_10846(script_8521(v17), "/") == 0) {
					script_1050(2, v17, "");
				} else if (cs2method_10846(script_8521(v17), "//") == 0) {
					script_1050(8, v17, "");
				} else {
					if (cs2method_10846(script_8521(v17), "///") == 0) {
						script_1050(10, v17, "");
					}
				}
				int v9 = script_8519(script_8521(v17));
				if (v9 != -1) {
					cs2_configs['cfg1028'] = cs2method_10265(script_8521(v17));
					script_8522("", v17);
					script_8514(v17, v9);
					if (v9 == 18 && client_configs['cfg3680'].bitcfg22315 == 0) {
						script_8551(v9, 0);
						script_1558(v9, 0);
					}
					return;
				}
				int v25 = script_8520(v17);
				switch (v25) {
					case 0:
						if (cs2method_10397(script_8875(4), 37) == 1) {
							v25 = -1;
							cs2method_10810("Public chat is not available in Mobilising Armies.");
						}
						break;
					case 1:
						if (cs2method_10846("", cs2method_10403()) == 0) {
							v25 = -1;
							script_7171(v17, "You aren't in a Friends Chat channel.");
						}
						break;
					case 2:
						if (v18 < 0) {
							v25 = -1;
							script_7171(v17, "You aren't in a Clan Chat channel.");
						} else {
							if (v0 < v12) {
								v25 = -1;
								cs2method_11102(43, 0, "Your rank is not high enough to talk in your Clan Chat.");
							}
						}
						break;
					case 3:
						if (v13 < 0) {
							v25 = -1;
							script_7171(v17, "You aren't a guest in a visited Clan Chat channel.");
						} else {
							if (v3 < v2) {
								v25 = -1;
								cs2method_11102(46, 0, "Guests cannot chat in this Clan Chat channel.");
							}
						}
				}
				if (v25 != -1 && cs2method_10265(script_8521(v17)) > 0) {
					if (v25 == 4) {
						cs2method_10365(cs2_configs['cfg2367'], script_8521(v17));
					} else {
						cs2method_10190(v25);
						cs2method_10539(script_8521(v17));
					}
				}
				script_8517(v17);
			}
			break;
		case 83:
			int v8 = script_8519(script_8521(v17));
			if (v8 != -1) {
				script_8522("", v17);
				script_8514(v17, v8);
				if (v8 == 18) {
					script_8551(v8, 0);
					script_1558(v8, 0);
				}
				return;
			}
			script_8510(v17, a0, a1);
			break;
		default:
			if (cs2_configs['cfg1652'] == 1) {
				cs2_configs['cfg1652'] = 0;
				return;
			}
			script_8510(v17, a0, a1);
	}
	script_1558(v17, 0);
	return;
}
