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


void script_10058(int a0,int a1) {
	int v0 = script_10065(a1);
	if (v0 == -1) {
		return;
	}
	if (client_configs['cfg1444'].bitcfg4323 != 0) {
		cs2method_10467(1, v0);
		cs2method_10283(0, 0, 0, 0, v0);
		return;
	}
	cs2method_10467(0, v0);
	cs2method_10283(cs2method_10236(a0), cs2method_10823(a0), 0, 0, v0);
	cs2method_10112(cs2method_10191(a0), cs2method_10152(a0), 0, 0, v0);
	cs2method_10316(v0, idx17mapData('i', 's', 8530, a1));
	if (script_10079(a1) == 1) {
		if (script_9745(a1) == 1) {
			cs2method_11127(1, v0, "Unfreeze");
			script_4407(v0, 1, 203);
		} else {
			cs2method_11127(1, v0, "Freeze");
			script_4407(v0, 1, 202);
		}
		cs2method_20486(new function<script_10063>(int a0) {
			int v2 = 0;
			object v1 = "null";
			if (script_9745(a0) == 1) {
				cs2method_10670(43546, 1, 0, 100);
				script_10078(a0);
			} else if (v0 >= cs2method_10872(script_9743(), cs2_configs['cfg4158'])) {
				object v3;
				if (v0 >= cs2_configs['cfg4158']) {
					v3 = "You have already frozen " + (string)cs2method_10379(cs2_configs['cfg4158']) + " categories and cannot freeze any more.";
				} else {
					v3 = "You do not have enough Hearts of Ice to freeze any more categories.";
				}
				script_10057(script_10065(a0), v3, 100);
				cs2method_10670(10046, 1, 0, 200);
			} else {
				cs2method_10670(43561, 1, 0, 100);
				script_10077(a0);
			}
			int v0 = script_9744();
			script_10070();
			return;
		}, a1, "i", new WidgetPointer(v0));
	} else {
		cs2method_11127(1, v0, "Can't freeze");
		script_4408(v0);
		cs2method_20486(new function<script_10064>(int a0) {
			cs2method_10467(1, 82116851);
			script_10057(a0, "This category can't be frozen.", 100);
			return;
		}, new WidgetPointer(-32768,3), "I", new WidgetPointer(v0));
	}
	return;
}
