diff options
author | Haru <haru@dotalux.com> | 2017-11-12 01:46:40 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2017-11-12 01:46:40 +0100 |
commit | ab1c84c8586b18ebb194d2f67120df7307399712 (patch) | |
tree | 35dc8320db48da8d26ba7c9aee9bfeef04933f80 /npc/custom/quests | |
parent | 82da003c98d1525b6302cb7c753959a3b3e8c10d (diff) | |
download | hercules-ab1c84c8586b18ebb194d2f67120df7307399712.tar.gz hercules-ab1c84c8586b18ebb194d2f67120df7307399712.tar.bz2 hercules-ab1c84c8586b18ebb194d2f67120df7307399712.tar.xz hercules-ab1c84c8586b18ebb194d2f67120df7307399712.zip |
Add type constants for the getiteminfo()/setiteminfo() buildins
Replacements are as follows:
0 => ITEMINFO_BUYPRICE
1 => ITEMINFO_SELLPRICE
2 => ITEMINFO_TYPE
3 => ITEMINFO_MAXCHANCE
4 => ITEMINFO_SEX
5 => ITEMINFO_LOC
6 => ITEMINFO_WEIGHT
7 => ITEMINFO_ATK
8 => ITEMINFO_DEF
9 => ITEMINFO_RANGE
10 => ITEMINFO_SLOTS
11 (Subtype, for weapons and ammunitions) => ITEMINFO_SUBTYPE
11 (ViewSprite, for other item types) => ITEMINFO_VIEWSPRITE (NOT AVAILABLE YET)
12 => ITEMINFO_ELV
13 => ITEMINFO_WLV
14 => ITEMINFO_VIEWID
15 => ITEMINFO_MATK (NOT AVAILABLE YET - this was documented but never implemented)
Calls to getiteminfo() and setiteminfo() have been replaced with the
newly introduced constants. Other constants (such as W_ weapon subtypes)
in related code have been replaced as well, to improve code readability.
This fixes an issue in the Eden Tutorial script "Tutorial Goal", where
ITEMINFO_ATK was accidentally used instead of ITEMINFO_WEIGHT.
Note: calls to getiteminfo or setiteminfo with numeric type arguments in
third party scripts must be replaced with the respective constants. The
use of numeric literals is no longer recommended, and those values may
change in the future without notice. See the getiteminfo documentation
for details.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'npc/custom/quests')
-rw-r--r-- | npc/custom/quests/quest_shop.txt | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/npc/custom/quests/quest_shop.txt b/npc/custom/quests/quest_shop.txt index 6805220f7..739b53c02 100644 --- a/npc/custom/quests/quest_shop.txt +++ b/npc/custom/quests/quest_shop.txt @@ -121,8 +121,8 @@ OnBuyItem: 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))) + setarray @qe[1], getiteminfo(.@q[0], ITEMINFO_LOC), getiteminfo(.@q[0], ITEMINFO_VIEWSPRITE); + if (@qe[2] > 0 && ((@qe[1] & EQP_HEAD_LOW) || (@qe[1] & EQP_HEAD_TOP) || (@qe[1] & EQP_HEAD_MID) || (@qe[1] & EQP_COSTUME_HEAD_TOP) || (@qe[1] & EQP_COSTUME_HEAD_MID) || (@qe[1] & EQP_COSTUME_HEAD_LOW) || (@qe[1] & EQP_GARMENT) || (@qe[1] & EQP_COSTUME_GARMENT))) set .@preview,1; addtimer 1000, strnpcinfo(NPC_NAME)+"::OnEnd"; while(1) { @@ -135,7 +135,7 @@ OnBuyItem: } 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"; + mes "^FF0000You need "+(((.@q[2] * getiteminfo(.@q[0], ITEMINFO_WEIGHT)) + Weight - MaxWeight) / 10)+" additional weight capacity to complete this trade.^000000"; close; } if (.@q[4]) Zeny -= (.@q[4]*.@q[1]); @@ -198,7 +198,7 @@ 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))+"]"; + case 2: if (getiteminfo(getarg(0), ITEMINFO_TYPE) == IT_WEAPON || getiteminfo(getarg(0), ITEMINFO_TYPE) == IT_ARMOR) return .@s$+" ["+getitemslots(getarg(0))+"]"; default: return .@s$; } } |