diff options
Diffstat (limited to 'src')
42 files changed, 139 insertions, 162 deletions
diff --git a/src/server/database/Database/Implementation/CharacterDatabase.cpp b/src/server/database/Database/Implementation/CharacterDatabase.cpp index cccd919f6ae..a20984fe09d 100644 --- a/src/server/database/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/database/Database/Implementation/CharacterDatabase.cpp @@ -51,7 +51,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() "cb.guid, cd.genitive FROM characters AS c LEFT JOIN character_pet AS cp ON c.guid = cp.owner AND cp.slot = ? " "LEFT JOIN character_declinedname AS cd ON c.guid = cd.guid LEFT JOIN guild_member AS gm ON c.guid = gm.guid " "LEFT JOIN character_banned AS cb ON c.guid = cb.guid AND cb.active = 1 WHERE c.account = ? AND c.deleteInfos_Name IS NULL ORDER BY c.guid", CONNECTION_ASYNC); - PrepareStatement(CHAR_SEL_FREE_NAME, "SELECT guid, name, at_login FROM characters WHERE guid = ? AND account = ? AND NOT EXISTS (SELECT NULL FROM characters WHERE name = ?)", CONNECTION_ASYNC); + PrepareStatement(CHAR_SEL_FREE_NAME, "SELECT name, at_login FROM characters WHERE guid = ? AND account = ? AND NOT EXISTS (SELECT NULL FROM characters WHERE name = ?)", CONNECTION_ASYNC); PrepareStatement(CHAR_SEL_CHAR_ZONE, "SELECT zone FROM characters WHERE guid = ?", CONNECTION_SYNCH); PrepareStatement(CHAR_SEL_CHARACTER_NAME_DATA, "SELECT race, class, gender, level, name FROM characters WHERE guid = ?", CONNECTION_SYNCH); PrepareStatement(CHAR_SEL_CHAR_POSITION_XYZ, "SELECT map, position_x, position_y, position_z FROM characters WHERE guid = ?", CONNECTION_SYNCH); @@ -141,7 +141,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_UPD_MAIL_ITEM_RECEIVER, "UPDATE mail_items SET receiver = ? WHERE item_guid = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_UPD_ITEM_OWNER, "UPDATE item_instance SET owner_guid = ? WHERE guid = ?", CONNECTION_ASYNC); - PrepareStatement(CHAR_SEL_ITEM_REFUNDS, "SELECT player_guid, paidMoney, paidExtendedCost FROM item_refund_instance WHERE item_guid = ? AND player_guid = ? LIMIT 1", CONNECTION_SYNCH); + PrepareStatement(CHAR_SEL_ITEM_REFUNDS, "SELECT paidMoney, paidExtendedCost FROM item_refund_instance WHERE item_guid = ? AND player_guid = ? LIMIT 1", CONNECTION_SYNCH); PrepareStatement(CHAR_SEL_ITEM_BOP_TRADE, "SELECT allowedPlayers FROM item_soulbound_trade_data WHERE itemGuid = ? LIMIT 1", CONNECTION_SYNCH); PrepareStatement(CHAR_DEL_ITEM_BOP_TRADE, "DELETE FROM item_soulbound_trade_data WHERE itemGuid = ? LIMIT 1", CONNECTION_ASYNC); PrepareStatement(CHAR_INS_ITEM_BOP_TRADE, "INSERT INTO item_soulbound_trade_data VALUES (?, ?)", CONNECTION_ASYNC); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index b41ba344b0c..8c0fbf0bfb7 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -316,7 +316,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u mUseTextTimer = true; sCreatureTextMgr->SendChat(talker, uint8(e.action.talk.textGroupID), talkTarget); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_TALK: talker: {} {}, textGuid: {}", - talker->GetName(), talker->GetGUID().ToString(), talkTarget ? talkTarget->GetGUID().ToString() : "0"); + talker->GetName(), talker->GetGUID().ToString(), talkTarget ? talkTarget->GetGUID().ToString() : "Empty"); break; } case SMART_ACTION_SIMPLE_TALK: diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index bcdfbbc3384..1db1c6d22c3 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -1527,7 +1527,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) return; TC_LOG_INFO("achievement", "AchievementMgr::CompletedAchievement({}). Player: {} {}", - achievement->ID, m_player->GetName(), m_player->GetGUID().ToString()); + achievement->ID, m_player->GetGUID().ToString(), m_player->GetName()); SendAchievementEarned(achievement); CompletedAchievementData& ca = m_completedAchievements[achievement->ID]; diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 62a7ed1c61c..cd3e61a6fcf 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -416,11 +416,10 @@ void AuctionHouseMgr::LoadAuctions() TC_LOG_INFO("server.loading", ">> Loaded {} auctions with {} bidders in {} ms", countAuctions, countBidders, GetMSTimeDiffToNow(oldMSTime)); } -void AuctionHouseMgr::AddAItem(Item* it) +void AuctionHouseMgr::AddAItem(Item* item) { - ASSERT(it); - ASSERT(mAitems.find(it->GetGUID().GetCounter()) == mAitems.end()); - mAitems[it->GetGUID().GetCounter()] = it; + ASSERT(item); + ASSERT_WITH_SIDE_EFFECTS(mAitems.emplace(item->GetGUID().GetCounter(), item).second); } bool AuctionHouseMgr::RemoveAItem(ObjectGuid::LowType id, bool deleteItem /*= false*/, CharacterDatabaseTransaction* trans /*= nullptr*/) @@ -645,7 +644,7 @@ void AuctionHouseObject::Update() continue; ///- Either cancel the auction if there was no bidder - if (auction->bidder == 0 && auction->bid == 0) + if (!auction->bidder && auction->bid == 0) { sAuctionMgr->SendAuctionExpiredMail(auction, trans); sScriptMgr->OnAuctionExpire(this, auction); diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h index dd7bb5d484c..7fd8ec3aeaa 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.h +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h @@ -199,7 +199,7 @@ class TC_GAME_API AuctionHouseMgr void LoadAuctionItems(); void LoadAuctions(); - void AddAItem(Item* it); + void AddAItem(Item* item); bool RemoveAItem(ObjectGuid::LowType id, bool deleteItem = false, CharacterDatabaseTransaction* trans = nullptr); bool PendingAuctionAdd(Player* player, AuctionEntry* aEntry); uint32 PendingAuctionCount(Player const* player) const; diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 614fdc5c66c..80ac0305453 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -913,7 +913,7 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint) TC_LOG_DEBUG("bg.battlefield", "Creating capture point {}", capturePoint->GetEntry()); - m_capturePointGUID = ObjectGuid(HighGuid::GameObject, capturePoint->GetEntry(), capturePoint->GetGUID().GetCounter()); + m_capturePointGUID = capturePoint->GetGUID(); // check info existence GameObjectTemplate const* goinfo = capturePoint->GetGOInfo(); diff --git a/src/server/game/Chat/Hyperlinks.h b/src/server/game/Chat/Hyperlinks.h index 008aec24fde..822b803b764 100644 --- a/src/server/game/Chat/Hyperlinks.h +++ b/src/server/game/Chat/Hyperlinks.h @@ -134,7 +134,7 @@ namespace Trinity::Hyperlinks { if (Optional<uint64> res = Trinity::StringTo<uint64>(data, 16)) { - val.Set(*res); + val.SetRawValue(*res); return true; } else diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 7de1e337139..0d9648ca7e4 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -260,7 +260,6 @@ Item::Item() mb_in_trade = false; m_lastPlayedTimeUpdate = GameTime::GetGameTime(); - m_refundRecipient = 0; m_paidMoney = 0; m_paidExtendedCost = 0; } @@ -327,7 +326,6 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans) if (!isInTransaction) trans = CharacterDatabase.BeginTransaction(); - ObjectGuid::LowType guid = GetGUID().GetCounter(); switch (uState) { case ITEM_NEW: @@ -362,7 +360,7 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans) stmt->setUInt16(++index, GetUInt32Value(ITEM_FIELD_DURABILITY)); stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME)); stmt->setString(++index, m_text); - stmt->setUInt32(++index, guid); + stmt->setUInt32(++index, GetGUID().GetCounter()); trans->Append(stmt); @@ -370,7 +368,7 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GIFT_OWNER); stmt->setUInt32(0, GetOwnerGUID().GetCounter()); - stmt->setUInt32(1, guid); + stmt->setUInt32(1, GetGUID().GetCounter()); trans->Append(stmt); } break; @@ -378,13 +376,13 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans) case ITEM_REMOVED: { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); - stmt->setUInt32(0, guid); + stmt->setUInt32(0, GetGUID().GetCounter()); trans->Append(stmt); if (IsWrapped()) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT); - stmt->setUInt32(0, guid); + stmt->setUInt32(0, GetGUID().GetCounter()); trans->Append(stmt); } @@ -1139,7 +1137,7 @@ void Item::SaveRefundDataToDB() stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_REFUND_INSTANCE); stmt->setUInt32(0, GetGUID().GetCounter()); - stmt->setUInt32(1, GetRefundRecipient()); + stmt->setUInt32(1, GetRefundRecipient().GetCounter()); stmt->setUInt32(2, GetPaidMoney()); stmt->setUInt16(3, uint16(GetPaidExtendedCost())); trans->Append(stmt); @@ -1168,7 +1166,7 @@ void Item::SetNotRefundable(Player* owner, bool changestate /*=true*/, Character if (changestate) SetState(ITEM_CHANGED, owner); - SetRefundRecipient(0); + SetRefundRecipient(ObjectGuid::Empty); SetPaidMoney(0); SetPaidExtendedCost(0); DeleteRefundDataFromDB(trans); diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index 450b052d90b..1b54476ce99 100644 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -183,11 +183,11 @@ class TC_GAME_API Item : public Object // Item Refund system void SetNotRefundable(Player* owner, bool changestate = true, CharacterDatabaseTransaction* trans = nullptr); - void SetRefundRecipient(ObjectGuid::LowType pGuidLow) { m_refundRecipient = pGuidLow; } + void SetRefundRecipient(ObjectGuid const& guid) { m_refundRecipient = guid; } void SetPaidMoney(uint32 money) { m_paidMoney = money; } void SetPaidExtendedCost(uint32 iece) { m_paidExtendedCost = iece; } - uint32 GetRefundRecipient() const { return m_refundRecipient; } + ObjectGuid const& GetRefundRecipient() const { return m_refundRecipient; } uint32 GetPaidMoney() const { return m_paidMoney; } uint32 GetPaidExtendedCost() const { return m_paidExtendedCost; } @@ -216,7 +216,7 @@ class TC_GAME_API Item : public Object int16 uQueuePos; bool mb_in_trade; // true if item is currently in trade-window time_t m_lastPlayedTimeUpdate; - ObjectGuid::LowType m_refundRecipient; + ObjectGuid m_refundRecipient; uint32 m_paidMoney; uint32 m_paidExtendedCost; GuidSet allowedGUIDs; diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 6b02a990fa1..e825af8c4dd 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1101,7 +1101,7 @@ bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool Position const* thisOrTransport = this; Position const* objOrObjTransport = obj; - if (GetTransport() && obj->GetTransport() && obj->GetTransport()->GetGUID().GetCounter() == GetTransport()->GetGUID().GetCounter()) + if (GetTransport() && obj->GetTransport() && obj->GetTransport()->GetGUID() == GetTransport()->GetGUID()) { thisOrTransport = &m_movementInfo.transport.pos; objOrObjTransport = &obj->m_movementInfo.transport.pos; diff --git a/src/server/game/Entities/Object/ObjectGuid.cpp b/src/server/game/Entities/Object/ObjectGuid.cpp index 959be366409..cb0f4e5ab4d 100644 --- a/src/server/game/Entities/Object/ObjectGuid.cpp +++ b/src/server/game/Entities/Object/ObjectGuid.cpp @@ -151,7 +151,7 @@ ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid) ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid) { - guid.Set(buf.read<uint64>()); + guid.SetRawValue(buf.read<uint64>()); return buf; } diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h index e17e4c98a38..4c26d2a87cd 100644 --- a/src/server/game/Entities/Object/ObjectGuid.h +++ b/src/server/game/Entities/Object/ObjectGuid.h @@ -144,18 +144,17 @@ class TC_GAME_API ObjectGuid ObjectGuid(HighGuid hi, uint32 entry, LowType counter) : _guid(counter ? uint64(counter) | (uint64(entry) << 24) | (uint64(hi) << 48) : 0) { } ObjectGuid(HighGuid hi, LowType counter) : _guid(counter ? uint64(counter) | (uint64(hi) << 48) : 0) { } - operator uint64() const { return _guid; } PackedGuidReader ReadAsPacked() { return PackedGuidReader(*this); } - void Set(uint64 guid) { _guid = guid; } + uint64 GetRawValue() const { return _guid; } + void SetRawValue(uint64 guid) { _guid = guid; } void Clear() { _guid = 0; } PackedGuidWriter WriteAsPacked() const { return PackedGuidWriter(*this); } - uint64 GetRawValue() const { return _guid; } HighGuid GetHigh() const { return HighGuid((_guid >> 48) & 0x0000FFFF); } - uint32 GetEntry() const { return HasEntry() ? uint32((_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; } - LowType GetCounter() const + uint32 GetEntry() const { return HasEntry() ? uint32((_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; } + LowType GetCounter() const { return HasEntry() ? LowType(_guid & UI64LIT(0x0000000000FFFFFF)) @@ -169,7 +168,7 @@ class TC_GAME_API ObjectGuid : LowType(0xFFFFFFFF); } - ObjectGuid::LowType GetMaxCounter() const { return GetMaxCounter(GetHigh()); } + LowType GetMaxCounter() const { return GetMaxCounter(GetHigh()); } bool IsEmpty() const { return _guid == 0; } bool IsCreature() const { return GetHigh() == HighGuid::Unit; } @@ -263,7 +262,7 @@ using GuidList = std::list<ObjectGuid>; using GuidVector = std::vector<ObjectGuid>; using GuidUnorderedSet = std::unordered_set<ObjectGuid>; -// minimum buffer size for packed guid is 9 bytes +// maximum buffer size for packed guid is 9 bytes #define PACKED_GUID_MIN_BUFFER_SIZE 9 class TC_GAME_API PackedGuid @@ -307,18 +306,14 @@ TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid); TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, PackedGuidWriter const& guid); TC_GAME_API ByteBuffer& operator>>(ByteBuffer& buf, PackedGuidReader const& guid); -namespace std +template<> +struct std::hash<ObjectGuid> { - template<> - struct hash<ObjectGuid> + size_t operator()(ObjectGuid const& key) const noexcept { - public: - size_t operator()(ObjectGuid const& key) const - { - return std::hash<uint64>()(key.GetRawValue()); - } - }; -} + return std::hash<uint64>()(key.GetRawValue()); + } +}; namespace fmt { diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 8430845acd8..348b6c9d487 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -17824,6 +17824,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff) maxDuration, remainTime, remainCharges, critChance, applyResilience FROM character_aura WHERE guid = '{}'", GetGUID().GetCounter()); */ + ObjectGuid casterGuid, itemGuid; if (result) { do @@ -17831,8 +17832,8 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff) Field* fields = result->Fetch(); int32 damage[3]; int32 baseDamage[3]; - ObjectGuid caster_guid(fields[0].GetUInt64()); - ObjectGuid itemGuid(fields[1].GetUInt64()); + casterGuid.SetRawValue(fields[0].GetUInt64()); + itemGuid.SetRawValue(fields[1].GetUInt64()); uint32 spellid = fields[2].GetUInt32(); uint8 effmask = fields[3].GetUInt8(); uint8 recalculatemask = fields[4].GetUInt8(); @@ -17881,7 +17882,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff) AuraCreateInfo createInfo(spellInfo, effmask, this); createInfo - .SetCasterGUID(caster_guid) + .SetCasterGUID(casterGuid) .SetCastItemGUID(itemGuid) .SetBaseAmount(baseDamage); @@ -18131,8 +18132,8 @@ Item* Player::_LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint3 stmt->setUInt32(1, GetGUID().GetCounter()); if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) { - item->SetRefundRecipient((*result)[0].GetUInt32()); - item->SetPaidMoney((*result)[1].GetUInt32()); + item->SetRefundRecipient(GetGUID()); + item->SetPaidMoney((*result)[0].GetUInt32()); item->SetPaidExtendedCost((*result)[2].GetUInt16()); AddRefundReference(item->GetGUID()); } @@ -19632,7 +19633,6 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans) if (m_itemUpdateQueue.empty()) return; - ObjectGuid::LowType lowGuid = GetGUID().GetCounter(); for (size_t i = 0; i < m_itemUpdateQueue.size(); ++i) { Item* item = m_itemUpdateQueue[i]; @@ -19640,8 +19640,6 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans) continue; Bag* container = item->GetContainer(); - ObjectGuid::LowType bag_guid = container ? container->GetGUID().GetCounter() : 0; - if (item->GetState() != ITEM_REMOVED) { Item* test = GetItemByPos(item->GetBagSlot(), item->GetSlot()); @@ -19657,7 +19655,7 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans) stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT); stmt->setUInt32(0, bagTestGUID); stmt->setUInt8(1, item->GetSlot()); - stmt->setUInt32(2, lowGuid); + stmt->setUInt32(2, GetGUID().GetCounter()); trans->Append(stmt); RemoveTradeableItem(item); @@ -19687,8 +19685,8 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans) case ITEM_NEW: case ITEM_CHANGED: stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_INVENTORY_ITEM); - stmt->setUInt32(0, lowGuid); - stmt->setUInt32(1, bag_guid); + stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt32(1, container ? container->GetGUID().GetCounter() : 0); stmt->setUInt8 (2, item->GetSlot()); stmt->setUInt32(3, item->GetGUID().GetCounter()); trans->Append(stmt); @@ -21547,7 +21545,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c if (pProto->HasFlag(ITEM_FLAG_ITEM_PURCHASE_RECORD) && crItem->ExtendedCost && pProto->GetMaxStackSize() == 1) { it->SetFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE); - it->SetRefundRecipient(GetGUID().GetCounter()); + it->SetRefundRecipient(GetGUID()); it->SetPaidMoney(price); it->SetPaidExtendedCost(crItem->ExtendedCost); it->SaveRefundDataToDB(); @@ -24757,8 +24755,7 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot) InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item->itemid, item->count); if (msg == EQUIP_ERR_OK) { - GuidSet looters = item->GetAllowedLooters(); - Item* newitem = StoreNewItem(dest, item->itemid, true, item->randomPropertyId, looters); + Item* newitem = StoreNewItem(dest, item->itemid, true, item->randomPropertyId, item->GetAllowedLooters()); if (qitem) { @@ -26166,7 +26163,7 @@ void Player::SendRefundInfo(Item* item) return; } - if (GetGUID().GetCounter() != item->GetRefundRecipient()) // Formerly refundable item got traded + if (GetGUID() != item->GetRefundRecipient()) // Formerly refundable item got traded { TC_LOG_DEBUG("entities.player.items", "Item refund: item was traded!"); item->SetNotRefundable(this); @@ -26261,7 +26258,7 @@ void Player::RefundItem(Item* item) return; } - if (GetGUID().GetCounter() != item->GetRefundRecipient()) // Formerly refundable item got traded + if (GetGUID() != item->GetRefundRecipient()) // Formerly refundable item got traded { TC_LOG_DEBUG("entities.player.items", "Item refund: item was traded!"); item->SetNotRefundable(this); diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index a8815c3ab7a..0dd8860bf58 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -328,7 +328,7 @@ Creature* Transport::CreateNPCPassenger(ObjectGuid::LowType guid, CreatureData c if (!creature->IsPositionValid()) { - TC_LOG_ERROR("entities.transport", "Creature {} not created. Suggested coordinates aren't valid (X: {} Y: {})", creature->GetGUID().ToString(), creature->GetPositionX(), creature->GetPositionY()); + TC_LOG_ERROR("entities.transport", "Passenger {} not created. Suggested coordinates aren't valid (X: {} Y: {})", creature->GetGUID().ToString(), creature->GetPositionX(), creature->GetPositionY()); delete creature; return nullptr; } @@ -372,7 +372,7 @@ GameObject* Transport::CreateGOPassenger(ObjectGuid::LowType guid, GameObjectDat if (!go->IsPositionValid()) { - TC_LOG_ERROR("entities.transport", "GameObject {} not created. Suggested coordinates aren't valid (X: {} Y: {})", go->GetGUID().ToString(), go->GetPositionX(), go->GetPositionY()); + TC_LOG_ERROR("entities.transport", "Passenger {} not created. Suggested coordinates aren't valid (X: {} Y: {})", go->GetGUID().ToString(), go->GetPositionX(), go->GetPositionY()); delete go; return nullptr; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 0955dceda53..acf02eabc03 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2109,12 +2109,8 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extr DamageInfo dmgInfo(damageInfo); Unit::ProcSkillsAndAuras(damageInfo.Attacker, damageInfo.Target, damageInfo.ProcAttacker, damageInfo.ProcVictim, PROC_SPELL_TYPE_NONE, PROC_SPELL_PHASE_NONE, dmgInfo.GetHitMask(), nullptr, &dmgInfo, nullptr); - if (GetTypeId() == TYPEID_PLAYER) - TC_LOG_DEBUG("entities.unit", "AttackerStateUpdate: (Player) {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.", - GetGUID().ToString(), victim->GetGUID().ToString(), dmgInfo.GetDamage(), dmgInfo.GetAbsorb(), dmgInfo.GetBlock(), dmgInfo.GetResist()); - else - TC_LOG_DEBUG("entities.unit", "AttackerStateUpdate: (NPC) {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.", - GetGUID().ToString(), victim->GetGUID().ToString(), dmgInfo.GetDamage(), dmgInfo.GetAbsorb(), dmgInfo.GetBlock(), dmgInfo.GetResist()); + TC_LOG_DEBUG("entities.unit", "AttackerStateUpdate: {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.", + GetGUID().ToString(), victim->GetGUID().ToString(), dmgInfo.GetDamage(), dmgInfo.GetAbsorb(), dmgInfo.GetBlock(), dmgInfo.GetResist()); } } diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 4011703c7c2..14ec0f18a8d 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -110,8 +110,8 @@ void Vehicle::Uninstall() /// @Prevent recursive uninstall call. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.) if (_status == STATUS_UNINSTALLING && !GetBase()->HasUnitTypeMask(UNIT_MASK_MINION)) { - TC_LOG_ERROR("entities.vehicle", "Vehicle {} attempts to uninstall, but already has STATUS_UNINSTALLING! " - "Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUID().ToString()); + TC_LOG_ERROR("entities.vehicle", "Vehicle {} Entry: {} attempts to uninstall, but already has STATUS_UNINSTALLING! " + "Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUID().ToString(), _creatureEntry); return; } diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index d450c0d5eca..6dad196c884 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -234,7 +234,7 @@ void Group::LoadGroupFromDB(Field* fields) m_lootThreshold = ItemQualities(fields[3].GetUInt8()); for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i) - m_targetIcons[i].Set(fields[4 + i].GetUInt64()); + m_targetIcons[i].SetRawValue(fields[4 + i].GetUInt64()); m_groupType = GroupType(fields[12].GetUInt8()); if (m_groupType & GROUPTYPE_RAID) diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 9aaac264425..f26b4fc75a8 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -938,8 +938,8 @@ void Guild::BankMoveItemData::LogAction(MoveItemData* pFrom) const if (!pFrom->IsBank() && m_pPlayer->GetSession()->HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE)) /// @todo Move this to scripts { sLog->OutCommand(m_pPlayer->GetSession()->GetAccountId(), - "GM {} (Guid: {}) (Account: {}) deposit item: {} (Entry: {} Count: {}) to guild bank named: {} (Guild ID: {})", - m_pPlayer->GetName(), m_pPlayer->GetGUID().GetCounter(), m_pPlayer->GetSession()->GetAccountId(), + "GM {} ({}) (Account: {}) deposit item: {} (Entry: {} Count: {}) to guild bank named: {} (Guild ID: {})", + m_pPlayer->GetName(), m_pPlayer->GetGUID().ToString(), m_pPlayer->GetSession()->GetAccountId(), pFrom->GetItem()->GetTemplate()->Name1, pFrom->GetItem()->GetEntry(), pFrom->GetItem()->GetCount(), m_pGuild->GetName(), m_pGuild->GetId()); } diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 399e94e0ed8..1880194278d 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -339,8 +339,9 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) AH->auctionHouseEntry = auctionHouseEntry; AH->Flags = AUCTION_ENTRY_FLAG_NONE; - TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player {} {} is selling item {} entry {} {} with count {} with initial bid {} with buyout {} and with time {} (in sec) in auctionhouse {}", - _player->GetName(), _player->GetGUID().ToString(), item->GetTemplate()->Name1, item->GetEntry(), item->GetGUID().ToString(), item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); + TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: {} {} is selling item {} {} to auctioneer {} with count {} with initial bid {} with buyout {} and with time {} (in sec) in auctionhouse {}", + _player->GetGUID().ToString(), _player->GetName(), item->GetGUID().ToString(), item->GetTemplate()->Name1, + creature->GetGUID().ToString(), item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); // Add to pending auctions, or fail with insufficient funds error if (!sAuctionMgr->PendingAuctionAdd(_player, AH)) @@ -397,8 +398,9 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) AH->auctionHouseEntry = auctionHouseEntry; AH->Flags = AUCTION_ENTRY_FLAG_NONE; - TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player {} {} is selling item {} entry {} {} with count {} with initial bid {} with buyout {} and with time {} (in sec) in auctionhouse {}", - _player->GetName(), _player->GetGUID().ToString(), newItem->GetTemplate()->Name1, newItem->GetEntry(), newItem->GetGUID().ToString(), newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); + TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: {} {} is selling item {} {} to auctioneer {} with count {} with initial bid {} with buyout {} and with time {} (in sec) in auctionhouse {}", + _player->GetGUID().ToString(), _player->GetName(), newItem->GetGUID().ToString(), newItem->GetTemplate()->Name1, + creature->GetGUID().ToString(), newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); // Add to pending auctions, or fail with insufficient funds error if (!sAuctionMgr->PendingAuctionAdd(_player, AH)) @@ -520,7 +522,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData) if (price < auction->buyout || auction->buyout == 0) { - if (auction->bidder > 0) + if (auction->bidder) { if (auction->bidder == player->GetGUID().GetCounter()) player->ModifyMoney(-int32(price - auction->bid)); @@ -630,7 +632,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) Item* pItem = sAuctionMgr->GetAItem(auction->itemGUIDLow); if (pItem) { - if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid + if (auction->bidder) // If we have a bidder, we have to send him the money he paid { uint32 auctionCut = auction->GetAuctionCut(); if (!player->HasEnoughMoney(auctionCut)) //player doesn't have enough money, maybe message needed diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 4067b3acc29..660808f8c4d 100644 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -67,7 +67,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPackets::Battleground::Batt bool isPremade = false; if (!sBattlemasterListStore.LookupEntry(battlemasterJoin.BattlemasterListID)) { - TC_LOG_ERROR("network", "Battleground: invalid bgtype ({}) received. possible cheater? player {}", battlemasterJoin.BattlemasterListID, _player->GetGUID().ToString()); + TC_LOG_ERROR("network", "Battleground: invalid bgtype ({}) received. possible cheater? {}", battlemasterJoin.BattlemasterListID, _player->GetGUID().ToString()); return; } diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 0dc557b8844..cca9216a4af 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1149,9 +1149,8 @@ void WorldSession::HandleCharRenameCallBack(std::shared_ptr<CharacterRenameInfo> Field* fields = result->Fetch(); - ObjectGuid::LowType guidLow = fields[0].GetUInt32(); - std::string oldName = fields[1].GetString(); - uint16 atLoginFlags = fields[2].GetUInt16(); + std::string oldName = fields[0].GetString(); + uint16 atLoginFlags = fields[1].GetUInt16(); if (!(atLoginFlags & AT_LOGIN_RENAME)) { @@ -1168,14 +1167,14 @@ void WorldSession::HandleCharRenameCallBack(std::shared_ptr<CharacterRenameInfo> stmt->setString(0, renameInfo->Name); stmt->setUInt16(1, atLoginFlags); - stmt->setUInt32(2, guidLow); + stmt->setUInt32(2, renameInfo->Guid.GetCounter()); CharacterDatabase.Execute(stmt); // Removed declined name from db stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME); - stmt->setUInt32(0, guidLow); + stmt->setUInt32(0, renameInfo->Guid.GetCounter()); CharacterDatabase.Execute(stmt); diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index ef38b1edef0..ef7e8ac4bf7 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -128,8 +128,8 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) } break; default: - TC_LOG_ERROR("network", "Player {}{} sent a chatmessage with an invalid language/message type combination", - GetPlayer()->GetName(), GetPlayer()->GetGUID().ToString()); + TC_LOG_ERROR("network", "Player {} {} sent a chatmessage with an invalid language/message type combination", + GetPlayer()->GetName(), GetPlayer()->GetGUID().ToString()); recvData.rfinish(); return; diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index c3f12dce104..73ae6746f4d 100644 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -468,11 +468,8 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) return; } - // list of players allowed to receive this item in trade - GuidSet looters = item.GetAllowedLooters(); - // now move item from loot to target inventory - Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomPropertyId, looters); + Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomPropertyId, item.GetAllowedLooters()); target->SendNewItem(newitem, uint32(item.count), false, false, true); target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count); target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item.count); diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index 16a4df4dc0b..b6cb6a510aa 100644 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -245,8 +245,8 @@ void WorldSession::HandleSendMail(WorldPackets::Mail::SendMail& sendMail) { if (log) { - sLog->OutCommand(GetAccountId(), "GM {} (GUID: {}) (Account: {}) mail item: {} (Entry: {} Count: {}) " - "to: {} ({}) (Account: {})", GetPlayerName(), GetGUIDLow(), GetAccountId(), + sLog->OutCommand(GetAccountId(), "GM {} ({}) (Account: {}) mail item: {} (Entry: {} Count: {}) " + "to: {} ({}) (Account: {})", GetPlayerName(), _player->GetGUID().ToString(), GetAccountId(), item->GetTemplate()->Name1, item->GetEntry(), item->GetCount(), mailInfo.Target, receiverGuid.ToString(), receiverAccountId); } @@ -268,8 +268,8 @@ void WorldSession::HandleSendMail(WorldPackets::Mail::SendMail& sendMail) if (log && mailInfo.SendMoney > 0) { - sLog->OutCommand(GetAccountId(), "GM {} (GUID: {}) (Account: {}) mail money: {} to: {} ({}) (Account: {})", - GetPlayerName(), GetGUIDLow(), GetAccountId(), mailInfo.SendMoney, mailInfo.Target, receiverGuid.ToString(), receiverAccountId); + sLog->OutCommand(GetAccountId(), "GM {} ({}) (Account: {}) mail money: {} to: {} ({}) (Account: {})", + GetPlayerName(), _player->GetGUID().ToString(), GetAccountId(), mailInfo.SendMoney, mailInfo.Target, receiverGuid.ToString(), receiverAccountId); } } diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp index 0785f7af5fd..f2464b1c7f7 100644 --- a/src/server/game/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Handlers/PetitionsHandler.cpp @@ -400,8 +400,7 @@ void WorldSession::HandleSignPetition(WorldPacket& recvData) CharterTypes type = petition->PetitionType; uint8 signs = uint8(petition->Signatures.size()); - ObjectGuid playerGuid = _player->GetGUID(); - if (ownerGuid == playerGuid) + if (ownerGuid == _player->GetGUID()) return; // not let enemies sign guild charter @@ -475,9 +474,9 @@ void WorldSession::HandleSignPetition(WorldPacket& recvData) } // fill petition store - petition->AddSignature(GetAccountId(), playerGuid, false); + petition->AddSignature(GetAccountId(), _player->GetGUID(), false); - TC_LOG_DEBUG("network", "PETITION SIGN: {} by player: {} ({} Account: {})", petitionGuid.ToString(), _player->GetName(), playerGuid.ToString(), GetAccountId()); + TC_LOG_DEBUG("network", "PETITION SIGN: {} by player: {} ({} Account: {})", petitionGuid.ToString(), _player->GetName(), _player->GetGUID().ToString(), GetAccountId()); WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4)); data << petitionGuid; diff --git a/src/server/game/Handlers/SocialHandler.cpp b/src/server/game/Handlers/SocialHandler.cpp index 36c8200f97a..7a7dca880d0 100644 --- a/src/server/game/Handlers/SocialHandler.cpp +++ b/src/server/game/Handlers/SocialHandler.cpp @@ -59,7 +59,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket& recvData) team = Player::TeamForRace(friendCharacterInfo->Race), friendNote = std::move(friendNote)]() { - if (playerGuid.GetCounter() != GetGUIDLow()) + if (playerGuid.GetCounter() != m_GUIDLow) return; // not the player initiating request, do nothing FriendsResult friendResult = FRIEND_NOT_FOUND; diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp index c2e3cc78dc9..dbc688d2e99 100644 --- a/src/server/game/Handlers/VehicleHandler.cpp +++ b/src/server/game/Handlers/VehicleHandler.cpp @@ -200,7 +200,7 @@ void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/) GetPlayer()->ExitVehicle(); else TC_LOG_ERROR("network", "Player {} tried to exit vehicle, but seatflags {} (ID: {}) don't permit that.", - GetPlayer()->GetGUID().ToString(), seat->ID, seat->Flags); + GetPlayer()->GetGUID().ToString(), seat->ID, seat->Flags); } } } diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp index dc509e28a41..c580d794426 100644 --- a/src/server/game/Mails/Mail.cpp +++ b/src/server/game/Mails/Mail.cpp @@ -89,7 +89,8 @@ MailReceiver::MailReceiver(Player* receiver, ObjectGuid::LowType receiver_lowgui MailDraft& MailDraft::AddItem(Item* item) { - m_items[item->GetGUID().GetCounter()] = item; return *this; + m_items[item->GetGUID().GetCounter()] = item; + return *this; } void MailDraft::prepareItems(Player* receiver, CharacterDatabaseTransaction trans) diff --git a/src/server/game/Maps/MapScripts.cpp b/src/server/game/Maps/MapScripts.cpp index d8bb33c74bf..d3e59b42dd7 100644 --- a/src/server/game/Maps/MapScripts.cpp +++ b/src/server/game/Maps/MapScripts.cpp @@ -113,10 +113,10 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe player = source->ToPlayer(); if (!player) - TC_LOG_ERROR("scripts", "{} neither source nor target object is player (source: TypeId: {}, Entry: {}, GUID: {}; target: TypeId: {}, Entry: {}, GUID: {}), skipping.", + TC_LOG_ERROR("scripts", "{} neither source nor target object is player (source: TypeId: {}, Entry: {}, {}; target: TypeId: {}, Entry: {}, {}), skipping.", scriptInfo->GetDebugInfo().c_str(), - source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUID().GetCounter() : 0, - target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUID().GetCounter() : 0); + source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, (source ? source->GetGUID() : ObjectGuid::Empty).ToString().c_str(), + target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, (target ? target->GetGUID() : ObjectGuid::Empty).ToString().c_str()); } return player; } @@ -146,10 +146,10 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t } if (!creature) - TC_LOG_ERROR("scripts", "{} neither source nor target are creatures (source: TypeId: {}, Entry: {}, GUID: {}; target: TypeId: {}, Entry: {}, GUID: {}), skipping.", + TC_LOG_ERROR("scripts", "{} neither source nor target are creatures (source: TypeId: {}, Entry: {}, {}; target: TypeId: {}, Entry: {}, {}), skipping.", scriptInfo->GetDebugInfo().c_str(), - source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUID().GetCounter() : 0, - target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUID().GetCounter() : 0); + source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, (source ? source->GetGUID() : ObjectGuid::Empty).ToString().c_str(), + target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, (target ? target->GetGUID() : ObjectGuid::Empty).ToString().c_str()); } return creature; } @@ -179,10 +179,10 @@ inline GameObject* Map::_GetScriptGameObjectSourceOrTarget(Object* source, Objec } if (!gameobject) - TC_LOG_ERROR("scripts", "{} neither source nor target are gameobjects (source: TypeId: {}, Entry: {}, GUID: {}; target: TypeId: {}, Entry: {}, GUID: {}), skipping.", + TC_LOG_ERROR("scripts", "{} neither source nor target are gameobjects (source: TypeId: {}, Entry: {}, {}; target: TypeId: {}, Entry: {}, {}), skipping.", scriptInfo->GetDebugInfo().c_str(), - source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUID().GetCounter() : 0, - target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUID().GetCounter() : 0); + source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, (source ? source->GetGUID() : ObjectGuid::Empty).ToString().c_str(), + target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, (target ? target->GetGUID() : ObjectGuid::Empty).ToString().c_str()); } return gameobject; } @@ -340,8 +340,8 @@ void Map::ScriptsProcess() case HighGuid::Player: source = GetPlayer(step.sourceGUID); break; - case HighGuid::Transport: case HighGuid::GameObject: + case HighGuid::Transport: source = GetGameObject(step.sourceGUID); break; case HighGuid::Corpse: @@ -369,11 +369,11 @@ void Map::ScriptsProcess() case HighGuid::Pet: target = GetPet(step.targetGUID); break; - case HighGuid::Player: // empty GUID case also + case HighGuid::Player: target = GetPlayer(step.targetGUID); break; - case HighGuid::Transport: case HighGuid::GameObject: + case HighGuid::Transport: target = GetGameObject(step.targetGUID); break; case HighGuid::Corpse: @@ -826,6 +826,7 @@ void Map::ScriptsProcess() { return pair.second->IsAlive(); }); + cTarget = creatureItr != creatureBounds.second ? creatureItr->second : creatureBounds.first->second; } diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index 10819b81da2..6df094cc66a 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -345,7 +345,7 @@ std::string MoveSpline::ToString() const if (splineflags.final_angle) str << "facing angle: " << facing.angle << std::endl; else if (splineflags.final_target) - str << "facing target: " << facing.target << std::endl; + str << "facing target: " << facing.target.ToString() << std::endl; else if (splineflags.final_point) str << "facing point: " << facing.f.x << " " << facing.f.y << " " << facing.f.z << std::endl; str << "time passed: " << time_passed << std::endl; diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index f61d7391bbb..64842921fe9 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -218,7 +218,7 @@ namespace Movement void MoveSplineInit::SetFacing(ObjectGuid const& target) { args.flags.EnableFacingTarget(); - args.facing.target = target.GetRawValue(); + args.facing.target = target; } void MoveSplineInit::SetFacing(float angle) diff --git a/src/server/game/Movement/Spline/MoveSplineInitArgs.h b/src/server/game/Movement/Spline/MoveSplineInitArgs.h index dbb715c19b6..42682adffdd 100644 --- a/src/server/game/Movement/Spline/MoveSplineInitArgs.h +++ b/src/server/game/Movement/Spline/MoveSplineInitArgs.h @@ -19,6 +19,7 @@ #define TRINITYSERVER_MOVESPLINEINIT_ARGS_H #include "MoveSplineFlag.h" +#include "ObjectGuid.h" #include <vector> class Unit; @@ -32,11 +33,11 @@ namespace Movement struct { float x, y, z; } f; - uint64 target; + ObjectGuid target; float angle; FacingInfo(float o) : angle(o) { } - FacingInfo(uint64 t) : target(t) { } + FacingInfo(ObjectGuid t) : target(t) { } FacingInfo() { } }; diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index ff65e7f8c2b..7adf4ccbacb 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -198,12 +198,6 @@ std::string WorldSession::GetPlayerInfo() const return Trinity::StringFormat("[Player: Account: {}]", GetAccountId()); } -/// Get player guid if available. Use for logging purposes only -ObjectGuid::LowType WorldSession::GetGUIDLow() const -{ - return GetPlayer() ? GetPlayer()->GetGUID().GetCounter() : 0; -} - /// Send a packet to the client void WorldSession::SendPacket(WorldPacket const* packet) { diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index d80eb1d1526..165217e939c 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -501,7 +501,6 @@ class TC_GAME_API WorldSession std::string const& GetPlayerName() const; std::string GetPlayerInfo() const; - ObjectGuid::LowType GetGUIDLow() const; void SetSecurity(AccountTypes security) { _security = security; } std::string const& GetRemoteAddress() const { return m_Address; } void SetPlayer(Player* player); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 711bbbf2744..7452c0e60b2 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -582,7 +582,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication* auraAp if (itr == m_applications.end()) { TC_LOG_ERROR("spells", "Aura::_UnapplyForTarget, target: {}, caster: {}, spell:{} was not found in owners application map!", - target->GetGUID().ToString(), caster ? caster->GetGUID().ToString() : "0", auraApp->GetBase()->GetSpellInfo()->Id); + target->GetGUID().ToString(), caster ? caster->GetGUID().ToString() : "Empty", auraApp->GetBase()->GetSpellInfo()->Id); ABORT(); } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 783e27a3a8b..5f024a813ea 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -316,7 +316,7 @@ void SpellCastTargets::SetItemTarget(Item* item) void SpellCastTargets::SetTradeItemTarget(Player* caster) { - m_itemTargetGUID.Set(uint64(TRADE_SLOT_NONTRADED)); + m_itemTargetGUID.SetRawValue(uint64(TRADE_SLOT_NONTRADED)); m_itemTargetEntry = 0; m_targetMask |= TARGET_FLAG_TRADE_ITEM; @@ -3931,7 +3931,7 @@ void Spell::finish(bool ok) TC_LOG_DEBUG("spells", "Statue {} is unsummoned in spell {} finish", unitCaster->GetGUID().ToString(), m_spellInfo->Id); // Avoid infinite loops with setDeathState(JUST_DIED) being called over and over // It might make sense to do this check in Unit::setDeathState() and all overloaded functions - if(unitCaster->getDeathState() != JUST_DIED) + if (unitCaster->getDeathState() != JUST_DIED) unitCaster->setDeathState(JUST_DIED); return; } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 4b543169854..6b4192efaef 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1723,7 +1723,7 @@ void Spell::SendLoot(ObjectGuid guid, LootType loottype) if (!gameObjTarget->isSpawned() && !player->IsGameMaster()) { TC_LOG_ERROR("entities.player.cheat", "Possible hacking attempt: Player {} {} tried to loot a gameobject {} which is on respawn timer without being in GM mode!", - player->GetName(), player->GetGUID().ToString(), gameObjTarget->GetGUID().ToString()); + player->GetName(), player->GetGUID().ToString(), gameObjTarget->GetGUID().ToString()); return; } // special case, already has GossipHello inside so return and avoid calling twice diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index 5268d726a0f..852fc73e23e 100644 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -214,7 +214,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject CreatureTextMap::const_iterator sList = mTextMap.find(source->GetEntry()); if (sList == mTextMap.end()) { - TC_LOG_ERROR("sql.sql.creaturetextmgr", "CreatureTextMgr: Could not find Text for Creature {} (Entry {}, spawnId {}) in 'creature_text' table. Ignoring.", source->GetName(), source->GetEntry(), source->GetSpawnId()); + TC_LOG_ERROR("sql.sql.creaturetextmgr", "CreatureTextMgr: Could not find Text for Creature {} ({}) in 'creature_text' table. Ignoring.", source->GetName(), source->GetGUID().ToString()); return 0; } @@ -222,7 +222,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject CreatureTextHolder::const_iterator itr = textHolder.find(textGroup); if (itr == textHolder.end()) { - TC_LOG_ERROR("sql.sql.creaturetextmgr", "CreatureTextMgr: Could not find TextGroup {} for Creature {} (Entry {}, spawnId {}) in 'creature_text' table. Ignoring.", uint32(textGroup), source->GetName(), source->GetEntry(), source->GetSpawnId()); + TC_LOG_ERROR("sql.sql.creaturetextmgr", "CreatureTextMgr: Could not find TextGroup {} for Creature {} ({}) in 'creature_text' table. Ignoring.", uint32(textGroup), source->GetName(), source->GetGUID().ToString()); return 0; } diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 6e808bea980..a99ad2e8752 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -509,8 +509,8 @@ public: if (!target) return false; - handler->PSendSysMessage("Loot recipient for creature %s (GUID %u, SpawnID %u) is %s", - target->GetName().c_str(), target->GetGUID().GetCounter(), target->GetSpawnId(), + handler->PSendSysMessage("Loot recipient for creature %s (%s, SpawnID %u) is %s", + target->GetName().c_str(), target->GetGUID().ToString().c_str(), target->GetSpawnId(), target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName().c_str() : "offline") : "no loot recipient"); return true; } @@ -599,7 +599,7 @@ public: break; } - handler->PSendSysMessage("bag: %d slot: %d guid: %d - state: %s", bagSlot, item->GetSlot(), item->GetGUID().GetCounter(), st.c_str()); + handler->PSendSysMessage("bag: %d slot: %d %s - state: %s", bagSlot, item->GetSlot(), item->GetGUID().ToString().c_str(), st.c_str()); } if (updateQueue.empty()) handler->PSendSysMessage("The player's updatequeue is empty"); @@ -620,7 +620,7 @@ public: if (item->GetSlot() != i) { - handler->PSendSysMessage("Item with slot %d and guid %d has an incorrect slot value: %d", i, item->GetGUID().GetCounter(), item->GetSlot()); + handler->PSendSysMessage("Item with slot %d and %s has an incorrect slot value: %d", i, item->GetGUID().ToString().c_str(), item->GetSlot()); error = true; continue; } @@ -644,28 +644,28 @@ public: uint16 qp = item->GetQueuePos(); if (qp > updateQueue.size()) { - handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) larger than the update queue size! ", item->GetSlot(), item->GetGUID().GetCounter(), qp); + handler->PSendSysMessage("The item with slot %d and %s has its queuepos (%d) larger than the update queue size! ", item->GetSlot(), item->GetGUID().ToString().c_str(), qp); error = true; continue; } if (updateQueue[qp] == nullptr) { - handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) pointing to NULL in the queue!", item->GetSlot(), item->GetGUID().GetCounter(), qp); + handler->PSendSysMessage("The item with slot %d and %s has its queuepos (%d) pointing to NULL in the queue!", item->GetSlot(), item->GetGUID().ToString().c_str(), qp); error = true; continue; } if (updateQueue[qp] != item) { - handler->PSendSysMessage("The item with slot %d and guid %d has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", item->GetSlot(), item->GetGUID().GetCounter(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUID().GetCounter()); + handler->PSendSysMessage("The item with slot %d and %s has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, %s)", item->GetSlot(), item->GetGUID().ToString().c_str(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUID().ToString().c_str()); error = true; continue; } } else if (item->GetState() != ITEM_UNCHANGED) { - handler->PSendSysMessage("The item with slot %d and guid %d is not in queue but should be (state: %d)!", item->GetSlot(), item->GetGUID().GetCounter(), item->GetState()); + handler->PSendSysMessage("The item with slot %d and %s is not in queue but should be (state: %d)!", item->GetSlot(), item->GetGUID().ToString().c_str(), item->GetState()); error = true; continue; } @@ -680,7 +680,7 @@ public: if (item2->GetSlot() != j) { - handler->PSendSysMessage("The item in bag %d and slot %d (guid: %d) has an incorrect slot value: %d", bag->GetSlot(), j, item2->GetGUID().GetCounter(), item2->GetSlot()); + handler->PSendSysMessage("The item in bag %d and slot %d (%s) has an incorrect slot value: %d", bag->GetSlot(), j, item2->GetGUID().ToString().c_str(), item2->GetSlot()); error = true; continue; } @@ -712,28 +712,28 @@ public: uint16 qp = item2->GetQueuePos(); if (qp > updateQueue.size()) { - handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().GetCounter(), qp); + handler->PSendSysMessage("The item in bag %d at slot %d having %s has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString().c_str(), qp); error = true; continue; } if (updateQueue[qp] == nullptr) { - handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().GetCounter(), qp); + handler->PSendSysMessage("The item in bag %d at slot %d having %s has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString().c_str(), qp); error = true; continue; } if (updateQueue[qp] != item2) { - handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().GetCounter(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUID().GetCounter()); + handler->PSendSysMessage("The item in bag %d at slot %d having %s has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, %s)", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString().c_str(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUID().ToString().c_str()); error = true; continue; } } else if (item2->GetState() != ITEM_UNCHANGED) { - handler->PSendSysMessage("The item in bag %d at slot %d having guid %d is not in queue but should be (state: %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().GetCounter(), item2->GetState()); + handler->PSendSysMessage("The item in bag %d at slot %d having %s is not in queue but should be (state: %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString().c_str(), item2->GetState()); error = true; continue; } @@ -808,21 +808,21 @@ public: ThreatManager& mgr = target->GetThreatManager(); if (!target->IsAlive()) { - handler->PSendSysMessage("%s (GUID %u) is not alive.%s", target->GetName().c_str(), target->GetGUID().GetCounter(), target->IsEngaged() ? " (It is, however, engaged. Huh?)" : ""); + handler->PSendSysMessage("%s (%s) is not alive.%s", target->GetName().c_str(), target->GetGUID().ToString().c_str(), target->IsEngaged() ? " (It is, however, engaged. Huh?)" : ""); return true; } uint32 count = 0; auto const& threatenedByMe = target->GetThreatManager().GetThreatenedByMeList(); if (threatenedByMe.empty()) - handler->PSendSysMessage("%s (GUID %u) does not threaten any units.", target->GetName().c_str(), target->GetGUID().GetCounter()); + handler->PSendSysMessage("%s (%s) does not threaten any units.", target->GetName().c_str(), target->GetGUID().ToString().c_str()); else { - handler->PSendSysMessage("List of units threatened by %s (GUID %u)", target->GetName().c_str(), target->GetGUID().GetCounter()); + handler->PSendSysMessage("List of units threatened by %s (%s)", target->GetName().c_str(), target->GetGUID().ToString().c_str()); for (auto const& pair : threatenedByMe) { Unit* unit = pair.second->GetOwner(); - handler->PSendSysMessage(" %u. %s (GUID %u, SpawnID %u) - threat %f", ++count, unit->GetName().c_str(), unit->GetGUID().GetCounter(), unit->GetTypeId() == TYPEID_UNIT ? unit->ToCreature()->GetSpawnId() : 0, pair.second->GetThreat()); + handler->PSendSysMessage(" %u. %s (%s, SpawnID %u) - threat %f", ++count, unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), unit->GetTypeId() == TYPEID_UNIT ? unit->ToCreature()->GetSpawnId() : 0, pair.second->GetThreat()); } handler->SendSysMessage("End of threatened-by-me list."); } @@ -832,9 +832,9 @@ public: if (!mgr.IsThreatListEmpty(true)) { if (target->IsEngaged()) - handler->PSendSysMessage("Threat list of %s (GUID %u, SpawnID %u):", target->GetName().c_str(), target->GetGUID().GetCounter(), target->GetTypeId() == TYPEID_UNIT ? target->ToCreature()->GetSpawnId() : 0); + handler->PSendSysMessage("Threat list of %s (%s, SpawnID %u):", target->GetName().c_str(), target->GetGUID().ToString().c_str(), target->GetTypeId() == TYPEID_UNIT ? target->ToCreature()->GetSpawnId() : 0); else - handler->PSendSysMessage("%s (GUID %u, SpawnID %u) is not engaged, but still has a threat list? Well, here it is:", target->GetName().c_str(), target->GetGUID().GetCounter(), target->GetTypeId() == TYPEID_UNIT ? target->ToCreature()->GetSpawnId() : 0); + handler->PSendSysMessage("%s (%s, SpawnID %u) is not engaged, but still has a threat list? Well, here it is:", target->GetName().c_str(), target->GetGUID().ToString().c_str(), target->GetTypeId() == TYPEID_UNIT ? target->ToCreature()->GetSpawnId() : 0); count = 0; Unit* fixateVictim = mgr.GetFixateTarget(); @@ -868,19 +868,19 @@ public: default: tauntStr = ""; } - handler->PSendSysMessage(" %u. %s (GUID %u) - threat %f%s%s", ++count, unit->GetName().c_str(), unit->GetGUID().GetCounter(), ref->GetThreat(), tauntStr, onlineStr); + handler->PSendSysMessage(" %u. %s (%s) - threat %f%s%s", ++count, unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), ref->GetThreat(), tauntStr, onlineStr); } handler->SendSysMessage("End of threat list."); } else if (!target->IsEngaged()) - handler->PSendSysMessage("%s (GUID %u, SpawnID %u) is not currently engaged.", target->GetName().c_str(), target->GetGUID().GetCounter(), target->GetTypeId() == TYPEID_UNIT ? target->ToCreature()->GetSpawnId() : 0); + handler->PSendSysMessage("%s (%s, SpawnID %u) is not currently engaged.", target->GetName().c_str(), target->GetGUID().ToString().c_str(), target->GetTypeId() == TYPEID_UNIT ? target->ToCreature()->GetSpawnId() : 0); else - handler->PSendSysMessage("%s (GUID %u, SpawnID %u) seems to be engaged, but does not have a threat list??", target->GetName().c_str(), target->GetGUID().GetCounter(), target->GetTypeId() == TYPEID_UNIT ? target->ToCreature()->GetSpawnId() : 0); + handler->PSendSysMessage("%s (%s, SpawnID %u) seems to be engaged, but does not have a threat list??", target->GetName().c_str(), target->GetGUID().ToString().c_str(), target->GetTypeId() == TYPEID_UNIT ? target->ToCreature()->GetSpawnId() : 0); } else if (target->IsEngaged()) - handler->PSendSysMessage("%s (GUID %u) is currently engaged. (This unit cannot have a threat list.)", target->GetName().c_str(), target->GetGUID().GetCounter()); + handler->PSendSysMessage("%s (%s) is currently engaged. (This unit cannot have a threat list.)", target->GetName().c_str(), target->GetGUID().ToString().c_str()); else - handler->PSendSysMessage("%s (GUID %u) is not currently engaged. (This unit cannot have a threat list.)", target->GetName().c_str(), target->GetGUID().GetCounter()); + handler->PSendSysMessage("%s (%s) is not currently engaged. (This unit cannot have a threat list.)", target->GetName().c_str(), target->GetGUID().ToString().c_str()); return true; } diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index b7bc562053a..56e5dd52642 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -188,10 +188,10 @@ public: do { Field* fields = result->Fetch(); - uint32 itemGuid = fields[0].GetUInt32(); + ObjectGuid itemGuid = ObjectGuid::Create<HighGuid::Item>(fields[0].GetUInt32()); uint32 itemBag = fields[1].GetUInt32(); uint8 itemSlot = fields[2].GetUInt8(); - uint32 ownerGuid = fields[3].GetUInt32(); + ObjectGuid ownerGuid = ObjectGuid::Create<HighGuid::Player>(fields[3].GetUInt32()); uint32 ownerAccountId = fields[4].GetUInt32(); std::string ownerName = fields[5].GetString(); @@ -205,7 +205,7 @@ public: else itemPos = ""; - handler->PSendSysMessage(LANG_ITEMLIST_SLOT, itemGuid, ownerName.c_str(), ownerGuid, ownerAccountId, itemPos); + handler->PSendSysMessage(LANG_ITEMLIST_SLOT, itemGuid.ToString().c_str(), ownerName.c_str(), ownerGuid.ToString().c_str(), ownerAccountId, itemPos); } while (result->NextRow()); diff --git a/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp b/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp index df5e4641552..5953458f119 100644 --- a/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp +++ b/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp @@ -170,13 +170,13 @@ class spell_ioc_parachute_ic : public AuraScript class StartLaunchEvent : public BasicEvent { public: - StartLaunchEvent(Position const& pos, ObjectGuid::LowType lowGuid) : _pos(pos), _lowGuid(lowGuid) + StartLaunchEvent(Position const& pos, ObjectGuid const& guid) : _pos(pos), _guid(guid) { } bool Execute(uint64 /*time*/, uint32 /*diff*/) override { - Player* player = ObjectAccessor::FindPlayerByLowGUID(_lowGuid); + Player* player = ObjectAccessor::FindPlayer(_guid); if (!player || !player->GetVehicle()) return true; @@ -191,7 +191,7 @@ class StartLaunchEvent : public BasicEvent private: Position _pos; - ObjectGuid::LowType _lowGuid; + ObjectGuid _guid; }; // 66218 - Launch @@ -204,7 +204,7 @@ class spell_ioc_launch : public SpellScript if (!GetCaster()->ToCreature() || !GetExplTargetDest()) return; - GetCaster()->ToCreature()->m_Events.AddEvent(new StartLaunchEvent(*GetExplTargetDest(), ASSERT_NOTNULL(GetHitPlayer())->GetGUID().GetCounter()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500ms)); + GetCaster()->ToCreature()->m_Events.AddEvent(new StartLaunchEvent(*GetExplTargetDest(), ASSERT_NOTNULL(GetHitPlayer())->GetGUID()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500ms)); } void Register() override diff --git a/src/server/scripts/World/action_ip_logger.cpp b/src/server/scripts/World/action_ip_logger.cpp index f5e1f05569d..71550d2a800 100644 --- a/src/server/scripts/World/action_ip_logger.cpp +++ b/src/server/scripts/World/action_ip_logger.cpp @@ -206,7 +206,6 @@ class CharacterActionIpLogger : public PlayerScript // We declare all the required variables uint32 playerGuid = player->GetSession()->GetAccountId(); - ObjectGuid::LowType characterGuid = player->GetGUID().GetCounter(); uint32 realmId = realm.Id.Realm; const std::string currentIp = player->GetSession()->GetRemoteAddress(); std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it... @@ -240,7 +239,7 @@ class CharacterActionIpLogger : public PlayerScript LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_CHAR_IP_LOGGING); stmt->setUInt32(0, playerGuid); - stmt->setUInt64(1, characterGuid); + stmt->setUInt64(1, player->GetGUID().GetCounter()); stmt->setUInt32(2, realmId); stmt->setUInt8(3, aType); stmt->setString(4, currentIp); // We query the ip here. |