summaryrefslogtreecommitdiff
path: root/npc/functions/filters.txt
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-06-23 01:02:00 -0300
committerJesusaves <cpntb1@ymail.com>2020-06-23 01:02:00 -0300
commit9701df54795ff74f23391a259edb29196d0fbd4f (patch)
treeb4096af0383bb3b26bc7a97a7b01a619bc64c283 /npc/functions/filters.txt
parentac6c384e7b035378611808e4eb4346659104f4fe (diff)
downloadserverdata-9701df54795ff74f23391a259edb29196d0fbd4f.tar.gz
serverdata-9701df54795ff74f23391a259edb29196d0fbd4f.tar.bz2
serverdata-9701df54795ff74f23391a259edb29196d0fbd4f.tar.xz
serverdata-9701df54795ff74f23391a259edb29196d0fbd4f.zip
First sketch of areaharm()
Diffstat (limited to 'npc/functions/filters.txt')
-rw-r--r--npc/functions/filters.txt42
1 files changed, 42 insertions, 0 deletions
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