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


void script_8538(int a0,int a1) {
	int v2;
	int v0;
	int v5 = -1;
	int v1 = 18;
	if (client_configs['cfg3680'].bitcfg22315 == 0) {
		while (v1 <= 23) {
			if (script_8507(v1, a0, 0) == 1) {
				if (cs2method_10609(idx22mapAttribute(idx17mapData('i', 'J', 7716, v1), 3503)) == 0) {
					return;
				}
				if (v5 == -1) {
					v5 = v1;
				}
			}
			v1 = cs2method_10060(v1, 1);
		}
	} else {
		if (script_8507(v1, a0, 1) == 1 || a0 == 1) {
			if (a0 == 1) {
				if (client_configs['cfg1775'].bitcfg4290 != 2 && client_configs['cfg1775'].bitcfg4290 != 0) {
					v5 = 18;
				} else {
					return;
				}
			} else if (client_configs['cfg1775'].bitcfg4290 != 0 && script_3787(a0) == 1) {
				v5 = 18;
			} else {
				return;
			}
		}
	}
	int v3 = -1;
	int v4 = -1;
	switch (v5) {
		case 18:
			if (cs2_configs['cfg44'] > 0) {
				return;
			}
			if (client_configs['cfg3680'].bitcfg22315 == 0) {
				cs2_configs['cfg44'] = 100;
			} else {
				switch (script_3788(a0)) {
					case 0:
						cs2_configs['cfg44'] = 200;
						break;
					case 1:
						cs2_configs['cfg45'] = 200;
						break;
					case 2:
						cs2_configs['cfg46'] = 200;
						break;
					case 3:
						cs2_configs['cfg1511'] = 200;
						break;
					case 4:
						cs2_configs['cfg47'] = 200;
				}
			}
			v0 = 18;
			v2 = 8;
			break;
		case 19:
			if (cs2_configs['cfg46'] > 0) {
				return;
			}
			cs2_configs['cfg46'] = 100;
			v0 = 19;
			v2 = 9;
			break;
		case 20:
			if (cs2_configs['cfg1511'] > 0) {
				return;
			}
			cs2_configs['cfg1511'] = 100;
			v0 = 20;
			v2 = 10;
			break;
		case 21:
			if (cs2_configs['cfg47'] > 0) {
				return;
			}
			cs2_configs['cfg47'] = 100;
			v0 = 21;
			v2 = 11;
			break;
		case 22:
			if (cs2_configs['cfg45'] > 0) {
				return;
			}
			cs2_configs['cfg45'] = 100;
			v0 = 22;
			v2 = 12;
			break;
		case 23:
			if (cs2_configs['cfg45'] > 0) {
				return;
			}
			cs2_configs['cfg45'] = 100;
			v0 = 22;
			v2 = 8;
			break;
		default:
			return;
	}
	if (client_configs['cfg3680'].bitcfg22315 == 0) {
		script_8057(v0, -1, v2);
	}
	cs2method_20162(new function<script_8539>() {
		int v0 = 0;
		if (client_configs['cfg3680'].bitcfg22315 == 0) {
			script_8540(18, cs2method_10461(cs2_configs['cfg44'], 1));
			script_8540(19, cs2method_10461(cs2_configs['cfg46'], 1));
			script_8540(20, cs2method_10461(cs2_configs['cfg1511'], 1));
			script_8540(21, cs2method_10461(cs2_configs['cfg47'], 1));
			script_8540(22, cs2method_10461(cs2_configs['cfg45'], 1));
		} else {
			script_3789(0, cs2method_10461(cs2_configs['cfg44'], 1));
			script_3789(1, cs2method_10461(cs2_configs['cfg45'], 1));
			script_3789(2, cs2method_10461(cs2_configs['cfg46'], 1));
			script_3789(3, cs2method_10461(cs2_configs['cfg1511'], 1));
			script_3789(4, cs2method_10461(cs2_configs['cfg47'], 1));
		}
		if (cs2method_10060(cs2method_10060(cs2method_10060(cs2method_10060(cs2_configs['cfg44'], cs2_configs['cfg46']), cs2_configs['cfg1511']), cs2_configs['cfg47']), cs2_configs['cfg45']) == 0) {
			cs2method_20162(new function<none>() {
			}, "", new WidgetPointer(1477,1));
		}
		return;
	}, "", new WidgetPointer(1477,1));
	return;
}
