diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-12-19 23:15:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2019-01-14 19:37:28 +0300 |
commit | 14d89f00e32cc2b21c53b66a41d4564fd1a0d3aa (patch) | |
tree | c7f14d25c552acba5fc946bb56bc6642acc5d15e | |
parent | 3685cb9b819f4933de5adce45179238e5c790bba (diff) | |
download | hercules-14d89f00e32cc2b21c53b66a41d4564fd1a0d3aa.tar.gz hercules-14d89f00e32cc2b21c53b66a41d4564fd1a0d3aa.tar.bz2 hercules-14d89f00e32cc2b21c53b66a41d4564fd1a0d3aa.tar.xz hercules-14d89f00e32cc2b21c53b66a41d4564fd1a0d3aa.zip |
Allow load item with big id even if packet version not support this id.
-rw-r--r-- | src/map/itemdb.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index cea7cb10e..03f0fdc06 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1700,7 +1700,12 @@ static int itemdb_validate_entry(struct item_data *entry, int n, const char *sou nullpo_ret(entry); nullpo_ret(source); +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 if (entry->nameid <= 0 || entry->nameid > MAX_ITEM_ID) { +#else + if (entry->nameid <= 0) { +#endif + // item id wrong for any packet versions ShowWarning("itemdb_validate_entry: Invalid item ID %d in entry %d of '%s', allowed values 0 < ID < %d (MAX_ITEM_ID), skipping.\n", entry->nameid, n, source, MAX_ITEM_ID); if (entry->script) { @@ -1716,7 +1721,14 @@ static int itemdb_validate_entry(struct item_data *entry, int n, const char *sou entry->unequip_script = NULL; } return 0; +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 } +#else + } else if (entry->nameid > MAX_ITEM_ID) { + // item id too big for packet version before item id in 4 bytes + entry->view_id = UNKNOWN_ITEM_ID; + } +#endif { const char *c = entry->name; |