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

@@ -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;