shadow_refiner.txt 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. //===== rAthena Script =======================================
  2. //= Shadow Blacksmith
  3. //===== Description: =========================================
  4. //= [Official Conversion]
  5. //= Shadow equipments refining NPC.
  6. //===== Changelog: ===========================================
  7. //= 1.0 First version [Aleos]
  8. //= 1.1 Removed re-roll behavior and fetch materials from db
  9. //= [Secret]
  10. //= 1.2 Added Refine UI [Atemo, Lemongrass]
  11. //= 1.3 Moved to Cash Mall [Lemongrass]
  12. //============================================================
  13. - script ::ShadowBlacksmith -1,{
  14. if( getbattleflag( "feature.refineui" ) ){
  15. mes "[Shadow Blacksmith]";
  16. mes "Now Basta is in charge of refinement for shadow items.";
  17. mes "If you'd like to refine a shadow item, please visit him.";
  18. close;
  19. }
  20. .@zeny_cost = 200000; // Zeny cost is 200,000 according to official script [Secret]
  21. disable_items;
  22. mes "[Shadow Blacksmith]";
  23. mes "Do you want to refine a shadow item? Pick yer poison!";
  24. next;
  25. setarray .@indices[1], EQI_SHADOW_ARMOR, EQI_SHADOW_WEAPON, EQI_SHADOW_SHIELD, EQI_SHADOW_SHOES, EQI_SHADOW_ACC_R, EQI_SHADOW_ACC_L;
  26. .@indlen = getarraysize(.@indices) - 1;
  27. for(.@i = 1; .@i <= .@indlen; .@i++)
  28. .@menu$ = .@menu$ + (getequipisequiped(.@indices[.@i]) ? getequipname(.@indices[.@i]) : F_getpositionname(.@indices[.@i]) +"-[Not equipped]") +":";
  29. .@menu$ = .@menu$ + "Refine info";
  30. .@choice = select(.@menu$);
  31. if (.@choice == .@indlen + 1) { // Refine info
  32. mes "[Shadow Blacksmith]";
  33. mes "When a shadow item is refined, it gains extra bonuses very much like normal items.";
  34. next;
  35. mes "[Shadow Blacksmith]";
  36. mes "Weapon: ATK, MATK + 1 increase for each +1 refine success.";
  37. mes "Etc: HP + 10 increase for each +1 refine success.";
  38. next;
  39. mes "[Shadow Blacksmith]";
  40. mes "All types of Oridecon and Elunium can be used to refine shadow items. Each attempt will also cost 20,000 zeny.";
  41. next;
  42. mes "[Shadow Blacksmith]";
  43. mes "HD ores can be used for gear that is at least refine level +7 and will prevent breaking as long as you stay talking to me.";
  44. close;
  45. }
  46. .@part = .@indices[.@choice];
  47. if (!getequipisequiped(.@part)) {
  48. mes "[Shadow Blacksmith]";
  49. mes "There's nothing here!";
  50. close;
  51. }
  52. .@equip_id = getequipid(.@part);
  53. setarray .@card[0], getequipcardid(.@part,0), getequipcardid(.@part,1), getequipcardid(.@part,2), getequipcardid(.@part,3);
  54. while(1) {
  55. .@equip_refine = getequiprefinerycnt(.@part);
  56. mes "[Shadow Blacksmith]";
  57. mes "I require " + callfunc("F_InsertComma", .@zeny_cost) + " zeny as a fee for EACH refine attempt.";
  58. mes "Choose your Ore and start refining.";
  59. next;
  60. .@material[0] = getequiprefinecost(.@part, REFINE_COST_NORMAL, REFINE_MATERIAL_ID);
  61. .@material[1] = getequiprefinecost(.@part, REFINE_COST_ENRICHED, REFINE_MATERIAL_ID);
  62. .@material[2] = getequiprefinecost(.@part, REFINE_COST_HD, REFINE_MATERIAL_ID);
  63. .@is_enriched = false;
  64. if (countitem(.@material[0]))
  65. .@mate$[0] = getitemname(.@material[0]);
  66. else
  67. .@mate$[0] = "^8C8C8C"+ getitemname(.@material[0]) +"^000000";
  68. if (countitem(.@material[1]))
  69. .@mate$[1] = getitemname(.@material[1]);
  70. else
  71. .@mate$[1] = "^8C8C8C"+ getitemname(.@material[1]) +"^000000";
  72. if (.@equip_refine > 6 && countitem(.@material[2]))
  73. .@mate$[2] = getitemname(.@material[2]);
  74. else
  75. .@mate$[2] = "^8C8C8C"+ getitemname(.@material[2]) +"^000000";
  76. switch( select( .@mate$[0], .@mate$[1], .@mate$[2], "Cancel" ) ) {
  77. case 1:// NORMAL
  78. .@choose = .@material[0];
  79. break;
  80. case 2:// ENRICHED
  81. .@is_enriched = true;
  82. .@choose = .@material[1];
  83. break;
  84. case 3:// HD
  85. if (.@equip_refine < 7) {
  86. mes "[Shadow Blacksmith]";
  87. mes "HD Ore can only used for +7 or higher refine level items.";
  88. close;
  89. }
  90. .@hoihoi = 1;
  91. .@choose = .@material[2];
  92. break;
  93. case 4:
  94. mes "[Shadow Blacksmith]";
  95. mes "You've cancelled refining.";
  96. close;
  97. }
  98. if (!countitem(.@choose)) {
  99. mes "[Shadow Blacksmith]";
  100. mes "You do not have enough "+ getitemname(.@choose) +".";
  101. close;
  102. }
  103. if (Zeny < .@zeny_cost) {
  104. mes "[Shadow Blacksmith]";
  105. mes "You do not have enough zeny.";
  106. close;
  107. }
  108. if (.@equip_refine > 9) {
  109. mes "[Shadow Blacksmith]";
  110. mes "Shadow Equipment can be refined to the maximum of 10...";
  111. close;
  112. }
  113. if (!getequipisenableref(.@part)) {
  114. mes "[Shadow Blacksmith]";
  115. mes "This item cannot be refined.";
  116. close;
  117. }
  118. if (getequippercentrefinery(.@part) < 100) {
  119. mes "[Shadow Blacksmith]";
  120. mes "The safety refine level for Shadow Equipment is +4.";
  121. if (!.@hoihoi)
  122. mes "Shadow equipment may be destroyed in subsequent refinements. Want to get started?";
  123. else
  124. mes "The next refinement, if it fails, will degrade the refinement. Do you want to refine?";
  125. next;
  126. if (select("Proceed","Cancel") == 2) {
  127. mes "[Shadow Blacksmith]";
  128. mes "Heh, I knew it!";
  129. close;
  130. }
  131. }
  132. mes "[Shadow Blacksmith]";
  133. mes "Well then.. here goes nothing!";
  134. next;
  135. delitem .@choose,1;
  136. Zeny -= .@zeny_cost;
  137. // anti-hack
  138. if (callfunc("F_IsEquipIDHack", .@part, .@equip_id) || callfunc("F_IsEquipCardHack", .@part, .@card[0], .@card[1], .@card[2], .@card[3]) || callfunc("F_IsEquipRefineHack", .@part, .@equip_refine))
  139. close;
  140. if (getequippercentrefinery(.@part, .@is_enriched) > rand(100)) {
  141. successrefitem .@part;
  142. mes "[Shadow Blacksmith]";
  143. mes "It worked! It worked!";
  144. next;
  145. } else {
  146. if (.@hoihoi)
  147. downrefitem .@part;
  148. else
  149. failedrefitem .@part;
  150. mes "[Shadow Blacksmith]";
  151. mes "Oh Odin No!";
  152. close;
  153. }
  154. }
  155. }
  156. //moc_paraup,45,185,5 duplicate(ShadowBlacksmith) Shadow Blacksmith#eden1 4_F_JOB_BLACKSMITH // Commented out until it's added to the map index
  157. //prt_in,61,54,3 duplicate(ShadowBlacksmith) Shadow Blacksmith#itemmall 4_F_JOB_BLACKSMITH
  158. itemmall,31,76,3 duplicate(ShadowBlacksmith) Shadow Blacksmith#itemmall 4_F_JOB_BLACKSMITH