summaryrefslogtreecommitdiff
path: root/doc/sample
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2017-11-12 01:46:40 +0100
committerHaru <haru@dotalux.com>2017-11-12 01:46:40 +0100
commitab1c84c8586b18ebb194d2f67120df7307399712 (patch)
tree35dc8320db48da8d26ba7c9aee9bfeef04933f80 /doc/sample
parent82da003c98d1525b6302cb7c753959a3b3e8c10d (diff)
downloadhercules-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 'doc/sample')
-rw-r--r--doc/sample/getiteminfo.txt19
-rw-r--r--doc/sample/npc_test_setitemx.txt11
2 files changed, 21 insertions, 9 deletions
diff --git a/doc/sample/getiteminfo.txt b/doc/sample/getiteminfo.txt
index 89f9a66b5..35dd9e27c 100644
--- a/doc/sample/getiteminfo.txt
+++ b/doc/sample/getiteminfo.txt
@@ -16,8 +16,21 @@ prontera,156,179,6 script test_getiteminfo 4_F_KAFRA1,{
// ^nItemID^XXXX -> Item Name
mes "Item ID: "+.@value+" ^nItemID^"+.@value;
- mes "Current item info:";
- for (.@id = 0; .@id < 14; ++.@id)
- mes " getiteminfo("+.@value+","+.@id+") = "+getiteminfo(.@value,.@id);
+ mes("Current item info:");
+ mesf("Buy Price: %d", getiteminfo(.@value, ITEMINFO_BUYPRICE));
+ mesf("Sell Price: %d", getiteminfo(.@value, ITEMINFO_SELLPRICE));
+ mesf("Type: %d", getiteminfo(.@value, ITEMINFO_TYPE));
+ mesf("Max drop chance: %d.%02d", getiteminfo(.@value, ITEMINFO_MAXCHANCE) / 100, getiteminfo(.@value, ITEMINFO_MAXCHANCE) % 100);
+ mesf("Sex: %d", getiteminfo(.@value, ITEMINFO_SEX));
+ mesf("Equip location: %d", getiteminfo(.@value, ITEMINFO_LOC));
+ mesf("Weight: %d.%d", getiteminfo(.@value, ITEMINFO_WEIGHT) / 10, getiteminfo(.@value, ITEMINFO_WEIGHT) % 10);
+ mesf("Attack: %d", getiteminfo(.@value, ITEMINFO_ATK));
+ mesf("Defense: %d", getiteminfo(.@value, ITEMINFO_DEF));
+ mesf("Range: %d", getiteminfo(.@value, ITEMINFO_RANGE));
+ mesf("Slots: %d", getiteminfo(.@value, ITEMINFO_SLOTS));
+ mesf("Subtype: %d", getiteminfo(.@value, ITEMINFO_SUBTYPE));
+ mesf("Equip Level: %d", getiteminfo(.@value, ITEMINFO_ELV));
+ mesf("Weapon Level: %d", getiteminfo(.@value, ITEMINFO_WLV));
+ mesf("View ID: %d", getiteminfo(.@value, ITEMINFO_VIEWID));
close;
}
diff --git a/doc/sample/npc_test_setitemx.txt b/doc/sample/npc_test_setitemx.txt
index a06f0dc9f..990c09bae 100644
--- a/doc/sample/npc_test_setitemx.txt
+++ b/doc/sample/npc_test_setitemx.txt
@@ -14,15 +14,14 @@ prontera,164,161,5 script Lupus WOLF,{
switch (select("Make Knife[3] Edible", "Make Apple Equippable", "Edible Knife = Full SP", "Knife = Weapon + 3 Notes")) {
case 1:
mes "Ok. We made Knife[3] edible.";
- setiteminfo(Knife, 2, IT_HEALING); //type = 0 : potion
+ setiteminfo(Knife, ITEIMINFO_TYPE, IT_HEALING);
setitemscript(Knife, "{dispbottom \"* You used Knife[3]\";}");
break;
case 2:
mes "Ok. We made Apple equippable.";
- setiteminfo(Apple, 2, IT_ARMOR); //item type -> headgear (type = 5 -> IT_ARMOR)
- setiteminfo(Apple, 5, 512); //where to equip to (equip = 512)
- setiteminfo(Apple, 11, 256); //set as headgear location (loc = 256)
- setiteminfo(Apple, 14, 85); //set Headgear Sprite ID (view id = 85)
+ setiteminfo(Apple, ITEMINFO_TYPE, IT_ARMOR);
+ setiteminfo(Apple, ITEMINFO_LOC, EQP_HEAD_MID); //where to equip to (equip = 512)
+ //setiteminfo(Apple, 14, 85); //set Headgear Sprite ID (view id = 85)
setitemscript(Apple, "{dispbottom \"* Other item's changed\";}", 0);
setitemscript(Apple, "{dispbottom \"* Equipped\";}", 1);
setitemscript(Apple, "{dispbottom \"* Unequipped\";}", 2);
@@ -34,7 +33,7 @@ prontera,164,161,5 script Lupus WOLF,{
break;
case 4:
mes "Ok. We made Knife a weapon, but added 3 notes.";
- setiteminfo(Knife, 2, IT_WEAPON); //type = 4 -> IT_WEAPON
+ setiteminfo(Knife, ITEIMINFO_TYPE, IT_WEAPON);
setitemscript(Knife, "{dispbottom \"* 1 Used\";}", 0);
setitemscript(Knife, "{dispbottom \"* 2 Equipped\";}", 1);
setitemscript(Knife, "{dispbottom \"* 3 Unequipped\";}", 2);