diff options
Diffstat (limited to 'src/game/ObjectMgr.h')
| -rw-r--r-- | src/game/ObjectMgr.h | 162 | 
1 files changed, 75 insertions, 87 deletions
diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 5dbea9c0ce4..3946f912b96 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 @@ -34,7 +34,6 @@  #include "ItemPrototype.h"  #include "NPCHandler.h"  #include "Database/DatabaseEnv.h" -#include "AuctionHouseObject.h"  #include "Mail.h"  #include "Map.h"  #include "ObjectAccessor.h" @@ -153,6 +152,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; @@ -179,6 +179,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]; @@ -305,9 +316,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; @@ -316,6 +328,7 @@ class ObjectMgr          typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap;          typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap; +        typedef UNORDERED_MAP<uint32, PointOfInterest> PointOfInterestMap;          typedef UNORDERED_MAP<uint32, WeatherZoneChances> WeatherZoneMap; @@ -338,17 +351,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(); } @@ -374,42 +387,6 @@ class ObjectMgr              return sInstanceTemplate.LookupEntry<InstanceTemplate>(map);          } -        Item* GetAItem(uint32 id) -        { -            ItemMap::const_iterator itr = mAitems.find(id); -            if (itr != mAitems.end()) -            { -                return itr->second; -            } -            return NULL; -        } -        void AddAItem(Item* it) -        { -            ASSERT( it ); -            ASSERT( mAitems.find(it->GetGUIDLow()) == mAitems.end()); -            mAitems[it->GetGUIDLow()] = it; -        } -        bool RemoveAItem(uint32 id) -        { -            ItemMap::iterator i = mAitems.find(id); -            if (i == mAitems.end()) -            { -                return false; -            } -            mAitems.erase(i); -            return true; -        } -        AuctionHouseObject * GetAuctionsMap( uint32 location ); - -        //auction messages -        void SendAuctionWonMail( AuctionEntry * auction ); -        void SendAuctionSalePendingMail( AuctionEntry * auction ); -        void SendAuctionSuccessfulMail( AuctionEntry * auction ); -        void SendAuctionExpiredMail( AuctionEntry * auction ); -        static uint32 GetAuctionCut( uint32 location, uint32 highBid ); -        static uint32 GetAuctionDeposit(uint32 location, uint32 time, Item *pItem); -        static uint32 GetAuctionOutBid(uint32 currentBid); -          PetLevelInfo const* GetPetLevelInfo(uint32 creature_id, uint32 level) const;          PlayerClassInfo const* GetPlayerClassInfo(uint32 class_) const @@ -435,7 +412,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 ); @@ -455,8 +432,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)) @@ -465,16 +450,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); @@ -491,6 +467,7 @@ class ObjectMgr          }          AreaTrigger const* GetGoBackTrigger(uint32 Map) const; +        AreaTrigger const* GetMapEntranceTrigger(uint32 Map) const;          uint32 GetAreaTriggerScriptId(uint32 trigger_id); @@ -502,6 +479,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); @@ -560,6 +545,7 @@ class ObjectMgr          void LoadNpcTextLocales();          void LoadPageTextLocales();          void LoadNpcOptionLocales(); +        void LoadPointOfInterestLocales();          void LoadInstanceTemplate();          void LoadGossipText(); @@ -568,15 +554,11 @@ class ObjectMgr          void LoadQuestAreaTriggers();          void LoadAreaTriggerScripts();          void LoadTavernAreaTriggers(); -        void LoadBattleMastersEntry();          void LoadGameObjectForQuests();          void LoadItemTexts();          void LoadPageTexts(); -        //load first auction items, because of check if item exists, when loading -        void LoadAuctionItems(); -        void LoadAuctions();          void LoadPlayerInfo();          void LoadPetLevelInfo();          void LoadExplorationBaseXP(); @@ -586,6 +568,7 @@ class ObjectMgr          void LoadFishingBaseSkillLevel();          void LoadReputationOnKill(); +        void LoadPointsOfInterest();          void LoadWeatherZoneChances();          void LoadGameTele(); @@ -597,6 +580,7 @@ class ObjectMgr          std::string GeneratePetName(uint32 entry);          uint32 GetBaseXP(uint32 level); +        uint32 GetXPForLevel(uint32 level);          int32 GetFishingBaseSkillLevel(uint32 entry) const          { @@ -608,12 +592,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; @@ -696,6 +680,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          { @@ -734,10 +724,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 ); @@ -811,20 +798,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; @@ -832,28 +822,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; -        ItemMap             mAitems; -          ItemTextMap         mItemTexts; -        AuctionHouseObject  mHordeAuctions; -        AuctionHouseObject  mAllianceAuctions; -        AuctionHouseObject  mNeutralAuctions; -          QuestAreaTriggerMap mQuestAreaTriggerMap; -        BattleMastersMap    mBattleMastersMap;          TavernAreaTriggerSet mTavernAreaTriggerSet;          GameObjectForQuestSet mGameObjectForQuestSet;          GossipTextMap       mGossipText; @@ -862,12 +843,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; @@ -881,7 +864,6 @@ class ObjectMgr          typedef             std::vector<LocaleConstant> LocalForIndex;          LocalForIndex        m_LocalForIndex; -        int GetOrNewIndexForLocale(LocaleConstant loc);          int DBCLocaleIndex; @@ -900,6 +882,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; @@ -921,6 +906,7 @@ class ObjectMgr          PageTextLocaleMap mPageTextLocaleMap;          TrinityStringLocaleMap mTrinityStringLocaleMap;          NpcOptionLocaleMap mNpcOptionLocaleMap; +        PointOfInterestLocaleMap mPointOfInterestLocaleMap;          RespawnTimes mCreatureRespawnTimes;          RespawnTimes mGORespawnTimes; @@ -946,6 +932,8 @@ TRINITY_DLL_SPEC uint32 GetScriptId(const char *name);  TRINITY_DLL_SPEC ObjectMgr::ScriptNameMap& GetScriptNames();  TRINITY_DLL_SPEC GameObjectInfo const *GetGameObjectInfo(uint32 id);  TRINITY_DLL_SPEC CreatureInfo const *GetCreatureInfo(uint32 id); +TRINITY_DLL_SPEC CreatureInfo const* GetCreatureTemplateStore(uint32 entry); +TRINITY_DLL_SPEC Quest const* GetQuestTemplateStore(uint32 entry);  #endif  | 
