1. poring_c01,97,108,3 script James 4_F_SON,{
  2. .npc$ = "^00B2EE[James]^000000";
  3. mes .npc$;
  4. mes "Olá ^FFA500"+strcharinfo(0)+"^000000, estou escutando uma música maravilhosa.";
  5. if (select("- Sim:- Não") == 2) close;
  6. next;
  7. mes .npc$;
  8. mes "Deseja visualizar os que eu tenho?";
  9. if (select("- Sim:- Não") == 2) close;
  10. next;
  11. mes .npc$;
  12. mes "Escolha o que você deseja visualizar.";
  13. function Add; function Chk; function Slot; function A_An;
  14. if (.Shops$ == "") set .@i, select(.menu$);
  15. else set .@i,1;
  16. dispbottom "Selecione um item por vez.";
  17. callshop "qshop67"+.@i,1;
  18. npcshopattach "qshop67"+.@i;
  19. end;
  20. function Add {
  21. if (getitemname(getarg(1)) == "null") {
  22. sprintf "Quest reward #"+getarg(1)+" invalid (skipped).";
  23. return;
  24. }
  25. for(set .@n,5; .@n<127; set .@n,.@n+2) {
  26. if (!getarg(.@n,0)) break;
  27. if (getitemname(getarg(.@n)) == "null") {
  28. sprintf "Quest requirement #"+getarg(.@n)+" invalid (skipped).";
  29. return;
  30. }
  31. }
  32. for(set .@i,2; .@i<.@n; set .@i,.@i+1)
  33. set getd(".q_"+getarg(1)+"["+(.@i-2)+"]"), getarg(.@i);
  34. npcshopadditem "qshop67"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0);
  35. return;
  36. }
  37. function Chk {
  38. if (getarg(0) < getarg(1)) {
  39. set @qe0,1;
  40. return "^FF0000";
  41. }
  42. else return "^00FF00";
  43. }
  44. function Slot {
  45. set .@s$,getitemname(getarg(0));
  46. switch(.ShowSlot) {
  47. case 1: if (!getitemslots(getarg(0))) return .@s$;
  48. case 2: if (getiteminfo(getarg(0),2) == 4 || getiteminfo(getarg(0),2) == 5) return .@s$+" ["+getitemslots(getarg(0))+"]";
  49. default: return .@s$;
  50. }
  51. }
  52. function A_An {
  53. setarray .@A$[0],"a","e","i","o","u";
  54. set .@B$, "_"+getarg(0);
  55. for(set .@i,0; .@i<5; set .@i,.@i+1)
  56. if (compare(.@B$,"_"+.@A$[.@i])) return "an "+getarg(0);
  57. return "a "+getarg(0);
  58. }
  59. OnBuyItem:
  60. set .@q[0],@bought_nameid;
  61. copyarray .@q[1],getd(".q_"+@bought_nameid+"[0]"),getarraysize(getd(".q_"+@bought_nameid+"[0]"));
  62. if (!.@q[1]) {
  63. message strcharinfo(0),"Algum erro aconteceu.";
  64. end;
  65. }
  66. mes .npc$;
  67. mes "^FF9900Recompensa:^000000 ^0055FF"+((.@q[1]>1)?.@q[1]+"x ":"")+Slot(.@q[0])+"^000000";
  68. mes "^FF9900Requisitos:^000000";
  69. if (.@q[2]) mes " > "+Chk(Zeny,.@q[2])+.@q[2]+" Zeny^000000";
  70. if (.@q[3]) mes " > "+Chk(getd(.Points$[0]),.@q[3])+.@q[3]+" "+.Points$[1]+" ("+getd(.Points$[0])+"/"+.@q[3]+")^000000";
  71. if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
  72. mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1])+((.DisplayID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+.@q[.@i+1]+")^000000";
  73. next;
  74. set @qe1, getiteminfo(.@q[0],5);
  75. set @qe2, getiteminfo(.@q[0],11);
  76. addtimer 1000, strnpcinfo(1)+"::OnEnd";
  77. while(1) {
  78. switch(select("- Comprar ^0055FF"+getitemname(.@q[0])+"^000000:- Visualizar:- ^777777Cancelar^000000")) {
  79. case 1:
  80. if (@qe0) {
  81. mes .npc$;
  82. mes "Você não tem todos os itens necessários.";
  83. close;
  84. }
  85. if (!checkweight(.@q[0],.@q[1])) {
  86. mes .npc$;
  87. mes "^FF0000Você precisa de "+(((.@q[1]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" capacidade de peso adicional para completar a quest.^000000";
  88. close;
  89. }
  90. if (.@q[2]) set Zeny, Zeny-.@q[2];
  91. if (.@q[3]) setd .Points$[0], getd(.Points$[0])-.@q[3];
  92. if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
  93. delitem .@q[.@i],.@q[.@i+1];
  94. getitem .@q[0],.@q[1];
  95. if (.Announce) announce "[James] O Jogador "+strcharinfo(0)+" acaba de concluir a quest do item "+A_An(getitemname(.@q[0]))+"!",0;
  96. specialeffect(699,SELF,playerattached());
  97. close;
  98. case 2:
  99. set @qe3, getlook(LOOK_HEAD_BOTTOM);
  100. set @qe4, getlook(LOOK_HEAD_TOP);
  101. set @qe5, getlook(LOOK_HEAD_MID);
  102. set @qe6,1;
  103. if (@qe1&1) changelook LOOK_HEAD_BOTTOM, @qe2;
  104. if (@qe1&256) changelook LOOK_HEAD_TOP, @qe2;
  105. if (@qe1&512) changelook LOOK_HEAD_MID, @qe2;
  106. if (@qe1&1024) changelook LOOK_HEAD_TOP, @qe2;
  107. if (@qe1&2048) changelook LOOK_HEAD_MID, @qe2;
  108. if (@qe1&4096) changelook LOOK_HEAD_BOTTOM, @qe2;
  109. if (@qe1&7168) changelook LOOK_HEAD_TOP, @qe2;
  110. break;
  111. case 3:
  112. close;
  113. }
  114. }
  115. OnPCLoadMapEvent:
  116. if(strcharinfo(3) == strnpcinfo(4))
  117. showevent 1,1;
  118. end;
  119. OnEnd:
  120. if (@qe6) {
  121. changelook LOOK_HEAD_BOTTOM, @qe3;
  122. changelook LOOK_HEAD_TOP, @qe4;
  123. changelook LOOK_HEAD_MID, @qe5;
  124. }
  125. for(set .@i,0; .@i<7; set .@i,.@i+1)
  126. setd "@qe"+.@i,0;
  127. end;
  128. OnInit:
  129. freeloop(1);
  130. // --------------------- Config ---------------------
  131. // Custom points, if needed: "<variable>","<name to display>"
  132. setarray .Points$[0],"#CASHPOINTS","Cash Points";
  133. set .Announce,1; // Announce quest completion? (1: yes / 0: no)
  134. set .ShowSlot,1; // Show item slots? (2: all equipment / 1: if slots > 0 / 0: never)
  135. set .DisplayID,0; // Show item IDs? (1: yes / 0: no)
  136. set .ShowZeny,1; // Show Zeny cost, if any? (1: yes / 0: no)
  137. setarray .Shops$[1],"- Headphone";
  138. // -----------------------------------------------------------
  139. // Quest items -- do NOT use a reward item more than once!
  140. // Add(<shop ID>,<reward ID>,<reward amount>,
  141. // <Zeny cost>,<point cost>,
  142. // <required item ID>,<required item amount>{,...});
  143. // -----------------------------------------------------------
  144. // Headphone
  145. Add(1,40227,1,0,0,5151,1,978,50);
  146. Add(1,40228,1,0,0,5151,1,983,50);
  147. Add(1,40229,1,0,0,5151,1,979,50);
  148. Add(1,40230,1,0,0,5151,1,983,25,982,25);
  149. Add(1,40231,1,0,0,5151,1,975,25,981,25);
  150. Add(1,40232,1,0,0,5151,1,975,50);
  151. Add(1,40233,1,0,0,5151,1,982,50);
  152. Add(1,40234,1,0,0,5151,1,976,50);
  153. // --------------------------------------------------
  154. freeloop(0);
  155. set .menu$,"";
  156. for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) {
  157. set .menu$, .menu$+.Shops$[.@i]+":";
  158. npcshopdelitem "qshop67"+.@i,909;
  159. }
  160. end;
  161. }
  162. // -------- Dummy data (duplicate as needed) --------
  163. - shop qshop670 -1,909:-1
  164. - shop qshop671 -1,909:-1
  165. - shop qshop672 -1,909:-1
  166. - shop qshop673 -1,909:-1
  167. - shop qshop674 -1,909:-1