advanced_refiner.txt 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. .@refineitemid = getequipid(.@part); // save id of the item
  55. .@refinerycnt = getequiprefinerycnt(.@part); //save refinery count
  56. .@price = getequiprefinecost(.@part, REFINE_COST_ENRICHED, REFINE_ZENY_COST);
  57. .@material = getequiprefinecost(.@part, REFINE_COST_ENRICHED, REFINE_MATERIAL_ID);
  58. // Make sure you have the necessary items and Zeny to refine your items
  59. // Determines chance of failure and verifies that you want to continue.
  60. callsub S_RefineValidate,getequipweaponlv(.@part),.@material,.@price,.@part,.@refineitemid,.@refinerycnt;
  61. mes "[Suhnbi]";
  62. mes "Clang! Clang! Clang!";
  63. if (getequippercentrefinery(.@part, true) > rand(100)) {
  64. successrefitem .@part;
  65. next;
  66. emotion ET_BEST;
  67. mes "[Suhnbi]";
  68. mes "There you go! It's done.";
  69. 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!";
  70. close;
  71. }
  72. failedrefitem .@part;
  73. next;
  74. emotion (!rand(5))?ET_MONEY:ET_HUK;
  75. mes "[Suhnbi]";
  76. mes "Uuuuuuuuuummmmmph!!!";
  77. next;
  78. mes "[Suhnbi]";
  79. mes "...";
  80. mes ".....";
  81. mes ".......Huhuhuhuhu~";
  82. mes "........It was your choice and my ability, no regret.";
  83. close;
  84. S_RefineValidate:
  85. .@weapon_lvl = getarg(0);
  86. .@item_req = getarg(1);
  87. .@price = getarg(2);
  88. .@part = getarg(3);
  89. setarray .@card[0], getequipcardid(.@part,0), getequipcardid(.@part,1), getequipcardid(.@part,2), getequipcardid(.@part,3);
  90. // If the VIP system is enabled, the prices for non-VIP players are considerably higher.
  91. if (VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE)) {
  92. switch(.@weapon_lvl){
  93. case 0: set .@price, .@price * 10; break;
  94. case 1: set .@price, .@price * 40; break;
  95. case 2: set .@price, .@price * 50; break;
  96. case 3: set .@price, .@price * 2; break;
  97. case 4: set .@price, .@price * 2; break;
  98. }
  99. }
  100. mes "[Suhnbi]";
  101. if (.@weapon_lvl)
  102. mes "You want to refine a level "+ .@weapon_lvl +" weapon?";
  103. mes "To refine that, you'll need to have one ^ff9999"+ getitemname(.@item_req) +"^000000 and "+ .@price +" zeny.";
  104. mes "Would you like to continue?";
  105. next;
  106. if(select("Yes:No") == 1) {
  107. if (getequippercentrefinery(.@part) < 100) {
  108. if (.@weapon_lvl) {
  109. mes "[Suhnbi]";
  110. mes "Wow!!";
  111. mes "This weapon probably";
  112. mes "looks like it's been refined...";
  113. mes "many times...";
  114. mes "It may break if";
  115. mes "you refine it again.";
  116. next;
  117. mes "And if it breaks,";
  118. mes "you can't use it anymore!";
  119. mes "All the cards in it and the properties ^ff0000will be lost^000000!";
  120. mes "^ff0000Besides, the equipment will break!^000000";
  121. mes "Are you sure you still want to continue?";
  122. next;
  123. if(select("Yes:No") == 2) {
  124. mes "[Suhnbi]";
  125. mes "Good.";
  126. mes "Because if the weapon breaks from unreasonable refining, then I get a bad mood, too.";
  127. close;
  128. }
  129. } else {
  130. mes "[Suhnbi]";
  131. mes "Giggle. Giggle. Oh, you have guts, daring to refine this.";
  132. mes "You know it's pretty risky, don't you?";
  133. next;
  134. mes "If your defensive equipment is broken, you'll never be able to use it again.";
  135. mes "Even your cards and your modifications will ^ff0000completely disappear^000000.";
  136. //mes "Everything will disappear. As in... GONE!";
  137. mes "Do you really wish to continue?";
  138. next;
  139. if(select("Yes:No") == 2) {
  140. mes "[Suhnbi]";
  141. mes "What nonsense. You waste my precious time.";
  142. mes "Get lost, punk.";
  143. close;
  144. }
  145. }
  146. }
  147. if (countitem(.@item_req) > 0 && Zeny > .@price) {
  148. delitem .@item_req,1;
  149. set Zeny, Zeny - .@price;
  150. // anti-hack
  151. if (callfunc("F_IsEquipIDHack", .@part, getarg(4)) ||
  152. callfunc("F_IsEquipRefineHack", .@part, getarg(5)) || callfunc("F_IsEquipCardHack", .@part, .@card[0], .@card[1], .@card[2], .@card[3])) {
  153. mes "[Holink]";
  154. emotion ET_FRET;
  155. mes "Wait a second...";
  156. mes "Do you think I'm stupid?!";
  157. mes "You switched the item while I wasn't looking! Get out of here!";
  158. close;
  159. }
  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. }