summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-17 12:15:34 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-17 12:15:34 +0300
commit707ccaa19fa60aab91dec2b2394b4ff588e01f4e (patch)
tree43113cef54430fca78bc7a1bd3face9b6dba0e7a
parent0259ea31939be1ec56a47980256d67837158b3f2 (diff)
downloadplugin-707ccaa19fa60aab91dec2b2394b4ff588e01f4e.tar.gz
plugin-707ccaa19fa60aab91dec2b2394b4ff588e01f4e.tar.bz2
plugin-707ccaa19fa60aab91dec2b2394b4ff588e01f4e.tar.xz
plugin-707ccaa19fa60aab91dec2b2394b4ff588e01f4e.zip
Allow "use" pet eggs.
-rw-r--r--src/Makefile.am2
-rw-r--r--src/map/init.c2
-rw-r--r--src/map/itemdb.c28
-rw-r--r--src/map/itemdb.h9
4 files changed, 41 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 1208446..ec78719 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,6 +25,8 @@ LOGIN_SRC = login/config.c \
MAP_SRC = map/clif.c \
map/clif.h \
map/init.c \
+ map/itemdb.c \
+ map/itemdb.h \
map/lang.c \
map/lang.h \
map/npc.c \
diff --git a/src/map/init.c b/src/map/init.c
index f78d4d2..67a36dc 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -35,6 +35,7 @@
#include "common/init.h"
#include "map/clif.h"
+#include "map/itemdb.h"
#include "map/lang.h"
#include "map/npc.h"
#include "map/parse.h"
@@ -109,6 +110,7 @@ HPExport void plugin_init (void)
addHookPre("clif->send", eclif_send);
addHookPre("clif->set_unit_idle", eclif_set_unit_idle);
addHookPre("clif->send_actual", eclif_send_actual);
+ addHookPre("itemdb->is_item_usable", eitemdb_is_item_usable);
addHookPost("clif->getareachar_unit", eclif_getareachar_unit_post);
addHookPost("clif->authok", eclif_authok_post);
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
new file mode 100644
index 0000000..0057a75
--- /dev/null
+++ b/src/map/itemdb.c
@@ -0,0 +1,28 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "../../../common/HPMi.h"
+#include "../../../common/malloc.h"
+#include "../../../common/mmo.h"
+#include "../../../common/socket.h"
+#include "../../../common/strlib.h"
+#include "../../../map/itemdb.h"
+#include "../../../map/map.h"
+#include "../../../map/npc.h"
+#include "../../../map/pc.h"
+
+#include "map/data/mapd.h"
+#include "map/data/npcd.h"
+#include "map/struct/mapdext.h"
+#include "map/struct/npcdext.h"
+#include "map/npc.h"
+
+bool eitemdb_is_item_usable(struct item_data *item)
+{
+ hookStop();
+ return item->type == IT_HEALING || item->type == IT_USABLE || item->type == IT_CASH || item->type == IT_PETEGG;
+}
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
new file mode 100644
index 0000000..5e1faac
--- /dev/null
+++ b/src/map/itemdb.h
@@ -0,0 +1,9 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#ifndef EVOL_MAP_ITEMDB
+#define EVOL_MAP_ITEMDB
+
+bool eitemdb_is_item_usable(struct item_data *item);
+
+#endif // EVOL_MAP_ITEMDB