TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ObjectMgr Class Reference

#include <ObjectMgr.h>

Public Types

typedef std::unordered_map
< uint32, Item * > 
ItemMap
 
typedef std::unordered_map
< uint32, Quest * > 
QuestMap
 
typedef std::unordered_map
< uint32, AreaTriggerStruct
AreaTriggerContainer
 
typedef std::unordered_map
< uint32, uint32
AreaTriggerScriptContainer
 
typedef std::unordered_map
< uint64, AccessRequirement * > 
AccessRequirementContainer
 
typedef std::unordered_map
< uint32, RepRewardRate
RepRewardRateContainer
 
typedef std::unordered_map
< uint32,
ReputationOnKillEntry
RepOnKillContainer
 
typedef std::unordered_map
< uint32, RepSpilloverTemplate
RepSpilloverTemplateContainer
 
typedef std::unordered_map
< uint32, PointOfInterest
PointOfInterestContainer
 
typedef std::vector< std::string > ScriptNameContainer
 
typedef std::map< uint32, uint32CharacterConversionMap
 
typedef std::multimap< int32,
uint32
ExclusiveQuestGroups
 
typedef std::pair
< ExclusiveQuestGroups::const_iterator,
ExclusiveQuestGroups::const_iterator > 
ExclusiveQuestGroupsBounds
 

Public Member Functions

 ObjectMgr (ObjectMgr const &)=delete
 
 ObjectMgr (ObjectMgr &&)=delete
 
ObjectMgroperator= (ObjectMgr const &)=delete
 
ObjectMgroperator= (ObjectMgr &&)=delete
 
PlayerGetPlayerByLowGUID (ObjectGuid::LowType lowguid) const
 
GameObjectTemplate constGetGameObjectTemplate (uint32 entry)
 
GameObjectTemplateContainer constGetGameObjectTemplates () const
 
int LoadReferenceVendor (int32 vendor, int32 item, uint8 type, std::set< uint32 > *skip_vendors)
 
void LoadGameObjectTemplate ()
 
void AddGameobjectInfo (GameObjectTemplate *goinfo)
 
CreatureTemplate constGetCreatureTemplate (uint32 entry)
 
CreatureTemplateContainer constGetCreatureTemplates () const
 
CreatureModelInfo constGetCreatureModelInfo (uint32 modelId)
 
CreatureModelInfo constGetCreatureModelRandomGender (uint32 *displayID)
 
EquipmentInfo constGetEquipmentInfo (uint32 entry, int8 &id)
 
CreatureAddon constGetCreatureAddon (ObjectGuid::LowType lowguid)
 
GameObjectAddon constGetGameObjectAddon (ObjectGuid::LowType lowguid)
 
CreatureAddon constGetCreatureTemplateAddon (uint32 entry)
 
ItemTemplate constGetItemTemplate (uint32 entry)
 
ItemTemplateContainer constGetItemTemplateStore () const
 
InstanceTemplate constGetInstanceTemplate (uint32 mapId)
 
PetLevelInfo constGetPetLevelInfo (uint32 creature_id, uint8 level) const
 
void GetPlayerClassLevelInfo (uint32 class_, uint8 level, uint32 &baseHP, uint32 &baseMana) const
 
PlayerInfo constGetPlayerInfo (uint32 race, uint32 class_) const
 
void GetPlayerLevelInfo (uint32 race, uint32 class_, uint8 level, PlayerLevelInfo *info) const
 
GameObjectQuestItemList constGetGameObjectQuestItemList (uint32 id) const
 
GameObjectQuestItemMap constGetGameObjectQuestItemMap () const
 
CreatureQuestItemList constGetCreatureQuestItemList (uint32 id) const
 
CreatureQuestItemMap constGetCreatureQuestItemMap () const
 
uint32 GetNearestTaxiNode (float x, float y, float z, uint32 mapid, uint32 team)
 
void GetTaxiPath (uint32 source, uint32 destination, uint32 &path, uint32 &cost)
 
void GetTaxiPath (uint32 source, uint32 destination, std::vector< uint32 > &path, uint32 &cost)
 
uint32 GetTaxiMountDisplayId (uint32 id, uint32 team, bool allowed_alt_team=false)
 
Quest constGetQuestTemplate (uint32 quest_id) const
 
QuestMap constGetQuestTemplates () const
 
std::unordered_set< uint32 >
const
GetQuestsForAreaTrigger (uint32 Trigger_ID) const
 
bool IsTavernAreaTrigger (uint32 Trigger_ID) const
 
bool IsGameObjectForQuests (uint32 entry) const
 
NpcText constGetNpcText (uint32 textID) const
 
QuestGreeting constGetQuestGreeting (ObjectGuid guid) const
 
WorldSafeLocsEntry constGetDefaultGraveYard (uint32 team)
 
WorldSafeLocsEntry constGetClosestGraveYard (float x, float y, float z, uint32 MapId, uint32 team)
 
bool AddGraveYardLink (uint32 id, uint32 zoneId, uint32 team, bool persist=true)
 
void RemoveGraveYardLink (uint32 id, uint32 zoneId, uint32 team, bool persist=false)
 
void LoadGraveyardZones ()
 
GraveYardData constFindGraveYardData (uint32 id, uint32 zone)
 
AreaTriggerStruct constGetAreaTrigger (uint32 trigger) const
 
AccessRequirement constGetAccessRequirement (uint32 mapid, Difficulty difficulty) const
 
AreaTriggerStruct constGetGoBackTrigger (uint32 Map) const
 
AreaTriggerStruct constGetMapEntranceTrigger (uint32 Map) const
 
uint32 GetAreaTriggerScriptId (uint32 trigger_id)
 
SpellScriptsBounds GetSpellScriptsBounds (uint32 spellId)
 
RepRewardRate constGetRepRewardRate (uint32 factionId) const
 
ReputationOnKillEntry constGetReputationOnKilEntry (uint32 id) const
 
int32 GetBaseReputationOf (FactionEntry const *factionEntry, uint8 race, uint8 playerClass)
 
RepSpilloverTemplate constGetRepSpilloverTemplate (uint32 factionId) const
 
PointOfInterest constGetPointOfInterest (uint32 id) const
 
QuestPOIVector constGetQuestPOIVector (int32 QuestID)
 
VehicleAccessoryList constGetVehicleAccessoryList (Vehicle *veh) const
 
DungeonEncounterList constGetDungeonEncounterList (uint32 mapId, Difficulty difficulty)
 
void LoadQuests ()
 
void LoadQuestStartersAndEnders ()
 
void LoadGameobjectQuestStarters ()
 
void LoadGameobjectQuestEnders ()
 
void LoadCreatureQuestStarters ()
 
void LoadCreatureQuestEnders ()
 
QuestRelationsGetGOQuestRelationMap ()
 
QuestRelationBounds GetGOQuestRelationBounds (uint32 go_entry)
 
QuestRelationBounds GetGOQuestInvolvedRelationBounds (uint32 go_entry)
 
QuestRelationReverseBounds GetGOQuestInvolvedRelationReverseBounds (uint32 questId)
 
QuestRelationsGetCreatureQuestRelationMap ()
 
QuestRelationBounds GetCreatureQuestRelationBounds (uint32 creature_entry)
 
QuestRelationBounds GetCreatureQuestInvolvedRelationBounds (uint32 creature_entry)
 
QuestRelationReverseBounds GetCreatureQuestInvolvedRelationReverseBounds (uint32 questId)
 
bool LoadTrinityStrings ()
 
void LoadEventScripts ()
 
void LoadSpellScripts ()
 
void LoadWaypointScripts ()
 
void LoadSpellScriptNames ()
 
void ValidateSpellScripts ()
 
void LoadCreatureClassLevelStats ()
 
void LoadCreatureLocales ()
 
void LoadCreatureTemplates ()
 
void LoadCreatureTemplateAddons ()
 
void LoadCreatureTemplate (Field *fields)
 
void CheckCreatureTemplate (CreatureTemplate const *cInfo)
 
void LoadGameObjectQuestItems ()
 
void LoadCreatureQuestItems ()
 
void LoadTempSummons ()
 
void LoadCreatures ()
 
void LoadLinkedRespawn ()
 
bool SetCreatureLinkedRespawn (ObjectGuid::LowType guid, ObjectGuid::LowType linkedGuid)
 
void LoadCreatureAddons ()
 
void LoadGameObjectAddons ()
 
void LoadCreatureModelInfo ()
 
void LoadEquipmentTemplates ()
 
void LoadGameObjectLocales ()
 
void LoadGameobjects ()
 
void LoadItemTemplates ()
 
void LoadItemTemplateAddon ()
 
void LoadItemScriptNames ()
 
void LoadQuestTemplateLocale ()
 
void LoadQuestObjectivesLocale ()
 
void LoadPageTextLocales ()
 
void LoadGossipMenuItemsLocales ()
 
void LoadPointOfInterestLocales ()
 
void LoadInstanceTemplate ()
 
void LoadInstanceEncounters ()
 
void LoadMailLevelRewards ()
 
void LoadVehicleTemplateAccessories ()
 
void LoadVehicleAccessories ()
 
void LoadNPCText ()
 
void LoadAreaTriggerTeleports ()
 
void LoadAccessRequirements ()
 
void LoadQuestAreaTriggers ()
 
void LoadQuestGreetings ()
 
void LoadAreaTriggerScripts ()
 
void LoadTavernAreaTriggers ()
 
void LoadGameObjectForQuests ()
 
void LoadPageTexts ()
 
PageText constGetPageText (uint32 pageEntry)
 
void LoadPlayerInfo ()
 
void LoadPetLevelInfo ()
 
void LoadExplorationBaseXP ()
 
void LoadPetNames ()
 
void LoadPetNumber ()
 
void LoadFishingBaseSkillLevel ()
 
void LoadSkillTiers ()
 
void LoadReputationRewardRate ()
 
void LoadReputationOnKill ()
 
void LoadReputationSpilloverTemplate ()
 
void LoadPointsOfInterest ()
 
void LoadQuestPOI ()
 
void LoadNPCSpellClickSpells ()
 
void LoadGameTele ()
 
void LoadGossipMenu ()
 
void LoadGossipMenuItems ()
 
void LoadVendors ()
 
void LoadTrainerSpell ()
 
void AddSpellToTrainer (uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel)
 
void LoadTerrainPhaseInfo ()
 
void LoadTerrainSwapDefaults ()
 
void LoadTerrainWorldMaps ()
 
void LoadAreaPhases ()
 
std::string GeneratePetName (uint32 entry)
 
uint32 GetBaseXP (uint8 level)
 
uint32 GetXPForLevel (uint8 level) const
 
int32 GetFishingBaseSkillLevel (uint32 entry) const
 
SkillTiersEntry constGetSkillTier (uint32 skillTierId) const
 
void ReturnOrDeleteOldMails (bool serverUp)
 
CreatureBaseStats constGetCreatureBaseStats (uint8 level, uint8 unitClass)
 
void SetHighestGuids ()
 
template<HighGuid type>
ObjectGuidGeneratorBaseGetGenerator ()
 
uint32 GenerateAuctionID ()
 
uint64 GenerateEquipmentSetGuid ()
 
uint32 GenerateMailID ()
 
uint32 GeneratePetNumber ()
 
uint64 GenerateVoidStorageItemId ()
 
uint64 GenerateCreatureSpawnId ()
 
uint64 GenerateGameObjectSpawnId ()
 
MailLevelReward constGetMailLevelReward (uint8 level, uint32 raceMask)
 
CellObjectGuids constGetCellObjectGuids (uint16 mapid, uint8 spawnMode, uint32 cell_id)
 
CellObjectGuidsMap constGetMapObjectGuids (uint16 mapid, uint8 spawnMode)
 
std::vector< TempSummonData >
const
GetSummonGroup (uint32 summonerId, SummonerType summonerType, uint8 group) const
 
CreatureData constGetCreatureData (ObjectGuid::LowType guid) const
 
CreatureDataNewOrExistCreatureData (ObjectGuid::LowType guid)
 
void DeleteCreatureData (ObjectGuid::LowType guid)
 
ObjectGuid GetLinkedRespawnGuid (ObjectGuid guid) const
 
CreatureLocale constGetCreatureLocale (uint32 entry) const
 
GameObjectLocale constGetGameObjectLocale (uint32 entry) const
 
QuestTemplateLocale constGetQuestLocale (uint32 entry) const
 
QuestObjectivesLocale constGetQuestObjectivesLocale (uint32 entry) const
 
PageTextLocale constGetPageTextLocale (uint32 entry) const
 
GossipMenuItemsLocale constGetGossipMenuItemsLocale (uint32 entry) const
 
PointOfInterestLocale constGetPointOfInterestLocale (uint32 id) const
 
GameObjectData constGetGOData (ObjectGuid::LowType guid) const
 
GameObjectDataNewGOData (ObjectGuid::LowType guid)
 
void DeleteGOData (ObjectGuid::LowType guid)
 
TrinityString constGetTrinityString (uint32 entry) const
 
char constGetTrinityString (uint32 entry, LocaleConstant locale) const
 
char constGetTrinityStringForDBCLocale (uint32 entry) const
 
LocaleConstant GetDBCLocaleIndex () const
 
void SetDBCLocaleIndex (LocaleConstant locale)
 
void AddCreatureToGrid (ObjectGuid::LowType guid, CreatureData const *data)
 
void RemoveCreatureFromGrid (ObjectGuid::LowType guid, CreatureData const *data)
 
void AddGameobjectToGrid (ObjectGuid::LowType guid, GameObjectData const *data)
 
void RemoveGameobjectFromGrid (ObjectGuid::LowType guid, GameObjectData const *data)
 
ObjectGuid::LowType 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)
 
ObjectGuid::LowType AddCreatureData (uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay=0)
 
void LoadReservedPlayersNames ()
 
bool IsReservedName (std::string const &name) const
 
GameTele constGetGameTele (uint32 id) const
 
GameTele constGetGameTele (std::string const &name) const
 
GameTele constGetGameTeleExactName (std::string const &name) const
 
GameTeleContainer constGetGameTeleMap () const
 
bool AddGameTele (GameTele &data)
 
bool DeleteGameTele (std::string const &name)
 
TrainerSpellData constGetNpcTrainerSpells (uint32 entry) const
 
VendorItemData constGetNpcVendorItemList (uint32 entry) const
 
void AddVendorItem (uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedCost, uint8 type, bool persist=true)
 
bool RemoveVendorItem (uint32 entry, uint32 item, uint8 type, bool persist=true)
 
bool IsVendorItemValid (uint32 vendor_entry, uint32 id, int32 maxcount, uint32 ptime, uint32 ExtendedCost, uint8 type, Player *player=NULL, std::set< uint32 > *skip_vendors=NULL, uint32 ORnpcflag=0) const
 
void LoadScriptNames ()
 
std::string constGetScriptName (uint32 id) const
 
uint32 GetScriptId (std::string const &name)
 
SpellClickInfoMapBounds GetSpellClickInfoMapBounds (uint32 creature_id) const
 
GossipMenusMapBounds GetGossipMenusMapBounds (uint32 uiMenuId) const
 
GossipMenusMapBoundsNonConst GetGossipMenusMapBoundsNonConst (uint32 uiMenuId)
 
GossipMenuItemsMapBounds GetGossipMenuItemsMapBounds (uint32 uiMenuId) const
 
GossipMenuItemsMapBoundsNonConst GetGossipMenuItemsMapBoundsNonConst (uint32 uiMenuId)
 
std::vector< uint32 > constGetPhaseTerrainSwaps (uint32 phaseid) const
 
std::vector< uint32 > constGetDefaultTerrainSwaps (uint32 mapid) const
 
std::vector< uint32 > constGetTerrainWorldMaps (uint32 terrainId) const
 
std::vector< PhaseInfoStruct >
const
GetPhasesForArea (uint32 area) const
 
TerrainPhaseInfo constGetDefaultTerrainSwapStore () const
 
PhaseInfo constGetAreaPhases () const
 
std::vector< PhaseInfoStruct > * GetPhasesForAreaForLoading (uint32 area)
 
PhaseInfoGetAreaPhasesForLoading ()
 
void LoadFactionChangeAchievements ()
 
void LoadFactionChangeItems ()
 
void LoadFactionChangeQuests ()
 
void LoadFactionChangeReputations ()
 
void LoadFactionChangeSpells ()
 
void LoadFactionChangeTitles ()
 
bool IsTransportMap (uint32 mapId) const
 
void LoadRaceAndClassExpansionRequirements ()
 
void LoadCharacterTemplates ()
 
void LoadRealmNames ()
 
std::string GetRealmName (uint32 realm) const
 
std::string GetNormalizedRealmName (uint32 realm) const
 
ExpansionRequirementContainer
const
GetRaceExpansionRequirements () const
 
uint8 GetRaceExpansionRequirement (uint8 race) const
 
ExpansionRequirementContainer
const
GetClassExpansionRequirements () const
 
uint8 GetClassExpansionRequirement (uint8 class_) const
 
CharacterTemplateContainer constGetCharacterTemplates () const
 
CharacterTemplate constGetCharacterTemplate (uint32 id) const
 

Static Public Member Functions

static ObjectMgrinstance ()
 
static uint32 ChooseDisplayId (CreatureTemplate const *cinfo, CreatureData const *data=NULL)
 
static void ChooseCreatureFlags (CreatureTemplate const *cinfo, uint64 &npcflag, uint32 &unit_flags, uint32 &dynamicflags, CreatureData const *data=NULL)
 
static ObjectGuid GetPlayerGUIDByName (std::string const &name)
 
static bool GetPlayerNameByGUID (ObjectGuid const &guid, std::string &name)
 
static bool GetPlayerNameAndClassByGUID (ObjectGuid const &guid, std::string &name, uint8 &_class)
 
static uint32 GetPlayerTeamByGUID (ObjectGuid const &guid)
 
