From a691c52d01236996087f39487d0aaf267b25753b Mon Sep 17 00:00:00 2001 From: euphyy Date: Mon, 24 Dec 2012 02:56:49 +0000 Subject: * Custom Quest Shop updated to v1.6, which adds support for bulk purchases. * Follow-up r17014, fixed a typo in main.sql -- credits to Jeroen for finding that. * Follow-up r17039, missed a parameter -- thanks, clydelion/mkbu95! git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17040 54d463be-8e91-2dee-dedb-b68131a5f0ec --- npc/custom/quests/quest_shop.txt | 52 +++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'npc/custom/quests/quest_shop.txt') diff --git a/npc/custom/quests/quest_shop.txt b/npc/custom/quests/quest_shop.txt index 7b1ab7db6..a6ae634a7 100644 --- a/npc/custom/quests/quest_shop.txt +++ b/npc/custom/quests/quest_shop.txt @@ -3,7 +3,7 @@ //===== By: ================================================== //= Euphy //===== Current Version: ===================================== -//= 1.5 +//= 1.6 //===== Compatible With: ===================================== //= rAthena SVN r16862+ //===== Description: ========================================= @@ -33,6 +33,7 @@ OnInit: 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. @@ -87,6 +88,7 @@ OnMenu: set .@menu$, .@menu$+.Shops$[@i[.@j]]+":"; set .@i, @i[select(.@menu$)-1]; } + deletearray @i[0],getarraysize(@i); if (.Shops$[.@i] == "") { message strcharinfo(0),"An error has occurred."; end; @@ -97,19 +99,21 @@ OnMenu: end; OnBuyItem: - set .@q[0],@bought_nameid[0]; - copyarray .@q[1],getd(".q_"+.@q[0]+"[0]"),getarraysize(getd(".q_"+.@q[0])); - if (!.@q[1]) { - message strcharinfo(0),"An error has occurred."; + // .@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_"+.@q[0]+"[0]"),getarraysize(getd(".q_"+.@q[0])); + set .@q[2],.@q[1]*.@q[3]; + if (!.@q[2] || .@q[2] > 30000) { + message strcharinfo(0),"You can't purchase that many "+getitemname(.@q[0])+"."; end; } mes "[Quest Shop]"; - mes "Reward: ^0055FF"+((.@q[1]>1)?.@q[1]+"x ":"")+Slot(.@q[0])+"^000000"; + mes "Reward: ^0055FF"+((.@q[2] > 1)?.@q[2]+"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 "+Chk(countitem(.@q[.@i]),.@q[.@i+1])+((.ShowID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+.@q[.@i+1]+")^000000"; + 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 "+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[1] & 1) || (@qe[1] & 256) || (@qe[1] & 512)) && @qe[2] > 0) @@ -123,17 +127,17 @@ OnBuyItem: mes "You're missing one or more quest requirements."; close; } - if (!checkweight(.@q[0],.@q[1])) { + if (!checkweight(.@q[0],.@q[2])) { mes "[Quest Shop]"; - mes "^FF0000You need "+(((.@q[1]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000"; + mes "^FF0000You need "+(((.@q[2]*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 1)?.@q[2]+"x "+getitemname(.@q[0]):A_An(getitemname(.@q[0])))+"!",0; specialeffect2 699; close; case 2: @@ -161,15 +165,15 @@ function Add { 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)."; + for(set .@i,2; .@i