advanced_refiner.txt 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. //===== rAthena Script =======================================
  2. //= Advanced Refiner
  3. //===== Description: =========================================
  4. //= [Official Conversion]
  5. //= Refiner that uses Enriched ores to increase upgrade success.
  6. //= - Dialog is only partly official to iRO.
  7. //= - Uses the iRO position for this NPC.
  8. //===== Changelog: ===========================================
  9. //= 1.0 First Version. [L0ne_W0lf]
  10. //= 1.1 Fixed a weird carriage return. o_o [L0ne_W0lf]
  11. //= 1.2 Optimizing refine method [Zephyrus]
  12. //= 1.3 Typo fixes [Yommy]
  13. //= 1.4 Removed unnecessary dialogs [Zephyrus]
  14. //= 1.4a Added 'disable_items' command. [Euphy]
  15. //= 1.4b Fixed coordinates. [Euphy]
  16. //= 1.5 Some official script updates. [Euphy]
  17. //= 1.6 Added VIP features. [Euphy]
  18. //= 1.7 Removed re-roll behavior. [Secret]
  19. //============================================================
  20. payon,157,146,6 script Suhnbi#cash 85,{
  21. disable_items;
  22. mes "[Suhnbi]";
  23. mes "I am the Armsmith";
  24. mes "I can refine all kinds of weapons,";
  25. mes "armor and equipment, so let me";
  26. mes "know what you want to refine.";
  27. next;
  28. 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;
  29. for(set .@i,1; .@i<=10; set .@i,.@i+1) {
  30. if (getequipisequiped(.@indices[.@i])) {
  31. set .@menu$, .@menu$ + F_getpositionname(.@indices[.@i]) + "-[" + getequipname(.@indices[.@i]) + "]";
  32. set .@equipped,1;
  33. }
  34. set .@menu$, .@menu$ + ":";
  35. }
  36. if (.@equipped == 0) {
  37. mes "[Suhnbi]";
  38. mes "I don't think I can refine any items you have...";
  39. close;
  40. }
  41. set .@part, .@indices[ select(.@menu$) ];
  42. if (!getequipisequiped(.@part)) //custom check
  43. close;
  44. if (!getequipisenableref(.@part)) {
  45. mes "[Suhnbi]";
  46. mes "Go find another Blacksmith. You can't refine this thing.";
  47. close;
  48. }
  49. if (getequiprefinerycnt(.@part) >= 10) {
  50. mes "[Suhnbi]";
  51. mes "Hmm... someone perfected this already. I don't think I can work on it further.";
  52. close;
  53. }
  54. .@price = getequiprefinecost(.@part, REFINE_COST_ENRICHED, REFINE_ZENY_COST);
  55. .@material = getequiprefinecost(.@part, REFINE_COST_ENRICHED, REFINE_MATERIAL_ID);
  56. // Make sure you have the neccessary items and Zeny to refine your items
  57. // Determines chance of failure and verifies that you want to continue.
  58. callsub S_RefineValidate,getequipweaponlv(.@part),.@material,.@price,.@part;
  59. mes "[Suhnbi]";
  60. mes "Clang! Clang! Clang!";
  61. if (getequippercentrefinery(.@part, true) > rand(100)) {
  62. successrefitem .@part;
  63. next;
  64. emotion e_no1;
  65. mes "[Suhnbi]";
  66. mes "There you go! It's done.";
  67. mes "It's been a while since I've made such a fine "+((getequipweaponlv(.@part))?"weapon":"armor")+". You must be happy because it has become stronger!";
  68. close;
  69. }
  70. failedrefitem .@part;
  71. next;
  72. emotion (!rand(5))?e_cash:e_omg;
  73. mes "[Suhnbi]";
  74. mes "Uuuuuuuuuummmmmph!!!";
  75. next;
  76. mes "[Suhnbi]";
  77. mes "...";
  78. mes ".....";
  79. mes ".......Huhuhuhuhu~";
  80. mes "........It was your choice and my ability, no regret.";
  81. close;
  82. S_RefineValidate:
  83. .@weapon_lvl = getarg(0);
  84. .@item_req = getarg(1);
  85. set .@price, getarg(2);
  86. // If the VIP system is enabled, the prices for non-VIP players are considerably higher.
  87. if (VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE)) {
  88. switch(.@weapon_lvl){
  89. case 0: set .@price, .@price * 10; break;
  90. case 1: set .@price, .@price * 40; break;
  91. case 2: set .@price, .@price * 50; break;
  92. case 3: set .@price, .@price * 2; break;
  93. case 4: set .@price, .@price * 2; break;
  94. }
  95. }
  96. mes "[Suhnbi]";
  97. if (.@weapon_lvl)
  98. mes "You want to refine a level "+ .@weapon_lvl +" weapon?";
  99. mes "To refine that, you'll need to have one ^ff9999"+ getitemname(.@item_req) +"^000000 and "+ .@price +" zeny.";
  100. mes "Would you like to continue?";
  101. next;
  102. if(select("Yes:No") == 1) {
  103. if (getequippercentrefinery(getarg(3)) < 100) {
  104. if (.@weapon_lvl) {
  105. mes "[Suhnbi]";
  106. mes "Wow!!";
  107. mes "This weapon probably";
  108. mes "looks like it's been refined...";
  109. mes "many times...";
  110. mes "It may break if";
  111. mes "you refine it again.";
  112. next;
  113. mes "And if it breaks,";
  114. mes "you can't use it anymore!";
  115. mes "All the cards in it and the properties ^ff0000will be lost^000000!";
  116. mes "^ff0000Besides, the equipment will break!^000000";
  117. mes "Are you sure you still want to continue?";
  118. next;
  119. if(select("Yes:No") == 2) {
  120. mes "[Suhnbi]";
  121. mes "Good.";
  122. mes "Because if the weapon breaks from unreasonable refining, then I get a bad mood, too.";
  123. close;
  124. }
  125. } else {
  126. mes "[Suhnbi]";
  127. mes "Giggle. Giggle. Oh, you have guts, daring to refine this.";
  128. mes "You know it's pretty risky, don't you?";
  129. next;
  130. mes "If your defensive equipment is broken, you'll never be able to use it again.";
  131. mes "Even your cards and your modifications will ^ff0000completely disappear^000000.";
  132. //mes "Everything will disappear. As in... GONE!";
  133. mes "Do you really wish to continue?";
  134. next;
  135. if(select("Yes:No") == 2) {
  136. mes "[Suhnbi]";
  137. mes "What nonsense. You waste my precious time.";
  138. mes "Get lost, punk.";
  139. close;
  140. }
  141. }
  142. }
  143. if (countitem(.@item_req) > 0 && Zeny > .@price) {
  144. delitem .@item_req,1;
  145. set Zeny, Zeny - .@price;
  146. return;
  147. }
  148. mes "[Suhnbi]";
  149. mes "Are these all you have?";
  150. mes "I'm very sorry, but I can't do anything without all the materials. Besides, I deserve some payments for my work, don't I?";
  151. close;
  152. }
  153. mes "[Suhnbi]";
  154. mes "I can't help it even if you're not happy about it...";
  155. close;
  156. }