From ab1c84c8586b18ebb194d2f67120df7307399712 Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 12 Nov 2017 01:46:40 +0100 Subject: 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 --- npc/custom/itembind.txt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'npc/custom/itembind.txt') diff --git a/npc/custom/itembind.txt b/npc/custom/itembind.txt index 8c51ad24d..7d95afdfc 100644 --- a/npc/custom/itembind.txt +++ b/npc/custom/itembind.txt @@ -35,14 +35,10 @@ prontera,144,174,4 script Bound Items 4_M_JP_MID,{ //Allows equipment (default) or non-rental item if (@inventorylist_bound[.@i] || @inventorylist_expire[.@i]) continue; - if (((.allowbind & 1) && (getiteminfo(@inventorylist_id[.@i], 2) == IT_WEAPON || getiteminfo(@inventorylist_id[.@i], 2) == IT_ARMOR)) || - ((.allowbind & 2) && - (getiteminfo(@inventorylist_id[.@i], 2) == IT_HEALING || getiteminfo(@inventorylist_id[.@i], 2) == IT_USABLE || - getiteminfo(@inventorylist_id[.@i], 2) == IT_DELAYCONSUME || getiteminfo(@inventorylist_id[.@i], 2) == IT_CASH)) || - ((.allowbind & 4) && - (getiteminfo(@inventorylist_id[.@i], 2) == IT_ETC || getiteminfo(@inventorylist_id[.@i], 2) == IT_CARD || - getiteminfo(@inventorylist_id[.@i], 2) == IT_PETEGG || getiteminfo(@inventorylist_id[.@i], 2) == IT_PETARMOR || - getiteminfo(@inventorylist_id[.@i], 2) == IT_AMMO)) + .@itemtype = getiteminfo(@inventorylist_id[.@i], ITEMINFO_TYPE); + if (((.allowbind & 1) != 0 && (.@itemtype == IT_WEAPON || .@itemtype == IT_ARMOR)) + || ((.allowbind & 2) != 0 && (.@itemtype == IT_HEALING || .@itemtype == IT_USABLE || .@itemtype == IT_DELAYCONSUME || .@itemtype == IT_CASH)) + || ((.allowbind & 4) != 0 && (.@itemtype == IT_ETC || .@itemtype == IT_CARD || .@itemtype == IT_PETEGG || .@itemtype == IT_PETARMOR || .@itemtype == IT_AMMO)) ) { set .@bindlist$, .@bindlist$ + ":" + getitemname(@inventorylist_id[.@i]) + " - " + @inventorylist_id[.@i]; set .@bindlist[.@j],.@i; -- cgit v1.2.3-70-g09d2