From 9701df54795ff74f23391a259edb29196d0fbd4f Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 23 Jun 2020 01:02:00 -0300 Subject: First sketch of areaharm() --- npc/functions/filters.txt | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'npc/functions/filters.txt') diff --git a/npc/functions/filters.txt b/npc/functions/filters.txt index cec7a15af..f47c16beb 100644 --- a/npc/functions/filters.txt +++ b/npc/functions/filters.txt @@ -62,6 +62,48 @@ function script filter_sameguildorpartynotyou { return ((getcharid(1) > 0 && .@party) || (getcharid(2) > 0 && .@guild)); } +// filter_hostile( id ) +function script filter_hostile { + debugmes "filter_hostile %d", getarg(0); + .@type=getunitdata(getarg(0), UDT_TYPE); + .@chkid=getarg(0); + + debugmes "filter_hostile: Checking %d (BL %d)", getarg(0), .@type; + + // Monsters + if (.@type == BL_MOB) + return true; + + // NPCs + if (.@type == BL_NPC) + return false; + + // Homunculus + if (.@type == BL_HOM) + .@chkid=charid2rid(getunitdata(getarg(0), UDT_MASTERCID)); + + // Pets + if (.@type == BL_PET) + .@chkid=getunitdata(getarg(0), UDT_MASTERAID); + + // Mercenaries + if (.@type == BL_MER) + .@chkid=charid2rid(getunitdata(getarg(0), UDT_MASTERCID)); + + // Elementals + if (.@type == BL_ELEM) + .@chkid=charid2rid(getunitdata(getarg(0), UDT_MASTERCID)); + + debugmes "filter_hostile: Filtering %d (original %d) (BL %d)", .@chkid, getarg(0), .@type; + // Players (and slaves) + return !(filter_sameguildorparty(.@chkid)); +} + +// filter_friendly( id ) +function script filter_friendly { + return !(filter_hostile(.@chkid)); +} + // filter_notboss( id ) function script filter_notboss { // 32 = MD_BOSS -- cgit v1.2.3-60-g2f50