From b41043d393543cdfae0a6b9503ef2167e72cf4e2 Mon Sep 17 00:00:00 2001 From: Balfear Date: Wed, 31 Mar 2021 02:46:31 +0300 Subject: [PATCH] Fix getnameditem command (#5807) * Fixes #5713. * Resolves script command getnameditem not properly naming items. * Also resolves atcommand getring. Thanks to @Erukanu and @Balferian! Co-authored-by: Lemongrass3110 --- sql-files/upgrades/upgrade_20210331.sql | 4 ++++ src/map/atcommand.cpp | 4 ++-- src/map/script.cpp | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 sql-files/upgrades/upgrade_20210331.sql diff --git a/sql-files/upgrades/upgrade_20210331.sql b/sql-files/upgrades/upgrade_20210331.sql new file mode 100644 index 0000000000..8f4d671be9 --- /dev/null +++ b/sql-files/upgrades/upgrade_20210331.sql @@ -0,0 +1,4 @@ +UPDATE `inventory` SET `card2` = `card2` & 65535 WHERE `card0` = 254 OR `card0` = 255; +UPDATE `cart_inventory` SET `card2` = `card2` & 65535 WHERE `card0` = 254 OR `card0` = 255; +UPDATE `storage` SET `card2` = `card2` & 65535 WHERE `card0` = 254 OR `card0` = 255; +UPDATE `guild_storage` SET `card2` = `card2` & 65535 WHERE `card0` = 254 OR `card0` = 255; diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index 080a740392..9cf116c34a 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -6028,8 +6028,8 @@ void getring (struct map_session_data* sd) item_tmp.nameid = item_id; item_tmp.identify = 1; item_tmp.card[0] = CARD0_FORGE; - item_tmp.card[2] = sd->status.partner_id; - item_tmp.card[3] = sd->status.partner_id >> 16; + item_tmp.card[2] = GetWord(sd->status.partner_id,0); + item_tmp.card[3] = GetWord(sd->status.partner_id,1); if((flag = pc_additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) { clif_additem(sd,0,0,flag); diff --git a/src/map/script.cpp b/src/map/script.cpp index b11726ba5a..e63389242c 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -7834,8 +7834,8 @@ BUILDIN_FUNC(getnameditem) item_tmp.amount=1; item_tmp.identify=1; item_tmp.card[0]=CARD0_CREATE; //we don't use 255! because for example SIGNED WEAPON shouldn't get TOP10 BS Fame bonus [Lupus] - item_tmp.card[2]=tsd->status.char_id; - item_tmp.card[3]=tsd->status.char_id >> 16; + item_tmp.card[2]=GetWord(tsd->status.char_id,0); + item_tmp.card[3]=GetWord(tsd->status.char_id,1); if(pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT)) { script_pushint(st,0); return SCRIPT_CMD_SUCCESS; //Failed to add item, we will not drop if they don't fit