aboutsummaryrefslogtreecommitdiff
path: root/src/game/ObjectMgr.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/ObjectMgr.h')
-rw-r--r--src/game/ObjectMgr.h143
1 files changed, 79 insertions, 64 deletions
diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h
index 8de6c3333b3..ae1222cccfb 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
@@ -99,6 +99,16 @@ extern ScriptMapMap sGameObjectScripts;
extern ScriptMapMap sEventScripts;
extern ScriptMapMap sWaypointScripts;
+struct SpellClickInfo
+{
+ uint32 spellId;
+ uint32 questId;
+ uint32 questStatus;
+ uint8 castFlags;
+};
+
+typedef std::multimap<uint32, SpellClickInfo> SpellClickInfoMap;
+
struct AreaTrigger
{
uint32 access_id;
@@ -124,10 +134,12 @@ typedef UNORDERED_MAP<uint64/*(instance,guid) pair*/,time_t> RespawnTimes;
// mangos string ranges
-#define MIN_TRINITY_STRING_ID 1
-#define MAX_TRINITY_STRING_ID 2000000000
-#define MIN_DB_SCRIPT_STRING_ID MAX_TRINITY_STRING_ID
-#define MAX_DB_SCRIPT_STRING_ID 2000010000
+#define MIN_TRINITY_STRING_ID 1 // 'mangos_string'
+#define MAX_TRINITY_STRING_ID 2000000000
+#define MIN_DB_SCRIPT_STRING_ID MAX_TRINITY_STRING_ID // 'db_script_string'
+#define MAX_DB_SCRIPT_STRING_ID 2000010000
+#define MIN_CREATURE_AI_TEXT_STRING_ID (-1) // 'creature_ai_texts'
+#define MAX_CREATURE_AI_TEXT_STRING_ID (-1000000)
struct TrinityStringLocale
{
@@ -143,8 +155,9 @@ typedef UNORDERED_MAP<uint32,ItemLocale> ItemLocaleMap;
typedef UNORDERED_MAP<uint32,QuestLocale> QuestLocaleMap;
typedef UNORDERED_MAP<uint32,NpcTextLocale> NpcTextLocaleMap;
typedef UNORDERED_MAP<uint32,PageTextLocale> PageTextLocaleMap;
-typedef UNORDERED_MAP<uint32,TrinityStringLocale> TrinityStringLocaleMap;
+typedef UNORDERED_MAP<int32,TrinityStringLocale> TrinityStringLocaleMap;
typedef UNORDERED_MAP<uint32,NpcOptionLocale> NpcOptionLocaleMap;
+typedef UNORDERED_MAP<uint32,PointOfInterestLocale> PointOfInterestLocaleMap;
typedef std::multimap<uint32,uint32> QuestRelations;
@@ -171,9 +184,15 @@ struct ReputationOnKillEntry
bool team_dependent;
};
-struct PetCreateSpellEntry
+struct PointOfInterest
{
- uint32 spellid[4];
+ uint32 entry;
+ float x;
+ float y;
+ uint32 icon;
+ uint32 flags;
+ uint32 data;
+ std::string icon_name;
};
#define WEATHER_SEASONS 4
@@ -208,7 +227,7 @@ enum ConditionType
CONDITION_SKILL = 7, // skill_id skill_value
CONDITION_QUESTREWARDED = 8, // quest_id 0
CONDITION_QUESTTAKEN = 9, // quest_id 0, for condition true while quest active.
- CONDITION_AD_COMMISSION_AURA = 10, // 0 0, for condition true while one from AD ñommission aura active
+ CONDITION_AD_COMMISSION_AURA = 10, // 0 0, for condition true while one from AD ńommission aura active
CONDITION_NO_AURA = 11, // spell_id effindex
CONDITION_ACTIVE_EVENT = 12, // event_id
CONDITION_INSTANCE_DATA = 13, // entry data
@@ -311,11 +330,10 @@ 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;
- typedef UNORDERED_MAP<uint32, PetCreateSpellEntry> PetCreateSpellMap;
-
typedef std::vector<std::string> ScriptNameMap;
UNORDERED_MAP<uint32, uint32> TransportEventMap;
@@ -333,13 +351,13 @@ 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;
+ 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);
@@ -394,9 +412,9 @@ 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 );
+ uint16 GetTaxiMount( uint32 id, uint32 team, bool allowed_alt_team = false);
void GetTaxiPathNodes( uint32 path, Path &pathnodes, std::vector<uint32>& mapIds );
void GetTransportPathNodes( uint32 path, TransportPath &pathnodes );
@@ -414,26 +432,17 @@ 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 IsGuildVaultGameObject(Player *player, uint64 guid) const
+ bool IsTavernAreaTrigger(uint32 Trigger_ID) const
{
- if(GameObject *go = ObjectAccessor::GetGameObject(*player, guid))
- if(go->GetGoType() == GAMEOBJECT_TYPE_GUILD_BANK)
- return true;
- return false;
+ return mTavernAreaTriggerSet.find(Trigger_ID) != mTavernAreaTriggerSet.end();
}
- uint32 GetBattleMasterBG(uint32 entry) const
+ bool IsGameObjectForQuests(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!
+ return mGameObjectForQuestSet.find(entry) != mGameObjectForQuestSet.end();
}
- 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);
@@ -458,6 +467,7 @@ class ObjectMgr
}
AreaTrigger const* GetGoBackTrigger(uint32 Map) const;
+ AreaTrigger const* GetMapEntranceTrigger(uint32 Map) const;
uint32 GetAreaTriggerScriptId(uint32 trigger_id);
@@ -469,10 +479,10 @@ class ObjectMgr
return NULL;
}
- PetCreateSpellEntry const* GetPetCreateSpellEntry(uint32 id) const
+ PointOfInterest const* GetPointOfInterest(uint32 id) const
{
- PetCreateSpellMap::const_iterator itr = mPetCreateSpell.find(id);
- if(itr != mPetCreateSpell.end())
+ PointOfInterestMap::const_iterator itr = mPointsOfInterest.find(id);
+ if(itr != mPointsOfInterest.end())
return &itr->second;
return NULL;
}
@@ -509,8 +519,7 @@ class ObjectMgr
bool LoadTrinityStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value);
bool LoadTrinityStrings() { return LoadTrinityStrings(WorldDatabase,"trinity_string",MIN_TRINITY_STRING_ID,MAX_TRINITY_STRING_ID); }
- void LoadDbScriptStrings();
- void LoadPetCreateSpells();
+ void LoadDbScriptStrings();
void LoadCreatureLocales();
void LoadCreatureTemplates();
void LoadCreatures();
@@ -530,6 +539,7 @@ class ObjectMgr
void LoadNpcTextLocales();
void LoadPageTextLocales();
void LoadNpcOptionLocales();
+ void LoadPointOfInterestLocales();
void LoadInstanceTemplate();
void LoadGossipText();
@@ -539,7 +549,6 @@ class ObjectMgr
void LoadQuestAreaTriggers();
void LoadAreaTriggerScripts();
void LoadTavernAreaTriggers();
- void LoadBattleMastersEntry();
void LoadGameObjectForQuests();
void LoadItemTexts();
@@ -554,6 +563,10 @@ class ObjectMgr
void LoadFishingBaseSkillLevel();
void LoadReputationOnKill();
+ void LoadPointsOfInterest();
+
+ SpellClickInfoMap mSpellClickInfoMap;
+ void LoadNPCSpellClickSpells();
void LoadWeatherZoneChances();
void LoadGameTele();
@@ -565,6 +578,7 @@ class ObjectMgr
std::string GeneratePetName(uint32 entry);
uint32 GetBaseXP(uint32 level);
+ uint32 GetXPForLevel(uint32 level);
int32 GetFishingBaseSkillLevel(uint32 entry) const
{
@@ -576,12 +590,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;
@@ -670,6 +684,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
{
@@ -688,7 +708,7 @@ class ObjectMgr
}
const char *GetTrinityString(int32 entry, int locale_idx) const;
const char *GetTrinityStringForDBCLocale(int32 entry) const { return GetTrinityString(entry,DBCLocaleIndex); }
- int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; }
+ int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; }
void SetDBCLocaleIndex(uint32 lang) { DBCLocaleIndex = GetIndexForLocale(LocaleConstant(lang)); }
void AddCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_guid, uint32 instance);
@@ -705,13 +725,12 @@ class ObjectMgr
void RemoveCreatureFromGrid(uint32 guid, CreatureData const* data);
void AddGameobjectToGrid(uint32 guid, GameObjectData const* data);
void RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data);
+ uint32 AddGameObject(uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0, float rotation0 = 0, float rotation1 = 0, float rotation2 = 0, float rotation3 = 0);
+ uint32 AddCreature(uint32 entry, uint32 team, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0);
// 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 );
@@ -727,8 +746,6 @@ class ObjectMgr
int GetIndexForLocale(LocaleConstant loc);
LocaleConstant GetLocaleForIndex(int i);
- // guild bank tabs
- uint32 GetGuildBankTabPrice(uint8 Index) const { return Index < GUILD_BANK_MAX_TABS ? mGuildBankTabPrice[Index] : 0; }
uint16 GetConditionId(ConditionType condition, uint32 value1, uint32 value2);
bool IsPlayerMeetToCondition(Player const* player, uint16 condition_id) const
@@ -786,20 +803,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;
@@ -807,9 +827,8 @@ 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;
@@ -818,12 +837,9 @@ class ObjectMgr
GuildMap mGuildMap;
ArenaTeamMap mArenaTeamMap;
- ItemMap mItems;
-
ItemTextMap mItemTexts;
QuestAreaTriggerMap mQuestAreaTriggerMap;
- BattleMastersMap mBattleMastersMap;
TavernAreaTriggerSet mTavernAreaTriggerSet;
GameObjectForQuestSet mGameObjectForQuestSet;
GossipTextMap mGossipText;
@@ -833,12 +849,12 @@ class ObjectMgr
RepOnKillMap mRepOnKill;
- WeatherZoneMap mWeatherZoneMap;
+ PointOfInterestMap mPointsOfInterest;
- PetCreateSpellMap mPetCreateSpell;
+ WeatherZoneMap mWeatherZoneMap;
//character reserved names
- typedef std::set<std::string> ReservedNamesMap;
+ typedef std::set<std::wstring> ReservedNamesMap;
ReservedNamesMap m_ReservedNames;
std::set<uint32> m_DisabledPlayerSpells;
@@ -853,7 +869,6 @@ class ObjectMgr
typedef std::vector<LocaleConstant> LocalForIndex;
LocalForIndex m_LocalForIndex;
- int GetOrNewIndexForLocale(LocaleConstant loc);
int DBCLocaleIndex;
@@ -872,6 +887,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;
@@ -894,12 +912,10 @@ class ObjectMgr
PageTextLocaleMap mPageTextLocaleMap;
TrinityStringLocaleMap mTrinityStringLocaleMap;
NpcOptionLocaleMap mNpcOptionLocaleMap;
+ PointOfInterestLocaleMap mPointOfInterestLocaleMap;
RespawnTimes mCreatureRespawnTimes;
RespawnTimes mGORespawnTimes;
- typedef std::vector<uint32> GuildBankTabPriceMap;
- GuildBankTabPriceMap mGuildBankTabPrice;
-
// Storage for Conditions. First element (index 0) is reserved for zero-condition (nothing required)
typedef std::vector<PlayerCondition> ConditionStore;
ConditionStore mConditions;
@@ -913,7 +929,7 @@ class ObjectMgr
#define objmgr Trinity::Singleton<ObjectMgr>::Instance()
// scripting access functions
-TRINITY_DLL_SPEC bool LoadTrinityStrings(DatabaseType& db, char const* table,int32 start_value = -1, int32 end_value = std::numeric_limits<int32>::min());
+TRINITY_DLL_SPEC bool LoadTrinityStrings(DatabaseType& db, char const* table,int32 start_value = MAX_CREATURE_AI_TEXT_STRING_ID, int32 end_value = std::numeric_limits<int32>::min());
TRINITY_DLL_SPEC uint32 GetAreaTriggerScriptId(uint32 trigger_id);
TRINITY_DLL_SPEC uint32 GetScriptId(const char *name);
TRINITY_DLL_SPEC ObjectMgr::ScriptNameMap& GetScriptNames();
@@ -923,4 +939,3 @@ TRINITY_DLL_SPEC CreatureInfo const* GetCreatureTemplateStore(uint32 entry);
TRINITY_DLL_SPEC Quest const* GetQuestTemplateStore(uint32 entry);
#endif
-