Advertisement
Guest User

Eathena

a guest
Aug 6th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.97 KB | None | 0 0
  1. //===== eAthena Script =======================================
  2. //= Euphy's Quest Shop
  3. //===== By: ==================================================
  4. //= Euphy
  5. //===== Current Version: =====================================
  6. //= 1.4a - eAthena
  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. z_agit,16,170,5 script Quest Shop 1 51,{
  14. cutin "god_nelluad02",2;
  15. function Add; function Chk; function Slot; function A_An;
  16.  
  17. if(.Shops$ != "") set .@i,1;
  18. else {
  19. set .@menu$,"";
  20. for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1)
  21. set .@menu$, .@menu$+.Shops$[.@i]+":";
  22. set .@i, select(.@menu$); }
  23. dispbottom "Select one item at a time.";
  24. callshop "qshop"+.@i,1;
  25. npcshopattach "qshop"+.@i;
  26. end;
  27.  
  28. function Add {
  29. if (getitemname(getarg(1))=="null") {
  30. debugmes "Quest reward #"+getarg(1)+" invalid (skipped)."; return; }
  31. for(set .@n,5; .@n<127; set .@n,.@n+2) {
  32. if (!getarg(.@n,0)) break;
  33. if (getitemname(getarg(.@n))=="null") {
  34. debugmes "Quest requirement #"+getarg(.@n)+" invalid (skipped)."; return; } }
  35. for(set .@i,2; .@i<.@n; set .@i,.@i+1)
  36. set getd(".q_"+getarg(1)+"["+(.@i-2)+"]"), getarg(.@i);
  37. npcshopadditem "qshop"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0);
  38. sleep 1;
  39. return; }
  40. function Chk {
  41. if (getarg(0)<getarg(1)) { set @qe0,1; return "^FF0000"; }
  42. else return "^00FF00"; }
  43. function Slot {
  44. set .@s$,getitemname(getarg(0));
  45. switch(.ShowSlot){
  46. case 1: if (!getitemslots(getarg(0))) return .@s$;
  47. case 2: if (getiteminfo(getarg(0),11)>0) return .@s$+" ["+getitemslots(getarg(0))+"]";
  48. default: return .@s$; } }
  49. function A_An {
  50. setarray .@A$[0],"a","e","i","o","u";
  51. set .@B$, "_"+getarg(0);
  52. for(set .@i,0; .@i<5; set .@i,.@i+1)
  53. if (compare(.@B$,"_"+.@A$[.@i])) return "an "+getarg(0);
  54. return "a "+getarg(0); }
  55.  
  56. OnBuyItem:
  57. set .@q[0],@bought_nameid;
  58. copyarray .@q[1],getd(".q_"+@bought_nameid+"[0]"),getarraysize(getd(".q_"+@bought_nameid+"[0]"));
  59. if (!.@q[1]) { message strcharinfo(0),"An error has occurred."; end; }
  60. mes "[Quest Shop]";
  61. mes "Reward: ^0055FF"+((.@q[1]>1)?.@q[1]+"x ":"")+Slot(.@q[0])+"^000000";
  62. mes "Requirements:";
  63. if (.@q[2]) mes " > "+Chk(Zeny,.@q[2])+.@q[2]+" Zeny^000000";
  64. if (.@q[3]) mes " > "+Chk(getd(.Points$[0]),.@q[3])+.@q[3]+" "+.Points$[1]+" ("+getd(.Points$[0])+"/"+.@q[3]+")^000000";
  65. if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
  66. mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1])+((.DisplayID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+.@q[.@i+1]+")^000000";
  67. next;
  68. set @qe1, getiteminfo(.@q[0],5); set @qe2, getiteminfo(.@q[0],11);
  69. addtimer 1000, strnpcinfo(1)+"::OnEnd";
  70. while(1){
  71. switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000:"+((((@qe1&1) || (@qe1&256) || (@qe1&512)) && @qe2>0 && !@qe6)?" ~ Preview...":"")+": ~ ^777777Cancel^000000")) {
  72. case 1:
  73. if (@qe0) {
  74. mes "[Quest Shop]";
  75. mes "You're missing one or more quest requirements.";
  76. close; }
  77. if (!checkweight(.@q[0],.@q[1])) {
  78. mes "[Quest Shop]";
  79. mes "^FF0000You need "+(((.@q[1]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000";
  80. close; }
  81. if (.@q[2]) set Zeny, Zeny-.@q[2];
  82. if (.@q[3]) setd .Points$[0], getd(.Points$[0])-.@q[3];
  83. if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
  84. delitem .@q[.@i],.@q[.@i+1];
  85. getitem .@q[0],.@q[1];
  86. if (.Announce) announce strcharinfo(0)+" has created "+A_An(getitemname(.@q[0]))+"!",0;
  87. specialeffect2 699;
  88. close;
  89. case 2:
  90. set @qe3, getlook(3); set @qe4, getlook(4); set @qe5, getlook(5);
  91. if (@qe1&1) atcommand "@changelook 3 "+@qe2;
  92. if (@qe1&256) atcommand "@changelook 1 "+@qe2;
  93. if (@qe1&512) atcommand "@changelook 2 "+@qe2;
  94. set @qe6,1;
  95. break;
  96. case 3:
  97. close; } }
  98. OnEnd:
  99. if (@qe6) { atcommand "@changelook 3 "+@qe3; atcommand "@changelook 1 "+@qe4; atcommand "@changelook 2 "+@qe5; }
  100. for(set .@i,0; .@i<7; set .@i,.@i+1) setd "@qe"+.@i,0;
  101. end;
  102. OnInit:
  103. // --------------------- Config ---------------------
  104. // Custom points, if needed: "<variable>","<name to display>"
  105. setarray .Points$[0],"#CASHPOINTS","Cash Points";
  106.  
  107. set .Announce,1; // Announce quest completion? (1: yes / 0: no)
  108. set .ShowSlot,1; // Show item slots? (2: all equipment / 1: if slots > 0 / 0: never)
  109. set .DisplayID,0; // Show item IDs? (1: yes / 0: no)
  110. set .ShowZeny,0; // Show Zeny cost, if any? (1: yes / 0: no)
  111.  
  112. // Shop categories, if needed: "<Shop 1>","<Shop 2>"{,...};
  113. // Duplicate dummy data for any additional shops (bottom of script).
  114. // If no categories, use the second line instead (remove //).
  115.  
  116. setarray .Shops$[1],"Headgears","Castle Dops";
  117. // set .Shops$,"n/a";
  118.  
  119. // Add(<shop number>,<reward ID>,<reward amount>,<Zeny cost>,<point cost>,
  120. // <required item ID>,<required item amount>{,...});
  121. // Shop number corresponds with order above (default is 1).
  122. // Note: Do NOT use a reward item more than once!
  123.  
  124. //=============== all
  125. Add(1,5428,1,150000000,0,7157,100,7447,10,7445,10,7446,10,7448,10);
  126. Add(1,5420,1,150000000,0,7447,20,7300,1,7451,1,994,200);
  127. Add(1,5170,1,50000000,0,5172,5,949,100);
  128. Add(1,5453,1,50000000,0,7193,30,7122,30,1020,50,7447,10,7445,10,7446,10,7448,10,7020,1,1030,1);
  129. Add(1,5452,1,50000000,0,7193,30,7122,30,1020,50,7447,20,7445,20,7446,20,7448,20,7020,3,1030,3,5453,1);
  130. Add(1,5210,1,50000000,0,949,100,916,100,914,100);
  131. Add(1,5324,1,50000000,0,949,100,916,100,914,100,7063,5);
  132. Add(1,5372,1,50000000,0,7446,50);
  133. Add(1,5253,1,50000000,0,7445,50);
  134. Add(1,5290,1,50000000,0,7447,50);
  135. Add(1,5359,1,50000000,0,7448,50);
  136. Add(1,5418,1,50000000,0,1030,5,7113,5);
  137. Add(1,5378,1,50000000,0,7100,150);
  138. Add(1,5690,1,50000000,0,994,150,7089,1,7090,1,7091,1,7092,1);
  139. Add(1,5312,1,50000000,0,949,100,7085,1);
  140. //============== Special
  141. Add(2,7073,1,100000000,0,7179,2);
  142. Add(2,7074,1,100000000,0,7179,2);
  143. Add(2,7075,1,100000000,0,7179,2);
  144. Add(2,7076,1,100000000,0,7179,2);
  145. Add(2,7077,1,100000000,0,7179,2);
  146. Add(2,7078,1,100000000,0,7179,2);
  147. Add(2,7079,1,100000000,0,7179,2);
  148. Add(2,7080,1,100000000,0,7179,2);
  149. Add(2,7081,1,100000000,0,7179,2);
  150. Add(2,7082,1,100000000,0,7179,2);
  151. Add(2,7083,1,100000000,0,7179,2);
  152. Add(2,7084,1,100000000,0,7179,2);
  153. Add(2,7085,1,100000000,0,7179,2);
  154. Add(2,7086,1,100000000,0,7179,2);
  155. Add(2,7087,1,100000000,0,7179,2);
  156. Add(2,7088,1,100000000,0,7179,2);
  157. Add(2,7089,1,100000000,0,7179,2);
  158. Add(2,7090,1,100000000,0,7179,2);
  159. Add(2,7091,1,100000000,0,7179,2);
  160. Add(2,7092,1,100000000,0,7179,2);
  161. // --------------------------------------------------
  162. for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1)
  163. npcshopdelitem "qshop"+.@i,909;
  164. end;
  165. }
  166.  
  167. // -------- Dummy data (duplicate as needed) --------
  168. - shop qshop1 -1,909:-1
  169. - shop qshop2 -1,909:-1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement