summaryrefslogtreecommitdiff
path: root/npc/006-2-1/glim.txt
blob: 0fddf8800709674a55e01e57f1691ce63d550a07 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// TMW2 scripts.
// Authors:
//   Jesusalva
//   +seeds
// Description:
//   Daily quest to exchange Tolchi Arrow Boxes for a small amount of gp and exp
// Variables:
//   $GLIM_ST
//     How many Tolchi Arrow Boxes were given
//   q2
//     Controls your own progress helping Glim - Items today
//   q3
//     Controls your own progress helping Glim - Your timer

006-2-1,82,28,0	script	Glim	NPC_PIOU_VIKING,{
	function handle_donation;

L_Loop:
	.@q3 = getq3(PiouQuest_Glim);
	mesn;
	mesq l("Argh, I've run out o' arrows! Say, ye don't have any I could use, do ye? I only got %s...", fnum($GLIM_ST));
	next;
	if (.@q3 < $@GLIM_QTIMER) {
		setq2 PiouQuest_Glim, 0;
		setq3 PiouQuest_Glim, $@GLIM_QTIMER;
	}

	// Daily limit reached
	.@q2 = getq2(PiouQuest_Glim);
	.@donations_limit = (BaseLevel-17)/3 - .@q2;
	.@tabox_limit = min(countitem(TolchiAmmoBox), .@donations_limit);
	.@tarow_limit = min(countitem(TolchiArrow)/200, .@donations_limit);

	if (.@donations_limit <= 0)
		goto L_Timer;

	select
		rif(.@tabox_limit > 0, l("Give Glim a %s", getitemname(TolchiAmmoBox))),
		rif(.@tarow_limit > 0, l("Give Glim a %s", l("bundle of 200 %s", getitemname(TolchiArrow)))),
		l("Maybe later.");
	mes "";

	switch (@menu) {
	case 1:
		handle_donation(TolchiAmmoBox, 1, 150, 64);
		break;
	case 2:
		handle_donation(TolchiArrow, 200, 100, 72);
		break;
	case 3:
		close;
		break;
	}
	goto L_Loop;

L_Timer:
	if (BaseLevel < 10) {
		mesq l("Wait a minute! I ain't trustin' a weakling like ye fer good arrows!");
		mesn;
		mesq l("Come back when ye've grown sum muscles.");
		close;
	}
	mesn;
	mesq l("I'm all stocked up now, thanks to ye. Come back in @@ and ye might be able to help me again.", FuzzyTime($@GLIM_TIMER+(60*60*24),2,2));
	close;

function handle_donation { // (partID, Amount, Zeny, bEXP)
	.@partID = getarg(0);
	.@amount = getarg(1);
	.@zeny   = getarg(2);
	.@bEXP   = getarg(3);

	delitem .@partID, .@amount;
	getexp (.@amount * .@bEXP), 0;
	Zeny += (.@amount * .@zeny);
	$GLIM_ST += 1;
	setq2 PiouQuest_Glim, (getq2(PiouQuest_Glim) + 1);
}

OnInit:
	.sex = G_OTHER;
	.distance = 5;

	$@GLIM_QTIMER = gettimeparam(GETTIME_DAYOFMONTH);
	$@GLIM_TIMER  = gettimetick(2);
	$@GLIM_TIMER -= gettime(1);
	$@GLIM_TIMER -= gettime(2)*60;
	$@GLIM_TIMER -= gettime(3)*3600;
	end;

OnHour00:
	$@GLIM_QTIMER = gettimeparam(GETTIME_DAYOFMONTH);
	$@GLIM_TIMER  = gettimetick(2);
	end;
}