36 static_assert(std::is_same<Player, T>::value
37 || std::is_same<Transport, T>::value,
38 "Only Player and Transport can be registered in global HashMapHolder");
40 std::unique_lock<std::shared_mutex> lock(*GetLock());
42 GetContainer()[o->GetGUID()] = o;
48 std::unique_lock<std::shared_mutex> lock(*GetLock());
50 GetContainer().erase(o->GetGUID());
56 std::shared_lock<std::shared_mutex> lock(*GetLock());
58 typename MapType::iterator itr = GetContainer().find(guid);
59 return (itr != GetContainer().end()) ? itr->second :
nullptr;
72 static std::shared_mutex _lock;
86 typedef std::unordered_map<std::string, Player*>
MapType;
101 std::string charName(name);
123 default:
return nullptr;
133 return ((
Player const&)p).GetItemByGuid(guid);
214 if (player->IsInWorld() && player->GetMap() == m)
239 return player && player->
IsInWorld() ? player :
nullptr;
253 ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>(lowguid);
273 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)
GameObject * GetGameObject(ObjectGuid const &guid)
Corpse * GetCorpse(ObjectGuid const &guid)
DynamicObject * GetDynamicObject(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 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 &)
std::unordered_map< std::string, Player * > MapType
Player * Find(std::string_view name)
static MapType PlayerNameMap