Skip to content

Commit 25065c4

Browse files
authored
fix: wrap/unwrap owner bug for on use items (opentibiabr#3474)
Items that were "used" and transformed into others lost their store attribute when wrapping/unwrapping and could no longer be moved to the inbox store.
1 parent 124ee9e commit 25065c4

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/game/game.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4612,9 +4612,13 @@ std::shared_ptr<Item> Game::wrapItem(const std::shared_ptr<Item> &item, const st
46124612
}
46134613
uint16_t oldItemID = item->getID();
46144614
auto itemName = item->getName();
4615+
auto attributeStore = item->getAttribute<int64_t>(ItemAttribute_t::STORE);
46154616
std::shared_ptr<Item> newItem = transformItem(item, ITEM_DECORATION_KIT);
4617+
if (attributeStore != 0) {
4618+
newItem->setAttribute(ItemAttribute_t::STORE, attributeStore);
4619+
}
46164620
newItem->setCustomAttribute("unWrapId", static_cast<int64_t>(oldItemID));
4617-
newItem->setAttribute(ItemAttribute_t::DESCRIPTION, "Unwrap it in your own house to create a <" + itemName + ">.");
4621+
newItem->setAttribute(ItemAttribute_t::DESCRIPTION, "You bought this item in the Store.\nUnwrap it in your own house to create a <" + itemName + ">.");
46184622
if (hiddenCharges > 0) {
46194623
newItem->setAttribute(ItemAttribute_t::DATE, hiddenCharges);
46204624
}
@@ -4640,7 +4644,12 @@ void Game::unwrapItem(const std::shared_ptr<Item> &item, uint16_t unWrapId, cons
46404644
if (!amount) {
46414645
amount = 1;
46424646
}
4647+
4648+
auto attributeStore = item->getAttribute<int64_t>(ItemAttribute_t::STORE);
46434649
std::shared_ptr<Item> newItem = transformItem(item, unWrapId, amount);
4650+
if (attributeStore != 0) {
4651+
newItem->setAttribute(ItemAttribute_t::STORE, attributeStore);
4652+
}
46444653
if (house && newiType.isBed()) {
46454654
house->addBed(newItem->getBed());
46464655
}
@@ -10708,7 +10717,7 @@ bool Game::addItemStoreInbox(const std::shared_ptr<Player> &player, uint32_t ite
1070810717
return false;
1070910718
}
1071010719
const ItemType &itemType = Item::items[itemId];
10711-
std::string description = fmt::format("Unwrap it in your own house to create a <{}>.", itemType.name);
10720+
std::string description = fmt::format("You bought this item in the Store.\nUnwrap it in your own house to create a <{}>.", itemType.name);
1071210721
decoKit->setAttribute(ItemAttribute_t::DESCRIPTION, description);
1071310722
decoKit->setCustomAttribute("unWrapId", static_cast<int64_t>(itemId));
1071410723

0 commit comments

Comments
 (0)