Kakaroto Posted November 29, 2016 Group: Members Topic Count: 99 Topics Per Day: 0.02 Content Count: 638 Reputation: 95 Joined: 05/11/12 Last Seen: Monday at 01:03 PM Share Posted November 29, 2016 Hello, does anyone have any vote-point npc based on fluxcp that allows you to view the items before buying them? I am very grateful to anyone who can help me! Quote Link to comment Share on other sites More sharing options...
0 HappyMan Posted November 29, 2016 Group: Members Topic Count: 20 Topics Per Day: 0.01 Content Count: 191 Reputation: 25 Joined: 07/19/14 Last Seen: June 26, 2019 Share Posted November 29, 2016 //===== rAthena Script ======================================= //= Euphy's Quest Shop //===== By: ================================================== //= Euphy //===== Current Version: ===================================== //= 1.4a //===== 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. //============================================================ quiz_02,293,234,4 script Vote Shop 501,{ function Add; function Chk; function Slot; function A_An; if(.Shops$ != "") set .@i,1; else { set .@menu$,""; for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) set .@menu$, .@menu$+.Shops$[.@i]+":"; set .@i, select(.@menu$); } dispbottom "Select one item at a time."; callshop "qshop2"+.@i,1; npcshopattach "qshop2"+.@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) set getd(".q_"+getarg(1)+"["+(.@i-2)+"]"), getarg(.@i); npcshopadditem "qshop2"+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),11)>0) 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),"An error has occurred."; end; } mes "[Quest Shop]"; mes "Reward: ^0055FF"+((.@q[1]>1)?.@q[1]+"x ":"")+Slot(.@q[0])+"^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); addtimer 1000, 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")) { case 1: 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]) 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 strcharinfo(0)+" has created "+A_An(getitemname(.@q[0]))+"!",0; specialeffect2 699; close; case 2: set @qe3, getlook(3); set @qe4, getlook(4); set @qe5, getlook(5); if (@qe1&1) atcommand "@changelook 3 "+@qe2; if (@qe1&256) atcommand "@changelook 1 "+@qe2; if (@qe1&512) atcommand "@changelook 2 "+@qe2; set @qe6,1; break; case 3: 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; 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,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],"Vote4Cash Items","Vote4Cash Foods"; // 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,5401,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5402,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5288,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5793,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5387,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5486,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5338,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5346,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5336,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5360,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,18600,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5751,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5188,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5506,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5432,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5560,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5372,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5495,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,18656,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5579,1,0,25,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,20097,1,0,200,0,0,0,0,0,0,0,0,0,0,0,0); Add(1,5306,1,0,200,0,0,0,0,0,0,0,0,0,0,0,0); Add(2,12075,1,0,5,0,0,0,0,0,0,0,0,0,0,0,0); Add(2,12090,1,0,5,0,0,0,0,0,0,0,0,0,0,0,0); Add(2,12080,1,0,5,0,0,0,0,0,0,0,0,0,0,0,0); Add(2,12100,1,0,5,0,0,0,0,0,0,0,0,0,0,0,0); Add(2,12095,1,0,5,0,0,0,0,0,0,0,0,0,0,0,0); Add(2,12085,1,0,5,0,0,0,0,0,0,0,0,0,0,0,0); Add(2,13697,1,0,20,0,0,0,0,0,0,0,0,0,0,0,0); Add(2,13698,1,0,20,0,0,0,0,0,0,0,0,0,0,0,0); // -------------------------------------------------- freeloop(0); for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) npcshopdelitem "qshop2"+.@i,909; end; } // -------- Dummy data (duplicate as needed) -------- - shop qshop21 -1,909:-1 - shop qshop22 -1,909:-1 - shop qshop23 -1,909:-1 here. Quote Link to comment Share on other sites More sharing options...
0 Kakaroto Posted November 29, 2016 Group: Members Topic Count: 99 Topics Per Day: 0.02 Content Count: 638 Reputation: 95 Joined: 05/11/12 Last Seen: Monday at 01:03 PM Author Share Posted November 29, 2016 @HappyMan I just need the players to see the items, type a listing of an ordinary store, the item appears, it drags to the buy and sell window it. I have the script, could you help me update it? /==================================================================================== //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 //==================================================================================== royal_room3,80,136,5 script VoteForPoints 89,{ //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$,"[ Vote For Points ]"; //Initialization of the Rewards add_item(555,1,100,"Hello"); add_item(556,2,101,"Hello"); add_item(557,3,101,"Hello1"); //Script Start mes .npcname$; mes "Hi! Do you want to exchange your vote points?:"; switch(select("Yes, I want to exchange my points:See my points")) { case 1: next; mes .npcname$; mes "Please choose a category:"; set .@selected,select(makeCategory())-1; next; mes .npcname$; mes "Please the item you want:"; 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 "Item ID:"+.@ritemid; mes "Item Name: "+getitemname(.@ritemid); mes "Item Quantity: "+.@rquantity+" pc(s)."; mes "Required Points: "+.@rpoints+" pt(s)."; mes "\n"; mes "Do you want to this item?"; if(select("Yes:No")==1) { set .@points,getPoints(getcharid(3)); if(.@points>=.@rpoints) { next; mes .npcname$; updatePoints(getcharid(3),.@rpoints); getitem .@ritemid,.@rquantity; mes "Here you go!. Thank you for voting. Don't forget to vote again. :D"; } else mes "Sorry, you do not have enough points for this item."; } else { next; mes .npcname$; mes "Okay bye!"; } garbagecol(); close; case 2: next; mes .npcname$; set .@points,getPoints(getcharid(3)); mes "You currently have "+.@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$+":"+@category$[.@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; } } Quote Link to comment Share on other sites More sharing options...
0 HappyMan Posted December 1, 2016 Group: Members Topic Count: 20 Topics Per Day: 0.01 Content Count: 191 Reputation: 25 Joined: 07/19/14 Last Seen: June 26, 2019 Share Posted December 1, 2016 @Kakaroto you want to add preview item in that script? Quote Link to comment Share on other sites More sharing options...
0 Kakaroto Posted December 3, 2016 Group: Members Topic Count: 99 Topics Per Day: 0.02 Content Count: 638 Reputation: 95 Joined: 05/11/12 Last Seen: Monday at 01:03 PM Author Share Posted December 3, 2016 On 01/12/2016 at 4:19 AM, HappyMan said: @Kakaroto you want to add preview item in that script? Yes! Quote Link to comment Share on other sites More sharing options...
Question
Kakaroto
Hello, does anyone have any vote-point npc based on fluxcp that allows you to view the items before buying them?
I am very grateful to anyone who can help me!
Link to comment
Share on other sites
4 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.