[11468] Finally remove all uses Object::GetGUID from core sources.

GetGUID() is now depricted function and will removed soon.
Still exist just for give time for update patches/scripts.
This commit is contained in:
VladimirMangos 2011-05-11 01:46:03 +04:00
parent 1e38db574a
commit 5ff698f53a
7 changed files with 214 additions and 215 deletions

View file

@ -22,7 +22,7 @@
#include "SocialMgr.h"
Channel::Channel(const std::string& name, uint32 channel_id)
: m_announce(true), m_moderate(false), m_name(name), m_flags(0), m_channelId(channel_id), m_ownerGUID(0)
: m_announce(true), m_moderate(false), m_name(name), m_flags(0), m_channelId(channel_id)
{
// set special flags if built-in channel
ChatChannelsEntry const* ch = GetChannelEntryFor(channel_id);
@ -50,10 +50,10 @@ Channel::Channel(const std::string& name, uint32 channel_id)
}
}
void Channel::Join(uint64 p, const char *pass)
void Channel::Join(ObjectGuid p, const char *pass)
{
WorldPacket data;
if(IsOn(p))
if (IsOn(p))
{
if(!IsConstant()) // non send error message for built-in channels
{
@ -63,7 +63,7 @@ void Channel::Join(uint64 p, const char *pass)
return;
}
if(IsBanned(p))
if (IsBanned(p))
{
MakeBanned(&data);
SendToOne(&data, p);
@ -102,10 +102,9 @@ void Channel::Join(uint64 p, const char *pass)
data.clear();
PlayerInfo pinfo;
PlayerInfo& pinfo = m_players[p];
pinfo.player = p;
pinfo.flags = 0;
players[p] = pinfo;
MakeYouJoined(&data);
SendToOne(&data, p);
@ -113,16 +112,16 @@ void Channel::Join(uint64 p, const char *pass)
JoinNotify(p);
// if no owner first logged will become
if(!IsConstant() && !m_ownerGUID)
if(!IsConstant() && m_ownerGuid.IsEmpty())
{
SetOwner(p, (players.size() > 1 ? true : false));
players[p].SetModerator(true);
SetOwner(p, (m_players.size() > 1 ? true : false));
m_players[p].SetModerator(true);
}
}
void Channel::Leave(uint64 p, bool send)
void Channel::Leave(ObjectGuid p, bool send)
{
if(!IsOn(p))
if (!IsOn(p))
{
if(send)
{
@ -145,9 +144,9 @@ void Channel::Leave(uint64 p, bool send)
data.clear();
}
bool changeowner = players[p].IsOwner();
bool changeowner = m_players[p].IsOwner();
players.erase(p);
m_players.erase(p);
if(m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_BOOL_SILENTLY_GM_JOIN_TO_CHANNEL) ))
{
WorldPacket data;
@ -159,26 +158,26 @@ void Channel::Leave(uint64 p, bool send)
if(changeowner)
{
uint64 newowner = !players.empty() ? players.begin()->second.player : 0;
ObjectGuid newowner = !m_players.empty() ? m_players.begin()->second.player : ObjectGuid();
SetOwner(newowner);
}
}
}
void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
void Channel::KickOrBan(ObjectGuid good, const char *badname, bool ban)
{
AccountTypes sec = SEC_PLAYER;
Player *gplr = sObjectMgr.GetPlayer(good);
if(gplr)
if (gplr)
sec = gplr->GetSession()->GetSecurity();
if(!IsOn(good))
if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
}
else if(!players[good].IsModerator() && sec < SEC_GAMEMASTER)
else if (!m_players[good].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@ -187,13 +186,13 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
else
{
Player *bad = sObjectMgr.GetPlayer(badname);
if(bad == NULL || !IsOn(bad->GetGUID()))
if (bad == NULL || !IsOn(bad->GetObjectGuid()))
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
SendToOne(&data, good);
}
else if(sec < SEC_GAMEMASTER && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID)
else if (sec < SEC_GAMEMASTER && bad->GetObjectGuid() == m_ownerGuid && good != m_ownerGuid)
{
WorldPacket data;
MakeNotOwner(&data);
@ -201,45 +200,45 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
}
else
{
bool changeowner = (m_ownerGUID == bad->GetGUID());
bool changeowner = (m_ownerGuid == bad->GetObjectGuid());
WorldPacket data;
if(ban && !IsBanned(bad->GetGUID()))
if(ban && !IsBanned(bad->GetObjectGuid()))
{
banned.insert(bad->GetGUID());
MakePlayerBanned(&data, bad->GetGUID(), good);
m_banned.insert(bad->GetObjectGuid());
MakePlayerBanned(&data, bad->GetObjectGuid(), good);
}
else
MakePlayerKicked(&data, bad->GetGUID(), good);
MakePlayerKicked(&data, bad->GetObjectGuid(), good);
SendToAll(&data);
players.erase(bad->GetGUID());
m_players.erase(bad->GetObjectGuid());
bad->LeftChannel(this);
if(changeowner)
{
uint64 newowner = !players.empty() ? good : false;
ObjectGuid newowner = !m_players.empty() ? good : ObjectGuid();
SetOwner(newowner);
}
}
}
}
void Channel::UnBan(uint64 good, const char *badname)
void Channel::UnBan(ObjectGuid good, const char *badname)
{
uint32 sec = 0;
Player *gplr = sObjectMgr.GetPlayer(good);
if(gplr)
sec = gplr->GetSession()->GetSecurity();
if(!IsOn(good))
if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
}
else if(!players[good].IsModerator() && sec < SEC_GAMEMASTER)
else if(!m_players[good].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@ -248,7 +247,7 @@ void Channel::UnBan(uint64 good, const char *badname)
else
{
Player *bad = sObjectMgr.GetPlayer(badname);
if(bad == NULL || !IsBanned(bad->GetGUID()))
if(bad == NULL || !IsBanned(bad->GetObjectGuid()))
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
@ -256,29 +255,29 @@ void Channel::UnBan(uint64 good, const char *badname)
}
else
{
banned.erase(bad->GetGUID());
m_banned.erase(bad->GetObjectGuid());
WorldPacket data;
MakePlayerUnbanned(&data, bad->GetGUID(), good);
MakePlayerUnbanned(&data, bad->GetObjectGuid(), good);
SendToAll(&data);
}
}
}
void Channel::Password(uint64 p, const char *pass)
void Channel::Password(ObjectGuid p, const char *pass)
{
uint32 sec = 0;
Player *plr = sObjectMgr.GetPlayer(p);
if(plr)
if (plr)
sec = plr->GetSession()->GetSecurity();
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
else if(!m_players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@ -294,7 +293,7 @@ void Channel::Password(uint64 p, const char *pass)
}
}
void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
void Channel::SetMode(ObjectGuid p, const char *p2n, bool mod, bool set)
{
Player *plr = sObjectMgr.GetPlayer(p);
if (!plr)
@ -302,13 +301,13 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
uint32 sec = plr->GetSession()->GetSecurity();
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
else if(!m_players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@ -325,11 +324,11 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
return;
}
PlayerInfo inf = players[newp->GetGUID()];
if(p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod)
PlayerInfo inf = m_players[newp->GetObjectGuid()];
if(p == m_ownerGuid && newp->GetObjectGuid() == m_ownerGuid && mod)
return;
if(!IsOn(newp->GetGUID()))
if (!IsOn(newp->GetObjectGuid()))
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
@ -348,7 +347,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
return;
}
if(m_ownerGUID == newp->GetGUID() && m_ownerGUID != p)
if(m_ownerGuid == newp->GetObjectGuid() && m_ownerGuid != p)
{
WorldPacket data;
MakeNotOwner(&data);
@ -357,13 +356,13 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
}
if(mod)
SetModerator(newp->GetGUID(), set);
SetModerator(newp->GetObjectGuid(), set);
else
SetMute(newp->GetGUID(), set);
SetMute(newp->GetObjectGuid(), set);
}
}
void Channel::SetOwner(uint64 p, const char *newname)
void Channel::SetOwner(ObjectGuid p, const char *newname)
{
Player *plr = sObjectMgr.GetPlayer(p);
if (!plr)
@ -371,7 +370,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
uint32 sec = plr->GetSession()->GetSecurity();
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@ -379,7 +378,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
return;
}
if(sec < SEC_GAMEMASTER && p != m_ownerGUID)
if(sec < SEC_GAMEMASTER && p != m_ownerGuid)
{
WorldPacket data;
MakeNotOwner(&data);
@ -388,7 +387,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
}
Player *newp = sObjectMgr.GetPlayer(newname);
if(newp == NULL || !IsOn(newp->GetGUID()))
if (newp == NULL || !IsOn(newp->GetObjectGuid()))
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
@ -404,13 +403,13 @@ void Channel::SetOwner(uint64 p, const char *newname)
return;
}
players[newp->GetGUID()].SetModerator(true);
SetOwner(newp->GetGUID());
m_players[newp->GetObjectGuid()].SetModerator(true);
SetOwner(newp->GetObjectGuid());
}
void Channel::SendWhoOwner(uint64 p)
void Channel::SendWhoOwner(ObjectGuid p)
{
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@ -426,9 +425,9 @@ void Channel::SendWhoOwner(uint64 p)
void Channel::List(Player* player)
{
uint64 p = player->GetGUID();
ObjectGuid p = player->GetObjectGuid();
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@ -436,7 +435,7 @@ void Channel::List(Player* player)
}
else
{
WorldPacket data(SMSG_CHANNEL_LIST, 1+(GetName().size()+1)+1+4+players.size()*(8+1));
WorldPacket data(SMSG_CHANNEL_LIST, 1+(GetName().size()+1)+1+4+m_players.size()*(8+1));
data << uint8(1); // channel type?
data << GetName(); // channel name
data << uint8(GetFlags()); // channel flags?
@ -447,7 +446,7 @@ void Channel::List(Player* player)
AccountTypes gmLevelInWhoList = (AccountTypes)sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_WHO_LIST);
uint32 count = 0;
for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
for(PlayerList::const_iterator i = m_players.begin(); i != m_players.end(); ++i)
{
Player *plr = sObjectMgr.GetPlayer(i->first);
@ -456,7 +455,7 @@ void Channel::List(Player* player)
if (plr && (player->GetSession()->GetSecurity() > SEC_PLAYER || plr->GetSession()->GetSecurity() <= gmLevelInWhoList) &&
plr->IsVisibleGloballyFor(player))
{
data << uint64(i->first);
data << ObjectGuid(i->first);
data << uint8(i->second.flags); // flags seems to be changed...
++count;
}
@ -468,20 +467,20 @@ void Channel::List(Player* player)
}
}
void Channel::Announce(uint64 p)
void Channel::Announce(ObjectGuid p)
{
uint32 sec = 0;
Player *plr = sObjectMgr.GetPlayer(p);
if(plr)
sec = plr->GetSession()->GetSecurity();
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
else if (!m_players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@ -500,20 +499,20 @@ void Channel::Announce(uint64 p)
}
}
void Channel::Moderate(uint64 p)
void Channel::Moderate(ObjectGuid p)
{
uint32 sec = 0;
Player *plr = sObjectMgr.GetPlayer(p);
if(plr)
sec = plr->GetSession()->GetSecurity();
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
else if (!m_players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@ -532,9 +531,9 @@ void Channel::Moderate(uint64 p)
}
}
void Channel::Say(uint64 p, const char *what, uint32 lang)
void Channel::Say(ObjectGuid p, const char *what, uint32 lang)
{
if(!what)
if (!what)
return;
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
lang = LANG_UNIVERSAL;
@ -544,19 +543,19 @@ void Channel::Say(uint64 p, const char *what, uint32 lang)
if(plr)
sec = plr->GetSession()->GetSecurity();
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
else if(players[p].IsMuted())
else if (m_players[p].IsMuted())
{
WorldPacket data;
MakeMuted(&data);
SendToOne(&data, p);
}
else if(m_moderate && !players[p].IsModerator() && sec < SEC_GAMEMASTER)
else if (m_moderate && !m_players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@ -567,23 +566,23 @@ void Channel::Say(uint64 p, const char *what, uint32 lang)
uint32 messageLength = strlen(what) + 1;
WorldPacket data(SMSG_MESSAGECHAT, 1+4+8+4+m_name.size()+1+8+4+messageLength+1);
data << (uint8)CHAT_MSG_CHANNEL;
data << (uint32)lang;
data << p; // 2.1.0
data << uint8(CHAT_MSG_CHANNEL);
data << uint32(lang);
data << ObjectGuid(p); // 2.1.0
data << uint32(0); // 2.1.0
data << m_name;
data << p;
data << messageLength;
data << ObjectGuid(p);
data << uint32(messageLength);
data << what;
data << uint8(plr ? plr->chatTag() : 0);
SendToAll(&data, !players[p].IsModerator() ? p : 0);
SendToAll(&data, !m_players[p].IsModerator() ? p : ObjectGuid());
}
}
void Channel::Invite(uint64 p, const char *newname)
void Channel::Invite(ObjectGuid p, const char *newname)
{
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@ -612,16 +611,16 @@ void Channel::Invite(uint64 p, const char *newname)
return;
}
if(IsOn(newp->GetGUID()))
if (IsOn(newp->GetObjectGuid()))
{
WorldPacket data;
MakePlayerAlreadyMember(&data, newp->GetGUID());
MakePlayerAlreadyMember(&data, newp->GetObjectGuid());
SendToOne(&data, p);
return;
}
WorldPacket data;
if(!newp->GetSocial()->HasIgnore(p))
if (!newp->GetSocial()->HasIgnore(p))
{
MakeInvite(&data, p);
SendToOne(&data, newp->GetObjectGuid());
@ -631,39 +630,39 @@ void Channel::Invite(uint64 p, const char *newname)
SendToOne(&data, p);
}
void Channel::SetOwner(uint64 guid, bool exclaim)
void Channel::SetOwner(ObjectGuid guid, bool exclaim)
{
if(m_ownerGUID)
if (!m_ownerGuid.IsEmpty())
{
// [] will re-add player after it possible removed
PlayerList::iterator p_itr = players.find(m_ownerGUID);
if(p_itr != players.end())
PlayerList::iterator p_itr = m_players.find(m_ownerGuid);
if (p_itr != m_players.end())
p_itr->second.SetOwner(false);
}
m_ownerGUID = guid;
if(m_ownerGUID)
m_ownerGuid = guid;
if (!m_ownerGuid.IsEmpty())
{
uint8 oldFlag = GetPlayerFlags(m_ownerGUID);
players[m_ownerGUID].SetOwner(true);
uint8 oldFlag = GetPlayerFlags(m_ownerGuid);
m_players[m_ownerGuid].SetOwner(true);
WorldPacket data;
MakeModeChange(&data, m_ownerGUID, oldFlag);
MakeModeChange(&data, m_ownerGuid, oldFlag);
SendToAll(&data);
if(exclaim)
{
MakeOwnerChanged(&data, m_ownerGUID);
MakeOwnerChanged(&data, m_ownerGuid);
SendToAll(&data);
}
}
}
void Channel::SendToAll(WorldPacket *data, uint64 p)
void Channel::SendToAll(WorldPacket *data, ObjectGuid p)
{
for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
for(PlayerList::const_iterator i = m_players.begin(); i != m_players.end(); ++i)
if (Player *plr = sObjectMgr.GetPlayer(i->first))
if(!p || !plr->GetSocial()->HasIgnore(p))
if (p.IsEmpty() || !plr->GetSocial()->HasIgnore(p))
plr->GetSession()->SendPacket(data);
}
@ -692,17 +691,17 @@ void Channel::MakeNotifyPacket(WorldPacket *data, uint8 notify_type)
}
// done 0x00
void Channel::MakeJoined(WorldPacket *data, uint64 guid)
void Channel::MakeJoined(WorldPacket *data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_JOINED_NOTICE);
*data << uint64(guid);
*data << ObjectGuid(guid);
}
// done 0x01
void Channel::MakeLeft(WorldPacket *data, uint64 guid)
void Channel::MakeLeft(WorldPacket *data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_LEFT_NOTICE);
*data << uint64(guid);
*data << ObjectGuid(guid);
}
// done 0x02
@ -741,17 +740,17 @@ void Channel::MakeNotModerator(WorldPacket *data)
}
// done 0x07
void Channel::MakePasswordChanged(WorldPacket *data, uint64 guid)
void Channel::MakePasswordChanged(WorldPacket *data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_PASSWORD_CHANGED_NOTICE);
*data << uint64(guid);
*data << ObjectGuid(guid);
}
// done 0x08
void Channel::MakeOwnerChanged(WorldPacket *data, uint64 guid)
void Channel::MakeOwnerChanged(WorldPacket *data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_OWNER_CHANGED_NOTICE);
*data << uint64(guid);
*data << ObjectGuid(guid);
}
// done 0x09
@ -772,48 +771,48 @@ void Channel::MakeChannelOwner(WorldPacket *data)
{
std::string name = "";
if(!sObjectMgr.GetPlayerNameByGUID(m_ownerGUID, name) || name.empty())
if (!sObjectMgr.GetPlayerNameByGUID(m_ownerGuid, name) || name.empty())
name = "PLAYER_NOT_FOUND";
MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE);
*data << ((IsConstant() || !m_ownerGUID) ? "Nobody" : name);
*data << ((IsConstant() || m_ownerGuid.IsEmpty()) ? "Nobody" : name);
}
// done 0x0C
void Channel::MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags)
void Channel::MakeModeChange(WorldPacket *data, ObjectGuid guid, uint8 oldflags)
{
MakeNotifyPacket(data, CHAT_MODE_CHANGE_NOTICE);
*data << uint64(guid);
*data << ObjectGuid(guid);
*data << uint8(oldflags);
*data << uint8(GetPlayerFlags(guid));
}
// done 0x0D
void Channel::MakeAnnouncementsOn(WorldPacket *data, uint64 guid)
void Channel::MakeAnnouncementsOn(WorldPacket *data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_ON_NOTICE);
*data << uint64(guid);
*data << ObjectGuid(guid);
}
// done 0x0E
void Channel::MakeAnnouncementsOff(WorldPacket *data, uint64 guid)
void Channel::MakeAnnouncementsOff(WorldPacket *data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_OFF_NOTICE);
*data << uint64(guid);
*data << ObjectGuid(guid);
}
// done 0x0F
void Channel::MakeModerationOn(WorldPacket *data, uint64 guid)
void Channel::MakeModerationOn(WorldPacket *data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_MODERATION_ON_NOTICE);
*data << uint64(guid);
*data << ObjectGuid(guid);
}
// done 0x10
void Channel::MakeModerationOff(WorldPacket *data, uint64 guid)
void Channel::MakeModerationOff(WorldPacket *data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_MODERATION_OFF_NOTICE);
*data << uint64(guid);
*data << ObjectGuid(guid);
}
// done 0x11
@ -823,11 +822,11 @@ void Channel::MakeMuted(WorldPacket *data)
}
// done 0x12
void Channel::MakePlayerKicked(WorldPacket *data, uint64 bad, uint64 good)
void Channel::MakePlayerKicked(WorldPacket *data, ObjectGuid bad, ObjectGuid good)
{
MakeNotifyPacket(data, CHAT_PLAYER_KICKED_NOTICE);
*data << uint64(bad);
*data << uint64(good);
*data << ObjectGuid(bad);
*data << ObjectGuid(good);
}
// done 0x13
@ -837,40 +836,40 @@ void Channel::MakeBanned(WorldPacket *data)
}
// done 0x14
void Channel::MakePlayerBanned(WorldPacket *data, uint64 bad, uint64 good)
void Channel::MakePlayerBanned(WorldPacket *data, ObjectGuid bad, ObjectGuid good)
{
MakeNotifyPacket(data, CHAT_PLAYER_BANNED_NOTICE);
*data << uint64(bad);
*data << uint64(good);
*data << ObjectGuid(bad);
*data << ObjectGuid(good);
}
// done 0x15
void Channel::MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good)
void Channel::MakePlayerUnbanned(WorldPacket *data, ObjectGuid bad, ObjectGuid good)
{
MakeNotifyPacket(data, CHAT_PLAYER_UNBANNED_NOTICE);
*data << uint64(bad);
*data << uint64(good);
*data << ObjectGuid(bad);
*data << ObjectGuid(good);
}
// done 0x16
void Channel::MakePlayerNotBanned(WorldPacket *data, uint64 guid)
void Channel::MakePlayerNotBanned(WorldPacket *data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE);
*data << uint64(guid); // should be string!!
*data << ObjectGuid(guid); // should be string!!
}
// done 0x17
void Channel::MakePlayerAlreadyMember(WorldPacket *data, uint64 guid)
void Channel::MakePlayerAlreadyMember(WorldPacket *data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_PLAYER_ALREADY_MEMBER_NOTICE);
*data << uint64(guid);
*data << ObjectGuid(guid);
}
// done 0x18
void Channel::MakeInvite(WorldPacket *data, uint64 guid)
void Channel::MakeInvite(WorldPacket *data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_INVITE_NOTICE);
*data << uint64(guid);
*data << ObjectGuid(guid);
}
// done 0x19
@ -943,16 +942,16 @@ void Channel::MakeVoiceOff(WorldPacket *data, uint64 guid)
*data << uint64(guid);
}
void Channel::JoinNotify(uint64 guid)
void Channel::JoinNotify(ObjectGuid guid)
{
WorldPacket data;
if(IsConstant())
if (IsConstant())
data.Initialize(SMSG_USERLIST_ADD, 8+1+1+4+GetName().size()+1);
else
data.Initialize(SMSG_USERLIST_UPDATE, 8+1+1+4+GetName().size()+1);
data << uint64(guid);
data << ObjectGuid(guid);
data << uint8(GetPlayerFlags(guid));
data << uint8(GetFlags());
data << uint32(GetNumPlayers());
@ -960,10 +959,10 @@ void Channel::JoinNotify(uint64 guid)
SendToAll(&data);
}
void Channel::LeaveNotify(uint64 guid)
void Channel::LeaveNotify(ObjectGuid guid)
{
WorldPacket data(SMSG_USERLIST_REMOVE, 8+1+4+GetName().size()+1);
data << uint64(guid);
data << ObjectGuid(guid);
data << uint8(GetFlags());
data << uint32(GetNumPlayers());
data << GetName();

View file

@ -121,7 +121,7 @@ class Channel
struct PlayerInfo
{
uint64 player;
ObjectGuid player;
uint8 flags;
bool HasFlag(uint8 flag) { return flags & flag; }
@ -156,64 +156,64 @@ class Channel
std::string GetPassword() const { return m_password; }
void SetPassword(const std::string& npassword) { m_password = npassword; }
void SetAnnounce(bool nannounce) { m_announce = nannounce; }
uint32 GetNumPlayers() const { return players.size(); }
uint32 GetNumPlayers() const { return m_players.size(); }
uint8 GetFlags() const { return m_flags; }
bool HasFlag(uint8 flag) { return m_flags & flag; }
void Join(uint64 p, const char *pass);
void Leave(uint64 p, bool send = true);
void KickOrBan(uint64 good, const char *badname, bool ban);
void Kick(uint64 good, const char *badname) { KickOrBan(good, badname, false); }
void Ban(uint64 good, const char *badname) { KickOrBan(good, badname, true); }
void UnBan(uint64 good, const char *badname);
void Password(uint64 p, const char *pass);
void SetMode(uint64 p, const char *p2n, bool mod, bool set);
void SetOwner(uint64 p, bool exclaim = true);
void SetOwner(uint64 p, const char *newname);
void SendWhoOwner(uint64 p);
void SetModerator(uint64 p, const char *newname) { SetMode(p, newname, true, true); }
void UnsetModerator(uint64 p, const char *newname) { SetMode(p, newname, true, false); }
void SetMute(uint64 p, const char *newname) { SetMode(p, newname, false, true); }
void UnsetMute(uint64 p, const char *newname) { SetMode(p, newname, false, false); }
void Join(ObjectGuid p, const char *pass);
void Leave(ObjectGuid p, bool send = true);
void KickOrBan(ObjectGuid good, const char *badname, bool ban);
void Kick(ObjectGuid good, const char *badname) { KickOrBan(good, badname, false); }
void Ban(ObjectGuid good, const char *badname) { KickOrBan(good, badname, true); }
void UnBan(ObjectGuid good, const char *badname);
void Password(ObjectGuid p, const char *pass);
void SetMode(ObjectGuid p, const char *p2n, bool mod, bool set);
void SetOwner(ObjectGuid p, bool exclaim = true);
void SetOwner(ObjectGuid p, const char *newname);
void SendWhoOwner(ObjectGuid p);
void SetModerator(ObjectGuid p, const char *newname) { SetMode(p, newname, true, true); }
void UnsetModerator(ObjectGuid p, const char *newname) { SetMode(p, newname, true, false); }
void SetMute(ObjectGuid p, const char *newname) { SetMode(p, newname, false, true); }
void UnsetMute(ObjectGuid p, const char *newname) { SetMode(p, newname, false, false); }
void List(Player* p);
void Announce(uint64 p);
void Moderate(uint64 p);
void Say(uint64 p, const char *what, uint32 lang);
void Invite(uint64 p, const char *newp);
void Announce(ObjectGuid p);
void Moderate(ObjectGuid p);
void Say(ObjectGuid p, const char *what, uint32 lang);
void Invite(ObjectGuid p, const char *newp);
void Voice(uint64 guid1, uint64 guid2);
void DeVoice(uint64 guid1, uint64 guid2);
void JoinNotify(uint64 guid); // invisible notify
void LeaveNotify(uint64 guid); // invisible notify
void JoinNotify(ObjectGuid guid); // invisible notify
void LeaveNotify(ObjectGuid guid); // invisible notify
private:
// initial packet data (notify type and channel name)
void MakeNotifyPacket(WorldPacket *data, uint8 notify_type);
// type specific packet data
void MakeJoined(WorldPacket *data, uint64 guid); //+ 0x00
void MakeLeft(WorldPacket *data, uint64 guid); //+ 0x01
void MakeJoined(WorldPacket *data, ObjectGuid guid); //+ 0x00
void MakeLeft(WorldPacket *data, ObjectGuid guid); //+ 0x01
void MakeYouJoined(WorldPacket *data); //+ 0x02
void MakeYouLeft(WorldPacket *data); //+ 0x03
void MakeWrongPassword(WorldPacket *data); //? 0x04
void MakeNotMember(WorldPacket *data); //? 0x05
void MakeNotModerator(WorldPacket *data); //? 0x06
void MakePasswordChanged(WorldPacket *data, uint64 guid); //+ 0x07
void MakeOwnerChanged(WorldPacket *data, uint64 guid); //? 0x08
void MakePasswordChanged(WorldPacket *data, ObjectGuid guid); //+ 0x07
void MakeOwnerChanged(WorldPacket *data, ObjectGuid guid); //? 0x08
void MakePlayerNotFound(WorldPacket *data, const std::string& name); //+ 0x09
void MakeNotOwner(WorldPacket *data); //? 0x0A
void MakeChannelOwner(WorldPacket *data); //? 0x0B
void MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags); //+ 0x0C
void MakeAnnouncementsOn(WorldPacket *data, uint64 guid); //+ 0x0D
void MakeAnnouncementsOff(WorldPacket *data, uint64 guid); //+ 0x0E
void MakeModerationOn(WorldPacket *data, uint64 guid); //+ 0x0F
void MakeModerationOff(WorldPacket *data, uint64 guid); //+ 0x10
void MakeModeChange(WorldPacket *data, ObjectGuid guid, uint8 oldflags);//+ 0x0C
void MakeAnnouncementsOn(WorldPacket *data, ObjectGuid guid); //+ 0x0D
void MakeAnnouncementsOff(WorldPacket *data, ObjectGuid guid); //+ 0x0E
void MakeModerationOn(WorldPacket *data, ObjectGuid guid); //+ 0x0F
void MakeModerationOff(WorldPacket *data, ObjectGuid guid); //+ 0x10
void MakeMuted(WorldPacket *data); //? 0x11
void MakePlayerKicked(WorldPacket *data, uint64 bad, uint64 good); //? 0x12
void MakePlayerKicked(WorldPacket *data, ObjectGuid bad, ObjectGuid good);//? 0x12
void MakeBanned(WorldPacket *data); //? 0x13
void MakePlayerBanned(WorldPacket *data, uint64 bad, uint64 good); //? 0x14
void MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good); //? 0x15
void MakePlayerNotBanned(WorldPacket *data, uint64 guid); //? 0x16
void MakePlayerAlreadyMember(WorldPacket *data, uint64 guid); //+ 0x17
void MakeInvite(WorldPacket *data, uint64 guid); //? 0x18
void MakePlayerBanned(WorldPacket *data, ObjectGuid bad, ObjectGuid good);//? 0x14
void MakePlayerUnbanned(WorldPacket *data, ObjectGuid bad, ObjectGuid good);//? 0x15
void MakePlayerNotBanned(WorldPacket *data, ObjectGuid guid); //? 0x16
void MakePlayerAlreadyMember(WorldPacket *data, ObjectGuid guid); //+ 0x17
void MakeInvite(WorldPacket *data, ObjectGuid guid); //? 0x18
void MakeInviteWrongFaction(WorldPacket *data); //? 0x19
void MakeWrongFaction(WorldPacket *data); //? 0x1A
void MakeInvalidName(WorldPacket *data); //? 0x1B
@ -226,27 +226,27 @@ class Channel
void MakeVoiceOn(WorldPacket *data, uint64 guid); //+ 0x22
void MakeVoiceOff(WorldPacket *data, uint64 guid); //+ 0x23
void SendToAll(WorldPacket *data, uint64 p = 0);
void SendToAll(WorldPacket *data, ObjectGuid p = ObjectGuid());
void SendToOne(WorldPacket *data, ObjectGuid who);
bool IsOn(uint64 who) const { return players.find(who) != players.end(); }
bool IsBanned(uint64 guid) const { return banned.find(guid) != banned.end(); }
bool IsOn(ObjectGuid who) const { return m_players.find(who) != m_players.end(); }
bool IsBanned(ObjectGuid guid) const { return m_banned.find(guid) != m_banned.end(); }
uint8 GetPlayerFlags(uint64 p) const
uint8 GetPlayerFlags(ObjectGuid p) const
{
PlayerList::const_iterator p_itr = players.find(p);
if(p_itr == players.end())
PlayerList::const_iterator p_itr = m_players.find(p);
if (p_itr == m_players.end())
return 0;
return p_itr->second.flags;
}
void SetModerator(uint64 p, bool set)
void SetModerator(ObjectGuid p, bool set)
{
if(players[p].IsModerator() != set)
if (m_players[p].IsModerator() != set)
{
uint8 oldFlag = GetPlayerFlags(p);
players[p].SetModerator(set);
m_players[p].SetModerator(set);
WorldPacket data;
MakeModeChange(&data, p, oldFlag);
@ -254,12 +254,12 @@ class Channel
}
}
void SetMute(uint64 p, bool set)
void SetMute(ObjectGuid p, bool set)
{
if(players[p].IsMuted() != set)
if (m_players[p].IsMuted() != set)
{
uint8 oldFlag = GetPlayerFlags(p);
players[p].SetMuted(set);
m_players[p].SetMuted(set);
WorldPacket data;
MakeModeChange(&data, p, oldFlag);
@ -274,11 +274,11 @@ class Channel
std::string m_password;
uint8 m_flags;
uint32 m_channelId;
uint64 m_ownerGUID;
ObjectGuid m_ownerGuid;
typedef std::map<uint64, PlayerInfo> PlayerList;
PlayerList players;
typedef std::set<uint64> BannedList;
BannedList banned;
typedef std::map<ObjectGuid, PlayerInfo> PlayerList;
PlayerList m_players;
typedef std::set<ObjectGuid> BannedList;
BannedList m_banned;
};
#endif

View file

@ -36,7 +36,7 @@ void WorldSession::HandleJoinChannelOpcode(WorldPacket& recvPacket)
recvPacket >> pass;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetJoinChannel(channelname, channel_id))
chn->Join(_player->GetGUID(), pass.c_str());
chn->Join(_player->GetObjectGuid(), pass.c_str());
}
void WorldSession::HandleLeaveChannelOpcode(WorldPacket& recvPacket)
@ -55,7 +55,7 @@ void WorldSession::HandleLeaveChannelOpcode(WorldPacket& recvPacket)
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
if(Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Leave(_player->GetGUID(), true);
chn->Leave(_player->GetObjectGuid(), true);
cMgr->LeftChannel(channelname);
}
}
@ -83,7 +83,7 @@ void WorldSession::HandleChannelPasswordOpcode(WorldPacket& recvPacket)
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Password(_player->GetGUID(), pass.c_str());
chn->Password(_player->GetObjectGuid(), pass.c_str());
}
void WorldSession::HandleChannelSetOwnerOpcode(WorldPacket& recvPacket)
@ -100,7 +100,7 @@ void WorldSession::HandleChannelSetOwnerOpcode(WorldPacket& recvPacket)
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
chn->SetOwner(_player->GetGUID(), newp.c_str());
chn->SetOwner(_player->GetObjectGuid(), newp.c_str());
}
void WorldSession::HandleChannelOwnerOpcode(WorldPacket& recvPacket)
@ -111,7 +111,7 @@ void WorldSession::HandleChannelOwnerOpcode(WorldPacket& recvPacket)
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
chn->SendWhoOwner(_player->GetGUID());
chn->SendWhoOwner(_player->GetObjectGuid());
}
void WorldSession::HandleChannelModeratorOpcode(WorldPacket& recvPacket)
@ -128,7 +128,7 @@ void WorldSession::HandleChannelModeratorOpcode(WorldPacket& recvPacket)
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
chn->SetModerator(_player->GetGUID(), otp.c_str());
chn->SetModerator(_player->GetObjectGuid(), otp.c_str());
}
void WorldSession::HandleChannelUnmoderatorOpcode(WorldPacket& recvPacket)
@ -145,7 +145,7 @@ void WorldSession::HandleChannelUnmoderatorOpcode(WorldPacket& recvPacket)
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
chn->UnsetModerator(_player->GetGUID(), otp.c_str());
chn->UnsetModerator(_player->GetObjectGuid(), otp.c_str());
}
void WorldSession::HandleChannelMuteOpcode(WorldPacket& recvPacket)
@ -162,7 +162,7 @@ void WorldSession::HandleChannelMuteOpcode(WorldPacket& recvPacket)
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
chn->SetMute(_player->GetGUID(), otp.c_str());
chn->SetMute(_player->GetObjectGuid(), otp.c_str());
}
void WorldSession::HandleChannelUnmuteOpcode(WorldPacket& recvPacket)
@ -180,7 +180,7 @@ void WorldSession::HandleChannelUnmuteOpcode(WorldPacket& recvPacket)
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
chn->UnsetMute(_player->GetGUID(), otp.c_str());
chn->UnsetMute(_player->GetObjectGuid(), otp.c_str());
}
void WorldSession::HandleChannelInviteOpcode(WorldPacket& recvPacket)
@ -197,7 +197,7 @@ void WorldSession::HandleChannelInviteOpcode(WorldPacket& recvPacket)
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Invite(_player->GetGUID(), otp.c_str());
chn->Invite(_player->GetObjectGuid(), otp.c_str());
}
void WorldSession::HandleChannelKickOpcode(WorldPacket& recvPacket)
@ -213,7 +213,7 @@ void WorldSession::HandleChannelKickOpcode(WorldPacket& recvPacket)
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Kick(_player->GetGUID(), otp.c_str());
chn->Kick(_player->GetObjectGuid(), otp.c_str());
}
void WorldSession::HandleChannelBanOpcode(WorldPacket& recvPacket)
@ -230,7 +230,7 @@ void WorldSession::HandleChannelBanOpcode(WorldPacket& recvPacket)
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Ban(_player->GetGUID(), otp.c_str());
chn->Ban(_player->GetObjectGuid(), otp.c_str());
}
void WorldSession::HandleChannelUnbanOpcode(WorldPacket& recvPacket)
@ -248,7 +248,7 @@ void WorldSession::HandleChannelUnbanOpcode(WorldPacket& recvPacket)
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
chn->UnBan(_player->GetGUID(), otp.c_str());
chn->UnBan(_player->GetObjectGuid(), otp.c_str());
}
void WorldSession::HandleChannelAnnouncementsOpcode(WorldPacket& recvPacket)
@ -259,7 +259,7 @@ void WorldSession::HandleChannelAnnouncementsOpcode(WorldPacket& recvPacket)
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Announce(_player->GetGUID());
chn->Announce(_player->GetObjectGuid());
}
void WorldSession::HandleChannelModerateOpcode(WorldPacket& recvPacket)
@ -270,7 +270,7 @@ void WorldSession::HandleChannelModerateOpcode(WorldPacket& recvPacket)
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Moderate(_player->GetGUID());
chn->Moderate(_player->GetObjectGuid());
}
void WorldSession::HandleChannelDisplayListQueryOpcode(WorldPacket &recvPacket)

View file

@ -444,7 +444,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channel, _player))
chn->Say(_player->GetGUID(), msg.c_str(), lang);
chn->Say(_player->GetObjectGuid(), msg.c_str(), lang);
} break;
case CHAT_MSG_AFK:

View file

@ -138,7 +138,7 @@ class MANGOS_DLL_SPEC Object
}
ObjectGuid const& GetObjectGuid() const { return GetGuidValue(OBJECT_FIELD_GUID); }
const uint64& GetGUID() const { return GetUInt64Value(OBJECT_FIELD_GUID); }
const uint64& GetGUID() const { return GetUInt64Value(OBJECT_FIELD_GUID); } // DEPRICATED, not use, will removed soon
uint32 GetGUIDLow() const { return GetObjectGuid().GetCounter(); }
PackedGuid const& GetPackGUID() const { return m_PackGUID; }
std::string GetGuidStr() const { return GetObjectGuid().GetString(); }

View file

@ -4921,11 +4921,11 @@ void Player::LeftChannel(Channel *c)
void Player::CleanupChannels()
{
while(!m_channels.empty())
while (!m_channels.empty())
{
Channel* ch = *m_channels.begin();
m_channels.erase(m_channels.begin()); // remove from player's channel list
ch->Leave(GetGUID(), false); // not send to client, not remove from player's channel list
ch->Leave(GetObjectGuid(), false); // not send to client, not remove from player's channel list
if (ChannelMgr* cMgr = channelMgr(GetTeam()))
cMgr->LeftChannel(ch->GetName()); // deleted channel if empty
@ -4968,12 +4968,12 @@ void Player::UpdateLocalChannels(uint32 newZone )
snprintf(new_channel_name_buf,100,ch->pattern[m_session->GetSessionDbcLocale()],current_zone_name.c_str());
Channel* new_channel = cMgr->GetJoinChannel(new_channel_name_buf,ch->ChannelID);
if((*i)!=new_channel)
if ((*i)!=new_channel)
{
new_channel->Join(GetGUID(),""); // will output Changed Channel: N. Name
new_channel->Join(GetObjectGuid(),""); // will output Changed Channel: N. Name
// leave old channel
(*i)->Leave(GetGUID(),false); // not send leave channel, it already replaced at client
(*i)->Leave(GetObjectGuid(),false); // not send leave channel, it already replaced at client
std::string name = (*i)->GetName(); // store name, (*i)erase in LeftChannel
LeftChannel(*i); // remove from player's channel list
cMgr->LeftChannel(name); // delete if empty
@ -4986,9 +4986,9 @@ void Player::LeaveLFGChannel()
{
for(JoinedChannelsList::iterator i = m_channels.begin(); i != m_channels.end(); ++i )
{
if((*i)->IsLFG())
if ((*i)->IsLFG())
{
(*i)->Leave(GetGUID());
(*i)->Leave(GetObjectGuid());
break;
}
}
@ -19907,7 +19907,7 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* targe
template<class T>
inline void UpdateVisibilityOf_helper(ObjectGuidSet& s64, T* target)
{
s64.insert(target->GetGUID());
s64.insert(target->GetObjectGuid());
}
template<>

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11467"
#define REVISION_NR "11468"
#endif // __REVISION_NR_H__