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


void script_8935(int a0,int a1) {
	cs2method_10670(36961, 1, 0, 200);
	cs2method_10467(0, 97976669);
	int v4 = idx17mapData('i', 'J', 7568, a0);
	int v1 = idx22mapAttribute(v4, 3398);
	object v0 = "Are you sure you want to claim this reward?";
	if (cs2method_10938(1) < itemDefsAttribute(v1, 750)) {
		v0 = cs2method_10427(v0, "<br>" + "<col=ff0000>" + "You require " + (string)cs2method_10379(itemDefsAttribute(v1, 750)) + " Defence to wear this armour.");
	}
	int v5 = idx22mapAttribute(v4, 3404);
	if (cs2_configs['cfg2774'] > 0) {
		v5 = cs2method_10122(95, 100, v5);
	}
	int v2 = cs2method_10051(v5, a1);
	object v3 = cs2method_10427(v0, "<br>" + "This will cost you " + (string)cs2method_10379(v2) + " renown.");
	cs2method_10026(97976674, v3);
	if (client_configs['cfg3667'].bitcfg18730 == 1) {
		cs2method_10026(97976672, cs2method_10018(idx22mapAttribute(v4, 3398)));
		if (idx22mapAttribute(v4, 3408) == 1) {
			cs2method_10039(-1, -1, 97976673);
			cs2method_10758(idx22mapAttribute(v4, 3415), 97976673);
		} else {
			cs2method_10039(idx22mapAttribute(v4, 3398), -1, 97976673);
		}
	} else if (idx22mapAttribute(v4, 3408) == 1) {
		cs2method_10039(-1, -1, 97976673);
		cs2method_10758(idx22mapAttribute(v4, 3416), 97976673);
	} else {
		cs2method_10039(idx22mapAttribute(v4, 3399), -1, 97976673);
	}
	cs2method_10026(97976672, cs2method_10018(idx22mapAttribute(v4, 3399)));
	cs2method_20486(new function<script_8938>(int a0) {
		int v6 = -1;
		int v8 = -1;
		int v2 = -1;
		int v14 = -1;
		int v3 = -1;
		int v12 = 0;
		int v15 = idx17mapData('i', 'J', 7568, a0);
		int v7 = idx22mapAttribute(v15, 3404);
		int v13 = a0;
		script_8928_struct(6,0,0) v9 = script_8928(v13);
		int v4 = v9.intpart_5;
		int v5 = v9.intpart_4;
		int v11 = v9.intpart_3;
		int v1 = v9.intpart_2;
		int v0 = v9.intpart_1;
		int v10 = v9.intpart_0;
		if (idx22mapAttribute(v15, 3410) == 1) {
			v7 = cs2method_10122(40, 100, v7);
		}
		if (cs2_configs['cfg2774'] == 1) {
			v7 = cs2method_10122(95, 100, v7);
		}
		if (client_configs['cfg3669'] < v7) {
			return;
		}
		if (idx22mapAttribute(v15, 3408) == 1) {
			script_8936(v11, v0, 0, v15, 1);
			cs2method_10797("Purchased");
		} else {
			if (v4 == -1) {
				return;
			}
			if (idx22mapAttribute(v15, 3410) == 0) {
				cs2method_10026(v0, "Reclaim");
			} else {
				cs2method_10026(v0, cs2method_10379(v7));
			}
			cs2method_10758(7892, v4);
			cs2method_20680(new function<script_8930>(int a0) {
				cs2method_10758(7895, a0);
				return;
			}, new WidgetPointer(v4), "I", new WidgetPointer(v4));
			cs2method_20069(new function<script_8930>(int a0) {
				cs2method_10758(7895, a0);
				return;
			}, new WidgetPointer(v4), "I", new WidgetPointer(v4));
			cs2method_21103(new function<script_8930>(int a0) {
				cs2method_10758(7895, a0);
				return;
			}, new WidgetPointer(v4), "I", new WidgetPointer(v4));
			cs2method_20750(new function<script_8931>(int a0) {
				cs2method_10758(7892, a0);
				return;
			}, new WidgetPointer(v4), "I", new WidgetPointer(v4));
		}
		return;
	}, a0, "i", new WidgetPointer(1495,351));
	return;
}
