diff options
Diffstat (limited to 'src/server/game/Guilds/Guild.cpp')
-rw-r--r-- | src/server/game/Guilds/Guild.cpp | 203 |
1 files changed, 101 insertions, 102 deletions
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 2b0c2be4bbd..7048fd3ee9d 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -199,8 +199,8 @@ void Guild::EventLogEntry::SaveToDB(SQLTransaction& trans) const void Guild::EventLogEntry::WritePacket(WorldPacket& data, ByteBuffer& content) const { - ObjectGuid guid1 = MAKE_NEW_GUID(m_playerGuid1, 0, HIGHGUID_PLAYER); - ObjectGuid guid2 = MAKE_NEW_GUID(m_playerGuid2, 0, HIGHGUID_PLAYER); + ObjectGuid guid1 = ObjectGuid(HIGHGUID_PLAYER, m_playerGuid1); + ObjectGuid guid2 = ObjectGuid(HIGHGUID_PLAYER, m_playerGuid2); data.WriteBit(guid1[2]); data.WriteBit(guid1[4]); @@ -276,7 +276,7 @@ void Guild::BankEventLogEntry::SaveToDB(SQLTransaction& trans) const void Guild::BankEventLogEntry::WritePacket(WorldPacket& data, ByteBuffer& content) const { - ObjectGuid logGuid = MAKE_NEW_GUID(m_playerGuid, 0, HIGHGUID_PLAYER); + ObjectGuid logGuid = ObjectGuid(HIGHGUID_PLAYER, m_playerGuid); bool hasItem = m_eventType == GUILD_BANK_LOG_DEPOSIT_ITEM || m_eventType == GUILD_BANK_LOG_WITHDRAW_ITEM || m_eventType == GUILD_BANK_LOG_MOVE_ITEM || m_eventType == GUILD_BANK_LOG_MOVE_ITEM2; @@ -329,7 +329,7 @@ void Guild::NewsLogEntry::SaveToDB(SQLTransaction& trans) const stmt->setUInt32( index, m_guildId); stmt->setUInt32(++index, GetGUID()); stmt->setUInt8 (++index, GetType()); - stmt->setUInt32(++index, GetPlayerGuid()); + stmt->setUInt32(++index, GetPlayerGuid().GetCounter()); stmt->setUInt32(++index, GetFlags()); stmt->setUInt32(++index, GetValue()); stmt->setUInt64(++index, GetTimestamp()); @@ -513,7 +513,7 @@ bool Guild::BankTab::LoadItemFromDB(Field* fields) } Item* pItem = NewItemOrBag(proto); - if (!pItem->LoadFromDB(itemGuid, 0, fields, itemEntry)) + if (!pItem->LoadFromDB(itemGuid, ObjectGuid::Empty, fields, itemEntry)) { TC_LOG_ERROR("guild", "Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry); @@ -601,8 +601,8 @@ bool Guild::BankTab::SetItem(SQLTransaction& trans, uint8 slotId, Item* item) stmt->setUInt32(3, item->GetGUIDLow()); CharacterDatabase.ExecuteOrAppend(trans, stmt); - item->SetUInt64Value(ITEM_FIELD_CONTAINED, 0); - item->SetUInt64Value(ITEM_FIELD_OWNER, 0); + item->SetGuidValue(ITEM_FIELD_CONTAINED, ObjectGuid::Empty); + item->SetGuidValue(ITEM_FIELD_OWNER, ObjectGuid::Empty); item->FSetState(ITEM_NEW); item->SaveToDB(trans); // Not in inventory and can be saved standalone } @@ -659,7 +659,7 @@ void Guild::Member::SetPublicNote(std::string const& publicNote) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_MEMBER_PNOTE); stmt->setString(0, publicNote); - stmt->setUInt32(1, GUID_LOPART(m_guid)); + stmt->setUInt32(1, m_guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -672,7 +672,7 @@ void Guild::Member::SetOfficerNote(std::string const& officerNote) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_MEMBER_OFFNOTE); stmt->setString(0, officerNote); - stmt->setUInt32(1, GUID_LOPART(m_guid)); + stmt->setUInt32(1, m_guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -686,7 +686,7 @@ void Guild::Member::ChangeRank(uint8 newRank) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_MEMBER_RANK); stmt->setUInt8 (0, newRank); - stmt->setUInt32(1, GUID_LOPART(m_guid)); + stmt->setUInt32(1, m_guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -694,7 +694,7 @@ void Guild::Member::SaveToDB(SQLTransaction& trans) const { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER); stmt->setUInt32(0, m_guildId); - stmt->setUInt32(1, GUID_LOPART(m_guid)); + stmt->setUInt32(1, m_guid.GetCounter()); stmt->setUInt8 (2, m_rankId); stmt->setString(3, m_publicNote); stmt->setString(4, m_officerNote); @@ -728,7 +728,7 @@ bool Guild::Member::LoadFromDB(Field* fields) if (!m_zoneId) { - TC_LOG_DEBUG("guild", "Player (GUID: %u) has broken zone-data", GUID_LOPART(m_guid)); + TC_LOG_DEBUG("guild", "%s has broken zone-data", m_guid.ToString().c_str()); m_zoneId = Player::GetZoneIdFromDB(m_guid); } @@ -741,13 +741,13 @@ bool Guild::Member::CheckStats() const { if (m_level < 1) { - TC_LOG_ERROR("guild", "Player (GUID: %u) has a broken data in field `characters`.`level`, deleting him from guild!", GUID_LOPART(m_guid)); + TC_LOG_ERROR("guild", "%s has a broken data in field `characters`.`level`, deleting him from guild!", m_guid.ToString().c_str()); return false; } if (m_class < CLASS_WARRIOR || m_class >= MAX_CLASSES) { - TC_LOG_ERROR("guild", "Player (GUID: %u) has a broken data in field `characters`.`class`, deleting him from guild!", GUID_LOPART(m_guid)); + TC_LOG_ERROR("guild", "%s has a broken data in field `characters`.`class`, deleting him from guild!", m_guid.ToString().c_str()); return false; } return true; @@ -761,7 +761,7 @@ void Guild::Member::UpdateBankWithdrawValue(SQLTransaction& trans, uint8 tabId, m_bankWithdraw[tabId] += amount; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER_WITHDRAW); - stmt->setUInt32(0, GUID_LOPART(m_guid)); + stmt->setUInt32(0, m_guid.GetCounter()); for (uint8 i = 0; i <= GUILD_BANK_MAX_TABS;) { uint32 withdraw = m_bankWithdraw[i++]; @@ -1159,7 +1159,7 @@ InventoryResult Guild::BankMoveItemData::CanStore(Item* pItem, bool swap) // Guild Guild::Guild(): m_id(0), - m_leaderGuid(0), + m_leaderGuid(), m_createdDate(0), m_accountsNumber(0), m_bankMoney(0), @@ -1221,7 +1221,7 @@ bool Guild::Create(Player* pLeader, std::string const& name) _CreateLogHolders(); TC_LOG_DEBUG("guild", "GUILD: creating guild [%s] for leader %s (%u)", - name.c_str(), pLeader->GetName().c_str(), GUID_LOPART(m_leaderGuid)); + name.c_str(), pLeader->GetName().c_str(), m_leaderGuid.GetCounter()); SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -1233,7 +1233,7 @@ bool Guild::Create(Player* pLeader, std::string const& name) stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD); stmt->setUInt32( index, m_id); stmt->setString(++index, name); - stmt->setUInt32(++index, GUID_LOPART(m_leaderGuid)); + stmt->setUInt32(++index, m_leaderGuid.GetCounter()); stmt->setString(++index, m_info); stmt->setString(++index, m_motd); stmt->setUInt64(++index, uint32(m_createdDate)); @@ -1251,7 +1251,7 @@ bool Guild::Create(Player* pLeader, std::string const& name) if (ret) { - _BroadcastEvent(GE_FOUNDER, 0); + _BroadcastEvent(GE_FOUNDER, ObjectGuid::Empty); sScriptMgr->OnGuildCreate(this, pLeader, name); } @@ -1264,7 +1264,7 @@ void Guild::Disband() // Call scripts before guild data removed from database sScriptMgr->OnGuildDisband(this); - _BroadcastEvent(GE_DISBANDED, 0); + _BroadcastEvent(GE_DISBANDED, ObjectGuid::Empty); // Remove all members while (!m_members.empty()) { @@ -1587,7 +1587,7 @@ void Guild::HandleSetMOTD(WorldSession* session, std::string const& motd) stmt->setUInt32(1, m_id); CharacterDatabase.Execute(stmt); - _BroadcastEvent(GE_MOTD, 0, motd.c_str()); + _BroadcastEvent(GE_MOTD, ObjectGuid::Empty, motd.c_str()); } } @@ -1644,7 +1644,7 @@ void Guild::HandleSetNewGuildMaster(WorldSession* session, std::string const& na { _SetLeaderGUID(newGuildMaster); oldGuildMaster->ChangeRank(GR_INITIATE); - _BroadcastEvent(GE_LEADER_CHANGED, 0, player->GetName().c_str(), name.c_str()); + _BroadcastEvent(GE_LEADER_CHANGED, ObjectGuid::Empty, player->GetName().c_str(), name.c_str()); } } } @@ -1663,10 +1663,10 @@ void Guild::HandleSetBankTabInfo(WorldSession* session, uint8 tabId, std::string sprintf(aux, "%u", tabId); tab->SetInfo(name, icon); - _BroadcastEvent(GE_BANK_TAB_UPDATED, 0, aux, name.c_str(), icon.c_str()); + _BroadcastEvent(GE_BANK_TAB_UPDATED, ObjectGuid::Empty, aux, name.c_str(), icon.c_str()); } -void Guild::HandleSetMemberNote(WorldSession* session, std::string const& note, uint64 guid, bool isPublic) +void Guild::HandleSetMemberNote(WorldSession* session, std::string const& note, ObjectGuid guid, bool isPublic) { // Player must have rights to set public/officer note if (!_HasRankRight(session->GetPlayer(), isPublic ? GR_RIGHT_EPNOTE : GR_RIGHT_EOFFNOTE)) @@ -1700,7 +1700,7 @@ void Guild::HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string c char aux[2]; sprintf(aux, "%u", rankId); - _BroadcastEvent(GE_RANK_UPDATED, 0, aux); + _BroadcastEvent(GE_RANK_UPDATED, ObjectGuid::Empty, aux); } } @@ -1735,7 +1735,7 @@ void Guild::HandleBuyBankTab(WorldSession* session, uint8 tabId) } _CreateNewBankTab(); - _BroadcastEvent(GE_BANK_TAB_PURCHASED, 0); + _BroadcastEvent(GE_BANK_TAB_PURCHASED, ObjectGuid::Empty); SendPermissions(session); /// Hack to force client to update permissions } @@ -1794,7 +1794,10 @@ void Guild::HandleInviteMember(WorldSession* session, std::string const& name) data << uint32(m_emblemInfo.GetBackgroundColor()); data << uint32(m_emblemInfo.GetColor()); - ObjectGuid oldGuildGuid = MAKE_NEW_GUID(pInvitee->GetGuildId(), 0, pInvitee->GetGuildId() ? uint32(HIGHGUID_GUILD) : 0); + ObjectGuid oldGuildGuid; + if (uint32 oldId = pInvitee->GetGuildId()) + oldGuildGuid = ObjectGuid(HIGHGUID_GUILD, pInvitee->GetGuildId()); + ObjectGuid newGuildGuid = GetGUID(); data.WriteBit(newGuildGuid[3]); @@ -1895,7 +1898,7 @@ void Guild::HandleLeaveMember(WorldSession* session) delete this; } -void Guild::HandleRemoveMember(WorldSession* session, uint64 guid) +void Guild::HandleRemoveMember(WorldSession* session, ObjectGuid guid) { Player* player = session->GetPlayer(); @@ -1919,15 +1922,15 @@ void Guild::HandleRemoveMember(WorldSession* session, uint64 guid) { // After call to DeleteMember pointer to member becomes invalid DeleteMember(guid, false, true); - _LogEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, player->GetGUIDLow(), GUID_LOPART(guid)); - _BroadcastEvent(GE_REMOVED, 0, name.c_str(), player->GetName().c_str()); + _LogEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, player->GetGUIDLow(), guid.GetCounter()); + _BroadcastEvent(GE_REMOVED, ObjectGuid::Empty, name.c_str(), player->GetName().c_str()); SendCommandResult(session, GUILD_COMMAND_REMOVE, ERR_GUILD_COMMAND_SUCCESS, name); } } } } -void Guild::HandleUpdateMemberRank(WorldSession* session, uint64 guid, bool demote) +void Guild::HandleUpdateMemberRank(WorldSession* session, ObjectGuid guid, bool demote) { Player* player = session->GetPlayer(); GuildCommandType type = demote ? GUILD_COMMAND_DEMOTE : GUILD_COMMAND_PROMOTE; @@ -1975,12 +1978,12 @@ void Guild::HandleUpdateMemberRank(WorldSession* session, uint64 guid, bool demo uint32 newRankId = member->GetRankId() + (demote ? 1 : -1); member->ChangeRank(newRankId); - _LogEvent(demote ? GUILD_EVENT_LOG_DEMOTE_PLAYER : GUILD_EVENT_LOG_PROMOTE_PLAYER, player->GetGUIDLow(), GUID_LOPART(member->GetGUID()), newRankId); - _BroadcastEvent(demote ? GE_DEMOTION : GE_PROMOTION, 0, player->GetName().c_str(), name.c_str(), _GetRankName(newRankId).c_str()); + _LogEvent(demote ? GUILD_EVENT_LOG_DEMOTE_PLAYER : GUILD_EVENT_LOG_PROMOTE_PLAYER, player->GetGUIDLow(), member->GetGUID().GetCounter(), newRankId); + _BroadcastEvent(demote ? GE_DEMOTION : GE_PROMOTION, ObjectGuid::Empty, player->GetName().c_str(), name.c_str(), _GetRankName(newRankId).c_str()); } } -void Guild::HandleSetMemberRank(WorldSession* session, uint64 targetGuid, uint64 setterGuid, uint32 rank) +void Guild::HandleSetMemberRank(WorldSession* session, ObjectGuid targetGuid, ObjectGuid setterGuid, uint32 rank) { Player* player = session->GetPlayer(); Member* member = GetMember(targetGuid); @@ -2019,7 +2022,7 @@ void Guild::HandleAddNewRank(WorldSession* session, std::string const& name) // Only leader can add new rank if (_IsLeader(session->GetPlayer())) if (_CreateRank(name, GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK)) - _BroadcastEvent(GE_RANK_CREATED, 0); + _BroadcastEvent(GE_RANK_CREATED, ObjectGuid::Empty); } void Guild::HandleRemoveRank(WorldSession* session, uint8 rankId) @@ -2041,7 +2044,7 @@ void Guild::HandleRemoveRank(WorldSession* session, uint8 rankId) m_ranks.erase(m_ranks.begin() + rankId); - _BroadcastEvent(GE_RANK_DELETED, rankId); + _BroadcastEvent(GE_RANK_DELETED, ObjectGuid::Empty, std::to_string(rankId).c_str()); } void Guild::HandleMemberDepositMoney(WorldSession* session, uint64 amount, bool cashFlow /*=false*/) @@ -2063,7 +2066,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint64 amount, bool CharacterDatabase.CommitTransaction(trans); std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&m_bankMoney), 8, true); - _BroadcastEvent(GE_BANK_MONEY_SET, 0, aux.c_str()); + _BroadcastEvent(GE_BANK_MONEY_SET, ObjectGuid::Empty, aux.c_str()); if (player->GetSession()->HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE)) { @@ -2113,7 +2116,7 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint64 amount, bool CharacterDatabase.CommitTransaction(trans); std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&m_bankMoney), 8, true); - _BroadcastEvent(GE_BANK_MONEY_SET, 0, aux.c_str()); + _BroadcastEvent(GE_BANK_MONEY_SET, ObjectGuid::Empty, aux.c_str()); return true; } @@ -2368,7 +2371,7 @@ bool Guild::LoadFromDB(Field* fields) { m_id = fields[0].GetUInt32(); m_name = fields[1].GetString(); - m_leaderGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER); + m_leaderGuid = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32()); m_emblemInfo.LoadFromDB(fields); m_info = fields[8].GetString(); m_motd = fields[9].GetString(); @@ -2402,7 +2405,7 @@ void Guild::LoadRankFromDB(Field* fields) bool Guild::LoadMemberFromDB(Field* fields) { uint32 lowguid = fields[1].GetUInt32(); - Member *member = new Member(m_id, MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER), fields[2].GetUInt8()); + Member *member = new Member(m_id, ObjectGuid(HIGHGUID_PLAYER, lowguid), fields[2].GetUInt8()); if (!member->LoadFromDB(fields)) { _DeleteMemberFromDB(lowguid); @@ -2484,13 +2487,13 @@ void Guild::LoadGuildNewsLogFromDB(Field* fields) return; m_newsLog->LoadEvent(new NewsLogEntry( - m_id, // guild id - fields[1].GetUInt32(), // guid - fields[6].GetUInt32(), // timestamp //64 bits? - GuildNews(fields[2].GetUInt8()), // type - fields[3].GetUInt32(), // player guid - fields[4].GetUInt32(), // Flags - fields[5].GetUInt32())); // value + m_id, // guild id + fields[1].GetUInt32(), // guid + fields[6].GetUInt32(), // timestamp //64 bits? + GuildNews(fields[2].GetUInt8()), // type + ObjectGuid(HIGHGUID_PLAYER, fields[3].GetUInt32()), // player guid + fields[4].GetUInt32(), // Flags + fields[5].GetUInt32())); // value } void Guild::LoadBankTabFromDB(Field* fields) @@ -2661,7 +2664,7 @@ void Guild::MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 max if (member->GetGUID() != session->GetPlayer()->GetGUID() && level >= minLevel && level <= maxLevel && member->IsRankNotLower(minRank)) { - data.appendPackGUID(member->GetGUID()); + data.appendPackGUID(member->GetGUID().GetRawValue()); data << uint8(0); // unk ++count; } @@ -2673,7 +2676,7 @@ void Guild::MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 max } // Members handling -bool Guild::AddMember(uint64 guid, uint8 rankId) +bool Guild::AddMember(ObjectGuid guid, uint8 rankId) { Player* player = ObjectAccessor::FindPlayer(guid); // Player cannot be in guild @@ -2689,7 +2692,7 @@ bool Guild::AddMember(uint64 guid, uint8 rankId) // This will be prevent attempt to join many guilds and corrupt guild data integrity Player::RemovePetitionsAndSigns(guid, GUILD_CHARTER_TYPE); - uint32 lowguid = GUID_LOPART(guid); + uint32 lowguid = guid.GetCounter(); // If rank was not passed, assign lowest possible rank if (rankId == GUILD_RANK_NONE) @@ -2752,9 +2755,9 @@ bool Guild::AddMember(uint64 guid, uint8 rankId) return true; } -void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked, bool canDeleteGuild) +void Guild::DeleteMember(ObjectGuid guid, bool isDisbanding, bool isKicked, bool canDeleteGuild) { - uint32 lowguid = GUID_LOPART(guid); + uint32 lowguid = guid.GetCounter(); Player* player = ObjectAccessor::FindPlayer(guid); // Guild master can be deleted when loading guild and guid doesn't exist in characters table @@ -2788,7 +2791,7 @@ void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked, bool can // If leader does not exist (at guild loading with deleted leader) do not send broadcasts if (oldLeader) { - _BroadcastEvent(GE_LEADER_CHANGED, 0, oldLeader->GetName().c_str(), newLeader->GetName().c_str()); + _BroadcastEvent(GE_LEADER_CHANGED, ObjectGuid::Empty, oldLeader->GetName().c_str(), newLeader->GetName().c_str()); _BroadcastEvent(GE_LEFT, guid, oldLeader->GetName().c_str()); } } @@ -2817,7 +2820,7 @@ void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked, bool can _UpdateAccountsNumber(); } -bool Guild::ChangeMemberRank(uint64 guid, uint8 newRank) +bool Guild::ChangeMemberRank(ObjectGuid guid, uint8 newRank) { if (newRank <= _GetLowestRankId()) // Validate rank (allow only existing ranks) if (Member* member = GetMember(guid)) @@ -2828,9 +2831,9 @@ bool Guild::ChangeMemberRank(uint64 guid, uint8 newRank) return false; } -bool Guild::IsMember(uint64 guid) const +bool Guild::IsMember(ObjectGuid guid) const { - Members::const_iterator itr = m_members.find(GUID_LOPART(guid)); + Members::const_iterator itr = m_members.find(guid.GetCounter()); return itr != m_members.end(); } @@ -3003,7 +3006,7 @@ void Guild::_SetLeaderGUID(Member* pLeader) pLeader->ChangeRank(GR_GUILDMASTER); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_LEADER); - stmt->setUInt32(0, GUID_LOPART(m_leaderGuid)); + stmt->setUInt32(0, m_leaderGuid.GetCounter()); stmt->setUInt32(1, m_id); CharacterDatabase.Execute(stmt); } @@ -3094,7 +3097,7 @@ inline int32 Guild::_GetMemberRemainingMoney(Member const* member) const return 0; } -inline void Guild::_UpdateMemberWithdrawSlots(SQLTransaction& trans, uint64 guid, uint8 tabId) +inline void Guild::_UpdateMemberWithdrawSlots(SQLTransaction& trans, ObjectGuid guid, uint8 tabId) { if (Member* member = GetMember(guid)) { @@ -3105,7 +3108,7 @@ inline void Guild::_UpdateMemberWithdrawSlots(SQLTransaction& trans, uint64 guid } } -inline bool Guild::_MemberHasTabRights(uint64 guid, uint8 tabId, uint32 rights) const +inline bool Guild::_MemberHasTabRights(ObjectGuid guid, uint8 tabId, uint32 rights) const { if (const Member* member = GetMember(guid)) { @@ -3365,7 +3368,7 @@ void Guild::_SendBankContentUpdate(uint8 tabId, SlotIds slots) const } } -void Guild::_BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* param1, const char* param2, const char* param3) const +void Guild::_BroadcastEvent(GuildEvents guildEvent, ObjectGuid guid, const char* param1, const char* param2, const char* param3) const { uint8 count = !param3 ? (!param2 ? (!param1 ? 0 : 1) : 2) : 3; @@ -3478,58 +3481,55 @@ void Guild::SendBankList(WorldSession* session, uint8 tabId, bool withContent, b TC_LOG_DEBUG("guild", "WORLD: Sent (SMSG_GUILD_BANK_LIST)"); } -void Guild::SendGuildRanksUpdate(uint64 setterGuid, uint64 targetGuid, uint32 rank) +void Guild::SendGuildRanksUpdate(ObjectGuid setterGuid, ObjectGuid targetGuid, uint32 rank) { - ObjectGuid tarGuid = targetGuid; - ObjectGuid setGuid = setterGuid; - Member* member = GetMember(targetGuid); ASSERT(member); WorldPacket data(SMSG_GUILD_RANKS_UPDATE, 100); - data.WriteBit(setGuid[7]); - data.WriteBit(setGuid[2]); - data.WriteBit(tarGuid[2]); - data.WriteBit(setGuid[1]); - data.WriteBit(tarGuid[1]); - data.WriteBit(tarGuid[7]); - data.WriteBit(tarGuid[0]); - data.WriteBit(tarGuid[5]); - data.WriteBit(tarGuid[4]); + data.WriteBit(setterGuid[7]); + data.WriteBit(setterGuid[2]); + data.WriteBit(targetGuid[2]); + data.WriteBit(setterGuid[1]); + data.WriteBit(targetGuid[1]); + data.WriteBit(targetGuid[7]); + data.WriteBit(targetGuid[0]); + data.WriteBit(targetGuid[5]); + data.WriteBit(targetGuid[4]); data.WriteBit(rank < member->GetRankId()); // 1 == higher, 0 = lower? - data.WriteBit(setGuid[5]); - data.WriteBit(setGuid[0]); - data.WriteBit(tarGuid[6]); - data.WriteBit(setGuid[3]); - data.WriteBit(setGuid[6]); - data.WriteBit(tarGuid[3]); - data.WriteBit(setGuid[4]); + data.WriteBit(setterGuid[5]); + data.WriteBit(setterGuid[0]); + data.WriteBit(targetGuid[6]); + data.WriteBit(setterGuid[3]); + data.WriteBit(setterGuid[6]); + data.WriteBit(targetGuid[3]); + data.WriteBit(setterGuid[4]); data.FlushBits(); data << uint32(rank); - data.WriteByteSeq(setGuid[3]); - data.WriteByteSeq(tarGuid[7]); - data.WriteByteSeq(setGuid[6]); - data.WriteByteSeq(setGuid[2]); - data.WriteByteSeq(tarGuid[5]); - data.WriteByteSeq(tarGuid[0]); - data.WriteByteSeq(setGuid[7]); - data.WriteByteSeq(setGuid[5]); - data.WriteByteSeq(tarGuid[2]); - data.WriteByteSeq(tarGuid[1]); - data.WriteByteSeq(setGuid[0]); - data.WriteByteSeq(setGuid[4]); - data.WriteByteSeq(setGuid[1]); - data.WriteByteSeq(tarGuid[3]); - data.WriteByteSeq(tarGuid[6]); - data.WriteByteSeq(tarGuid[4]); + data.WriteByteSeq(setterGuid[3]); + data.WriteByteSeq(targetGuid[7]); + data.WriteByteSeq(setterGuid[6]); + data.WriteByteSeq(setterGuid[2]); + data.WriteByteSeq(targetGuid[5]); + data.WriteByteSeq(targetGuid[0]); + data.WriteByteSeq(setterGuid[7]); + data.WriteByteSeq(setterGuid[5]); + data.WriteByteSeq(targetGuid[2]); + data.WriteByteSeq(targetGuid[1]); + data.WriteByteSeq(setterGuid[0]); + data.WriteByteSeq(setterGuid[4]); + data.WriteByteSeq(setterGuid[1]); + data.WriteByteSeq(targetGuid[3]); + data.WriteByteSeq(targetGuid[6]); + data.WriteByteSeq(targetGuid[4]); BroadcastPacket(&data); member->ChangeRank(rank); - TC_LOG_DEBUG("network", "SMSG_GUILD_RANKS_UPDATE [Broadcast] Target: %u, Issuer: %u, RankId: %u", - GUID_LOPART(targetGuid), GUID_LOPART(setterGuid), rank); + TC_LOG_DEBUG("network", "SMSG_GUILD_RANKS_UPDATE [Broadcast] Target: %s, Issuer: %s, RankId: %u", + targetGuid.ToString().c_str(), setterGuid.ToString().c_str(), rank); } void Guild::GiveXP(uint32 xp, Player* source) @@ -3581,7 +3581,7 @@ void Guild::GiveXP(uint32 xp, Player* source) } } - AddGuildNews(GUILD_NEWS_LEVEL_UP, 0, 0, _level); + AddGuildNews(GUILD_NEWS_LEVEL_UP, ObjectGuid::Empty, 0, _level); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_GUILD_LEVEL, GetLevel(), 0, 0, NULL, source); ++oldLevel; @@ -3626,10 +3626,9 @@ void Guild::ResetTimes(bool weekly) } } -void Guild::AddGuildNews(uint8 type, uint64 guid, uint32 flags, uint32 value) +void Guild::AddGuildNews(uint8 type, ObjectGuid guid, uint32 flags, uint32 value) { - uint32 lowGuid = GUID_LOPART(guid); - NewsLogEntry* news = new NewsLogEntry(m_id, m_newsLog->GetNextGUID(), GuildNews(type), lowGuid, flags, value); + NewsLogEntry* news = new NewsLogEntry(m_id, m_newsLog->GetNextGUID(), GuildNews(type), guid, flags, value); SQLTransaction trans = CharacterDatabase.BeginTransaction(); m_newsLog->AddEvent(trans, news); |