static uint32 GetPlayerAccountIdByGUID (ObjectGuid const &guid)
 
static uint32 GetPlayerAccountIdByPlayerName (std::string const &name)
 
static ResponseCodes CheckPlayerName (std::string const &name, LocaleConstant locale, bool create=false)
 
static PetNameInvalidReason CheckPetName (std::string const &name)
 
static bool IsValidCharterName (std::string const &name)
 
static bool CheckDeclinedNames (const std::wstring &w_ownname, DeclinedName const &names)
 
static void AddLocaleString (std::string const &value, LocaleConstant localeConstant, StringVector &data)
 
static void GetLocaleString (StringVector const &data, LocaleConstant localeConstant, std::string &value)
 

Public Attributes

ExclusiveQuestGroups mExclusiveQuestGroups
 
GraveYardContainer GraveYardStore
 
CharacterConversionMap FactionChangeAchievements
 
CharacterConversionMap FactionChangeItems
 
CharacterConversionMap FactionChangeQuests
 
CharacterConversionMap FactionChangeReputation
 
CharacterConversionMap FactionChangeSpells
 
CharacterConversionMap FactionChangeTitles
 

Private Types

enum  CreatureLinkedRespawnType { CREATURE_TO_CREATURE, CREATURE_TO_GO, GO_TO_GO, GO_TO_CREATURE }
 
typedef std::unordered_map
< uint32, NpcText
NpcTextContainer
 
typedef std::unordered_map
< uint32, std::unordered_set
< uint32 > > 
QuestAreaTriggerContainer
 
typedef std::set< uint32TavernAreaTriggerContainer
 
typedef std::set< uint32GameObjectForQuestContainer
 
typedef std::set< std::wstring > ReservedNamesContainer
 
typedef std::map< uint32,
PetLevelInfo * > 
PetLevelInfoContainer
 
typedef std::vector< uint32PlayerXPperLevel
 
typedef std::map< uint32, uint32BaseXPContainer
 
typedef std::map< uint32, int32FishingBaseSkillContainer
 
typedef std::map< uint32,
StringVector
HalfNameContainer
 

Private Member Functions

 ObjectMgr ()
 
 ~ObjectMgr ()
 
template<HighGuid high>
ObjectGuidGeneratorBaseGetGuidSequenceGenerator ()
 
void LoadScripts (ScriptsType type)
 
void LoadQuestRelationsHelper (QuestRelations &map, QuestRelationsReverse *reverseMap, std::string const &table, bool starter, bool go)
 
void PlayerCreateInfoAddItemHelper (uint32 race_, uint32 class_, uint32 itemId, int32 count)
 
void BuildPlayerLevelInfo (uint8 race, uint8 class_, uint8 level, PlayerLevelInfo *plinfo) const
 

Private Attributes

uint32 _auctionId
 
uint64 _equipmentSetGuid
 
uint32 _itemTextId
 
uint32 _mailId
 
uint32 _hiPetNumber
 
uint64 _voidItemId
 
uint64 _creatureSpawnId
 
uint64 _gameObjectSpawnId
 
std::map< HighGuid,
std::unique_ptr
< ObjectGuidGeneratorBase > > 
_guidGenerators
 
QuestMap _questTemplates
 
QuestAreaTriggerContainer _questAreaTriggerStore
 
TavernAreaTriggerContainer _tavernAreaTriggerStore
 
GameObjectForQuestContainer _gameObjectForQuestStore
 
NpcTextContainer _npcTextStore
 
QuestGreetingContainer _questGreetingStore
 
AreaTriggerContainer _areaTriggerStore
 
AreaTriggerScriptContainer _areaTriggerScriptStore
 
AccessRequirementContainer _accessRequirementStore
 
DungeonEncounterContainer _dungeonEncounterStore
 
RepRewardRateContainer _repRewardRateStore
 
RepOnKillContainer _repOnKillStore
 
RepSpilloverTemplateContainer _repSpilloverTemplateStore
 
GossipMenusContainer _gossipMenusStore
 
GossipMenuItemsContainer _gossipMenuItemsStore
 
PointOfInterestContainer _pointsOfInterestStore
 
QuestPOIContainer _questPOIStore
 
QuestRelations _goQuestRelations
 
QuestRelations _goQuestInvolvedRelations
 
QuestRelationsReverse _goQuestInvolvedRelationsReverse
 
QuestRelations _creatureQuestRelations
 
QuestRelations _creatureQuestInvolvedRelations
 
QuestRelationsReverse _creatureQuestInvolvedRelationsReverse
 
ReservedNamesContainer _reservedNamesStore
 
GameTeleContainer _gameTeleStore
 
ScriptNameContainer _scriptNamesStore
 
SpellClickInfoContainer _spellClickInfoStore
 
SpellScriptsContainer _spellScriptsStore
 
VehicleAccessoryTemplateContainer _vehicleTemplateAccessoryStore
 
VehicleAccessoryContainer _vehicleAccessoryStore
 
LocaleConstant DBCLocaleIndex
 
PageTextContainer _pageTextStore
 
InstanceTemplateContainer _instanceTemplateStore
 
TerrainPhaseInfo _terrainPhaseInfoStore
 
TerrainPhaseInfo _terrainMapDefaultStore
 
TerrainUIPhaseInfo _terrainWorldMapStore
 
PhaseInfo _phases
 
MailLevelRewardContainer _mailLevelRewardStore
 
CreatureBaseStatsContainer _creatureBaseStatsStore
 
PetLevelInfoContainer _petInfoStore
 
PlayerInfo_playerInfo [MAX_RACES][MAX_CLASSES]
 
PlayerXPperLevel _playerXPperLevel
 
BaseXPContainer _baseXPTable
 
FishingBaseSkillContainer _fishingBaseForAreaStore
 
std::unordered_map< uint32,
SkillTiersEntry
_skillTiers
 
HalfNameContainer _petHalfName0
 
HalfNameContainer _petHalfName1
 
MapObjectGuids _mapObjectGuidsStore
 
CreatureDataContainer _creatureDataStore
 
CreatureTemplateContainer _creatureTemplateStore
 
CreatureModelContainer _creatureModelStore
 
CreatureAddonContainer _creatureAddonStore
 
GameObjectAddonContainer _gameObjectAddonStore
 
GameObjectQuestItemMap _gameObjectQuestItemStore
 
CreatureQuestItemMap _creatureQuestItemStore
 
CreatureTemplateAddonContainer _creatureTemplateAddonStore
 
EquipmentInfoContainer _equipmentInfoStore
 
LinkedRespawnContainer _linkedRespawnStore
 
CreatureLocaleContainer _creatureLocaleStore
 
GameObjectDataContainer _gameObjectDataStore
 
GameObjectLocaleContainer _gameObjectLocaleStore
 
GameObjectTemplateContainer _gameObjectTemplateStore
 
TempSummonDataContainer _tempSummonDataStore
 Stores temp summon data grouped by summoner's entry, summoner's type and group id. More...
 
ItemTemplateContainer _itemTemplateStore
 
QuestTemplateLocaleContainer _questTemplateLocaleStore
 
QuestObjectivesLocaleContainer _questObjectivesLocaleStore
 
PageTextLocaleContainer _pageTextLocaleStore
 
GossipMenuItemsLocaleContainer _gossipMenuItemsLocaleStore
 
PointOfInterestLocaleContainer _pointOfInterestLocaleStore
 
TrinityStringContainer _trinityStringStore
 
CacheVendorItemContainer _cacheVendorItemStore
 
CacheTrainerSpellContainer _cacheTrainerSpellStore
 
std::set< uint32_difficultyEntries [MAX_CREATURE_DIFFICULTIES]
 
std::set< uint32_hasDifficultyEntries [MAX_CREATURE_DIFFICULTIES]
 
ExpansionRequirementContainer _raceExpansionRequirementStore
 
ExpansionRequirementContainer _classExpansionRequirementStore
 
RealmNameContainer _realmNameStore
 
CharacterTemplateContainer _characterTemplateStore
 
HotfixData _hotfixData
 
std::set< uint32_transportMaps
 

Friends

class PlayerDumpReader
 

Member Typedef Documentation

typedef std::unordered_map<uint64, AccessRequirement*> ObjectMgr::AccessRequirementContainer
typedef std::unordered_map<uint32, uint32> ObjectMgr::AreaTriggerScriptContainer
typedef std::map<uint32, uint32> ObjectMgr::BaseXPContainer
private
typedef std::multimap<int32, uint32> ObjectMgr::ExclusiveQuestGroups
typedef std::pair<ExclusiveQuestGroups::const_iterator, ExclusiveQuestGroups::const_iterator> ObjectMgr::ExclusiveQuestGroupsBounds
typedef std::map<uint32, StringVector> ObjectMgr::HalfNameContainer
private
typedef std::unordered_map<uint32, Item*> ObjectMgr::ItemMap
typedef std::unordered_map<uint32, NpcText> ObjectMgr::NpcTextContainer
private
typedef std::vector<uint32> ObjectMgr::PlayerXPperLevel
private
typedef std::unordered_map<uint32, std::unordered_set<uint32> > ObjectMgr::QuestAreaTriggerContainer
private
typedef std::unordered_map<uint32, Quest*> ObjectMgr::QuestMap
typedef std::set<std::wstring> ObjectMgr::ReservedNamesContainer
private
typedef std::vector<std::string> ObjectMgr::ScriptNameContainer
typedef std::set<uint32> ObjectMgr::TavernAreaTriggerContainer
private

Member Enumeration Documentation

Enumerator
CREATURE_TO_CREATURE 
CREATURE_TO_GO 
GO_TO_GO 
GO_TO_CREATURE 
1556  {
1558  CREATURE_TO_GO, // Creature is dependant on GO
1559  GO_TO_GO,
1560  GO_TO_CREATURE // GO is dependant on creature
1561  };
Definition: ObjectMgr.h:1560
Definition: ObjectMgr.h:1558
Definition: ObjectMgr.h:1557
Definition: ObjectMgr.h:1559

Constructor & Destructor Documentation

ObjectMgr::ObjectMgr ( )
private
238  :
239  _auctionId(1),
241  _itemTextId(1),
242  _mailId(1),
243  _hiPetNumber(1),
244  _voidItemId(1),
245  _creatureSpawnId(1),
248 {
249  for (uint8 i = 0; i < MAX_CLASSES; ++i)
250  for (uint8 j = 0; j < MAX_RACES; ++j)
251  _playerInfo[j][i] = NULL;
252 }
LocaleConstant DBCLocaleIndex
Definition: ObjectMgr.h:1475
arena_t NULL
Definition: jemalloc_internal.h:624
uint64 _voidItemId
Definition: ObjectMgr.h:1409
uint64 _gameObjectSpawnId
Definition: ObjectMgr.h:1411
uint32 _itemTextId
Definition: ObjectMgr.h:1406
uint32 _mailId
Definition: ObjectMgr.h:1407
uint32 _auctionId
Definition: ObjectMgr.h:1404
uint32 _hiPetNumber
Definition: ObjectMgr.h:1408
#define MAX_CLASSES
Definition: SharedDefines.h:181
#define MAX_RACES
Definition: SharedDefines.h:131
Definition: Common.h:117
uint8_t uint8
Definition: Define.h:152
PlayerInfo * _playerInfo[MAX_RACES][MAX_CLASSES]
Definition: ObjectMgr.h:1500
uint64 _equipmentSetGuid
Definition: ObjectMgr.h:1405
uint64 _creatureSpawnId
Definition: ObjectMgr.h:1410
ObjectMgr::~ObjectMgr ( )
private
261 {
262  for (QuestMap::iterator i = _questTemplates.begin(); i != _questTemplates.end(); ++i)
263  delete i->second;
264 
265  for (PetLevelInfoContainer::iterator i = _petInfoStore.begin(); i != _petInfoStore.end(); ++i)
266  delete[] i->second;
267 
268  for (int race = 0; race < MAX_RACES; ++race)
269  {
270  for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
271  {
272  if (_playerInfo[race][class_])
273  delete[] _playerInfo[race][class_]->levelInfo;
274  delete _playerInfo[race][class_];
275  }
276  }
277 
278  for (CacheVendorItemContainer::iterator itr = _cacheVendorItemStore.begin(); itr != _cacheVendorItemStore.end(); ++itr)
279  itr->second.Clear();
280 
281  _cacheTrainerSpellStore.clear();
282 
283  for (DungeonEncounterContainer::iterator itr =_dungeonEncounterStore.begin(); itr != _dungeonEncounterStore.end(); ++itr)
284  for (DungeonEncounterList::iterator encounterItr = itr->second.begin(); encounterItr != itr->second.end(); ++encounterItr)
285  delete *encounterItr;
286 
287  for (AccessRequirementContainer::iterator itr = _accessRequirementStore.begin(); itr != _accessRequirementStore.end(); ++itr)
288  delete itr->second;
289 
290  for (QuestGreetingContainer::iterator itr = _questGreetingStore.begin(); itr != _questGreetingStore.end(); ++itr)
291  for (std::unordered_map<uint32, QuestGreeting const*>::iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
292  delete itr2->second;
293 }
QuestGreetingContainer _questGreetingStore
Definition: ObjectMgr.h:1437
DungeonEncounterContainer _dungeonEncounterStore
Definition: ObjectMgr.h:1441
CacheTrainerSpellContainer _cacheTrainerSpellStore
Definition: ObjectMgr.h:1544
QuestMap _questTemplates
Definition: ObjectMgr.h:1426
PlayerLevelInfo * levelInfo
Definition: Player.h:415
AccessRequirementContainer _accessRequirementStore
Definition: ObjectMgr.h:1440
CacheVendorItemContainer _cacheVendorItemStore
Definition: ObjectMgr.h:1543
#define MAX_CLASSES
Definition: SharedDefines.h:181
#define MAX_RACES
Definition: SharedDefines.h:131
PetLevelInfoContainer _petInfoStore
Definition: ObjectMgr.h:1496
PlayerInfo * _playerInfo[MAX_RACES][MAX_CLASSES]
Definition: ObjectMgr.h:1500
ObjectMgr::ObjectMgr ( ObjectMgr const )
delete
ObjectMgr::ObjectMgr ( ObjectMgr &&  )
delete

Member Function Documentation

ObjectGuid::LowType ObjectMgr::AddCreatureData ( uint32  entry,
uint32  map,
float  x,
float  y,
float  z,
float  o,
uint32  spawntimedelay = 0 
)
1980 {
1981  CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
1982  if (!cInfo)
1983  return UI64LIT(0);
1984 
1985  uint32 level = cInfo->minlevel == cInfo->maxlevel ? cInfo->minlevel : urand(cInfo->minlevel, cInfo->maxlevel); // Only used for extracting creature base stats
1986  CreatureBaseStats const* stats = GetCreatureBaseStats(level, cInfo->unit_class);
1987  Map* map = sMapMgr->CreateBaseMap(mapId);
1988  if (!map)
1989  return UI64LIT(0);
1990 
1992  CreatureData& data = NewOrExistCreatureData(guid);
1993  data.id = entry;
1994  data.mapid = mapId;
1995  data.displayid = 0;
1996  data.equipmentId = 0;
1997  data.posX = x;
1998  data.posY = y;
1999  data.posZ = z;
2000  data.orientation = o;
2001  data.spawntimesecs = spawntimedelay;
2002  data.spawndist = 0;
2003  data.currentwaypoint = 0;
2004  data.curhealth = stats->GenerateHealth(cInfo);
2005  data.curmana = stats->GenerateMana(cInfo);
2006  data.movementType = cInfo->MovementType;
2007  data.spawnMask = 1;
2008  data.phaseMask = PHASEMASK_NORMAL;
2009  data.dbData = false;
2010  data.npcflag = cInfo->npcflag;
2011  data.unit_flags = cInfo->unit_flags;
2012  data.dynamicflags = cInfo->dynamicflags;
2013 
2014  AddCreatureToGrid(guid, &data);
2015 
2016  // We use spawn coords to spawn
2017  if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
2018  {
2019  Creature* creature = new Creature();
2020  if (!creature->LoadCreatureFromDB(guid, map))
2021  {
2022  TC_LOG_ERROR("misc", "AddCreature: Cannot add creature entry %u to map", entry);
2023  delete creature;
2024  return UI64LIT(0);
2025  }
2026  }
2027 
2028  return guid;
2029 }
Definition: Creature.h:287
int16 maxlevel
Definition: Creature.h:94
uint8 movementType
Definition: Creature.h:307
CreatureData & NewOrExistCreatureData(ObjectGuid::LowType guid)
Definition: ObjectMgr.h:1158
uint32 id
Definition: Creature.h:293
int16 minlevel
Definition: Creature.h:93
uint32 dynamicflags
Definition: Creature.h:111
uint64 npcflag
Definition: Creature.h:98
uint32 displayid
Definition: Creature.h:296
uint32 curhealth
Definition: Creature.h:305
uint32 curmana
Definition: Creature.h:306
#define UI64LIT(N)
Definition: Define.h:138
float spawndist
Definition: Creature.h:303
void AddCreatureToGrid(ObjectGuid::LowType guid, CreatureData const *data)
Definition: ObjectMgr.cpp:1901
Definition: Creature.h:467
bool dbData
Definition: Creature.h:314
uint64 LowType
Definition: ObjectGuid.h:199
float posX
Definition: Creature.h:298
uint32 spawntimesecs
Definition: Creature.h:302
CreatureBaseStats const * GetCreatureBaseStats(uint8 level, uint8 unitClass)
Definition: ObjectMgr.cpp:8641
uint32 MovementType
Definition: Creature.h:128
uint64 GenerateCreatureSpawnId()
Definition: ObjectMgr.cpp:6450
float posY
Definition: Creature.h:299
Definition: Object.h:66
G3D::int16 z
Definition: Vector3int16.h:46
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
uint32 unit_flags
Definition: Creature.h:109
int8 equipmentId
Definition: Creature.h:297
uint32_t uint32
Definition: Define.h:150
G3D::int16 y
Definition: Vector2int16.h:38
uint32 GenerateMana(CreatureTemplate const *info) const
Definition: Creature.h:234
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
Definition: Map.h:259
uint32 dynamicflags
Definition: Creature.h:311
uint32 spawnMask
Definition: Creature.h:308
uint32 unit_flags
Definition: Creature.h:310
uint32 GenerateHealth(CreatureTemplate const *info) const
Definition: Creature.h:229
uint32 currentwaypoint
Definition: Creature.h:304
#define sMapMgr
Definition: MapManager.h:194
float orientation
Definition: Creature.h:301
bool Instanceable() const
Definition: Map.h:394
uint16 mapid
Definition: Creature.h:294
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32 phaseMask
Definition: Creature.h:295
G3D::int16 x
Definition: Vector2int16.h:37
bool IsRemovalGrid(float x, float y) const
Definition: Map.h:302
uint64 npcflag
Definition: Creature.h:309
bool LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap=true, bool allowDuplicate=false)
Definition: Creature.cpp:1327
float posZ
Definition: Creature.h:300
uint32 unit_class
Definition: Creature.h:108
Definition: Creature.h:79
Definition: Creature.h:218

