Advertisement
johnlol

card_remover

May 4th, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //===== rAthena Script =======================================
  2. //= Card Removal NPC
  3. //===== By: ==================================================
  4. //= TyrNemesis^
  5. //===== Current Version: =====================================
  6. //= 1.2a
  7. //===== Compatible With: =====================================
  8. //= rAthena Project
  9. //===== Description: =========================================
  10. //= Removes cards from equipped items.
  11. //===== Additional Comments: =================================
  12. //= 1.0 First version. [TyrNemesis^]
  13. //= 1.2 Optimized and fixed getequipname menu. [Kisuka]
  14. //= 1.2a Added 'disable_items' command. [Euphy]
  15. //============================================================
  16.  
  17. prt_in,28,73,4  script  Wise Old Woman#eAcustom 78,{
  18.  
  19.     set .zenycost,200000;    // base cost of the card remover services (in Zeny)
  20.     set .percardcost,25000;  // cost per card of the card remover services (in Zeny)
  21.     set .faildestroy,1;      // should the card remover have a chance of failure that destroys items? (1=yes, 0=no)
  22.  
  23.     disable_items;
  24.     mes "[Wise Old Woman]";
  25.     mes "Good day, young one. I have the power to remove cards that you have compounded onto your equipment. Does this idea please you?";
  26.     next;
  27.     switch(select("Yes, it does.:What do you charge?:No thanks.")) {
  28.     case 1:
  29.         mes "[Wise Old Woman]";
  30.         mes "Very well. Which item shall I examine for you?";
  31.         next;
  32.  
  33.         setarray .@indices[1], EQI_HEAD_TOP, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_GARMENT, EQI_SHOES, EQI_ACC_L, EQI_ACC_R, EQI_HEAD_MID, EQI_HEAD_LOW;
  34.         for( set .@i,1; .@i <= 10; set .@i,.@i+1 ) {
  35.             if( getequipisequiped(.@indices[.@i]) )
  36.                 set .@menu$, .@menu$ + F_getpositionname(.@indices[.@i]) + "-[" + getequipname(.@indices[.@i]) + "]";
  37.             set .@menu$, .@menu$ + ":";
  38.         }
  39.         set .@part, .@indices[ select(.@menu$) ];
  40.         if(!getequipisequiped(.@part)) {
  41.             mes "[Wise Old Woman]";
  42.             mes "Young one... Your not wearing anything there that I can remove cards from.";
  43.             close;
  44.         }
  45.         if(getequipcardcnt(.@part) == 0) {
  46.             mes "[Wise Old Woman]";
  47.             mes "Young one... There are no cards compounded on this item. I can do nothing with it, I'm afraid.";
  48.             close;
  49.         }
  50.         set .@cardcount,getequipcardcnt(.@part);
  51.        
  52.         if (!checkweight(1202,(.@cardcount+1))) {
  53.             mes "^3355FFJust a minute!";
  54.             mes "I can't offer any of my";
  55.             mes "services to you because";
  56.             mes "you're carrying too much";
  57.             mes "stuff. Put your extra items in";
  58.             mes "Kafra Storage and come again~";
  59.             close;
  60.         }
  61.         mes "[Wise Old Woman]";
  62.         mes "This item has " + .@cardcount + " cards compounded on it. To perform my magic, I will need " + (.zenycost+(.@cardcount * .percardcost)) + " zeny, a ^0000FFStar Crumb^000000, and a ^0000FFYellow Gemstone^000000.";
  63.         next;
  64.         if(select("Very well. Do it.:Nevermind.") == 2) {
  65.             mes "[Wise Old Woman]";
  66.             mes "Very well. Return at once if you seek my services.";
  67.             close;
  68.         }
  69.         if((zeny < (.zenycost+(.@cardcount * .percardcost))) || (countitem(1000) < 1) || (countitem(715) < 1)) {
  70.             mes "[Wise Old Woman]";
  71.             mes "You do not have all the items I require to work my magic, child. Come again when you do.";
  72.             close;
  73.         }
  74.         mes "[Wise Old Woman]";
  75.         mes "Before I begin, I must warn you--I may fail. If I do, I may destroy the cards, the item, or both. I do not give refunds. That being said, which is more important to you: The cards, or the item?";
  76.         next;
  77.         switch(select("I changed my mind about this.:The item.:The cards.")) {
  78.         case 1:
  79.             mes "[Wise Old Woman]";
  80.             mes "Very well. Return at once if you seek my services.";
  81.             close;
  82.         case 2:
  83.             set .@failtype,1;
  84.             break;
  85.         case 3:
  86.             set .@failtype,2;
  87.         }
  88.         mes "[Wise Old Woman]";
  89.         mes "Very well. I shall begin.";
  90.         set Zeny, Zeny - (.zenycost+(.@cardcount * .percardcost));
  91.         delitem 1000,1; //Star_Crumb
  92.         delitem 715,1; //Yellow_Gemstone
  93.        
  94.         // Replace the constants in the next 3 lines with failure chance values defined in refine_db.txt
  95.         // First value = Total failure chance (item and cards destroyed)
  96.         // Second value = Partial failure chance (one or the other is destroyed, player decides which one is safe)
  97.         // Third value = Harmless failure chance (all that's lost is your investment)
  98.  
  99.         set .@failchance,rand(100);
  100.         if (.faildestroy==1) {
  101.             if(.@failchance < 2) {
  102.                 next;
  103.                 failedremovecards .@part,0;
  104.                 mes "[Wise Old Woman]";
  105.                 mes "The process was a total failure. I am afraid the item and the cards were destroyed.";
  106.                 close;
  107.             }
  108.  
  109.             if(.@failchance < 8) {
  110.                 if (.@failtype == 1) {
  111.                     next;
  112.                     failedremovecards .@part,1;
  113.                     mes "[Wise Old Woman]";
  114.                     mes "While I have managed to remove the cards from the item, they were destroyed in the process. The item, however, is okay.";
  115.                     close;
  116.                 }
  117.  
  118.                 if (.@failtype == 2) {
  119.                     next;
  120.                     failedremovecards .@part,2;
  121.                     mes "[Wise Old Woman]";
  122.                     mes "Most unfortunate. I succeeded at removing the cards, but the item itself was destroyed in the process.";
  123.                     close;
  124.                 }
  125.             }
  126.         }
  127.  
  128.         if(.@failchance < 10) {
  129.             next;
  130.             failedremovecards .@part,3;
  131.             mes "[Wise Old Woman]";
  132.             mes "I have failed to remove the cards. Luckily, however, both the item and the cards are still okay.";
  133.             close;
  134.         }
  135.         next;
  136.         successremovecards .@part;
  137.         mes "[Wise Old Woman]";
  138.         mes "The process was a success. Here are your cards and your item. Farewell.";
  139.         close;
  140.     case 2:
  141.         mes "[Wise Old Woman]";
  142.         mes "I charge a flat fee of "+callfunc("F_InsertComma",.zenycost)+" zeny, plus "+callfunc("F_InsertComma",.percardcost)+" zeny for each card I remove from the item. In addition, I need a star crumb and a yellow gemstone to work my magic.";
  143.         close;
  144.     case 3:
  145.         mes "[Wise Old Woman]";
  146.         mes "Very well. Return at once if you seek my services.";
  147.         close;
  148.     }
  149. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement