From 50a97b0ef2a8365d87a8a57047caccb0c050c56b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 30 Nov 2014 19:27:14 +0300 Subject: add map flag what prevent from attacking mobs. New map flag: nopve --- src/map/pc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/map/pc.c') diff --git a/src/map/pc.c b/src/map/pc.c index 524c130..fddcdea 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -14,7 +14,9 @@ #include "../../../map/pc.h" #include "map/pc.h" +#include "map/data/mapd.h" #include "map/data/session.h" +#include "map/struct/mapdext.h" #include "map/struct/sessionext.h" int langScriptId; @@ -122,3 +124,21 @@ void epc_unequipitem_pos(struct map_session_data *sd, int *nPtr, int *posPtr) #undef unequipPos #undef unequipPos2 + +bool epc_can_attack (struct map_session_data *sd, int *target_id) +{ + if (!sd) + return false; + + struct MapdExt *data = mapd_get(sd->bl.m); + if (!data) + return true; + if (data->flag.nopve) + { + if (map->id2md(*target_id)) + { + hookStop(); + return false; + } + } +} -- cgit v1.2.3-60-g2f50