+ Here is the call graph for this function:

void ObjectMgr::AddCreatureToGrid ( ObjectGuid::LowType  guid,
CreatureData const data 
)
1902 {
1903  uint32 mask = data->spawnMask;
1904  for (uint8 i = 0; mask != 0; i++, mask >>= 1)
1905  {
1906  if (mask & 1)
1907  {
1908  CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY);
1909  CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
1910  cell_guids.creatures.insert(guid);
1911  }
1912  }
1913 }
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
MapObjectGuids _mapObjectGuidsStore
Definition: ObjectMgr.h:1516
uint32_t uint32
Definition: Define.h:150
CellGuidSet creatures
Definition: ObjectMgr.h:412
uint8_t uint8
Definition: Define.h:152
Definition: ObjectMgr.h:410
uint32 MAKE_PAIR32(uint16 l, uint16 h)
Definition: ObjectDefines.h:54
uint32 GetId() const
Definition: GridDefines.h:150

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ObjectMgr::AddGameobjectInfo ( GameObjectTemplate goinfo)
void ObjectMgr::AddGameobjectToGrid ( ObjectGuid::LowType  guid,
GameObjectData const data 
)
2214 {
2215  uint32 mask = data->spawnMask;
2216  for (uint8 i = 0; mask != 0; i++, mask >>= 1)
2217  {
2218  if (mask & 1)
2219  {
2220  CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY);
2221  CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
2222  cell_guids.gameobjects.insert(guid);
2223  }
2224  }
2225 }
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
MapObjectGuids _mapObjectGuidsStore
Definition: ObjectMgr.h:1516
uint32_t uint32
Definition: Define.h:150
uint8_t uint8
Definition: Define.h:152
CellGuidSet gameobjects
Definition: ObjectMgr.h:413
Definition: ObjectMgr.h:410
uint32 MAKE_PAIR32(uint16 l, uint16 h)
Definition: ObjectDefines.h:54
uint32 GetId() const
Definition: GridDefines.h:150

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ObjectMgr::AddGameTele ( GameTele data)
7993 {
7994  // find max id
7995  uint32 new_id = 0;
7996  for (GameTeleContainer::const_iterator itr = _gameTeleStore.begin(); itr != _gameTeleStore.end(); ++itr)
7997  if (itr->first > new_id)
7998  new_id = itr->first;
7999 
8000  // use next
8001  ++new_id;
8002 
8003  if (!Utf8toWStr(tele.name, tele.wnameLow))
8004  return false;
8005 
8006  wstrToLower(tele.wnameLow);
8007 
8008  _gameTeleStore[new_id] = tele;
8009 
8011 
8012  stmt->setUInt32(0, new_id);
8013  stmt->setFloat(1, tele.position_x);
8014  stmt->setFloat(2, tele.position_y);
8015  stmt->setFloat(3, tele.position_z);
8016  stmt->setFloat(4, tele.orientation);
8017  stmt->setUInt16(5, uint16(tele.mapId));
8018  stmt->setString(6, tele.name);
8019 
8020  WorldDatabase.Execute(stmt);
8021 
8022  return true;
8023 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
GameTeleContainer _gameTeleStore
Definition: ObjectMgr.h:1464
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:281
uint16_t uint16
Definition: g3dmath.h:166
void wstrToLower(std::wstring &str)
Definition: Util.h:306
Definition: PreparedStatement.h:74
Definition: WorldDatabase.h:42
void setUInt16(const uint8 index, const uint16 value)
Definition: PreparedStatement.cpp:106
uint32_t uint32
Definition: Define.h:150
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
void setFloat(const uint8 index, const float value)
Definition: PreparedStatement.cpp:169

+ Here is the call graph for this function:

ObjectGuid::LowType ObjectMgr::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 
)
1930 {
1931  GameObjectTemplate const* goinfo = GetGameObjectTemplate(entry);
1932  if (!goinfo)
1933  return UI64LIT(0);
1934 
1935  Map* map = sMapMgr->CreateBaseMap(mapId);
1936  if (!map)
1937  return UI64LIT(0);
1938 
1940  GameObjectData& data = NewGOData(guid);
1941  data.id = entry;
1942  data.mapid = mapId;
1943  data.posX = x;
1944  data.posY = y;
1945  data.posZ = z;
1946  data.orientation = o;
1947  data.rotation0 = rotation0;
1948  data.rotation1 = rotation1;
1949  data.rotation2 = rotation2;
1950  data.rotation3 = rotation3;
1951  data.spawntimesecs = spawntimedelay;
1952  data.animprogress = 100;
1953  data.spawnMask = 1;
1954  data.go_state = GO_STATE_READY;
1955  data.phaseMask = PHASEMASK_NORMAL;
1956  data.artKit = goinfo->type == GAMEOBJECT_TYPE_CONTROL_ZONE ? 21 : 0;
1957  data.dbData = false;
1958 
1959  AddGameobjectToGrid(guid, &data);
1960 
1961  // Spawn if necessary (loaded grids only)
1962  // We use spawn coords to spawn
1963  if (!map->Instanceable() && map->IsGridLoaded(x, y))
1964  {
1965  GameObject* go = new GameObject;
1966  if (!go->LoadGameObjectFromDB(guid, map))
1967  {
1968  TC_LOG_ERROR("misc", "AddGOData: cannot add gameobject entry %u to map", entry);
1969  delete go;
1970  return UI64LIT(0);
1971  }
1972  }
1973 
1974  TC_LOG_DEBUG("maps", "AddGOData: dbguid " UI64FMTD " entry %u map %u x %f y %f z %f o %f", guid, entry, mapId, x, y, z, o);
1975 
1976  return guid;
1977 }
GameObjectTemplate const * GetGameObjectTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9104
uint32 spawnMask
Definition: GameObject.h:852
float posZ
Definition: GameObject.h:843
uint64 GenerateGameObjectSpawnId()
Definition: ObjectMgr.cpp:6460
float rotation0
Definition: GameObject.h:845
int32 spawntimesecs
Definition: GameObject.h:849
Definition: SharedDefines.h:2094
float rotation2
Definition: GameObject.h:847
float rotation3
Definition: GameObject.h:848
#define UI64LIT(N)
Definition: Define.h:138
Definition: GameObject.h:34
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
bool IsGridLoaded(float x, float y) const
Definition: Map.h:308
uint64 LowType
Definition: ObjectGuid.h:199
float orientation
Definition: GameObject.h:844
void AddGameobjectToGrid(ObjectGuid::LowType guid, GameObjectData const *data)
Definition: ObjectMgr.cpp:2213
uint8 artKit
Definition: GameObject.h:853
Definition: Object.h:66
G3D::int16 z
Definition: Vector3int16.h:46
#define UI64FMTD
Definition: Define.h:137
bool LoadGameObjectFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap=true)
Definition: GameObject.cpp:858
uint32 id
Definition: GameObject.h:838
G3D::int16 y
Definition: Vector2int16.h:38
Definition: GameObject.h:880
Definition: Map.h:259
Definition: GameObject.h:823
Definition: GameObject.h:833
uint16 mapid
Definition: GameObject.h:839
uint32 animprogress
Definition: GameObject.h:850
#define sMapMgr
Definition: MapManager.h:194
float rotation1
Definition: GameObject.h:846
bool Instanceable() const
Definition: Map.h:394
bool dbData
Definition: GameObject.h:856
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
G3D::int16 x
Definition: Vector2int16.h:37
float posX
Definition: GameObject.h:841
uint32 phaseMask
Definition: GameObject.h:840
GameObjectData & NewGOData(ObjectGuid::LowType guid)
Definition: ObjectMgr.h:1215
float posY
Definition: GameObject.h:842
uint32 type
Definition: GameObject.h:37
GOState go_state
Definition: GameObject.h:851

+ Here is the call graph for this function:

bool ObjectMgr::AddGraveYardLink ( uint32  id,
uint32  zoneId,
uint32  team,
bool  persist = true 
)
6056 {
6057  if (FindGraveYardData(id, zoneId))
6058  return false;
6059 
6060  // add link to loaded data
6061  GraveYardData data;
6062  data.safeLocId = id;
6063  data.team = team;
6064 
6065  GraveYardStore.insert(GraveYardContainer::value_type(zoneId, data));
6066 
6067  // add link to DB
6068  if (persist)
6069  {
6071 
6072  stmt->setUInt32(0, id);
6073  stmt->setUInt32(1, zoneId);
6074  stmt->setUInt16(2, uint16(team));
6075 
6076  WorldDatabase.Execute(stmt);
6077  }
6078 
6079  return true;
6080 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 team
Definition: ObjectMgr.h:592
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32 safeLocId
Definition: ObjectMgr.h:591
uint16_t uint16
Definition: g3dmath.h:166
Definition: PreparedStatement.h:74
Definition: WorldDatabase.h:40
Definition: ObjectMgr.h:589
GraveYardData const * FindGraveYardData(uint32 id, uint32 zone)
Definition: ObjectMgr.cpp:6043
void setUInt16(const uint8 index, const uint16 value)
Definition: PreparedStatement.cpp:106
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
GraveYardContainer GraveYardStore
Definition: ObjectMgr.h:1342

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ObjectMgr::AddLocaleString ( std::string const value,
LocaleConstant  localeConstant,
StringVector data 
)
static
296 {
297  if (!value.empty())
298  {
299  if (data.size() <= size_t(localeConstant))
300  data.resize(localeConstant + 1);
301 
302  data[localeConstant] = value;
303  }
304 }
const FieldDescriptor value
Definition: descriptor.h:1522

+ Here is the caller graph for this function:

void ObjectMgr::AddSpellToTrainer ( uint32  entry,
uint32  spell,
uint32  spellCost,
uint32  reqSkill,
uint32  reqSkillValue,
uint32  reqLevel 
)
8113 {
8114  if (ID >= TRINITY_TRAINER_START_REF)
8115  return;
8116 
8117  CreatureTemplate const* cInfo = GetCreatureTemplate(ID);
8118  if (!cInfo)
8119  {
8120  TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains entries for a non-existing creature template (ID: %u), ignoring", ID);
8121  return;
8122  }
8123 
8124  if (!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER))
8125  {
8126  TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains entries for a creature template (ID: %u) without any trainer flag, ignoring", ID);
8127  return;
8128  }
8129 
8130  SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(SpellID);
8131  if (!spellinfo)
8132  {
8133  TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains an ID (%u) for a non-existing spell (Spell: %u), ignoring", ID, SpellID);
8134  return;
8135  }
8136 
8137  if (!SpellMgr::IsSpellValid(spellinfo))
8138  {
8139  TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains an ID (%u) for a broken spell (Spell: %u), ignoring", ID, SpellID);
8140  return;
8141  }
8142 
8144 
8145  TrainerSpell& trainerSpell = data.spellList[SpellID];
8146  trainerSpell.SpellID = SpellID;
8147  trainerSpell.MoneyCost = MoneyCost;
8148  trainerSpell.ReqSkillLine = ReqSkillLine;
8149  trainerSpell.ReqSkillRank = ReqSkillRank;
8150  trainerSpell.ReqLevel = ReqLevel;
8151 
8152  if (!trainerSpell.ReqLevel)
8153  trainerSpell.ReqLevel = spellinfo->SpellLevel;
8154 
8155  // calculate learned spell for profession case when stored cast-spell
8156  trainerSpell.ReqAbility[0] = SpellID;
8157  for (SpellEffectInfo const* effect : spellinfo->GetEffectsForDifficulty(DIFFICULTY_NONE))
8158  {
8159  if (!effect || effect->Effect != SPELL_EFFECT_LEARN_SPELL)
8160  continue;
8161  if (trainerSpell.ReqAbility[0] == SpellID)
8162  trainerSpell.ReqAbility[0] = 0;
8163  // player must be able to cast spell on himself
8164  if (effect->TargetA.GetTarget() != 0 && effect->TargetA.GetTarget() != TARGET_UNIT_TARGET_ALLY
8165  && effect->TargetA.GetTarget() != TARGET_UNIT_TARGET_ANY && effect->TargetA.GetTarget() != TARGET_UNIT_CASTER)
8166  {
8167  TC_LOG_ERROR("sql.sql", "Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", SpellID, ID);
8168  continue;
8169  }
8170 
8171  trainerSpell.ReqAbility[effect->EffectIndex] = effect->TriggerSpell;
8172 
8173  if (trainerSpell.ReqAbility[effect->EffectIndex])
8174  {
8175  SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainerSpell.ReqAbility[effect->EffectIndex]);
8176  if (learnedSpellInfo && learnedSpellInfo->IsProfession())
8177  data.trainerType = 2;
8178  }
8179  }
8180 
8181  return;
8182 }
Definition: DBCEnums.h:404
CacheTrainerSpellContainer _cacheTrainerSpellStore
Definition: ObjectMgr.h:1544
uint32 SpellLevel
Definition: SpellInfo.h:375
Definition: SpellInfo.h:326
uint64 npcflag
Definition: Creature.h:98
uint32 trainerType
Definition: Creature.h:451
Definition: Unit.h:739
bool IsProfession(uint32 difficulty=DIFFICULTY_NONE) const
Definition: SpellInfo.cpp:1270
uint32 ReqSkillRank
Definition: Creature.h:435
Definition: SharedDefines.h:1894
Definition: SharedDefines.h:1046
uint32 ReqSkillLine
Definition: Creature.h:434
Definition: Creature.h:424
uint32 ReqAbility[MAX_TRAINERSPELL_ABILITY_REQS]
Definition: Creature.h:437
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: SpellInfo.h:238
static bool IsSpellValid(SpellInfo const *spellInfo, Player *player=NULL, bool msg=true)
Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book...
Definition: SpellMgr.cpp:482
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
Definition: SharedDefines.h:1890
uint32 ReqLevel
Definition: Creature.h:436
uint32 SpellID
Definition: Creature.h:432
TrainerSpellMap spellList
Definition: Creature.h:450
#define TRINITY_TRAINER_START_REF
Definition: ObjectMgr.h:419
SpellEffectInfoVector GetEffectsForDifficulty(uint32 difficulty) const
Definition: SpellInfo.cpp:3311
Definition: Creature.h:445
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: SharedDefines.h:1875
Definition: Creature.h:79
uint32 MoneyCost
Definition: Creature.h:433

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ObjectMgr::AddVendorItem ( uint32  entry,
uint32  item,
int32  maxcount,
uint32  incrtime,
uint32  extendedCost,
uint8  type,
bool  persist = true 
)
8438 {
8439  VendorItemData& vList = _cacheVendorItemStore[entry];
8440  vList.AddItem(item, maxcount, incrtime, extendedCost, type);
8441 
8442  if (persist)
8443  {
8445 
8446  stmt->setUInt32(0, entry);
8447  stmt->setUInt32(1, item);
8448  stmt->setUInt8(2, maxcount);
8449  stmt->setUInt32(3, incrtime);
8450  stmt->setUInt32(4, extendedCost);
8451  stmt->setUInt8(5, type);
8452 
8453  WorldDatabase.Execute(stmt);
8454  }
8455 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: WorldDatabase.h:44
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
CacheVendorItemContainer _cacheVendorItemStore
Definition: ObjectMgr.h:1543
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
Definition: Creature.h:383
void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, uint8 type)
Definition: Creature.h:396

+ Here is the call graph for this function:

void ObjectMgr::BuildPlayerLevelInfo ( uint8  race,
uint8  class_,
uint8  level,
PlayerLevelInfo plinfo 
) const
private
3571 {
3572  // base data (last known level)
3573  *info = _playerInfo[race][_class]->levelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)-1];
3574 
3575  // if conversion from uint32 to uint8 causes unexpected behaviour, change lvl to uint32
3576  for (uint8 lvl = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)-1; lvl < level; ++lvl)
3577  {
3578  switch (_class)
3579  {
3580  case CLASS_WARRIOR:
3581  info->stats[STAT_STRENGTH] += (lvl > 23 ? 2: (lvl > 1 ? 1: 0));
3582  info->stats[STAT_STAMINA] += (lvl > 23 ? 2: (lvl > 1 ? 1: 0));
3583  info->stats[STAT_AGILITY] += (lvl > 36 ? 1: (lvl > 6 && (lvl%2) ? 1: 0));
3584  info->stats[STAT_INTELLECT] += (lvl > 9 && !(lvl%2) ? 1: 0);
3585  info->stats[STAT_SPIRIT] += (lvl > 9 && !(lvl%2) ? 1: 0);
3586  break;
3587  case CLASS_PALADIN:
3588  info->stats[STAT_STRENGTH] += (lvl > 3 ? 1: 0);
3589  info->stats[STAT_STAMINA] += (lvl > 33 ? 2: (lvl > 1 ? 1: 0));
3590  info->stats[STAT_AGILITY] += (lvl > 38 ? 1: (lvl > 7 && !(lvl%2) ? 1: 0));
3591  info->stats[STAT_INTELLECT] += (lvl > 6 && (lvl%2) ? 1: 0);
3592  info->stats[STAT_SPIRIT] += (lvl > 7 ? 1: 0);
3593  break;
3594  case CLASS_HUNTER:
3595  info->stats[STAT_STRENGTH] += (lvl > 4 ? 1: 0);
3596  info->stats[STAT_STAMINA] += (lvl > 4 ? 1: 0);
3597  info->stats[STAT_AGILITY] += (lvl > 33 ? 2: (lvl > 1 ? 1: 0));
3598  info->stats[STAT_INTELLECT] += (lvl > 8 && (lvl%2) ? 1: 0);
3599  info->stats[STAT_SPIRIT] += (lvl > 38 ? 1: (lvl > 9 && !(lvl%2) ? 1: 0));
3600  break;
3601  case CLASS_ROGUE:
3602  info->stats[STAT_STRENGTH] += (lvl > 5 ? 1: 0);
3603  info->stats[STAT_STAMINA] += (lvl > 4 ? 1: 0);
3604  info->stats[STAT_AGILITY] += (lvl > 16 ? 2: (lvl > 1 ? 1: 0));
3605  info->stats[STAT_INTELLECT] += (lvl > 8 && !(lvl%2) ? 1: 0);
3606  info->stats[STAT_SPIRIT] += (lvl > 38 ? 1: (lvl > 9 && !(lvl%2) ? 1: 0));
3607  break;
3608  case CLASS_PRIEST:
3609  info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl%2) ? 1: 0);
3610  info->stats[STAT_STAMINA] += (lvl > 5 ? 1: 0);
3611  info->stats[STAT_AGILITY] += (lvl > 38 ? 1: (lvl > 8 && (lvl%2) ? 1: 0));
3612  info->stats[STAT_INTELLECT] += (lvl > 22 ? 2: (lvl > 1 ? 1: 0));
3613  info->stats[STAT_SPIRIT] += (lvl > 3 ? 1: 0);
3614  break;
3615  case CLASS_SHAMAN:
3616  info->stats[STAT_STRENGTH] += (lvl > 34 ? 1: (lvl > 6 && (lvl%2) ? 1: 0));
3617  info->stats[STAT_STAMINA] += (lvl > 4 ? 1: 0);
3618  info->stats[STAT_AGILITY] += (lvl > 7 && !(lvl%2) ? 1: 0);
3619  info->stats[STAT_INTELLECT] += (lvl > 5 ? 1: 0);
3620  info->stats[STAT_SPIRIT] += (lvl > 4 ? 1: 0);
3621  break;
3622  case CLASS_MAGE:
3623  info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl%2) ? 1: 0);
3624  info->stats[STAT_STAMINA] += (lvl > 5 ? 1: 0);
3625  info->stats[STAT_AGILITY] += (lvl > 9 && !(lvl%2) ? 1: 0);
3626  info->stats[STAT_INTELLECT] += (lvl > 24 ? 2: (lvl > 1 ? 1: 0));
3627  info->stats[STAT_SPIRIT] += (lvl > 33 ? 2: (lvl > 2 ? 1: 0));
3628  break;
3629  case CLASS_WARLOCK:
3630  info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl%2) ? 1: 0);
3631  info->stats[STAT_STAMINA] += (lvl > 38 ? 2: (lvl > 3 ? 1: 0));
3632  info->stats[STAT_AGILITY] += (lvl > 9 && !(lvl%2) ? 1: 0);
3633  info->stats[STAT_INTELLECT] += (lvl > 33 ? 2: (lvl > 2 ? 1: 0));
3634  info->stats[STAT_SPIRIT] += (lvl > 38 ? 2: (lvl > 3 ? 1: 0));
3635  break;
3636  case CLASS_DRUID:
3637  info->stats[STAT_STRENGTH] += (lvl > 38 ? 2: (lvl > 6 && (lvl%2) ? 1: 0));
3638  info->stats[STAT_STAMINA] += (lvl > 32 ? 2: (lvl > 4 ? 1: 0));
3639  info->stats[STAT_AGILITY] += (lvl > 38 ? 2: (lvl > 8 && (lvl%2) ? 1: 0));
3640  info->stats[STAT_INTELLECT] += (lvl > 38 ? 3: (lvl > 4 ? 1: 0));
3641  info->stats[STAT_SPIRIT] += (lvl > 38 ? 3: (lvl > 5 ? 1: 0));
3642  }
3643  }
3644 }
Definition: SharedDefines.h:170
Definition: SharedDefines.h:239
PlayerLevelInfo * levelInfo
Definition: Player.h:415
Definition: SharedDefines.h:238
#define sWorld
Definition: World.h:887
Definition: SharedDefines.h:168
Definition: SharedDefines.h:237
Definition: SharedDefines.h:240
Definition: SharedDefines.h:167
Definition: SharedDefines.h:171
Definition: SharedDefines.h:173
Definition: SharedDefines.h:174
Definition: SharedDefines.h:169
Definition: SharedDefines.h:241
uint8_t uint8
Definition: Define.h:152
PlayerInfo * _playerInfo[MAX_RACES][MAX_CLASSES]
Definition: ObjectMgr.h:1500
Definition: SharedDefines.h:175
Definition: SharedDefines.h:177
Definition: World.h:235

+ Here is the caller graph for this function:

void ObjectMgr::CheckCreatureTemplate ( CreatureTemplate const cInfo)

if not set custom creature scale then load scale from CreatureDisplayInfo.dbc

