summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/init.c1
-rw-r--r--src/map/pc.c20
-rw-r--r--src/map/pc.h2
3 files changed, 23 insertions, 0 deletions
diff --git a/src/map/init.c b/src/map/init.c
index 2757aeb..94e57b0 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -103,6 +103,7 @@ HPExport void plugin_init (void)
addHookPre("pc->equipitem_pos", epc_equipitem_pos);
addHookPre("pc->unequipitem_pos", epc_unequipitem_pos);
addHookPre("pc->can_attack", epc_can_attack);
+ addHookPre("pc->takeitem", epc_takeitem);
addHookPre("npc->parse_unknown_mapflag", enpc_parse_unknown_mapflag);
addHookPre("npc->buysellsel", enpc_buysellsel);
addHookPre("clif->quest_send_list", eclif_quest_send_list);
diff --git a/src/map/pc.c b/src/map/pc.c
index b593682..fba2441 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -14,8 +14,10 @@
#include "../../../map/pc.h"
#include "map/pc.h"
+#include "map/data/itemd.h"
#include "map/data/mapd.h"
#include "map/data/session.h"
+#include "map/struct/itemdext.h"
#include "map/struct/mapdext.h"
#include "map/struct/sessionext.h"
@@ -145,3 +147,21 @@ bool epc_can_attack (struct map_session_data *sd, int *target_id)
}
return true;
}
+
+int epc_takeitem(struct map_session_data *sd __attribute__ ((unused)),
+ struct flooritem_data *fitem)
+{
+ if (!fitem)
+ return 0;
+
+ struct ItemdExt *data = itemd_get_by_item(&fitem->item_data);
+ if (!data)
+ return 1;
+
+ if (!data->allowPickup)
+ {
+ hookStop();
+ return 0;
+ }
+ return 1;
+}
diff --git a/src/map/pc.h b/src/map/pc.h
index ac6d723..cfc37a0 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -19,4 +19,6 @@ void epc_unequipitem_pos(struct map_session_data *sd, int *nPtr, int *posPtr);
bool epc_can_attack (struct map_session_data *sd, int *target_id);
+int epc_takeitem(struct map_session_data *sd, struct flooritem_data *fitem);
+
#endif // EVOL_MAP_PC