summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/elogin/send.c4
-rw-r--r--src/emap/clif.c18
-rw-r--r--src/emap/data/itemd.c2
-rw-r--r--src/emap/itemdb.c26
-rw-r--r--src/emap/map.c19
-rw-r--r--src/emap/struct/itemdext.h2
6 files changed, 60 insertions, 11 deletions
diff --git a/src/elogin/send.c b/src/elogin/send.c
index 9c5762d..ee5ffcb 100644
--- a/src/elogin/send.c
+++ b/src/elogin/send.c
@@ -23,8 +23,8 @@ void send_server_version(int fd)
WFIFOHEAD(fd, 4 + 8);
WFIFOW(fd, 0) = 0x7531;
WFIFOW(fd, 2) = 16;
- WFIFOL(fd, 4) = 0; // unused
- WFIFOL(fd, 8) = 11; // plugin version
+ WFIFOL(fd, 4) = 0; // unused
+ WFIFOL(fd, 8) = 12; // plugin version
WFIFOL(fd, 12) = serverPacketVersion; // server packet version
WFIFOSET(fd, WFIFOW(fd,2));
diff --git a/src/emap/clif.c b/src/emap/clif.c
index 87e65b5..7aaf3d0 100644
--- a/src/emap/clif.c
+++ b/src/emap/clif.c
@@ -28,8 +28,10 @@
#include "emap/map.h"
#include "emap/packets_struct.h"
#include "emap/send.h"
+#include "emap/data/itemd.h"
#include "emap/data/mapd.h"
#include "emap/data/session.h"
+#include "emap/struct/itemdext.h"
#include "emap/struct/mapdext.h"
#include "emap/struct/sessionext.h"
@@ -1118,7 +1120,7 @@ void eclif_getareachar_item(struct map_session_data *sd, struct flooritem_data *
struct SessionExt *data = session_get(fd);
if (!data || data->clientVersion < 10)
return;
- hookStop();
+
WFIFOHEAD(fd, 28);
WFIFOW(fd, 0) = 0xb18;
WFIFOL(fd, 2) = fitem->bl.id;
@@ -1137,6 +1139,7 @@ void eclif_getareachar_item(struct map_session_data *sd, struct flooritem_data *
WFIFOB(fd, 26) = fitem->subx;
WFIFOB(fd, 27) = fitem->suby;
WFIFOSET(fd, 28);
+ hookStop();
}
void eclif_dropflooritem(struct flooritem_data* fitem)
@@ -1144,6 +1147,19 @@ void eclif_dropflooritem(struct flooritem_data* fitem)
char buf[28];
int view;
+ struct ItemdExt *itemData = itemd_get_by_item(&fitem->item_data);
+ if (itemData)
+ {
+ if (itemData->subX)
+ fitem->subx = (rand() % (itemData->subX * 2)) - itemData->subX;
+ else
+ fitem->subx = 0;
+ if (itemData->subY)
+ fitem->suby = (rand() % (itemData->subY * 2)) - itemData->subY;
+ else
+ fitem->suby = 0;
+ }
+
WBUFW(buf, 0) = 0xb19;
WBUFL(buf, 2) = fitem->bl.id;
if((view = itemdb_viewid(fitem->item_data.nameid)) > 0)
diff --git a/src/emap/data/itemd.c b/src/emap/data/itemd.c
index d5bb26b..2a4ba80 100644
--- a/src/emap/data/itemd.c
+++ b/src/emap/data/itemd.c
@@ -72,5 +72,7 @@ struct ItemdExt *itemd_create(void)
data->takeScript = NULL;
data->insertScript = NULL;
memset(&data->allowedCards, 0, sizeof(data->allowedCards));
+ data->subX = 8;
+ data->subY = 8;
return data;
}
diff --git a/src/emap/itemdb.c b/src/emap/itemdb.c
index 63434bf..5fcc86b 100644
--- a/src/emap/itemdb.c
+++ b/src/emap/itemdb.c
@@ -86,6 +86,32 @@ void eitemdb_readdb_additional_fields(int *itemid,
data->requiredSkill = i32;
if (libconfig->setting_lookup_bool(it, "Charm", &i32) && i32 >= 0)
data->charmItem = i32 ? true : false;
+ if ((t = libconfig->setting_get_member(it, "MaxFloorOffset")))
+ {
+ if (config_setting_is_aggregate(t))
+ {
+ data->subX = libconfig->setting_get_int_elem(t, 0);
+ if (libconfig->setting_length(t) >= 2)
+ data->subY = libconfig->setting_get_int_elem(t, 1);
+ else if (libconfig->setting_length(t) >= 1)
+ data->subY = data->subX;
+ }
+ else if (libconfig->setting_lookup_int(it, "MaxFloorOffset", &i32))
+ {
+ data->subX = i32;
+ data->subY = i32;
+ }
+ if (data->subX < 0 || data->subX > 127)
+ {
+ ShowWarning("Field MaxFloorOffsetX for item %s must be in range 0-127\n", item->name);
+ data->subX = 8;
+ }
+ if (data->subY < 0 || data->subY > 127)
+ {
+ ShowWarning("Field MaxFloorOffsetY for item %s must be in range 0-127\n", item->name);
+ data->subY = 8;
+ }
+ }
if (itemdb->lookup_const(it, "UseEffect", &i32))
data->useEffect = i32;
diff --git a/src/emap/map.c b/src/emap/map.c
index 67d279d..e08d31f 100644
--- a/src/emap/map.c
+++ b/src/emap/map.c
@@ -74,15 +74,18 @@ int emap_addflooritem_post(int retVal,
int *flags __attribute__ ((unused)))
{
TBL_ITEM* fitem = (TBL_ITEM*)idb_get(map->id_db, retVal);
- if (fitem && fitem->cleartimer != INVALID_TIMER)
+ if (fitem)
{
- int timeout = battle->bc->flooritem_lifetime;
- struct ItemdExt *data = itemd_get_by_item(item);
- if (data)
- timeout = data->floorLifeTime;
- timer->delete(fitem->cleartimer, map->clearflooritem_timer);
- if (timeout >= 0)
- fitem->cleartimer = timer->add(timer->gettick() + timeout, map->clearflooritem_timer, fitem->bl.id, 0);
+ if (fitem->cleartimer != INVALID_TIMER)
+ {
+ int timeout = battle->bc->flooritem_lifetime;
+ struct ItemdExt *data = itemd_get_by_item(item);
+ if (data)
+ timeout = data->floorLifeTime;
+ timer->delete(fitem->cleartimer, map->clearflooritem_timer);
+ if (timeout >= 0)
+ fitem->cleartimer = timer->add(timer->gettick() + timeout, map->clearflooritem_timer, fitem->bl.id, 0);
+ }
}
return retVal;
}
diff --git a/src/emap/struct/itemdext.h b/src/emap/struct/itemdext.h
index 6ce3017..2ce9e61 100644
--- a/src/emap/struct/itemdext.h
+++ b/src/emap/struct/itemdext.h
@@ -39,6 +39,8 @@ struct ItemdExt
struct script_code *takeScript;
struct script_code *insertScript;
+ int16_t subX;
+ int16_t subY;
bool allowPickup;
bool charmItem;
};