619 {
620  if (!cInfo)
621  return;
622 
623  bool ok = true; // bool to allow continue outside this loop
624  for (uint32 diff = 0; diff < MAX_CREATURE_DIFFICULTIES && ok; ++diff)
625  {
626  if (!cInfo->DifficultyEntry[diff])
627  continue;
628  ok = false; // will be set to true at the end of this loop again
629 
630  CreatureTemplate const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]);
631  if (!difficultyInfo)
632  {
633  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u does not exist.",
634  cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff]);
635  continue;
636  }
637 
638  bool ok2 = true;
639  for (uint32 diff2 = 0; diff2 < MAX_CREATURE_DIFFICULTIES && ok2; ++diff2)
640  {
641  ok2 = false;
642  if (_difficultyEntries[diff2].find(cInfo->Entry) != _difficultyEntries[diff2].end())
643  {
644  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) is listed as `difficulty_entry_%u` of another creature, but itself lists %u in `difficulty_entry_%u`.",
645  cInfo->Entry, diff2 + 1, cInfo->DifficultyEntry[diff], diff + 1);
646  continue;
647  }
648 
649  if (_difficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _difficultyEntries[diff2].end())
650  {
651  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) already listed as `difficulty_entry_%u` for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1);
652  continue;
653  }
654 
655  if (_hasDifficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _hasDifficultyEntries[diff2].end())
656  {
657  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u has itself a value in `difficulty_entry_%u`.",
658  cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff], diff2 + 1);
659  continue;
660  }
661  ok2 = true;
662  }
663 
664  if (!ok2)
665  continue;
666 
667  if (cInfo->expansion > difficultyInfo->expansion)
668  {
669  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, exp %u) has different `exp` in difficulty %u mode (Entry: %u, exp %u).",
670  cInfo->Entry, cInfo->expansion, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->expansion);
671  }
672 
673  if (cInfo->faction != difficultyInfo->faction)
674  {
675  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, faction %u) has different `faction` in difficulty %u mode (Entry: %u, faction %u).",
676  cInfo->Entry, cInfo->faction, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->faction);
677  TC_LOG_ERROR("sql.sql", "Possible FIX: UPDATE `creature_template` SET `faction`=%u WHERE `entry`=%u;",
678  cInfo->faction, cInfo->DifficultyEntry[diff]);
679  }
680 
681  if (cInfo->unit_class != difficultyInfo->unit_class)
682  {
683  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).",
684  cInfo->Entry, cInfo->unit_class, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->unit_class);
685  TC_LOG_ERROR("sql.sql", "Possible FIX: UPDATE `creature_template` SET `unit_class`=%u WHERE `entry`=%u;",
686  cInfo->unit_class, cInfo->DifficultyEntry[diff]);
687  continue;
688  }
689 
690  if (cInfo->npcflag != difficultyInfo->npcflag)
691  {
692  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, `npcflag`: " UI64FMTD ") has different `npcflag` in difficulty %u mode (Entry: %u, `npcflag`: " UI64FMTD ").",
693  cInfo->Entry, cInfo->npcflag, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->npcflag);
694  TC_LOG_ERROR("sql.sql", "Possible FIX: UPDATE `creature_template` SET `npcflag`=" UI64FMTD " WHERE `entry`=%u;",
695  cInfo->npcflag, cInfo->DifficultyEntry[diff]);
696  continue;
697  }
698 
699  if (cInfo->family != difficultyInfo->family)
700  {
701  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, family %u) has different `family` in difficulty %u mode (Entry: %u, family %u).",
702  cInfo->Entry, cInfo->family, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->family);
703  TC_LOG_ERROR("sql.sql", "Possible FIX: UPDATE `creature_template` SET `family`=%u WHERE `entry`=%u;",
704  cInfo->family, cInfo->DifficultyEntry[diff]);
705  }
706 
707  if (cInfo->trainer_class != difficultyInfo->trainer_class)
708  {
709  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, trainer_class: %u) has different `trainer_class` in difficulty %u mode (Entry: %u, trainer_class: %u).",
710  cInfo->Entry, cInfo->trainer_class, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->trainer_class);
711  TC_LOG_ERROR("sql.sql", "Possible FIX: UPDATE `creature_template` SET `trainer_class`=%u WHERE `entry`=%u;",
712  cInfo->trainer_class, cInfo->DifficultyEntry[diff]);
713  continue;
714  }
715 
716  if (cInfo->trainer_race != difficultyInfo->trainer_race)
717  {
718  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, trainer_race: %u) has different `trainer_race` in difficulty %u mode (Entry: %u, trainer_race: %u).",
719  cInfo->Entry, cInfo->trainer_race, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->trainer_race);
720  TC_LOG_ERROR("sql.sql", "Possible FIX: UPDATE `creature_template` SET `trainer_race`=%u WHERE `entry`=%u;",
721  cInfo->trainer_race, cInfo->DifficultyEntry[diff]);
722  continue;
723  }
724 
725  if (cInfo->trainer_type != difficultyInfo->trainer_type)
726  {
727  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, trainer_type: %u) has different `trainer_type` in difficulty %u mode (Entry: %u, trainer_type: %u).",
728  cInfo->Entry, cInfo->trainer_type, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->trainer_type);
729  TC_LOG_ERROR("sql.sql", "Possible FIX: UPDATE `creature_template` SET `trainer_type`=%u WHERE `entry`=%u;",
730  cInfo->trainer_type, cInfo->DifficultyEntry[diff]);
731  continue;
732  }
733 
734  if (cInfo->type != difficultyInfo->type)
735  {
736  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, type %u) has different `type` in difficulty %u mode (Entry: %u, type %u).",
737  cInfo->Entry, cInfo->type, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->type);
738  TC_LOG_ERROR("sql.sql", "Possible FIX: UPDATE `creature_template` SET `type`=%u WHERE `entry`=%u;",
739  cInfo->type, cInfo->DifficultyEntry[diff]);
740  }
741 
742  if (!cInfo->VehicleId && difficultyInfo->VehicleId)
743  {
744  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, VehicleId %u) has different `VehicleId` in difficulty %u mode (Entry: %u, VehicleId %u).",
745  cInfo->Entry, cInfo->VehicleId, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->VehicleId);
746  }
747 
748  if (!difficultyInfo->AIName.empty())
749  {
750  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists difficulty %u mode entry %u with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.",
751  cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
752  continue;
753  }
754 
755  if (difficultyInfo->ScriptID)
756  {
757  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists difficulty %u mode entry %u with `ScriptName` filled in. `ScriptName` of difficulty 0 mode creature is always used instead.",
758  cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
759  continue;
760  }
761 
762  _hasDifficultyEntries[diff].insert(cInfo->Entry);
763  _difficultyEntries[diff].insert(cInfo->DifficultyEntry[diff]);
764  ok = true;
765  }
766 
767  FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction);
768  if (!factionTemplate)
769  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has non-existing faction template (%u).", cInfo->Entry, cInfo->faction);
770 
771  // used later for scale
772  CreatureDisplayInfoEntry const* displayScaleEntry = NULL;
773 
774  if (cInfo->Modelid1)
775  {
776  CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid1);
777  if (!displayEntry)
778  {
779  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid1 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid1);
780  const_cast<CreatureTemplate*>(cInfo)->Modelid1 = 0;
781  }
782  else if (!displayScaleEntry)
783  displayScaleEntry = displayEntry;
784 
785  CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid1);
786  if (!modelInfo)
787  TC_LOG_ERROR("sql.sql", "No model data exist for `Modelid1` = %u listed by creature (Entry: %u).", cInfo->Modelid1, cInfo->Entry);
788  }
789 
790  if (cInfo->Modelid2)
791  {
792  CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid2);
793  if (!displayEntry)
794  {
795  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid2 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid2);
796  const_cast<CreatureTemplate*>(cInfo)->Modelid2 = 0;
797  }
798  else if (!displayScaleEntry)
799  displayScaleEntry = displayEntry;
800 
801  CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid2);
802  if (!modelInfo)
803  TC_LOG_ERROR("sql.sql", "No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry);
804  }
805 
806  if (cInfo->Modelid3)
807  {
808  CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid3);
809  if (!displayEntry)
810  {
811  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid3 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid3);
812  const_cast<CreatureTemplate*>(cInfo)->Modelid3 = 0;
813  }
814  else if (!displayScaleEntry)
815  displayScaleEntry = displayEntry;
816 
817  CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid3);
818  if (!modelInfo)
819  TC_LOG_ERROR("sql.sql", "No model data exist for `Modelid3` = %u listed by creature (Entry: %u).", cInfo->Modelid3, cInfo->Entry);
820  }
821 
822  if (cInfo->Modelid4)
823  {
824  CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid4);
825  if (!displayEntry)
826  {
827  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid4 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid4);
828  const_cast<CreatureTemplate*>(cInfo)->Modelid4 = 0;
829  }
830  else if (!displayScaleEntry)
831  displayScaleEntry = displayEntry;
832 
833  CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid4);
834  if (!modelInfo)
835  TC_LOG_ERROR("sql.sql", "No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry);
836  }
837 
838  if (!displayScaleEntry)
839  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) does not have any existing display id in Modelid1/Modelid2/Modelid3/Modelid4.", cInfo->Entry);
840 
841  for (int k = 0; k < MAX_KILL_CREDIT; ++k)
842  {
843  if (cInfo->KillCredit[k])
844  {
845  if (!GetCreatureTemplate(cInfo->KillCredit[k]))
846  {
847  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing creature entry %u in `KillCredit%d`.", cInfo->Entry, cInfo->KillCredit[k], k + 1);
848  const_cast<CreatureTemplate*>(cInfo)->KillCredit[k] = 0;
849  }
850  }
851  }
852 
853  if (!cInfo->unit_class || ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0)
854  {
855  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid unit_class (%u) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class);
856  const_cast<CreatureTemplate*>(cInfo)->unit_class = UNIT_CLASS_WARRIOR;
857  }
858 
859  if (cInfo->dmgschool >= MAX_SPELL_SCHOOL)
860  {
861  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid spell school value (%u) in `dmgschool`.", cInfo->Entry, cInfo->dmgschool);
862  const_cast<CreatureTemplate*>(cInfo)->dmgschool = SPELL_SCHOOL_NORMAL;
863  }
864 
865  if (cInfo->BaseAttackTime == 0)
866  const_cast<CreatureTemplate*>(cInfo)->BaseAttackTime = BASE_ATTACK_TIME;
867 
868  if (cInfo->RangeAttackTime == 0)
869  const_cast<CreatureTemplate*>(cInfo)->RangeAttackTime = BASE_ATTACK_TIME;
870 
871  if ((cInfo->npcflag & UNIT_NPC_FLAG_TRAINER) && cInfo->trainer_type >= MAX_TRAINER_TYPE)
872  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong trainer type %u.", cInfo->Entry, cInfo->trainer_type);
873 
874  if (cInfo->speed_walk == 0.0f)
875  {
876  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong value (%f) in speed_walk, set to 1.", cInfo->Entry, cInfo->speed_walk);
877  const_cast<CreatureTemplate*>(cInfo)->speed_walk = 1.0f;
878  }
879 
880  if (cInfo->speed_run == 0.0f)
881  {
882  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong value (%f) in speed_run, set to 1.14286.", cInfo->Entry, cInfo->speed_run);
883  const_cast<CreatureTemplate*>(cInfo)->speed_run = 1.14286f;
884  }
885 
886  if (cInfo->type && !sCreatureTypeStore.LookupEntry(cInfo->type))
887  {
888  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid creature type (%u) in `type`.", cInfo->Entry, cInfo->type);
889  const_cast<CreatureTemplate*>(cInfo)->type = CREATURE_TYPE_HUMANOID;
890  }
891 
892  // must exist or used hidden but used in data horse case
893  if (cInfo->family && !sCreatureFamilyStore.LookupEntry(cInfo->family) && cInfo->family != CREATURE_FAMILY_HORSE_CUSTOM)
894  {
895  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid creature family (%u) in `family`.", cInfo->Entry, cInfo->family);
896  const_cast<CreatureTemplate*>(cInfo)->family = 0;
897  }
898 
899  if (cInfo->InhabitType <= 0 || cInfo->InhabitType > INHABIT_ANYWHERE)
900  {
901  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly.", cInfo->Entry, cInfo->InhabitType);
902  const_cast<CreatureTemplate*>(cInfo)->InhabitType = INHABIT_ANYWHERE;
903  }
904 
905  if (cInfo->HoverHeight < 0.0f)
906  {
907  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong value (%f) in `HoverHeight`", cInfo->Entry, cInfo->HoverHeight);
908  const_cast<CreatureTemplate*>(cInfo)->HoverHeight = 1.0f;
909  }
910 
911  if (cInfo->VehicleId)
912  {
913  VehicleEntry const* vehId = sVehicleStore.LookupEntry(cInfo->VehicleId);
914  if (!vehId)
915  {
916  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId);
917  const_cast<CreatureTemplate*>(cInfo)->VehicleId = 0;
918  }
919  }
920 
921  for (uint8 j = 0; j < CREATURE_MAX_SPELLS; ++j)
922  {
923  if (cInfo->spells[j] && !sSpellMgr->GetSpellInfo(cInfo->spells[j]))
924  {
925  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j+1, cInfo->spells[j]);
926  const_cast<CreatureTemplate*>(cInfo)->spells[j] = 0;
927  }
928  }
929 
930  if (cInfo->MovementType >= MAX_DB_MOTION_TYPE)
931  {
932  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong movement generator type (%u), ignored and set to IDLE.", cInfo->Entry, cInfo->MovementType);
933  const_cast<CreatureTemplate*>(cInfo)->MovementType = IDLE_MOTION_TYPE;
934  }
935 
937  if (cInfo->scale <= 0.0f)
938  {
939  if (displayScaleEntry)
940  const_cast<CreatureTemplate*>(cInfo)->scale = displayScaleEntry->CreatureModelScale;
941  else
942  const_cast<CreatureTemplate*>(cInfo)->scale = 1.0f;
943  }
944 
945  if (cInfo->expansion > (MAX_EXPANSIONS - 1))
946  {
947  TC_LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: %u) with `exp` %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansion);
948  const_cast<CreatureTemplate*>(cInfo)->expansion = 0;
949  }
950 
951  if (cInfo->expansionUnknown > MAX_EXPANSIONS)
952  {
953  TC_LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: %u) with `exp_unk` %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansionUnknown);
954  const_cast<CreatureTemplate*>(cInfo)->expansionUnknown = 0;
955  }
956 
957  if (uint32 badFlags = (cInfo->flags_extra & ~CREATURE_FLAG_EXTRA_DB_ALLOWED))
958  {
959  TC_LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: %u) with disallowed `flags_extra` %u, removing incorrect flag.", cInfo->Entry, badFlags);
960  const_cast<CreatureTemplate*>(cInfo)->flags_extra &= CREATURE_FLAG_EXTRA_DB_ALLOWED;
961  }
962 
963  // -1 is used in the client for auto-updating the levels
964  // having their expansion set to it to the latest one
965  if (cInfo->expansion == -1)
966  {
967  const_cast<CreatureTemplate*>(cInfo)->minlevel = (MAX_LEVEL + cInfo->minlevel);
968  const_cast<CreatureTemplate*>(cInfo)->maxlevel = (MAX_LEVEL + cInfo->maxlevel);
969  const_cast<CreatureTemplate*>(cInfo)->expansion = CURRENT_EXPANSION;
970  }
971 
972  if (cInfo->minlevel < 1 || cInfo->minlevel > STRONG_MAX_LEVEL)
973  {
974  TC_LOG_ERROR("sql.sql", "Creature (ID: %u): MinLevel %i is not within [1, 255], value has been set to 1.", cInfo->Entry, cInfo->minlevel);
975  const_cast<CreatureTemplate*>(cInfo)->minlevel = 1;
976  }
977 
978  if (cInfo->maxlevel < 1 || cInfo->maxlevel > STRONG_MAX_LEVEL)
979  {
980  TC_LOG_ERROR("sql.sql", "Creature (ID: %u): MaxLevel %i is not within [1, 255], value has been set to 1.", cInfo->Entry, cInfo->maxlevel);
981  const_cast<CreatureTemplate*>(cInfo)->maxlevel = 1;
982  }
983 
984  const_cast<CreatureTemplate*>(cInfo)->ModDamage *= Creature::_GetDamageMod(cInfo->rank);
985 }
#define BASE_ATTACK_TIME
Definition: Unit.h:202
Definition: MotionMaster.h:37
#define MAX_CREATURE_DIFFICULTIES
Definition: Creature.h:76
int32 expansion
Definition: Creature.h:95
Definition: SharedDefines.h:199
#define CREATURE_MAX_SPELLS
Definition: Creature.h:75
std::string AIName
Definition: Creature.h:127
uint64 npcflag
Definition: Creature.h:98
#define CURRENT_EXPANSION
Definition: SharedDefines.h:88
#define CREATURE_FLAG_EXTRA_DB_ALLOWED
Definition: Creature.h:63
Definition: Unit.h:739
#define MAX_TRAINER_TYPE
Definition: SharedDefines.h:3549
Definition: Creature.h:334
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: DBCEnums.h:54
Definition: MotionMaster.h:40
#define MAX_SPELL_SCHOOL
Definition: SharedDefines.h:283
uint32 faction
Definition: Creature.h:97
float CreatureModelScale
Definition: DB2Structure.h:159
Definition: DBCStructure.h:1271
Definition: Creature.h:317
#define MAX_KILL_CREDIT
Definition: Creature.h:72
uint32 trainer_type
Definition: Creature.h:113
Definition: SharedDefines.h:3560
#define UI64FMTD
Definition: Define.h:137
Definition: SharedDefines.h:274
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:3587
DB2Storage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore("CreatureDisplayInfo.db2", CreatureDisplayInfoFormat, HOTFIX_SEL_CREATURE_DISPLAY_INFO)
uint32 trainer_class
Definition: Creature.h:114
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
Definition: DBCEnums.h:50
DBCStorage< CreatureFamilyEntry > sCreatureFamilyStore(CreatureFamilyfmt)
std::set< uint32 > _hasDifficultyEntries[MAX_CREATURE_DIFFICULTIES]
Definition: ObjectMgr.h:1547
Definition: DBCStructure.h:433
uint32 VehicleId
Definition: Creature.h:124
std::set< uint32 > _difficultyEntries[MAX_CREATURE_DIFFICULTIES]
Definition: ObjectMgr.h:1546
DBCStorage< VehicleEntry > sVehicleStore(Vehiclefmt)
uint32 trainer_race
Definition: Creature.h:115
Definition: SharedDefines.h:85
#define CLASSMASK_ALL_CREATURES
Definition: SharedDefines.h:205
DB2Storage< CreatureTypeEntry > sCreatureTypeStore("CreatureType.db2", CreatureTypeFormat, HOTFIX_SEL_CREATURE_TYPE)
uint8_t uint8
Definition: Define.h:152
uint32 family
Definition: Creature.h:112
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
static float _GetDamageMod(int32 Rank)
Definition: Creature.cpp:1245
CreatureModelInfo const * GetCreatureModelInfo(uint32 modelId)
Definition: ObjectMgr.cpp:1256
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplatefmt)
uint32 ScriptID
Definition: Creature.h:143
uint32 unit_class
Definition: Creature.h:108
Definition: DB2Structure.h:153
Definition: Creature.h:79
uint32 type
Definition: Creature.h:116

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ObjectMgr::CheckDeclinedNames ( const std::wstring &  w_ownname,
DeclinedName const names 
)
static
7815 {
7816  // get main part of the name
7817  std::wstring mainpart = GetMainPartOfName(w_ownname, 0);
7818  // prepare flags
7819  bool x = true;
7820  bool y = true;
7821 
7822  // check declined names
7823  for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
7824  {
7825  std::wstring wname;
7826  if (!Utf8toWStr(names.name[i], wname))
7827  return false;
7828 
7829  if (mainpart != GetMainPartOfName(wname, i+1))
7830  x = false;
7831 
7832  if (w_ownname != wname)
7833  y = false;
7834  }
7835  return (x || y);
7836 }
#define MAX_DECLINED_NAME_CASES
Definition: Unit.h:1099
std::wstring GetMainPartOfName(std::wstring const &wname, uint32 declension)
Definition: Util.cpp:376
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:281
G3D::int16 y
Definition: Vector2int16.h:38
uint8_t uint8
Definition: Define.h:152
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PetNameInvalidReason ObjectMgr::CheckPetName ( std::string const name)
static
7624 {
7625  std::wstring wname;
7626  if (!Utf8toWStr(name, wname))
7627  return PET_NAME_INVALID;
7628 
7629  if (wname.size() > MAX_PET_NAME)
7630  return PET_NAME_TOO_LONG;
7631 
7632  uint32 minName = sWorld->getIntConfig(CONFIG_MIN_PET_NAME);
7633  if (wname.size() < minName)
7634  return PET_NAME_TOO_SHORT;
7635 
7636  uint32 strictMask = sWorld->getIntConfig(CONFIG_STRICT_PET_NAMES);
7637  if (!isValidString(wname, strictMask, false))
7638  return PET_NAME_MIXED_LANGUAGES;
7639 
7640  return PET_NAME_SUCCESS;
7641 }
Definition: SharedDefines.h:4794
Definition: SharedDefines.h:4793
Definition: SharedDefines.h:4792
#define sWorld
Definition: World.h:887
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:281
Definition: World.h:226
uint32_t uint32
Definition: Define.h:150
bool isValidString(const std::wstring &wstr, uint32 strictMask, bool numericOrSpace, bool create=false)
Definition: ObjectMgr.cpp:7544
Definition: World.h:223
Definition: SharedDefines.h:4788
Definition: SharedDefines.h:4790
#define MAX_PET_NAME
Definition: ObjectMgr.h:646

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ResponseCodes ObjectMgr::CheckPlayerName ( std::string const name,
LocaleConstant  locale,
bool  create = false 
)
static
7581 {
7582  std::wstring wname;
7583  if (!Utf8toWStr(name, wname))
7585 
7586  if (wname.size() > MAX_PLAYER_NAME)
7587  return CHAR_NAME_TOO_LONG;
7588 
7589  uint32 minName = sWorld->getIntConfig(CONFIG_MIN_PLAYER_NAME);
7590  if (wname.size() < minName)
7591  return CHAR_NAME_TOO_SHORT;
7592 
7593  uint32 strictMask = sWorld->getIntConfig(CONFIG_STRICT_PLAYER_NAMES);
7594  if (!isValidString(wname, strictMask, false, create))
7596 
7597  wstrToLower(wname);
7598  for (size_t i = 2; i < wname.size(); ++i)
7599  if (wname[i] == wname[i-1] && wname[i] == wname[i-2])
7601 
7602  return sDB2Manager.ValidateName(name, locale);
7603 }
#define sDB2Manager
Definition: DB2Stores.h:224
Definition: SharedDefines.h:4509
Definition: SharedDefines.h:4511
Definition: SharedDefines.h:4508
Definition: SharedDefines.h:4516
Definition: World.h:224
#define sWorld
Definition: World.h:887
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:281
void wstrToLower(std::wstring &str)
Definition: Util.h:306
Definition: SharedDefines.h:4510
uint32_t uint32
Definition: Define.h:150
bool isValidString(const std::wstring &wstr, uint32 strictMask, bool numericOrSpace, bool create=false)
Definition: ObjectMgr.cpp:7544
#define MAX_PLAYER_NAME
Definition: ObjectMgr.h:644
Definition: World.h:221

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ObjectMgr::ChooseCreatureFlags ( CreatureTemplate const cinfo,
uint64 npcflag,
uint32 unit_flags,
uint32 dynamicflags,
CreatureData const data = NULL 
)
static
1279 {
1280  npcflag = cinfo->npcflag;
1281  unit_flags = cinfo->unit_flags;
1282  dynamicflags = cinfo->dynamicflags;
1283 
1284  if (data)
1285  {
1286  if (data->npcflag)
1287  npcflag = data->npcflag;
1288 
1289  if (data->unit_flags)
1290  unit_flags = data->unit_flags;
1291 
1292  if (data->dynamicflags)
1293  dynamicflags = data->dynamicflags;
1294  }
1295 }

+ Here is the caller graph for this function:

uint32 ObjectMgr::ChooseDisplayId ( CreatureTemplate const cinfo,
CreatureData const data = NULL 
)
static
1266 {
1267  // Load creature model (display id)
1268  if (data && data->displayid)
1269  return data->displayid;
1270 
1271  if (!(cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER))
1272  return cinfo->GetRandomValidModelId();
1273 
1274  // Triggers by default receive the invisible model
1275  return cinfo->GetFirstInvisibleModel();
1276 }
Definition: Creature.h:49

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ObjectMgr::DeleteCreatureData ( ObjectGuid::LowType  guid)
7335 {
7336  // remove mapid*cellid -> guid_set map
7337  CreatureData const* data = GetCreatureData(guid);
7338  if (data)
7339  RemoveCreatureFromGrid(guid, data);
7340 
7341  _creatureDataStore.erase(guid);
7342 }
Definition: Creature.h:287
CreatureDataContainer _creatureDataStore
Definition: ObjectMgr.h:1517
CreatureData const * GetCreatureData(ObjectGuid::LowType guid) const
Definition: ObjectMgr.h:1152
void RemoveCreatureFromGrid(ObjectGuid::LowType guid, CreatureData const *data)
Definition: ObjectMgr.cpp:1915

+ Here is the call graph for this function:

bool ObjectMgr::DeleteGameTele ( std::string const name)
8026 {
8027  // explicit name case
8028  std::wstring wname;
8029  if (!Utf8toWStr(name, wname))
8030  return false;
8031 
8032  // converting string that we try to find to lower case
8033  wstrToLower(wname);
8034 
8035  for (GameTeleContainer::iterator itr = _gameTeleStore.begin(); itr != _gameTeleStore.end(); ++itr)
8036  {
8037  if (itr->second.wnameLow == wname)
8038  {
8040 
8041  stmt->setString(0, itr->second.name);
8042 
8043  WorldDatabase.Execute(stmt);
8044 
8045  _gameTeleStore.erase(itr);
8046  return true;
8047  }
8048  }
8049 
8050  return false;
8051 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
GameTeleContainer _gameTeleStore
Definition: ObjectMgr.h:1464
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:281
void wstrToLower(std::wstring &str)
Definition: Util.h:306
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: WorldDatabase.h:43

+ Here is the call graph for this function:

void ObjectMgr::DeleteGOData ( ObjectGuid::LowType  guid)
7345 {
7346  // remove mapid*cellid -> guid_set map
7347  GameObjectData const* data = GetGOData(guid);
7348  if (data)
7349  RemoveGameobjectFromGrid(guid, data);
7350 
7351  _gameObjectDataStore.erase(guid);
7352 }
GameObjectDataContainer _gameObjectDataStore
Definition: ObjectMgr.h:1528
void RemoveGameobjectFromGrid(ObjectGuid::LowType guid, GameObjectData const *data)
Definition: ObjectMgr.cpp:2227
GameObjectData const * GetGOData(ObjectGuid::LowType guid) const
Definition: ObjectMgr.h:1209
Definition: GameObject.h:833

+ Here is the call graph for this function:

GraveYardData const * ObjectMgr::FindGraveYardData ( uint32  id,
uint32  zone 
)
6044 {
6045  GraveYardMapBounds range = GraveYardStore.equal_range(zoneId);
6046  for (; range.first != range.second; ++range.first)
6047  {
6048  GraveYardData const& data = range.first->second;
6049  if (data.safeLocId == id)
6050  return &data;
6051  }
6052  return NULL;
6053 }
std::pair< GraveYardContainer::const_iterator, GraveYardContainer::const_iterator > GraveYardMapBounds
Definition: ObjectMgr.h:596
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 safeLocId
Definition: ObjectMgr.h:591
Definition: ObjectMgr.h:589
GraveYardContainer GraveYardStore
Definition: ObjectMgr.h:1342

+ Here is the caller graph for this function:

uint32 ObjectMgr::GenerateAuctionID ( )
6401 {
6402  if (_auctionId >= 0xFFFFFFFE)
6403  {
6404  TC_LOG_ERROR("misc", "Auctions ids overflow!! Can't continue, shutting down server. ");
6406  }
6407  return _auctionId++;
6408 }
uint32 _auctionId
Definition: ObjectMgr.h:1404
Definition: World.h:74
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
static void StopNow(uint8 exitcode)
Definition: World.h:662

+ Here is the call graph for this function:

uint64 ObjectMgr::GenerateCreatureSpawnId ( )
6451 {
6452  if (_creatureSpawnId >= uint64(0xFFFFFFFFFFFFFFFELL))
6453  {
6454  TC_LOG_ERROR("misc", "Creature spawn id overflow!! Can't continue, shutting down server. ");
6456  }
6457  return _creatureSpawnId++;
6458 }
uint64_t uint64
Definition: g3dmath.h:170
Definition: World.h:74
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint64 _creatureSpawnId
Definition: ObjectMgr.h:1410
static void StopNow(uint8 exitcode)
Definition: World.h:662

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint64 ObjectMgr::GenerateEquipmentSetGuid ( )
6411 {
6412  if (_equipmentSetGuid >= uint64(0xFFFFFFFFFFFFFFFELL))
6413  {
6414  TC_LOG_ERROR("misc", "EquipmentSet guid overflow!! Can't continue, shutting down server. ");
6416  }
6417  return _equipmentSetGuid++;
6418 }
uint64_t uint64
Definition: g3dmath.h:170
Definition: World.h:74
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint64 _equipmentSetGuid
Definition: ObjectMgr.h:1405
static void StopNow(uint8 exitcode)
Definition: World.h:662

+ Here is the call graph for this function:

uint64 ObjectMgr::GenerateGameObjectSpawnId ( )
6461 {
6462  if (_gameObjectSpawnId >= uint64(0xFFFFFFFFFFFFFFFELL))
6463  {
6464  TC_LOG_ERROR("misc", "Creature spawn id overflow!! Can't continue, shutting down server. ");
6466  }
6467  return _gameObjectSpawnId++;
6468 }
uint64_t uint64
Definition: g3dmath.h:170
uint64 _gameObjectSpawnId
Definition: ObjectMgr.h:1411
Definition: World.h:74
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
static void StopNow(uint8 exitcode)
Definition: World.h:662

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 ObjectMgr::GenerateMailID ( )
6421 {
6422  if (_mailId >= 0xFFFFFFFE)
6423  {
6424  TC_LOG_ERROR("misc", "Mail ids overflow!! Can't continue, shutting down server. ");
6426  }
6427  return _mailId++;
6428 }
uint32 _mailId
Definition: ObjectMgr.h:1407
Definition: World.h:74
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
static void StopNow(uint8 exitcode)
Definition: World.h:662

+ Here is the call graph for this function:

std::string ObjectMgr::GeneratePetName ( uint32  entry)
6865 {
6866  StringVector& list0 = _petHalfName0[entry];
6867  StringVector& list1 = _petHalfName1[entry];
6868 
6869  if (list0.empty() || list1.empty())
6870  {
6871  CreatureTemplate const* cinfo = GetCreatureTemplate(entry);
6872  if (!cinfo)
6873  return std::string();
6874 
6875  char const* petname = GetCreatureFamilyPetName(cinfo->family, sWorld->GetDefaultDbcLocale());
6876  if (petname)
6877  return std::string(petname);
6878  else
6879  return cinfo->Name;
6880  }
6881 
6882  return *(list0.begin()+urand(0, list0.size()-1)) + *(list1.begin()+urand(0, list1.size()-1));
6883 }
std::string Name
Definition: Creature.h:88
#define sWorld
Definition: World.h:887
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
char const * GetCreatureFamilyPetName(uint32 petfamily, uint32)
Definition: DBCStores.cpp:561
std::vector< std::string > StringVector
Definition: Common.h:142
HalfNameContainer _petHalfName0
Definition: ObjectMgr.h:1513
uint32 family
Definition: Creature.h:112
Definition: Creature.h:79
HalfNameContainer _petHalfName1
Definition: ObjectMgr.h:1514

+ Here is the call graph for this function:

uint32 ObjectMgr::GeneratePetNumber ( )
6431 {
6432  if (_hiPetNumber >= 0xFFFFFFFE)
6433  {
6434  TC_LOG_ERROR("misc", "_hiPetNumber Id overflow!! Can't continue, shutting down server. ");
6436  }
6437  return _hiPetNumber++;
6438 }
uint32 _hiPetNumber
Definition: ObjectMgr.h:1408
Definition: World.h:74
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
static void StopNow(uint8 exitcode)
Definition: World.h:662

+ Here is the call graph for this function:

uint64 ObjectMgr::GenerateVoidStorageItemId ( )
6441 {
6442  if (_voidItemId >= uint64(0xFFFFFFFFFFFFFFFELL))
6443  {
6444  TC_LOG_ERROR("misc", "_voidItemId overflow!! Can't continue, shutting down server. ");
6446  }
6447  return _voidItemId++;
6448 }
uint64_t uint64
Definition: g3dmath.h:170
uint64 _voidItemId
Definition: ObjectMgr.h:1409
Definition: World.h:74
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
static void StopNow(uint8 exitcode)
Definition: World.h:662

+ Here is the call graph for this function:

AccessRequirement const* ObjectMgr::GetAccessRequirement ( uint32  mapid,
Difficulty  difficulty 
) const
inline
860  {
861  AccessRequirementContainer::const_iterator itr = _accessRequirementStore.find(MAKE_PAIR64(mapid, difficulty));
862  if (itr != _accessRequirementStore.end())
863  return itr->second;
864  return NULL;
865  }
arena_t NULL
Definition: jemalloc_internal.h:624
uint64 MAKE_PAIR64(uint32 l, uint32 h)
Definition: ObjectDefines.h:34
AccessRequirementContainer _accessRequirementStore
Definition: ObjectMgr.h:1440

+ Here is the call graph for this function:

PhaseInfo const& ObjectMgr::GetAreaPhases ( ) const
inline
1332 { return _phases; }
PhaseInfo _phases
Definition: ObjectMgr.h:1483
PhaseInfo& ObjectMgr::GetAreaPhasesForLoading ( )
inline
1339 { return _phases; }
PhaseInfo _phases
Definition: ObjectMgr.h:1483
AreaTriggerStruct const* ObjectMgr::GetAreaTrigger ( uint32  trigger) const
inline
852  {
853  AreaTriggerContainer::const_iterator itr = _areaTriggerStore.find(trigger);
854  if (itr != _areaTriggerStore.end())
855  return &itr->second;
856  return NULL;
857  }
arena_t NULL
Definition: jemalloc_internal.h:624
AreaTriggerContainer _areaTriggerStore
Definition: ObjectMgr.h:1438
uint32 ObjectMgr::GetAreaTriggerScriptId ( uint32  trigger_id)
7839 {
7840  AreaTriggerScriptContainer::const_iterator i = _areaTriggerScriptStore.find(trigger_id);
7841  if (i!= _areaTriggerScriptStore.end())
7842  return i->second;
7843  return 0;
7844 }
AreaTriggerScriptContainer _areaTriggerScriptStore
Definition: ObjectMgr.h:1439
int32 ObjectMgr::GetBaseReputationOf ( FactionEntry const factionEntry,
uint8  race,
uint8  playerClass 
)
7853 {
7854  if (!factionEntry)
7855  return 0;
7856 
7857  uint32 raceMask = (1 << (race - 1));
7858  uint32 classMask = (1 << (playerClass-1));
7859 
7860  for (int i = 0; i < 4; i++)
7861  {
7862  if ((!factionEntry->ReputationClassMask[i] ||
7863  factionEntry->ReputationClassMask[i] & classMask) &&
7864  (!factionEntry->ReputationRaceMask[i] ||
7865  factionEntry->ReputationRaceMask[i] & raceMask))
7866  return factionEntry->ReputationBase[i];
7867  }
7868 
7869  return 0;
7870 }
uint32_t uint32
Definition: Define.h:150
uint32 ObjectMgr::GetBaseXP ( uint8  level)
6808 {
6809  return _baseXPTable[level] ? _baseXPTable[level] : 0;
6810 }
BaseXPContainer _baseXPTable
Definition: ObjectMgr.h:1506
CellObjectGuids const& ObjectMgr::GetCellObjectGuids ( uint16  mapid,
uint8  spawnMode,
uint32  cell_id 
)
inline
1125  {
1126  return _mapObjectGuidsStore[MAKE_PAIR32(mapid, spawnMode)][cell_id];
1127  }
MapObjectGuids _mapObjectGuidsStore
Definition: ObjectMgr.h:1516
uint32 MAKE_PAIR32(uint16 l, uint16 h)
Definition: ObjectDefines.h:54

+ Here is the call graph for this function:

CharacterTemplate const* ObjectMgr::GetCharacterTemplate ( uint32  id) const
inline
1394  {
1395  auto itr = _characterTemplateStore.find(id);
1396  if (itr != _characterTemplateStore.end())
1397  return &itr->second;
1398 
1399  return nullptr;
1400  }
CharacterTemplateContainer _characterTemplateStore
Definition: ObjectMgr.h:1553
CharacterTemplateContainer const& ObjectMgr::GetCharacterTemplates ( ) const
inline
1392 { return _characterTemplateStore; }
CharacterTemplateContainer _characterTemplateStore
Definition: ObjectMgr.h:1553
uint8 ObjectMgr::GetClassExpansionRequirement ( uint8  class_) const
inline
1385  {
1386  auto itr = _classExpansionRequirementStore.find(class_);
1387  if (itr != _classExpansionRequirementStore.end())
1388  return itr->second;
1389  return EXPANSION_CLASSIC;
1390  }
Definition: SharedDefines.h:79
ExpansionRequirementContainer _classExpansionRequirementStore
Definition: ObjectMgr.h:1550
ExpansionRequirementContainer const& ObjectMgr::GetClassExpansionRequirements ( ) const
inline
ExpansionRequirementContainer _classExpansionRequirementStore
Definition: ObjectMgr.h:1550
WorldSafeLocsEntry const * ObjectMgr::GetClosestGraveYard ( float  x,
float  y,
float  z,
uint32  MapId,
uint32  team 
)
5919 {
5920  // search for zone associated closest graveyard
5921  uint32 zoneId = sMapMgr->GetZoneId(MapId, x, y, z);
5922 
5923  if (!zoneId)
5924  {
5925  if (z > -500)
5926  {
5927  TC_LOG_ERROR("misc", "ZoneId not found for map %u coords (%f, %f, %f)", MapId, x, y, z);
5928  return GetDefaultGraveYard(team);
5929  }
5930  }
5931 
5932  // Simulate std. algorithm:
5933  // found some graveyard associated to (ghost_zone, ghost_map)
5934  //
5935  // if mapId == graveyard.mapId (ghost in plain zone or city or battleground) and search graveyard at same map
5936  // then check faction
5937  // if mapId != graveyard.mapId (ghost in instance) and search any graveyard associated
5938  // then check faction
5939  GraveYardMapBounds range = GraveYardStore.equal_range(zoneId);
5940  MapEntry const* map = sMapStore.LookupEntry(MapId);
5941 
5942  // not need to check validity of map object; MapId _MUST_ be valid here
5943  if (range.first == range.second && !map->IsBattlegroundOrArena())
5944  {
5945  if (zoneId != 0) // zone == 0 can't be fixed, used by bliz for bugged zones
5946  TC_LOG_ERROR("sql.sql", "Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team);
5947  return GetDefaultGraveYard(team);
5948  }
5949 
5950  // at corpse map
5951  bool foundNear = false;
5952  float distNear = 10000;
5953  WorldSafeLocsEntry const* entryNear = NULL;
5954 
5955  // at entrance map for corpse map
5956  bool foundEntr = false;
5957  float distEntr = 10000;
5958  WorldSafeLocsEntry const* entryEntr = NULL;
5959 
5960  // some where other
5961  WorldSafeLocsEntry const* entryFar = NULL;
5962 
5963  MapEntry const* mapEntry = sMapStore.LookupEntry(MapId);
5964 
5965  for (; range.first != range.second; ++range.first)
5966  {
5967  GraveYardData const& data = range.first->second;
5968 
5969  WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(data.safeLocId);
5970  if (!entry)
5971  {
5972  TC_LOG_ERROR("sql.sql", "Table `graveyard_zone` has record for non-existing graveyard (WorldSafeLocsID: %u), skipped.", data.safeLocId);
5973  continue;
5974  }
5975 
5976  // skip enemy faction graveyard
5977  // team == 0 case can be at call from .neargrave
5978  if (data.team != 0 && team != 0 && data.team != team)
5979  continue;
5980 
5981  // find now nearest graveyard at other map
5982  if (MapId != entry->MapID)
5983  {
5984  // if find graveyard at different map from where entrance placed (or no entrance data), use any first
5985  if (!mapEntry
5986  || mapEntry->CorpseMapID < 0
5987  || uint32(mapEntry->CorpseMapID) != entry->MapID
5988  || (mapEntry->CorpsePos.X == 0 && mapEntry->CorpsePos.Y == 0)) // Check X and Y
5989  {
5990  // not have any corrdinates for check distance anyway
5991  entryFar = entry;
5992  continue;
5993  }
5994 
5995  // at entrance map calculate distance (2D);
5996  float dist2 = (entry->Loc.X - mapEntry->CorpsePos.X)*(entry->Loc.X - mapEntry->CorpsePos.X)
5997  +(entry->Loc.Y - mapEntry->CorpsePos.Y)*(entry->Loc.Y - mapEntry->CorpsePos.Y);
5998  if (foundEntr)
5999  {
6000  if (dist2 < distEntr)
6001  {
6002  distEntr = dist2;
6003  entryEntr = entry;
6004  }
6005  }
6006  else
6007  {
6008  foundEntr = true;
6009  distEntr = dist2;
6010  entryEntr = entry;
6011  }
6012  }
6013  // find now nearest graveyard at same map
6014  else
6015  {
6016  float dist2 = (entry->Loc.X - x)*(entry->Loc.X - x)+(entry->Loc.Y - y)*(entry->Loc.Y - y)+(entry->Loc.Z - z)*(entry->Loc.Z - z);
6017  if (foundNear)
6018  {
6019  if (dist2 < distNear)
6020  {
6021  distNear = dist2;
6022  entryNear = entry;
6023  }
6024  }
6025  else
6026  {
6027  foundNear = true;
6028  distNear = dist2;
6029  entryNear = entry;
6030  }
6031  }
6032  }
6033 
6034  if (entryNear)
6035  return entryNear;
6036 
6037  if (entryEntr)
6038  return entryEntr;
6039 
6040  return entryFar;
6041 }
float Z
Definition: DBCEnums.h:36
std::pair< GraveYardContainer::const_iterator, GraveYardContainer::const_iterator > GraveYardMapBounds
Definition: ObjectMgr.h:596
DBCPosition2D CorpsePos
Definition: DBCStructure.h:845
float Y
Definition: DBCEnums.h:35
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsfmt)
uint32 team
Definition: ObjectMgr.h:592
int32 CorpseMapID
Definition: DBCStructure.h:844
Definition: DBCStructure.h:1434
Definition: DBCStructure.h:830
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 safeLocId
Definition: ObjectMgr.h:591
float X
Definition: DBCEnums.h:28
WorldSafeLocsEntry const * GetDefaultGraveYard(uint32 team)
Definition: ObjectMgr.cpp:5903
Definition: ObjectMgr.h:589
float Y
Definition: DBCEnums.h:29
uint32 MapID
Definition: DBCStructure.h:1437
G3D::int16 z
Definition: Vector3int16.h:46
uint32_t uint32
Definition: Define.h:150
G3D::int16 y
Definition: Vector2int16.h:38
float X
Definition: DBCEnums.h:34
DBCPosition3D Loc
Definition: DBCStructure.h:1438
bool IsBattlegroundOrArena() const
Definition: DBCStructure.h:863
DBCStorage< MapEntry > sMapStore(Mapfmt)
#define sMapMgr
Definition: MapManager.h:194
GraveYardContainer GraveYardStore
Definition: ObjectMgr.h:1342
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the call graph for this function:

CreatureAddon const * ObjectMgr::GetCreatureAddon ( ObjectGuid::LowType  lowguid)
1136 {
1137  CreatureAddonContainer::const_iterator itr = _creatureAddonStore.find(lowguid);
1138  if (itr != _creatureAddonStore.end())
1139  return &(itr->second);
1140 
1141  return NULL;
1142 }
arena_t NULL
Definition: jemalloc_internal.h:624
CreatureAddonContainer _creatureAddonStore
Definition: ObjectMgr.h:1520
CreatureBaseStats const * ObjectMgr::GetCreatureBaseStats ( uint8  level,
uint8  unitClass 
)
8642 {
8643  CreatureBaseStatsContainer::const_iterator it = _creatureBaseStatsStore.find(MAKE_PAIR16(level, unitClass));
8644 
8645  if (it != _creatureBaseStatsStore.end())
8646  return &(it->second);
8647 
8648  struct DefaultCreatureBaseStats : public CreatureBaseStats
8649  {
8650  DefaultCreatureBaseStats()
8651  {
8652  BaseArmor = 1;
8653  for (uint8 j = 0; j < MAX_EXPANSIONS; ++j)
8654  {
8655  BaseHealth[j] = 1;
8656  BaseDamage[j] = 0.0f;
8657  }
8658  BaseMana = 0;
8659  AttackPower = 0;
8660  RangedAttackPower = 0;
8661  }
8662  };
8663  static const DefaultCreatureBaseStats defStats;
8664  return &defStats;
8665 }
uint16 MAKE_PAIR16(uint8 l, uint8 h)
Definition: ObjectDefines.h:49
CreatureBaseStatsContainer _creatureBaseStatsStore
Definition: ObjectMgr.h:1492
Definition: SharedDefines.h:85
uint8_t uint8
Definition: Define.h:152
Definition: Creature.h:218

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CreatureData const* ObjectMgr::GetCreatureData ( ObjectGuid::LowType  guid) const
inline
1153  {
1154  CreatureDataContainer::const_iterator itr = _creatureDataStore.find(guid);
1155  if (itr == _creatureDataStore.end()) return NULL;
1156  return &itr->second;
1157  }
CreatureDataContainer _creatureDataStore
Definition: ObjectMgr.h:1517
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

CreatureLocale const* ObjectMgr::GetCreatureLocale ( uint32  entry) const
inline
1167  {
1168  CreatureLocaleContainer::const_iterator itr = _creatureLocaleStore.find(entry);
1169  if (itr == _creatureLocaleStore.end()) return NULL;
1170  return &itr->second;
1171  }
arena_t NULL
Definition: jemalloc_internal.h:624
CreatureLocaleContainer _creatureLocaleStore
Definition: ObjectMgr.h:1527
CreatureModelInfo const * ObjectMgr::GetCreatureModelInfo ( uint32  modelId)
1257 {
1258  CreatureModelContainer::const_iterator itr = _creatureModelStore.find(modelId);
1259  if (itr != _creatureModelStore.end())
1260  return &(itr->second);
1261 
1262  return NULL;
1263 }
arena_t NULL
Definition: jemalloc_internal.h:624
CreatureModelContainer _creatureModelStore
Definition: ObjectMgr.h:1519

+ Here is the caller graph for this function:

CreatureModelInfo const * ObjectMgr::GetCreatureModelRandomGender ( uint32 displayID)
1298 {
1299  CreatureModelInfo const* modelInfo = GetCreatureModelInfo(*displayID);
1300  if (!modelInfo)
1301  return NULL;
1302 
1303  // If a model for another gender exists, 50% chance to use it
1304  if (modelInfo->displayId_other_gender != 0 && urand(0, 1) == 0)
1305  {
1306  CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->displayId_other_gender);
1307  if (!minfo_tmp)
1308  TC_LOG_ERROR("sql.sql", "Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->displayId_other_gender);
1309  else
1310  {
1311  // DisplayID changed
1312  *displayID = modelInfo->displayId_other_gender;
1313  return minfo_tmp;
1314  }
1315  }
1316 
1317  return modelInfo;
1318 }
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:317
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
uint32 displayId_other_gender
Definition: Creature.h:322
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
CreatureModelInfo const * GetCreatureModelInfo(uint32 modelId)
Definition: ObjectMgr.cpp:1256

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QuestRelationBounds ObjectMgr::GetCreatureQuestInvolvedRelationBounds ( uint32  creature_entry)
inline
975  {
976  return _creatureQuestInvolvedRelations.equal_range(creature_entry);
977  }
QuestRelations _creatureQuestInvolvedRelations
Definition: ObjectMgr.h:1457
QuestRelationReverseBounds ObjectMgr::GetCreatureQuestInvolvedRelationReverseBounds ( uint32  questId)
inline
980  {
981  return _creatureQuestInvolvedRelationsReverse.equal_range(questId);
982  }
QuestRelationsReverse _creatureQuestInvolvedRelationsReverse
Definition: ObjectMgr.h:1458
CreatureQuestItemList const* ObjectMgr::GetCreatureQuestItemList ( uint32  id) const
inline
783  {
784  CreatureQuestItemMap::const_iterator itr = _creatureQuestItemStore.find(id);
785  if (itr != _creatureQuestItemStore.end())
786  return &itr->second;
787  return NULL;
788  }
arena_t NULL
Definition: jemalloc_internal.h:624
CreatureQuestItemMap _creatureQuestItemStore
Definition: ObjectMgr.h:1523
CreatureQuestItemMap const* ObjectMgr::GetCreatureQuestItemMap ( ) const
inline
789 { return &_creatureQuestItemStore; }
CreatureQuestItemMap _creatureQuestItemStore
Definition: ObjectMgr.h:1523
QuestRelationBounds ObjectMgr::GetCreatureQuestRelationBounds ( uint32  creature_entry)
inline
970  {
971  return _creatureQuestRelations.equal_range(creature_entry);
972  }
QuestRelations _creatureQuestRelations
Definition: ObjectMgr.h:1456
QuestRelations* ObjectMgr::GetCreatureQuestRelationMap ( )
inline
965  {
966  return &_creatureQuestRelations;
967  }
QuestRelations _creatureQuestRelations
Definition: ObjectMgr.h:1456
CreatureTemplate const * ObjectMgr::GetCreatureTemplate ( uint32  entry)
9114 {
9115  CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.find(entry);
9116  if (itr != _creatureTemplateStore.end())
9117  return &(itr->second);
9118 
9119  return NULL;
9120 }
CreatureTemplateContainer _creatureTemplateStore
Definition: ObjectMgr.h:1518
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

CreatureAddon const * ObjectMgr::GetCreatureTemplateAddon ( uint32  entry)
1145 {
1146  CreatureTemplateAddonContainer::const_iterator itr = _creatureTemplateAddonStore.find(entry);
1147  if (itr != _creatureTemplateAddonStore.end())
1148  return &(itr->second);
1149 
1150  return NULL;
1151 }
arena_t NULL
Definition: jemalloc_internal.h:624
CreatureTemplateAddonContainer _creatureTemplateAddonStore
Definition: ObjectMgr.h:1524
CreatureTemplateContainer const* ObjectMgr::GetCreatureTemplates ( ) const
inline
749 { return &_creatureTemplateStore; }
CreatureTemplateContainer _creatureTemplateStore
Definition: ObjectMgr.h:1518
LocaleConstant ObjectMgr::GetDBCLocaleIndex ( ) const
inline
1227 { return DBCLocaleIndex; }
LocaleConstant DBCLocaleIndex
Definition: ObjectMgr.h:1475
WorldSafeLocsEntry const * ObjectMgr::GetDefaultGraveYard ( uint32  team)
5904 {
5905  enum DefaultGraveyard
5906  {
5907  HORDE_GRAVEYARD = 10, // Crossroads
5908  ALLIANCE_GRAVEYARD = 4 // Westfall
5909  };
5910 
5911  if (team == HORDE)
5912  return sWorldSafeLocsStore.LookupEntry(HORDE_GRAVEYARD);
5913  else if (team == ALLIANCE)
5914  return sWorldSafeLocsStore.LookupEntry(ALLIANCE_GRAVEYARD);
5915  else return NULL;
5916 }
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsfmt)
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: SharedDefines.h:1000
Definition: SharedDefines.h:999

+ Here is the caller graph for this function:

std::vector<uint32> const* ObjectMgr::GetDefaultTerrainSwaps ( uint32  mapid) const
inline
1317  {
1318  auto itr = _terrainMapDefaultStore.find(mapid);
1319  return itr != _terrainMapDefaultStore.end() ? &itr->second : nullptr;
1320  }
TerrainPhaseInfo _terrainMapDefaultStore
Definition: ObjectMgr.h:1481
TerrainPhaseInfo const& ObjectMgr::GetDefaultTerrainSwapStore ( ) const
inline
1331 { return _terrainMapDefaultStore; }
TerrainPhaseInfo _terrainMapDefaultStore
Definition: ObjectMgr.h:1481
DungeonEncounterList const* ObjectMgr::GetDungeonEncounterList ( uint32  mapId,
Difficulty  difficulty 
)
inline
920  {
921  DungeonEncounterContainer::const_iterator itr = _dungeonEncounterStore.find(MAKE_PAIR64(mapId, difficulty));
922  if (itr != _dungeonEncounterStore.end())
923  return &itr->second;
924  return NULL;
925  }
DungeonEncounterContainer _dungeonEncounterStore
Definition: ObjectMgr.h:1441
arena_t NULL
Definition: jemalloc_internal.h:624
uint64 MAKE_PAIR64(uint32 l, uint32 h)
Definition: ObjectDefines.h:34

+ Here is the call graph for this function:

EquipmentInfo const * ObjectMgr::GetEquipmentInfo ( uint32  entry,
int8 id 
)
1154 {
1155  EquipmentInfoContainer::const_iterator itr = _equipmentInfoStore.find(entry);
1156  if (itr == _equipmentInfoStore.end())
1157  return NULL;
1158 
1159  if (itr->second.empty())
1160  return NULL;
1161 
1162  if (id == -1) // select a random element
1163  {
1164  EquipmentInfoContainerInternal::const_iterator ritr = itr->second.begin();
1165  std::advance(ritr, urand(0u, itr->second.size() - 1));
1166  id = std::distance(itr->second.begin(), ritr) + 1;
1167  return &ritr->second;
1168  }
1169  else
1170  {
1171  EquipmentInfoContainerInternal::const_iterator itr2 = itr->second.find(id);
1172  if (itr2 != itr->second.end())
1173  return &itr2->second;
1174  }
1175 
1176  return NULL;
1177 }
arena_t NULL
Definition: jemalloc_internal.h:624
double distance(double x, double y)
Definition: g3dmath.h:731
void advance(octet_iterator &it, distance_type n, octet_iterator end)
Definition: checked.h:190
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
EquipmentInfoContainer _equipmentInfoStore
Definition: ObjectMgr.h:1525

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 ObjectMgr::GetFishingBaseSkillLevel ( uint32  entry) const
inline
1074  {
1075  FishingBaseSkillContainer::const_iterator itr = _fishingBaseForAreaStore.find(entry);
1076  return itr != _fishingBaseForAreaStore.end() ? itr->second : 0;
1077  }
FishingBaseSkillContainer _fishingBaseForAreaStore
Definition: ObjectMgr.h:1509
GameObjectAddon const * ObjectMgr::GetGameObjectAddon ( ObjectGuid::LowType  lowguid)
1127 {
1128  GameObjectAddonContainer::const_iterator itr = _gameObjectAddonStore.find(lowguid);
1129  if (itr != _gameObjectAddonStore.end())
1130  return &(itr->second);
1131 
1132  return NULL;
1133 }
GameObjectAddonContainer _gameObjectAddonStore
Definition: ObjectMgr.h:1521
arena_t NULL
Definition: jemalloc_internal.h:624
GameObjectLocale const* ObjectMgr::GetGameObjectLocale ( uint32  entry) const
inline
1173  {
1174  GameObjectLocaleContainer::const_iterator itr = _gameObjectLocaleStore.find(entry);
1175  if (itr == _gameObjectLocaleStore.end()) return NULL;
1176  return &itr->second;
1177  }
arena_t NULL
Definition: jemalloc_internal.h:624
GameObjectLocaleContainer _gameObjectLocaleStore
Definition: ObjectMgr.h:1529
GameObjectQuestItemList const* ObjectMgr::GetGameObjectQuestItemList ( uint32  id) const
inline
774  {
775  GameObjectQuestItemMap::const_iterator itr = _gameObjectQuestItemStore.find(id);
776  if (itr != _gameObjectQuestItemStore.end())
777  return &itr->second;
778  return NULL;
779  }
arena_t NULL
Definition: jemalloc_internal.h:624
GameObjectQuestItemMap _gameObjectQuestItemStore
Definition: ObjectMgr.h:1522
GameObjectQuestItemMap const* ObjectMgr::GetGameObjectQuestItemMap ( ) const
inline
780 { return &_gameObjectQuestItemStore; }
GameObjectQuestItemMap _gameObjectQuestItemStore
Definition: ObjectMgr.h:1522
GameObjectTemplate const * ObjectMgr::GetGameObjectTemplate ( uint32  entry)
9105 {
9106  GameObjectTemplateContainer::const_iterator itr = _gameObjectTemplateStore.find(entry);
9107  if (itr != _gameObjectTemplateStore.end())
9108  return &(itr->second);
9109 
9110  return NULL;
9111 }
GameObjectTemplateContainer _gameObjectTemplateStore
Definition: ObjectMgr.h:1530
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

GameObjectTemplateContainer const* ObjectMgr::GetGameObjectTemplates ( ) const
inline
742 { return &_gameObjectTemplateStore; }
GameObjectTemplateContainer _gameObjectTemplateStore
Definition: ObjectMgr.h:1530
GameTele const* ObjectMgr::GetGameTele ( uint32  id) const
inline
1250  {
1251  GameTeleContainer::const_iterator itr = _gameTeleStore.find(id);
1252  if (itr == _gameTeleStore.end()) return NULL;
1253  return &itr->second;
1254  }
GameTeleContainer _gameTeleStore
Definition: ObjectMgr.h:1464
arena_t NULL
Definition: jemalloc_internal.h:624
GameTele const * ObjectMgr::GetGameTele ( std::string const name) const
7951 {
7952  // explicit name case
7953  std::wstring wname;
7954  if (!Utf8toWStr(name, wname))
7955  return NULL;
7956 
7957  // converting string that we try to find to lower case
7958  wstrToLower(wname);
7959 
7960  // Alternative first GameTele what contains wnameLow as substring in case no GameTele location found
7961  const GameTele* alt = NULL;
7962  for (GameTeleContainer::const_iterator itr = _gameTeleStore.begin(); itr != _gameTeleStore.end(); ++itr)
7963  {
7964  if (itr->second.wnameLow == wname)
7965  return &itr->second;
7966  else if (alt == NULL && itr->second.wnameLow.find(wname) != std::wstring::npos)
7967  alt = &itr->second;
7968  }
7969 
7970  return alt;
7971 }
GameTeleContainer _gameTeleStore
Definition: ObjectMgr.h:1464
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: ObjectMgr.h:125
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:281
void wstrToLower(std::wstring &str)
Definition: Util.h:306

+ Here is the call graph for this function:

GameTele const * ObjectMgr::GetGameTeleExactName ( std::string const name) const
7974 {
7975  // explicit name case
7976  std::wstring wname;
7977  if (!Utf8toWStr(name, wname))
7978  return NULL;
7979 
7980  // converting string that we try to find to lower case
7981  wstrToLower(wname);
7982 
7983  for (GameTeleContainer::const_iterator itr = _gameTeleStore.begin(); itr != _gameTeleStore.end(); ++itr)
7984  {
7985  if (itr->second.wnameLow == wname)
7986  return &itr->second;
7987  }
7988 
7989  return NULL;
7990 }
GameTeleContainer _gameTeleStore
Definition: ObjectMgr.h:1464
arena_t NULL
Definition: jemalloc_internal.h:624
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:281
void wstrToLower(std::wstring &str)
Definition: Util.h:306

+ Here is the call graph for this function:

GameTeleContainer const& ObjectMgr::GetGameTeleMap ( ) const
inline
1257 { return _gameTeleStore; }
GameTeleContainer _gameTeleStore
Definition: ObjectMgr.h:1464
template<HighGuid type>
ObjectGuidGeneratorBase& ObjectMgr::GetGenerator ( )
inline
1093  {
1094  static_assert(ObjectGuidTraits<type>::Global || ObjectGuidTraits<type>::RealmSpecific, "Only global guid can be generated in ObjectMgr context");
1095  return GetGuidSequenceGenerator<type>();
1096  }
Definition: ObjectGuid.h:114
AreaTriggerStruct const * ObjectMgr::GetGoBackTrigger ( uint32  Map) const
6297 {
6298  bool useParentDbValue = false;
6299  uint32 parentId = 0;
6300  const MapEntry* mapEntry = sMapStore.LookupEntry(Map);
6301  if (!mapEntry || mapEntry->CorpseMapID < 0)
6302  return NULL;
6303 
6304  if (mapEntry->IsDungeon())
6305  {
6306  const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(Map);
6307 
6308  if (!iTemplate)
6309  return NULL;
6310 
6311  parentId = iTemplate->Parent;
6312  useParentDbValue = true;
6313  }
6314 
6315  uint32 entrance_map = uint32(mapEntry->CorpseMapID);
6316  for (AreaTriggerContainer::const_iterator itr = _areaTriggerStore.begin(); itr != _areaTriggerStore.end(); ++itr)
6317  if ((!useParentDbValue && itr->second.target_mapId == entrance_map) || (useParentDbValue && itr->second.target_mapId == parentId))
6318  {
6319  AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
6320  if (atEntry && atEntry->MapID == Map)
6321  return &itr->second;
6322  }
6323  return NULL;
6324 }
Definition: Map.h:222
int32 CorpseMapID
Definition: DBCStructure.h:844
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerfmt)
uint32 MapID
Definition: DBCStructure.h:77
Definition: DBCStructure.h:830
arena_t NULL
Definition: jemalloc_internal.h:624
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 Parent
Definition: Map.h:224
uint32_t uint32
Definition: Define.h:150
bool IsDungeon() const
Definition: DBCStructure.h:857
Definition: Map.h:259
DBCStorage< MapEntry > sMapStore(Mapfmt)
Definition: DBCStructure.h:74
uint32_t uint32
Definition: g3dmath.h:168
AreaTriggerContainer _areaTriggerStore
Definition: ObjectMgr.h:1438

+ Here is the call graph for this function:

GameObjectData const* ObjectMgr::GetGOData ( ObjectGuid::LowType  guid) const
inline
1210  {
1211  GameObjectDataContainer::const_iterator itr = _gameObjectDataStore.find(guid);
1212  if (itr == _gameObjectDataStore.end()) return NULL;
1213  return &itr->second;
1214  }
GameObjectDataContainer _gameObjectDataStore
Definition: ObjectMgr.h:1528
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

QuestRelationBounds ObjectMgr::GetGOQuestInvolvedRelationBounds ( uint32  go_entry)
inline
955  {
956  return _goQuestInvolvedRelations.equal_range(go_entry);
957  }
QuestRelations _goQuestInvolvedRelations
Definition: ObjectMgr.h:1454
QuestRelationReverseBounds ObjectMgr::GetGOQuestInvolvedRelationReverseBounds ( uint32  questId)
inline
960  {
961  return _goQuestInvolvedRelationsReverse.equal_range(questId);
962  }
QuestRelationsReverse _goQuestInvolvedRelationsReverse
Definition: ObjectMgr.h:1455
QuestRelationBounds ObjectMgr::GetGOQuestRelationBounds ( uint32  go_entry)
inline
950  {
951  return _goQuestRelations.equal_range(go_entry);
952  }
QuestRelations _goQuestRelations
Definition: ObjectMgr.h:1453
QuestRelations* ObjectMgr::GetGOQuestRelationMap ( )
inline
945  {
946  return &_goQuestRelations;
947  }
QuestRelations _goQuestRelations
Definition: ObjectMgr.h:1453
GossipMenuItemsLocale const* ObjectMgr::GetGossipMenuItemsLocale ( uint32  entry) const
inline
1197  {
1198  GossipMenuItemsLocaleContainer::const_iterator itr = _gossipMenuItemsLocaleStore.find(entry);
1199  if (itr == _gossipMenuItemsLocaleStore.end()) return NULL;
1200  return &itr->second;
1201  }
GossipMenuItemsLocaleContainer _gossipMenuItemsLocaleStore
Definition: ObjectMgr.h:1538
arena_t NULL
Definition: jemalloc_internal.h:624
GossipMenuItemsMapBounds ObjectMgr::GetGossipMenuItemsMapBounds ( uint32  uiMenuId) const
inline
1303  {
1304  return _gossipMenuItemsStore.equal_range(uiMenuId);
1305  }
GossipMenuItemsContainer _gossipMenuItemsStore
Definition: ObjectMgr.h:1448
GossipMenuItemsMapBoundsNonConst ObjectMgr::GetGossipMenuItemsMapBoundsNonConst ( uint32  uiMenuId)
inline
1307  {
1308  return _gossipMenuItemsStore.equal_range(uiMenuId);
1309  }
GossipMenuItemsContainer _gossipMenuItemsStore
Definition: ObjectMgr.h:1448
GossipMenusMapBounds ObjectMgr::GetGossipMenusMapBounds ( uint32  uiMenuId) const
inline
1293  {
1294  return _gossipMenusStore.equal_range(uiMenuId);
1295  }
GossipMenusContainer _gossipMenusStore
Definition: ObjectMgr.h:1447
GossipMenusMapBoundsNonConst ObjectMgr::GetGossipMenusMapBoundsNonConst ( uint32  uiMenuId)
inline
1298  {
1299  return _gossipMenusStore.equal_range(uiMenuId);
1300  }
GossipMenusContainer _gossipMenusStore
Definition: ObjectMgr.h:1447
template<HighGuid high>
ObjectGuidGeneratorBase& ObjectMgr::GetGuidSequenceGenerator ( )
inlineprivate
1416  {
1417  auto itr = _guidGenerators.find(high);
1418  if (itr == _guidGenerators.end())
1419  itr = _guidGenerators.insert(std::make_pair(high, Trinity::make_unique<ObjectGuidGenerator<high>>())).first;
1420 
1421  return *itr->second;
1422  }
std::map< HighGuid, std::unique_ptr< ObjectGuidGeneratorBase > > _guidGenerators
Definition: ObjectMgr.h:1424
Definition: ObjectGuid.h:372
std::unique_ptr< T > make_unique(Args &&...args)
std::make_unique implementation (TODO: remove this once C++14 is supported)
Definition: Common.h:176

