advanced_refiner.txt 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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. .@itemtype = getiteminfo( .@refineitemid, ITEMINFO_TYPE );
  59. // Make sure you have the necessary items and Zeny to refine your items
  60. // Determines chance of failure and verifies that you want to continue.
  61. callsub S_RefineValidate,.@itemtype,.@material,.@price,.@part,.@refineitemid,.@refinerycnt;
  62. mes "[Suhnbi]";
  63. mes "Clang! Clang! Clang!";
  64. if (getequippercentrefinery(.@part, true) > rand(100)) {
  65. successrefitem .@part;
  66. next;
  67. emotion ET_BEST;
  68. mes "[Suhnbi]";
  69. mes "There you go! It's done.";
  70. mes "It's been a while since I've made such a fine "+((.@itemtype == IT_WEAPON)?"weapon":"armor")+". You must be happy because it has become stronger!";
  71. close;
  72. }
  73. failedrefitem .@part;
  74. next;
  75. emotion (!rand(5))?ET_MONEY:ET_HUK;
  76. mes "[Suhnbi]";
  77. mes "Uuuuuuuuuummmmmph!!!";
  78. next;
  79. mes "[Suhnbi]";
  80. mes "...";
  81. mes ".....";
  82. mes ".......Huhuhuhuhu~";
  83. mes "........It was your choice and my ability, no regret.";
  84. close;
  85. S_RefineValidate:
  86. .@itemtype = getarg(0);
  87. .@item_req = getarg(1);
  88. .@price = getarg(2);
  89. .@part = getarg(3);
  90. setarray .@card[0], getequipcardid(.@part,0), getequipcardid(.@part,1), getequipcardid(.@part,2), getequipcardid(.@part,3);
  91. if( .@itemtype == IT_ARMOR ){
  92. .@equip_lv = getequiparmorlv( .@part );
  93. // If the VIP system is enabled, the prices for non-VIP players are considerably higher.
  94. if (VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE)) {
  95. switch(.@equip_lv) {
  96. case 1:
  97. set .@price, .@price * 10;
  98. break;
  99. default:
  100. // TODO:
  101. close;
  102. }
  103. }
  104. }else if( .@itemtype == IT_WEAPON ){
  105. .@equip_lv = getequipweaponlv( .@part );
  106. // If the VIP system is enabled, the prices for non-VIP players are considerably higher.
  107. if (VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE)) {
  108. switch( .@equip_lv ){
  109. case 1:
  110. set .@price, .@price * 40;
  111. break;
  112. case 2:
  113. set .@price, .@price * 50;
  114. break;
  115. case 3:
  116. set .@price, .@price * 2;
  117. break;
  118. case 4:
  119. set .@price, .@price * 2;
  120. break;
  121. default:
  122. // TODO:
  123. close;
  124. }
  125. }
  126. }else{
  127. // TODO:
  128. close;
  129. }
  130. mes "[Suhnbi]";
  131. if (.@itemtype == IT_WEAPON)
  132. mes "You want to refine a level "+ .@equip_lv +" weapon?";
  133. mes "To refine that, you'll need to have one ^ff9999"+ getitemname(.@item_req) +"^000000 and "+ .@price +" zeny.";
  134. mes "Would you like to continue?";
  135. next;
  136. if(select("Yes:No") == 1) {
  137. if (getequippercentrefinery(.@part) < 100) {
  138. if (.@itemtype == IT_WEAPON) {
  139. mes "[Suhnbi]";
  140. mes "Wow!!";
  141. mes "This weapon probably";
  142. mes "looks like it's been refined...";
  143. mes "many times...";
  144. mes "It may break if";
  145. mes "you refine it again.";
  146. next;
  147. mes "And if it breaks,";
  148. mes "you can't use it anymore!";
  149. mes "All the cards in it and the properties ^ff0000will be lost^000000!";
  150. mes "^ff0000Besides, the equipment will break!^000000";
  151. mes "Are you sure you still want to continue?";
  152. next;
  153. if(select("Yes:No") == 2) {
  154. mes "[Suhnbi]";
  155. mes "Good.";
  156. mes "Because if the weapon breaks from unreasonable refining, then I get a bad mood, too.";
  157. close;
  158. }
  159. } else {
  160. mes "[Suhnbi]";
  161. mes "Giggle. Giggle. Oh, you have guts, daring to refine this.";
  162. mes "You know it's pretty risky, don't you?";
  163. next;
  164. mes "If your defensive equipment is broken, you'll never be able to use it again.";
  165. mes "Even your cards and your modifications will ^ff0000completely disappear^000000.";
  166. //mes "Everything will disappear. As in... GONE!";
  167. mes "Do you really wish to continue?";
  168. next;
  169. if(select("Yes:No") == 2) {
  170. mes "[Suhnbi]";
  171. mes "What nonsense. You waste my precious time.";
  172. mes "Get lost, punk.";
  173. close;
  174. }
  175. }
  176. }
  177. if (countitem(.@item_req) > 0 && Zeny > .@price) {
  178. delitem .@item_req,1;
  179. set Zeny, Zeny - .@price;
  180. // anti-hack
  181. if (callfunc("F_IsEquipIDHack", .@part, getarg(4)) ||
  182. callfunc("F_IsEquipRefineHack", .@part, getarg(5)) || callfunc("F_IsEquipCardHack", .@part, .@card[0], .@card[1], .@card[2], .@card[3])) {
  183. mes "[Holink]";
  184. emotion ET_FRET;
  185. mes "Wait a second...";
  186. mes "Do you think I'm stupid?!";
  187. mes "You switched the item while I wasn't looking! Get out of here!";
  188. close;
  189. }
  190. return;
  191. }
  192. mes "[Suhnbi]";
  193. mes "Are these all you have?";
  194. 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?";
  195. close;
  196. }
  197. mes "[Suhnbi]";
  198. mes "I can't help it even if you're not happy about it...";
  199. close;
  200. }