card_remover.txt 5.4 KB

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