ticket_refiner.txt 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. //===== rAthena Script =======================================
  2. //= Ticket Refiner
  3. //===== By: ==================================================
  4. //= Euphy
  5. //===== Current Version: =====================================
  6. //= 1.1
  7. //===== Compatible With: =====================================
  8. //= rAthena Project
  9. //===== Description: =========================================
  10. //= [Official Conversion]
  11. //= Refiner that uses +5~9/+11 refine tickets to refine
  12. //= equipment with no chance of failure.
  13. //= NOTE: This NPC is currently disabled on official servers.
  14. //===== Additional Comments: =================================
  15. //= 1.0 First version. [Euphy]
  16. //= 1.1 Do not refine above ticket level. [Euphy]
  17. //============================================================
  18. // Main NPC :: safety_Ref_NPC
  19. //============================================================
  20. prontera,184,177,6 script Refine Master 851,{
  21. disable_items;
  22. setarray .@cert_weapon[0],
  23. 6864, // Guarantee_Weapon_19Up
  24. 6875, // Guarantee_Weapon_18Up
  25. 6874, // Guarantee_Weapon_17Up
  26. 6873, // Guarantee_Weapon_16Up
  27. 6872, // Guarantee_Weapon_15Up
  28. 6871, // Guarantee_Weapon_14Up
  29. 6870, // Guarantee_Weapon_13Up
  30. 6584, // Guarantee_Weapon_12Up
  31. 6238, // Guarantee_Weapon_11Up
  32. 6228, // Guarantee_Weapon_9Up
  33. 6229, // Guarantee_Weapon_8Up
  34. 6230, // Guarantee_Weapon_7Up
  35. 6231, // Guarantee_Weapon_6Up
  36. 6456; // Guarantee_Weapon_5Up
  37. setarray .@cert_armor[0],
  38. 6865, // Guarantee_Armor_19Up
  39. 6881, // Guarantee_Armor_18Up
  40. 6880, // Guarantee_Armor_17Up
  41. 6879, // Guarantee_Armor_16Up
  42. 6878, // Guarantee_Armor_15Up
  43. 6877, // Guarantee_Armor_14Up
  44. 6876, // Guarantee_Armor_13Up
  45. 6585, // Guarantee_Armor_12Up
  46. 6239, // Guarantee_Armor_11Up
  47. 6232, // Guarantee_Armor_9Up
  48. 6233, // Guarantee_Armor_8Up
  49. 6234, // Guarantee_Armor_7Up
  50. 6235, // Guarantee_Armor_6Up
  51. 6457; // Guarantee_Armor_5Up
  52. setarray .@cert_level[0],19,18,17,16,15,14,13,12,11,9,8,7,6,5;
  53. .@size_cert = getarraysize(.@cert_weapon);
  54. for ( .@i = 0; .@i < .@size_cert; ++.@i ) {
  55. if (countitem(.@cert_weapon[.@i]) > 0 || countitem(.@cert_armor[.@i]) > 0) {
  56. .@check = 1;
  57. break;
  58. }
  59. }
  60. if (.@check == 0) {
  61. mes "[Refine Master]";
  62. mes "Hello!";
  63. mes "What's up?";
  64. mes "I'm a specialist";
  65. mes "for refining items,";
  66. mes "but I don't work anymore.";
  67. next;
  68. switch(select("I'll go on my way.:Hmm... this makes me curious.")) {
  69. case 1:
  70. mes "[Refine Master]";
  71. mes "Take care, adventurer.";
  72. close;
  73. case 2:
  74. mes "[Refine Master]";
  75. mes "Actually, I sometimes provide refine services for adventurers with a ^006400Refine Ticket^000000...";
  76. mes "Bye bye~!";
  77. close;
  78. }
  79. }
  80. emotion ET_SURPRISE;
  81. mes "[Refine Master]";
  82. mes "Greetings!";
  83. mes "I can refine an item up to the ^006400same level as your ticket^000000.";
  84. mes "You don't have to worry! There's no chance of breaking your item.";
  85. next;
  86. if(select("I'll come back later.:Refine item with ticket.") == 1) {
  87. mes "[Refine Master]";
  88. mes "Okay.";
  89. mes "You can come again later.";
  90. close;
  91. }
  92. mes "[Refine Master]";
  93. mes "Which equipment would you like to refine?";
  94. next;
  95. setarray .@position$[1],"Head upper","Armor","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head middle","Head lower";
  96. 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;
  97. for ( .@i = 1; .@i <= 10; ++.@i )
  98. .@menu$ += (getequipisequiped(.@indices[.@i]) ? getequipname(.@indices[.@i]) : .@position$[.@i] + "- [Empty]") + ":";
  99. .@part = .@indices[ select(.@menu$) ];
  100. if (!getequipisequiped(.@part)) {
  101. mes "[Refine Master]";
  102. mes "You have to equip the item you want to refine.";
  103. close;
  104. }
  105. if (!getequipisenableref(.@part)) {
  106. emotion ET_OTL;
  107. mes "[Refine Master]";
  108. mes "Oh, I'm sorry.";
  109. mes "This item is impossible to refine.";
  110. close;
  111. }
  112. .@refineitemid = getequipid(.@part); // save id of the item
  113. .@refinerycnt = getequiprefinerycnt(.@part); //save refinery count
  114. setarray .@card[0], getequipcardid(.@part,0), getequipcardid(.@part,1), getequipcardid(.@part,2), getequipcardid(.@part,3);
  115. .@itemtype = getiteminfo( .@refineitemid, ITEMINFO_TYPE );
  116. if( .@itemtype == IT_WEAPON ){
  117. switch( getequipweaponlv( .@part ) ){
  118. case 1:
  119. case 2:
  120. case 3:
  121. case 4:
  122. copyarray .@tickets[0], .@cert_weapon[0], .@size_cert;
  123. .@type$ = "Weapon";
  124. break;
  125. default:
  126. // TODO:
  127. close;
  128. }
  129. }else if( .@itemtype == IT_ARMOR ){
  130. switch( getequiparmorlv( .@part ) ){
  131. case 1:
  132. copyarray .@tickets[0], .@cert_armor[0], .@size_cert;
  133. .@type$ = "Armor";
  134. break;
  135. default:
  136. // TODO:
  137. close;
  138. }
  139. }else{
  140. // TODO:
  141. close;
  142. }
  143. .@check = 0;
  144. for ( .@i = 0; .@i < .@size_cert; ++.@i ) {
  145. if (countitem(.@tickets[.@i]) > 0) {
  146. .@check = 1;
  147. break;
  148. }
  149. }
  150. if (.@check == 0) {
  151. emotion ET_THINK;
  152. mes "[Refine Master]";
  153. mes "If you want to refine this ^006400"+.@type$+"^000000, please come along with ^006400"+.@type$+" Refine Ticket^000000.";
  154. mes "See you later!";
  155. close;
  156. }
  157. mes "[Refine Master]";
  158. mes "Please choose which ^006400"+.@type$+" Refine Ticket^000000 you want to use.";
  159. next;
  160. .@menu$ = "";
  161. for ( .@i = 0; .@i < .@size_cert; ++.@i )
  162. .@menu$ += getitemname(.@tickets[.@i]) + ":";
  163. .@select = select(.@menu$)-1;
  164. .@ticket_lv = .@cert_level[.@select];
  165. .@ticket_id = .@tickets[.@select];
  166. if (countitem(.@ticket_id) == 0) {
  167. emotion ET_QUESTION;
  168. mes "[Refine Master]";
  169. mes getitemname(.@ticket_id)+" is not in your inventory. Did you put it in your storage?";
  170. mes "Please check again.";
  171. mes "See you later!";
  172. close;
  173. }
  174. if (getequiprefinerycnt(.@part) >= .@ticket_lv) {
  175. emotion ET_PROFUSELY_SWEAT;
  176. mes "[Refine Master]";
  177. mes "^8B4513This item is already refined as much as your deed.^000000";
  178. mes "Please come along with an item refined less than your ticket.";
  179. close;
  180. }
  181. mes "[Refine Master]";
  182. mes "I'm going to refine ^006400"+getequipname(.@part)+"^8B4513 up to the +"+.@ticket_lv+" level^000000 with ^006400"+getitemname(.@ticket_id)+"^000000.";
  183. mes "May I proceed?";
  184. next;
  185. if(select("No.:Yes.") == 1) {
  186. emotion ET_THINK;
  187. mes "[Refine Master]";
  188. mes "Oh, you changed your mind.";
  189. mes "Ok.";
  190. mes "You can come back later.";
  191. close;
  192. }
  193. mes "[Refine Master]";
  194. mes "Great.";
  195. mes "As you wish!";
  196. mes "I have my own special way to refine...";
  197. mes ".......ka boom!";
  198. specialeffect EF_SUI_EXPLOSION;
  199. if (countitem(.@ticket_id) < 1) {
  200. next;
  201. mes "Error!";
  202. mes "Please report this.";
  203. close;
  204. }
  205. delitem .@ticket_id,1;
  206. // anti-hack
  207. if (callfunc("F_IsEquipIDHack", .@part, .@refineitemid) ||
  208. callfunc("F_IsEquipRefineHack", .@part, .@refinerycnt) || callfunc("F_IsEquipCardHack", .@part, .@card[0], .@card[1], .@card[2], .@card[3])) {
  209. mes "[Refine Master]";
  210. emotion ET_FRET;
  211. mes "Wait a second...";
  212. mes "Do you think I'm stupid?!";
  213. mes "You switched the item while I wasn't looking! Get out of here!";
  214. close;
  215. }
  216. successrefitem .@part, .@ticket_lv - getequiprefinerycnt(.@part);
  217. next;
  218. emotion ET_DELIGHT;
  219. mes "[Refine Master]";
  220. mes "Alright, here it is~";
  221. mes "Well, ^0000FF"+strcharinfo(0)+"^000000!";
  222. mes "Congratulations on your shining "+.@type$+".";
  223. mes "You look GREAT!";
  224. mes "Farewell~!";
  225. close;
  226. }