summaryrefslogblamecommitdiff
path: root/npc/re/merchants/refine.txt
blob: 749f573aa4f384af2d24d4d439d52dddd953dc94 (plain) (tree)
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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
                                                              




                                                              










































































































































































































































































































































































































































































































                                                                                                                                                                    
//===== Hercules Script ======================================
//= Renewal Refining NPCs
//===== By: ==================================================
//= rAthena Dev Team
//===== Current Version: =====================================
//= 1.0
//===== Description: =========================================
//= Renewal-specific refining NPCs and material merchants.
//===== Additional Comments: =================================
//= 1.0 Moved some scripts to Renewal file, optimized "Austry" NPC. [Euphy]
//============================================================

// +11 and above Refiners
//============================================================
prt_in,90,72,5	script	Bestry#prt	826,{
	callfunc "refinenew","Bestry",0,0;
	end;
}
morocc_in,64,41,5	script	Bestry#moc	826,{
	callfunc "refinenew","Bestry",0,0;
	end;
}
payon_in01,18,132,3	script	Bestry#pay	826,{
	callfunc "refinenew","Bestry",0,0;
	end;
}

//============================================================
// +11 and above Refiner Function
//============================================================
//= To allow auto safe refining/multiple refining set the
//= second argument to '1' in the function call.
//= If you enable this function, be sure to edit the value of
//= .@safe to the max safe refine in refine_db.txt as well.
//=
//= The official script uses a command which seems to generate a
//= random result upon refining: success, downgrade, or failure.
//= To enable that feature, set the third argument to '1' in the
//= function call.  Otherwise, the chance in refine_db.txt is used.
//============================================================
function	script	refinenew	{
	mes "["+ getarg(0) +"]";
	mes "I am the best Blacksmith ever!";
	mes "I don't work with normal, boring items.";
	mes "But only with items that are level 10 or higher!";
	next;
	mes "["+ getarg(0) +"]";
	mes "Anyway, you may use my services if your item is lv 10 or higher.";
	mes "What do you want to have refined?";
	next;

	setarray .@position$[1],"Head","Body","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
	set .@menu$,"";
	for(set .@i,1; .@i<=10; set .@i,.@i+1) {
		if(getequipisequiped(.@i))
			set .@menu$, .@menu$ + .@position$[.@i] + "-" + "[" + getequipname(.@i) + "]";
		set .@menu$, .@menu$ + ":";
	}
	set .@part,select(.@menu$);
	if(!getequipisequiped(.@part)) {
		mes "[" + getarg(0) + "]";
		mes "You're not wearing";
		mes "anything there that";
		mes "I can refine.";
		emotion e_an;
		close;
	}
	//Check if the item is refinable...
	if(!getequipisenableref(.@part)) {
		mes "[" + getarg(0) + "]";
		mes "I don't think I can";
		mes "refine this item at all...";
		close;
	}
	//Check if the item is identified... (Don't know why this is in here... but kept it anyway)
	if(!getequipisidentify(.@part)) {
		mes "[" + getarg(0) + "]";
		mes "You can't refine this";
		mes "if you haven't appraised";
		mes "it first. Make sure your";
		mes "stuff is identified before";
		mes "I can refine it.";
		close;
	}
	//Check to see if the items is at least +10
	if(getequiprefinerycnt(.@part) < 10) {
		mes "["+ getarg(0) +"]";
		mes "I said I don't work with Equipment under lv. 10.";
		close;
	}
	if(getequiprefinerycnt(.@part) >= 20) {
		mes "["+ getarg(0) +"]";
		mes "I can't refine this";
		mes "any more. This is as";
		mes "refined as it gets!";
		close;
	}
	set .@refineitemid, getequipid(.@part); // save id of the item
	set .@refinerycnt, getequiprefinerycnt(.@part); //save refinery count
	if ((getequipweaponlv(.@part) >= 1) && (getequipweaponlv(.@part) <= 4)) {
		set .@material,6224;
		set .@price,100000;
		set .@safe,10;
		mes "["+ getarg(0) +"]";
		mes "Hmm a weapon, is that ok?";
		mes "If you want to refine this weapon,";
		mes "I will need 1 ^003366Bradium^000000 and 100,000 zeny.";
		mes "Are you sure you want to continue?";
	} else {
		set .@material,6223;
		set .@price,100000;
		set .@safe,10;
		mes "["+ getarg(0) +"]";
		mes "Hmm an armor, is that ok?";
		mes "If you want to refine this armor,";
		mes "I will need 1 ^003366Carnium^000000 and 100,000 zeny.";
		mes "Are you sure you want to continue?";
	}
	next;
	if(select("Yes:No") == 2){
		mes "["+ getarg(0) +"]";
		mes "Well, no challenge is one way...";
		mes "No risk... that could be wise.";
		close;
	}
	if(getarg(1) != 1) {
		if ((getequipweaponlv(.@part) >= 1) && (getequipweaponlv(.@part) <= 4)) {
			mes "["+ getarg(0) +"]";
			mes "This weapon already has been refined serveral times.";
			mes "It could be destroyed if you try more.";
			mes "It won't break 100%, but is has a small chance.";
			next;
			mes "["+ getarg(0) +"]";
			mes "You could have the upgrade level of the weapon decreased,";
			mes "or if it breaks, you will lose ^FF0000any cards^000000 or special properties added to it.";
		} else {
			mes "["+ getarg(0) +"]";
			mes "This armor already has been refined serveral times.";
			mes "It could be destroyed if you try more.";
			mes "It won't break 100%, but is has a small chance.";
			next;
			mes "["+ getarg(0) +"]";
			mes "You could have the upgrade level of the armor decreased,";
			mes "or if it breaks, you will lose ^FF0000any cards^000000 or special properties added to it.";
		}
		next;
		mes "["+ getarg(0) +"]";
		mes "Do you want me to refine it?";
		mes "I think I gave you enough warnings.";
		next;
		if(select("Yes.:No.") == 2) {
			mes "["+ getarg(0) +"]";
			mes "Well, no challenge is one way..";
			mes "No risk.. that could be wise.";
			close;
		}
		if(countitem(.@material) < 1 || Zeny < .@price) {
			mes "["+ getarg(0) +"]";
			mes "Hm, it seems you don't have enough materials or money.";
			mes "Please check it out.";
			close;
		}
		set Zeny,Zeny - .@price;
		delitem .@material,1;
		if(getequipisequiped(.@part) == 0) { // hacker has removed the item (not changed, why?)
			mes "[" + getarg(0) + "]";
			mes "Look here... you don't have any items on...";
			close;
		}
		if(getequiprefinerycnt(.@part) != .@refinerycnt || getequipid(.@part) != .@refineitemid) { // hacker has changed the item
			mes "[" + getarg(0) + "]";
			emotion e_an;
			mes "Wait a second...";
			mes "Do you think I'm stupid?!";
			mes "You switched the item while I wasn't looking! Get out of here!";
			close;
		}
		if(getarg(2) == 1){
			set .@rand,rand(1,3);
			if (.@rand == 1) {
				mes "Clang! Clang! Clang! Clang!";
				successrefitem .@part;
				next;
				emotion e_no1;
				mes "["+ getarg(0) +"]";
				mes "Good! Succes!!!";
				mes "I am the best Blacksmith.";
				close;
			}
			if (.@rand == 2) {
				mes "["+ getarg(0) +"]";
				mes "Clang! Clang! Clang! Clang!";
				downrefitem .@part;
				next;
				emotion (!rand(5))?e_cash:e_omg;
				mes "["+ getarg(0) +"]";
				mes "Ahhh!!!";
				next;
				mes "["+ getarg(0) +"]";
				mes "Oh my!";
				mes "The upgrade level has dropped...";
				mes "There could've been made an mistake even though I am the best ever.";
				mes "It was out of my hands.";
				next;
				mes "["+ getarg(0) +"]";
				mes "I will do a better job next time! Don't worry!";
				close;
			}
			mes "["+ getarg(0) +"]";
			mes "Clang! Clang! Clang!";
			failedrefitem .@part;
			next;
			emotion (!rand(5))?e_cash:e_omg;
			mes "["+ getarg(0) +"]";
			mes "Hmmm!";
			next;
			mes "["+ getarg(0) +"]";
			mes "Oh my! I've failed to refine stuff...";
			mes "I didn't mean it!";
			mes "There could've been made an mistake even though I am the best ever.";
			mes "It was out of my hands.";
			next;
			mes "["+ getarg(0) +"]";
			mes "I will do a better job next time! Don't worry!";
			close;
		}
		set .@rand,rand(100);
		if (getequippercentrefinery(.@part) > .@rand) {
			mes "Clang! Clang! Clang! Clang!";
			successrefitem .@part;
			next;
			emotion e_no1;
			mes "["+ getarg(0) +"]";
			mes "Good! Succes!!!";
			mes "I am the best Blacksmith.";
			close;
		}
		if (getequippercentrefinery(.@part) < .@rand) {
			mes "["+ getarg(0) +"]";
			mes "Clang! Clang! Clang! Clang!";
			downrefitem .@part;
			next;
			emotion (!rand(5))?e_cash:e_omg;
			mes "["+ getarg(0) +"]";
			mes "Ahhh!!!";
			next;
			mes "["+ getarg(0) +"]";
			mes "Oh my!";
			mes "The upgrade level has dropped...";
			mes "There could've been made an mistake even though I am the best ever.";
			mes "It was out of my hands.";
			next;
			mes "["+ getarg(0) +"]";
			mes "I will do a better job next time! Don't worry!";
			close;
		}
		mes "["+ getarg(0) +"]";
		mes "Clang! Clang! Clang!";
		failedrefitem .@part;
		next;
		emotion (!rand(5))?e_cash:e_omg;
		mes "["+ getarg(0) +"]";
		mes "Hmmm!";
		next;
		mes "["+ getarg(0) +"]";
		mes "Oh my! I've failed to refine stuff...";
		mes "I didn't mean it!";
		mes "There could've been made an mistake even though I am the best ever.";
		mes "It was out of my hands.";
		next;
		mes "["+ getarg(0) +"]";
		mes "I will do a better job next time! Don't worry!";
		close;
	}
// New +11 and above Refining Functions ========================
	if(getequiprefinerycnt(.@part) < .@safe) {
		mes "[" + getarg(0) + "]";
		mes "I can refine this to the safe limit or a desired number of times. It's your choice.";
		next;
		set .@menu2,select("To the safe limit, please.","I'll decide how many times.","I've changed my mind...");
	} else
		set .@menu2,2;
	switch(.@menu2){
	case 1: 
		set .@refinecnt,.@safe - getequiprefinerycnt(.@part);
		break;
	case 2:
		next;
		mes "[" + getarg(0) + "]";
		mes "How many times would you like me to refine your item?";
		next;
		input .@refinecnt;
		set .@refinecheck,.@refinecnt + getequiprefinerycnt(.@part);
		if (.@refinecnt < 1 || .@refinecheck > 10) {
			mes "[" + getarg(0) + "]";
			mes "I can't refine this item that many times.";
			close;
		}
		if(.@refinecheck > .@safe) {
			set .@refinecheck,.@refinecheck - .@safe;
			mes "[" + getarg(0) + "]";
			mes "This will try to refine the equipment " + .@refinecheck + " times past the safe limit. Your equipment may be destroyed... is that ok?";
			next;
			if(select("Yes...","No...") == 2){
				mes "[" + getarg(0) + "]";
				mes "You said so... So be it.";
				close;
			}
		}
		break;
	case 3:
		next;
		mes "[" + getarg(0) + "]";
		mes "You said so... So be it.";
		close;
	}
	set .@fullprice,.@price * .@refinecnt;
	mes "[" + getarg(0) + "]";
	mes "That will cost you " + .@refinecnt + " " + getitemname(.@material) + " and " + .@fullprice + " Zeny. Is that ok?";
	next;
	if(select("Yes","No...") == 2){
		mes "[" + getarg(0) + "]";
		mes "You said so... So be it.";
		close;
	}
	if(countitem(.@material) < .@refinecnt || Zeny < .@fullprice) {
		mes "[" + getarg(0) + "]";
		mes "Is that all you got? Unfortunately I can't work for you at a lower price. Try putting yourself in my shoes.";
		close;
	}
	set Zeny,Zeny - .@fullprice;
	delitem .@material,.@refinecnt;
	while(.@refinecnt){
		if (getequipisequiped(.@part) == 0) {
			mes "[" + getarg(0) + "]";
			mes "Look here... you don't have any items on...";
			close;
		}
		if (getequipid(.@part) != .@refineitemid || (.@menu2 == 1 && getequippercentrefinery(.@part) < 100)) {
			mes "[" + getarg(0) + "]";
			mes "Clang... No, but did you imagine I could be so stupid?!";
			mes "You changed it...";
			mes "Get out before I stun you with my Hammer!!";
			close;
		}
		if(getarg(2) == 1){
			set .@rand,rand(1,3);
			if (.@rand == 1) {
				mes "["+ getarg(0) +"]";
				mes "Clang! Clang! Clang! Clang!";
				successrefitem .@part;
				next;
				emotion e_no1;
				mes "["+ getarg(0) +"]";
				mes "Good! Succes!!!";
				mes "I am the best Blacksmith.";
				close;
			}
			if (.@rand == 2) {
				mes "["+ getarg(0) +"]";
				mes "Clang! Clang! Clang! Clang!";
				downrefitem .@part;
				next;
				emotion (!rand(5))?e_cash:e_omg;
				mes "["+ getarg(0) +"]";
				mes "Ahhh!!!";
				next;
				mes "["+ getarg(0) +"]";
				mes "Oh my!";
				mes "The upgrade level has dropped...";
				mes "There could've been made an mistake even though I am the best ever.";
				mes "It was out of my hands.";
				next;
				mes "["+ getarg(0) +"]";
				mes "I will do a better job next time! Don't worry!";
				close;
			}
			mes "["+ getarg(0) +"]";
			mes "Clang! Clang! Clang!";
			failedrefitem .@part;
			next;
			emotion (!rand(5))?e_cash:e_omg;
			mes "["+ getarg(0) +"]";
			mes "Hmmm!";
			next;
			mes "["+ getarg(0) +"]";
			mes "Oh my! I've failed to refine stuff...";
			mes "I didn't mean it!";
			mes "There could've been made an mistake even though I am the best ever.";
			mes "It was out of my hands.";
			next;
			mes "["+ getarg(0) +"]";
			mes "I will do a better job next time! Don't worry!";
			close;
		}
		set .@rand,rand(100);
		if (getequippercentrefinery(.@part) > .@rand) {
			mes "Clang! Clang! Clang! Clang!";
			successrefitem .@part;
			next;
			emotion e_no1;
			mes "["+ getarg(0) +"]";
			mes "Good! Succes!!!";
			mes "I am the best Blacksmith.";
			close;
		}
		if (getequippercentrefinery(.@part) < .@rand) {
			mes "["+ getarg(0) +"]";
			mes "Clang! Clang! Clang! Clang!";
			downrefitem .@part;
			next;
			emotion (!rand(5))?e_cash:e_omg;
			mes "["+ getarg(0) +"]";
			mes "Ahhh!!!";
			next;
			mes "["+ getarg(0) +"]";
			mes "Oh my!";
			mes "The upgrade level has dropped...";
			mes "There could've been made an mistake even though I am the best ever.";
			mes "It was out of my hands.";
			next;
			mes "["+ getarg(0) +"]";
			mes "I will do a better job next time! Don't worry!";
			close;
		}
		mes "["+ getarg(0) +"]";
		mes "Clang! Clang! Clang!";
		failedrefitem .@part;
		next;
		emotion (!rand(5))?e_cash:e_omg;
		mes "["+ getarg(0) +"]";
		mes "Hmmm!";
		next;
		mes "["+ getarg(0) +"]";
		mes "Oh my! I've failed to refine stuff...";
		mes "I didn't mean it!";
		mes "There could've been made an mistake even though I am the best ever.";
		mes "It was out of my hands.";
		next;
		mes "["+ getarg(0) +"]";
		mes "I will do a better job next time! Don't worry!";
		close;
	}
	mes "[" + getarg(0) + "]";
	mes "All finished... Come again soon.";
	close;
}

