Skip to content

Commit

Permalink
[10402] Use ObjectGuid in packets and fix some uint32 guids cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirMangos committed Aug 23, 2010
1 parent 649ac40 commit 9c83c79
Show file tree
Hide file tree
Showing 24 changed files with 77 additions and 82 deletions.
6 changes: 3 additions & 3 deletions src/game/AchievementMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ namespace MaNGOS

data << uint8(i_msgtype);
data << uint32(LANG_UNIVERSAL);
data << uint64(i_player.GetGUID());
data << i_player.GetObjectGuid();
data << uint32(5);
data << uint64(i_player.GetGUID());
data << i_player.GetObjectGuid();
data << uint32(strlen(text)+1);
data << text;
data << uint8(0);
Expand Down Expand Up @@ -639,7 +639,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
// broadcast realm first reached
WorldPacket data(SMSG_SERVER_FIRST_ACHIEVEMENT, strlen(GetPlayer()->GetName())+1+8+4+4);
data << GetPlayer()->GetName();
data << uint64(GetPlayer()->GetGUID());
data << GetPlayer()->GetObjectGuid();
data << uint32(achievement->ID);
data << uint32(0); // 1=link supplied string as player name, 0=display plain string
sWorld.SendGlobalMessage(&data);
Expand Down
4 changes: 2 additions & 2 deletions src/game/AuctionHouseMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,13 +687,13 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket & data) const
data << uint32(pItem->GetCount()); //item->count
data << uint32(pItem->GetSpellCharges()); //item->charge FFFFFFF
data << uint32(0); //Unknown
data << uint64(owner); //Auction->owner
data << ObjectGuid(HIGHGUID_PLAYER, owner); //Auction->owner
data << uint32(startbid); //Auction->startbid (not sure if useful)
data << uint32(bid ? GetAuctionOutBid() : 0);
//minimal outbid
data << uint32(buyout); //auction->buyout
data << uint32((expire_time-time(NULL))*IN_MILLISECONDS);//time left
data << uint64(bidder) ; //auction->bidder current
data << ObjectGuid(HIGHGUID_PLAYER, bidder); //auction->bidder current
data << uint32(bid); //current bid
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/BattleGroundMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ void BattleGroundMgr::BuildPlayerLeftBattleGroundPacket(WorldPacket *data, const
void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr)
{
data->Initialize(SMSG_BATTLEGROUND_PLAYER_JOINED, 8);
*data << uint64(plr->GetGUID());
*data << plr->GetObjectGuid();
}

BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId)
Expand Down
2 changes: 1 addition & 1 deletion src/game/Chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1948,7 +1948,7 @@ void ChatHandler::FillMessageData( WorldPacket *data, WorldSession* session, uin
case CHAT_MSG_RAID_BOSS_EMOTE:
case CHAT_MSG_BATTLENET:
{
*data << uint64(speaker->GetGUID());
*data << speaker->GetObjectGuid();
*data << uint32(0); // 2.1.0
*data << uint32(strlen(speaker->GetName()) + 1);
*data << speaker->GetName();
Expand Down
2 changes: 1 addition & 1 deletion src/game/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ void Creature::SendAIReaction(AiReaction reactionType)
{
WorldPacket data(SMSG_AI_REACTION, 12);

data << uint64(GetGUID());
data << GetObjectGuid();
data << uint32(reactionType);

((WorldObject*)this)->SendMessageToSet(&data, true);
Expand Down
2 changes: 1 addition & 1 deletion src/game/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ void Group::MasterLoot(Creature *creature, Loot* loot)

if (looter->IsWithinDist(creature, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false))
{
data << uint64(looter->GetGUID());
data << looter->GetObjectGuid();
++real_count;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/Group.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class MANGOS_DLL_SPEC Group
// member manipulation methods
bool IsMember(ObjectGuid guid) const { return _getMemberCSlot(guid) != m_memberSlots.end(); }
bool IsLeader(ObjectGuid guid) const { return GetLeaderGuid() == guid; }
ObjectGuid GetMemberGUID(const std::string& name)
ObjectGuid GetMemberGuid(const std::string& name)
{
for(member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
if (itr->name == name)
Expand Down
17 changes: 6 additions & 11 deletions src/game/GroupHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
if (!grp)
return;

ObjectGuid guid = grp->GetMemberGUID(membername);
ObjectGuid guid = grp->GetMemberGuid(membername);
if (!guid.IsEmpty())
{
Player::RemoveFromGroup(grp, guid);
Expand Down Expand Up @@ -426,7 +426,7 @@ void WorldSession::HandleMinimapPingOpcode(WorldPacket& recv_data)

// everything is fine, do it
WorldPacket data(MSG_MINIMAP_PING, (8+4+4));
data << uint64(GetPlayer()->GetGUID());
data << GetPlayer()->GetObjectGuid();
data << float(x);
data << float(y);
GetPlayer()->GetGroup()->BroadcastPacket(&data, true, -1, GetPlayer()->GetObjectGuid());
Expand All @@ -452,7 +452,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data)
data << uint32(minimum);
data << uint32(maximum);
data << uint32(roll);
data << uint64(GetPlayer()->GetGUID());
data << GetPlayer()->GetObjectGuid();
if(GetPlayer()->GetGroup())
GetPlayer()->GetGroup()->BroadcastPacket(&data, false);
else
Expand Down Expand Up @@ -630,7 +630,7 @@ void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )

// everything is fine, do it
WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
data << uint64(GetPlayer()->GetGUID());
data << GetPlayer()->GetObjectGuid();
data << uint8(state);
group->BroadcastReadyCheck(&data);
}
Expand Down Expand Up @@ -721,12 +721,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke

Pet *pet = player->GetPet();
if (mask & GROUP_UPDATE_FLAG_PET_GUID)
{
if(pet)
*data << uint64(pet->GetGUID());
else
*data << uint64(0);
}
*data << (pet ? pet->GetObjectGuid() : ObjectGuid());

if (mask & GROUP_UPDATE_FLAG_PET_NAME)
{
Expand Down Expand Up @@ -863,7 +858,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
if(pet)
{
Powers petpowertype = pet->getPowerType();
data << uint64(pet->GetGUID()); // GROUP_UPDATE_FLAG_PET_GUID
data << pet->GetObjectGuid(); // GROUP_UPDATE_FLAG_PET_GUID
data << pet->GetName(); // GROUP_UPDATE_FLAG_PET_NAME
data << uint16(pet->GetDisplayId()); // GROUP_UPDATE_FLAG_PET_MODEL_ID
data << uint32(pet->GetHealth()); // GROUP_UPDATE_FLAG_PET_CUR_HP
Expand Down
6 changes: 3 additions & 3 deletions src/game/Guild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ void Guild::Roster(WorldSession *session /*= NULL*/)
{
if (Player *pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first)))
{
data << uint64(pl->GetGUID());
data << pl->GetObjectGuid();
data << uint8(1);
data << pl->GetName();
data << uint32(itr->second.RankId);
Expand Down Expand Up @@ -838,10 +838,10 @@ void Guild::DisplayGuildEventLog(WorldSession *session)
// Event type
data << uint8(itr->EventType);
// Player 1
data << uint64(itr->PlayerGuid1);
data << ObjectGuid(HIGHGUID_PLAYER, itr->PlayerGuid1);
// Player 2 not for left/join guild events
if (itr->EventType != GUILD_EVENT_LOG_JOIN_GUILD && itr->EventType != GUILD_EVENT_LOG_LEAVE_GUILD)
data << uint64(itr->PlayerGuid2);
data << ObjectGuid(HIGHGUID_PLAYER, itr->PlayerGuid2);
// New Rank - only for promote/demote guild events
if (itr->EventType == GUILD_EVENT_LOG_PROMOTE_PLAYER || itr->EventType == GUILD_EVENT_LOG_DEMOTE_PLAYER)
data << uint8(itr->NewRank);
Expand Down
2 changes: 1 addition & 1 deletion src/game/LFGHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
++number;
data << uint64(plr->GetGUID()); // guid
data << plr->GetObjectGuid(); // guid
uint32 flags = 0x1FF;
data << uint32(flags); // flags
Expand Down
4 changes: 2 additions & 2 deletions src/game/MiscHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
dest.resize(destSize);

WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA, 8+4+4+4+destSize);
data << uint64(_player ? _player->GetGUID() : 0); // player guid
data << (_player ? _player->GetObjectGuid() : ObjectGuid());// player guid
data << uint32(type); // type (0-7)
data << uint32(adata->Time); // unix time
data << uint32(size); // decompressed length
Expand Down Expand Up @@ -1118,7 +1118,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data)
}

WorldPacket data(MSG_INSPECT_HONOR_STATS, 8+1+4*4);
data << uint64(player->GetGUID());
data << player->GetObjectGuid();
data << uint8(player->GetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY));
data << uint32(player->GetUInt32Value(PLAYER_FIELD_KILLS));
data << uint32(player->GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION));
Expand Down
2 changes: 1 addition & 1 deletion src/game/MovementHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recvdata*/)
//DEBUG_LOG("WORLD: Recvd CMSG_MOUNTSPECIAL_ANIM");

