summaryrefslogtreecommitdiff
path: root/npc/re/merchants/enchan_mal.txt
blob: e921a73363220521fb8ab7413445ae40b510ebde (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
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
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
//================= Hercules Script =======================================
//=       _   _                     _
//=      | | | |                   | |
//=      | |_| | ___ _ __ ___ _   _| | ___  ___
//=      |  _  |/ _ \ '__/ __| | | | |/ _ \/ __|
//=      | | | |  __/ | | (__| |_| | |  __/\__ \
//=      \_| |_/\___|_|  \___|\__,_|_|\___||___/
//================= License ===============================================
//= This file is part of Hercules.
//= http://herc.ws - http://github.com/HerculesWS/Hercules
//=
//= Copyright (C) 2012-2015  Hercules Dev Team
//= Copyright (C)  Euphy
//= Copyright (C)  Muad_Dib
//=
//= Hercules is free software: you can redistribute it and/or modify
//= it under the terms of the GNU General Public License as published by
//= the Free Software Foundation, either version 3 of the License, or
//= (at your option) any later version.
//=
//= This program is distributed in the hope that it will be useful,
//= but WITHOUT ANY WARRANTY; without even the implied warranty of
//= MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//= GNU General Public License for more details.
//=
//= You should have received a copy of the GNU General Public License
//= along with this program.  If not, see <http://www.gnu.org/licenses/>.
//=========================================================================
//= Malangdo Enchants
//================= Description ===========================================
//= Adds enchantments to many high level weapons in exchange for Malangdo
//= coins.
//================= Current Version =======================================
//= 1.0a
//=========================================================================

malangdo,213,167,4	script	Mayomayo#mal	4_CAT_3COLOR,{
	disable_items;
	if (checkweight(Knife,1) == 0) {
		mes "You have too many kinds of objects. Let's try to continue after reducing those objects.";
		close;
	}
	if (MaxWeight - Weight < 10000) {
		mes "Can't continue because you have too many heavy objects. Let's try to continue after reducing the weight.";
		close;
	}
	mes "[Mayomayo]";
	mes "Wow welcome. It is new Mayomayo refinement store~ I enchant some luxury weapons including level 4 weapons.";
	next;
	switch(select("Any store policy changes?", "Enchant High Ranked Weapon", "Initialize Enchant (Need Silvervine Fruit)")) {
	case 1:
		mes "[Mayomayo]";
		mes "When I enchant weapons, the slotted cards or refined level are dissipated sometimes. I hated it. However, one day I found how to do it without any extinction.";
		next;
		mes "[Mayomayo]";
		mes "Have you ever seen a building of person of reinforcement capacity association?";
		next;
		if(select("I've seen it before.", "I haven't seen it before.") == 2) {
			mes "[Mayomayo]";
			mes "That builiding is located to the southeast of where I am. Why don't you go on a field trip there?";
			close;
		}
		mes "[Mayomayo]";
		mes "If you go to the place, there is someone who enchants the Archangel Wing. At that time that was amazing, because that was impossible ability by my own skill.";
		next;
		mes "[Mayomayo]";
		mes "Every night I became his butler and did odd jobs. That is how I learned to enchant.";
		next;
		mes "[Mayomayo]";
		mes "Several rules are changed. Well, you better have experience.";
		close;
	case 2:
		@mal_enchant_select = 1;
		break;
	case 3:
		@mal_enchant_select = 2;
		break;
	}

	if (!getequipisequiped(EQI_HAND_R)) {
		mes "[Mayomayo]";
		mes "Did you take off your equipment?";
		@mal_enchant_select = 0;
		close;
	}
	@mal_equip_id = getequipid(EQI_HAND_R);
	.@equip_type = getiteminfo(@mal_equip_id, ITEMINFO_SUBTYPE);

	//callsub L_Socket,<cost multiplier>,<4-x enchants possible>;
	switch(.@equip_type) { // Check weapon type first to speed up the checks.
	case W_DAGGER: // Daggers
		switch(@mal_equip_id) {
			case 1224: callsub L_Socket,1,2; //Sword_Breaker
			case 1225: callsub L_Socket,1,2; //Mail_Breaker
			case 1227: callsub L_Socket,1,2; //Weeder_Knife
			case 1229: callsub L_Socket,1,2; //Mamas_Knife
			case 1232: callsub L_Socket,1,2; //Assasin_Dagger
			case 1233: callsub L_Socket,1,2; //Exercise
			case 1235: callsub L_Socket,1,2; //Azoth
			case 1236: callsub L_Socket,1,2; //Sucsamad
			case 1237: callsub L_Socket,1,2; //Grimtooth_
			case 1240: callsub L_Socket,1,2; //Princess_Knife
			case 1241: callsub L_Socket,1,2; //Cursed_Dagger
			case 1242: callsub L_Socket,1,2; //Counter_Dagger
			case 1244: callsub L_Socket,1,2; //Holy_Dagger
			case 13046: callsub L_Socket,1,3; //Krieg
			case 13047: callsub L_Socket,1,2; //Weihna
			case 13061: callsub L_Socket,1,2; //Black_Wing
			case 1223: callsub L_Socket,2,2; //Forturn_Sword
			case 1228: callsub L_Socket,2,2; //Combat_Knife
			case 1234: callsub L_Socket,2,2; //Moonlight_Sword
			case 1230: callsub L_Socket,4,2; //House_Auger
			case 1231: callsub L_Socket,4,2; //Bazerald
			case 13062: callsub L_Socket,4,2; //Ancient_Dagger
		}
		break;
	case W_KATAR: // Katars
		switch(@mal_equip_id) {
			case 1271: callsub L_Socket,1,2; //Blood_Tears
			case 1263: callsub L_Socket,1,2; //Unholy_Touch
			case 1270: callsub L_Socket,1,2; //Drill_Katar
			case 1284: callsub L_Socket,1,2; //Krishna
			case 1285: callsub L_Socket,1,2; //Cakram
			case 1268: callsub L_Socket,2,2; //Wild_Beast_Claw
			case 1269: callsub L_Socket,2,2; //Inverse_Scale
			case 1265: callsub L_Socket,2,2; //Bloody_Roar
			case 1261: callsub L_Socket,4,2; //Infiltrator
			case 1266: callsub L_Socket,4,2; //Infiltrator_
		}
		break;
	case W_1HAXE: // 1-H Axes
		switch(@mal_equip_id) {
			case 1305: callsub L_Socket,1,2; //Cleaver
			case 1311: callsub L_Socket,1,2; //Vecer_Axe
		}
		break;
	case W_2HAXE: // 2-H Axes
		switch(@mal_equip_id) {
			case 1364: callsub L_Socket,1,2; //Great_Axe
			case 1365: callsub L_Socket,1,2; //Sabbath
			case 1385: callsub L_Socket,1,2; //Bradium_Stonehammer
			case 1367: callsub L_Socket,1,2; //Slaughter
			case 1368: callsub L_Socket,1,2; //Tomahawk
			case 1387: callsub L_Socket,2,2; //Giant_Axe
			case 1369: callsub L_Socket,2,2; //Guillotine
			case 1363: callsub L_Socket,2,2; //Brood_Axe
			case 1376: callsub L_Socket,4,2; //Heart_Breaker
			case 1377: callsub L_Socket,4,2; //Hurricane_Fury
			case 1366: callsub L_Socket,4,2; //Right_Epsilon
			case 1370: callsub L_Socket,4,2; //Doom_Slayer
			case 1371: callsub L_Socket,4,2; //Doom_Slayer_
		}
		break;
	case W_1HSWORD: // 1-H Swords
		switch(@mal_equip_id) {
			case 1131: callsub L_Socket,1,2; //Ice_Falchon
			case 1133: callsub L_Socket,1,2; //Fire_Brand
			case 1134: callsub L_Socket,1,2; //Scissores_Sword
			case 1135: callsub L_Socket,1,2; //Cutlas
			case 1136: callsub L_Socket,1,2; //Solar_Sword
			case 1138: callsub L_Socket,1,2; //Mysteltainn_
			case 1139: callsub L_Socket,1,2; //Tale_Fing_
			case 1140: callsub L_Socket,1,2; //Byeorrun_Gum
			case 1141: callsub L_Socket,1,2; //Immaterial_Sword
			case 1148: callsub L_Socket,1,2; //Star_Dust_Blade
			case 13421: callsub L_Socket,1,2; //Ruber
			case 13431: callsub L_Socket,2,2; //Chrome_Sword
			case 1137: callsub L_Socket,2,2; //Excalibur
			case 1130: callsub L_Socket,2,2; //Nagan
			case 1132: callsub L_Socket,4,2; //Edge
		}
		break;
	case W_2HSWORD: // 2-H Swords
		switch(@mal_equip_id) {
			case 1164: callsub L_Socket,1,2; //Muramasa
			case 1166: callsub L_Socket,1,2; //Dragon_Slayer
			case 1167: callsub L_Socket,1,2; //Schweizersabel
			case 1168: callsub L_Socket,1,2; //Zweihander
			case 1170: callsub L_Socket,1,2; //Katzbalger
			case 1171: callsub L_Socket,1,2; //Zweihander_
			case 1176: callsub L_Socket,1,2; //Muscle_Cutter
			case 1178: callsub L_Socket,1,2; //Schweizersabel_
			case 1180: callsub L_Socket,1,2; //Dragon_Slayer_
			case 1181: callsub L_Socket,1,2; //Tae_Goo_Lyeon
			case 1182: callsub L_Socket,1,2; //Bloody_Eater
			case 1188: callsub L_Socket,1,2; //Veteran_Sword
			case 1189: callsub L_Socket,1,3; //Krasnaya
			case 1196: callsub L_Socket,2,2; //Chrome_Twohand_Sword
			case 1165: callsub L_Socket,2,2; //Masamune
			case 1169: callsub L_Socket,2,2; //Executioner_
			case 1179: callsub L_Socket,2,2; //Executioner__
			case 1175: callsub L_Socket,2,2; //Altas_Weapon
			case 1185: callsub L_Socket,4,2; //Violet_Fear
			case 1186: callsub L_Socket,4,2; //Death_Guidance
		}
		break;
	case W_1HSPEAR: // 1-H Spears
		switch(@mal_equip_id) {
			case 1420: callsub L_Socket,1,2; //Long_Horn
			case 1413: callsub L_Socket,1,2; //Gungnir
			case 1414: callsub L_Socket,1,2; //Gelerdria
			case 1416: callsub L_Socket,1,2; //Tjungkuletti
			case 1418: callsub L_Socket,1,2; //Gungnir_
			case 1433: callsub L_Socket,2,2; //Imperial_Spear
			case 1415: callsub L_Socket,2,2; //Skewer
			case 1421: callsub L_Socket,2,2; //Battle_Hook
			case 1422: callsub L_Socket,4,2; //Hunting_Spear
		}
		break;
	case W_2HSPEAR: // 2-H Spears
		switch(@mal_equip_id) {
			case 1466: callsub L_Socket,1,2; //Crescent_Scythe
			case 1467: callsub L_Socket,1,2; //Bill_Guisarme
			case 1468: callsub L_Socket,1,2; //Zephyrus
			case 1469: callsub L_Socket,1,2; //Longinuss_Spear
			case 1470: callsub L_Socket,1,2; //Brionac
			case 1471: callsub L_Socket,1,2; //Hell_Fire
			case 1474: callsub L_Socket,1,2; //Gae_Bolg
			case 1477: callsub L_Socket,1,2; //Spectral_Spear
			case 1478: callsub L_Socket,1,2; //Ahlspiess
			case 1479: callsub L_Socket,1,2; //Spectral_Spear_
			case 1480: callsub L_Socket,1,2; //Gae_Bolg_
			case 1481: callsub L_Socket,1,3; //Zephyrus_
			case 1484: callsub L_Socket,2,2; //Cardo
		}
		break;
	case W_STAFF: // Staves
		switch(@mal_equip_id) {
			case 1616: callsub L_Socket,1,2; //Staff_Of_Wing
			case 1629: callsub L_Socket,1,2; //Walking_Stick
			case 1631: callsub L_Socket,1,2; //Holy_Stick
			case 1643: callsub L_Socket,1,2; //Dead_Tree_Cane
			case 1654: callsub L_Socket,1,2; //Mental_Stick
			case 1636: callsub L_Socket,2,2; //Thorn_Staff
			case 1637: callsub L_Socket,2,2; //Eraser
			case 1473: callsub L_Socket,1,2; //Wizardy_Staff
		}
		break;
	case W_2HSTAFF: // New 2-H Staves
		switch(@mal_equip_id) {
			case 2004: callsub L_Socket,1,2; //Kronos
			case 2005: callsub L_Socket,1,2; //Dea_Staff
			case 2001: callsub L_Socket,2,2; //Divine_Cross
			case 2000: callsub L_Socket,4,2; //Destruction_Rod
		}
		break;
	case W_MACE: // Maces
		switch(@mal_equip_id) {
			case 1524: callsub L_Socket,1,2; //Golden_Mace
			case 1525: callsub L_Socket,1,2; //Long_Mace
			case 1527: callsub L_Socket,1,2; //Quadrille
			case 1539: callsub L_Socket,1,2; //Golden_Mace_
			case 1541: callsub L_Socket,1,2; //Nemesis
			case 16000: callsub L_Socket,1,2; //Erde
			case 16001: callsub L_Socket,1,2; //Red_Square_Bag
			case 16010: callsub L_Socket,1,2; //Red_Ether_Bag
			case 1523: callsub L_Socket,2,2; //Spike
			case 1538: callsub L_Socket,2,2; //Spike_
			case 1526: callsub L_Socket,2,2; //Slash
			case 1528: callsub L_Socket,4,2; //Grand_Cross
			case 1540: callsub L_Socket,4,2; //Grand_Cross_
		}
		break;
	case W_BOOK: // Books
		switch(@mal_equip_id) {
			case 1557: callsub L_Socket,1,2; //Book_Of_The_Apocalypse
			case 1558: callsub L_Socket,1,2; //Girls_Diary
			case 1559: callsub L_Socket,1,2; //Legacy_Of_Dragon
			case 1561: callsub L_Socket,1,2; //Hardback
			case 1562: callsub L_Socket,1,2; //Bible_Of_Battlefield
			case 1565: callsub L_Socket,4,2; //Death_Note
		}
		break;
	case W_KNUCKLE: // Knuckles
		switch(@mal_equip_id) {
			case 1813: callsub L_Socket,1,2; //Kaiser_Knuckle
			case 1814: callsub L_Socket,1,2; //Berserk
			case 1815: callsub L_Socket,1,2; //Claw_Of_Garm
			case 1816: callsub L_Socket,1,2; //Berserk_
			case 1830: callsub L_Socket,2,2; //Sura_Rampage
		}
		break;
	case W_BOW: // Bows
		switch(@mal_equip_id) {
			case 1719: callsub L_Socket,1,2; //Bow_Of_Roguemaster
			case 1722: callsub L_Socket,1,2; //Balistar
			case 1724: callsub L_Socket,1,2; //Dragon_Wing
			case 1725: callsub L_Socket,1,2; //Bow_Of_Minstrel
			case 1727: callsub L_Socket,1,2; //Balistar_
			case 1737: callsub L_Socket,1,2; //Ixion_Wing
			case 1740: callsub L_Socket,1,2; //Nepenthes_Bow
			case 1741: callsub L_Socket,1,2; //Cursed_Lyre
			case 1745: callsub L_Socket,1,2; //Falken_Blitz
			case 18103: callsub L_Socket,1,2; //Mystic_Bow
			case 1720: callsub L_Socket,2,2; //Bow_Of_Rudra
		}
		break;
	case W_MUSICAL: // Musical Instruments
		switch(@mal_equip_id) {
			case 1913: callsub L_Socket,1,2; //Electronic_Guitar
			case 1918: callsub L_Socket,1,2; //Oriental_Lute
			case 1920: callsub L_Socket,1,2; //Berserk_Guitar
			case 1922: callsub L_Socket,1,2; //Oriental_Lute_
			case 1926: callsub L_Socket,1,2; //Harp_Of_Nepenthes
			case 1930: callsub L_Socket,2,2; //Green_Whistle
		}
		break;
	case W_WHIP: // Whips
		switch(@mal_equip_id) {
			case 1962: callsub L_Socket,1,2; //Lariat
			case 1963: callsub L_Socket,1,2; //Rapture_Rose
			case 1964: callsub L_Socket,1,2; //Chemeti
			case 1969: callsub L_Socket,1,2; //Bladed_Whip
			case 1970: callsub L_Socket,1,2; //Queens_Whip
			case 1972: callsub L_Socket,1,2; //Electric_Eel
			case 1973: callsub L_Socket,1,2; //Sea_Witch_Foot
			case 1974: callsub L_Socket,1,2; //Carrot_Whip
			case 1976: callsub L_Socket,1,2; //Queens_Whip_
			case 1979: callsub L_Socket,1,2; //Stem_Of_Nepenthes
			case 1984: callsub L_Socket,2,2; //Stem_Whip
			case 1985: callsub L_Socket,4,2; //Rosebine
		}
		break;
	case W_2HMACE:
	case W_REVOLVER:
	case W_RIFLE:
	case W_GATLING:
	case W_SHOTGUN:
	case W_GRENADE:
	case W_HUUMA:
		break;
	}
	mes "[Mayomayo]";
	if (@mal_enchant_select == 1)
		mes "This is not a suitable equipment for the enchant. Don't forget we only take care of high class weapons, including level 4 weapons~";
	else
		mes "This equipment can not be initialized. Don't forget we only handle some luxury weapons, including level 4 weapons~";
	@mal_equip_id = 0;
	@mal_enchant_select = 0;
	close;

L_Socket:
	.@select = @mal_enchant_select;
	.@equip_id = @mal_equip_id;
	.@equip_name$ = getitemname(.@equip_id)+((getitemslots(.@equip_id))?"["+getitemslots(.@equip_id)+"]":"");
	.@equip_refine = getequiprefinerycnt(EQI_HAND_R);
	setarray .@equip_card[0], getequipcardid(EQI_HAND_R,0),getequipcardid(EQI_HAND_R,1),getequipcardid(EQI_HAND_R,2),getequipcardid(EQI_HAND_R,3);
	@mal_equip_id = 0;
	@mal_enchant_select = 0;

	if (.@select == 1) {
		mes "[Mayomayo]";
		mes "^0000ff"+.@equip_name$+"^000000! Do you want to enchant this equipment? How will you pay for this?";
		next;

		setarray .@coin[0],6422,6421,6420,6419,6418,6423; // Payment ID
		setarray .@cost[0],  15,  10,   6,   3,   2,   1; // Payment multiplier

		.@menu$ = "Stop:";
		for(.@i = 0; .@i<getarraysize(.@coin); ++.@i) {
			.@count[.@i] = countitem(.@coin[.@i]);
			.@total[.@i] = getarg(0)*.@cost[.@i];
			if (.@count[.@i] < .@total[.@i])
				.@menu$ += "^999999"+getitemname(.@coin[.@i])+" (missing "+(.@total[.@i]-.@count[.@i])+")^000000:";
			else
				.@menu$ += getitemname(.@coin[.@i])+" (have "+.@count[.@i]+", need "+.@total[.@i]+"):";
		}
		.@coin_select = select(.@menu$)-2;
		if (.@coin_select == -1) {
			mes "[Mayomayo]";
			mes "Come back again if you change your mind.";
			close;
		} else if (.@count[.@coin_select] < .@total[.@coin_select]) {
			mes "[Mayomayo]";
			mes "You don't have enough coins. Do you want to check again?";
			close;
		}
		switch(.@coin_select) {
		case 0: //Egrade_Coin
			.@enchant_type = 10;
			break;
		case 1: //Dgrade_Coin
			.@enchant_type = 9;
			break;
		case 2: //Cgrade_Coin
			.@enchant_type = 8;
			break;
		case 3: //Bgrade_Coin
			.@enchant_type = 7;
			break;
		case 4: //Agrade_Coin
		case 5: //Anger_Seagod
			mes "[Mayomayo]";
			mes "When you use the "+getitemname(.@coin[.@coin_select])+", you can choose the enchant type.";
			next;
			switch(select("Stop", "Short Range Type", "Long Range Type", "Caster Type")) {
			case 1:
				mes "[Mayomayo]";
				mes "Ok. If you change your mind, let me know.";
				close;
			case 2:
				.@enchant_type = ((.@coin_select == 4)?4:1);
				break;
			case 3:
				.@enchant_type = ((.@coin_select == 4)?5:2);
				break;
			case 4:
				.@enchant_type = ((.@coin_select == 4)?6:3);
				break;
			}
			break;
		}
		if (.@equip_card[3] == 0 && getarg(1) < 4) {
			.@socket = 4;
			.@str$ = "1st";
		} else if (.@equip_card[2] == 0 && getarg(1) < 3) {
			.@socket = 3;
			.@str$ = "2nd";
		} else {
			mes "[Mayomayo]";
			mes "This equipment is at the end of enchant. Please initialize the enchant and you will be able to enchant it again, or bring another weapon.";
			close;
		}
		mes "[Mayomayo]";
		mes "I'm trying for the "+.@str$+" enchant. ^ff0000It will not touch previous refinement and cards. Also, the equipment will not be destroyed.^000000 Can I continue?";
		next;
		if(select("I'll come back later.", "Please, continue.") == 1) {
			mes "[Mayomayo]";
			mes "Ok. If you change your mind, come back again.";
			close;
		}
		switch(.@enchant_type) {
		case 10: //Egrade_Coin
			.@i = rand(1,531);
			     if (.@i < 101) .@enchant = 4787; //Mdef4
			else if (.@i < 201) .@enchant = 4792; //Def6
			else if (.@i < 301) .@enchant = 4801; //SP100
			else if (.@i < 351) .@enchant = 4795; //HP100
			else if (.@i < 401) .@enchant = 4796; //HP200
			else if (.@i < 451) .@enchant = 4819; //Atk1
			else if (.@i < 476) .@enchant = 4720; //Dexterity1
			else if (.@i < 501) .@enchant = 4740; //Vitality1
			else if (.@i < 526) .@enchant = 4750; //Luck1
			else if (.@i < 528) .@enchant = 4700; //Strength1
			else if (.@i < 530) .@enchant = 4730; //Agility1
			else if (.@i < 532) .@enchant = 4710; //Inteligence1
			else .@enchant = 9;
			break;
		case 9: //Dgrade_Coin
			.@i = rand(1,531);
			     if (.@i < 101) .@enchant = 4795; //HP100
			else if (.@i < 201) .@enchant = 4796; //HP200
			else if (.@i < 301) .@enchant = 4819; //Atk1
			else if (.@i < 351) .@enchant = 4720; //Dexterity1
			else if (.@i < 401) .@enchant = 4740; //Vitality1
			else if (.@i < 451) .@enchant = 4750; //Luck1
			else if (.@i < 476) .@enchant = 4700; //Strength1
			else if (.@i < 501) .@enchant = 4730; //Agility1
			else if (.@i < 526) .@enchant = 4710; //Inteligence1
			else if (.@i < 528) .@enchant = 4701; //Strength2
			else if (.@i < 530) .@enchant = 4731; //Agility2
			else if (.@i < 532) .@enchant = 4711; //Inteligence2
			else .@enchant = 9;
			break;
		case 8: //Cgrade_Coin
			.@i = rand(1,531);
			     if (.@i < 101) .@enchant = 4720; //Dexterity1
			else if (.@i < 201) .@enchant = 4740; //Vitality1
			else if (.@i < 301) .@enchant = 4750; //Luck1
			else if (.@i < 351) .@enchant = 4700; //Strength1
			else if (.@i < 401) .@enchant = 4730; //Agility1
			else if (.@i < 451) .@enchant = 4710; //Inteligence1
			else if (.@i < 476) .@enchant = 4701; //Strength2
			else if (.@i < 501) .@enchant = 4731; //Agility2
			else if (.@i < 526) .@enchant = 4711; //Inteligence2
			else if (.@i < 528) .@enchant = 4702; //Strength3
			else if (.@i < 530) .@enchant = 4732; //Agility3
			else if (.@i < 532) .@enchant = 4712; //Inteligence3
			else .@enchant = 9;
			break;
		case 7: //Bgrade_Coin
			.@i = rand(1,531);
			     if (.@i < 101) .@enchant = 4700; //Strength1
			else if (.@i < 201) .@enchant = 4730; //Agility1
			else if (.@i < 301) .@enchant = 4710; //Inteligence1
			else if (.@i < 351) .@enchant = 4701; //Strength2
			else if (.@i < 401) .@enchant = 4731; //Agility2
			else if (.@i < 451) .@enchant = 4711; //Inteligence2
			else if (.@i < 476) .@enchant = 4702; //Strength3
			else if (.@i < 501) .@enchant = 4732; //Agility3
			else if (.@i < 526) .@enchant = 4712; //Inteligence3
			else if (.@i < 528) .@enchant = 4703; //Strength4
			else if (.@i < 530) .@enchant = 4733; //Agility4
			else if (.@i < 532) .@enchant = 4713; //Inteligence4
			else .@enchant = 9;
			break;
		case 6: //Agrade_Coin - Caster
			.@i = rand(1,555);
			     if (.@i < 81)  .@enchant = 4711; //Inteligence2
			else if (.@i < 161) .@enchant = 4721; //Dexterity2
			else if (.@i < 241) .@enchant = 4814; //Spell2
			else if (.@i < 311) .@enchant = 4712; //Inteligence3
			else if (.@i < 371) .@enchant = 4722; //Dexterity3
			else if (.@i < 431) .@enchant = 4813; //Spell3
			else if (.@i < 476) .@enchant = 4713; //Inteligence4
			else if (.@i < 516) .@enchant = 4812; //Spell4
			else if (.@i < 526) .@enchant = 4760; //Matk1
			else if (.@i < 546) .@enchant = 4714; //Inteligence5
			else if (.@i < 551) .@enchant = 4826; //Spell5
			else if (.@i < 556) .@enchant = 4761; //Matk2
			else .@enchant = 9;
			break;
		case 5: //Agrade_Coin - Long Range
			.@i = rand(1,555);
			     if (.@i < 81)  .@enchant = 4731; //Agility2
			else if (.@i < 161) .@enchant = 4833; //Expert_Archer2
			else if (.@i < 241) .@enchant = 4817; //Sharp2
			else if (.@i < 311) .@enchant = 4732; //Agility3
			else if (.@i < 371) .@enchant = 4834; //Expert_Archer3
			else if (.@i < 431) .@enchant = 4816; //Sharp3
			else if (.@i < 476) .@enchant = 4733; //Agility4
			else if (.@i < 516) .@enchant = 4835; //Expert_Archer4
			else if (.@i < 526) .@enchant = 4807; //Atk_Speed1
			else if (.@i < 546) .@enchant = 4734; //Agility5
			else if (.@i < 551) .@enchant = 4836; //Expert_Archer5
			else if (.@i < 556) .@enchant = 4807; //Atk_Speed1
			else .@enchant = 9;
			break;
		case 4: //Agrade_Coin - Short Range
			.@i = rand(1,555);
			     if (.@i < 81)  .@enchant = 4731; //Agility2
			else if (.@i < 161) .@enchant = 4808; //Fighting_Spirit4
			else if (.@i < 241) .@enchant = 4817; //Sharp2
			else if (.@i < 311) .@enchant = 4732; //Agility3
			else if (.@i < 371) .@enchant = 4820; //Fighting_Spirit5
			else if (.@i < 431) .@enchant = 4816; //Sharp3
			else if (.@i < 476) .@enchant = 4733; //Agility4
			else if (.@i < 516) .@enchant = 4821; //Fighting_Spirit6
			else if (.@i < 526) .@enchant = 4807; //Atk_Speed1
			else if (.@i < 546) .@enchant = 4734; //Agility5
			else if (.@i < 551) .@enchant = 4822; //Fighting_Spirit7
			else if (.@i < 556) .@enchant = 4807; //Atk_Speed1
			else .@enchant = 9;
			break;
		case 3: //Anger_Seagod - Caster
			.@i = rand(1,555);
			     if (.@i < 81)  .@enchant = 4712; //Inteligence3
			else if (.@i < 161) .@enchant = 4722; //Dexterity3
			else if (.@i < 241) .@enchant = 4813; //Spell3
			else if (.@i < 311) .@enchant = 4713; //Inteligence4
			else if (.@i < 371) .@enchant = 4812; //Spell4
			else if (.@i < 431) .@enchant = 4760; //Matk1
			else if (.@i < 476) .@enchant = 4714; //Inteligence5
			else if (.@i < 516) .@enchant = 4826; //Spell5
			else if (.@i < 526) .@enchant = 4761; //Matk2
			else if (.@i < 546) .@enchant = 4715; //Inteligence6
			else if (.@i < 551) .@enchant = 4827; //Spell6
			else if (.@i < 556) .@enchant = 4761; //Matk2
			else .@enchant = 9;
			break;
		case 2: //Anger_Seagod - Long Range
			.@i = rand(1,555);
			     if (.@i < 81)  .@enchant = 4732; //Agility3
			else if (.@i < 161) .@enchant = 4834; //Expert_Archer3
			else if (.@i < 241) .@enchant = 4843; //Sharp4
			else if (.@i < 311) .@enchant = 4733; //Agility4
			else if (.@i < 371) .@enchant = 4835; //Expert_Archer4
			else if (.@i < 431) .@enchant = 4844; //Sharp5
			else if (.@i < 476) .@enchant = 4734; //Agility5
			else if (.@i < 516) .@enchant = 4836; //Expert_Archer5
			else if (.@i < 526) .@enchant = 4807; //Atk_Speed1
			else if (.@i < 546) .@enchant = 4735; //Agility6
			else if (.@i < 551) .@enchant = 4837; //Expert_Archer6
			else if (.@i < 556) .@enchant = 4807; //Atk_Speed1
			else .@enchant = 9;
			break;
		case 1: //Anger_Seagod - Short Range
			.@i = rand(1,555);
			     if (.@i < 81)  .@enchant = 4732; //Agility3
			else if (.@i < 161) .@enchant = 4820; //Fighting_Spirit5
			else if (.@i < 241) .@enchant = 4843; //Sharp4
			else if (.@i < 311) .@enchant = 4733; //Agility4
			else if (.@i < 371) .@enchant = 4821; //Fighting_Spirit6
			else if (.@i < 431) .@enchant = 4844; //Sharp5
			else if (.@i < 476) .@enchant = 4734; //Agility5
			else if (.@i < 516) .@enchant = 4822; //Fighting_Spirit7
			else if (.@i < 526) .@enchant = 4807; //Atk_Speed1
			else if (.@i < 546) .@enchant = 4735; //Agility6
			else if (.@i < 551) .@enchant = 4823; //Fighting_Spirit8
			else if (.@i < 556) .@enchant = 4807; //Atk_Speed1
			else .@enchant = 9;
			break;
		default:
			mes "[Mayomayo]";
			mes "There is something wrong. Please try again.";
			close;
		}
		     if (.@equip_card[3] == 0 && getarg(1) < 4) .@equip_card[3] = .@enchant;
		else if (.@equip_card[2] == 0 && getarg(1) < 3) .@equip_card[2] = .@enchant;
		else if (.@equip_card[1] == 0 && getarg(1) < 2) .@equip_card[1] = .@enchant;
		else if (.@equip_card[0] == 0 && getarg(1) < 1) .@equip_card[0] = .@enchant;
		else {
			mes "[Mayomayo]";
			mes "This equipment is at the end of enchant. I provide enchant for two times maximum.";
			next;
			mes "[Mayomayo]";
			mes "Surely I don't enchant at card socket, therefore weapons that have 3 slots can be enchanted only 1 time. Don't forget this~";
			close;
		}
		if (.@enchant == 9) { // Should never happen.
			specialeffect(EF_SUI_EXPLOSION, AREA, playerattached());
			mes "[Mayomayo]";
			mes "Oh my god!";
			mes "This equipment is destroyed because it could not endure powerful ability. I'm so sorry.";
			delitem .@coin[.@coin_select],.@total[.@coin_select];
			delequip EQI_HAND_R;
			close;
		}
		specialeffect(EF_REPAIRWEAPON, AREA, playerattached());
		mes "[Mayomayo]";
		mes "I have enchanted ^990000slot "+.@socket+"^000000 of this equipment.";
		delitem .@coin[.@coin_select],.@total[.@coin_select];
		delequip EQI_HAND_R;

		// GetNonSlotItemSock2 .@equip_refine .@equip_id .@equip_card[0] .@equip_card[1] .@equip_card[2] .@equip_card[3]
		getitem2 .@equip_id,1,1,.@equip_refine,0,.@equip_card[0],.@equip_card[1],.@equip_card[2],.@equip_card[3];

		close;
	} else if (.@select == 2) {
		mes "[Mayomayo]";
		mes "I will only initialize the enchant effect without touching previous refined level and cards.";
		next;
		if(select("Stop", "Continue") == 1) {
			mes "[Mayomayo]";
			mes "If you change your mind, come back anytime.";
			close;
		}
		if (countitem(Silvervine) == 0) {
			mes "[Mayomayo]";
			mes "I'm sorry. You don't have Silvervine Fruit. Please check your inventory again?";
			close;
		}
		if (!getequipisequiped(EQI_HAND_R)) {
			mes "[Mayomayo]";
			mes "Did you take off the equipment?";
			close;
		}
		if (.@equip_card[3] == 0) {
			mes "[Mayomayo]";
			mes "This equipment has nothing to initialize. Please check again.";
			close;
		}
		specialeffect(EF_REPAIRWEAPON, AREA, playerattached());
		mes "[Mayomayo]";
		mes "Initialize the enchant effect from the equipment.";
		delitem Silvervine,1;
		delequip EQI_HAND_R;

		// GetNonSlotItemSock2 .@equip_refine .@equip_id .@equip_card[0] .@equip_card[1] .@equip_card[2] .@equip_card[3]
		for(.@i = 0; .@i<4; ++.@i) {
			if (.@equip_card[.@i] >= 4700) // Armor Enchant System
				.@equip_card[.@i] = 0;
		}
		getitem2 .@equip_id,1,1,.@equip_refine,0,.@equip_card[0],.@equip_card[1],.@equip_card[2],.@equip_card[3];

		close;
	}
}