// Ori/Elu to Carnium/Bradium Refiners
//============================================================
-	script	Austry#ref	-1,{
	mes "[Austry]";
	mes "If you bring me 3";
	mes "Oridecon or Elunium";
	mes "I can exchange them for";
	mes "Bradium or Carnium.";
	mes "Just give me 50,000z.";
	next;
	switch(select("Oridecon to Bradium.:Elunium to Carnium.:Purified Bradium to Carnium.:No thanks.")) {
	case 1:
		setarray .@i[0],984,3,6224;  //Oridecon -> Bradium
		break;
	case 2:
		setarray .@i[0],985,3,6223;  //Elunium -> Carnium
		break;
	case 3:
		setarray .@i[0],6090,1,6223; //Purified_Bradium -> Carnium
		break;
	case 4:
		mes "[Austry]";
		mes "Hmm...";
		close;
	}
	if (countitem(.@i[0]) >= .@i[1] && Zeny >= 50000) {
		delitem .@i[0],.@i[1];
		set Zeny, Zeny - 50000;
		getitem .@i[2],1;
		mes "[Austry]";
		if (.@i[0] == 6090) {
			mes "Refining with Purified Bradium";
			mes "is a little expensive. I can";
			mes "trade it for some Carnium.";
		} else
			mes "Ok! Here is your "+getitemname(.@i[2])+".";
		mes "Take it and use it well.";
		close;
	}
	mes "[Austry]";
	mes "You better not be trying";
	mes "to cheat me because you";
	mes "don't have enough zeny";
	mes "or "+getitemname(.@i[0])+".";
	close;
}
prt_in,85,71,5	duplicate(Austry#ref)	Austry#prt	826
payon_in01,14,125,5	duplicate(Austry#ref)	Austry#pay	826
morocc_in,60,38,5	duplicate(Austry#ref)	Austry#moc	826