From c287943f22b294bb074411ae3e3d04ce02726841 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 23 Jun 2020 01:09:30 -0300 Subject: Fix a few tiny bugs --- npc/functions/filters.txt | 20 +++++++++----------- npc/functions/mobpoint.txt | 9 ++++++++- 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'npc/functions') diff --git a/npc/functions/filters.txt b/npc/functions/filters.txt index f47c16beb..945ab8bce 100644 --- a/npc/functions/filters.txt +++ b/npc/functions/filters.txt @@ -64,37 +64,35 @@ function script filter_sameguildorpartynotyou { // filter_hostile( id ) function script filter_hostile { - debugmes "filter_hostile %d", getarg(0); - .@type=getunitdata(getarg(0), UDT_TYPE); + //.@type=getunitdata(getarg(0), UDT_TYPE); + .@type=getunittype(getarg(0)); .@chkid=getarg(0); - debugmes "filter_hostile: Checking %d (BL %d)", getarg(0), .@type; - // Monsters - if (.@type == BL_MOB) + if (.@type == UNITTYPE_MOB) return true; // NPCs - if (.@type == BL_NPC) + if (.@type == UNITTYPE_NPC) return false; // Homunculus - if (.@type == BL_HOM) + if (.@type == UNITTYPE_HOM) .@chkid=charid2rid(getunitdata(getarg(0), UDT_MASTERCID)); // Pets - if (.@type == BL_PET) + if (.@type == UNITTYPE_PET) .@chkid=getunitdata(getarg(0), UDT_MASTERAID); // Mercenaries - if (.@type == BL_MER) + if (.@type == UNITTYPE_MER) .@chkid=charid2rid(getunitdata(getarg(0), UDT_MASTERCID)); // Elementals - if (.@type == BL_ELEM) + if (.@type == UNITTYPE_ELEM) .@chkid=charid2rid(getunitdata(getarg(0), UDT_MASTERCID)); - debugmes "filter_hostile: Filtering %d (original %d) (BL %d)", .@chkid, getarg(0), .@type; + //debugmes "filter_hostile: Filtering %d (original %d) (BL %d)", .@chkid, getarg(0), .@type; // Players (and slaves) return !(filter_sameguildorparty(.@chkid)); } diff --git a/npc/functions/mobpoint.txt b/npc/functions/mobpoint.txt index b069dbe27..49d742298 100644 --- a/npc/functions/mobpoint.txt +++ b/npc/functions/mobpoint.txt @@ -13,7 +13,8 @@ function script fix_mobkill { function script mobpoint { if (!MPQUEST) return; - //if (killedrid < 1002) goto L_Return; + if (!killedrid) // A bug! + return; .@moblv=strmobinfo(3,killedrid); // You get MobLv + 20% as MobPoints. @@ -62,6 +63,10 @@ OnNPCKillEvent: JobExp-=1; } + // killedrid was not set, so we skip + if (!killedrid) + return; + // call functions callfunc "mobpoint"; callfunc "mobhunter"; @@ -71,6 +76,8 @@ OnNPCKillEvent: callfunc "Guardhouse_RandQuestCheck"; callfunc "AuroraMobkill"; + // Unset killedrid. This affects multiple calls of this function + // But it is in overall more reliable imao killedrid=0; end; -- cgit v1.2.3-60-g2f50