xTaric

enchant_faw

Jul 9th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.82 KB | None | 0 0
  1. //===== rAthena Script =======================================
  2. //= Unofficial Fallen Angel Wing (FAW) Enchants
  3. //===== By: ==================================================
  4. //= Nerfwood
  5. //===== Current Version: =====================================
  6. //= 1.0
  7. //===== Compatible With: =====================================
  8. //= rAthena Project
  9. //===== Description: =========================================
  10. //= Enchants FAW as per iROWiki's information
  11. //= Dialogue are unofficial
  12. //===== Additional Comments: =================================
  13. //= 1.0 First Version
  14. //============================================================
  15.  
  16. //Decreasing Chance of Enchantment
  17. // 60% low, 30% mid, 10% high for 1st & 2nd enchant slot
  18. //40% low, 30% mid, 20% high, 10% special for 3rd enchant slot
  19. function script EnchantStat_1 {
  20.  
  21. .chance = rand(1,10);
  22.  
  23. if(@card2 && @card3) { //For 4th Slot aka 3rd Enchant Slot
  24.  
  25. if(.chance<5) .x=0;
  26. else if(.chance<7) .x=1;
  27. else if(.chance<9) .x=2;
  28. else .x=3;
  29.  
  30. }
  31. else { //For 2nd and 3rd card slot aka 1st and 2nd Enchant Slot
  32.  
  33. if(.chance<7) .x=0;
  34. else if(.chance<10) .x=1;
  35. else .x=2;
  36. }
  37. return getelementofarray(getvariableofnpc( getd(".enc" + getarg(0) ) , "Valkyrie#faw"), .x );
  38.  
  39. }
  40.  
  41.  
  42.  
  43.  
  44. //Equal Chance of Enchanting
  45. function script EnchantStat_0 {
  46. if(@card2 && @card3)
  47. return getelementofarray(getvariableofnpc( getd(".enc" + getarg(0) ) , "Valkyrie#faw"), rand(0,3) );
  48. else
  49. return getelementofarray(getvariableofnpc( getd(".enc" + getarg(0) ) , "Valkyrie#faw"), rand(0,2) );
  50.  
  51. }
  52.  
  53.  
  54. //=======MAIN NPC
  55.  
  56. moc_para01,180,23,3 script Valkyrie#faw 403,{
  57. mes .npc$;
  58. mes "I am here to enchant the",
  59. "magnificent ^000099Fallen Angel Wing^000000.",
  60. "Would you like to enchant yours?";
  61. if(countitem(2589)) {
  62. set .@menu$, "Enchant Fallen Angel Wing";
  63. }
  64. else .@menu$="";
  65. next;
  66. switch(select("Information:" + .@menu$ + ":Reset Enchantment"))
  67. {
  68. case 1: goto OnInformation;
  69. case 2: goto OnEnchantNow;
  70. case 3: goto OnResetEnchant;
  71. default: close;
  72. }
  73.  
  74. OnInformation:
  75. mes .npc$,
  76. "I can enchant your",
  77. "^000099Fallen Angel Wing^000000 for",
  78. (.cost?callfunc("F_InsertComma",.cost)+"z":"free")+" to give it various.",
  79. "effects. In fact, I can do it",
  80. "twice if its refinement level is",
  81. "+7 ~ +8, and thrice if its",
  82. "+9 and above.";
  83. next;
  84. mes .npc$,
  85. "The 3rd enchantment has a",
  86. "chance to be more powerful",
  87. "than the first two.";
  88. next;
  89. mes .npc$,
  90. "There is no chance to",
  91. "fail, so enchant away",
  92. "as much as you like.";
  93. next;
  94. mes .npc$,
  95. "But if you're not happy",
  96. "with the results, you can",
  97. "reset the enchantments",
  98. "for ^009900"+ callfunc("F_InsertComma",.cost2) + "z^000000.";
  99. next;
  100. mes .npc$,
  101. "That's about everything.";
  102. close;
  103.  
  104. OnEnchantNow:
  105. mes .npc$;
  106. if( (getequipid(EQI_GARMENT)!=2589) ) {
  107. mes "Please equip your",
  108. "^000099Fallen Angel Wing^000000 if",
  109. "you want to have it enchanted.";
  110. if(!.autoequip) close;
  111. next;
  112. if(select("Equip:Don't Equip")==2) close;
  113. equip 2589;
  114. mes .npc$;
  115. }
  116. .@refeq = getequiprefinerycnt(EQI_GARMENT);
  117. if(.@refeq<7) .@refeq2 = 1;
  118. else if(.@refeq>8) .@refeq2 = 3;
  119. else .@refeq2 = 2;
  120.  
  121. mes "You have a ^000099+" +.@refeq + " Fallen Angel Wing^000000.",
  122. "It can have a total of " + .@refeq2 + " enchantment" +( .@refeq2>1?"s.":".")+" Please";
  123. mes "select your preferred","enchantment.";
  124. next;
  125. setd ".@enc$", select("Fighting Enchant:Magic Enchant:Archer Enchant:Critical/Fatal Enchant:Max HP Enchant:Max SP Enchant:ASPD Enchant:STR Enchant:AGI Enchant:DEX Enchant:VIT Enchant:INT Enchant:LUK Enchant");
  126. if(.cost) callsub OnCostlyEnchant;
  127.  
  128. @card1 = getequipcardid(5,0);
  129. @card2 = getequipcardid(5,1);
  130. @card3 = getequipcardid(5,2);
  131. @card4 = getequipcardid(5,3);
  132.  
  133. if( @card2 && @card3 && @card4) {
  134. mes .npc$,
  135. "Hmm.. it seems that all",
  136. "slots have already been enchanted.";
  137. close;
  138. }
  139.  
  140. .@EnStat = callfunc( (.chancetype?"EnchantStat_1":"EnchantStat_0"), .@enc$) ;
  141.  
  142. if(!@card2) callsub OnFawEnchant , .@EnStat , @card3 , @card4 , .@refeq;
  143. else if(!@card3 && .@refeq>6) callsub OnFawEnchant , @card2 , .@EnStat , @card4 , .@refeq;
  144. else if(!@card4 && .@refeq>8) callsub OnFawEnchant , @card2 , @card3 , .@EnStat , .@refeq;
  145. else {
  146. mes .npc$,
  147. "Sorry, but your",
  148. "^000099Fallen Angel Wing^000000's",
  149. "refinement level is too",
  150. "low to continue";
  151. close;
  152. }
  153.  
  154. mes .npc$,
  155. "Your ^000099Fallen Angel Wing^000000 has",
  156. "been enchanted with ^000099"+getitemname(.@EnStat)+"^000000.";
  157. close;
  158.  
  159. OnFawEnChant:
  160. delitem2 2589, 1, 1, getarg(3), 0, @card1, @card2, @card3, @card4;
  161. getitem2 2589, 1, 1, getarg(3) , 0, @card1, getarg(0), getarg(1), getarg(2);
  162. equip 2589;
  163. specialeffect2 1019;
  164. specialeffect2 98;
  165. return;
  166.  
  167.  
  168. OnResetEnchant:
  169. mes .npc$,
  170. "This will cost " + callfunc("F_InsertComma",.cost2) + "z.",
  171. "Are you sure?";
  172. next;
  173. if(select("Yes:No")==2) close;
  174. mes .npc$;
  175. if(Zeny<1000000) {
  176. mes "You don't have enough zeny.";
  177. close;
  178. }
  179. Zeny -= 1000000;
  180. mes "Your ^000099Fallen Angel Wing^000000's",
  181. "enchantments have been reset.";
  182. .@refeq = getequiprefinerycnt(EQI_GARMENT);
  183. @card1 = getequipcardid(5,0);
  184. @card2 = getequipcardid(5,1);
  185. @card3 = getequipcardid(5,2);
  186. @card4 = getequipcardid(5,3);
  187. delitem2 2589, 1, 1, .@refeq, 0, @card1, @card2, @card3, @card4;
  188. getitem2 2589, 1, 1, .@refeq, 0, @card1, 0, 0, 0;
  189. equip 2589;
  190. specialeffect2 261;
  191. specialeffect2 119;
  192. close;
  193.  
  194. //Only called when .cost is defined
  195. OnCostlyEnchant:
  196. if(Zeny<.cost) {
  197.  
  198. mes .npc$,
  199. "You don't have enough zeny.";
  200. close;
  201. }
  202. Zeny -= .cost;
  203. return;
  204.  
  205.  
  206.  
  207.  
  208. OnInit:
  209. .npc$ = "[^AA0000Valkyrie^000000]";
  210. setarray .enc1[0], 4809,4808,4820, 4821; //Fighting 3~5
  211. setarray .enc2[0], 4812,4826,4827, 4828; //Magic 4~6
  212. setarray .enc3[0], 4832,4833,4834, 4835; //Expert Arc 1~3
  213. setarray .enc4[0], 4863,4864,4865, 4866; //Fatal 1~3
  214. setarray .enc5[0], 4861,4862,4867, 4868; //MHPP 1~3%
  215. setarray .enc6[0], 4870,4800,4871, 4801; //MaxSP 25,50,75
  216. setarray .enc7[0], 4869,4872,4873, 4807; //ASPD 1~3
  217. // setarray .enc7[0], 4869,4872,4873, 4881; //ASPD 1~3
  218. setarray .enc8[0], 4702,4703,4704, 4853; //STR 3~5 | Special Str
  219. setarray .enc9[0], 4731,4732,4733, 4854; //AGI 2~4
  220. setarray .enc10[0], 4722,4723,4724, 4857; //DEX 3~5
  221. setarray .enc11[0], 4742,4743,4744, 4855; //VIT 3~5
  222. setarray .enc12[0], 4712,4713,4714, 4856; //INT 3~5
  223. setarray .enc13[0], 4752,4753,4754, 4858; //LUK 3~5
  224. // 1 = 60% low, 30% mid, 10% high for 1st & 2nd enchant slot && 40% low, 30% mid, 20% high, 10% special for 3rd enchant slot
  225. // 0 = Equal Chance
  226. .chancetype = 1;
  227. //Turn on Equip Selection if garment is unequipped? 1 = Yes
  228. .autoequip =1;
  229. //Cost for Enchanting. It's free in iRO
  230. //.cost=0;
  231. //Cost to reset | Costs 1Mz in iRO
  232. .cost2 = 1000000;
  233. }
Add Comment
Please, Sign In to add comment