- poring_c01,97,108,3 script James 4_F_SON,{
- .npc$ = "^00B2EE[James]^000000";
- mes .npc$;
- mes "Olá ^FFA500"+strcharinfo(0)+"^000000, estou escutando uma música maravilhosa.";
- if (select("- Sim:- Não") == 2) close;
- next;
- mes .npc$;
- mes "Deseja visualizar os que eu tenho?";
- if (select("- Sim:- Não") == 2) close;
- next;
- mes .npc$;
- mes "Escolha o que você deseja visualizar.";
- function Add; function Chk; function Slot; function A_An;
- if (.Shops$ == "") set .@i, select(.menu$);
- else set .@i,1;
- dispbottom "Selecione um item por vez.";
- callshop "qshop67"+.@i,1;
- npcshopattach "qshop67"+.@i;
- end;
- function Add {
- if (getitemname(getarg(1)) == "null") {
- sprintf "Quest reward #"+getarg(1)+" invalid (skipped).";
- return;
- }
- for(set .@n,5; .@n<127; set .@n,.@n+2) {
- if (!getarg(.@n,0)) break;
- if (getitemname(getarg(.@n)) == "null") {
- sprintf "Quest requirement #"+getarg(.@n)+" invalid (skipped).";
- return;
- }
- }
- for(set .@i,2; .@i<.@n; set .@i,.@i+1)
- set getd(".q_"+getarg(1)+"["+(.@i-2)+"]"), getarg(.@i);
- npcshopadditem "qshop67"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0);
- return;
- }
- function Chk {
- if (getarg(0) < getarg(1)) {
- set @qe0,1;
- return "^FF0000";
- }
- else return "^00FF00";
- }
- function Slot {
- set .@s$,getitemname(getarg(0));
- switch(.ShowSlot) {
- case 1: if (!getitemslots(getarg(0))) return .@s$;
- case 2: if (getiteminfo(getarg(0),2) == 4 || getiteminfo(getarg(0),2) == 5) return .@s$+" ["+getitemslots(getarg(0))+"]";
- default: return .@s$;
- }
- }
- function A_An {
- setarray .@A$[0],"a","e","i","o","u";
- set .@B$, "_"+getarg(0);
- for(set .@i,0; .@i<5; set .@i,.@i+1)
- if (compare(.@B$,"_"+.@A$[.@i])) return "an "+getarg(0);
- return "a "+getarg(0);
- }
- OnBuyItem:
- set .@q[0],@bought_nameid;
- copyarray .@q[1],getd(".q_"+@bought_nameid+"[0]"),getarraysize(getd(".q_"+@bought_nameid+"[0]"));
- if (!.@q[1]) {
- message strcharinfo(0),"Algum erro aconteceu.";
- end;
- }
- mes .npc$;
- mes "^FF9900Recompensa:^000000 ^0055FF"+((.@q[1]>1)?.@q[1]+"x ":"")+Slot(.@q[0])+"^000000";
- mes "^FF9900Requisitos:^000000";
- if (.@q[2]) mes " > "+Chk(Zeny,.@q[2])+.@q[2]+" Zeny^000000";
- if (.@q[3]) mes " > "+Chk(getd(.Points$[0]),.@q[3])+.@q[3]+" "+.Points$[1]+" ("+getd(.Points$[0])+"/"+.@q[3]+")^000000";
- if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
- mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1])+((.DisplayID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+.@q[.@i+1]+")^000000";
- next;
- set @qe1, getiteminfo(.@q[0],5);
- set @qe2, getiteminfo(.@q[0],11);
- addtimer 1000, strnpcinfo(1)+"::OnEnd";
- while(1) {
- switch(select("- Comprar ^0055FF"+getitemname(.@q[0])+"^000000:- Visualizar:- ^777777Cancelar^000000")) {
- case 1:
- if (@qe0) {
- mes .npc$;
- mes "Você não tem todos os itens necessários.";
- close;
- }
- if (!checkweight(.@q[0],.@q[1])) {
- mes .npc$;
- mes "^FF0000Você precisa de "+(((.@q[1]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" capacidade de peso adicional para completar a quest.^000000";
- close;
- }
- if (.@q[2]) set Zeny, Zeny-.@q[2];
- if (.@q[3]) setd .Points$[0], getd(.Points$[0])-.@q[3];
- if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
- delitem .@q[.@i],.@q[.@i+1];
- getitem .@q[0],.@q[1];
- if (.Announce) announce "[James] O Jogador "+strcharinfo(0)+" acaba de concluir a quest do item "+A_An(getitemname(.@q[0]))+"!",0;
- specialeffect(699,SELF,playerattached());
- close;
- case 2:
- set @qe3, getlook(LOOK_HEAD_BOTTOM);
- set @qe4, getlook(LOOK_HEAD_TOP);
- set @qe5, getlook(LOOK_HEAD_MID);
- set @qe6,1;
- if (@qe1&1) changelook LOOK_HEAD_BOTTOM, @qe2;
- if (@qe1&256) changelook LOOK_HEAD_TOP, @qe2;
- if (@qe1&512) changelook LOOK_HEAD_MID, @qe2;
- if (@qe1&1024) changelook LOOK_HEAD_TOP, @qe2;
- if (@qe1&2048) changelook LOOK_HEAD_MID, @qe2;
- if (@qe1&4096) changelook LOOK_HEAD_BOTTOM, @qe2;
- if (@qe1&7168) changelook LOOK_HEAD_TOP, @qe2;
- break;
- case 3:
- close;
- }
- }
- OnPCLoadMapEvent:
- if(strcharinfo(3) == strnpcinfo(4))
- showevent 1,1;
- end;
- OnEnd:
- if (@qe6) {
- changelook LOOK_HEAD_BOTTOM, @qe3;
- changelook LOOK_HEAD_TOP, @qe4;
- changelook LOOK_HEAD_MID, @qe5;
- }
- for(set .@i,0; .@i<7; set .@i,.@i+1)
- setd "@qe"+.@i,0;
- end;
- OnInit:
- freeloop(1);
- // --------------------- Config ---------------------
- // Custom points, if needed: "<variable>","<name to display>"
- setarray .Points$[0],"#CASHPOINTS","Cash Points";
- set .Announce,1; // Announce quest completion? (1: yes / 0: no)
- set .ShowSlot,1; // Show item slots? (2: all equipment / 1: if slots > 0 / 0: never)
- set .DisplayID,0; // Show item IDs? (1: yes / 0: no)
- set .ShowZeny,1; // Show Zeny cost, if any? (1: yes / 0: no)
- setarray .Shops$[1],"- Headphone";
- // -----------------------------------------------------------
- // Quest items -- do NOT use a reward item more than once!
- // Add(<shop ID>,<reward ID>,<reward amount>,
- // <Zeny cost>,<point cost>,
- // <required item ID>,<required item amount>{,...});
- // -----------------------------------------------------------
- // Headphone
- Add(1,40227,1,0,0,5151,1,978,50);
- Add(1,40228,1,0,0,5151,1,983,50);
- Add(1,40229,1,0,0,5151,1,979,50);
- Add(1,40230,1,0,0,5151,1,983,25,982,25);
- Add(1,40231,1,0,0,5151,1,975,25,981,25);
- Add(1,40232,1,0,0,5151,1,975,50);
- Add(1,40233,1,0,0,5151,1,982,50);
- Add(1,40234,1,0,0,5151,1,976,50);
- // --------------------------------------------------
- freeloop(0);
- set .menu$,"";
- for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) {
- set .menu$, .menu$+.Shops$[.@i]+":";
- npcshopdelitem "qshop67"+.@i,909;
- }
- end;
- }
- // -------- Dummy data (duplicate as needed) --------
- - shop qshop670 -1,909:-1
- - shop qshop671 -1,909:-1
- - shop qshop672 -1,909:-1
- - shop qshop673 -1,909:-1
- - shop qshop674 -1,909:-1