Advertisement
Guest User

quest

a guest
Apr 19th, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.84 KB | None | 0 0
  1. prontera,172,204,4 script Joana 680,{
  2. function Add; function Chk; function Slot; function A_An;
  3.  
  4. mes "[ ^008000Joana^000000 ]";
  5. mes "Olá, ^FF0000"+strcharinfo(0)+"^000000.";
  6. mes "Aqui no RagnaDIX temos um sistema de quests que funciona como uma loja que pede items.";
  7. next;
  8. mes "[ ^008000Joana^000000 ]";
  9. mes "Então, qual tipo de item você quer fazer?";
  10. next;
  11.  
  12. if(.Shops$ != "") set .@i,1;
  13. else {
  14. set .@menu$,"";
  15. for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1)
  16. set .@menu$, .@menu$+.Shops$[.@i]+":";
  17. set .@i, select(.@menu$); }
  18. dispbottom "Selecione um item de cada vez.";
  19. callshop "qshop"+.@i,1;
  20. npcshopattach "qshop"+.@i;
  21. end;
  22.  
  23. function Add {
  24. if (getitemname(getarg(1))=="null") {
  25. debugmes "Quest reward #"+getarg(1)+" invalid (skipped)."; return; }
  26. for(set .@n,5; .@n<127; set .@n,.@n+2) {
  27. if (!getarg(.@n,0)) break;
  28. if (getitemname(getarg(.@n))=="null") {
  29. debugmes "Quest requirement #"+getarg(.@n)+" invalid (skipped)."; return; } }
  30. for(set .@i,2; .@i<.@n; set .@i,.@i+1)
  31. set getd(".q_"+getarg(1)+"["+(.@i-2)+"]"), getarg(.@i);
  32. npcshopadditem "qshop"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0);
  33. return; }
  34. function Chk {
  35. if (getarg(0)<getarg(1)) { set @qe0,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 "[ ^008000Quest Shop^000000 ]";
  55. mes "Recompensa: ^0055FF"+((.@q[1]>1)?.@q[1]+"x ":"")+Slot(.@q[0])+"^000000";
  56. mes "Requerimentos:";
  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. next;
  62. set @qe1, getiteminfo(.@q[0],5); set @qe2, getiteminfo(.@q[0],11);
  63. addtimer 1000, strnpcinfo(1)+"::OnEnd";
  64. while(1){
  65. switch(select("[^008000»^000000] Fazer ^0055FF"+getitemname(.@q[0])+"^000000:"+((((@qe1&1) || (@qe1&256) || (@qe1&512)) && @qe2>0 && !@qe6)?"[^008000»^000000] Experimentar Item.":"")+": ^777777Cancel.^000000")) {
  66. case 1:
  67. if (@qe0) {
  68. mes "[ ^008000Quest Shop^000000 ]";
  69. mes "Você está esquecendo um ou mais requisitos da quest.";
  70. close; }
  71. if (!checkweight(.@q[0],.@q[1])) {
  72. mes "[ ^008000Quest Shop^000000 ]";
  73. mes "^FF0000You need "+(((.@q[1]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000";
  74. close; }
  75. if (.@q[2]) set Zeny, Zeny-.@q[2];
  76. if (.@q[3]) setd .Points$[0], getd(.Points$[0])-.@q[3];
  77. if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
  78. delitem .@q[.@i],.@q[.@i+1];
  79. getitem .@q[0],.@q[1];
  80. if (.Announce) announce strcharinfo(0)+" acabou de criar seu item: "+(getitemname(.@q[0]))+"!",0;
  81. specialeffect2 699;
  82. close;
  83. case 2:
  84. set @qe3, getlook(3); set @qe4, getlook(4); set @qe5, getlook(5);
  85. if (@qe1&1) atcommand "@changelook 3 "+@qe2;
  86. if (@qe1&256) atcommand "@changelook 1 "+@qe2;
  87. if (@qe1&512) atcommand "@changelook 2 "+@qe2;
  88. set @qe6,1;
  89. break;
  90. case 3:
  91. close; } }
  92.  
  93. OnEnd:
  94. if (@qe6) { atcommand "@changelook 3 "+@qe3; atcommand "@changelook 1 "+@qe4; atcommand "@changelook 2 "+@qe5; }
  95. for(set .@i,0; .@i<7; set .@i,.@i+1) setd "@qe"+.@i,0;
  96. end;
  97.  
  98. OnPCLoadMapEvent:
  99. if( strcharinfo(3) == strnpcinfo(4) )
  100. showevent 1,0;
  101. end;
  102.  
  103. OnInit:
  104. freeloop(1);
  105.  
  106. // --------------------- Config ---------------------
  107. // Custom points, if needed: "<variable>","<name to display>"
  108. setarray .Points$[0],"#CASHPOINTS","Cash Points";
  109.  
  110. set .Announce,1; // Announce quest completion? (1: yes / 0: no)
  111. set .ShowSlot,2; // Show item slots? (2: all equipment / 1: if slots > 0 / 0: never)
  112. set .DisplayID,1; // Show item IDs? (1: yes / 0: no)
  113. set .ShowZeny,0; // Show Zeny cost, if any? (1: yes / 0: no)
  114.  
  115. // Shop categories, if needed: "<Shop 1>","<Shop 2>"{,...};
  116. // Duplicate dummy data for any additional shops (bottom of script).
  117. // If no categories, use the second line instead (remove //).
  118.  
  119. setarray .Shops$[1],"[^008000»^000000] Equipamentos Para Cabeça [Topo].","[^008000»^000000] Equipamentos Para Cabeça [Meio].","[^008000»^000000] Equipamentos Para Cabeça [Baixo].","[^008000»^000000] Visual.","[^008000»^000000] Acessórios.","[^008000»^000000] Equipamentos.";
  120. // set .Shops$,"n/a";
  121.  
  122. // Add(<shop number>,<reward ID>,<reward amount>,<Zeny cost>,<point cost>,
  123. // <required item ID>,<required item amount>{,...});
  124. // Shop number corresponds with order above (default is 1).
  125. // Note: Do NOT use a reward item more than once!
  126.  
  127. Add(1,5506,1,500000,0,5076,1,978,1,949,1000);
  128. Add(1,5507,1,500000,0,5076,1,975,1,949,1000);
  129. Add(1,5360,1,500000,0,2213,1,983,1,914,500);
  130. sleep 10;
  131. Add(1,5388,1,5000000,0,2229,1,979,1,954,300,926,300);
  132. Add(1,5208,1,5000000,0,7063,600,7182,300,1052,50);
  133. //Add(1,20038,1,5000000,0,7063,600,7182,300,1052,50);
  134. //Add(1,20039,1,5000000,0,7063,600,7182,300,1052,50);
  135. //Add(1,20040,1,5000000,0,7063,600,7182,300,1052,50);
  136. //Add(1,20041,1,5000000,0,7063,600,7182,300,1052,50);
  137. //Add(1,20051,1,5000000,0,7063,600,7182,300,1052,50);
  138.  
  139. Add(2,20002,1,5000000,0,1099,500,548,200,724,100);
  140. //Add(2,20201,1,5000000,0,727,400,7323,100,724,100);
  141. //Add(2,20202,1,5000000,0,999,600,951,600,724,100);
  142. //Add(2,20211,1,5000000,0,1055,500,936,200,724,100);
  143. //Add(2,20219,1,5000000,0,1037,400,928,600,724,100);
  144.  
  145. Add(3,20003,1,5000000,0,921,600,7220,300,7225,20);
  146. //Add(3,20401,1,5000000,0,7066,600,945,300,7225,20);
  147. //Add(3,20402,1,5000000,0,1019,600,7106,300,7225,20);
  148. //Add(3,20403,1,5000000,0,996,600,1011,300,7225,20);
  149. //Add(3,20404,1,5000000,0,746,600,971,400,7225,20);
  150. sleep 10;
  151. //Add(3,20412,1,5000000,0,1021,600,972,200,7225,20);
  152. //Add(3,20419,1,5000000,0,713,600,970,200,7225,20);
  153.  
  154. Add(4,20004,1,5000000,0,22029,10,22002,1,7773,500);
  155. //Add(4,20830,1,5000000,0,22029,10,22002,1,7773,500);
  156. //Add(4,20831,1,5000000,0,22029,10,22002,1,7773,500);
  157. //Add(4,20832,1,5000000,0,22029,10,22002,1,7773,500);
  158. //Add(4,20833,1,5000000,0,22029,10,22002,1,7773,500);
  159. //Add(4,20834,1,5000000,0,22029,10,22002,1,7773,500);
  160.  
  161. Add(5,20010,1,5000000,0,931,1000,7214,30,7112,30);
  162. //Add(5,21504,1,5000000,0,931,1000,7214,30,7112,30);
  163. //Add(5,21503,1,5000000,0,931,1000,7214,30,7112,30);
  164. //Add(5,21500,1,5000000,0,931,1000,7214,30,7112,30);
  165. //Add(5,21505,1,5000000,0,931,1000,7214,30,7112,30);
  166. //Add(5,21502,1,5000000,0,931,1000,7214,30,7112,30);
  167.  
  168. Add(6,2463,1,10000000,0,7074,2,7831,3,7075,4,7078,5,7087,5,7089,5,7830,5);
  169. //Add(6,25001,1,10000000,0,7080,4,7081,5,7082,4,7084,3,7085,3,7836,5,7837,5);
  170. //Add(6,25002,1,10000000,0,7073,4,7077,4,7088,3,7090,3,7092,3,7834,5,7835,5);
  171. //Add(6,25003,1,10000000,0,7076,3,7079,5,7083,3,7086,3,7832,5,7833,5);
  172.  
  173. // --------------------------------------------------
  174. freeloop(0);
  175. for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1)
  176. npcshopdelitem "qshop"+.@i,909;
  177. end;
  178. }
  179.  
  180. // -------- Dummy data (duplicate as needed) --------
  181. - shop qshop1 -1,909:-1
  182. - shop qshop2 -1,909:-1
  183. - shop qshop3 -1,909:-1
  184. - shop qshop4 -1,909:-1
  185. - shop qshop5 -1,909:-1
  186. - shop qshop6 -1,909:-1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement