advanced_refiner.txt 6.0 KB

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