*Backed out changeset 3be01fb200a5
--HG-- branch : trunk
This commit is contained in:
+168
-1
@@ -17,8 +17,10 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _OBJECTMGR_H
|
||||
#define _OBJECTMGR_H
|
||||
|
||||
#include "Log.h"
|
||||
#include "Object.h"
|
||||
#include "Bag.h"
|
||||
@@ -38,9 +40,11 @@
|
||||
#include "ObjectDefines.h"
|
||||
#include "Policies/Singleton.h"
|
||||
#include "Database/SQLStorage.h"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <limits>
|
||||
|
||||
extern SQLStorage sCreatureStorage;
|
||||
extern SQLStorage sCreatureDataAddonStorage;
|
||||
extern SQLStorage sCreatureInfoAddonStorage;
|
||||
@@ -50,12 +54,14 @@ extern SQLStorage sGOStorage;
|
||||
extern SQLStorage sPageTextStore;
|
||||
extern SQLStorage sItemStorage;
|
||||
extern SQLStorage sInstanceTemplate;
|
||||
|
||||
class Group;
|
||||
class Guild;
|
||||
class ArenaTeam;
|
||||
class Path;
|
||||
class TransportPath;
|
||||
class Item;
|
||||
|
||||
struct GameTele
|
||||
{
|
||||
float position_x;
|
||||
@@ -66,8 +72,10 @@ struct GameTele
|
||||
std::string name;
|
||||
std::wstring wnameLow;
|
||||
};
|
||||
|
||||
typedef UNORDERED_MAP<uint32, GameTele > GameTeleMap;
|
||||
typedef std::list<GossipOption> CacheNpcOptionList;
|
||||
|
||||
struct ScriptInfo
|
||||
{
|
||||
uint32 id;
|
||||
@@ -81,6 +89,7 @@ struct ScriptInfo
|
||||
float z;
|
||||
float o;
|
||||
};
|
||||
|
||||
typedef std::multimap<uint32, ScriptInfo> ScriptMap;
|
||||
typedef std::map<uint32, ScriptMap > ScriptMapMap;
|
||||
extern ScriptMapMap sQuestEndScripts;
|
||||
@@ -89,6 +98,7 @@ extern ScriptMapMap sSpellScripts;
|
||||
extern ScriptMapMap sGameObjectScripts;
|
||||
extern ScriptMapMap sEventScripts;
|
||||
extern ScriptMapMap sWaypointScripts;
|
||||
|
||||
struct SpellClickInfo
|
||||
{
|
||||
uint32 spellId;
|
||||
@@ -99,11 +109,14 @@ struct SpellClickInfo
|
||||
uint32 auraRequired;
|
||||
uint32 auraForbidden;
|
||||
SpellClickUserTypes userType;
|
||||
|
||||
// helpers
|
||||
bool IsFitToRequirements(Player const* player, Creature const * clickNpc) const;
|
||||
};
|
||||
|
||||
typedef std::multimap<uint32, SpellClickInfo> SpellClickInfoMap;
|
||||
typedef std::pair<SpellClickInfoMap::const_iterator,SpellClickInfoMap::const_iterator> SpellClickInfoMapBounds;
|
||||
|
||||
struct AreaTrigger
|
||||
{
|
||||
uint32 access_id;
|
||||
@@ -113,6 +126,7 @@ struct AreaTrigger
|
||||
float target_Z;
|
||||
float target_Orientation;
|
||||
};
|
||||
|
||||
typedef std::set<uint32> CellGuidSet;
|
||||
typedef std::map<uint32/*player guid*/,uint32/*instance*/> CellCorpseSet;
|
||||
struct CellObjectGuids
|
||||
@@ -123,8 +137,10 @@ struct CellObjectGuids
|
||||
};
|
||||
typedef UNORDERED_MAP<uint32/*cell_id*/,CellObjectGuids> CellObjectGuidsMap;
|
||||
typedef UNORDERED_MAP<uint32/*(mapid,spawnMode) pair*/,CellObjectGuidsMap> MapObjectGuids;
|
||||
|
||||
typedef UNORDERED_MAP<uint64/*(instance,guid) pair*/,time_t> RespawnTimes;
|
||||
|
||||
|
||||
// mangos string ranges
|
||||
#define MIN_TRINITY_STRING_ID 1 // 'mangos_string'
|
||||
#define MAX_TRINITY_STRING_ID 2000000000
|
||||
@@ -132,10 +148,12 @@ typedef UNORDERED_MAP<uint64/*(instance,guid) pair*/,time_t> RespawnTimes;
|
||||
#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
|
||||
{
|
||||
std::vector<std::string> Content; // 0 -> default, i -> i-1 locale index
|
||||
};
|
||||
|
||||
typedef std::map<uint32,uint32> CreatureLinkedRespawnMap;
|
||||
typedef UNORDERED_MAP<uint32,CreatureData> CreatureDataMap;
|
||||
typedef UNORDERED_MAP<uint32,GameObjectData> GameObjectDataMap;
|
||||
@@ -148,17 +166,21 @@ typedef UNORDERED_MAP<uint32,PageTextLocale> PageTextLocaleMap;
|
||||
typedef UNORDERED_MAP<int32,TrinityStringLocale> TrinityStringLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32,NpcOptionLocale> NpcOptionLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32,PointOfInterestLocale> PointOfInterestLocaleMap;
|
||||
|
||||
typedef std::multimap<uint32,uint32> QuestRelations;
|
||||
typedef std::multimap<uint32,ItemRequiredTarget> ItemRequiredTargetMap;
|
||||
typedef std::pair<ItemRequiredTargetMap::const_iterator, ItemRequiredTargetMap::const_iterator> ItemRequiredTargetMapBounds;
|
||||
|
||||
struct PetLevelInfo
|
||||
{
|
||||
PetLevelInfo() : health(0), mana(0) { for(uint8 i=0; i < MAX_STATS; ++i ) stats[i] = 0; }
|
||||
|
||||
uint16 stats[MAX_STATS];
|
||||
uint16 health;
|
||||
uint16 mana;
|
||||
uint16 armor;
|
||||
};
|
||||
|
||||
struct ReputationOnKillEntry
|
||||
{
|
||||
uint32 repfaction1;
|
||||
@@ -171,6 +193,7 @@ struct ReputationOnKillEntry
|
||||
int32 repvalue2;
|
||||
bool team_dependent;
|
||||
};
|
||||
|
||||
struct PointOfInterest
|
||||
{
|
||||
uint32 entry;
|
||||
@@ -181,6 +204,7 @@ struct PointOfInterest
|
||||
uint32 data;
|
||||
std::string icon_name;
|
||||
};
|
||||
|
||||
#define WEATHER_SEASONS 4
|
||||
struct WeatherSeasonChances
|
||||
{
|
||||
@@ -188,16 +212,19 @@ struct WeatherSeasonChances
|
||||
uint32 snowChance;
|
||||
uint32 stormChance;
|
||||
};
|
||||
|
||||
struct WeatherZoneChances
|
||||
{
|
||||
WeatherSeasonChances data[WEATHER_SEASONS];
|
||||
};
|
||||
|
||||
struct GraveYardData
|
||||
{
|
||||
uint32 safeLocId;
|
||||
uint32 team;
|
||||
};
|
||||
typedef std::multimap<uint32,GraveYardData> GraveYardMap;
|
||||
|
||||
enum ConditionType
|
||||
{ // value1 value2 for the Condition enumed
|
||||
CONDITION_NONE = 0, // 0 0
|
||||
@@ -215,7 +242,9 @@ enum ConditionType
|
||||
CONDITION_ACTIVE_EVENT = 12, // event_id
|
||||
CONDITION_INSTANCE_DATA = 13, // entry data
|
||||
};
|
||||
|
||||
#define MAX_CONDITION 14 // maximum value in ConditionType enum
|
||||
|
||||
//Player's info
|
||||
typedef struct _tagCachePlayerInfo
|
||||
{
|
||||
@@ -232,13 +261,16 @@ typedef struct _tagCachePlayerInfo
|
||||
uint32 unArenaInfoSlot2;
|
||||
}CachePlayerInfo, *PCachePlayerInfo;
|
||||
typedef UNORDERED_MAP<uint32, PCachePlayerInfo> CachePlayerInfoMap;
|
||||
|
||||
struct PlayerCondition
|
||||
{
|
||||
ConditionType condition; // additional condition type
|
||||
uint32 value1; // data for the condition - see ConditionType definition
|
||||
uint32 value2;
|
||||
|
||||
PlayerCondition(uint8 _condition = 0, uint32 _value1 = 0, uint32 _value2 = 0)
|
||||
: condition(ConditionType(_condition)), value1(_value1), value2(_value2) {}
|
||||
|
||||
static bool IsValid(ConditionType condition, uint32 value1, uint32 value2);
|
||||
// Checks correctness of values
|
||||
bool Meets(Player const * APlayer) const; // Checks if the player meets the condition
|
||||
@@ -247,11 +279,14 @@ struct PlayerCondition
|
||||
return (lc.condition == condition && lc.value1 == value1 && lc.value2 == value2);
|
||||
}
|
||||
};
|
||||
|
||||
// NPC gossip text id
|
||||
typedef UNORDERED_MAP<uint32, uint32> CacheNpcTextIdMap;
|
||||
typedef std::list<GossipOption> CacheNpcOptionList;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, VendorItemData> CacheVendorItemMap;
|
||||
typedef UNORDERED_MAP<uint32, TrainerSpellData> CacheTrainerSpellMap;
|
||||
|
||||
enum SkillRangeType
|
||||
{
|
||||
SKILL_RANGE_LANGUAGE, // 300..300
|
||||
@@ -260,6 +295,7 @@ enum SkillRangeType
|
||||
SKILL_RANGE_RANK, // 1..skill for known rank
|
||||
SKILL_RANGE_NONE, // 0..0 always
|
||||
};
|
||||
|
||||
struct GM_Ticket
|
||||
{
|
||||
uint64 guid;
|
||||
@@ -278,53 +314,78 @@ struct GM_Ticket
|
||||
};
|
||||
typedef std::list<GM_Ticket*> GmTicketList;
|
||||
SkillRangeType GetSkillRangeType(SkillLineEntry const *pSkill, bool racial);
|
||||
|
||||
#define MAX_PLAYER_NAME 12 // max allowed by client name length
|
||||
#define MAX_INTERNAL_PLAYER_NAME 15 // max server internal player name length ( > MAX_PLAYER_NAME for support declined names )
|
||||
#define MAX_PET_NAME 12 // max allowed by client name length
|
||||
#define MAX_CHARTER_NAME 24 // max allowed by client name length
|
||||
|
||||
bool normalizePlayerName(std::string& name);
|
||||
|
||||
struct TRINITY_DLL_SPEC LanguageDesc
|
||||
{
|
||||
Language lang_id;
|
||||
uint32 spell_id;
|
||||
uint32 skill_id;
|
||||
};
|
||||
|
||||
extern LanguageDesc lang_description[LANGUAGES_COUNT];
|
||||
TRINITY_DLL_SPEC LanguageDesc const* GetLanguageDescByID(uint32 lang);
|
||||
|
||||
class PlayerDumpReader;
|
||||
|
||||
class ObjectMgr
|
||||
{
|
||||
friend class PlayerDumpReader;
|
||||
|
||||
public:
|
||||
ObjectMgr();
|
||||
~ObjectMgr();
|
||||
|
||||
typedef UNORDERED_MAP<uint32, Item*> ItemMap;
|
||||
|
||||
typedef std::set< Group * > GroupSet;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, Guild *> GuildMap;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, ArenaTeam*> ArenaTeamMap;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, Quest*> QuestMap;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, AreaTrigger> AreaTriggerMap;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap;
|
||||
|
||||
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 std::vector<std::string> ScriptNameMap;
|
||||
|
||||
UNORDERED_MAP<uint32, uint32> TransportEventMap;
|
||||
|
||||
Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);}
|
||||
Player* GetPlayer(uint64 guid) const { return ObjectAccessor::FindPlayer(guid); }
|
||||
|
||||
static GameObjectInfo const *GetGameObjectInfo(uint32 id) { return sGOStorage.LookupEntry<GameObjectInfo>(id); }
|
||||
|
||||
void LoadGameobjectInfo();
|
||||
void AddGameobjectInfo(GameObjectInfo *goinfo);
|
||||
|
||||
Group * GetGroupByLeader(const uint64 &guid) const;
|
||||
void AddGroup(Group* group) { mGroupSet.insert( group ); }
|
||||
void RemoveGroup(Group* group) { mGroupSet.erase( group ); }
|
||||
|
||||
Guild* GetGuildByLeader(uint64 const&guid) const;
|
||||
Guild* GetGuildById(uint32 GuildId) const;
|
||||
Guild* GetGuildByName(const std::string& guildname) const;
|
||||
std::string GetGuildNameById(uint32 GuildId) const;
|
||||
void AddGuild(Guild* guild);
|
||||
void RemoveGuild(uint32 Id);
|
||||
|
||||
ArenaTeam* GetArenaTeamById(uint32 arenateamid) const;
|
||||
ArenaTeam* GetArenaTeamByName(const std::string& arenateamname) const;
|
||||
ArenaTeam* GetArenaTeamByCaptain(uint64 const& guid) const;
|
||||
@@ -332,6 +393,7 @@ class ObjectMgr
|
||||
void RemoveArenaTeam(uint32 Id);
|
||||
ArenaTeamMap::iterator GetArenaTeamMapBegin() { return mArenaTeamMap.begin(); }
|
||||
ArenaTeamMap::iterator GetArenaTeamMapEnd() { return mArenaTeamMap.end(); }
|
||||
|
||||
static CreatureInfo const *GetCreatureTemplate( uint32 id );
|
||||
CreatureModelInfo const *GetCreatureModelInfo( uint32 modelid );
|
||||
CreatureModelInfo const* GetCreatureModelRandomGender(uint32 display_id);
|
||||
@@ -341,22 +403,28 @@ class ObjectMgr
|
||||
{
|
||||
return sCreatureDataAddonStorage.LookupEntry<CreatureDataAddon>(lowguid);
|
||||
}
|
||||
|
||||
static CreatureDataAddon const *GetCreatureTemplateAddon( uint32 entry )
|
||||
{
|
||||
return sCreatureInfoAddonStorage.LookupEntry<CreatureDataAddon>(entry);
|
||||
}
|
||||
|
||||
static ItemPrototype const* GetItemPrototype(uint32 id) { return sItemStorage.LookupEntry<ItemPrototype>(id); }
|
||||
|
||||
static InstanceTemplate const* GetInstanceTemplate(uint32 map)
|
||||
{
|
||||
return sInstanceTemplate.LookupEntry<InstanceTemplate>(map);
|
||||
}
|
||||
|
||||
PetLevelInfo const* GetPetLevelInfo(uint32 creature_id, uint32 level) const;
|
||||
|
||||
PlayerClassInfo const* GetPlayerClassInfo(uint32 class_) const
|
||||
{
|
||||
if(class_ >= MAX_CLASSES) return NULL;
|
||||
return &playerClassInfo[class_];
|
||||
}
|
||||
void GetPlayerClassLevelInfo(uint32 class_,uint32 level, PlayerClassLevelInfo* info) const;
|
||||
|
||||
PlayerInfo const* GetPlayerInfo(uint32 race, uint32 class_) const
|
||||
{
|
||||
if(race >= MAX_RACES) return NULL;
|
||||
@@ -366,22 +434,26 @@ class ObjectMgr
|
||||
return info;
|
||||
}
|
||||
void GetPlayerLevelInfo(uint32 race, uint32 class_,uint32 level, PlayerLevelInfo* info) const;
|
||||
|
||||
uint64 GetPlayerGUIDByName(std::string name) const;
|
||||
bool GetPlayerNameByGUID(const uint64 &guid, std::string &name) const;
|
||||
uint32 GetPlayerTeamByGUID(const uint64 &guid) const;
|
||||
uint32 GetPlayerAccountIdByGUID(const uint64 &guid) const;
|
||||
uint32 GetPlayerAccountIdByPlayerName(const std::string& name) const;
|
||||
|
||||
uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid, uint32 team );
|
||||
void GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost);
|
||||
uint32 GetTaxiMountDisplayId( 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 );
|
||||
|
||||
Quest const* GetQuestTemplate(uint32 quest_id) const
|
||||
{
|
||||
QuestMap::const_iterator itr = mQuestTemplates.find(quest_id);
|
||||
return itr != mQuestTemplates.end() ? itr->second : NULL;
|
||||
}
|
||||
QuestMap const& GetQuestTemplates() const { return mQuestTemplates; }
|
||||
|
||||
uint32 GetQuestForAreaTrigger(uint32 Trigger_ID) const
|
||||
{
|
||||
QuestAreaTriggerMap::const_iterator itr = mQuestAreaTriggerMap.find(Trigger_ID);
|
||||
@@ -393,16 +465,20 @@ class ObjectMgr
|
||||
{
|
||||
return mTavernAreaTriggerSet.find(Trigger_ID) != mTavernAreaTriggerSet.end();
|
||||
}
|
||||
|
||||
bool IsGameObjectForQuests(uint32 entry) const
|
||||
{
|
||||
return mGameObjectForQuestSet.find(entry) != mGameObjectForQuestSet.end();
|
||||
}
|
||||
|
||||
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);
|
||||
void RemoveGraveYardLink(uint32 id, uint32 zone, uint32 team, bool inDB = false);
|
||||
void LoadGraveyardZones();
|
||||
GraveYardData const* FindGraveYardData(uint32 id, uint32 zone);
|
||||
|
||||
AreaTrigger const* GetAreaTrigger(uint32 trigger) const
|
||||
{
|
||||
AreaTriggerMap::const_iterator itr = mAreaTriggers.find( trigger );
|
||||
@@ -410,6 +486,7 @@ class ObjectMgr
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AccessRequirement const* GetAccessRequirement(uint32 requirement) const
|
||||
{
|
||||
AccessRequirementMap::const_iterator itr = mAccessRequirements.find( requirement );
|
||||
@@ -417,9 +494,12 @@ class ObjectMgr
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AreaTrigger const* GetGoBackTrigger(uint32 Map) const;
|
||||
AreaTrigger const* GetMapEntranceTrigger(uint32 Map) const;
|
||||
|
||||
uint32 GetAreaTriggerScriptId(uint32 trigger_id);
|
||||
|
||||
ReputationOnKillEntry const* GetReputationOnKilEntry(uint32 id) const
|
||||
{
|
||||
RepOnKillMap::const_iterator itr = mRepOnKill.find(id);
|
||||
@@ -427,6 +507,7 @@ class ObjectMgr
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PointOfInterest const* GetPointOfInterest(uint32 id) const
|
||||
{
|
||||
PointOfInterestMap::const_iterator itr = mPointsOfInterest.find(id);
|
||||
@@ -434,6 +515,7 @@ class ObjectMgr
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void LoadGuilds();
|
||||
void LoadArenaTeams();
|
||||
void LoadGroups();
|
||||
@@ -449,17 +531,21 @@ class ObjectMgr
|
||||
void LoadGameobjectInvolvedRelations();
|
||||
void LoadCreatureQuestRelations();
|
||||
void LoadCreatureInvolvedRelations();
|
||||
|
||||
QuestRelations mGOQuestRelations;
|
||||
QuestRelations mGOQuestInvolvedRelations;
|
||||
QuestRelations mCreatureQuestRelations;
|
||||
QuestRelations mCreatureQuestInvolvedRelations;
|
||||
|
||||
void LoadGameObjectScripts();
|
||||
void LoadQuestEndScripts();
|
||||
void LoadQuestStartScripts();
|
||||
void LoadEventScripts();
|
||||
void LoadSpellScripts();
|
||||
void LoadWaypointScripts();
|
||||
|
||||
void LoadTransportEvents();
|
||||
|
||||
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();
|
||||
@@ -485,15 +571,19 @@ class ObjectMgr
|
||||
void LoadNpcOptionLocales();
|
||||
void LoadPointOfInterestLocales();
|
||||
void LoadInstanceTemplate();
|
||||
|
||||
void LoadGossipText();
|
||||
|
||||
void LoadAreaTriggerTeleports();
|
||||
void LoadAccessRequirements();
|
||||
void LoadQuestAreaTriggers();
|
||||
void LoadAreaTriggerScripts();
|
||||
void LoadTavernAreaTriggers();
|
||||
void LoadGameObjectForQuests();
|
||||
|
||||
void LoadItemTexts();
|
||||
void LoadPageTexts();
|
||||
|
||||
void LoadPlayerInfo();
|
||||
void LoadPetLevelInfo();
|
||||
void LoadExplorationBaseXP();
|
||||
@@ -501,25 +591,33 @@ class ObjectMgr
|
||||
void LoadPetNumber();
|
||||
void LoadCorpses();
|
||||
void LoadFishingBaseSkillLevel();
|
||||
|
||||
void LoadReputationOnKill();
|
||||
void LoadPointsOfInterest();
|
||||
|
||||
void LoadNPCSpellClickSpells();
|
||||
|
||||
void LoadWeatherZoneChances();
|
||||
void LoadGameTele();
|
||||
|
||||
void LoadNpcOptions();
|
||||
void LoadNpcTextId();
|
||||
void LoadVendors();
|
||||
void LoadTrainerSpell();
|
||||
void LoadGMTickets();
|
||||
|
||||
std::string GeneratePetName(uint32 entry);
|
||||
uint32 GetBaseXP(uint32 level);
|
||||
uint32 GetXPForLevel(uint32 level);
|
||||
|
||||
int32 GetFishingBaseSkillLevel(uint32 entry) const
|
||||
{
|
||||
FishingBaseSkillMap::const_iterator itr = mFishingBaseForArea.find(entry);
|
||||
return itr != mFishingBaseForArea.end() ? itr->second : 0;
|
||||
}
|
||||
|
||||
void ReturnOrDeleteOldMails(bool serverUp);
|
||||
|
||||
void SetHighestGuids();
|
||||
uint32 GenerateLowGuid(HighGuid guidhigh);
|
||||
uint32 GenerateArenaTeamId();
|
||||
@@ -529,9 +627,11 @@ class ObjectMgr
|
||||
uint32 GenerateItemTextID();
|
||||
uint32 GenerateMailID();
|
||||
uint32 GeneratePetNumber();
|
||||
|
||||
void LoadPlayerInfoInCache();
|
||||
PCachePlayerInfo GetPlayerInfoFromCache(uint32 unPlayerGuid) const;
|
||||
CachePlayerInfoMap m_mPlayerInfoMap;
|
||||
|
||||
uint32 CreateItemText(std::string text);
|
||||
void AddItemText(uint32 itemTextId, std::string text) { mItemTexts[itemTextId] = text; }
|
||||
std::string GetItemText( uint32 id )
|
||||
@@ -542,8 +642,10 @@ class ObjectMgr
|
||||
else
|
||||
return "There is no info for this item";
|
||||
}
|
||||
|
||||
typedef std::multimap<int32, uint32> ExclusiveQuestGroups;
|
||||
ExclusiveQuestGroups mExclusiveQuestGroups;
|
||||
|
||||
WeatherZoneChances const* GetWeatherChances(uint32 zone_id) const
|
||||
{
|
||||
WeatherZoneMap::const_iterator itr = mWeatherZoneMap.find(zone_id);
|
||||
@@ -552,10 +654,12 @@ class ObjectMgr
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CellObjectGuids const& GetCellObjectGuids(uint16 mapid, uint8 spawnMode, uint32 cell_id)
|
||||
{
|
||||
return mMapObjectGuids[MAKE_PAIR32(mapid,spawnMode)][cell_id];
|
||||
}
|
||||
|
||||
CreatureData const* GetCreatureData(uint32 guid) const
|
||||
{
|
||||
CreatureDataMap::const_iterator itr = mCreatureDataMap.find(guid);
|
||||
@@ -618,6 +722,7 @@ class ObjectMgr
|
||||
if(itr==mPointOfInterestLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
GameObjectData const* GetGOData(uint32 guid) const
|
||||
{
|
||||
GameObjectDataMap::const_iterator itr = mGameObjectDataMap.find(guid);
|
||||
@@ -626,6 +731,7 @@ class ObjectMgr
|
||||
}
|
||||
GameObjectData& NewGOData(uint32 guid) { return mGameObjectDataMap[guid]; }
|
||||
void DeleteGOData(uint32 guid);
|
||||
|
||||
TrinityStringLocale const* GetTrinityStringLocale(int32 entry) const
|
||||
{
|
||||
TrinityStringLocaleMap::const_iterator itr = mTrinityStringLocaleMap.find(entry);
|
||||
@@ -636,13 +742,16 @@ class ObjectMgr
|
||||
const char *GetTrinityStringForDBCLocale(int32 entry) const { return GetTrinityString(entry,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);
|
||||
void DeleteCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_guid);
|
||||
|
||||
time_t GetCreatureRespawnTime(uint32 loguid, uint32 instance) { return mCreatureRespawnTimes[MAKE_PAIR64(loguid,instance)]; }
|
||||
void SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t);
|
||||
time_t GetGORespawnTime(uint32 loguid, uint32 instance) { return mGORespawnTimes[MAKE_PAIR64(loguid,instance)]; }
|
||||
void SaveGORespawnTime(uint32 loguid, uint32 instance, time_t t);
|
||||
void DeleteRespawnTimeForInstance(uint32 instance);
|
||||
|
||||
// grid objects
|
||||
void AddCreatureToGrid(uint32 guid, CreatureData const* data);
|
||||
void RemoveCreatureFromGrid(uint32 guid, CreatureData const* data);
|
||||
@@ -650,27 +759,35 @@ class ObjectMgr
|
||||
void RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data);
|
||||
uint32 AddGOData(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 AddCreData(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;
|
||||
|
||||
// name with valid structure and symbols
|
||||
static uint8 CheckPlayerName( const std::string& name, bool create = false );
|
||||
static PetNameInvalidReason CheckPetName( const std::string& name );
|
||||
static bool IsValidCharterName( const std::string& name );
|
||||
|
||||
static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names);
|
||||
|
||||
void LoadSpellDisabledEntrys();
|
||||
bool IsPlayerSpellDisabled(uint32 spellid) { return (m_DisabledPlayerSpells.count(spellid) != 0); }
|
||||
bool IsCreatureSpellDisabled(uint32 spellid) { return (m_DisabledCreatureSpells.count(spellid) != 0); }
|
||||
bool IsPetSpellDisabled(uint32 spellid) { return (m_DisabledPetSpells.count(spellid) != 0); }
|
||||
|
||||
int GetIndexForLocale(LocaleConstant loc);
|
||||
LocaleConstant GetLocaleForIndex(int i);
|
||||
|
||||
uint16 GetConditionId(ConditionType condition, uint32 value1, uint32 value2);
|
||||
bool IsPlayerMeetToCondition(Player const* player, uint16 condition_id) const
|
||||
{
|
||||
if(condition_id >= mConditions.size())
|
||||
return false;
|
||||
|
||||
return mConditions[condition_id].Meets(player);
|
||||
}
|
||||
|
||||
GameTele const* GetGameTele(uint32 id) const
|
||||
{
|
||||
GameTeleMap::const_iterator itr = m_GameTeleMap.find(id);
|
||||
@@ -681,49 +798,62 @@ class ObjectMgr
|
||||
GameTeleMap const& GetGameTeleMap() const { return m_GameTeleMap; }
|
||||
bool AddGameTele(GameTele& data);
|
||||
bool DeleteGameTele(const std::string& name);
|
||||
|
||||
CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; }
|
||||
|
||||
uint32 GetNpcGossip(uint32 entry) const
|
||||
{
|
||||
CacheNpcTextIdMap::const_iterator iter = m_mCacheNpcTextIdMap.find(entry);
|
||||
if(iter == m_mCacheNpcTextIdMap.end())
|
||||
return 0;
|
||||
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
TrainerSpellData const* GetNpcTrainerSpells(uint32 entry) const
|
||||
{
|
||||
CacheTrainerSpellMap::const_iterator iter = m_mCacheTrainerSpellMap.find(entry);
|
||||
if(iter == m_mCacheTrainerSpellMap.end())
|
||||
return NULL;
|
||||
|
||||
return &iter->second;
|
||||
}
|
||||
|
||||
VendorItemData const* GetNpcVendorItemList(uint32 entry) const
|
||||
{
|
||||
CacheVendorItemMap::const_iterator iter = m_mCacheVendorItemMap.find(entry);
|
||||
if(iter == m_mCacheVendorItemMap.end())
|
||||
return NULL;
|
||||
|
||||
return &iter->second;
|
||||
}
|
||||
void AddVendorItem(uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb = true); // for event
|
||||
bool RemoveVendorItem(uint32 entry,uint32 item, bool savetodb = true); // for event
|
||||
bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0 ) const;
|
||||
|
||||
void LoadScriptNames();
|
||||
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);
|
||||
|
||||
SpellClickInfoMapBounds GetSpellClickInfoMapBounds(uint32 creature_id) const
|
||||
{
|
||||
return SpellClickInfoMapBounds(mSpellClickInfoMap.lower_bound(creature_id),mSpellClickInfoMap.upper_bound(creature_id));
|
||||
}
|
||||
|
||||
ItemRequiredTargetMapBounds GetItemRequiredTargetMapBounds(uint32 uiItemEntry) const
|
||||
{
|
||||
return ItemRequiredTargetMapBounds(m_ItemRequiredTarget.lower_bound(uiItemEntry),m_ItemRequiredTarget.upper_bound(uiItemEntry));
|
||||
}
|
||||
|
||||
GM_Ticket *GetGMTicket(uint64 ticketGuid)
|
||||
{
|
||||
for(GmTicketList::const_iterator i = m_GMTicketList.begin(); i != m_GMTicketList.end(); ++i)
|
||||
if((*i) && (*i)->guid == ticketGuid)
|
||||
return (*i);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
GM_Ticket *GetGMTicketByPlayer(uint64 playerGuid)
|
||||
@@ -731,18 +861,23 @@ class ObjectMgr
|
||||
for(GmTicketList::const_iterator i = m_GMTicketList.begin(); i != m_GMTicketList.end(); ++i)
|
||||
if((*i) && (*i)->playerGuid == playerGuid && (*i)->closed == 0)
|
||||
return (*i);
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void AddOrUpdateGMTicket(GM_Ticket &ticket, bool create = false);
|
||||
void _AddOrUpdateGMTicket(GM_Ticket &ticket);
|
||||
void RemoveGMTicket(uint64 ticketGuid, int64 source = -1, bool permanently = false);
|
||||
void RemoveGMTicket(GM_Ticket *ticket, int64 source = -1, bool permanently = false);
|
||||
GmTicketList m_GMTicketList;
|
||||
uint64 GenerateGMTicketId();
|
||||
|
||||
bool CheckDB() const;
|
||||
|
||||
// for wintergrasp only
|
||||
GraveYardMap mGraveYardMap;
|
||||
protected:
|
||||
|
||||
// first free id for selected id type
|
||||
uint32 m_arenaTeamId;
|
||||
uint32 m_auctionid;
|
||||
@@ -752,6 +887,7 @@ class ObjectMgr
|
||||
uint32 m_mailid;
|
||||
uint32 m_hiPetNumber;
|
||||
uint64 m_GMticketid;
|
||||
|
||||
// first free low guid for seelcted guid type
|
||||
uint32 m_hiCharGuid;
|
||||
uint32 m_hiCreatureGuid;
|
||||
@@ -761,16 +897,21 @@ class ObjectMgr
|
||||
uint32 m_hiGoGuid;
|
||||
uint32 m_hiDoGuid;
|
||||
uint32 m_hiCorpseGuid;
|
||||
|
||||
QuestMap mQuestTemplates;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, GossipText> GossipTextMap;
|
||||
typedef UNORDERED_MAP<uint32, uint32> QuestAreaTriggerMap;
|
||||
typedef UNORDERED_MAP<uint32, std::string> ItemTextMap;
|
||||
typedef std::set<uint32> TavernAreaTriggerSet;
|
||||
typedef std::set<uint32> GameObjectForQuestSet;
|
||||
|
||||
GroupSet mGroupSet;
|
||||
GuildMap mGuildMap;
|
||||
ArenaTeamMap mArenaTeamMap;
|
||||
|
||||
ItemTextMap mItemTexts;
|
||||
|
||||
QuestAreaTriggerMap mQuestAreaTriggerMap;
|
||||
TavernAreaTriggerSet mTavernAreaTriggerSet;
|
||||
GameObjectForQuestSet mGameObjectForQuestSet;
|
||||
@@ -778,44 +919,65 @@ class ObjectMgr
|
||||
AreaTriggerMap mAreaTriggers;
|
||||
AreaTriggerScriptMap mAreaTriggerScripts;
|
||||
AccessRequirementMap mAccessRequirements;
|
||||
|
||||
RepOnKillMap mRepOnKill;
|
||||
|
||||
PointOfInterestMap mPointsOfInterest;
|
||||
|
||||
WeatherZoneMap mWeatherZoneMap;
|
||||
|
||||
//character reserved names
|
||||
typedef std::set<std::wstring> ReservedNamesMap;
|
||||
ReservedNamesMap m_ReservedNames;
|
||||
|
||||
std::set<uint32> m_DisabledPlayerSpells;
|
||||
std::set<uint32> m_DisabledCreatureSpells;
|
||||
std::set<uint32> m_DisabledPetSpells;
|
||||
|
||||
// GraveYardMap mGraveYardMap;
|
||||
|
||||
GameTeleMap m_GameTeleMap;
|
||||
|
||||
ScriptNameMap m_scriptNames;
|
||||
|
||||
SpellClickInfoMap mSpellClickInfoMap;
|
||||
|
||||
ItemRequiredTargetMap m_ItemRequiredTarget;
|
||||
|
||||
typedef std::vector<LocaleConstant> LocalForIndex;
|
||||
LocalForIndex m_LocalForIndex;
|
||||
|
||||
int DBCLocaleIndex;
|
||||
|
||||
private:
|
||||
void LoadScripts(ScriptMapMap& scripts, char const* tablename);
|
||||
void CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids);
|
||||
void LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment);
|
||||
void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr);
|
||||
void LoadQuestRelationsHelper(QuestRelations& map,char const* table);
|
||||
|
||||
typedef std::map<uint32,PetLevelInfo*> PetLevelInfoMap;
|
||||
// PetLevelInfoMap[creature_id][level]
|
||||
PetLevelInfoMap petInfo; // [creature_id][level]
|
||||
|
||||
PlayerClassInfo playerClassInfo[MAX_CLASSES];
|
||||
|
||||
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;
|
||||
|
||||
typedef std::map<uint32,int32> FishingBaseSkillMap; // [areaId][base skill level]
|
||||
FishingBaseSkillMap mFishingBaseForArea;
|
||||
|
||||
typedef std::map<uint32,std::vector<std::string> > HalfNameMap;
|
||||
HalfNameMap PetHalfName0;
|
||||
HalfNameMap PetHalfName1;
|
||||
|
||||
MapObjectGuids mMapObjectGuids;
|
||||
CreatureDataMap mCreatureDataMap;
|
||||
CreatureLinkedRespawnMap mCreatureLinkedRespawnMap;
|
||||
@@ -831,15 +993,19 @@ class ObjectMgr
|
||||
PointOfInterestLocaleMap mPointOfInterestLocaleMap;
|
||||
RespawnTimes mCreatureRespawnTimes;
|
||||
RespawnTimes mGORespawnTimes;
|
||||
|
||||
// Storage for Conditions. First element (index 0) is reserved for zero-condition (nothing required)
|
||||
typedef std::vector<PlayerCondition> ConditionStore;
|
||||
ConditionStore mConditions;
|
||||
|
||||
CacheNpcOptionList m_mCacheNpcOptionList;
|
||||
CacheNpcTextIdMap m_mCacheNpcTextIdMap;
|
||||
CacheVendorItemMap m_mCacheVendorItemMap;
|
||||
CacheTrainerSpellMap m_mCacheTrainerSpellMap;
|
||||
};
|
||||
|
||||
#define objmgr Trinity::Singleton<ObjectMgr>::Instance()
|
||||
|
||||
// scripting access functions
|
||||
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);
|
||||
@@ -849,4 +1015,5 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user