summaryrefslogtreecommitdiff
path: root/npc/kafras/functions_kafras.txt
blob: ad0547f3dc55509ce96bbf87bdd2c0a5b0631059 (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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
//===== eAthena Script ======================================= 
//= Kafra Functions
//===== By: ================================================== 
//= Lotsa People (1.0)
//= eAthena Dev Team
//= Darlskies
//= Darkchild
//= Syrus22
//= Lupus
//= kobra_k88 (2.0)
//===== Current Version: ===================================== 
//= 2.2b
//===== Compatible With: ===================================== 
//= eAthena 1.0
//===== Description: ===============================================
//= These functions  handle save, storage, cart rental, teleport,
//= and Kafra pass options for all Kafra NPCs.
//===== Additional Comments: ================================= 
//= v1.1 Now using functions :)
//= v2.1 Added Cart Rent for Classes: Whitesmith, Professor.
//= Replaced checkoption(x) into checkcart(0) [Lupus]
//= v2.1b Added Fix Kafra Pass Func [Kobra_k88]
//= 2.2 Final fix of the Kafra Pass Exploit! [Lupus] a -Izlude[4] fix
//= 2.2a Minor changes to function calls.  Using agruments. Added Guild options. [kobra_k88]
//= 2.2b This version uses arrays for the teleport option.
//= Rearranged next statements to make menu transitions smoother. [kobra_k88]
//= Fixed typo >_< [Aria]
//============================================================ 


// Main Function ===========================================================
//=   arg(0): Used to determine which welcome message to show.
//=   arg(1): Used to determine which menu to display.
//=   arg(2): Used to determine if the info menu is shown in F_KafInfo.
//==========================================================================
function	script	F_Kafra	{
	set @kafPass, 0;
	mes "[Kafra]";
	if(getarg(0)==0) mes "Welcome to Kafra Corp.  We will stay with you wherever you go.";
	if(getarg(0)==1) mes "Welcome... Kafra Services.... Will be with you even if you die.....";
	if(getarg(0)==2) mes "Welcome, ^5533FF" + GetGuildName(@GID) + "^000000 members.  We will stay with you wherever you go";
	next;
	M_Menu:

	if(getarg(0)==2) menu "-Use Storage",M_Storage, "-Use Guild Storage",M_GStorage, "-Rent a Cart",M_Cart, "-Use Teleport Service",M_Teleport, "-Cancel",M_End;

	if(getarg(1)==1) menu "-Save",M_Save, "-Use Storage",M_Storage, "-Rent a Cart",M_Cart, "-Kafra Pass",M_Pass, "-Other Information Check",M_Info,
			"-Cancel",M_End;

	menu	"-Save",M_Save, "-Use Storage",M_Storage, "-Use Teleport Service",M_Teleport, "-Rent a Cart",M_Cart, "-Kafra Pass",M_Pass, 
		"-Other Information Check",M_Info, "-Cancel",M_End;

	M_Save:
		return;
	M_Storage:
		callfunc "F_KafStor",getarg(0);
		next;
		goto M_Menu;
	M_GStorage:
		callfunc "F_KafStor",3;
		next;
		goto M_Menu;
	M_Teleport:
		callfunc "F_KafTele",getarg(0);
		goto M_Menu;
	M_Cart:
		if(callfunc("F_KafCart",getarg(0)) == 1) next;
		goto M_Menu;
	M_Pass:
		if(callfunc("F_KafPass") == 1) next;
		goto M_Menu;
	M_Info:
		callfunc "F_KafInfo",getarg(2);
		goto M_Menu;
	M_End:
		callfunc "F_KafEnd",getarg(0),0;
		end;
}


// Storage Function =======================================================
function	script	F_KafStor	{
	if(getarg(0) == 3) goto L_Guild;
	if((class ==Job_Novice) && (JobLevel<6)) goto sL_JbLvl;
	if(Class == Job_Novice) set @fee, 30;
	if(Class != Job_Novice) set @fee, 60;
	if(@kafPass==1 || getarg(0)==2) set @fee, 0;
	if(Zeny<@fee) goto sL_Zeny;
	set Zeny, Zeny-@fee;
	set RESRVPTS, RESRVPTS + (@fee/5);
	openstorage;
	callfunc "F_KafEnd",getarg(0),0;
	end;

	sL_JbLvl:
		mes "[Kafra]";
		mes "I am sorry but you have to be at leaset Novice level 6 if you want to use the storage.";
		return;
	sL_Zeny:
		mes "[Kafra]";
		mes "Dear you don't have enough money. The Storage fee is "+@fee+" Zeny.";
		return;
L_Guild:
	if(guildopenstorage(0) == 1) goto L_InUse;
	callfunc "F_KafEnd",0,0;
	end;

	L_InUse:
		mes "[Kafra]";
		mes "I'm sorry but another guild member is using the guild storage";
		mes "right now.  Please wait untill that person is finished.";
		close2;
		cutin "", 255;
		end;

}


// Teleport Function ==================================================
function	script	F_KafTele	{
	mes "[Kafra]";
	if (@kafPass==1) mes "Since you're using a Kafra Pass, any warp is free!";
	mes "Please set your destination.";
	next;

	menu 	@wrpC$[0],M_Wrp0, @wrpC$[1],M_Wrp1, @wrpC$[2],M_Wrp2, @wrpC$[3],M_Wrp3, 
		@wrpC$[4],M_Wrp4, @wrpC$[5],M_Wrp5, @wrpC$[6],M_Wrp6;

	M_Wrp0:
		set @num, 0;
		goto L_Warp;
	M_Wrp1:
		set @num, 1;
		goto L_Warp;
	M_Wrp2:
		set @num, 2;
		goto L_Warp;
	M_Wrp3:
		set @num, 3;
		goto L_Warp;
	M_Wrp4:
		set @num, 4;
		goto L_Warp;
	M_Wrp5:
		set @num, 5;
		goto L_Warp;
	M_Wrp6:
		set @num, 6;

	L_Warp:
		if (@wrpC$[@num] == "Cancel") return;
		if (@kafPass==1) set @wrpP[@num], 0;
		if (Zeny<@wrpP[@num]) goto sL_CantTele;
		set Zeny, Zeny-@wrpP[@num];
		if (@kafPass==0) set RESRVPTS, RESRVPTS + (@wrpP[@num]/16);

		if (@wrpD$[@num] == "Alberta") warp "alberta.gat", 117, 56;
		if (@wrpD$[@num] == "Al De Baran") warp "aldebaran.gat",143,110;
		if (@wrpD$[@num] == "Comodo") warp "comodo.gat", 207, 144;
		if (@wrpD$[@num] == "Izlude") warp "izlude.gat", 91, 105;
		if (@wrpD$[@num] == "Geffen") warp "geffen.gat", 120, 39;
		if (@wrpD$[@num] == "Morroc") warp "morocc.gat", 156, 46;
		if (@wrpD$[@num] == "Payon") warp "payon.gat", 168, 103;
		if (@wrpD$[@num] == "Prontera") warp "prontera.gat", 116, 72;
		if (@wrpD$[@num] == "Coal Mine(Dead Pit)") warp "mjolnir_02.gat", 82, 347;
		if (@wrpD$[@num] == "Comodo Pharos Lighthouse") warp "cmd_fild07.gat", 127, 134;
		if (@wrpD$[@num] == "Orc Dungeon") warp "gef_fild10.gat", 52, 326;
		if (@wrpD$[@num] == "Umbala") warp "umbala.gat", 130, 130;
		end;

		sL_CantTele:
			mes "[Kafra]";
			mes "Dear you don't have enough money. Please check your funds again.";
			close2;
			cutin "", 255;
			end;
}


// Cart Function ========================================================
function	script	F_KafCart	{
	if(callfunc("Is_Merc_Class") == 0) goto sL_CantRent;
	if(getskilllv(39)==0) goto sL_NeedSkill;
	if(checkcart(0) == 1) goto sL_GotCart;
	if(getarg(0) == 2) goto L_Guild;
	mes "[Kafra]";
	if(@kafPass==0) mes "The Cart Fee is 800 Zeny.  Do you want to Rent a Cart?";
	if(@kafPass==1) mes "Since you're using a Kafra Pass, you can rent a cart for free!";
	next;
	menu "-Rent a Cart.",-, "-Cancel.",M_End;

		if(Zeny<800 && kafPass==0) goto sL_CartFee;
		if(@kafPass==0) set Zeny,Zeny-800;
		if(@kafPass==0) set RESRVPTS, RESRVPTS + 48;
	L_Guild:
		setcart;
		mes "[Kafra]";
		mes "Here is your cart.";
		return 1;

	sL_CantRent:
		mes "[Kafra]";
		mes "I'm sorry dear.  The Cart service is only provided for the Merchant and Blacksmith Class.";
		return 1;
	sL_NeedSkill:
		mes "[Kafra]";
		mes "I'm sorry but you need the skill ^0000FF'Pushcart'^000000 to rent a cart.";
		return 1;
	sL_GotCart:
		mes "[Kafra]";
		mes "Excuse me... but you already have a cart....";
		emotion 4;
		return 1;
	sL_CartFee:
		mes "[Kafra]";
		mes "Dear, you don't have enough Money. You need 800 Zeny.";
		return 1;
	M_End:
		return 0;
}


// Pass Function ===============================================================
function	script	F_KafPass	{

	sM_Menu:
	menu "Use a Kafra Pass.",-, "What is a Kafra Pass?",sM_PassInfo, "Cancel",sM_End;

		mes "[Kafra]";
		mes "Let me just check your pass.....";
		next;
		if(usedKafPass==0 && countitem(1084)<1) goto sL_NeedPass;
		set @kafPass,1;
		set usedKafPass, usedKafPass + 1;
		if(usedKafPass>=3) goto sL_PassExpire;
		if(usedKafPass > 1) goto L_Cont; //fixed Lupus
		mes "(you hand her your pass)";
		next;
		mes "[Kafra]";
		mes "Great! Everything seems to be in order.  Now that your pass is activated, you may rent a cart or use the teleport services for free.";
		mes "Your pass number has been entered into our database so you no longer need it.";
		delitem 1084,1;
		next;

		L_Cont:
		mes "[Kafra]";
		mes "You will be able to use the Cart Rental and Teleport services free of charge ^5533FF"+(3 - usedKafPass)+"^000000 more times with any Kafra service agent you choose.";
		return 1;

		sL_NeedPass:
			mes "[Kafra]";
			mes "I'm sorry but you don't have a kafra pass to use....";
			next;
			goto sM_Menu;
		sL_PassExpire:
			mes "[Kafra]";
			mes "This is going to be the 3rd and final time you use this pass, therefore it is now expired.";
			next;
			set usedKafPass,0;
			mes "[Kafra]";
			mes "You may now use the Teleport and Cart Rental services for free.";
			return 1;
	sM_PassInfo:
		mes "[Kafra]";
		mes "A ^5533FFKafra Pass^000000 is a unique voucher that lets you use Kafra services for free!";
		mes "The Kafra services that you may use for free are the ^FF3355Teleport^000000 service and the ^FF3355Cart Rental^000000 service.";
		next;
		mes "[Kafra]";
		mes "Kafra passes can be purchased at the Kafra Corp. Main office in Al De Baran.";
		next;
		mes "[Kafra]";
		mes "To use a Kafra Pass, simply choose the option to 'Use a Kafra Pass', when speaking with a Kafra agent such as myself.";
		mes "Your pass number will be entered into our database, and you will then be able to use the Teleport, and Cart Rental Kafra services free of charge.";
		next;
		mes "[Kafra]";
		mes "Once you have finished using the desired services, and have stoped interacting with the Kafra, your 'free use' session will end.";
		mes "You will have a total of ^5533FF 3 'free use' sessions^000000 available upon activation of your Kafra Pass.";
		next;
		mes "[Kafra]";
		mes "To begin another 'free use' session, simply select the 'Use a Kafra Pass' option when speaking with a Kafra Agent.";
		next;
		mes "[Kafra]";
		mes "Believe me when I say that the Kafra Pass is a great bargain!!";
		mes "With the Kafra Pass, we hope to give players some incentive to use our great services.";
		next;
		goto sM_Menu;

	sM_End:
		return 0;
}

// Special Reserve Points Function ===========================================
function	script	F_KafInfo	{

	sM_Menu:
	if(getarg(0) == 0) menu "-Special Reserve Check",sM_ResChk, "-Kafra Locations",sM_KafLoc, "-Cancel",sM_End;

	sM_ResChk:
		mes "[Kafra]";
		mes "Here is your current amount of special reserve points:";
		mes "^0000ff"+RESRVPTS+"^000000.";
		next;
		mes "[Kafra]";
		mes "Remember to continue using Kafra services such as Storage and Teleport, to earn more special reserve points.";
		next;
		mes "[Kafra]";
		mes "You can trade them in at the Kafra Main Office in Al De Baran for usefull items and cool prizes.";
		next;
		if(getarg(0) == 1) return;
		goto sM_Menu;
	sM_KafLoc:
		mes "[Kafra]";
		mes "The flashing signals on your mini-map point to the locations of all of the Kafra Agents in this city.";
		viewpoint 1,@viewpX[0],@viewpY[0],1,0xFF00FF;
		viewpoint 1,@viewpX[1],@viewpY[1],2,0xFF00FF;
		viewpoint 1,@viewpX[2],@viewpY[2],3,0xFF00FF;
		viewpoint 1,@viewpX[3],@viewpY[3],4,0xFF00FF;
		next;
		viewpoint 2,@viewpX[0],@viewpY[0],1,0xFF00FF;
		viewpoint 2,@viewpX[1],@viewpY[1],2,0xFF00FF;
		viewpoint 2,@viewpX[2],@viewpY[2],3,0xFF00FF;
		viewpoint 2,@viewpX[3],@viewpY[3],4,0xFF00FF;
		goto sM_Menu;
	sM_End:
		return;
}


// End Function =====================================================
//  arg(0): used to determine what message to display.
//  arg(1): used to determine if save message is diplayed.
//===================================================================
function	script	F_KafEnd	{
	mes "[Kafra]";
	if(getarg(1)==1) mes "Your respawn point has been saved.";		// only shown when a player uses save
	if(getarg(0)!=1) mes "Thank you for using Kafra Services.  We hope to see you again soon.";
	if(getarg(0)==1) mes "We, Kafra Corporation.... Will be with you.... whenever.... wherever... therefore.... please don't forget us.....";
	close2;
	cutin "", 255;
	emotion 15;
	end;
}