+ Here is the call graph for this function:

InstanceTemplate const * ObjectMgr::GetInstanceTemplate ( uint32  mapId)
5244 {
5245  InstanceTemplateContainer::const_iterator itr = _instanceTemplateStore.find(uint16(mapID));
5246  if (itr != _instanceTemplateStore.end())
5247  return &(itr->second);
5248 
5249  return NULL;
5250 }
arena_t NULL
Definition: jemalloc_internal.h:624
uint16_t uint16
Definition: g3dmath.h:166
InstanceTemplateContainer _instanceTemplateStore
Definition: ObjectMgr.h:1478
ItemTemplate const * ObjectMgr::GetItemTemplate ( uint32  entry)
2783 {
2784  ItemTemplateContainer::const_iterator itr = _itemTemplateStore.find(entry);
2785  if (itr != _itemTemplateStore.end())
2786  return &(itr->second);
2787  return NULL;
2788 }
arena_t NULL
Definition: jemalloc_internal.h:624
ItemTemplateContainer _itemTemplateStore
Definition: ObjectMgr.h:1534

+ Here is the caller graph for this function:

ItemTemplateContainer const* ObjectMgr::GetItemTemplateStore ( ) const
inline
759 { return &_itemTemplateStore; }
ItemTemplateContainer _itemTemplateStore
Definition: ObjectMgr.h:1534
ObjectGuid ObjectMgr::GetLinkedRespawnGuid ( ObjectGuid  guid) const
inline
1161  {
1162  LinkedRespawnContainer::const_iterator itr = _linkedRespawnStore.find(guid);
1163  if (itr == _linkedRespawnStore.end()) return ObjectGuid::Empty;
1164  return itr->second;
1165  }
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
LinkedRespawnContainer _linkedRespawnStore
Definition: ObjectMgr.h:1526
static void ObjectMgr::GetLocaleString ( StringVector const data,
LocaleConstant  localeConstant,
std::string &  value 
)
inlinestatic
1346  {
1347  if (data.size() > size_t(localeConstant) && !data[localeConstant].empty())
1348  value = data[localeConstant];
1349  }
const FieldDescriptor value
Definition: descriptor.h:1522

+ Here is the caller graph for this function:

MailLevelReward const* ObjectMgr::GetMailLevelReward ( uint8  level,
uint32  raceMask 
)
inline
1112  {
1113  MailLevelRewardContainer::const_iterator map_itr = _mailLevelRewardStore.find(level);
1114  if (map_itr == _mailLevelRewardStore.end())
1115  return NULL;
1116 
1117  for (MailLevelRewardList::const_iterator set_itr = map_itr->second.begin(); set_itr != map_itr->second.end(); ++set_itr)
1118  if (set_itr->raceMask & raceMask)
1119  return &*set_itr;
1120 
1121  return NULL;
1122  }
arena_t NULL
Definition: jemalloc_internal.h:624
MailLevelRewardContainer _mailLevelRewardStore
Definition: ObjectMgr.h:1490
AreaTriggerStruct const * ObjectMgr::GetMapEntranceTrigger ( uint32  Map) const

Searches for the areatrigger which teleports players to the given map

6330 {
6331  for (AreaTriggerContainer::const_iterator itr = _areaTriggerStore.begin(); itr != _areaTriggerStore.end(); ++itr)
6332  {
6333  if (itr->second.target_mapId == Map)
6334  {
6335  AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
6336  if (atEntry)
6337  return &itr->second;
6338  }
6339  }
6340  return NULL;
6341 }
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerfmt)
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Map.h:259
Definition: DBCStructure.h:74
AreaTriggerContainer _areaTriggerStore
Definition: ObjectMgr.h:1438
CellObjectGuidsMap const& ObjectMgr::GetMapObjectGuids ( uint16  mapid,
uint8  spawnMode 
)
inline
1130  {
1131  return _mapObjectGuidsStore[MAKE_PAIR32(mapid, spawnMode)];
1132  }
MapObjectGuids _mapObjectGuidsStore
Definition: ObjectMgr.h:1516
uint32 MAKE_PAIR32(uint16 l, uint16 h)
Definition: ObjectDefines.h:54

+ Here is the call graph for this function:

uint32 ObjectMgr::GetNearestTaxiNode ( float  x,
float  y,
float  z,
uint32  mapid,
uint32  team 
)
5741 {
5742  bool found = false;
5743  float dist = 10000;
5744  uint32 id = 0;
5745 
5746  uint32 requireFlag = (team == ALLIANCE) ? TAXI_NODE_FLAG_ALLIANCE : TAXI_NODE_FLAG_HORDE;
5747  for (TaxiNodesEntry const* node : sTaxiNodesStore)
5748  {
5749  if (!node || node->MapID != mapid || !(node->Flags & requireFlag))
5750  continue;
5751 
5752  uint8 field = (uint8)((node->ID - 1) / 8);
5753  uint32 submask = 1 << ((node->ID - 1) % 8);
5754 
5755  // skip not taxi network nodes
5756  if ((sTaxiNodesMask[field] & submask) == 0)
5757  continue;
5758 
5759  float dist2 = (node->Pos.X - x)*(node->Pos.X - x) + (node->Pos.Y - y)*(node->Pos.Y - y) + (node->Pos.Z - z)*(node->Pos.Z - z);
5760  if (found)
5761  {
5762  if (dist2 < dist)
5763  {
5764  dist = dist2;
5765  id = node->ID;
5766  }
5767  }
5768  else
5769  {
5770  found = true;
5771  dist = dist2;
5772  id = node->ID;
5773  }
5774  }
5775 
5776  return id;
5777 }
Definition: DBCEnums.h:696
TaxiMask sTaxiNodesMask
Definition: DB2Stores.cpp:134
Definition: SharedDefines.h:1000
Definition: DBCEnums.h:695
G3D::int16 z
Definition: Vector3int16.h:46
uint32_t uint32
Definition: Define.h:150
G3D::int16 y
Definition: Vector2int16.h:38
uint8_t uint8
Definition: g3dmath.h:164
Definition: DB2Structure.h:1324
uint8_t uint8
Definition: Define.h:152
G3D::int16 x
Definition: Vector2int16.h:37
DB2Storage< TaxiNodesEntry > sTaxiNodesStore("TaxiNodes.db2", TaxiNodesFormat, HOTFIX_SEL_TAXI_NODES)
std::string ObjectMgr::GetNormalizedRealmName ( uint32  realm) const
9344 {
9345  std::string name = GetRealmName(realmId);
9346  name.erase(std::remove_if(name.begin(), name.end(), ::isspace), name.end());
9347  return name;
9348 }
std::string GetRealmName(uint32 realm) const
Definition: ObjectMgr.cpp:9337

+ Here is the call graph for this function:

NpcText const * ObjectMgr::GetNpcText ( uint32  textID) const
5347 {
5348  NpcTextContainer::const_iterator itr = _npcTextStore.find(Text_ID);
5349  if (itr != _npcTextStore.end())
5350  return &itr->second;
5351  return NULL;
5352 }
NpcTextContainer _npcTextStore
Definition: ObjectMgr.h:1436
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

TrainerSpellData const* ObjectMgr::GetNpcTrainerSpells ( uint32  entry) const
inline
1262  {
1263  CacheTrainerSpellContainer::const_iterator iter = _cacheTrainerSpellStore.find(entry);
1264  if (iter == _cacheTrainerSpellStore.end())
1265  return NULL;
1266 
1267  return &iter->second;
1268  }
CacheTrainerSpellContainer _cacheTrainerSpellStore
Definition: ObjectMgr.h:1544
arena_t NULL
Definition: jemalloc_internal.h:624
VendorItemData const* ObjectMgr::GetNpcVendorItemList ( uint32  entry) const
inline
1271  {
1272  CacheVendorItemContainer::const_iterator iter = _cacheVendorItemStore.find(entry);
1273  if (iter == _cacheVendorItemStore.end())
1274  return NULL;
1275 
1276  return &iter->second;
1277  }
arena_t NULL
Definition: jemalloc_internal.h:624
CacheVendorItemContainer _cacheVendorItemStore
Definition: ObjectMgr.h:1543

+ Here is the caller graph for this function:

PageText const * ObjectMgr::GetPageText ( uint32  pageEntry)
5164 {
5165  PageTextContainer::const_iterator itr = _pageTextStore.find(pageEntry);
5166  if (itr != _pageTextStore.end())
5167  return &(itr->second);
5168 
5169  return NULL;
5170 }
arena_t NULL
Definition: jemalloc_internal.h:624
PageTextContainer _pageTextStore
Definition: ObjectMgr.h:1477

+ Here is the caller graph for this function:

PageTextLocale const* ObjectMgr::GetPageTextLocale ( uint32  entry) const
inline
1191  {
1192  PageTextLocaleContainer::const_iterator itr = _pageTextLocaleStore.find(entry);
1193  if (itr == _pageTextLocaleStore.end()) return NULL;
1194  return &itr->second;
1195  }
PageTextLocaleContainer _pageTextLocaleStore
Definition: ObjectMgr.h:1537
arena_t NULL
Definition: jemalloc_internal.h:624
PetLevelInfo const * ObjectMgr::GetPetLevelInfo ( uint32  creature_id,
uint8  level 
) const
2980 {
2981  if (level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
2982  level = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
2983 
2984  PetLevelInfoContainer::const_iterator itr = _petInfoStore.find(creature_id);
2985  if (itr == _petInfoStore.end())
2986  return NULL;
2987 
2988  return &itr->second[level-1]; // data for level 1 stored in [0] array element, ...
2989 }
arena_t NULL
Definition: jemalloc_internal.h:624
#define sWorld
Definition: World.h:887
PetLevelInfoContainer _petInfoStore
Definition: ObjectMgr.h:1496
Definition: World.h:235
std::vector<PhaseInfoStruct> const* ObjectMgr::GetPhasesForArea ( uint32  area) const
inline
1327  {
1328  auto itr = _phases.find(area);
1329  return itr != _phases.end() ? &itr->second : nullptr;
1330  }
PhaseInfo _phases
Definition: ObjectMgr.h:1483
std::vector<PhaseInfoStruct>* ObjectMgr::GetPhasesForAreaForLoading ( uint32  area)
inline
1335  {
1336  auto itr = _phases.find(area);
1337  return itr != _phases.end() ? &itr->second : nullptr;
1338  }
PhaseInfo _phases
Definition: ObjectMgr.h:1483
std::vector<uint32> const* ObjectMgr::GetPhaseTerrainSwaps ( uint32  phaseid) const
inline
1312  {
1313  auto itr = _terrainPhaseInfoStore.find(phaseid);
1314  return itr != _terrainPhaseInfoStore.end() ? &itr->second : nullptr;
1315  }
TerrainPhaseInfo _terrainPhaseInfoStore
Definition: ObjectMgr.h:1480
uint32 ObjectMgr::GetPlayerAccountIdByGUID ( ObjectGuid const guid)
static
2303 {
2304  if (CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(guid))
2305  return characterInfo->AccountId;
2306 
2307  return 0;
2308 }
#define sWorld
Definition: World.h:887
Definition: World.h:532

+ Here is the caller graph for this function:

uint32 ObjectMgr::GetPlayerAccountIdByPlayerName ( std::string const name)
static
2311 {
2313  stmt->setString(0, name);
2314 
2315  if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
2316  return (*result)[0].GetUInt32();
2317 
2318  return 0;
2319 }
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: CharacterDatabase.h:150

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Player * ObjectMgr::GetPlayerByLowGUID ( ObjectGuid::LowType  lowguid) const
2242 {
2243  return ObjectAccessor::FindPlayer(ObjectGuid::Create<HighGuid::Player>(lowguid));
2244 }
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209

+ Here is the call graph for this function:

void ObjectMgr::GetPlayerClassLevelInfo ( uint32  class_,
uint8  level,
uint32 baseHP,
uint32 baseMana 
) const
3535 {
3536  if (level < 1 || class_ >= MAX_CLASSES)
3537  return;
3538 
3539  if (level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
3540  level = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
3541 
3542  GtOCTBaseHPByClassEntry const* hp = sGtOCTBaseHPByClassStore.EvaluateTable(level - 1, class_ - 1);
3543  GtOCTBaseMPByClassEntry const* mp = sGtOCTBaseMPByClassStore.EvaluateTable(level - 1, class_ - 1);
3544 
3545  if (!hp || !mp)
3546  {
3547  TC_LOG_ERROR("misc", "Tried to get non-existant Class-Level combination data for base hp/mp. Class %u Level %u", class_, level);
3548  return;
3549  }
3550 
3551  baseHP = uint32(hp->ratio);
3552  baseMana = uint32(mp->ratio);
3553 }
Definition: DBCStructure.h:627
float ratio
Definition: DBCStructure.h:634
#define sWorld
Definition: World.h:887
float ratio
Definition: DBCStructure.h:629
#define MAX_CLASSES
Definition: SharedDefines.h:181
GameTable< GtOCTBaseHPByClassEntry > sGtOCTBaseHPByClassStore(GtOCTBaseHPByClassfmt)
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
Definition: DBCStructure.h:632
Definition: World.h:235
GameTable< GtOCTBaseMPByClassEntry > sGtOCTBaseMPByClassStore(GtOCTBaseMPByClassfmt)
ObjectGuid ObjectMgr::GetPlayerGUIDByName ( std::string const name)
static
2248 {
2250  stmt->setString(0, name);
2251 
2252  if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
2253  return ObjectGuid::Create<HighGuid::Player>((*result)[0].GetUInt64());
2254 
2255  return ObjectGuid::Empty;
2256 }
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
Definition: CharacterDatabase.h:36
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PlayerInfo const * ObjectMgr::GetPlayerInfo ( uint32  race,
uint32  class_ 
) const
9140 {
9141  if (race >= MAX_RACES)
9142  return NULL;
9143  if (class_ >= MAX_CLASSES)
9144  return NULL;
9145  PlayerInfo const* info = _playerInfo[race][class_];
9146  if (!info)
9147  return NULL;
9148  return info;
9149 }
Definition: Player.h:396
arena_t NULL
Definition: jemalloc_internal.h:624
#define MAX_CLASSES
Definition: SharedDefines.h:181
#define MAX_RACES
Definition: SharedDefines.h:131
PlayerInfo * _playerInfo[MAX_RACES][MAX_CLASSES]
Definition: ObjectMgr.h:1500
void ObjectMgr::GetPlayerLevelInfo ( uint32  race,
uint32  class_,
uint8  level,
PlayerLevelInfo info 
) const
3556 {
3557  if (level < 1 || race >= MAX_RACES || class_ >= MAX_CLASSES)
3558  return;
3559 
3560  PlayerInfo const* pInfo = _playerInfo[race][class_];
3561  if (!pInfo)
3562  return;
3563 
3564  if (level <= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
3565  *info = pInfo->levelInfo[level-1];
3566  else
3567  BuildPlayerLevelInfo(race, class_, level, info);
3568 }
Definition: Player.h:396
PlayerLevelInfo * levelInfo
Definition: Player.h:415
#define MAX_CLASSES
Definition: SharedDefines.h:181
void BuildPlayerLevelInfo(uint8 race, uint8 class_, uint8 level, PlayerLevelInfo *plinfo) const
Definition: ObjectMgr.cpp:3570
#define MAX_RACES
Definition: SharedDefines.h:131
PlayerInfo * _playerInfo[MAX_RACES][MAX_CLASSES]
Definition: ObjectMgr.h:1500
Definition: World.h:235

+ Here is the call graph for this function:

bool ObjectMgr::GetPlayerNameAndClassByGUID ( ObjectGuid const guid,
std::string &  name,
uint8 _class 
)
static
2276 {
2277  if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
2278  {
2279  name = player->GetName();
2280  _class = player->getClass();
2281  return true;
2282  }
2283 
2284  if (CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(guid))
2285  {
2286  name = characterInfo->Name;
2287  _class = characterInfo->Class;
2288  return true;
2289  }
2290 
2291  return false;
2292 }
#define sWorld
Definition: World.h:887
Definition: World.h:532
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215

+ Here is the call graph for this function: