Currently Im using the JayPee Mateo Voteforpoints NPC. Its working Nice!
//setarray .itemShop[0], 30005,700,30024,600,5545,200,5546,200,5514,200,5515,200,5588,200,5589,200,5598,200,5599,200,5662,200,5663,200,5739,200,5740,200,5676,200,5677,200,5744,200,5745,200,5512,200,5513,200,5549,200,5550,200,607,1; // <ITEM_ID>,<PRICE>
//====================================================================================
//Script Name: Vote For Points NPC Script for FluxCP
//SVN: Tested in rAthena r156513
//Developed By: JayPee Mateo
//Version: 1.0
//Requirement(s): FluxCP V4P Addon
//Description: This is a npc script for FluxCP Vote for points in order for the players
//to claim their vote points
//====================================================================================
florian,204,164,4 script VotaPuntos 862,{
//Function Prototypes
function garbagecol;//Garbage collection for the Character variables
garbagecol();
function add_item; //Syntanx: add_item(ITEMID,QUANTITY,POINTS,CATEGORY);
function makeCategory;//This will return a list of the categories
function getItemsByCat;//This will return the list of items associated to the particular category
function getItemDetails;//This will return the details of the item
function getPoints;//This will return the points of the player stored in the database
function updatePoints;//This will updates the points of the player stored in the database
//NPC Name
set .npcname$,"[ Vota Puntos ]";
//Initialization of the Rewards
add_item(18743,1,400,"Costume");
add_item(30124,1,400,"Costume");
add_item(19661,1,500,"Costume");
add_item(12036,1,2,"Consumibles");
add_item(12037,1,2,"Consumibles");
add_item(18859,1,400,"Hats");
add_item(18540,1,400,"Hats");
add_item(18844,1,400,"Hats");
//Script Start
mes .npcname$;
mes "Gracias por ayudar al servidor a crecer con tus votos, Te gustaria cambiar tus puntos de votacion?";
switch(select("Si:Ver mis puntos"))
{
case 1:
next;
mes .npcname$;
mes "Porfavor elige una categoria:";
set .@selected,select(makeCategory())-1;
next;
mes .npcname$;
mes "Porfavor elige el articulo que deseas:";
set .@selected,select(getItemsByCat(@listCat$[.@selected]))-1;
next;
mes .npcname$;
set .@ritemid,getItemDetails(@itemKeys[.@selected],"itemid");
set .@rquantity,getItemDetails(@itemKeys[.@selected],"quantity");
set .@rpoints,getItemDetails(@itemKeys[.@selected],"points");
mes "ID del articulo:"+.@ritemid;
mes "Nombre del Articulo: "+getitemname(.@ritemid);
mes "Cantidad: "+.@rquantity+" pc(s).";
mes "Costo por articulo: "+.@rpoints+" pt(s).";
mes "\n";
mes "hacemos trato?";
if(select("Si:No")==1)
{
set .@points,getPoints(getcharid(3));
if(.@points>=.@rpoints)
{
next;
mes .npcname$;
updatePoints(getcharid(3),.@rpoints);
getitem .@ritemid,.@rquantity;
mes "Gracias por votar!. No olvides hacerlo de nuevo!. :D";
}
else
mes "Lo siento, no tienes los puntos necesarios para este articulo.";
}
else
{
next;
mes .npcname$;
mes "Okay bye!";
}
garbagecol();
close;
case 2:
next;
mes .npcname$;
set .@points,getPoints(getcharid(3));
mes "Actualmente dispones de "+.@points+" pt(s).";
garbagecol();
close;
}
end;
//Functions Bodies
function updatePoints {
set .@account_id,getarg(0);
set .@usedPoints,getarg(1);
query_sql("UPDATE `cp_v4p_voters` SET points=(points-"+.@usedPoints+") WHERE account_id='"+.@account_id+"'");
return;
}
function getPoints {
set .@account_id,getarg(0);
query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id="+.@account_id+" LIMIT 1",.@points);
if(getarraysize(.@points)==0)
return 0;
return .@points[0];
}
function getItemDetails {
set .@key,getarg(0); //Key
set .@detail$,getarg(1); //What details to return such as ItemID, Points, Quantity, Category
if(strtolower(.@detail$) == strtolower("ItemID"))
return @itemID[.@key];
else if(strtolower(.@detail$) == strtolower("Quantity"))
return @itemQ[.@key];
else if(strtolower(.@detail$) == strtolower("Points"))
return @points[.@key];
else if(strtolower(.@detail$) == strtolower("Category"))
return @category$[.@key];
}
function getItemsByCat {
set .@selectedCat$,getarg(0);
set .@make_string$,"";
set .@x,0;
for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1)
{
if(strtolower(.@selectedCat$) == strtolower(@category$[.@i]))
{
setarray @itemKeys[.@x],.@i;
if(.@make_string$ == "")
set .@make_string$,getitemname(@itemID[.@i]);
else
set .@make_string$,.@make_string$+":"+getitemname(@itemID[.@i]);
set .@x,.@x+1;
}
}
return .@make_string$;
}
function makeCategory {
set .@make_string$,"";
for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1)
{
if(.@make_string$ == "")
{
setarray @listCat$[getarraysize(@listCat$)],@category$[.@i];
set .@make_string$,@category$[.@i];
}
else
{
if(compare(.@make_string$,@category$[.@i])==0)
{
setarray @listCat$[getarraysize(@listCat$)],@category$[.@i];
set .@make_string$,.@make_string$+":"[email protected]<script data-cfhash='f9e31' type="text/javascript">/* */</script>$[.@i];
}
}
}
return .@make_string$;
}
function add_item
{
set .@itemID,getarg(0,-1); //IteID
set .@itemQ,getarg(1,-1); //Item Quantity
set .@points,getarg(2,-1);
set .@cat$,getarg(3,"Uncategorized"); //Category
if(.@itemID == -1)
{
debugmes "Invalid Item ID. Script not completely loaded.";
end;
}
else if(.@itemQ == -1)
{
debugmes "Invalid Item Quantity. Script not completely loaded.";
end;
}
else if(.@points == -1)
{
debugmes "Points assignment error. Script not completely loaded.";
end;
}
set .@key,getarraysize(@itemID);
setarray @itemID[.@key],.@itemID;
setarray @itemQ[.@key],.@itemQ;
setarray @points[.@key],.@points;
setarray @category$[.@key],.@cat$;
return 1; //return 1 as success
}
function garbagecol{
deletearray @itemID[0],128;
deletearray @itemQ[0],128;
deletearray @points[0],128;
deletearray @category$[0],128;
deletearray @listCat$[0],128;
deletearray @itemKeys[0],128;
return;
}
}
But I would like to make it similar to the Euphy's Dynamic Shop with the changelook option, costume headgears changelook. etc.
//===== rAthena Script =======================================
//= Euphy's Quest Shop
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.6c
//===== Compatible With: =====================================
//= rAthena Project
//===== Description: =========================================
//= A dynamic quest shop based on Lunar's, with easier config.
//= Includes support for multiple shops & cashpoints.
//= Item Preview script by ToastOfDoom.
//===== Additional Comments: =================================
//= 1.0 Initial script.
//= 1.2 Added category support.
//= 1.3 More options and fixes.
//= 1.4 Added debug settings.
//= 1.5 Replaced categories with shop IDs.
//= 1.6 Added support for purchasing stackables.
//= 1.6a Added support for previewing costumes and robes.
//= 1.6b Added 'disable_items' command.
//= 1.6c Replaced function 'A_An' with "F_InsertArticle".
//============================================================
// Shop NPCs -- supplying no argument displays entire menu.
// callfunc "qshop"{,<shop ID>{,<shop ID>{,...}}};
//============================================================
florian,83,135,6 script Sombreros Quest#1 408,{ callfunc "qshop"; }
// Script Core
//============================================================
- script quest_shop -1,{
function Add; function Chk; function Slot;
OnInit:
freeloop(1);
// -----------------------------------------------------------
// Basic shop settings.
// -----------------------------------------------------------
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 .ShowID,0; // Show item IDs? (1: yes / 0: no)
set .ShowZeny,0; // Show Zeny cost, if any? (1: yes / 0: no)
set .MaxStack,100; // Max number of quest items purchased at one time.
// -----------------------------------------------------------
// Points variable -- optional quest requirement.
// setarray .Points$[0],"<variable name>","<display name>";
// -----------------------------------------------------------
setarray .Points$[0],"#CASHPOINTS","Cash Points";
// -----------------------------------------------------------
// Shop IDs -- to add shops, copy dummy data at bottom of file.
// setarray .Shops$[1],"<Shop 1>","<Shop 2>"{,...};
// -----------------------------------------------------------
setarray .Shops$[1],"Sombreros";
// -----------------------------------------------------------
// 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>{,...});
// -----------------------------------------------------------
Add(1,18930,1,0,0,7011,100,10018,20,753,100,6242,200);
Add(1,18931,1,0,0,1060,150,1048,200,2249,50,6242,200);
Add(1,18932,1,0,0,947,200,6023,100,6022,10,6242,200);
Add(1,18547,1,0,0,12374,150,12018,500,2250,50,6242,200);
Add(1,18548,1,0,0,7799,200,2252,70,975,20,6242,200);
Add(1,18549,1,0,0,7168,300,2718,50,710,150,6242,200);
//
// Add(2,1224,1,0,0,7297,30,969,10,999,50,714,10);
// Add(2,1225,1,0,0,7292,30,969,10,999,50,714,10);
//
// Add(3,531,1,3,0,512,1,713,1);
// Add(3,532,1,3,0,513,1,713,1);
// Add(3,533,1,3,0,514,1,713,1);
// Add(3,534,1,3,0,515,1,713,1);
// -----------------------------------------------------------
freeloop(0);
set .menu$,"";
for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) {
set .menu$, .menu$+.Shops$[.@i]+":";
npcshopdelitem "qshop"+.@i,909;
}
end;
OnMenu:
set .@size, getarraysize(@i);
if (!.@size) set @shop_index, select(.menu$);
else if (.@size == 1) set @shop_index, @i[0];
else {
for(set .@j,0; .@j<.@size; set .@j,.@j+1)
set .@menu$, .@menu$+.Shops$[@i[.@j]]+":";
set @shop_index, @i[select(.@menu$)-1];
}
deletearray @i[0],getarraysize(@i);
if (.Shops$[@shop_index] == "") {
message strcharinfo(0),"An error has occurred.";
end;
}
dispbottom "Select one item at a time.";
callshop "qshop"+@shop_index,1;
npcshopattach "qshop"+@shop_index;
end;
OnBuyItem:
// .@q[] : RewardID, BoughtAmt, RewardAmt, BaseAmt, ReqZeny, ReqPts, { ReqItem, ReqAmt, ... }
setarray .@q[0],@bought_nameid[0],((@bought_quantity[0] > .MaxStack)?.MaxStack:@bought_quantity[0]);
copyarray .@q[3],getd(".q_"+@shop_index+"_"+.@q[0]+"[0]"),getarraysize(getd(".q_"+@shop_index+"_"+.@q[0]));
set .@q[2],.@q[1]*.@q[3];
if (!.@q[2] || .@q[2] > 30000) {
message strcharinfo(0),"No puedes comprar tantos hats "+getitemname(.@q[0])+".";
end;
}
mes "[Quest Shop]";
mes "Reward: ^0055FF"+((.@q[2] > 1)?.@q[2]+"x ":"")+Slot(.@q[0])+"^000000";
mes "Requirements:";
disable_items;
if (.@q[4]) mes " > "+Chk(Zeny,.@q[4]*.@q[1])+(.@q[4]*.@q[1])+" Zeny^000000";
if (.@q[5]) mes " > "+Chk(getd(.Points$[0]),.@q[5]*.@q[1])+(.@q[5]*.@q[1])+" "+.Points$[1]+" ("+getd(.Points$[0])+"/"+(.@q[5]*.@q[1])+")^000000";
if (.@q[6]) for(set .@i,6; .@i<getarraysize(.@q); set .@i,.@i+2)
mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1]*.@q[1])+((.ShowID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+(.@q[.@i+1]*.@q[1])+")^000000";
next;
setarray @qe[1], getiteminfo(.@q[0],5), getiteminfo(.@q[0],11);
if (@qe[2] > 0 && ((@qe[1] & 1) || (@qe[1] & 256) || (@qe[1] & 512) || (@qe[1] & 1024) || (@qe[1] & 2048) || (@qe[1] & 4096) || (@qe[1] & 4) || (@qe[1] & 8192)))
set .@preview,1;
addtimer 1000, strnpcinfo(0)+"::OnEnd";
while(1) {
switch(select(" Obtener ^0055FF"+getitemname(.@q[0])+"^000000:"+((.@preview && !@qe[7])?" Probarmelo...":"")+": ^777777Nada^000000")) {
case 1:
if (@qe[0]) {
mes "[Quest Shop]";
mes "Parece que no tienes todo, revisa tu inventario.";
close;
}
if (!checkweight(.@q[0],.@q[2])) {
mes "[Quest Shop]";
mes "^FF0000You need "+(((.@q[2]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000";
close;
}
if (.@q[4]) set Zeny, Zeny-(.@q[4]*.@q[1]);
if (.@q[5]) setd .Points$[0], getd(.Points$[0])-(.@q[5]*.@q[1]);
if (.@q[6]) for(set .@i,6; .@i<getarraysize(.@q); set .@i,.@i+2)
delitem .@q[.@i],.@q[.@i+1]*.@q[1];
getitem .@q[0],.@q[2];
if (.Announce) announce strcharinfo(0)+" Se ha creado un "+((.@q[2] > 1)?.@q[2]+"x "+getitemname(.@q[0]):callfunc("F_InsertArticle",getitemname(.@q[0])))+"!",0;
specialeffect2 EF_FLOWERLEAF;
close;
case 2:
setarray @qe[3], getlook(LOOK_HEAD_BOTTOM), getlook(LOOK_HEAD_TOP), getlook(LOOK_HEAD_MID), getlook(LOOK_ROBE), 1;
if ((@qe[1] & 1) || (@qe[1] & 4096)) changelook LOOK_HEAD_BOTTOM, @qe[2];
else if ((@qe[1] & 256) || (@qe[1] & 1024)) changelook LOOK_HEAD_TOP, @qe[2];
else if ((@qe[1] & 512) || (@qe[1] & 2048)) changelook LOOK_HEAD_MID, @qe[2];
else if ((@qe[1] & 4) || (@qe[1] & 8192)) changelook LOOK_ROBE, @qe[2];
break;
case 3:
close;
}
}
OnEnd:
if (@qe[7]) {
changelook LOOK_HEAD_BOTTOM, @qe[3];
changelook LOOK_HEAD_TOP, @qe[4];
changelook LOOK_HEAD_MID, @qe[5];
changelook LOOK_ROBE, @qe[6];
}
deletearray @qe[0],8;
end;
function Add {
if (getitemname(getarg(1)) == "null") {
debugmes "Quest reward #"+getarg(1)+" invalid (skipped).";
return;
}
setarray .@j[0],getarg(2),getarg(3),getarg(4);
for(set .@i,5; .@i<getargcount(); set .@i,.@i+2) {
if (getitemname(getarg(.@i)) == "null") {
debugmes "Quest requirement #"+getarg(.@i)+" invalid (skipped).";
return;
} else
setarray .@j[.@i-2],getarg(.@i),getarg(.@i+1);
}
copyarray getd(".q_"+getarg(0)+"_"+getarg(1)+"[0]"),.@j[0],getarraysize(.@j);
npcshopadditem "qshop"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0);
return;
}
function Chk {
if (getarg(0) < getarg(1)) {
set @qe[0],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 script qshop {
deletearray @i[0],getarraysize(@i);
for(set .@i,0; .@i<getargcount(); set .@i,.@i+1)
set @i[.@i],getarg(.@i);
doevent "quest_shop::OnMenu";
end;
}
// Dummy shop data -- copy as needed.
//============================================================
- shop qshop1 -1,909:-1
- shop qshop2 -1,909:-1
- shop qshop3 -1,909:-1
- shop qshop4 -1,909:-1
- shop qshop5 -1,909:-1
Question
Yaoi
Hi rAthena!
Currently Im using the JayPee Mateo Voteforpoints NPC.
Its working Nice!
But I would like to make it similar to the Euphy's Dynamic Shop with the changelook option, costume headgears changelook. etc.
Please help, ill pay if its possible.

Thanks.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.