hd_refiner.txt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. //===== rAthena Script =======================================
  2. //= HD Refiners
  3. //===== Description: =========================================
  4. //= [Official Conversion]
  5. //= Refiners that use HD ores to refine equipment. Upon
  6. //= failure, the equipment is not destroyed; rather, its
  7. //= refine level decreases by 1. The success rate is identical
  8. //= to that for Enriched ores.
  9. //= - "Blacksmith Mighty Hammer" only refines from +7~9.
  10. //= - "Basta" only refines from +10 and up.
  11. //===== Changelog: ===========================================
  12. //= 1.0 First version. [Euphy]
  13. //= 1.1 Removed re-roll behavior. [Secret]
  14. //============================================================
  15. // Blacksmith Mighty Hammer (+7~9) :: cash_smelting79
  16. //============================================================
  17. - script ::MightyHammer -1,{
  18. disable_items;
  19. mes "[Blacksmith Mighty Hammer]";
  20. mes "Unlike others, I am a blacksmith who refines a very limited number of items.";
  21. mes "I refine only items that are ^CC0000+7 to +9^000000.";
  22. next;
  23. mes "[Blacksmith Mighty Hammer]";
  24. mes "My specialty is that even if my refining fails, the refine level decreases by 1 without losing the gear. Isn't it great?";
  25. next;
  26. mes "[Blacksmith Mighty Hammer]";
  27. mes "So lets kick this into overdrive, what d' ya say? What item do you want to refine?";
  28. next;
  29. 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;
  30. for ( .@i = 1; .@i <= 10; ++.@i )
  31. .@menu$ = .@menu$ + ( getequipisequiped(.@indices[.@i]) ? getequipname(.@indices[.@i]) : F_getpositionname(.@indices[.@i]) + "-[Not equipped]" ) + ":";
  32. .@part = .@indices[ select(.@menu$) ];
  33. if (!getequipisequiped(.@part)) {
  34. mes "[Blacksmith Mighty Hammer]";
  35. switch(.@part) {
  36. case EQI_HEAD_TOP:
  37. mes "I'm a blacksmith, not a hairstylist.";
  38. break;
  39. case EQI_ARMOR:
  40. mes "With my hammer, I will make you a star of the sky.";
  41. break;
  42. case EQI_HAND_L:
  43. case EQI_HAND_R:
  44. mes "Making artificial hands is not my specialty.";
  45. break;
  46. case EQI_GARMENT:
  47. mes "Bring out the item so I can refine it!";
  48. break;
  49. case EQI_SHOES:
  50. mes "Where is this foot odor coming from?";
  51. break;
  52. case EQI_ACC_L:
  53. case EQI_ACC_R:
  54. mes "Where is the accessory?";
  55. break;
  56. case EQI_HEAD_MID:
  57. mes "What do you want me to refine?";
  58. break;
  59. case EQI_HEAD_LOW:
  60. mes "Huh? What do you want me to do?";
  61. break;
  62. }
  63. close;
  64. }
  65. if (!getequipisenableref(.@part)) {
  66. mes "[Blacksmith Mighty Hammer]";
  67. mes "This item can't be refined.";
  68. close;
  69. }
  70. switch( getequiprefinerycnt(.@part) ) {
  71. case 7:
  72. .@blacksmith_blessing_count = 1;
  73. break;
  74. case 8:
  75. .@blacksmith_blessing_count = 2;
  76. break;
  77. case 9:
  78. .@blacksmith_blessing_count = 4;
  79. break;
  80. default:
  81. mes "[Blacksmith Mighty Hammer]";
  82. mes "I only handle items with refine levels from +7 to +9.";
  83. close;
  84. }
  85. .@refineitemid = getequipid(.@part); // save id of the item
  86. .@itemtype = getiteminfo( .@refineitemid, ITEMINFO_TYPE );
  87. .@refinerycnt = getequiprefinerycnt(.@part); //save refinery count
  88. setarray .@card[0], getequipcardid(.@part,0), getequipcardid(.@part,1), getequipcardid(.@part,2), getequipcardid(.@part,3);
  89. .@price = getequiprefinecost(.@part, REFINE_COST_HD, REFINE_ZENY_COST);
  90. .@material = getequiprefinecost(.@part, REFINE_COST_HD, REFINE_MATERIAL_ID);
  91. mes "[Blacksmith Mighty Hammer]";
  92. mes "In order to refine the gear you selected you need ^ff9999" + getitemname(.@material) + "^000000 and 20,000 zeny as a fee.";
  93. mes "Do you have them ready?";
  94. next;
  95. if (select("Yes:No") == 2) {
  96. mes "[Blacksmith Mighty Hammer]";
  97. mes "I will wait until you are ready.";
  98. close;
  99. }
  100. if (getequippercentrefinery(.@part) < 100) {
  101. mes "[Blacksmith Mighty Hammer]";
  102. mes "It looks like this item will likely fail to be refined.";
  103. mes "Well, even if it fails, it only decreases by 1 refine level.";
  104. mes "Would you like to continue refining?";
  105. next;
  106. if (countitem(6635) < .@blacksmith_blessing_count)
  107. setarray .@menu$[0], "", "Yes", "Not yet";
  108. else {
  109. mes "[Blacksmith Mighty Hammer]";
  110. mes "Ah! Is it the ^0000ffBlacksmith Blessing^000000?";
  111. mes "With the Blacksmith Blessing, the equipment won't vanish if the refine fails!";
  112. next;
  113. mes "[Blacksmith Mighty Hammer]";
  114. if ( .@itemtype != IT_WEAPON )
  115. mes "For +" + getequiprefinerycnt(.@part) + " equipment, refine with^316AC5 " + .@blacksmith_blessing_count + " unit(s) Blacksmith Blessing^000000 can prevent the equipment from vanishing. Do you want use it to refine?";
  116. else
  117. mes "For +" + getequiprefinerycnt(.@part) + " weapon, refine with^316AC5 " + .@blacksmith_blessing_count + " unit(s) Blacksmith Blessing^000000 can prevent the equipment from vanishing. Do you want use it to refine?";
  118. next;
  119. setarray .@menu$[0], "Use it to refine", "Refine directly without it", "Don't refine yet";
  120. }
  121. switch( select(.@menu$[0], .@menu$[1], .@menu$[2]) ) {
  122. case 1:
  123. .@bless_who = 1;
  124. break;
  125. case 2:
  126. break;
  127. case 3:
  128. mes "[Blacksmith Mighty Hammer]";
  129. mes "Only those who overcome fear of failure will obtain a masterpiece.";
  130. close;
  131. }
  132. }
  133. if ((.@bless_who && countitem(6635) < .@blacksmith_blessing_count) || countitem(.@material) == 0 || Zeny < .@price) {
  134. mes "[Blacksmith Mighty Hammer]";
  135. mes "Didn't you just say you had everything ready?";
  136. close;
  137. }
  138. if (.@bless_who)
  139. delitem 6635, .@blacksmith_blessing_count;
  140. delitem .@material,1;
  141. Zeny = Zeny - .@price;
  142. // anti-hack
  143. if (callfunc("F_IsEquipIDHack", .@part, .@refineitemid) || callfunc("F_IsEquipCardHack", .@part, .@card[0], .@card[1], .@card[2], .@card[3]) ||
  144. callfunc("F_IsEquipRefineHack", .@part, .@refinerycnt)) {
  145. mes "[Blacksmith Mighty Hammer]";
  146. emotion ET_FRET;
  147. mes "Wait a second...";
  148. mes "Do you think I'm stupid?!";
  149. mes "You switched the item while I wasn't looking! Get out of here!";
  150. close;
  151. }
  152. mes "[Blacksmith Mighty Hammer]";
  153. mes "Tac! Tac! Tac!";
  154. if (getequippercentrefinery(.@part, true) > rand(100)) {
  155. successrefitem .@part;
  156. next;
  157. emotion ET_BEST;
  158. mes "[Blacksmith Mighty Hammer]";
  159. mes "The sound refreshes my mind every time I hear it.";
  160. mes "Here, have it. Refine succeeded flawlessly!";
  161. close;
  162. }
  163. if (.@bless_who == 1) {
  164. specialeffect EF_HOLYHIT;
  165. next;
  166. emotion ET_HUK;
  167. mes "[Blacksmith Mighty Hammer]";
  168. mes "What?!!";
  169. next;
  170. mes "[Blacksmith Mighty Hammer]";
  171. mes "Aiya! I am faceless now. HmHm.";
  172. close;
  173. }
  174. downrefitem .@part;
  175. next;
  176. emotion ET_HUK;
  177. mes "[Blacksmith Mighty Hammer]";
  178. mes "Oops!!";
  179. next;
  180. mes "[Blacksmith Mighty Hammer]";
  181. mes "I am sure a person like you would never blame me for a decrease in refine level by 1. Hmm.";
  182. close;
  183. }
  184. prt_in,59,54,3 duplicate(MightyHammer) Mighty Hammer#prt 4_M_DWARF
  185. morocc_in,65,30,3 duplicate(MightyHammer) Mighty Hammer#morocc 4_M_DWARF
  186. payon,148,176,3 duplicate(MightyHammer) Mighty Hammer#pay 4_M_DWARF
  187. alberta_in,16,56,3 duplicate(MightyHammer) Mighty Hammer#alb 4_M_DWARF
  188. yuno_in01,171,18,3 duplicate(MightyHammer) Mighty Hammer#yuno 4_M_DWARF
  189. ein_in01,22,82,3 duplicate(MightyHammer) Mighty Hammer#ein 4_M_DWARF
  190. lhz_in02,280,19,3 duplicate(MightyHammer) Mighty Hammer#lhz 4_M_DWARF
  191. // iRO NPC locations:
  192. // payon,174,133,4 duplicate(MightyHammer) Mighty Hammer#im 4_M_DWARF
  193. // Basta (+10 and up) :: cash_smelting
  194. //============================================================
  195. - script ::Basta -1,{
  196. disable_items;
  197. mes "[Basta]";
  198. mes "I'm the best Blacksmith in the whole world, Basta.";
  199. mes "But I don't provide a normal refine service.";
  200. mes "I only refine equipment ^CC0000over +10^000000.";
  201. next;
  202. mes "[Basta]";
  203. mes "Which equipment do you want to refine?";
  204. next;
  205. 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;
  206. for ( .@i = 1; .@i <= 10; ++.@i )
  207. .@menu$ = .@menu$ + ( getequipisequiped(.@indices[.@i]) ? getequipname(.@indices[.@i]) : F_getpositionname(.@indices[.@i]) + "-[Unequipped]" ) + ":";
  208. .@part = .@indices[ select(.@menu$) ];
  209. if (!getequipisequiped(.@part)) {
  210. mes "[Basta]";
  211. switch(.@part) {
  212. case EQI_HEAD_TOP:
  213. mes "Is your head an equipment?";
  214. break;
  215. case EQI_ARMOR:
  216. mes "What do you want me to do?";
  217. break;
  218. case EQI_HAND_L:
  219. case EQI_HAND_R:
  220. mes "Making artificial hands is not my specialty.";
  221. break;
  222. case EQI_GARMENT:
  223. mes "Do you even know what a robe is?";
  224. break;
  225. case EQI_SHOES:
  226. mes "If you want to refine your feet, don't come to me, try running a marathon.";
  227. break;
  228. case EQI_ACC_L:
  229. case EQI_ACC_R:
  230. mes "Where is the accessory?";
  231. break;
  232. case EQI_HEAD_MID:
  233. mes "Well... I don't see any equipment worth refining.";
  234. break;
  235. case EQI_HEAD_LOW:
  236. mes "I can't make you smart. Go see a school teacher for that.";
  237. break;
  238. }
  239. close;
  240. }
  241. if (!getequipisenableref(.@part)) {
  242. mes "[Basta]";
  243. mes "Even I cannot refine this item. There's no way.";
  244. close;
  245. }
  246. .@refine_count = getequiprefinerycnt(.@part);
  247. if (.@refine_count < 10) {
  248. mes "[Basta]";
  249. mes "Haven't I told you? I only refine equipment that are +10 and above.";
  250. close;
  251. }
  252. else if (.@refine_count == 10)
  253. .@blacksmith_blessing_count = 7;
  254. else if (.@refine_count == 11)
  255. .@blacksmith_blessing_count = 11;
  256. else if (.@refine_count == 20) {
  257. mes "[Basta]";
  258. mes "This weapon is perfect, no need to refine it anymore~";
  259. close;
  260. }
  261. .@refineitemid = getequipid(.@part); // save id of the item
  262. .@itemtype = getiteminfo( .@refineitemid, ITEMINFO_TYPE );
  263. .@refinerycnt = getequiprefinerycnt(.@part); //save refinery count
  264. setarray .@card[0], getequipcardid(.@part,0), getequipcardid(.@part,1), getequipcardid(.@part,2), getequipcardid(.@part,3);
  265. .@price = getequiprefinecost(.@part, REFINE_COST_HD, REFINE_ZENY_COST);
  266. .@material = getequiprefinecost(.@part, REFINE_COST_HD, REFINE_MATERIAL_ID);
  267. if ( .@itemtype != IT_WEAPON )
  268. .@type$ = "armor";
  269. else
  270. .@type$ = "weapon";
  271. mes "[Basta]";
  272. mes "Hmm... is this the one you want to refine?";
  273. mes "To refine this equipment, I need 1 ^ff9999" + getitemname(.@material) + "^000000 and " + callfunc("F_InsertComma",.@price) + " zeny as a fee.";
  274. mes "Do you really want to refine this?";
  275. next;
  276. if (select("Yes:No") == 2) {
  277. mes "[Basta]";
  278. mes "Okay. If that's what you want...";
  279. close;
  280. }
  281. if (getequippercentrefinery(.@part, true) < 100) {
  282. mes "[Basta]";
  283. mes "This " + .@type$ + " has already been refined pretty high.";
  284. mes "If you try to refine it more, the refine level could decrease.";
  285. next;
  286. mes "[Basta]";
  287. mes "I am different from the blacksmiths in others places.";
  288. mes "It is impossible that the refine level will drop by, say, 3 or 4... that sounds scary.";
  289. mes "Here it can only decrease by 1 level.";
  290. next;
  291. if (.@blacksmith_blessing_count == 0 || countitem(6635) < .@blacksmith_blessing_count) {
  292. mes "[Basta]";
  293. mes "Compared to other blacksmiths, the risk is smaller.";
  294. mes "I've given all precautions. Do you want to try it?";
  295. next;
  296. setarray .@menu$[0], "", "Yes", "No";
  297. }
  298. else {
  299. mes "[Basta]";
  300. mes "Woah~ Is it the ^316AC5Blacksmith Blessing^000000? It is difficult to get~ But, you have it!";
  301. next;
  302. mes "[Basta]";
  303. mes "For +" + .@refine_count + " " + .@type$ + " need ^316AC5" + .@blacksmith_blessing_count + " unit(s) Blacksmith Blessing^000000 can prevent the equipment from vanishing. Do you want to refine with Blacksmith Blessing?";
  304. next;
  305. setarray .@menu$[0], "Refine with Blacksmith Blessing", "Refine without Blacksmith Blessing", "Don't refine yet";
  306. }
  307. switch( select(.@menu$[0], .@menu$[1], .@menu$[2]) ) {
  308. case 1:
  309. .@bless_who = 1;
  310. break;
  311. case 2:
  312. break;
  313. case 3:
  314. mes "[Basta]";
  315. mes "Well~";
  316. mes "Not challenging at all could also be a kind of wisdom in life.";
  317. close;
  318. }
  319. }
  320. if ((.@bless_who && countitem(6635) < .@blacksmith_blessing_count) || countitem(.@material) == 0 || Zeny < .@price) {
  321. mes "[Basta]";
  322. mes "Hmm... You didn't bring all the materials needed.";
  323. mes "Come back when you have them all.";
  324. close;
  325. }
  326. if (.@bless_who)
  327. delitem 6635, .@blacksmith_blessing_count;
  328. delitem .@material,1;
  329. Zeny = Zeny - .@price;
  330. // anti-hack
  331. if (callfunc("F_IsEquipIDHack", .@part, .@refineitemid) || callfunc("F_IsEquipCardHack", .@part, .@card[0], .@card[1], .@card[2], .@card[3]) ||
  332. callfunc("F_IsEquipRefineHack", .@part, .@refinerycnt)) {
  333. mes "[Basta]";
  334. emotion ET_FRET;
  335. mes "Wait a second...";
  336. mes "Do you think I'm stupid?!";
  337. mes "You switched the item while I wasn't looking! Get out of here!";
  338. close;
  339. }
  340. mes "Pow! Pow! Pow! Pow!";
  341. if (getequippercentrefinery(.@part, true) > rand(100)) {
  342. successrefitem .@part;
  343. next;
  344. emotion ET_BEST;
  345. mes "[Basta]";
  346. mes "Great! Nicely done!!";
  347. mes "I really am the best blacksmith in the whole wide world!";
  348. close;
  349. }
  350. if (.@bless_who == 1) {
  351. specialeffect EF_HOLYHIT;
  352. next;
  353. emotion (!rand(5))?ET_MONEY:ET_HUK;
  354. mes "[Basta]";
  355. mes "Aaaaaaaaaaak!!!";
  356. next;
  357. mes "[Basta]";
  358. mes "Refining has failed!";
  359. mes "The best blacksmith in the world like me...";
  360. mes "doesn't guarantee 100% success~";
  361. }
  362. else {
  363. downrefitem .@part;
  364. next;
  365. emotion (!rand(5))?ET_MONEY:ET_HUK;
  366. mes "[Basta]";
  367. mes "Aaaaaaaaaaak!!!";
  368. next;
  369. mes "[Basta]";
  370. mes "Damn it!";
  371. mes "Refining has failed and refine level has decreased!";
  372. mes "Even the best blacksmith in the world doesn't guarantee 100% success!";
  373. }
  374. mes "Too bad.";
  375. next;
  376. mes "[Basta]";
  377. mes "I'll do better next time! Don't worry!";
  378. close;
  379. }
  380. prt_in,57,54,3 duplicate(Basta) Basta#prt 4_M_DWARF
  381. morocc_in,68,30,3 duplicate(Basta) Basta#morocc 4_M_DWARF
  382. payon,148,174,3 duplicate(Basta) Basta#payon 4_M_DWARF
  383. alberta_in,18,56,3 duplicate(Basta) Basta#alberta 4_M_DWARF
  384. yuno_in01,173,18,3 duplicate(Basta) Basta#yuno 4_M_DWARF
  385. ein_in01,24,82,3 duplicate(Basta) Basta#einbroch 4_M_DWARF
  386. lhz_in02,280,17,3 duplicate(Basta) Basta#lighthalzen 4_M_DWARF
  387. // Refine UI makes these NPCs useless
  388. - script RefineUI_Init -1,{
  389. end;
  390. OnInit:
  391. if (getbattleflag("feature.refineui")) {
  392. unloadnpc "Basta";
  393. unloadnpc "MightyHammer";
  394. }
  395. end;
  396. }