35 static_assert(std::is_same<Player, T>::value,
36 "Only Player can be registered in global HashMapHolder");
38 std::unique_lock<std::shared_mutex> lock(*GetLock());
40 GetContainer()[o->GetGUID()] = o;
46 std::unique_lock<std::shared_mutex> lock(*GetLock());
48 GetContainer().erase(o->GetGUID());
54 std::shared_lock<std::shared_mutex> lock(*GetLock());
56 typename MapType::iterator itr = GetContainer().find(guid);
57 return (itr != GetContainer().end()) ? itr->second :
nullptr;
70 static std::shared_mutex _lock;
78 typedef std::unordered_map<std::string, Player*>
MapType;
93 std::string charName(name);
117 default:
return nullptr;
127 return ((
Player const&)p).GetItemByGuid(guid);
231 if (player->IsInWorld() && player->GetMap() == m)
256 return player && player->
IsInWorld() ? player :
nullptr;
270 ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>(lowguid);
295 itr->second->SaveToDB();
bool normalizePlayerName(std::string &name)
static T * Find(ObjectGuid guid)
static std::shared_mutex * GetLock()
std::unordered_map< ObjectGuid, T * > MapType
static MapType & GetContainer()
Pet * GetPet(ObjectGuid const &guid)
SceneObject * GetSceneObject(ObjectGuid const &guid)
GameObject * GetGameObject(ObjectGuid const &guid)
Corpse * GetCorpse(ObjectGuid const &guid)
DynamicObject * GetDynamicObject(ObjectGuid const &guid)
Conversation * GetConversation(ObjectGuid const &guid)
AreaTrigger * GetAreaTrigger(ObjectGuid const &guid)
Creature * GetCreature(ObjectGuid const &guid)
Transport * GetTransport(ObjectGuid const &guid)
bool IsCreatureOrVehicle() const
std::string const & GetName() const
TC_GAME_API WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &)
TC_GAME_API Player * FindPlayerByName(std::string_view name)
TC_GAME_API void SaveAllPlayers()
TC_GAME_API Player * FindPlayerByLowGUID(ObjectGuid::LowType lowguid)
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Player * FindConnectedPlayerByName(std::string_view name)
void AddObject(T *object)
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API Transport * GetTransport(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API Object * GetObjectByTypeMask(WorldObject const &, ObjectGuid const &, uint32 typemask)
TC_GAME_API AreaTrigger * GetAreaTrigger(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
TC_GAME_API HashMapHolder< Player >::MapType const & GetPlayers()
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API DynamicObject * GetDynamicObject(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
TC_GAME_API Pet * GetPet(WorldObject const &, ObjectGuid const &guid)
void RemoveObject(T *object)
TC_GAME_API Corpse * GetCorpse(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreatureOrPetOrVehicle(WorldObject const &, ObjectGuid const &)
TC_GAME_API Conversation * GetConversation(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API SceneObject * GetSceneObject(WorldObject const &u, ObjectGuid const &guid)
std::unordered_map< std::string, Player * > MapType
Player * Find(std::string_view name)
static MapType PlayerNameMap