//===== rAthena Script =======================================//= Euphy's Quest Shop//===== By: ==================================================//= Euphy//===== Current Version: =====================================//= 1.4b//===== Compatible With: =====================================//= rAthena SVN r15340+//===== Description: =========================================//= A dynamic quest shop based on Lunar's, with easier config.//= Includes support for multiple shops & cashpoints.//= Item Preview script by ToastOfDoom.//============================================================prontera,156,190,6 script Quest for Treat 998,{function Add; function Chk; function Slot; function A_An;specialeffect358, SELF;mes"[^FF78E4Quest for Treat^000000]";mes"Hello there, "+strcharinfo(0)+"! For the ^C060E6Halloween Event^000000, I've cooked up something good for you!";mes" ";mes"You can choose from ^FF00006 cool headgears^000000 and ^FF00002 masks^000000, mostly with awesome BONUS stats, to celebrate the ^C060E6Halloween^000000. ";mes" ";mes"Not too fast though, they're not free! You have to gather requirements for each of the headgears in order to get a hold of them! ";specialeffect360, SELF;next;mes"[^FF78E4Quest for Treat^000000]";mes"Halloween Promos: ";mes"- ^FF0000Get the first four headgears in the shop for only P500 each^000000 (direct donation)^FF0000!^000000";mes"- ^008800Get the last four headgears in the shop for only P200 each^000000 (direct donation)^008800!^000000";mes" ";mes"Contact [GM] Cassie in-game or in Facebook (fb.com/cassie.tbro) for more details. ";next;mes"[^FF78E4Quest for Treat^000000]";mes"NOTE: These headgears have ^FF00007-day expiration^000000 and ^FF0000cannot be traded/stored^000000. Headgears are simply for Halloween collection per character and not per account. ^FF0000Compound cards at your own risk.^000000";mes"";next;if(.Shops$ =="")set .@i, select(.menu$);elseset .@i,1;dispbottom"Select one item at a time.";callshop"newqshop"+.@i,1;npcshopattach"newqshop"+.@i;end;function Add {if(getitemname(getarg(1))=="null"){debugmes"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"){debugmes"Quest requirement #"+getarg(.@n)+" invalid (skipped).";return;}}for(set .@i,2; .@i<.@n; set .@i,.@i+1)setgetd(".q_"+getarg(1)+"["+(.@i-2)+"]"), getarg(.@i);npcshopadditem"newqshop"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0);return;}function Chk {if(getarg(0) < getarg(1)){set @qe0,1;return"^FF0000";}elsereturn"^4FD64F";}function Slot {set .@s$,getitemname(getarg(0));switch(.ShowSlot){case1:if(!getitemslots(getarg(0)))return .@s$;case2: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]){messagestrcharinfo(0),"An error has occurred.";end;}mes"[^FF78E4Quest for Treat^000000]";mes"Treat: ^0055FF"+((.@q[1]>1)?.@q[1]+"x ":"")+Slot(.@q[0])+"^000000";mes"Terms: ^0055FF7 Days^000000 & ^0055FFNon-tradeable^000000";mes"Requirements:";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);addtimer1000, strnpcinfo(1)+"::OnEnd";while(1){switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000:"+((((@qe1&1) || (@qe1&256) || (@qe1&512))&& @qe2 > 0&&!@qe6)?" ~ Preview...":"")+": ~ ^777777Cancel^000000")){case1:if(@qe0){mes"[Quest Shop]";mes"You're missing one or more quest requirements.";close;}if(!checkweight(.@q[0],.@q[1])){mes"[Quest Shop]";mes"^FF0000You need "+(((.@q[1]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000";close;}if(.@q[2])setZeny, 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];for(.@i=0;.@i <.@q[1];.@i++)rentitem .@q[0], 604800;if(.Announce)announce"Quest for Treat: "+strcharinfo(0)+" has created "+A_An(getitemname(.@q[0]))+" for the Halloween!",0,0xFF78E4;specialeffect2699;close;case2:set @qe3, getlook(3);set @qe4, getlook(4);set @qe5, getlook(5);set @qe6,1;if(@qe1&1)atcommand"@changelook 3 "+@qe2;if(@qe1&256)atcommand"@changelook 1 "+@qe2;if(@qe1&512)atcommand"@changelook 2 "+@qe2;break;case3:close;}}OnEnd:if(@qe6){atcommand"@changelook 3 "+@qe3;atcommand"@changelook 1 "+@qe4;atcommand"@changelook 2 "+@qe5;}for(set .@i,0; .@i<7; set .@i,.@i+1)setd"@qe"+.@i,0;end;OnClock0115:OnClock0315:OnClock0515:OnClock0715:OnClock0915:OnClock1115:OnClock1315:OnClock1515:OnClock1715:OnClock1915:OnClock2115:OnClock2315:announce"Quest for Treat: Are you good enough to collect all the Halloween headgears just in time?",0,0xFF78E4;announce"Quest for Treat: Visit me in mid Prontera for complete details and get pumped now!",0,0xFF78E4;end;OnInit:waitingroom"[Halloween Quest]",0;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,0; // Show Zeny cost, if any? (1: yes / 0: no)// Shop categories, if needed: "<Shop 1>","<Shop 2>"{,...};// Duplicate dummy data for any additional shops (bottom of script).// If no categories, use the second line instead (remove //).setarray .Shops$[1],"Halloween Headgears";// set .Shops$,"n/a";// Add(<shop number>,<reward ID>,<reward amount>,<Zeny cost>,<point cost>,// <required item ID>,<required item amount>{,...});// Shop number corresponds with order above (default is 1).// Note: Do NOT use a reward item more than once! Add(1,5356,1,0,0,7539,3000,1062,500,539,100,538,100,919,100,907,100,958,100,1024,100,7420,30); Add(1,18527,1,0,0,7539,2000,1062,300,529,100,530,100,938,100,957,100,932,100,930,100,7420,30); Add(1,18656,1,0,0,7539,1000,1001,200,1061,150,529,100,530,100,539,100,538,100,930,100,7420,30); Add(1,5490,1,0,0,7539,1000,1038,300,958,200,7002,300,1060,100,1020,100,7420,30,923,5,1048,3); Add(1,5671,1,0,0,7539,500,930,300,932,300,938,200,1059,200,7420,30); Add(1,5530,1,0,0,7539,200,1020,250,1034,250,938,100); Add(1,5294,1,0,0,7539,300,930,300,1059,300,938,300); Add(1,5461,1,0,0,7539,1000,5294,1);// --------------------------------------------------freeloop(0);set .menu$,"";for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1){set .menu$, .menu$+.Shops$[.@i]+":";npcshopdelitem"newqshop"+.@i,909;}end;}// -------- Dummy data (duplicate as needed) --------- shop newqshop1 -1,909:-1- shop newqshop2 -1,909:-1- shop newqshop3 -1,909:-1