diff options
author | Haru <haru@dotalux.com> | 2017-11-18 20:05:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-18 20:05:20 +0100 |
commit | 7b2f685d9fa8a2998b424c003d7a1386f76d45db (patch) | |
tree | a5f118370396e8168c5aa84b4fb105951157d35c /npc/other/Global_Functions.txt | |
parent | a63c82c8bd29fd829a5d8cfba7d02d11cf4634c5 (diff) | |
parent | 42248822bf5348c7cbf33efbdf12873bea11ff38 (diff) | |
download | hercules-7b2f685d9fa8a2998b424c003d7a1386f76d45db.tar.gz hercules-7b2f685d9fa8a2998b424c003d7a1386f76d45db.tar.bz2 hercules-7b2f685d9fa8a2998b424c003d7a1386f76d45db.tar.xz hercules-7b2f685d9fa8a2998b424c003d7a1386f76d45db.zip |
Merge pull request #1902 from MishimaHaruna/getiteminfo-fix
getiteminfo() / setiteminfo() fixes
Diffstat (limited to 'npc/other/Global_Functions.txt')
-rw-r--r-- | npc/other/Global_Functions.txt | 171 |
1 files changed, 121 insertions, 50 deletions
diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt index 5a15ff1d2..9882e9d71 100644 --- a/npc/other/Global_Functions.txt +++ b/npc/other/Global_Functions.txt @@ -235,66 +235,137 @@ function script F_Load2Skills { } //== Function F_GetWeaponType ============================== -// Determines weapon type by view +// Determines weapon type by subtype function script F_GetWeaponType { - switch(getiteminfo(getarg(0),11)) { - case 1: return "Dagger"; break; - case 2: return "One-handed Sword"; break; - case 3: return "Two-handed Sword"; break; - case 4: return "One-handed Spear"; break; - case 5: return "Two-handed Spear"; break; - case 6: return "One-handed Axe"; break; - case 7: return "Two-handed Axe"; break; - case 8: return "Mace"; break; - //case 9: return "Unused"; break; - case 10: return "Staff"; break; - case 11: return "Bow"; break; - case 12: return "Knuckle"; break; - case 13: return "Instrument"; break; - case 14: return "Whip"; break; - case 15: return "Book"; break; - case 16: return "Katar"; break; - case 17: return "Revolver"; break; - case 18: return "Rifle"; break; - case 19: return "Gatling gun"; break; - case 20: return "Shotgun"; break; - case 21: return "Grenade Launcher"; break; - case 22: return "Shuriken"; break; + 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; + case W_2HSWORD: return "Two-handed Sword"; break; + case W_1HSPEAR: return "One-handed Spear"; break; + case W_2HSPEAR: return "Two-handed Spear"; break; + case W_1HAXE: return "One-handed Axe"; break; + case W_2HAXE: return "Two-handed Axe"; break; + case W_MACE: return "Mace"; break; + //case W_2HMACE: return "Two-handed Mace"; break; // Unused + case W_STAFF: return "Staff"; break; + case W_BOW: return "Bow"; break; + case W_KNUCKLE: return "Knuckle"; break; + case W_MUSICAL: return "Instrument"; break; + case W_WHIP: return "Whip"; break; + case W_BOOK: return "Book"; break; + case W_KATAR: return "Katar"; break; + case W_REVOLVER: return "Revolver"; break; + case W_RIFLE: return "Rifle"; break; + case W_GATLING: return "Gatling gun"; break; + 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 { - switch(getiteminfo(getarg(0),5)) { - case 1: return "Lower Headgear"; break; - case 2: return callfunc("F_GetWeaponType", getarg(0)); break; - case 4: return "Garment"; break; - case 8: return "Accessory"; break; - case 16: return "Armor"; break; - case 32: return "Shield"; break; - case 64: return "Shoes"; break; - case 128: return "Accessory"; break; - case 136: return "Accessory"; break; - case 256: return "Upper Headgear"; break; - case 512: return "Middle Headgear"; break; - case 1024: return "Costume Upper Headgear"; break; - case 2048: return "Costume Midle Headgear"; break; - case 4096: return "Costume Lower Headgear"; break; - case 8192: return "Costume Garment"; break; - case 32768: return "Ammo"; break; - case 65536: return "Shadow Armor"; break; - case 131072: return "Shadow Weapon"; break; - case 262144: return "Shadow Shield"; break; - case 524288: return "Shadow Shoes"; break; - case 1048576: return "Shadow Accessory"; break; - case 2097152: return "Shadow Accessory"; break; - case 3145728: return "Shadow Accessory"; break; - default: return "Unknown Equip Type"; break; + switch (getiteminfo(getarg(0), ITEMINFO_TYPE)) { + case IT_WEAPON: + return callfunc("F_GetWeaponType", getarg(0)); + case IT_AMMO: + return callfunc("F_GetAmmoType", getarg(0)); + case IT_ARMOR: + break; + default: + return "Unknown Equip Type"; } - end; + + .@loc = getiteminfo(getarg(0), ITEMINFO_LOC); + + if ((.@loc & EQP_HELM) != 0) { + .@name$ = ""; + if ((.@loc & EQP_HEAD_TOP) != 0) { + .@name$ += "Top"; + } + if ((.@loc & EQP_HEAD_MID) != 0) { + if ((.@loc & EQP_HEAD_TOP) != 0) + .@name$ += " + "; + .@name$ += "Middle"; + } + if ((.@loc & EQP_HEAD_LOW) != 0) { + if ((.@loc & (EQP_HEAD_TOP | EQP_HEAD_MID)) != 0) + .@name$ += " + "; + .@name$ += "Lower"; + } + .@name$ += " Headgear"; + return .@name$; + } + if ((.@loc & EQP_GARMENT) != 0) + return "Garment"; + if ((.@loc & EQP_ACC) != 0) + return "Accessory"; + if ((.@loc & EQP_ARMOR) != 0) + return "Armor"; + if ((.@loc & EQP_SHIELD) != 0) + return "Shield"; + if ((.@loc & EQP_SHOES) != 0) + return "Shoes"; + if ((.@loc & EQP_COSTUE_GARMENT) != 0) + return "Costume Garment"; + if ((.@loc & EQP_COSTUME) != 0) { + .@name = "Costume "; + if ((.@loc & EQP_COSTUME_HEAD_TOP) != 0) { + .@name$ += "Top"; + } + if ((.@loc & EQP_COSTUME_HEAD_MID) != 0) { + if ((.@loc & EQP_COSTUME_HEAD_TOP) != 0) + .@name$ += " + "; + .@name$ += "Middle"; + } + if ((.@loc & EQP_COSTUME_HEAD_LOW) != 0) { + if ((.@loc & (EQP_COSTUME_HEAD_TOP | EQP_COSTUME_HEAD_MID)) != 0) + .@name$ += " + "; + .@name$ += "Lower"; + } + .@name$ += " Headgear"; + return .@name$; + } + if ((.@loc & EQP_SHADOW_ARMOR) != 0) + return "Shadow Armor"; + if ((.@loc & EQP_SHADOW_WEAPON) != 0) + return "Shadow Weapon"; + if ((.@loc & EQP_SHADOW_SHIELD) != 0) + return "Shadow Shield"; + if ((.@loc & EQP_SHADOW_SHOES) != 0) + return "Shadow Shoes"; + if ((.@loc & EQP_SHADOW_ACC) != 0) + return "Shadow Accessory"; + + return "Unknown Equip Type"; } //== Function Time2Str ===================================== |