summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2017-11-12 02:03:23 +0100
committerHaru <haru@dotalux.com>2017-11-12 02:03:23 +0100
commitb87eb96ad9adfa8fc569841df5aa3fd35e8e1405 (patch)
treefdfdda35d4661753fe06431fc3c646b5c40da5ab /npc
parente52cb33ab5f9900e9c10818a19b49c80c2196f76 (diff)
downloadhercules-b87eb96ad9adfa8fc569841df5aa3fd35e8e1405.tar.gz
hercules-b87eb96ad9adfa8fc569841df5aa3fd35e8e1405.tar.bz2
hercules-b87eb96ad9adfa8fc569841df5aa3fd35e8e1405.tar.xz
hercules-b87eb96ad9adfa8fc569841df5aa3fd35e8e1405.zip
Add F_GetAmmoType global function, counterpart to F_GetWeaponType for ammunitions
Both functions have now been updated to only check the subtype if the item type is correct (IT_AMMO for F_GetAmmoType, IT_WEAPON for F_GetWeaponType) Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'npc')
-rw-r--r--npc/other/Global_Functions.txt25
1 files changed, 25 insertions, 0 deletions
diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt
index cb41abcd7..360fb9e2e 100644
--- a/npc/other/Global_Functions.txt
+++ b/npc/other/Global_Functions.txt
@@ -237,6 +237,9 @@ function script F_Load2Skills {
//== Function F_GetWeaponType ==============================
// Determines weapon type by subtype
function script F_GetWeaponType {
+ if (getiteminfo(getarg(0), ITEMINFO_TYPE) != IT_WEAPON)
+ return "Not a weapon";
+
switch (getiteminfo(getarg(0), ITEMINFO_SUBTYPE)) {
case W_DAGGER: return "Dagger"; break;
case W_1HSWORD: return "One-handed Sword"; break;
@@ -260,11 +263,33 @@ function script F_GetWeaponType {
case W_SHOTGUN: return "Shotgun"; break;
case W_GRENADE: return "Grenade Launcher"; break;
case W_HUUMA: return "Shuriken"; break;
+ case W_2HSTAFF: return "Two-handed Staff"; break;
default: return "Unable to Determine Equip Type"; break;
}
end;
}
+//== Function F_GetAmmoType ================================
+// Determines ammunition type by subtype
+function script F_GetAmmoType {
+ if (getiteminfo(getarg(0), ITEMINFO_TYPE) != IT_AMMO)
+ return "Not an ammunition";
+
+ switch (getiteminfo(getarg(0), ITEMINFO_SUBTYPE)) {
+ case A_ARROW: return "Arrow"; break;
+ case A_DAGGER: return "Throwing Dagger"; break;
+ case A_BULLET: return "Bullet"; break;
+ case A_SHELL: return "Shell"; break;
+ case A_GRENADE: return "Grenade"; break;
+ case A_SHURIKEN: return "Huuma Shuriken"; break;
+ case A_KUNAI: return "Kunai"; break;
+ case A_CANNONBALL: return "Cannon Ball"; break;
+ case A_THROWWEAPON: return "Throwing Weapon"; break;
+ default: return "Unable to Determine Ammunition Type"; break;
+ }
+ end;
+}
+
//== Function F_GetArmorType ===============================
// Determines equipment type by equip location
function script F_GetArmorType {