From 4537814684bc50d1154d9f54500c0602303ca862 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 17 Dec 2014 22:30:10 +0300 Subject: Add itemdb plugin structure. --- src/Makefile.am | 3 +++ src/map/data/itemd.c | 41 +++++++++++++++++++++++++++++++++++++++++ src/map/data/itemd.h | 12 ++++++++++++ src/map/struct/itemdext.h | 12 ++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 src/map/data/itemd.c create mode 100644 src/map/data/itemd.h create mode 100644 src/map/struct/itemdext.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index ec78719..3f6c504 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -44,12 +44,15 @@ MAP_SRC = map/clif.c \ map/send.h \ map/status.c \ map/status.h \ + map/data/itemd.c \ + map/data/itemd.h \ map/data/mapd.c \ map/data/mapd.h \ map/data/npcd.c \ map/data/npcd.h \ map/data/session.c \ map/data/session.h \ + map/struct/itemdext.h \ map/struct/mapdext.h \ map/struct/npcdext.h \ map/struct/sessionext.h \ diff --git a/src/map/data/itemd.c b/src/map/data/itemd.c new file mode 100644 index 0000000..a862617 --- /dev/null +++ b/src/map/data/itemd.c @@ -0,0 +1,41 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#include +#include +#include + +#include "../../../common/HPMi.h" +#include "../../../common/malloc.h" +#include "../../../common/mmo.h" +#include "../../../common/socket.h" +#include "../../../common/strlib.h" +#include "../../../map/battle.h" +#include "../../../map/itemdb.h" + +#include "map/data/itemd.h" +#include "map/struct/itemdext.h" + +struct ItemdExt *itemd_get(struct item_data *item) +{ + if (!item) + return NULL; + + struct ItemdExt *data = getFromITEMDATA(item, 0); + if (!data) + { + data = itemd_create(); + addToITEMDATA(item, data, 0, true); + } + return data; +} + +struct ItemdExt *itemd_create(void) +{ + struct ItemdExt *data = NULL; + CREATE(data, struct ItemdExt, 1); + if (!data) + return NULL; + data->floorLifeTime = battle->bc->flooritem_lifetime; + return data; +} diff --git a/src/map/data/itemd.h b/src/map/data/itemd.h new file mode 100644 index 0000000..611d6cd --- /dev/null +++ b/src/map/data/itemd.h @@ -0,0 +1,12 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#ifndef EVOL_MAP_ITEMD +#define EVOL_MAP_ITEMD + +struct ItemdExt; + +struct ItemdExt *itemd_get(struct item_data *item); +struct ItemdExt *itemd_create(void); + +#endif // EVOL_MAP_MAPD diff --git a/src/map/struct/itemdext.h b/src/map/struct/itemdext.h new file mode 100644 index 0000000..837f5bb --- /dev/null +++ b/src/map/struct/itemdext.h @@ -0,0 +1,12 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#ifndef EVOL_MAP_ITEMDEXT +#define EVOL_MAP_ITEMDEXT + +struct ItemdExt +{ + int floorLifeTime; +}; + +#endif // EVOL_MAP_ITEMDEXT -- cgit v1.2.3-70-g09d2