WorldPacket data(SMSG_MOUNTSPECIAL_ANIM, 8);
data << uint64(GetPlayer()->GetGUID());
data << GetPlayer()->GetObjectGuid();

GetPlayer()->SendMessageToSet(&data, false);
}
Expand Down
4 changes: 2 additions & 2 deletions src/game/NPCHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data )
SendPacket(&data);

data.Initialize(SMSG_PLAY_SPELL_IMPACT, 12); // visual effect on player
data << uint64(_player->GetGUID());
data << _player->GetObjectGuid();
data << uint32(0x016A); // index from SpellVisualKit.dbc
SendPacket(&data);

Expand Down Expand Up @@ -453,7 +453,7 @@ void WorldSession::SendBindPoint(Creature *npc)
npc->CastSpell(_player, 3286, true); // Bind

WorldPacket data( SMSG_TRAINER_BUY_SUCCEEDED, (8+4));
data << uint64(npc->GetGUID());
data << npc->GetObjectGuid();
data << uint32(3286); // Bind
SendPacket( &data );

Expand Down
4 changes: 2 additions & 2 deletions src/game/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void Object::DestroyForPlayer( Player *target, bool anim ) const
ASSERT(target);

WorldPacket data(SMSG_DESTROY_OBJECT, 8);
data << uint64(GetGUID());
data << GetObjectGuid();
data << uint8(anim ? 1 : 0); // WotLK (bool), may be despawn animation
target->GetSession()->SendPacket(&data);
}
Expand Down Expand Up @@ -1874,7 +1874,7 @@ void WorldObject::PlayDistanceSound( uint32 sound_id, Player* target /*= NULL*/
{
WorldPacket data(SMSG_PLAY_OBJECT_SOUND,4+8);
data << uint32(sound_id);
data << uint64(GetGUID());
data << GetObjectGuid();
if (target)
target->SendDirectMessage( &data );
else
Expand Down
2 changes: 1 addition & 1 deletion src/game/Pet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1987,7 +1987,7 @@ void Pet::ApplyModeFlags(PetModeFlags mode, bool apply)
return;

WorldPacket data(SMSG_PET_MODE, 12);
data << uint64(GetGUID());
data << GetObjectGuid();
data << uint32(m_petModeFlags);
((Player*)owner)->GetSession()->SendPacket(&data);
}
4 changes: 2 additions & 2 deletions src/game/PetitionsHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)

WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+1+signs*12));
data << uint64(petitionguid); // petition guid
data << uint64(_player->GetGUID()); // owner guid
data << _player->GetObjectGuid(); // owner guid
data << uint32(petitionguid_low); // guild guid (in mangos always same as GUID_LOPART(petitionguid)
data << uint8(signs); // sign's count

Expand Down Expand Up @@ -687,7 +687,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)

WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12));
data << uint64(petitionguid); // petition guid
data << uint64(_player->GetGUID()); // owner guid
data << _player->GetObjectGuid(); // owner guid
data << uint32(GUID_LOPART(petitionguid)); // guild guid (in mangos always same as GUID_LOPART(petition guid)
data << uint8(signs); // sign's count

Expand Down

2 comments on commit 9c83c79

@LordJZ
Copy link
Contributor

@LordJZ LordJZ commented on 9c83c79 Aug 23, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just getting better and better. Can't wait support for different player highguids. Thank you.

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I not think before changes that we still have so lot uint32 -> uint64 guid assign :/
I sure now that we still have more cases. Currently most old way guids used in spell code...

Please sign in to comment.