Advertisement
Guest User

Untitled

a guest
Jun 5th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.71 KB | None | 0 0
  1. //===== eAthena Script =======================================
  2. //= All-in-One NPC
  3. //===== By: ==================================================
  4. //= Euphy
  5. //===== Current Version: =====================================
  6. //= 1.3
  7. //===== Description: =========================================
  8. //= A compilation of commonly-used NPC scripts.
  9. //== Includes job changer, stylist, refiner, card remover,
  10. //== coin exchanger, rentals, resetter, platinum skills,
  11. //== sex changer, identifier, healer, buffer, and repairman.
  12. //============================================================
  13.  
  14. town,110,50,3 script All-in-One NPC 531,{
  15. function Get_Platinum; function Equip_Menu;
  16.  
  17. if (getarraysize(.OnClick)) {
  18. if (.OnClick[0]) { specialeffect2 313; percentheal 100,100; }
  19. if (.OnClick[1]) { specialeffect2 42; sc_start SC_BLESSING,600000,10; specialeffect2 37; sc_start SC_INCREASEAGI,600000,10; }
  20. if (.OnClick[2] && getbrokenid(1)) { specialeffect2 101; atcommand "@repairall"; } }
  21. set .@menu$,"";
  22. for (set .@i,0; .@i < getarraysize(.MainMenu$); set .@i,.@i+1) {
  23. if (.MenuOption & pow(2,.@i))
  24. set .@menu$, .@menu$+" ~ "+.MainMenu$[.@i];
  25. set .@menu$, .@menu$+":"; }
  26. switch(select(.@menu$)) {
  27. case 1:
  28. function Job_Menu; function A_An;
  29. if (checkfalcon() || checkcart() || checkriding()) {
  30. message strcharinfo(0),"Please remove your "+((checkfalcon())?"falcon":"")+((checkcart())?"cart":"")+((checkriding())?"Peco":"")+" before proceeding.";
  31. end; }
  32. if (.SkillPointCheck && SkillPoint) { message strcharinfo(0),"Please use all your skill points before proceeding."; end; }
  33. if (Class > 6 && Class < 22) {
  34. if (BaseLevel < .Rebirth[0] || JobLevel < .Rebirth[1]) {
  35. set .@blvl, .Rebirth[0]-BaseLevel; set .@jlvl, .Rebirth[1]-JobLevel;
  36. message strcharinfo(0),"You need "+((.@blvl>0)?.@blvl+" more base levels "+((.@jlvl>0)?"/ ":""):"")+((.@jlvl>0)?.@jlvl+" more job levels ":"")+"to rebirth.";
  37. end; }
  38. message strcharinfo(0),"Change into a High Novice?";
  39. if(select(" ~ ^0055FFRebirth^000000: ~ ^777777Cancel^000000")==2) end;
  40. jobchange 4001; resetlvl(1); specialeffect2 432;
  41. end; }
  42. set .@eac, eaclass();
  43. set .@j1, roclass(.@eac|EAJL_2_1); set .@j2,roclass(.@eac|EAJL_2_2);
  44. if (.@eac&EAJL_2)
  45. if (.@eac&(EAJL_UPPER|EAJL_BABY) || roclass(.@eac|EAJL_UPPER) == -1) {
  46. message strcharinfo(0),"No more jobs are available."; end; }
  47. if ((.@eac&EAJ_BASEMASK) == EAJ_NOVICE) {
  48. if (JobLevel < .JobReq[0]) message strcharinfo(0),"A job level of "+.JobReq[0]+" is required to change into the 1st Class.";
  49. else switch(Class) {
  50. case 0: Job_Menu(11,1,2,3,4,5,6,23,4046,24,25,4023);
  51. case 4001: Job_Menu(6,4002,4003,4004,4005,4006,4007);
  52. case 4023: Job_Menu(7,4024,4025,4026,4027,4028,4029,4045);
  53. default: message strcharinfo(0),"An error has occurred."; break; }
  54. end; }
  55. if (roclass(.@eac|EAJL_2_1) == -1 || roclass(.@eac|EAJL_2_2) == -1) {
  56. message strcharinfo(0),"No more jobs are available."; end; }
  57. if (!(.@eac&EAJL_2) && JobLevel < .JobReq[1]) { message strcharinfo(0),"A job level of "+.JobReq[1]+" is required to change into the 2nd Class."; end; }
  58. Job_Menu(2,.@j1,.@j2);
  59. end;
  60. function Job_Menu {
  61. set .@menu$,"";
  62. for(set .@i,1; .@i<=getarg(0); set .@i,.@i+1)
  63. set .@menu$, .@menu$+" ~ "+jobname(getarg(.@i))+":";
  64. set .@menu$, .@menu$+" ~ ^777777Cancel^000000";
  65. while(1) {
  66. set .@i, getarg(select(.@menu$),0);
  67. if (!.@i) end;
  68. if ((.@i == 23 || .@i == 4045) && BaseLevel < .SNovice) {
  69. message strcharinfo(0),"A base level of "+.SNovice+" is required to turn into a Super "+((.@i==23)?"Novice":"Baby")+"."; }
  70. else if (select(" ~ Change into ^0055FF"+jobname(.@i)+"^000000 class: ~ ^777777Go back^000000")==1) {
  71. message strcharinfo(0),"Became "+A_An(jobname(.@i))+"!";
  72. jobchange .@i; specialeffect2 338;
  73. if (.Platinum) Get_Platinum;
  74. end; }
  75. } end; }
  76. function Get_Platinum {
  77. skill 142,1,0;
  78. switch(BaseClass) {
  79. case 0: if (Class !=23) skill 143,1,0; break;
  80. case 1: skill 144,1,0; skill 145,1,0; skill 146,1,0; break;
  81. case 2: skill 157,1,0; break;
  82. case 3: skill 147,1,0; skill 148,1,0; break;
  83. case 4: skill 156,1,0; break;
  84. case 5: skill 153,1,0; skill 154,1,0; skill 155,1,0; break;
  85. case 6: skill 149,1,0; skill 150,1,0; skill 151,1,0; skill 152,1,0; break;
  86. default: break; }
  87. switch(roclass(eaclass()&EAJ_UPPERMASK)) {
  88. case 7: skill 1001,1,0; break;
  89. case 8: skill 1014,1,0; break;
  90. case 9: skill 1006,1,0; break;
  91. case 10: skill 1012,1,0; skill 1013,1,0; break;
  92. case 11: skill 1009,1,0; break;
  93. case 12: skill 1003,1,0; skill 1004,1,0; break;
  94. case 14: skill 1002,1,0; break;
  95. case 15: skill 1015,1,0; skill 1016,1,0; break;
  96. case 16: skill 1007,1,0; skill 1008,1,0; skill 1017,1,0; skill 1018,1,0; skill 1019,1,0; break;
  97. case 17: skill 1005,1,0; break;
  98. case 18: skill 238,1,0; break;
  99. case 19: skill 1010,1,0; break;
  100. case 20: skill 1011,1,0; break;
  101. default: break; }
  102. return; }
  103. function A_An {
  104. setarray .@A$[0],"a","e","i","o","u";
  105. set .@B$, "_"+getarg(0);
  106. for(set .@i,0; .@i<5; set .@i,.@i+1)
  107. if (compare(.@B$,"_"+.@A$[.@i])) return "an "+getarg(0);
  108. return "a "+getarg(0); }
  109. case 2:
  110. setarray .@Look[1],7,1,6;
  111. set .@s, select(" ~ Cloth color: ~ Hairstyle: ~ Hair color");
  112. set .@Revert, getlook(.@Look[.@s]); set .@Style,1;
  113. while(1) {
  114. setlook .@Look[.@s], .@Style;
  115. message strcharinfo(0),"This is style #"+.@Style+".";
  116. set .@menu$, " ~ Next (^0055FF"+((.@Style!=.Styles[.@s])?.@Style+1:1)+"^000000): ~ Previous (^0055FF"+((.@Style!=1)?.@Style-1:.Styles[.@s])+"^000000): ~ Jump to...: ~ Revert to original (^0055FF"+.@Revert+"^000000)";
  117. switch(select(.@menu$)) {
  118. case 1: set .@Style, ((.@Style!=.Styles[.@s])?.@Style+1:1); break;
  119. case 2: set .@Style, ((.@Style!=1)?.@Style-1:.Styles[.@s]); break;
  120. case 3: message strcharinfo(0),"Choose a style between 1 - "+.Styles[.@s]+".";
  121. input .@Style,0,.Styles[.@s];
  122. if (!.@Style) set .@Style, rand(1,.Styles[.@s]);
  123. break;
  124. case 4: set .@Style, .@Revert; setlook .@Look[.@s], .@Revert; break; }
  125. } end;
  126. case 3:
  127. function Refine_Item;
  128. if (.EnrichedRefine)
  129. if (select(" ~ Normal Refiner: ~ Enriched Refiner")==2) {
  130. Equip_Menu(1);
  131. setarray .@Materials[0],7619,7620,7620,7620,7620;
  132. setarray .@Safe[0],4,7,6,5,4;
  133. set .@WLv, getequipweaponlv(@i);
  134. message strcharinfo(0),"Item: +"+getequiprefinerycnt(@i)+" "+getequipname(@i);
  135. if(select(" ~ Refine item (2 * ^0055FF"+getequippercentrefinery(@i)+"^000000% success): ~ ^777777Cancel^000000")==2) end;
  136. Refine_Item(1, .@Materials[.@WLv], .RP[.@WLv], .@Safe[.@WLv], 1);
  137. end; }
  138. Equip_Menu(1);
  139. setarray .@Materials[0],985,1010,1011,984,984;
  140. setarray .@Safe[0],4,7,6,5,4;
  141. set .@WLv, getequipweaponlv(@i);
  142. set .@SafeCount, .@Safe[.@WLv]-getequiprefinerycnt(@i);
  143. message strcharinfo(0),"Item: +"+getequiprefinerycnt(@i)+" "+getequipname(@i);
  144. switch(select(" ~ Refine once (^0055FF"+getequippercentrefinery(@i)+"^000000% success): ~ Refine multiple times (up to "+(10-getequiprefinerycnt(@i))+"): ~ Refine to safe limit ("+((.@SafeCount>0)?.@SafeCount+" refines":"^777777disabled^000000")+"): ~ ^777777Cancel^000000")) {
  145. case 1: Refine_Item(1, .@Materials[.@WLv], .RP[.@WLv], .@Safe[.@WLv]); end;
  146. case 2:
  147. input .@Refines;
  148. if (.@Refines+getequiprefinerycnt(@i) > 10 || .@Refines < 1) message strcharinfo(0),"Invalid number ("+.@Refines+").";
  149. else Refine_Item(.@Refines, .@Materials[.@WLv], .RP[.@WLv], .@Safe[.@WLv]);
  150. end;
  151. case 3:
  152. if (.@SafeCount < 1) message strcharinfo(0),"The item has already reached the safe limit.";
  153. else Refine_Item(.@SafeCount, .@Materials[.@WLv], .RP[.@WLv], .@Safe[.@WLv]);
  154. end;
  155. case 4: end; }
  156. function Equip_Menu {
  157. setarray .@pos$[1],"Upper Headgear","Armor","Left hand","Right hand","Garment","Footgear","Left Accessory","Right Accessory","Mid Headgear","Lower Headgear";
  158. set .@menu$,"";
  159. for (set .@i,1; .@i <= 10; set .@i,.@i+1) {
  160. if (getequipisequiped(.@i))
  161. set .@menu$, .@menu$+.@pos$[.@i]+" [^0055FF"+getequipname(.@i)+"^000000]";
  162. set .@menu$, .@menu$+":"; }
  163. set @i, select(.@menu$);
  164. if (!getequipisequiped(@i)) { message strcharinfo(0),"Nothing is equipped there!"; end; }
  165. if (getarg(0)) {
  166. if (!getequipisenableref(@i)) { message strcharinfo(0),getequipname(@i)+" cannot be refined."; end; }
  167. if (getequiprefinerycnt(@i) >= 10 ) { message strcharinfo(0),"+"+getequiprefinerycnt(@i)+" "+getequipname(@i)+" cannot be refined any further."; end; } }
  168. return; }
  169. function Refine_Item {
  170. message strcharinfo(0),"I'll need "+getarg(0)+"x "+getitemname(getarg(1))+" and "+getarg(0)*getarg(2)+" Zeny.";
  171. if (countitem(getarg(1)) < getarg(0) || Zeny < getarg(0)*getarg(2)) {
  172. sleep2 500; message strcharinfo(0),"Come back when you have the required materials."; end; }
  173. if (getequiprefinerycnt(@i)+getarg(0) > getarg(3)) {
  174. sleep2 500; message strcharinfo(0),"The item will be refined above the safe limit. It may break."; }
  175. sleep2 500;
  176. if(select(" ~ ^0055FFContinue^000000: ~ ^777777Cancel^000000")==2) end;
  177. set .@j, getarg(0);
  178. while(.@j) {
  179. delitem getarg(1), 1;
  180. set Zeny, Zeny-getarg(2);
  181. if (getarg(4,0)) {
  182. if (getequippercentrefinery(@i) <= rand(100) && getequippercentrefinery(@i) <= rand(100)) {
  183. message strcharinfo(0),getequipname(@i)+" broke while refining."; failedrefitem @i; end; } }
  184. else {
  185. if (getequippercentrefinery(@i) <= rand(100)) {
  186. message strcharinfo(0),getequipname(@i)+" broke while refining."; failedrefitem @i; end; } }
  187. successrefitem @i;
  188. set .@j, .@j-1; }
  189. message strcharinfo(0),"All done!";
  190. end; }
  191. case 4:
  192. if (.Prices[0]) message strcharinfo(0),"It costs "+.Prices[0]+" Zeny to remove cards.";
  193. Equip_Menu(0);
  194. if (Zeny < .Prices[0]) { message strcharinfo(0),"You don't have enough Zeny."; end; }
  195. set .@j,getequipcardcnt(@i);
  196. if (!.@j) { message strcharinfo(0),"There are no cards compounded to "+getequipname(@i)+"."; end; }
  197. if (!checkweight(4001,(.@j+1))) { message strcharinfo(0),"You're carrying too many items!"; end; }
  198. message strcharinfo(0),"Item: "+getequipname(@i);
  199. if (select(" ~ Remove "+.@j+" card(s): ~ ^777777Cancel^000000")==2) end;
  200. set Zeny, Zeny-.Prices[0];
  201. successremovecards @i;
  202. message strcharinfo(0),"Cards successfully removed!";
  203. end;
  204. case 5:
  205. message strcharinfo(0),"Coins are worth "+.Coin[1]+" Zeny each.";
  206. switch(select(" ~ Zeny to coins: ~ Coins to Zeny: ~ Close")) {
  207. case 1:
  208. message strcharinfo(0),"How many coins do you want?";
  209. input .@coins,0,(1000000000/.Coin[1]);
  210. if (.@coins*.Coin[1] > Zeny) { message strcharinfo(0),"You don't have enough Zeny."; end; }
  211. if (!checkweight(.Coin[0],.@coins)) { message strcharinfo(0),"You don't have enough inventory space."; end; }
  212. set Zeny, Zeny-(.Coin[1]*.@coins);
  213. getitem .Coin[0], .@coins;
  214. message strcharinfo(0),"Purchased "+.@coins+" coins.";
  215. end;
  216. case 2:
  217. message strcharinfo(0),"How many coins do you want to trade in?";
  218. input .@coins,0,(1000000000/.Coin[1]);
  219. if (countitem(.Coin[0]) < .@coins) { message strcharinfo(0),"You don't have that many coins!"; end; }
  220. if ((Zeny+(.Coin[1]*.@coins)) > 1000000000) { message strcharinfo(0),"You have too much Zeny!"; end; }
  221. delitem .Coin[0], .@coins;
  222. set Zeny, Zeny+(.Coin[1]*.@coins);
  223. message strcharinfo(0),"Exchanged "+.@coins+" coins.";
  224. end;
  225. case 3:
  226. end; }
  227. case 6:
  228. if (.Prices[2]) message strcharinfo(0),"It costs "+.Prices[2]+" Zeny to rent.";
  229. set .@i, select(" ~ Cart: ~ Falcon: ~ Peco");
  230. if (Zeny < .Prices[2]) { message strcharinfo(0),"You don't have enough Zeny."; end; }
  231. if (.@i==1 && !checkcart() && getskilllv(39)) setcart;
  232. else if (.@i==2 && !checkfalcon() && getskilllv(127)) setfalcon;
  233. else if (.@i==3 && !checkriding() && getskilllv(63)) setriding;
  234. else { message strcharinfo(0),"You do not meet skill the requirements to rent."; end; }
  235. set Zeny, Zeny-.Prices[2];
  236. end;
  237. case 7:
  238. if (.Prices[1]) message strcharinfo(0),"It costs "+.Prices[1]+" Zeny to reset stats or skills.";
  239. set .@i, select(" ~ Stat reset: ~ Skill reset: ~ Cancel");
  240. if (.@i==3) end;
  241. if (Zeny < .Prices[1]) { message strcharinfo(0),"You don't have enough Zeny."; end; }
  242. set Zeny, Zeny-.Prices[1];
  243. if (.@i==1) ResetStatus;
  244. else ResetSkill;
  245. message strcharinfo(0),((.@i==1)?"Stats":"Skills")+" reset!";
  246. end;
  247. case 8:
  248. Get_Platinum;
  249. specialeffect2 441;
  250. message strcharinfo(0),"Platinum skills received!";
  251. end;
  252. case 9:
  253. set .@Var$, ".SexChange"+((Sex)?"F":"M");
  254. if (getarraysize(getd(.@Var$))) {
  255. message strcharinfo(0),"To turn into a "+((Sex)?"female":"male")+" you need the following items:";
  256. sleep2 1000;
  257. for(set .@i,0; .@i<getarraysize(getd(.@Var$)); set .@i,.@i+2) {
  258. message strcharinfo(0),getd(.@Var$+"["+(.@i+1)+"]")+"x "+getitemname(getd(.@Var$+"["+.@i+"]"));
  259. if (countitem(getd(.@Var$+"["+.@i+"]")) < getd(.@Var$+"["+(.@i+1)+"]")) set .@nreq,1;
  260. sleep2 500; }
  261. if (.@nreq) end; }
  262. if(select(" ~ Change into a "+((Sex)?"female":"male")+": ~ Cancel")==2) end;
  263. if (getarraysize(getd(.@Var$)))
  264. for(set .@i,0; .@i<getarraysize(getd(.@Var$)); set .@i,.@i+2)
  265. delitem getd(.@Var$+"["+.@i+"]"), getd(.@Var$+"["+(.@i+1)+"]");
  266. changesex;
  267. end;
  268. case 10:
  269. setarray .@Total[0],0,0;
  270. getinventorylist;
  271. for(set .@i,0; .@i<@inventorylist_count; set .@i,.@i+1) {
  272. if (@inventorylist_identify[.@i]) continue;
  273. if (Zeny < .Prices[3]) {
  274. dispbottom "It costs "+.Prices[3]+" to identify an item."; break; }
  275. set Zeny, Zeny-.Prices[3];
  276. delitem2 @inventorylist_id[.@i],1,0,0,0,0,0,0,0;
  277. getitem @inventorylist_id[.@i],1;
  278. setarray .@Total[0], .@Total[0]+1, .@Total[1]+.Prices[3]; }
  279. if (!.@Total[0]) { message strcharinfo(0),"No items identified."; end; }
  280. specialeffect2 154;
  281. message strcharinfo(0),"Identified "+.@Total[0]+" items"+((.@Total[1])?" for "+.@Total[1]+" Zeny":"")+".";
  282. end;
  283. }
  284. OnInit:
  285.  
  286. // --------------------- Config ---------------------
  287. setarray .MainMenu$[0], // Set menu options!
  288. "Change Jobs", // [1]
  289. "Stylist", // [2]
  290. "Refiner", // [4]
  291. "Remove Cards", // [8]
  292. "Exchange Coins", // [16]
  293. "Rentals", // [32]
  294. "Reset Stats/Skills", // [64]
  295. "Platinum Skills", // [128]
  296. "Change Sex", // [256]
  297. "Identify All"; // [512]
  298.  
  299. set .MenuOption,1|8|32|64|128|256|512;
  300.  
  301. setarray .OnClick[0],0; // When clicked: heal [0], buff [1], repair [2] (1: yes / 0: no)
  302. setarray .Styles[1],553,37,250; // Maximum dye, hair style, and hair color
  303. setarray .Coin[0],674,100000000; // Coin item ID, coin price
  304. setarray .Prices[0],50000,10000,0,100; // Zeny to remove cards [0], reset [1], rent [2], identify [3]
  305.  
  306. setarray .Rebirth[0],99,50; // Minimum base level, job level to rebirth
  307. setarray .JobReq[0],10,40; // Minimum job level to turn into 1st class, 2nd class
  308. set .SNovice,45; // Minimum base level to turn into Super Novice
  309. set .SkillPointCheck,0; // Force player to use up all skill points? (1: yes / 0: no)
  310. set .Platinum,1; // Get platinum skills automatically? (1: yes / 0: no)
  311.  
  312. set .EnrichedRefine,1; // Allow enriched refiner option? (1: yes / 0: no)
  313. setarray .RP[0],2000,50,200,5000,20000; // Zeny for armor, lv1, lv2, lv3, lv4 refines
  314.  
  315. setarray .SexChangeF[0],27020,100; // Items to turn into Female (ID,Count)
  316. setarray .SexChangeM[0],27020,100; // Items to turn into Male (ID,Count)
  317.  
  318. // --------------------------------------------------
  319. end;
  320. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement