feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)

This commit is contained in:
UltraNix
2021-04-25 22:18:03 +02:00
committed by GitHub
parent 91081f4ad8
commit f4c226423d
568 changed files with 10655 additions and 11019 deletions

View File

@@ -22,7 +22,6 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId,
_channelId(channelId),
_channelDBId(channelDBId),
_teamId(teamId),
_ownerGUID(0),
_name(name),
_password("")
{
@@ -81,9 +80,9 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId,
}
}
bool Channel::IsBanned(uint64 guid) const
bool Channel::IsBanned(ObjectGuid guid) const
{
BannedContainer::const_iterator itr = bannedStore.find(GUID_LOPART(guid));
BannedContainer::const_iterator itr = bannedStore.find(guid);
return itr != bannedStore.end() && itr->second > time(nullptr);
}
@@ -110,20 +109,20 @@ void Channel::UpdateChannelUseageInDB() const
CharacterDatabase.Execute(stmt);
}
void Channel::AddChannelBanToDB(uint32 guid, uint32 time) const
void Channel::AddChannelBanToDB(ObjectGuid guid, uint32 time) const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL_BAN);
stmt->setUInt32(0, _channelDBId);
stmt->setUInt32(1, guid);
stmt->setUInt32(1, guid.GetCounter());
stmt->setUInt32(2, time);
CharacterDatabase.Execute(stmt);
}
void Channel::RemoveChannelBanFromDB(uint32 guid) const
void Channel::RemoveChannelBanFromDB(ObjectGuid guid) const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHANNEL_BAN);
stmt->setUInt32(0, _channelDBId);
stmt->setUInt32(1, guid);
stmt->setUInt32(1, guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -146,7 +145,7 @@ void Channel::CleanOldChannelsInDB()
void Channel::JoinChannel(Player* player, std::string const& pass)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
if (IsOn(guid))
{
// Do not send error message for built-in channels
@@ -243,7 +242,7 @@ void Channel::JoinChannel(Player* player, std::string const& pass)
void Channel::LeaveChannel(Player* player, bool send)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
if (send)
@@ -288,7 +287,7 @@ void Channel::LeaveChannel(Player* player, bool send)
{
if (!playersStore.empty())
{
uint64 newowner = 0;
ObjectGuid newowner;
for (Channel::PlayerContainer::const_iterator itr = playersStore.begin(); itr != playersStore.end(); ++itr)
{
newowner = itr->second.player;
@@ -303,7 +302,7 @@ void Channel::LeaveChannel(Player* player, bool send)
// if the new owner is invisible gm, set flag to automatically choose a new owner
}
else
SetOwner(0);
SetOwner(ObjectGuid::Empty);
}
}
}
@@ -311,7 +310,7 @@ void Channel::LeaveChannel(Player* player, bool send)
void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban)
{
AccountTypes sec = player->GetSession()->GetSecurity();
uint64 good = player->GetGUID();
ObjectGuid good = player->GetGUID();
if (!IsOn(good))
{
@@ -332,7 +331,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
bool banOffline = false; // pussywizard
bool isGoodConstantModerator = _channelRights.moderators.find(player->GetSession()->GetAccountId()) != _channelRights.moderators.end();
uint64 victim = 0;
ObjectGuid victim;
uint32 badAccId = 0;
uint32 badSecurity = 0;
Player* bad = ObjectAccessor::FindPlayerByName(badname, false);
@@ -348,13 +347,13 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
{
if (ban && (AccountMgr::IsGMAccount(sec) || isGoodConstantModerator))
{
if (uint32 lowGuid = sWorld->GetGlobalPlayerGUID(badname))
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(lowGuid))
if (ObjectGuid guid = sWorld->GetGlobalPlayerGUID(badname))
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(guid.GetCounter()))
{
if (Player::TeamIdForRace(gpd->race) == Player::TeamIdForRace(player->getRace()))
{
banOffline = true;
victim = MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER);
victim = guid;
badAccId = gpd->accountId;
}
else
@@ -417,8 +416,8 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
{
if (!IsBanned(victim))
{
bannedStore[GUID_LOPART(victim)] = time(nullptr) + CHANNEL_BAN_DURATION;
AddChannelBanToDB(GUID_LOPART(victim), time(nullptr) + CHANNEL_BAN_DURATION);
bannedStore[victim] = time(nullptr) + CHANNEL_BAN_DURATION;
AddChannelBanToDB(victim, time(nullptr) + CHANNEL_BAN_DURATION);
if (notify)
{
@@ -449,7 +448,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
SetOwner(good);
else if (!playersStore.empty())
{
uint64 newowner = 0;
ObjectGuid newowner;
for (Channel::PlayerContainer::const_iterator itr = playersStore.begin(); itr != playersStore.end(); ++itr)
{
newowner = itr->second.player;
@@ -459,14 +458,14 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
SetOwner(newowner);
}
else
SetOwner(0);
SetOwner(ObjectGuid::Empty);
}
}
void Channel::UnBan(Player const* player, std::string const& badname)
{
uint32 sec = player->GetSession()->GetSecurity();
uint64 good = player->GetGUID();
ObjectGuid good = player->GetGUID();
if (!IsOn(good))
{
@@ -484,9 +483,9 @@ void Channel::UnBan(Player const* player, std::string const& badname)
return;
}
uint64 victim = 0;
if (uint32 guidLow = sWorld->GetGlobalPlayerGUID(badname))
victim = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
ObjectGuid victim;
if (ObjectGuid guid = sWorld->GetGlobalPlayerGUID(badname))
victim = guid;
if (!victim || !IsBanned(victim))
{
@@ -509,27 +508,29 @@ void Channel::UnBan(Player const* player, std::string const& badname)
}
if (_channelRights.flags & CHANNEL_RIGHT_CANT_BAN)
LOG_GM(player->GetSession()->GetAccountId(), "Command: /unban %s %s (Moderator %s [guid: %u, account: %u] unbanned %s [guid: %u])", GetName().c_str(), badname.c_str(), player->GetName().c_str(), player->GetGUIDLow(), player->GetSession()->GetAccountId(), badname.c_str(), GUID_LOPART(victim));
LOG_GM(player->GetSession()->GetAccountId(), "Command: /unban %s %s (Moderator %s [%s, account: %u] unbanned %s [%s])",
GetName().c_str(), badname.c_str(), player->GetName().c_str(), player->GetGUID().ToString().c_str(), player->GetSession()->GetAccountId(),
badname.c_str(), victim.ToString().c_str());
bannedStore.erase(GUID_LOPART(victim));
RemoveChannelBanFromDB(GUID_LOPART(victim));
bannedStore.erase(victim);
RemoveChannelBanFromDB(victim);
WorldPacket data;
MakePlayerUnbanned(&data, victim, good);
SendToAll(&data);
}
void Channel::UnBan(uint64 guid)
void Channel::UnBan(ObjectGuid guid)
{
if (!IsBanned(guid))
return;
bannedStore.erase(GUID_LOPART(guid));
RemoveChannelBanFromDB(GUID_LOPART(guid));
bannedStore.erase(guid);
RemoveChannelBanFromDB(guid);
}
void Channel::Password(Player const* player, std::string const& pass)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
ChatHandler chat(player->GetSession());
if (!IsOn(guid))
@@ -567,7 +568,7 @@ void Channel::Password(Player const* player, std::string const& pass)
void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
uint32 sec = player->GetSession()->GetSecurity();
if (!IsOn(guid))
@@ -590,7 +591,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
return;
Player* newp = ObjectAccessor::FindPlayerByName(p2n, false);
uint64 victim = newp ? newp->GetGUID() : 0;
ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty;
if (!victim || !IsOn(victim) ||
// allow make moderator from another team only if both is GMs
@@ -638,7 +639,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
void Channel::SetOwner(Player const* player, std::string const& newname)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
uint32 sec = player->GetSession()->GetSecurity();
if (!IsOn(guid))
@@ -659,7 +660,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
}
Player* newp = ObjectAccessor::FindPlayerByName(newname, false);
uint64 victim = newp ? newp->GetGUID() : 0;
ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty;
if (!victim || !IsOn(victim) || (newp->GetTeamId() != player->GetTeamId() &&
!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)))
@@ -673,7 +674,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
SetOwner(victim);
}
void Channel::SendWhoOwner(uint64 guid)
void Channel::SendWhoOwner(ObjectGuid guid)
{
WorldPacket data;
if (IsOn(guid))
@@ -685,7 +686,7 @@ void Channel::SendWhoOwner(uint64 guid)
void Channel::List(Player const* player)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
@@ -711,7 +712,7 @@ void Channel::List(Player const* player)
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
if (AccountMgr::IsPlayerAccount(i->second.plrPtr->GetSession()->GetSecurity()))
{
data << uint64(i->first);
data << i->first;
data << uint8(i->second.flags); // flags seems to be changed...
++count;
}
@@ -723,7 +724,7 @@ void Channel::List(Player const* player)
void Channel::Announce(Player const* player)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
uint32 sec = player->GetSession()->GetSecurity();
if (!IsOn(guid))
@@ -762,7 +763,7 @@ void Channel::Announce(Player const* player)
UpdateChannelInDB();
}
void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
void Channel::Say(ObjectGuid guid, std::string const& what, uint32 lang)
{
if (what.empty())
return;
@@ -814,7 +815,7 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
else
ChatHandler::BuildChatPacket(data, CHAT_MSG_CHANNEL, Language(lang), guid, guid, what, 0, "", "", 0, false, _name);
SendToAll(&data, pinfo.IsModerator() ? 0 : guid);
SendToAll(&data, pinfo.IsModerator() ? ObjectGuid::Empty : guid);
}
void Channel::EveryoneSayToSelf(const char* what)
@@ -845,7 +846,7 @@ void Channel::EveryoneSayToSelf(const char* what)
void Channel::Invite(Player const* player, std::string const& newname)
{
uint64 guid = player->GetGUID();
ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
@@ -888,7 +889,7 @@ void Channel::Invite(Player const* player, std::string const& newname)
return;
}
if (!newp->GetSocial()->HasIgnore(GUID_LOPART(guid)))
if (!newp->GetSocial()->HasIgnore(guid))
{
WorldPacket data;
MakeInvite(&data, guid);
@@ -901,7 +902,7 @@ void Channel::Invite(Player const* player, std::string const& newname)
SendToOne(&data, guid);
}
void Channel::SetOwner(uint64 guid, bool exclaim)
void Channel::SetOwner(ObjectGuid guid, bool exclaim)
{
if (_ownerGUID)
{
@@ -950,23 +951,23 @@ void Channel::SetOwner(uint64 guid, bool exclaim)
}
}
void Channel::SendToAll(WorldPacket* data, uint64 guid)
void Channel::SendToAll(WorldPacket* data, ObjectGuid guid)
{
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
if (!guid || !i->second.plrPtr->GetSocial()->HasIgnore(GUID_LOPART(guid)))
if (!guid || !i->second.plrPtr->GetSocial()->HasIgnore(guid))
i->second.plrPtr->GetSession()->SendPacket(data);
}
void Channel::SendToAllButOne(WorldPacket* data, uint64 who)
void Channel::SendToAllButOne(WorldPacket* data, ObjectGuid who)
{
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
if (i->first != who)
i->second.plrPtr->GetSession()->SendPacket(data);
}
void Channel::SendToOne(WorldPacket* data, uint64 who)
void Channel::SendToOne(WorldPacket* data, ObjectGuid who)
{
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(who))
if (Player* player = ObjectAccessor::FindConnectedPlayer(who))
player->GetSession()->SendPacket(data);
}
@@ -976,11 +977,11 @@ void Channel::SendToAllWatching(WorldPacket* data)
(*i)->GetSession()->SendPacket(data);
}
void Channel::Voice(uint64 /*guid1*/, uint64 /*guid2*/)
void Channel::Voice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
{
}
void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/)
void Channel::DeVoice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
{
}
@@ -991,16 +992,16 @@ void Channel::MakeNotifyPacket(WorldPacket* data, uint8 notify_type)
*data << _name;
}
void Channel::MakeJoined(WorldPacket* data, uint64 guid)
void Channel::MakeJoined(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_JOINED_NOTICE);
*data << uint64(guid);
*data << guid;
}
void Channel::MakeLeft(WorldPacket* data, uint64 guid)
void Channel::MakeLeft(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_LEFT_NOTICE);
*data << uint64(guid);
*data << guid;
}
void Channel::MakeYouJoined(WorldPacket* data)
@@ -1033,16 +1034,16 @@ void Channel::MakeNotModerator(WorldPacket* data)
MakeNotifyPacket(data, CHAT_NOT_MODERATOR_NOTICE);
}
void Channel::MakePasswordChanged(WorldPacket* data, uint64 guid)
void Channel::MakePasswordChanged(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_PASSWORD_CHANGED_NOTICE);
*data << uint64(guid);
*data << guid;
}
void Channel::MakeOwnerChanged(WorldPacket* data, uint64 guid)
void Channel::MakeOwnerChanged(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_OWNER_CHANGED_NOTICE);
*data << uint64(guid);
*data << guid;
}
void Channel::MakePlayerNotFound(WorldPacket* data, std::string const& name)
@@ -1060,31 +1061,31 @@ void Channel::MakeChannelOwner(WorldPacket* data)
{
std::string name = "";
if (!sObjectMgr->GetPlayerNameByGUID(_ownerGUID, name) || name.empty())
if (!sObjectMgr->GetPlayerNameByGUID(_ownerGUID.GetCounter(), name) || name.empty())
name = "PLAYER_NOT_FOUND";
MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE);
*data << ((IsConstant() || !_ownerGUID) ? "Nobody" : name);
}
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 << guid;
*data << uint8(oldflags);
*data << uint8(GetPlayerFlags(guid));
}
void Channel::MakeAnnouncementsOn(WorldPacket* data, uint64 guid)
void Channel::MakeAnnouncementsOn(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_ON_NOTICE);
*data << uint64(guid);
*data << guid;
}
void Channel::MakeAnnouncementsOff(WorldPacket* data, uint64 guid)
void Channel::MakeAnnouncementsOff(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_OFF_NOTICE);
*data << uint64(guid);
*data << guid;
}
void Channel::MakeMuted(WorldPacket* data)
@@ -1092,11 +1093,11 @@ void Channel::MakeMuted(WorldPacket* data)
MakeNotifyPacket(data, CHAT_MUTED_NOTICE);
}
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 << bad;
*data << good;
}
void Channel::MakeBanned(WorldPacket* data)
@@ -1104,18 +1105,18 @@ void Channel::MakeBanned(WorldPacket* data)
MakeNotifyPacket(data, CHAT_BANNED_NOTICE);
}
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 << bad;
*data << good;
}
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 << bad;
*data << good;
}
void Channel::MakePlayerNotBanned(WorldPacket* data, const std::string& name)
@@ -1124,16 +1125,16 @@ void Channel::MakePlayerNotBanned(WorldPacket* data, const std::string& name)
*data << name;
}
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 << guid;
}
void Channel::MakeInvite(WorldPacket* data, uint64 guid)
void Channel::MakeInvite(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_INVITE_NOTICE);
*data << uint64(guid);
*data << guid;
}
void Channel::MakeInviteWrongFaction(WorldPacket* data)
@@ -1183,16 +1184,16 @@ void Channel::MakeNotInLfg(WorldPacket* data)
MakeNotifyPacket(data, CHAT_NOT_IN_LFG_NOTICE);
}
void Channel::MakeVoiceOn(WorldPacket* data, uint64 guid)
void Channel::MakeVoiceOn(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_VOICE_ON_NOTICE);
*data << uint64(guid);
*data << guid;
}
void Channel::MakeVoiceOff(WorldPacket* data, uint64 guid)
void Channel::MakeVoiceOff(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_VOICE_OFF_NOTICE);
*data << uint64(guid);
*data << guid;
}
void Channel::JoinNotify(Player* p)
@@ -1203,7 +1204,7 @@ void Channel::JoinNotify(Player* p)
return;
WorldPacket data(SMSG_USERLIST_ADD, 8 + 1 + 1 + 4 + GetName().size());
data << uint64(p->GetGUID());
data << p->GetGUID();
data << uint8(GetPlayerFlags(p->GetGUID()));
data << uint8(GetFlags());
data << uint32(GetNumPlayers());
@@ -1220,7 +1221,7 @@ void Channel::LeaveNotify(Player* p)
return;
WorldPacket data(SMSG_USERLIST_REMOVE, 8 + 1 + 4 + GetName().size());
data << uint64(p->GetGUID());
data << p->GetGUID();
data << uint8(GetFlags());
data << uint32(GetNumPlayers());
data << GetName();
@@ -1236,7 +1237,7 @@ void Channel::FlagsNotify(Player* p)
return;
WorldPacket data(SMSG_USERLIST_UPDATE, 8 + 1 + 1 + 4 + GetName().size());
data << uint64(p->GetGUID());
data << p->GetGUID();
data << uint8(GetPlayerFlags(p->GetGUID()));
data << uint8(GetFlags());
data << uint32(GetNumPlayers());
@@ -1261,7 +1262,7 @@ void Channel::RemoveWatching(Player* p)
void Channel::ToggleModeration(Player* player)
{
uint64 guid = player->GetGUIDLow();
ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
@@ -1298,14 +1299,14 @@ void Channel::ToggleModeration(Player* player)
SendToAll(&data);
}
void Channel::MakeModerationOn(WorldPacket* data, uint64 guid)
void Channel::MakeModerationOn(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_MODERATION_ON_NOTICE);
*data << uint64(guid);
*data << guid;
}
void Channel::MakeModerationOff(WorldPacket* data, uint64 guid)
void Channel::MakeModerationOff(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_MODERATION_OFF_NOTICE);
*data << uint64(guid);
*data << guid;
}

View File

@@ -135,7 +135,7 @@ class Channel
{
struct PlayerInfo
{
uint64 player;
ObjectGuid player;
uint8 flags;
uint64 lastSpeakTime; // pussywizard
Player* plrPtr; // pussywizard
@@ -194,25 +194,25 @@ public:
void KickOrBan(Player const* player, std::string const& badname, bool ban);
void Kick(Player const* player, std::string const& badname) { KickOrBan(player, badname, false); }
void Ban(Player const* player, std::string const& badname) { KickOrBan(player, badname, true); }
void AddBan(uint32 guid, uint32 time) { bannedStore[guid] = time; }
void AddBan(ObjectGuid guid, uint32 time) { bannedStore[guid] = time; }
void UnBan(Player const* player, std::string const& badname);
void UnBan(uint64 guid);
void UnBan(ObjectGuid guid);
void Password(Player const* player, std::string const& pass);
void SetMode(Player const* player, std::string const& p2n, bool mod, bool set);
void SetOwner(uint64 guid, bool exclaim = true);
void SetOwner(ObjectGuid guid, bool exclaim = true);
void SetOwner(Player const* player, std::string const& name);
void SendWhoOwner(uint64 guid);
void SendWhoOwner(ObjectGuid guid);
void SetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, true); }
void UnsetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, false); }
void SetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, true); }
void UnsetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, false); }
void List(Player const* player);
void Announce(Player const* player);
void Say(uint64 guid, std::string const& what, uint32 lang);
void Say(ObjectGuid guid, std::string const& what, uint32 lang);
void EveryoneSayToSelf(const char* what);
void Invite(Player const* player, std::string const& newp);
void Voice(uint64 guid1, uint64 guid2);
void DeVoice(uint64 guid1, uint64 guid2);
void Voice(ObjectGuid guid1, ObjectGuid guid2);
void DeVoice(ObjectGuid guid1, ObjectGuid guid2);
void JoinNotify(Player* p);
void LeaveNotify(Player* p);
void FlagsNotify(Player* p);
@@ -227,63 +227,63 @@ 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 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 MakePlayerNotFound(WorldPacket* data, std::string const& 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 MakeMuted(WorldPacket* data); //? 0x11
void MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 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, std::string const& name); //? 0x16
void MakePlayerAlreadyMember(WorldPacket* data, uint64 guid); //+ 0x17
void MakeInvite(WorldPacket* data, uint64 guid); //? 0x18
void MakeInviteWrongFaction(WorldPacket* data); //? 0x19
void MakeWrongFaction(WorldPacket* data); //? 0x1A
void MakeInvalidName(WorldPacket* data); //? 0x1B
void MakeNotModerated(WorldPacket* data); //? 0x1C
void MakePlayerInvited(WorldPacket* data, std::string const& name); //+ 0x1D
void MakePlayerInviteBanned(WorldPacket* data, std::string const& name);//? 0x1E
void MakeThrottled(WorldPacket* data); //? 0x1F
void MakeNotInArea(WorldPacket* data); //? 0x20
void MakeNotInLfg(WorldPacket* data); //? 0x21
void MakeVoiceOn(WorldPacket* data, uint64 guid); //+ 0x22
void MakeVoiceOff(WorldPacket* data, uint64 guid); //+ 0x23
void MakeModerationOn(WorldPacket* data, uint64 guid);
void MakeModerationOff(WorldPacket* data, uint64 guid);
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, ObjectGuid guid); //+ 0x07
void MakeOwnerChanged(WorldPacket* data, ObjectGuid guid); //? 0x08
void MakePlayerNotFound(WorldPacket* data, std::string const& name); //+ 0x09
void MakeNotOwner(WorldPacket* data); //? 0x0A
void MakeChannelOwner(WorldPacket* data); //? 0x0B
void MakeModeChange(WorldPacket* data, ObjectGuid guid, uint8 oldflags); //+ 0x0C
void MakeAnnouncementsOn(WorldPacket* data, ObjectGuid guid); //+ 0x0D
void MakeAnnouncementsOff(WorldPacket* data, ObjectGuid guid); //+ 0x0E
void MakeMuted(WorldPacket* data); //? 0x11
void MakePlayerKicked(WorldPacket* data, ObjectGuid bad, ObjectGuid good); //? 0x12
void MakeBanned(WorldPacket* data); //? 0x13
void MakePlayerBanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good); //? 0x14
void MakePlayerUnbanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good);//? 0x15
void MakePlayerNotBanned(WorldPacket* data, std::string const& name); //? 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
void MakeNotModerated(WorldPacket* data); //? 0x1C
void MakePlayerInvited(WorldPacket* data, std::string const& name); //+ 0x1D
void MakePlayerInviteBanned(WorldPacket* data, std::string const& name); //? 0x1E
void MakeThrottled(WorldPacket* data); //? 0x1F
void MakeNotInArea(WorldPacket* data); //? 0x20
void MakeNotInLfg(WorldPacket* data); //? 0x21
void MakeVoiceOn(WorldPacket* data, ObjectGuid guid); //+ 0x22
void MakeVoiceOff(WorldPacket* data, ObjectGuid guid); //+ 0x23
void MakeModerationOn(WorldPacket* data, ObjectGuid guid);
void MakeModerationOff(WorldPacket* data, ObjectGuid guid);
void SendToAll(WorldPacket* data, uint64 guid = 0);
void SendToAllButOne(WorldPacket* data, uint64 who);
void SendToOne(WorldPacket* data, uint64 who);
void SendToAll(WorldPacket* data, ObjectGuid guid = ObjectGuid::Empty);
void SendToAllButOne(WorldPacket* data, ObjectGuid who);
void SendToOne(WorldPacket* data, ObjectGuid who);
void SendToAllWatching(WorldPacket* data);
bool IsOn(uint64 who) const { return playersStore.find(who) != playersStore.end(); }
bool IsBanned(uint64 guid) const;
bool IsOn(ObjectGuid who) const { return playersStore.find(who) != playersStore.end(); }
bool IsBanned(ObjectGuid guid) const;
void UpdateChannelInDB() const;
void UpdateChannelUseageInDB() const;
void AddChannelBanToDB(uint32 guid, uint32 time) const;
void RemoveChannelBanFromDB(uint32 guid) const;
void AddChannelBanToDB(ObjectGuid guid, uint32 time) const;
void RemoveChannelBanFromDB(ObjectGuid guid) const;
uint8 GetPlayerFlags(uint64 guid) const
uint8 GetPlayerFlags(ObjectGuid guid) const
{
PlayerContainer::const_iterator itr = playersStore.find(guid);
return itr != playersStore.end() ? itr->second.flags : 0;
}
void SetModerator(uint64 guid, bool set)
void SetModerator(ObjectGuid guid, bool set)
{
PlayerInfo& pinfo = playersStore[guid];
if (pinfo.IsModerator() != set)
@@ -299,7 +299,7 @@ private:
}
}
void SetMute(uint64 guid, bool set)
void SetMute(ObjectGuid guid, bool set)
{
PlayerInfo& pinfo = playersStore[guid];
if (pinfo.IsMuted() != set)
@@ -313,8 +313,8 @@ private:
}
}
typedef std::unordered_map<uint64, PlayerInfo> PlayerContainer;
typedef std::unordered_map<uint32, uint32> BannedContainer;
typedef std::unordered_map<ObjectGuid, PlayerInfo> PlayerContainer;
typedef std::unordered_map<ObjectGuid, uint32> BannedContainer;
typedef std::unordered_set<Player*> PlayersWatchingContainer;
bool _announce;
@@ -326,7 +326,7 @@ private:
uint32 _channelId;
uint32 _channelDBId;
TeamId _teamId;
uint64 _ownerGUID;
ObjectGuid _ownerGUID;
std::string _name;
std::string _password;
ChannelRights _channelRights;

View File

@@ -69,7 +69,7 @@ void ChannelMgr::LoadChannels()
Field* banFields = banResult->Fetch();
if (!banFields)
break;
newChannel->AddBan(banFields[0].GetUInt32(), banFields[1].GetUInt32());
newChannel->AddBan(ObjectGuid::Create<HighGuid::Player>(banFields[0].GetUInt32()), banFields[1].GetUInt32());
} while (banResult->NextRow());
}

View File

@@ -79,7 +79,7 @@ bool ChatHandler::isAvailable(ChatCommand const& cmd) const
return m_session->GetSecurity() >= AccountTypes(cmd.SecurityLevel);
}
bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong)
bool ChatHandler::HasLowerSecurity(Player* target, ObjectGuid guid, bool strong)
{
WorldSession* target_session = nullptr;
uint32 target_account = 0;
@@ -87,7 +87,7 @@ bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong)
if (target)
target_session = target->GetSession();
else if (guid)
target_account = sObjectMgr->GetPlayerAccountIdByGUID(guid);
target_account = sObjectMgr->GetPlayerAccountIdByGUID(guid.GetCounter());
if (!target_session && !target_account)
{
@@ -304,7 +304,7 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
Player* player = m_session->GetPlayer();
if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity()))
{
uint64 guid = player->GetTarget();
ObjectGuid guid = player->GetTarget();
uint32 areaId = player->GetAreaId();
std::string areaName = "Unknown";
std::string zoneName = "Unknown";
@@ -316,20 +316,14 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
zoneName = zone->area_name[locale];
}
LOG_GM(m_session->GetAccountId(), "Command: %s [Player: %s (%u) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected: %s (%ul)]",
fullcmd.c_str(),
player->GetName().c_str(),
GUID_LOPART(player->GetGUID()),
m_session->GetAccountId(),
player->GetPositionX(),
player->GetPositionY(),
player->GetPositionZ(),
player->GetMapId(),
player->GetMap()->GetMapName(),
areaId, areaName.c_str(),
zoneName.c_str(),
(player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "",
GUID_LOPART(guid));
LOG_GM(m_session->GetAccountId(), "Command: %s [Player: %s (%s) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected: %s (%s)]",
fullcmd.c_str(), player->GetName().c_str(), player->GetGUID().ToString().c_str(),
m_session->GetAccountId(), player->GetPositionX(), player->GetPositionY(),
player->GetPositionZ(), player->GetMapId(),
player->GetMap()->GetMapName(),
areaId, areaName.c_str(), zoneName.c_str(),
(player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "",
guid.ToString().c_str());
}
}
// some commands have custom error messages. Don't send the default one in these cases.
@@ -601,7 +595,7 @@ bool ChatHandler::ShowHelpForCommand(std::vector<ChatCommand> const& table, cons
return ShowHelpForSubCommands(table, "", cmd);
}
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, uint64 senderGUID, uint64 receiverGUID, std::string const& message, uint8 chatTag,
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string const& message, uint8 chatTag,
std::string const& senderName /*= ""*/, std::string const& receiverName /*= ""*/,
uint32 achievementId /*= 0*/, bool gmMessage /*= false*/, std::string const& channelName /*= ""*/)
{
@@ -609,7 +603,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
data.Initialize(!gmMessage ? SMSG_MESSAGECHAT : SMSG_GM_MESSAGECHAT);
data << uint8(chatType);
data << int32(language);
data << uint64(senderGUID);
data << senderGUID;
data << uint32(0); // some flags
switch (chatType)
{
@@ -624,8 +618,8 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
data << uint32(senderName.length() + 1);
data << senderName;
receiverGUIDPos = data.wpos();
data << uint64(receiverGUID);
if (receiverGUID && !IS_PLAYER_GUID(receiverGUID) && !IS_PET_GUID(receiverGUID))
data << receiverGUID;
if (receiverGUID && !receiverGUID.IsPlayer() && !receiverGUID.IsPet())
{
data << uint32(receiverName.length() + 1);
data << receiverName;
@@ -635,14 +629,14 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
data << uint32(senderName.length() + 1);
data << senderName;
receiverGUIDPos = data.wpos();
data << uint64(receiverGUID);
data << receiverGUID;
break;
case CHAT_MSG_BG_SYSTEM_NEUTRAL:
case CHAT_MSG_BG_SYSTEM_ALLIANCE:
case CHAT_MSG_BG_SYSTEM_HORDE:
receiverGUIDPos = data.wpos();
data << uint64(receiverGUID);
if (receiverGUID && !IS_PLAYER_GUID(receiverGUID))
data << receiverGUID;
if (receiverGUID && !receiverGUID.IsPlayer())
{
data << uint32(receiverName.length() + 1);
data << receiverName;
@@ -651,7 +645,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
case CHAT_MSG_ACHIEVEMENT:
case CHAT_MSG_GUILD_ACHIEVEMENT:
receiverGUIDPos = data.wpos();
data << uint64(receiverGUID);
data << receiverGUID;
break;
default:
if (gmMessage)
@@ -667,7 +661,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
}
receiverGUIDPos = data.wpos();
data << uint64(receiverGUID);
data << receiverGUID;
break;
}
@@ -684,11 +678,11 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string const& message,
uint32 achievementId /*= 0*/, std::string const& channelName /*= ""*/, LocaleConstant locale /*= DEFAULT_LOCALE*/)
{
uint64 senderGUID = 0;
ObjectGuid senderGUID;
std::string senderName = "";
uint8 chatTag = 0;
bool gmMessage = false;
uint64 receiverGUID = 0;
ObjectGuid receiverGUID;
std::string receiverName = "";
if (sender)
{
@@ -715,11 +709,11 @@ Player* ChatHandler::getSelectedPlayer()
if (!m_session)
return nullptr;
uint64 selected = m_session->GetPlayer()->GetTarget();
ObjectGuid selected = m_session->GetPlayer()->GetTarget();
if (!selected)
return m_session->GetPlayer();
return ObjectAccessor::FindPlayerInOrOutOfWorld(selected);
return ObjectAccessor::FindConnectedPlayer(selected);
}
Unit* ChatHandler::getSelectedUnit()
@@ -738,9 +732,9 @@ WorldObject* ChatHandler::getSelectedObject()
if (!m_session)
return nullptr;
uint64 guid = m_session->GetPlayer()->GetTarget();
ObjectGuid guid = m_session->GetPlayer()->GetTarget();
if (guid == 0)
if (!guid)
return GetNearbyGameObject();
return ObjectAccessor::GetUnit(*m_session->GetPlayer(), guid);
@@ -759,12 +753,12 @@ Player* ChatHandler::getSelectedPlayerOrSelf()
if (!m_session)
return nullptr;
uint64 selected = m_session->GetPlayer()->GetTarget();
ObjectGuid selected = m_session->GetPlayer()->GetTarget();
if (!selected)
return m_session->GetPlayer();
// first try with selected target
Player* targetPlayer = ObjectAccessor::FindPlayerInOrOutOfWorld(selected);
Player* targetPlayer = ObjectAccessor::FindConnectedPlayer(selected);
// if the target is not a player, then return self
if (!targetPlayer)
targetPlayer = m_session->GetPlayer();
@@ -897,29 +891,35 @@ GameObject* ChatHandler::GetNearbyGameObject()
return obj;
}
GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry)
Creature* ChatHandler::GetCreatureFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid)
{
if (!m_session)
return nullptr;
Player* pl = m_session->GetPlayer();
// Select the first alive creature or a dead one if not found
Creature* creature = nullptr;
GameObject* obj = pl->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT));
if (!obj && sObjectMgr->GetGOData(lowguid)) // guid is DB guid of object
auto bounds = m_session->GetPlayer()->GetMap()->GetCreatureBySpawnIdStore().equal_range(lowguid);
for (auto it = bounds.first; it != bounds.second; ++it)
{
// search near player then
CellCoord p(acore::ComputeCellCoord(pl->GetPositionX(), pl->GetPositionY()));
Cell cell(p);
acore::GameObjectWithDbGUIDCheck go_check(lowguid);
acore::GameObjectSearcher<acore::GameObjectWithDbGUIDCheck> checker(pl, obj, go_check);
TypeContainerVisitor<acore::GameObjectSearcher<acore::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker);
cell.Visit(p, object_checker, *pl->GetMap(), *pl, pl->GetGridActivationRange());
creature = it->second;
if (it->second->IsAlive())
break;
}
return obj;
return creature;
}
GameObject* ChatHandler::GetObjectFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid)
{
if (!m_session)
return nullptr;
auto bounds = m_session->GetPlayer()->GetMap()->GetGameObjectBySpawnIdStore().equal_range(lowguid);
if (bounds.first != bounds.second)
return bounds.first->second;
return nullptr;
}
enum SpellLinkType
@@ -1025,7 +1025,7 @@ static char const* const guidKeys[] =
0
};
uint64 ChatHandler::extractGuidFromLink(char* text)
ObjectGuid::LowType ChatHandler::extractLowGuidFromLink(char* text, HighGuid& guidHigh)
{
int type = 0;
@@ -1040,33 +1040,39 @@ uint64 ChatHandler::extractGuidFromLink(char* text)
{
case SPELL_LINK_PLAYER:
{
guidHigh = HighGuid::Player;
std::string name = idS;
if (!normalizePlayerName(name))
return 0;
if (Player* player = ObjectAccessor::FindPlayerByName(name, false))
return player->GetGUID();
return player->GetGUID().GetCounter();
if (uint64 guid = sObjectMgr->GetPlayerGUIDByName(name))
return guid;
if (ObjectGuid guid = sObjectMgr->GetPlayerGUIDByName(name))
return guid.GetCounter();
return 0;
}
case SPELL_LINK_CREATURE:
{
uint32 lowguid = (uint32)atol(idS);
guidHigh = HighGuid::Unit;
if (CreatureData const* data = sObjectMgr->GetCreatureData(lowguid))
return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT);
ObjectGuid::LowType lowguid = (uint32)atol(idS);
if (sObjectMgr->GetCreatureData(lowguid))
return lowguid;
else
return 0;
}
case SPELL_LINK_GAMEOBJECT:
{
uint32 lowguid = (uint32)atol(idS);
guidHigh = HighGuid::GameObject;
if (GameObjectData const* data = sObjectMgr->GetGOData(lowguid))
return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_GAMEOBJECT);
ObjectGuid::LowType lowguid = (uint32)atol(idS);
if (sObjectMgr->GetGOData(lowguid))
return lowguid;
else
return 0;
}
@@ -1090,7 +1096,7 @@ std::string ChatHandler::extractPlayerNameFromLink(char* text)
return name;
}
bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* player_guid /*=nullptr*/, std::string* player_name /*= nullptr*/)
bool ChatHandler::extractPlayerTarget(char* args, Player** player, ObjectGuid* player_guid /*=nullptr*/, std::string* player_name /*= nullptr*/)
{
if (args && *args)
{
@@ -1109,7 +1115,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe
*player = pl;
// if need guid value from DB (in name case for check player existence)
uint64 guid = !pl && (player_guid || player_name) ? sObjectMgr->GetPlayerGUIDByName(name) : 0;
ObjectGuid guid = !pl && (player_guid || player_name) ? sObjectMgr->GetPlayerGUIDByName(name) : ObjectGuid::Empty;
// if allowed player guid (if no then only online players allowed)
if (player_guid)
@@ -1126,7 +1132,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe
*player = pl;
// if allowed player guid (if no then only online players allowed)
if (player_guid)
*player_guid = pl ? pl->GetGUID() : 0;
*player_guid = pl ? pl->GetGUID() : ObjectGuid::Empty;
if (player_name)
*player_name = pl ? pl->GetName() : "";
@@ -1249,10 +1255,10 @@ bool CliHandler::needReportToTarget(Player* /*chr*/) const
return true;
}
bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, uint64& guid, bool offline)
bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline)
{
player = nullptr;
guid = 0;
player = nullptr;
guid = ObjectGuid::Empty;
if (cname)
{

View File

@@ -45,7 +45,7 @@ public:
virtual ~ChatHandler() { }
// Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders
static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, uint64 senderGUID, uint64 receiverGUID, std::string const& message, uint8 chatTag,
static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string const& message, uint8 chatTag,
std::string const& senderName = "", std::string const& receiverName = "",
uint32 achievementId = 0, bool gmMessage = false, std::string const& channelName = "");
@@ -79,7 +79,7 @@ public:
virtual LocaleConstant GetSessionDbcLocale() const;
virtual int GetSessionDbLocaleIndex() const;
bool HasLowerSecurity(Player* target, uint64 guid, bool strong = false);
bool HasLowerSecurity(Player* target, ObjectGuid guid = ObjectGuid::Empty, bool strong = false);
bool HasLowerSecurityAccount(WorldSession* target, uint32 account, bool strong = false);
void SendGlobalGMSysMessage(const char* str);
@@ -98,18 +98,19 @@ public:
char* extractQuotedArg(char* args);
uint32 extractSpellIdFromLink(char* text);
uint64 extractGuidFromLink(char* text);
ObjectGuid::LowType extractLowGuidFromLink(char* text, HighGuid& guidHigh);
GameTele const* extractGameTeleFromLink(char* text);
bool GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, uint64& guid, bool offline = false);
bool GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline = false);
std::string extractPlayerNameFromLink(char* text);
// select by arg (name/link) or in-game selection online/offline player
bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = nullptr, std::string* player_name = nullptr);
bool extractPlayerTarget(char* args, Player** player, ObjectGuid* player_guid = nullptr, std::string* player_name = nullptr);
std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:" + name + "|h[" + name + "]|h|r" : name; }
std::string GetNameLink(Player* chr) const;
GameObject* GetNearbyGameObject();
GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry);
GameObject* GetObjectFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid);
Creature* GetCreatureFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid);
bool HasSentErrorMessage() const { return sentErrorMessage; }
void SetSentErrorMessage(bool val) { sentErrorMessage = val; }
static bool LoadCommandTable() { return load_command_table; }