Advertisement
jayceekyd

quest

Mar 25th, 2017
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.01 KB | None | 0 0
  1. //===== eAthena Script =======================================
  2. //= Euphy's Quest Shop
  3. //===== By: ==================================================
  4. //= Euphy
  5. //===== Current Version: =====================================
  6. //= 1.3
  7. //===== Description: =========================================
  8. //= A dynamic quest shop based on Lunar's, with easier config.
  9. //= Includes support for multiple shops & cashpoints.
  10. //= Item Preview script by ToastOfDoom.
  11. //============================================================
  12.  
  13. que_temsky,128,102,6 script Wicca 438,{
  14. function Add; function Chk; function Slot; function A_An;
  15.  
  16. if(.Shops$ != "") set .@i,1;
  17. else {
  18. set .@menu$,"";
  19. for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1)
  20. set .@menu$, .@menu$+.Shops$[.@i]+":";
  21. set .@i, select(.@menu$); }
  22. dispbottom "Select one item at a time.";
  23. callshop "Tshop"+.@i,1;
  24. npcshopattach "Tshop"+.@i;
  25. end;
  26.  
  27. function Add {
  28. for(set .@n,5; 1; set .@n,.@n+2)
  29. if (!getarg(.@n,0)) break;
  30. for(set .@i,2; .@i<.@n; set .@i,.@i+1)
  31. set getd(".q_"+getarg(1)+"["+(.@i-2)+"]"), getarg(.@i);
  32. npcshopadditem "Tshop"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0);
  33. return; }
  34. function Chk {
  35. if (getarg(0)<getarg(1)) { set @qf,1; return "^FF0000"; }
  36. else return "^00FF00"; }
  37. function Slot {
  38. set .@s$,getitemname(getarg(0));
  39. switch(.ShowSlot){
  40. case 1: if (!getitemslots(getarg(0))) return .@s$;
  41. case 2: if (getiteminfo(getarg(0),11)>0) return .@s$+" ["+getitemslots(getarg(0))+"]";
  42. default: return .@s$; } }
  43. function A_An {
  44. setarray .@A$[0],"a","e","i","o","u";
  45. set .@B$, "_"+getarg(0);
  46. for(set .@i,0; .@i<5; set .@i,.@i+1)
  47. if (compare(.@B$,"_"+.@A$[.@i])) return "an "+getarg(0);
  48. return "a "+getarg(0); }
  49.  
  50. OnBuyItem:
  51. set .@q[0],@bought_nameid;
  52. copyarray .@q[1],getd(".q_"+@bought_nameid+"[0]"),getarraysize(getd(".q_"+@bought_nameid+"[0]"));
  53. if (!.@q[1]) { message strcharinfo(0),"An error has occurred."; end; }
  54. mes "[Quest Shop]";
  55. mes "Reward: ^0055FF"+((.@q[1]>1)?.@q[1]+"x ":"")+Slot(.@q[0])+"^000000";
  56. mes "Requirements:";
  57. if (.@q[2]) mes " > "+Chk(Zeny,.@q[2])+.@q[2]+" Zeny^000000";
  58. if (.@q[3]) mes " > "+Chk(getd(.Points$[0]),.@q[3])+.@q[3]+" "+.Points$[1]+" ("+getd(.Points$[0])+"/"+.@q[3]+")^000000";
  59. if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
  60. mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1])+((.DisplayID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+.@q[.@i+1]+")^000000";
  61. if (@qf) { set @qf,0; close; }
  62. next;
  63. if (!checkweight(.@q[0],.@q[1])) {
  64. mes "[Quest Shop]";
  65. mes "^FF0000You need "+(((.@q[1]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000";
  66. close; }
  67. set @qe1, getiteminfo(.@q[0],5); set @qe2, getiteminfo(.@q[0],11);
  68. addtimer 1000, strnpcinfo(3)+"::OnExit";
  69. while(1){
  70. switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000: ~ ^777777Cancel^000000")) {
  71. case 1:
  72. if (.@q[2]) set Zeny, Zeny-.@q[2];
  73. if (.@q[3]) setd .Points$[0], getd(.Points$[0])-.@q[3];
  74. if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
  75. delitem .@q[.@i],.@q[.@i+1];
  76. getitem .@q[0],.@q[1];
  77. if (.Announce) announce strcharinfo(0)+" has created "+A_An(getitemname(.@q[0]))+"!",0;
  78. specialeffect2 699;
  79. close;
  80. case 2:
  81. close; } }
  82. OnExit:
  83. if (@qe6) { atcommand "@changelook 3 "+@qe3; atcommand "@changelook 1 "+@qe4; atcommand "@changelook 2 "+@qe5; }
  84. for(set .@i,1; .@i<7; set .@i,.@i+1) setd "@qe"+.@i,0;
  85. end;
  86. OnInit:
  87. // --------------------- Config ---------------------
  88. // Custom points, if needed: "<variable>","<name to display>"
  89. setarray .Points$[0],"#REWARDPOINTS","Cash Points";
  90.  
  91. set .Announce,0; // Announce quest completion? (1: yes / 0: no)
  92. set .ShowSlot,1; // Show item slots? (2: all equipment / 1: if slots > 0 / 0: never)
  93. set .DisplayID,0; // Show item IDs? (1: yes / 0: no)
  94. set .ShowZeny,0; // Show Zeny cost, if any? (1: yes / 0: no)
  95.  
  96. // Shop categories, if needed: "<Shop 1>","<Shop 2>"{,...};
  97. // Duplicate dummy data for any additional shops (bottom of script).
  98. // If no categories, use the second line instead (remove //).
  99.  
  100. //setarray .Shops$[1],"Upper","Middle","Lower","Accessory";
  101. set .Shops$,"n/a";
  102.  
  103. // Add(<shop number>,<reward ID>,<reward amount>,<Zeny cost>,<point cost>,
  104. // <required item ID>,<required item amount>{,...});
  105. // Shop number corresponds with order above (default is 1).
  106. // Note: Do NOT use a reward item more than once!
  107.  
  108.  
  109.  
  110.  
  111. Add(1,19051,1,0,500,0,0);
  112. Add(1,19052,1,0,500,0,0);
  113. Add(1,19053,1,0,500,0,0);
  114. Add(1,19054,1,0,500,0,0);
  115. Add(1,19055,1,0,500,0,0);
  116. Add(1,19056,1,0,500,0,0);
  117.  
  118.  
  119.  
  120.  
  121.  
  122. // --------------------------------------------------
  123. for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1)
  124. npcshopdelitem "Tshop"+.@i,909;
  125. //waitingroom "Free Custom Item!",0;
  126. end;
  127. }
  128.  
  129. // -------- Dummy data (duplicate as needed) --------
  130. - shop Tshop1 -1,909:-1
  131. - shop Tshop2 -1,909:-1
  132. - shop Tshop3 -1,909:-1
  133. - shop Tshop4 -1,909:-1
  134. - shop Tshop5 -1,909:-1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement