summaryrefslogtreecommitdiff
path: root/npc/custom/quests/questboard.txt
blob: 56357601ac0cbaccbf185088c23ea9329bf3b4be (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
//===== rAthena Script =======================================
//= tr0n's Questboard
//===== By: ==================================================
//= tr0n
//===== Current Version: =====================================
//= 1.4.4
//===== Compatible With: ===================================== 
//= rAthena SVN
//===== Description: =========================================
//= Easily add collection and hunting quests.
//===== Additional Comments: =================================  
// 1.0.0 Release
// 1.1.0 Added zeny reward
// 1.2.0 Rewrote checkmob and killcounter
// 1.3.1 Added level restriction
// 1.3.4 Added Reward Item Amount
// 1.4.4 Added Quest delay
//============================================================

prontera,129,215,5	script	Questboard	857,{
		
	if(c_run==1){
		mes "[^FF7700Questboard^000000]";
		mes "^0000FF"+getd("." + currentquest$ + "_collectionname$")+"^000000";
		mes "--------------------------------";
		for( set .@j, 0; .@j < getarraysize(getd("."+ currentquest$ + "_collectionitem")); set .@j,.@j+2) {
			mes "^FF0000"+getitemname(getd("."+currentquest$+"_collectionitem["+.@j+"]"))+" - "+countitem(getd("."+currentquest$+"_collectionitem["+.@j+"]"))+"/"+getd("."+currentquest$+"_collectionitem["+(.@j+1)+"]")+" ea.^000000";
		}
		mes "--------------------------------";
		mes "[Reward]";
		mes "Item: ^0000FF"+((getd("." +currentquest$+"_collectionprize"))?getitemname(getd("." +currentquest$+"_collectionprize"))+" - "+getd("." +currentquest$+"_collectionamount")+" ea.^000000":"Nothing^000000");
		mes "Zeny: ^0000FF"+getd("." +currentquest$+"_collectionzeny")+"^000000";
		mes "Base EXP: ^0000FF"+getd("." +currentquest$+"_collectionexp["+0+"]")+"^000000";
		mes "Job EXP: ^0000FF"+getd("." +currentquest$+"_collectionexp["+1+"]")+"^000000";
		next;
		if(select("Finish:Abort") == 2){
			mes "[^FF7700Questboard^000000]";
			mes "Quest aborted.";
			set currentquest$, "";
			set c_run, 0;
			close;
		}
		goto L_checkitems;
	}
	
	if(h_run==1){
		mes "[^FF7700Questboard^000000]";
		mes "^0000FF"+getd("." + currentquest$ + "_huntingname$")+"^000000";
		mes "--------------------------------";
		for( set .@j, 0; .@j < getarraysize(getd("."+ currentquest$ + "_huntingmob")); set .@j,.@j+2) {
			set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@j)+"]");
			mes "^FF0000"+strmobinfo(1,getd("."+currentquest$+"_huntingmob["+.@j+"]"))+" - "+getd(currentquest$+"_"+.@currentmob+"_"+(.@j+1)+"_killcount")+"/"+getd("."+currentquest$+"_huntingmob["+(.@j+1)+"]")+" ea.^000000";
		}
		mes "--------------------------------";
		mes "[Reward]";
		mes "Item: ^0000FF"+((getd("." +currentquest$+"_huntingprize"))?getitemname(getd("." +currentquest$+"_huntingprize"))+" - "+getd("." +currentquest$+"_huntingamount")+" ea.^000000":"Nothing^000000");
		mes "Zeny: ^0000FF"+getd("." +currentquest$+"_huntingzeny")+"^000000";
		mes "Base EXP: ^0000FF"+getd("." +currentquest$+"_huntingexp["+0+"]")+"^000000";
		mes "Job EXP: ^0000FF"+getd("." +currentquest$+"_huntingexp["+1+"]")+"^000000";
		next;
		if(select("Finish:Abort") == 2){
			mes "[^FF7700Questboard^000000]";
			mes "Quest aborted.";
			for(set .@x, 1; .@x < getarraysize(getd("."+currentquest$+"_huntingmob")); set .@x,.@x+2){
				set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@x-1)+"]");
				setd(currentquest$+"_"+.@currentmob+"_"+.@x+"_killcount", 0);
			}
			set currentquest$, "";
			set h_run, 0;
			close;
		}
		goto L_checkmobs;
	}
		
L_questmenu:
	mes "[^FF7700Questboard^000000]";
	mes "Select category:";
	next;
	
	switch(select((.collection)?"Collection Quests":"",
				  (.hunting)?"Hunting Quests":"",
				  "Exit")) {
	
case 1:
	set .@collectmenu$, "";
	for( set .@i,0; .@i < .collectionquestcount; set .@i,.@i+1) {
		if (.@i) set .@collectmenu$,.@collectmenu$+":";
		set .@collectmenu$, .@collectmenu$ + "[" + getd("." +(.@i+1)+"_collectionmin") + " - " + getd("." +(.@i+1)+"_collectionmax") + "] " + getd("." + (.@i+1) + "_collectionname$");
	}
	set .@selection,select(.@collectmenu$);
	if(gettimetick(2) < getd(.@selection + "_collection_delay")){
		set .@time_left, getd(.@selection + "_collection_delay")-gettimetick(2);
		mes "[^FF7700Questboard^000000]";
		if(.@time_left < 60) mes "You have to wait ^0000FF"+.@time_left+" seconds^000000 to do this quest again.";
		if(.@time_left < 3600) mes "You have to wait ^0000FF"+.@time_left/60+" minutes^000000 to do this quest again.";
		mes "You have to wait ^0000FF"+.@time_left/60/60+" hours^000000 to do this quest again.";
		close;
	}
	mes "[^FF7700Questboard^000000]";
	mes "^0000FF"+getd("." + .@selection + "_collectionname$")+"^000000";
	mes "--------------------------------";
	for( set .@j, 0; .@j < getarraysize(getd("."+ .@selection + "_collectionitem")); set .@j,.@j+2) {
		mes "^FF0000"+getitemname(getd("."+.@selection+"_collectionitem["+.@j+"]"))+" - "+getd("."+.@selection+"_collectionitem["+(.@j+1)+"]")+" ea.^000000";
	}
	mes "--------------------------------";
	mes "[Reward]";
	mes "Item: ^0000FF"+((getd("." +.@selection+"_collectionprize"))?getitemname(getd("." +.@selection+"_collectionprize"))+" - "+getd("." +.@selection+"_collectionamount")+" ea.^000000":"Nothing^000000");
	mes "Zeny: ^0000FF"+getd("." +.@selection+"_collectionzeny")+"^000000";
	mes "Base EXP: ^0000FF"+getd("." +.@selection+"_collectionexp["+0+"]")+"^000000";
	mes "Job EXP: ^0000FF"+getd("." +.@selection+"_collectionexp["+1+"]")+"^000000";
	next;
	if(select("Accept:Decline") == 2){
		close;
	}
	if(BaseLevel >= getd("." +.@selection+"_collectionmin") && BaseLevel <= getd("." +.@selection+"_collectionmax"))
	{
		mes "[^FF7700Questboard^000000]";
		mes "Quest accepted.";
		set c_run, 1;
		set currentquest$, .@selection;
		close;
	}
	else
	{
		mes "[^FF7700Questboard^000000]";
		mes "You don't have the required";
		mes "level to do this quest.";
		close;
	}
	
case 2:
	set .@huntmenu$, "";
	for( set .@i,0; .@i < .huntingquestcount; set .@i,.@i+1) {
		if (.@i) set .@huntmenu$,.@huntmenu$+":";
		set .@huntmenu$, .@huntmenu$ + "[" + getd("." +(.@i+1)+"_huntingmin") + " - " + getd("." +(.@i+1)+"_huntingmax") + "] " + getd("." + (.@i+1) + "_huntingname$");
	}
	set .@selection,select(.@huntmenu$);
	if(gettimetick(2) < getd(.@selection + "_hunting_delay")){
		set .@time_left, getd(.@selection + "_hunting_delay")-gettimetick(2);
		mes "[^FF7700Questboard^000000]";
		if(.@time_left < 60) mes "You have to wait ^0000FF"+.@time_left+" seconds^000000 to do this quest again.";
		if(.@time_left < 3600) mes "You have to wait ^0000FF"+.@time_left/60+" minutes^000000 to do this quest again.";
		mes "You have to wait ^0000FF"+.@time_left/60/60+" hours^000000 to do this quest again.";
		close;
	}
	mes "[^FF7700Questboard^000000]";
	mes "^0000FF"+getd("." + .@selection + "_huntingname$")+"^000000";
	mes "--------------------------------";
	for( set .@j, 0; .@j < getarraysize(getd("."+ .@selection + "_huntingmob")); set .@j,.@j+2) {
		mes "^FF0000"+strmobinfo(1,getd("."+.@selection+"_huntingmob["+.@j+"]"))+" - "+getd("."+.@selection+"_huntingmob["+(.@j+1)+"]")+" ea.^000000";
	}
	mes "--------------------------------";
	mes "[Reward]";
	mes "Item: ^0000FF"+((getd("." +.@selection+"_huntingprize"))?getitemname(getd("." +.@selection+"_huntingprize"))+" - "+getd("." +.@selection+"_huntingamount")+" ea.^000000":"Nothing^000000");
	mes "Zeny: ^0000FF"+getd("." +.@selection+"_huntingzeny")+"^000000";
	mes "Base EXP: ^0000FF"+getd("." +.@selection+"_huntingexp["+0+"]")+"^000000";
	mes "Job EXP: ^0000FF"+getd("." +.@selection+"_huntingexp["+1+"]")+"^000000";
	next;
	if(select("Accept:Decline") == 2){
		close;
	}
	if(BaseLevel >= getd("." +.@selection+"_huntingmin") && BaseLevel <= getd("." +.@selection+"_huntingmax"))
	{
		mes "[^FF7700Questboard^000000]";
		mes "Quest accepted.";
		set h_run, 1;
		set currentquest$, .@selection;
		close;
	}
	else
	{
		mes "[^FF7700Questboard^000000]";
		mes "You don't have the required";
		mes "level to do this quest.";
		close;
	}
	
case 3:
	close;
	}
	
L_checkitems:
	for( set .@k,0; .@k < getarraysize(getd("."+currentquest$+"_collectionitem")); set .@k,.@k+2) {
		if(countitem(getd("."+currentquest$+"_collectionitem["+.@k+"]"))>=getd("."+currentquest$+"_collectionitem["+(.@k+1)+"]")){
			set .@checkitem,.@checkitem+2;
		}
	}
	if(.@checkitem<getarraysize(getd("."+currentquest$+"_collectionitem"))){
		mes "[^FF7700Questboard^000000]";
		mes "You don't have everything.";
		close;
	}
	for( set .@delcount,0; .@delcount < getarraysize(getd("."+currentquest$+"_collectionitem")); set .@delcount,.@delcount+2) {
		delitem getd("."+currentquest$+"_collectionitem["+.@delcount+"]"),getd("."+currentquest$+"_collectionitem["+(.@delcount+1)+"]");
	}
	mes "[^FF7700Questboard^000000]";
	mes "Congratulation! Here is your Reward.";
	if(getd("." +currentquest$+"_collectionprize")!=0) getitem(getd("." +currentquest$+"_collectionprize"),getd("." +currentquest$+"_collectionamount"));
	set Zeny,Zeny+getd("." +currentquest$+"_collectionzeny");
	getexp getd("." +currentquest$+"_collectionexp["+0+"]"),getd("." +currentquest$+"_collectionexp["+1+"]");
	setd(currentquest$ + "_collection_delay"),gettimetick(2)+.quest_delay;
	set currentquest$, "";
	set c_run, 0;
	close;
	
L_checkmobs:
	set .@goal, (getarraysize(getd("."+currentquest$+"_huntingmob"))/2);
	for(set .@i, 1; .@i < getarraysize(getd("."+currentquest$+"_huntingmob")); set .@i,.@i+2){
		set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@i-1)+"]");
		if(getd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")==getd("."+currentquest$+"_huntingmob["+.@i+"]")){
			set .@checkmonster, .@checkmonster+1;
			if(.@checkmonster==.@goal){
				goto L_checkmobs2;
			}
			continue;
		}
		goto L_checkmobs2;
	}
	
L_checkmobs2:
	if(.@checkmonster<.@goal){
		mes "[^FF7700Questboard^000000]";
		mes "You didn't kill everything.";
		close;
	}
	mes "[^FF7700Questboard^000000]";
	mes "Congratulation! Here is your Reward.";
	for(set .@x, 1; .@x < getarraysize(getd("."+currentquest$+"_huntingmob")); set .@x,.@x+2){
		set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@x-1)+"]");
		setd(currentquest$+"_"+.@currentmob+"_"+.@x+"_killcount", 0);
	}
	if(getd("." +currentquest$+"_huntingprize")!=0) getitem(getd("." +currentquest$+"_huntingprize"),getd("." +currentquest$+"_huntingamount"));
	set Zeny, Zeny+getd("." +currentquest$+"_huntingzeny");
	getexp getd("." +currentquest$+"_huntingexp["+0+"]"),getd("." +currentquest$+"_huntingexp["+1+"]");
	setd(currentquest$ + "_hunting_delay"),gettimetick(2)+.quest_delay;
	set currentquest$, "";
	set h_run, 0;
	close;

OnNPCKillEvent:
	if(h_run!=1) end;
	for(set .@i, 1; .@i < getarraysize(getd("."+currentquest$+"_huntingmob")); set .@i,.@i+2){
		if(killedrid==getd("."+currentquest$+"_huntingmob["+(.@i-1)+"]")){
			set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@i-1)+"]");
			if(getd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")>=getd("."+currentquest$+"_huntingmob["+.@i+"]")) end;
			setd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount", getd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")+1);
			dispbottom getd("."+currentquest$+"_huntingname$")+": ["+strmobinfo(1,.@currentmob)+"] ("+ getd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")+"/"+getd("."+currentquest$+"_huntingmob["+.@i+"]")+")";
			end;
		}
		continue;
	}
	end;
	
OnInit:

	function AddCollection;
	function AddHunting;

	//Activate/Deactive quest categories here
	set .collection, 1;
	set .hunting, 1;
	
	//Quest Delay (seconds)
	//24 hours = 86400 seconds
	set .quest_delay, 0;
	
	//Checks if quests are loaded (prevents out of index)
	if(.questsloaded==1) end;
		set .questsloaded, 1;
		
		//Add Collection Quests here
		//AddCollection("<Quest Name>",<Min Lvl>,<Max Lvl>,<Reward|Item ID>,<Reward|Item Amount>,<Zeny Reward>,<Base EXP>,<Job EXP>,<Item ID>,<Item Amount>,...);
		
		
		//Add Hunting Quests here
		//AddHunting("<Quest Name>",<Min Lvl>,<Max Lvl>,<Reward|Item ID>,<Reward|Item Amount>,<Zeny Reward>,<Base EXP>,<Job EXP>,<Monster ID>,<Monster Amount>,...);
		
		end;
		

function AddCollection {
	set .collectionquestcount,.collectionquestcount+1;
	setd ("." +.collectionquestcount+"_collectionname$", getarg(0));
	setd ("." +.collectionquestcount+"_collectionmin", getarg(1));
	setd ("." +.collectionquestcount+"_collectionmax", getarg(2));
	setd ("." +.collectionquestcount+"_collectionprize", getarg(3));
	setd ("." +.collectionquestcount+"_collectionamount", getarg(4));
	setd ("." +.collectionquestcount+"_collectionzeny", getarg(5));
	set .@argcount, 6;
	set .@size, getarraysize(getd("."+ .collectionquestcount + "_collectionexp"));
	setd ("." +.collectionquestcount+"_collectionexp["+.@size+"]",getarg(.@argcount)); 
	setd ("." +.collectionquestcount+"_collectionexp["+(.@size+1)+"]",getarg(.@argcount+1)); 
	set .@argcount, .@argcount+2;
	while(getarg(.@argcount,-1)!=-1 && getarg(.@argcount+1,-1)!=-1) {
		set .@size, getarraysize(getd("."+ .collectionquestcount + "_collectionitem"));
		setd ("."+.collectionquestcount+"_collectionitem["+.@size+"]",getarg(.@argcount)); 
		setd ("."+.collectionquestcount+"_collectionitem["+(.@size+1)+"]",getarg(.@argcount+1));
		set .@argcount,.@argcount+2;
	}
	return;
}

function AddHunting {
	set .huntingquestcount,.huntingquestcount+1;
	setd ("." +.huntingquestcount+"_huntingname$", getarg(0));
	setd ("." +.huntingquestcount+"_huntingmin", getarg(1));
	setd ("." +.huntingquestcount+"_huntingmax", getarg(2));
	setd ("." +.huntingquestcount+"_huntingprize", getarg(3));
	setd ("." +.huntingquestcount+"_huntingamount", getarg(4));
	setd ("." +.huntingquestcount+"_huntingzeny", getarg(5));
	set .@size, getarraysize(getd("."+ .huntingquestcount + "_huntingexp"));
	set .@argcount, 6;
	setd ("." +.huntingquestcount+"_huntingexp["+.@size+"]",getarg(.@argcount));
	setd ("." +.huntingquestcount+"_huntingexp["+(.@size+1)+"]",getarg(.@argcount+1)); 
	set .@argcount, .@argcount+2;
	while(getarg(.@argcount,-1)!=-1 && getarg(.@argcount+1,-1)!=-1) {
		set .@size, getarraysize(getd("."+ .huntingquestcount + "_huntingmob"));
		setd ("."+.huntingquestcount+"_huntingmob["+.@size+"]",getarg(.@argcount)); 
		setd ("."+.huntingquestcount+"_huntingmob["+(.@size+1)+"]",getarg(.@argcount+1));
		set .@argcount, .@argcount+2;
	}
	return;
}
}