card_remover.txt 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. prt_in,28,73,4 script Wise Old Woman#eAcustom 78,{
  17. set .zenycost,200000; // base cost of the card remover services (in Zeny)
  18. set .percardcost,25000; // cost per card of the card remover services (in Zeny)
  19. set .faildestroy,1; // should the card remover have a chance of failure that destroys items? (1=yes, 0=no)
  20. disable_items;
  21. mes "[Wise Old Woman]";
  22. mes "Good day, young one. I have the power to remove cards that you have compounded onto your equipment. Does this idea please you?";
  23. next;
  24. switch(select("Yes, it does.:What do you charge?:No thanks.")) {
  25. case 1:
  26. mes "[Wise Old Woman]";
  27. mes "Very well. Which item shall I examine for you?";
  28. next;
  29. setarray .@position$[1], "Head","Body","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
  30. set .@menu$,"";
  31. for( set .@i,1; .@i <= 10; set .@i,.@i+1 )
  32. {
  33. if( getequipisequiped(.@i) )
  34. set .@menu$, .@menu$ + .@position$[.@i] + "-" + "[" + getequipname(.@i) + "]";
  35. set .@menu$, .@menu$ + ":";
  36. }
  37. set .@part,select(.@menu$);
  38. if(!getequipisequiped(.@part)) {
  39. mes "[Wise Old Woman]";
  40. mes "Young one... Your not wearing anything there that I can remove cards from.";
  41. close;
  42. }
  43. if(getequipcardcnt(.@part) == 0) {
  44. mes "[Wise Old Woman]";
  45. mes "Young one... There are no cards compounded on this item. I can do nothing with it, I'm afraid.";
  46. close;
  47. }
  48. set .@cardcount,getequipcardcnt(.@part);
  49. if (!checkweight(1202,(.@cardcount+1))) {
  50. mes "^3355FFJust a minute!";
  51. mes "I can't offer any of my";
  52. mes "services to you because";
  53. mes "you're carrying too much";
  54. mes "stuff. Put your extra items in";
  55. mes "Kafra Storage and come again~";
  56. close;
  57. }
  58. mes "[Wise Old Woman]";
  59. 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.";
  60. next;
  61. if(select("Very well. Do it.:Nevermind.") == 2) {
  62. mes "[Wise Old Woman]";
  63. mes "Very well. Return at once if you seek my services.";
  64. close;
  65. }
  66. if((zeny < (.zenycost+(.@cardcount * .percardcost))) || (countitem(1000) < 1) || (countitem(715) < 1)) {
  67. mes "[Wise Old Woman]";
  68. mes "You do not have all the items I require to work my magic, child. Come again when you do.";
  69. close;
  70. }
  71. mes "[Wise Old Woman]";
  72. 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?";
  73. next;
  74. switch(select("I changed my mind about this.:The item.:The cards.")) {
  75. case 1:
  76. mes "[Wise Old Woman]";
  77. mes "Very well. Return at once if you seek my services.";
  78. close;
  79. case 2:
  80. set .@failtype,1;
  81. break;
  82. case 3:
  83. set .@failtype,2;
  84. }
  85. mes "[Wise Old Woman]";
  86. mes "Very well. I shall begin.";
  87. set Zeny, Zeny - (.zenycost+(.@cardcount * .percardcost));
  88. delitem 1000,1; //Star_Crumb
  89. delitem 715,1; //Yellow_Gemstone
  90. // Replace the constants in the next 3 lines with failure chance values defined in refine_db.txt
  91. // First value = Total failure chance (item and cards destroyed)
  92. // Second value = Partial failure chance (one or the other is destroyed, player decides which one is safe)
  93. // Third value = Harmless failure chance (all that's lost is your investment)
  94. set .@failchance,rand(100);
  95. if (.faildestroy==1) {
  96. if(.@failchance < 2) {
  97. next;
  98. failedremovecards .@part,0;
  99. mes "[Wise Old Woman]";
  100. mes "The process was a total failure. I am afraid the item and the cards were destroyed.";
  101. close;
  102. }
  103. if(.@failchance < 8) {
  104. if (.@failtype == 1) {
  105. next;
  106. failedremovecards .@part,1;
  107. mes "[Wise Old Woman]";
  108. mes "While I have managed to remove the cards from the item, they were destroyed in the process. The item, however, is okay.";
  109. close;
  110. }
  111. if (.@failtype == 2) {
  112. next;
  113. failedremovecards .@part,2;
  114. mes "[Wise Old Woman]";
  115. mes "Most unfortunate. I succeeded at removing the cards, but the item itself was destroyed in the process.";
  116. close;
  117. }
  118. }
  119. }
  120. if(.@failchance < 10) {
  121. next;
  122. failedremovecards .@part,3;
  123. mes "[Wise Old Woman]";
  124. mes "I have failed to remove the cards. Luckily, however, both the item and the cards are still okay.";
  125. close;
  126. }
  127. next;
  128. successremovecards .@part;
  129. mes "[Wise Old Woman]";
  130. mes "The process was a success. Here are your cards and your item. Farewell.";
  131. close;
  132. case 2:
  133. mes "[Wise Old Woman]";
  134. 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.";
  135. close;
  136. case 3:
  137. mes "[Wise Old Woman]";
  138. mes "Very well. Return at once if you seek my services.";
  139. close;
  140. }
  141. }