Advertisement
johnlol

sader_s_enchant_V2.0

May 27th, 2019
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VeriLog 15.42 KB | None | 0 0
  1. //===== rAthena Script =======================================
  2. //= saders enchant npc
  3. //===== By: ==================================================
  4. //= Sader1992
  5. //https://rathena.org/board/profile/30766-sader1992/
  6. //===== Current Version: =====================================
  7. //= 2.0
  8. //===== Compatible With: =====================================
  9. //= rAthena Project
  10. //https://rathena.org/board/files/file/3602-saders-enchantment-npc/
  11. //https://github.com/sader1992/sader_scripts
  12. //===== Description: =========================================
  13. //============================================================
  14. //============================================================
  15. prontera,157,176,6  script  sader enchant   998,{
  16.     callsub s_check_menu;
  17. end;
  18.  
  19. s_check_menu:
  20.         if(.s_only_vip == 1 && vip_status(1)){
  21.             mes "this service only for vip";
  22.             close;
  23.         }
  24.         if (BaseLevel < .s_level_required[0] || BaseLevel > .s_level_required[1]){
  25.             mes "Your level is too low or too high.";
  26.             mes "   ";
  27.             mes "Minimum level "+.s_level_required[0]+".";
  28.             mes "Maximum level "+.s_level_required[1]+".";
  29.             close;
  30.         }
  31.     callsub s_start_menu;
  32. end;
  33.  
  34. s_start_menu:
  35.     mes "Hello!";
  36.     mes "Do you want to enchant you items!";
  37.     mes "I am the best enchanter in the world!";
  38.     next;
  39.     if (.s_zeny  > 0) {
  40.             mes "this will cost you " + .s_zeny + " Zeny only!";
  41.         }
  42.     if (.item_is_required == 1) {
  43.             mes "and an enchantment orb";
  44.         }
  45.     mes "i will do my best to enchant it Successfully!";
  46.     mes "but remember";
  47.     mes "There is luck in this work too.";
  48.     next;
  49.     mes "please if you have items same";
  50.     mes "as the item you want to enchant";
  51.     mes "but them in the storage and come back to me!";
  52.     next;
  53.     set s_all_selected,0;
  54.     set s_orb_selected,0;
  55.     set selected_orb_id ,0;
  56.     set s_slot_selected,0;
  57.     set remove_orbs,0;
  58.     set selected_orb_size,0;
  59.     set s_item_refine,0;
  60.     if(.remove_enchant == 1){
  61.         callsub s_select_menu;
  62.     }else{
  63.         callsub s_select_armor;
  64.         }
  65. close;
  66. end;
  67.  
  68. s_select_menu:
  69.     mes "so what you want to do!";
  70.     if(.enable_the_shop == 1){
  71.         switch(select("Enchant:Remove Enchant:The Items you can enchant")){
  72.             case 2: remove_orbs = 1;
  73.             case 3: callsub Q_shop;
  74.         }
  75.     }else{
  76.         switch(select("Enchant:Remove Enchant")){
  77.             case 2: remove_orbs = 1;
  78.         }
  79.     }
  80.    
  81.     callsub s_select_armor;
  82. end;
  83.    
  84. s_select_armor:
  85.     next;
  86.     mes "please select the item you want to enchant";
  87.     for(.@i=0; .@i<getarraysize(.s_all$); .@i++)
  88.         if(getequipid(.s_all_loc[.@i])>-1) {
  89.             set .@armor_menu$, .@armor_menu$ + .s_all$[.@i] + " - [ ^E81B02" + getitemname(getequipid(.s_all_loc[.@i])) + "^000000 ]:";
  90.         }else{
  91.             set .@armor_menu$, .@armor_menu$ + .s_all$[.@i] + " - [ ^D6C4E8" + "No Equip" + "^000000 ]:";
  92.         }
  93.     set s_all_selected, select(.@armor_menu$) -1;
  94.     if(getequipid(.s_all_loc[s_all_selected])< 0) {
  95.         mes "you don't have item equiped there";
  96.         close;
  97.     }
  98.     if (countitem(getequipid(.s_all_loc[s_all_selected])) > 1){
  99.             mes "you have more then one item";
  100.             mes "from the item that you want to enchant";
  101.             close;
  102.     }
  103.     s_item_refine = getequiprefinerycnt(.s_all_loc[s_all_selected]);
  104.     callsub s_specific_gears;
  105. end;
  106.  
  107. s_specific_gears:
  108.     if( getd(".specific_" + .s_all$[s_all_selected] + "s") ==1){
  109.         for(.@i=0;.@i<getarraysize(getd("." + .s_all$[s_all_selected] + "s$"));.@i++){
  110.             if(getequipid(.s_all_loc[s_all_selected]) == atoi(getd("." + .s_all$[s_all_selected] + "s$["+.@i+"]"))){
  111.                 .@good_to_go = 1;
  112.             }
  113.         }
  114.     }else{
  115.         for(.@i=0;.@i<getarraysize(.black_list$);.@i++){
  116.             if(getequipid(.s_all_loc[s_all_selected]) == atoi(.black_list$[.@i])){
  117.                 .@black_list_item = 1;
  118.             }
  119.         }
  120.         .@good_to_go = 1;
  121.     }
  122.     if(!.@good_to_go || .@black_list_item == 1){
  123.         mes "sorry";
  124.         mes " i can't enchant this item.";
  125.         close;
  126.     }
  127.     if(remove_orbs == 1){callsub s_select_remove;}
  128.     if(.chosse_orb == 1){callsub s_select_orb;}else{callsub s_random_orb;}
  129. end;
  130.  
  131. Q_shop:
  132.     switch(select("Weapons:Armors:Shields:Germents:Shoses:Accessarys:Uppers:Middels:Lowers")){
  133.     case 1: callshop "enchantable_items_Weapon",1; break;
  134.     case 2: callshop "enchantable_items_Armor",1; break;
  135.     case 3: callshop "enchantable_items_Shield",1; break;
  136.     case 4: callshop "enchantable_items_Germent",1; break;
  137.     case 5: callshop "enchantable_items_Shose",1; break;
  138.     case 6: callshop "enchantable_items_Accessary",1; break;
  139.     case 7: callshop "enchantable_items_Upper",1; break;
  140.     case 8: callshop "enchantable_items_Middel",1; break;
  141.     case 9: callshop "enchantable_items_Lower",1; break;
  142.     }
  143. end;
  144.  
  145. s_select_orb:
  146.     next;
  147.     mes "select the orb you want";
  148.     for(.@i=0; .@i<getarraysize(getd("." + .s_all$[s_all_selected] + "$")); .@i++)
  149.             set .@orb_menu$, .@orb_menu$ + getitemname(atoi(getd("." + .s_all$[s_all_selected] + "$["+.@i+"]"))) + ":";
  150.     set s_orb_selected, select(.@orb_menu$) -1;
  151.     selected_orb_id = getd("." + .s_all$[s_all_selected] + "$["+s_orb_selected+"]");
  152.         callsub s_select_slot;
  153. end;
  154.  
  155.  
  156. s_select_slot:
  157.     next;
  158.     mes "which slot ?";
  159.         .@card0 = getequipcardid(.s_all_loc[s_all_selected],0);
  160.         .@card1 = getequipcardid(.s_all_loc[s_all_selected],1);
  161.         .@card2 = getequipcardid(.s_all_loc[s_all_selected],2);
  162.         .@card3 = getequipcardid(.s_all_loc[s_all_selected],3);
  163.     for(.@i=getd(".slot_count_" + .s_all$[s_all_selected]); .@i<4; .@i++)
  164.         if(getequipcardid(.s_all_loc[s_all_selected],.@i)!= null) {
  165.             set .@slot_menu$, .@slot_menu$ + " [ ^E81B02" + getitemname(getequipcardid(.s_all_loc[s_all_selected],.@i)) + "^000000 ]:";
  166.         }else{
  167.             set .@slot_menu$, .@slot_menu$ + " [ ^D6C4E8" + "Empty" + "^000000 ]:";
  168.         }
  169.     set s_slot_selected, select(.@slot_menu$) -1;
  170.     if(.s_enchant_overwrite == 0){
  171.         if(getequipcardid(.s_all_loc[s_all_selected],s_slot_selected) > 0){
  172.             mes "you already have orb in this slot";
  173.             close;
  174.         }
  175.     }
  176.     callsub s_enchant_progress;
  177. end;
  178.  
  179. s_enchant_progress:
  180.         .@card0 = getequipcardid(.s_all_loc[s_all_selected],0);
  181.         .@card1 = getequipcardid(.s_all_loc[s_all_selected],1);
  182.         .@card2 = getequipcardid(.s_all_loc[s_all_selected],2);
  183.         .@card3 = getequipcardid(.s_all_loc[s_all_selected],3);
  184.     if (Zeny < .s_zeny) {
  185.             mes "Sorry, but you don't have enough zeny.";
  186.             close;
  187.         }
  188.     if(.item_is_required == 1){
  189.         if (countitem(selected_orb_id) < 1){
  190.             mes"you don't have enchant orb";
  191.             close;
  192.         }
  193.     }
  194.     close2;
  195.     specialeffect2 EF_MAPPILLAR;
  196.     progressbar "ffff00",.progress_time;
  197.     set Zeny, Zeny-.s_zeny;
  198.     if(.item_is_required == 1){delitem selected_orb_id,1;}
  199.     if (rand(100) < .success_chanse[s_slot_selected]) callsub s_enchant_success;
  200.     else callsub s_brack;
  201. end;
  202.  
  203. s_brack:
  204.     specialeffect2 155;
  205.     mes "I am sorry";
  206.     mes "We did Fail";
  207.     specialeffect2 EF_PHARMACY_FAIL;
  208.     if (rand(100) < .brack_chance){
  209.         set .@item, getequipid(.s_all_loc[s_all_selected]);
  210.         delitem .@item,1;
  211.         mes "and it broke!!";
  212.         specialeffect EF_SUI_EXPLOSION;
  213.     }
  214.     close;
  215. end;
  216.  
  217. s_enchant_success:
  218.         .@card0 = getequipcardid(.s_all_loc[s_all_selected],0);
  219.         .@card1 = getequipcardid(.s_all_loc[s_all_selected],1);
  220.         .@card2 = getequipcardid(.s_all_loc[s_all_selected],2);
  221.         .@card3 = getequipcardid(.s_all_loc[s_all_selected],3);
  222.     mes "We did it!";
  223.         specialeffect2 154;
  224.         setd(".@card" + s_slot_selected, selected_orb_id);
  225.         set .@item, getequipid(.s_all_loc[s_all_selected]);
  226.         delitem .@item,1;
  227.         getitem2 .@item, 1, 1, s_item_refine, 0, .@card0, .@card1, .@card2, .@card3;
  228.         equip .@item;
  229.     close;
  230. end;   
  231.  
  232.  
  233. s_select_remove:
  234.         .@card0 = getequipcardid(.s_all_loc[s_all_selected],0);
  235.         .@card1 = getequipcardid(.s_all_loc[s_all_selected],1);
  236.         .@card2 = getequipcardid(.s_all_loc[s_all_selected],2);
  237.         .@card3 = getequipcardid(.s_all_loc[s_all_selected],3);
  238.         next;
  239.         mes "this will remove all the cards and orbs inside the item!";
  240.         if (.s_zeny_remove > 0) {
  241.             mes "this will cost you " + .s_zeny_remove + " Zeny.";
  242.         }
  243.         mes "are you sure?";
  244.             switch(select("NO:Yes")){
  245.                 case 2:
  246.                     mes "for the last time!";
  247.                     mes "are you sure?";
  248.                     switch(select("NO:Yes")){
  249.                         if (Zeny < .s_zeny_remove) {
  250.                             mes "Sorry, but you don't have enough zeny.";
  251.                             close;
  252.                         }
  253.                     case 2:
  254.                         specialeffect2 EF_REPAIRWEAPON;
  255.                         set .@item, getequipid(.s_all_loc[s_all_selected]);
  256.                         delitem .@item,1;
  257.                         getitem2 .@item, 1, 1, s_item_refine, 0, 0, 0, 0, 0;
  258.                         set Zeny, Zeny-.s_zeny_remove;
  259.                     }
  260.             }  
  261.     close;
  262. end;
  263.  
  264. s_random_orb:
  265. selected_orb_size = rand(getarraysize(getd("." + .s_all$[s_all_selected] + "$")));
  266. selected_orb_id = getd("." + .s_all$[s_all_selected] + "$["+selected_orb_size+"]");
  267.     callsub s_select_slot;
  268. end;
  269.  
  270.  
  271. OnInit:
  272.     //--------------------------------------------------------------//
  273.     //--------------------------------------------------------------//
  274.     //--------------------   configuration   -----------------------//
  275.     //--------------------------------------------------------------//
  276.     //--------------------------------------------------------------//
  277.    
  278.     //--------------------------------------------------------------//
  279.     //if you want to remove one from the menu you need to remove it down too!! /or add
  280.     //--------------------------------------------------------------//
  281.     setarray .s_all$,"Weapon","Armor","Shield","Germent","Shose","Accessary","Upper","Middel","Lower";
  282.     setarray .s_all_loc,EQI_HAND_R,EQI_ARMOR,EQI_HAND_L,EQI_GARMENT,EQI_SHOES,EQI_ACC_L,EQI_HEAD_TOP,EQI_HEAD_MID,EQI_HEAD_LOW;
  283.    
  284.     //--------------------------------------------------------------//
  285.     //Orbs IDs (Note : Shield = left hand so the weapon on the left hand count as Shield too!
  286.     //--------------------------------------------------------------//
  287.     setarray .Weapon$,4741,4933,4861,4762,4934; //right handed weapons
  288.     setarray .Armor$,4933,4861,4762,4934;   //Armors
  289.     setarray .Shield$,4861,4762,4934;   //Shields and left hand weapons
  290.     setarray .Germent$,4741,4933,4861,4762,4934;    //Germent
  291.     setarray .Shose$,4741,4933,4861,4762,4934;  //Shose
  292.     setarray .Accessary$,4741,4933,4861,4762,4934;  //orbs id
  293.     setarray .Upper$,4741,4933,4861,4762,4934;  //Accessary
  294.     setarray .Middel$,4741,4933,4861,4762,4934; //Middel
  295.     setarray .Lower$,4741,4933,4861,4762,4934;  //Lower
  296.    
  297.     //--------------------------------------------------------------//
  298.     //if you want to put specific IDs for kind of gear put it to 1
  299.     //--------------------------------------------------------------//
  300.     .specific_Weapons = 1;
  301.     .specific_Armors = 1;
  302.     .specific_Shields = 1;
  303.     .specific_Germents = 1;
  304.     .specific_Shoses = 1;
  305.     .specific_Accessarys = 1;
  306.     .specific_Uppers = 1;
  307.     .specific_Middels =1;
  308.     .specific_Lowers = 1;
  309.    
  310.     //--------------------------------------------------------------//
  311.     //if specific put the IDs here
  312.     //--------------------------------------------------------------//
  313.     setarray .Weapons$,1601,1201,1204,1207,1210,1213,1216,1219,1222,1247,1248,1249; //right handed weapons
  314.     setarray .Armors$,2301,2303,2305,2307,2307,2309,2312,2314,2316,2321,2323,2325,2328,2330,2332;   //Armors
  315.     setarray .Shields$,2101,2103,2105,2107,2113,2117;   //Shields and left hand weapons
  316.     setarray .Germents$,2512,2501,2503,2505;    //Germents
  317.     setarray .Shoses$,2416,2401,2403,2405,2411; //Shoses
  318.     setarray .Accessarys$,2628,2608,2609,2612,2613,2627;    //Accessarys
  319.     setarray .Uppers$,2206,2208,2211,2216;  //Uppers
  320.     setarray .Middels$,2218,2241;   //Middels
  321.     setarray .Lowers$,2628,2206;    //Lowers
  322.    
  323.     //--------------------------------------------------------------//
  324.     //if not specific put the black list IDs here (if you want
  325.     //--------------------------------------------------------------//
  326.     setarray .black_list$,2335,2338,2340,2341;
  327.    
  328.     //--------------------------------------------------------------//
  329.     //here you can make a specific slot number for each kind
  330.     //0 = all 4 slot ,1 = last 3 slot ,2 = last 2 slot ,3 = last 1 slot
  331.     //--------------------------------------------------------------//
  332.     .slot_count_Weapon = 0;
  333.     .slot_count_Armor = 0;
  334.     .slot_count_Shield = 0;
  335.     .slot_count_Germent = 0;
  336.     .slot_count_Shose = 0;
  337.     .slot_count_Accessary = 0;
  338.     .slot_count_Upper = 0;
  339.     .slot_count_Middel = 0;
  340.     .slot_count_Lower = 0;
  341.    
  342.     //--------------------------------------------------------------//
  343.     //other configuration
  344.     //--------------------------------------------------------------//
  345.     setarray .s_level_required,0,175;   //the level required to use the npc
  346.     .s_only_vip = 0;    //if you want only vip to use it put it to 1
  347.     setarray .success_chanse,100,80,60,40;  //success chanse [1st_slot_chanse,2nd_slot_chanse,3rd_slot_chanse,4th_slot_chanse]
  348.     .s_zeny = 10000;    //if you don't want zeny requirment set it to 0
  349.     .s_zeny_remove = 100000;    //this for enchantment reset
  350.     .item_is_required = 0;  //if you want the orb it self to be required 1 = yes , 0 = no
  351.     .s_enchant_overwrite = 0;   //if 1 then you can overwrite the enchant
  352.     .progress_time = 7; //the time that needed to wait until the socket end
  353.     .chosse_orb = 0;    //0 = random ,1 = yes
  354.     .brack_chance = 50; //the chanse that it will brack if it fail
  355.     .remove_enchant = 1;    //0 = no ,1 = yes
  356.    
  357.     //--------------------------------------------------------------//
  358.     //this will only show the items that the npc can enchant in a shop but no one can buy from it as long as you don't give them the value
  359.     //--------------------------------------------------------------//
  360.     .enable_the_shop = 1;
  361.  
  362.  
  363.    
  364.    
  365.    
  366.     //--------------------------------------------------------------//
  367.     //Do not edit here
  368.     //--------------------------------------------------------------//
  369.     npcshopdelitem "enchantable_items_Weapon",512;
  370.     npcshopdelitem "enchantable_items_Armor",512;
  371.     npcshopdelitem "enchantable_items_Shield",512;
  372.     npcshopdelitem "enchantable_items_Germent",512;
  373.     npcshopdelitem "enchantable_items_Shose",512;
  374.     npcshopdelitem "enchantable_items_Accessary",512;
  375.     npcshopdelitem "enchantable_items_Upper",512;
  376.     npcshopdelitem "enchantable_items_Middel",512;
  377.     npcshopdelitem "enchantable_items_Lower",512;
  378.    
  379.     for (.@i = 0; .@i < getarraysize(.Weapons$); .@i++)
  380.             npcshopadditem "enchantable_items_Weapon", atoi(.Weapons$[.@i]),1;
  381.     for (.@i = 0; .@i < getarraysize(.Armors$); .@i++)
  382.             npcshopadditem "enchantable_items_Armor", atoi(.Armors$[.@i]),1;
  383.     for (.@i = 0; .@i < getarraysize(.Shields$); .@i++)
  384.             npcshopadditem "enchantable_items_Shield", atoi(.Shields$[.@i]),1;
  385.     for (.@i = 0; .@i < getarraysize(.Germents$); .@i++)
  386.             npcshopadditem "enchantable_items_Germent", atoi(.Germents$[.@i]),1;   
  387.     for (.@i = 0; .@i < getarraysize(.Shoses$); .@i++)
  388.             npcshopadditem "enchantable_items_Shose", atoi(.Shoses$[.@i]),1;   
  389.     for (.@i = 0; .@i < getarraysize(.Accessarys$); .@i++)
  390.             npcshopadditem "enchantable_items_Accessary", atoi(.Accessarys$[.@i]),1;   
  391.     for (.@i = 0; .@i < getarraysize(.Uppers$); .@i++)
  392.             npcshopadditem "enchantable_items_Upper", atoi(.Uppers$[.@i]),1;       
  393.     for (.@i = 0; .@i < getarraysize(.Middels$); .@i++)
  394.             npcshopadditem "enchantable_items_Middel", atoi(.Middels$[.@i]),1; 
  395.     for (.@i = 0; .@i < getarraysize(.Lowers$); .@i++)
  396.             npcshopadditem "enchantable_items_Lower", atoi(.Lowers$[.@i]),1;   
  397.     end;
  398. }
  399. -   pointshop   enchantable_items_Weapon    -1,#YOU_CAN_ENCHANT_Weapons,512:1;
  400. -   pointshop   enchantable_items_Armor -1,#YOU_CAN_ENCHANT_Armors,512:1;
  401. -   pointshop   enchantable_items_Shield    -1,#YOU_CAN_ENCHANT_Shields,512:1;
  402. -   pointshop   enchantable_items_Germent   -1,#YOU_CAN_ENCHANT_Germents,512:1;
  403. -   pointshop   enchantable_items_Shose -1,#YOU_CAN_ENCHANT_Shoses,512:1;
  404. -   pointshop   enchantable_items_Accessary -1,#YOU_CAN_ENCHANT_Accessarys,512:1;
  405. -   pointshop   enchantable_items_Upper -1,#YOU_CAN_ENCHANT_Uppers,512:1;
  406. -   pointshop   enchantable_items_Middel    -1,#YOU_CAN_ENCHANT_Middels,512:1;
  407. -   pointshop   enchantable_items_Lower -1,#YOU_CAN_ENCHANT_Lowers,512:1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement