summaryrefslogblamecommitdiff
path: root/npc/re/merchants/enchan_mal.txt
blob: fed154dc8d8083bcb1eda50e041139e827161d20 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                                           


                                             













                                                                           
                     



                                                                           
        
                                                                           
 
                                                              
                      
                                        









                                                                                                                               
                                                                                                                                 

                                 
                                                                                                                                                                                     



                                                                                                     
                                                                                      




                                                                                                                                
                                                                                                                                                                                    







                                                                                                          
                                        

                      
                                        





                                                       
                                        

                      
                                               
                                                                    
 
                                                                     
                                                                                 
                                 



                                                                        
                                                                      



















                                                                          
                               












                                                                          
                                 




                                                                    
                                 















                                                                              
                                     

















                                                                           
                                     






















                                                                               
                                     











                                                                         
                                     



                                                                          
                                                                          










                                                                          
                               










                                                                         
                                         






                                                                          
                             















                                                                          
                             

                                                                                 
                                                                      





                                                                               
                                   







                                                                         
                           













                                                                             
                                              








                                                                            
                             




                                                                       
                                                                      


                                                                         
                                                                       




                                                                            







                        


                                     
                                                                                                                                                         

                                                                                                                                         

                                


              



                                                                                                                 
                                                                                                                                                      

                                








                                                                                                                         



                                                               
                                                        
                                                                                                                                   
                            
                                                                                                                       
                 
                                                  










                                                                                       
                                            

                                     
                                           

                                     
                                           

                                     
                                           





                                                                                                                        
                                                                                                      




                                                                                
                                                                            

                                      
                                                                            

                                      
                                                                            




                                                            

                                       
                                                                   

                                       







                                                                                                                                                                                       
                                                                               





                                                                            













                                                                            

                                     













                                                                            

                                     













                                                                            

                                     













                                                                            

                                              













                                                                            

                                                  













                                                                              

                                                   













                                                                                

                                               













                                                                            

                                                   













                                                                              

                                                    













                                                                                





                                                                          



                                                                                            








                                                                                                                                                          
                                                                                



                                                                                                                      
                                            

                              
                                                                       


                                                                                          
                                    
 
                                                                                                                                
                                                                                                                         
 




                                                                                                                   
                                                     



                                                                          
                                                 













                                                                                                             
                                                                       

                                                                        
                                     
                                    
 
                                                                                                                                
                                            
                                                                              
                                                      

                                                                                                                         
 


                      
//================= Hercules Script =======================================
//=       _   _                     _
//=      | | | |                   | |
//=      | |_| | ___ _ __ ___ _   _| | ___  ___
//=      |  _  |/ _ \ '__/ __| | | | |/ _ \/ __|
//=      | | | |  __/ | | (__| |_| | |  __/\__ \
//=      \_| |_/\___|_|  \___|\__,_|_|\___||___/
//================= License ===============================================
//= This file is part of Hercules.
//= http://herc.ws - http://github.com/HerculesWS/Hercules
//=
//= Copyright (C) 2012-2020 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;
	}
}