feat(Core/Debug): GetDebugInfo implementation (#12705)
Cherry-pick: https://github.com/TrinityCore/TrinityCore/commit/9a924fb9d557434c5a2e4020c80db6e6bfe466ad Co-authored-by: jackpoz <giacomopoz@gmail.com> Co-authored-by: jackpoz <giacomopoz@gmail.com>
This commit is contained in:
@@ -239,3 +239,10 @@ Item* Bag::GetItemByPos(uint8 slot) const
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string Bag::GetDebugInfo() const
|
||||
{
|
||||
std::stringstream sstr;
|
||||
sstr << Item::GetDebugInfo();
|
||||
return sstr.str();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ public:
|
||||
|
||||
bool Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const* owner) override;
|
||||
|
||||
void Clear();
|
||||
void StoreItem(uint8 slot, Item* pItem, bool update);
|
||||
void RemoveItem(uint8 slot, bool update);
|
||||
|
||||
@@ -58,6 +57,8 @@ public:
|
||||
|
||||
void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const override;
|
||||
|
||||
std::string GetDebugInfo() const override;
|
||||
|
||||
protected:
|
||||
// Bag Storage space
|
||||
Item* m_bagslot[MAX_BAG_SIZE];
|
||||
|
||||
@@ -1097,7 +1097,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, bool clo
|
||||
if (count > pProto->GetMaxStackSize())
|
||||
count = pProto->GetMaxStackSize();
|
||||
|
||||
ASSERT(count != 0 && "pProto->Stackable == 0 but checked at loading already");
|
||||
ASSERT_NODEBUGINFO(count != 0 && "pProto->Stackable == 0 but checked at loading already");
|
||||
|
||||
Item* pItem = NewItemOrBag(pProto);
|
||||
if (pItem->Create(sObjectMgr->GetGenerator<HighGuid::Item>().Generate(), item, player))
|
||||
@@ -1287,3 +1287,13 @@ bool Item::CheckSoulboundTradeExpire()
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string Item::GetDebugInfo() const
|
||||
{
|
||||
std::stringstream sstr;
|
||||
sstr << Object::GetDebugInfo() << "\n"
|
||||
<< std::boolalpha
|
||||
<< "Owner: " << GetOwnerGUID().ToString() << " Count: " << GetCount()
|
||||
<< " BagSlot: " << std::to_string(GetBagSlot()) << " Slot: " << std::to_string(GetSlot()) << " Equipped: " << IsEquipped();
|
||||
return sstr.str();
|
||||
}
|
||||
|
||||
@@ -353,6 +353,8 @@ public:
|
||||
void RemoveFromObjectUpdate() override;
|
||||
|
||||
[[nodiscard]] uint32 GetScriptId() const { return GetTemplate()->ScriptId; }
|
||||
|
||||
std::string GetDebugInfo() const override;
|
||||
private:
|
||||
std::string m_text;
|
||||
uint8 m_slot;
|
||||
|
||||
Reference in New Issue
Block a user