diff options
Diffstat (limited to 'src/game/ObjectMgr.h')
-rw-r--r-- | src/game/ObjectMgr.h | 115 |
1 files changed, 73 insertions, 42 deletions
diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index bb2866d55c7..ea73fb15715 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -1,7 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * - * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -144,6 +144,7 @@ typedef UNORDERED_MAP<uint32,NpcTextLocale> NpcTextLocaleMap; typedef UNORDERED_MAP<uint32,PageTextLocale> PageTextLocaleMap; typedef UNORDERED_MAP<uint32,TrinityStringLocale> TrinityStringLocaleMap; typedef UNORDERED_MAP<uint32,NpcOptionLocale> NpcOptionLocaleMap; +typedef UNORDERED_MAP<uint32,PointOfInterestLocale> PointOfInterestLocaleMap; typedef std::multimap<uint32,uint32> QuestRelations; @@ -170,6 +171,17 @@ struct ReputationOnKillEntry bool team_dependent; }; +struct PointOfInterest +{ + uint32 entry; + float x; + float y; + uint32 icon; + uint32 flags; + uint32 data; + std::string icon_name; +}; + struct PetCreateSpellEntry { uint32 spellid[4]; @@ -296,9 +308,10 @@ class ObjectMgr typedef UNORDERED_MAP<uint32, Item*> ItemMap; typedef std::set< Group * > GroupSet; - typedef std::set< Guild * > GuildSet; - typedef UNORDERED_MAP<uint32, ArenaTeam* > ArenaTeamMap; + typedef UNORDERED_MAP<uint32, Guild *> GuildMap; + + typedef UNORDERED_MAP<uint32, ArenaTeam*> ArenaTeamMap; typedef UNORDERED_MAP<uint32, Quest*> QuestMap; @@ -309,6 +322,7 @@ class ObjectMgr typedef UNORDERED_MAP<uint32, AccessRequirement> AccessRequirementMap; typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap; + typedef UNORDERED_MAP<uint32, PointOfInterest> PointOfInterestMap; typedef UNORDERED_MAP<uint32, WeatherZoneChances> WeatherZoneMap; @@ -331,17 +345,17 @@ class ObjectMgr void RemoveGroup(Group* group) { mGroupSet.erase( group ); } Guild* GetGuildByLeader(uint64 const&guid) const; - Guild* GetGuildById(const uint32 GuildId) const; + Guild* GetGuildById(uint32 GuildId) const; Guild* GetGuildByName(const std::string& guildname) const; - std::string GetGuildNameById(const uint32 GuildId) const; - void AddGuild(Guild* guild) { mGuildSet.insert( guild ); } - void RemoveGuild(Guild* guild) { mGuildSet.erase( guild ); } + std::string GetGuildNameById(uint32 GuildId) const; + void AddGuild(Guild* guild); + void RemoveGuild(uint32 Id); - ArenaTeam* GetArenaTeamById(const uint32 arenateamid) const; + ArenaTeam* GetArenaTeamById(uint32 arenateamid) const; ArenaTeam* GetArenaTeamByName(const std::string& arenateamname) const; ArenaTeam* GetArenaTeamByCaptain(uint64 const& guid) const; void AddArenaTeam(ArenaTeam* arenaTeam); - void RemoveArenaTeam(ArenaTeam* arenaTeam); + void RemoveArenaTeam(uint32 Id); ArenaTeamMap::iterator GetArenaTeamMapBegin() { return mArenaTeamMap.begin(); } ArenaTeamMap::iterator GetArenaTeamMapEnd() { return mArenaTeamMap.end(); } @@ -392,7 +406,7 @@ class ObjectMgr uint32 GetPlayerAccountIdByGUID(const uint64 &guid) const; uint32 GetPlayerAccountIdByPlayerName(const std::string& name) const; - uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid ); + uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid, uint32 team ); void GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost); uint16 GetTaxiMount( uint32 id, uint32 team ); void GetTaxiPathNodes( uint32 path, Path &pathnodes, std::vector<uint32>& mapIds ); @@ -412,8 +426,16 @@ class ObjectMgr return itr->second; return 0; } - bool IsTavernAreaTrigger(uint32 Trigger_ID) const { return mTavernAreaTriggerSet.count(Trigger_ID) != 0; } - bool IsGameObjectForQuests(uint32 entry) const { return mGameObjectForQuestSet.count(entry) != 0; } + bool IsTavernAreaTrigger(uint32 Trigger_ID) const + { + return mTavernAreaTriggerSet.find(Trigger_ID) != mTavernAreaTriggerSet.end(); + } + + bool IsGameObjectForQuests(uint32 entry) const + { + return mGameObjectForQuestSet.find(entry) != mGameObjectForQuestSet.end(); + } + bool IsGuildVaultGameObject(Player *player, uint64 guid) const { if(GameObject *go = ObjectAccessor::GetGameObject(*player, guid)) @@ -422,16 +444,7 @@ class ObjectMgr return false; } - uint32 GetBattleMasterBG(uint32 entry) const - { - BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry); - if(itr != mBattleMastersMap.end()) - return itr->second; - return 2; //BATTLEGROUND_WS - i will not add include only for constant usage! - } - - void AddGossipText(GossipText *pGText); - GossipText *GetGossipText(uint32 Text_ID); + GossipText const* GetGossipText(uint32 Text_ID) const; WorldSafeLocsEntry const *GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team); bool AddGraveYardLink(uint32 id, uint32 zone, uint32 team, bool inDB = true); @@ -456,6 +469,7 @@ class ObjectMgr } AreaTrigger const* GetGoBackTrigger(uint32 Map) const; + AreaTrigger const* GetMapEntranceTrigger(uint32 Map) const; uint32 GetAreaTriggerScriptId(uint32 trigger_id); @@ -467,6 +481,14 @@ class ObjectMgr return NULL; } + PointOfInterest const* GetPointOfInterest(uint32 id) const + { + PointOfInterestMap::const_iterator itr = mPointsOfInterest.find(id); + if(itr != mPointsOfInterest.end()) + return &itr->second; + return NULL; + } + PetCreateSpellEntry const* GetPetCreateSpellEntry(uint32 id) const { PetCreateSpellMap::const_iterator itr = mPetCreateSpell.find(id); @@ -525,6 +547,7 @@ class ObjectMgr void LoadNpcTextLocales(); void LoadPageTextLocales(); void LoadNpcOptionLocales(); + void LoadPointOfInterestLocales(); void LoadInstanceTemplate(); void LoadGossipText(); @@ -534,7 +557,6 @@ class ObjectMgr void LoadQuestAreaTriggers(); void LoadAreaTriggerScripts(); void LoadTavernAreaTriggers(); - void LoadBattleMastersEntry(); void LoadGameObjectForQuests(); void LoadItemTexts(); @@ -549,6 +571,7 @@ class ObjectMgr void LoadFishingBaseSkillLevel(); void LoadReputationOnKill(); + void LoadPointsOfInterest(); void LoadWeatherZoneChances(); void LoadGameTele(); @@ -560,6 +583,7 @@ class ObjectMgr std::string GeneratePetName(uint32 entry); uint32 GetBaseXP(uint32 level); + uint32 GetXPForLevel(uint32 level); int32 GetFishingBaseSkillLevel(uint32 entry) const { @@ -571,12 +595,12 @@ class ObjectMgr void SetHighestGuids(); uint32 GenerateLowGuid(HighGuid guidhigh); + uint32 GenerateArenaTeamId(); uint32 GenerateAuctionID(); - uint32 GenerateMailID(); + uint32 GenerateGuildId(); uint32 GenerateItemTextID(); + uint32 GenerateMailID(); uint32 GeneratePetNumber(); - uint32 GenerateArenaTeamId(); - uint32 GenerateGuildId(); void LoadPlayerInfoInCache(); PCachePlayerInfo GetPlayerInfoFromCache(uint32 unPlayerGuid) const; @@ -659,6 +683,12 @@ class ObjectMgr if(itr==mNpcOptionLocaleMap.end()) return NULL; return &itr->second; } + PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const + { + PointOfInterestLocaleMap::const_iterator itr = mPointOfInterestLocaleMap.find(poi_id); + if(itr==mPointOfInterestLocaleMap.end()) return NULL; + return &itr->second; + } GameObjectData const* GetGOData(uint32 guid) const { @@ -697,10 +727,7 @@ class ObjectMgr // reserved names void LoadReservedPlayersNames(); - bool IsReservedName(const std::string& name) const - { - return m_ReservedNames.find(name) != m_ReservedNames.end(); - } + bool IsReservedName(const std::string& name) const; // name with valid structure and symbols static bool IsValidName( const std::string& name, bool create = false ); @@ -775,20 +802,23 @@ class ObjectMgr ScriptNameMap &GetScriptNames() { return m_scriptNames; } const char * GetScriptName(uint32 id) { return id < m_scriptNames.size() ? m_scriptNames[id].c_str() : ""; } uint32 GetScriptId(const char *name); + + int GetOrNewIndexForLocale(LocaleConstant loc); protected: // first free id for selected id type - uint32 m_auctionid; - uint32 m_mailid; - uint32 m_ItemTextId; uint32 m_arenaTeamId; + uint32 m_auctionid; uint32 m_guildId; + uint32 m_ItemTextId; + uint32 m_mailid; uint32 m_hiPetNumber; // first free low guid for seelcted guid type uint32 m_hiCharGuid; uint32 m_hiCreatureGuid; uint32 m_hiPetGuid; + uint32 m_hiVehicleGuid; uint32 m_hiItemGuid; uint32 m_hiGoGuid; uint32 m_hiDoGuid; @@ -796,23 +826,19 @@ class ObjectMgr QuestMap mQuestTemplates; - typedef UNORDERED_MAP<uint32, GossipText*> GossipTextMap; + typedef UNORDERED_MAP<uint32, GossipText> GossipTextMap; typedef UNORDERED_MAP<uint32, uint32> QuestAreaTriggerMap; - typedef UNORDERED_MAP<uint32, uint32> BattleMastersMap; typedef UNORDERED_MAP<uint32, std::string> ItemTextMap; typedef std::set<uint32> TavernAreaTriggerSet; typedef std::set<uint32> GameObjectForQuestSet; GroupSet mGroupSet; - GuildSet mGuildSet; + GuildMap mGuildMap; ArenaTeamMap mArenaTeamMap; - ItemMap mItems; - ItemTextMap mItemTexts; QuestAreaTriggerMap mQuestAreaTriggerMap; - BattleMastersMap mBattleMastersMap; TavernAreaTriggerSet mTavernAreaTriggerSet; GameObjectForQuestSet mGameObjectForQuestSet; GossipTextMap mGossipText; @@ -822,12 +848,14 @@ class ObjectMgr RepOnKillMap mRepOnKill; + PointOfInterestMap mPointsOfInterest; + WeatherZoneMap mWeatherZoneMap; PetCreateSpellMap mPetCreateSpell; //character reserved names - typedef std::set<std::string> ReservedNamesMap; + typedef std::set<std::wstring> ReservedNamesMap; ReservedNamesMap m_ReservedNames; std::set<uint32> m_DisabledPlayerSpells; @@ -842,7 +870,6 @@ class ObjectMgr typedef std::vector<LocaleConstant> LocalForIndex; LocalForIndex m_LocalForIndex; - int GetOrNewIndexForLocale(LocaleConstant loc); int DBCLocaleIndex; @@ -861,6 +888,9 @@ class ObjectMgr void BuildPlayerLevelInfo(uint8 race, uint8 class_, uint8 level, PlayerLevelInfo* plinfo) const; PlayerInfo playerInfo[MAX_RACES][MAX_CLASSES]; + typedef std::vector<uint32> PlayerXPperLevel; // [level] + PlayerXPperLevel mPlayerXPperLevel; + typedef std::map<uint32,uint32> BaseXPMap; // [area level][base xp] BaseXPMap mBaseXPTable; @@ -882,6 +912,7 @@ class ObjectMgr PageTextLocaleMap mPageTextLocaleMap; TrinityStringLocaleMap mTrinityStringLocaleMap; NpcOptionLocaleMap mNpcOptionLocaleMap; + PointOfInterestLocaleMap mPointOfInterestLocaleMap; RespawnTimes mCreatureRespawnTimes; RespawnTimes mGORespawnTimes; |