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 ( >= 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:

+ Here is the caller graph for this function:

bool ObjectMgr::GetPlayerNameByGUID ( ObjectGuid const guid,
std::string &  name 
)
static

Retrieves the player name by guid.

If the player is online, the name is retrieved immediately otherwise a database query is done.

Remarks
Use sWorld->GetCharacterNameData because it doesn't require a database query when player is offline
Parameters
guidplayer full guid
namereturned name
Returns
true if player was found, false otherwise
2259 {
2260  if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
2261  {
2262  name = player->GetName();
2263  return true;
2264  }
2265 
2266  if (CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(guid))
2267  {
2268  name = characterInfo->Name;
2269  return true;
2270  }
2271 
2272  return false;
2273 }
#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:

+ Here is the caller graph for this function:

uint32 ObjectMgr::GetPlayerTeamByGUID ( ObjectGuid const guid)
static
2295 {
2296  if (CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(guid))
2297  return Player::TeamForRace(characterInfo->Race);
2298 
2299  return 0;
2300 }
#define sWorld
Definition: World.h:887
Definition: World.h:532

+ Here is the caller graph for this function:

PointOfInterest const* ObjectMgr::GetPointOfInterest ( uint32  id) const
inline
902  {
903  PointOfInterestContainer::const_iterator itr = _pointsOfInterestStore.find(id);
904  if (itr != _pointsOfInterestStore.end())
905  return &itr->second;
906  return NULL;
907  }
PointOfInterestContainer _pointsOfInterestStore
Definition: ObjectMgr.h:1449
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

PointOfInterestLocale const* ObjectMgr::GetPointOfInterestLocale ( uint32  id) const
inline
1203  {
1204  PointOfInterestLocaleContainer::const_iterator itr = _pointOfInterestLocaleStore.find(id);
1205  if (itr == _pointOfInterestLocaleStore.end()) return NULL;
1206  return &itr->second;
1207  }
arena_t NULL
Definition: jemalloc_internal.h:624
PointOfInterestLocaleContainer _pointOfInterestLocaleStore
Definition: ObjectMgr.h:1539
QuestGreeting const * ObjectMgr::GetQuestGreeting ( ObjectGuid  guid) const
5602 {
5603  auto itr = _questGreetingStore.find(guid.GetTypeId());
5604  if (itr == _questGreetingStore.end())
5605  return nullptr;
5606 
5607  auto questItr = itr->second.find(guid.GetEntry());
5608  if (questItr == itr->second.end())
5609  return nullptr;
5610 
5611  return questItr->second;
5612 }
QuestGreetingContainer _questGreetingStore
Definition: ObjectMgr.h:1437
uint32 GetEntry() const
Definition: ObjectGuid.h:220
static TypeID GetTypeId(HighGuid high)
Definition: ObjectGuid.h:263

+ Here is the call graph for this function:

QuestTemplateLocale const* ObjectMgr::GetQuestLocale ( uint32  entry) const
inline
1179  {
1180  QuestTemplateLocaleContainer::const_iterator itr = _questTemplateLocaleStore.find(entry);
1181  if (itr == _questTemplateLocaleStore.end()) return NULL;
1182  return &itr->second;
1183  }
arena_t NULL
Definition: jemalloc_internal.h:624
QuestTemplateLocaleContainer _questTemplateLocaleStore
Definition: ObjectMgr.h:1535
QuestObjectivesLocale const* ObjectMgr::GetQuestObjectivesLocale ( uint32  entry) const
inline
1185  {
1186  QuestObjectivesLocaleContainer::const_iterator itr = _questObjectivesLocaleStore.find(entry);
1187  if (itr == _questObjectivesLocaleStore.end()) return NULL;
1188  return &itr->second;
1189  }
QuestObjectivesLocaleContainer _questObjectivesLocaleStore
Definition: ObjectMgr.h:1536
arena_t NULL
Definition: jemalloc_internal.h:624
QuestPOIVector const* ObjectMgr::GetQuestPOIVector ( int32  QuestID)
inline
910  {
911  QuestPOIContainer::const_iterator itr = _questPOIStore.find(QuestID);
912  if (itr != _questPOIStore.end())
913  return &itr->second;
914  return NULL;
915  }
arena_t NULL
Definition: jemalloc_internal.h:624
QuestPOIContainer _questPOIStore
Definition: ObjectMgr.h:1451
std::unordered_set<uint32> const* ObjectMgr::GetQuestsForAreaTrigger ( uint32  Trigger_ID) const
inline
824  {
825  auto itr = _questAreaTriggerStore.find(Trigger_ID);
826  if (itr != _questAreaTriggerStore.end())
827  return &itr->second;
828  return nullptr;
829  }
QuestAreaTriggerContainer _questAreaTriggerStore
Definition: ObjectMgr.h:1433
Quest const* ObjectMgr::GetQuestTemplate ( uint32  quest_id) const
inline
816  {
817  QuestMap::const_iterator itr = _questTemplates.find(quest_id);
818  return itr != _questTemplates.end() ? itr->second : NULL;
819  }
QuestMap _questTemplates
Definition: ObjectMgr.h:1426
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

QuestMap const& ObjectMgr::GetQuestTemplates ( ) const
inline
821 { return _questTemplates; }
QuestMap _questTemplates
Definition: ObjectMgr.h:1426
uint8 ObjectMgr::GetRaceExpansionRequirement ( uint8  race) const
inline
1376  {
1377  auto itr = _raceExpansionRequirementStore.find(race);
1378  if (itr != _raceExpansionRequirementStore.end())
1379  return itr->second;
1380  return EXPANSION_CLASSIC;
1381  }
Definition: SharedDefines.h:79
ExpansionRequirementContainer _raceExpansionRequirementStore
Definition: ObjectMgr.h:1549
ExpansionRequirementContainer const& ObjectMgr::GetRaceExpansionRequirements ( ) const
inline
ExpansionRequirementContainer _raceExpansionRequirementStore
Definition: ObjectMgr.h:1549
std::string ObjectMgr::GetRealmName ( uint32  realm) const
9338 {
9339  RealmNameContainer::const_iterator iter = _realmNameStore.find(realmId);
9340  return iter != _realmNameStore.end() ? iter->second : "";
9341 }
RealmNameContainer _realmNameStore
Definition: ObjectMgr.h:1551

+ Here is the caller graph for this function:

RepRewardRate const* ObjectMgr::GetRepRewardRate ( uint32  factionId) const
inline
874  {
875  RepRewardRateContainer::const_iterator itr = _repRewardRateStore.find(factionId);
876  if (itr != _repRewardRateStore.end())
877  return &itr->second;
878 
879  return NULL;
880  }
arena_t NULL
Definition: jemalloc_internal.h:624
RepRewardRateContainer _repRewardRateStore
Definition: ObjectMgr.h:1443
RepSpilloverTemplate const* ObjectMgr::GetRepSpilloverTemplate ( uint32  factionId) const
inline
893  {
894  RepSpilloverTemplateContainer::const_iterator itr = _repSpilloverTemplateStore.find(factionId);
895  if (itr != _repSpilloverTemplateStore.end())
896  return &itr->second;
897 
898  return NULL;
899  }
arena_t NULL
Definition: jemalloc_internal.h:624
RepSpilloverTemplateContainer _repSpilloverTemplateStore
Definition: ObjectMgr.h:1445
ReputationOnKillEntry const* ObjectMgr::GetReputationOnKilEntry ( uint32  id) const
inline
883  {
884  RepOnKillContainer::const_iterator itr = _repOnKillStore.find(id);
885  if (itr != _repOnKillStore.end())
886  return &itr->second;
887  return NULL;
888  }
RepOnKillContainer _repOnKillStore
Definition: ObjectMgr.h:1444
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 ObjectMgr::GetScriptId ( std::string const name)
8628 {
8629  // use binary search to find the script name in the sorted vector
8630  // assume "" is the first element
8631  if (name.empty())
8632  return 0;
8633 
8634  ScriptNameContainer::const_iterator itr = std::lower_bound(_scriptNamesStore.begin(), _scriptNamesStore.end(), name);
8635  if (itr == _scriptNamesStore.end() || *itr != name)
8636  return 0;
8637 
8638  return uint32(itr - _scriptNamesStore.begin());
8639 }
ScriptNameContainer _scriptNamesStore
Definition: ObjectMgr.h:1466
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the caller graph for this function:

std::string const & ObjectMgr::GetScriptName ( uint32  id) const
8622 {
8623  static std::string const empty = "";
8624  return id < _scriptNamesStore.size() ? _scriptNamesStore[id] : empty;
8625 }
ScriptNameContainer _scriptNamesStore
Definition: ObjectMgr.h:1466

+ Here is the caller graph for this function:

SkillTiersEntry const* ObjectMgr::GetSkillTier ( uint32  skillTierId) const
inline
1080  {
1081  auto itr = _skillTiers.find(skillTierId);
1082  return itr != _skillTiers.end() ? &itr->second : nullptr;
1083  }
std::unordered_map< uint32, SkillTiersEntry > _skillTiers
Definition: ObjectMgr.h:1510
SpellClickInfoMapBounds ObjectMgr::GetSpellClickInfoMapBounds ( uint32  creature_id) const
inline
1288  {
1289  return _spellClickInfoStore.equal_range(creature_id);
1290  }
SpellClickInfoContainer _spellClickInfoStore
Definition: ObjectMgr.h:1468
SpellScriptsBounds ObjectMgr::GetSpellScriptsBounds ( uint32  spellId)
7847 {
7848  return SpellScriptsBounds(_spellScriptsStore.equal_range(spellId));
7849 }
std::pair< SpellScriptsContainer::iterator, SpellScriptsContainer::iterator > SpellScriptsBounds
Definition: ObjectMgr.h:378
SpellScriptsContainer _spellScriptsStore
Definition: ObjectMgr.h:1470
std::vector<TempSummonData> const* ObjectMgr::GetSummonGroup ( uint32  summonerId,
SummonerType  summonerType,
uint8  group 
) const
inline

Gets temp summon data for all creatures of specified group.

Parameters
summonerIdSummoner's entry.
summonerTypeSummoner's type, see SummonerType for available types.
groupId of required group.
Returns
null if group was not found, otherwise reference to the creature group data
1144  {
1145  TempSummonDataContainer::const_iterator itr = _tempSummonDataStore.find(TempSummonGroupKey(summonerId, summonerType, group));
1146  if (itr != _tempSummonDataStore.end())
1147  return &itr->second;
1148 
1149  return NULL;
1150  }
arena_t NULL
Definition: jemalloc_internal.h:624
TempSummonDataContainer _tempSummonDataStore
Stores temp summon data grouped by summoner's entry, summoner's type and group id.
Definition: ObjectMgr.h:1532
Key for storing temp summon data in TempSummonDataContainer.
Definition: ObjectMgr.h:62
uint32 ObjectMgr::GetTaxiMountDisplayId ( uint32  id,
uint32  team,
bool  allowed_alt_team = false 
)
5804 {
5805  uint32 mount_id = 0;
5806 
5807  // select mount creature id
5808  TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id);
5809  if (node)
5810  {
5811  uint32 mount_entry = 0;
5812  if (team == ALLIANCE)
5813  mount_entry = node->MountCreatureID[1];
5814  else
5815  mount_entry = node->MountCreatureID[0];
5816 
5817  // Fix for Alliance not being able to use Acherus taxi
5818  // only one mount type for both sides
5819  if (mount_entry == 0 && allowed_alt_team)
5820  {
5821  // Simply reverse the selection. At least one team in theory should have a valid mount ID to choose.
5822  mount_entry = team == ALLIANCE ? node->MountCreatureID[0] : node->MountCreatureID[1];
5823  }
5824 
5825  CreatureTemplate const* mount_info = GetCreatureTemplate(mount_entry);
5826  if (mount_info)
5827  {
5828  mount_id = mount_info->GetRandomValidModelId();
5829  if (!mount_id)
5830  {
5831  TC_LOG_ERROR("sql.sql", "No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry);
5832  return 0;
5833  }
5834  }
5835  }
5836 
5837  // minfo is not actually used but the mount_id was updated
5838  GetCreatureModelRandomGender(&mount_id);
5839 
5840  return mount_id;
5841 }
uint32 GetRandomValidModelId() const
Definition: Creature.cpp:86
uint32 MountCreatureID[2]
Definition: DB2Structure.h:1330
Definition: SharedDefines.h:1000
uint32_t uint32
Definition: Define.h:150
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
Definition: DB2Structure.h:1324
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
DB2Storage< TaxiNodesEntry > sTaxiNodesStore("TaxiNodes.db2", TaxiNodesFormat, HOTFIX_SEL_TAXI_NODES)
CreatureModelInfo const * GetCreatureModelRandomGender(uint32 *displayID)
Definition: ObjectMgr.cpp:1297
Definition: Creature.h:79

+ Here is the call graph for this function:

void ObjectMgr::GetTaxiPath ( uint32  source,
uint32  destination,
uint32 path,
uint32 cost 
)
5780 {
5781  TaxiPathSetBySource::iterator src_i = sTaxiPathSetBySource.find(source);
5782  if (src_i == sTaxiPathSetBySource.end())
5783  {
5784  path = 0;
5785  cost = 0;
5786  return;
5787  }
5788 
5789  TaxiPathSetForSource& pathSet = src_i->second;
5790 
5791  TaxiPathSetForSource::iterator dest_i = pathSet.find(destination);
5792  if (dest_i == pathSet.end())
5793  {
5794  path = 0;
5795  cost = 0;
5796  return;
5797  }
5798 
5799  cost = dest_i->second.price;
5800  path = dest_i->second.ID;
5801 }
std::map< uint32, TaxiPathBySourceAndDestination > TaxiPathSetForSource
Definition: DB2Structure.h:1446
TaxiPathSetBySource sTaxiPathSetBySource
Definition: DB2Stores.cpp:138
void ObjectMgr::GetTaxiPath ( uint32  source,
uint32  destination,
std::vector< uint32 > &  path,
uint32 cost 
)
std::vector<uint32> const* ObjectMgr::GetTerrainWorldMaps ( uint32  terrainId) const
inline
1322  {
1323  auto itr = _terrainWorldMapStore.find(terrainId);
1324  return itr != _terrainWorldMapStore.end() ? &itr->second : nullptr;
1325  }
TerrainUIPhaseInfo _terrainWorldMapStore
Definition: ObjectMgr.h:1482
TrinityString const* ObjectMgr::GetTrinityString ( uint32  entry) const
inline
1219  {
1220  TrinityStringContainer::const_iterator itr = _trinityStringStore.find(entry);
1221  if (itr == _trinityStringStore.end())
1222  return nullptr;
1223  return &itr->second;
1224  }
TrinityStringContainer _trinityStringStore
Definition: ObjectMgr.h:1541

+ Here is the caller graph for this function:

char const * ObjectMgr::GetTrinityString ( uint32  entry,
LocaleConstant  locale 
) const
7739 {
7740  if (TrinityString const* ts = GetTrinityString(entry))
7741  {
7742  if (ts->Content.size() > size_t(locale) && !ts->Content[locale].empty())
7743  return ts->Content[locale].c_str();
7744  return ts->Content[DEFAULT_LOCALE].c_str();
7745  }
7746 
7747  TC_LOG_ERROR("sql.sql", "Trinity string entry %u not found in DB.", entry);
7748  return "<error>";
7749 }
Definition: ObjectMgr.h:421
TrinityString const * GetTrinityString(uint32 entry) const
Definition: ObjectMgr.h:1218
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
#define DEFAULT_LOCALE
Definition: Common.h:134

+ Here is the call graph for this function:

char const* ObjectMgr::GetTrinityStringForDBCLocale ( uint32  entry) const
inline
1226 { return GetTrinityString(entry, DBCLocaleIndex); }
LocaleConstant DBCLocaleIndex
Definition: ObjectMgr.h:1475
TrinityString const * GetTrinityString(uint32 entry) const
Definition: ObjectMgr.h:1218
VehicleAccessoryList const * ObjectMgr::GetVehicleAccessoryList ( Vehicle veh) const
9123 {
9124  if (Creature* cre = veh->GetBase()->ToCreature())
9125  {
9126  // Give preference to GUID-based accessories
9127  VehicleAccessoryContainer::const_iterator itr = _vehicleAccessoryStore.find(cre->GetSpawnId());
9128  if (itr != _vehicleAccessoryStore.end())
9129  return &itr->second;
9130  }
9131 
9132  // Otherwise return entry-based
9133  VehicleAccessoryTemplateContainer::const_iterator itr = _vehicleTemplateAccessoryStore.find(veh->GetCreatureEntry());
9134  if (itr != _vehicleTemplateAccessoryStore.end())
9135  return &itr->second;
9136  return NULL;
9137 }
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:467
VehicleAccessoryTemplateContainer _vehicleTemplateAccessoryStore
Definition: ObjectMgr.h:1472
Creature * ToCreature()
Definition: Object.h:194
VehicleAccessoryContainer _vehicleAccessoryStore
Definition: ObjectMgr.h:1473
uint32 GetCreatureEntry() const
Definition: Vehicle.h:51
Unit * GetBase() const
May be called from scripts.
Definition: Vehicle.h:49

+ Here is the call graph for this function:

uint32 ObjectMgr::GetXPForLevel ( uint8  level) const
6813 {
6814  if (level < _playerXPperLevel.size())
6815  return _playerXPperLevel[level];
6816  return 0;
6817 }
PlayerXPperLevel _playerXPperLevel
Definition: ObjectMgr.h:1503
ObjectMgr * ObjectMgr::instance ( )
static
255 {
256  static ObjectMgr instance;
257  return &instance;
258 }
static ObjectMgr * instance()
Definition: ObjectMgr.cpp:254
Definition: ObjectMgr.h:702
bool ObjectMgr::IsGameObjectForQuests ( uint32  entry) const
inline
837  {
838  return _gameObjectForQuestStore.find(entry) != _gameObjectForQuestStore.end();
839  }
GameObjectForQuestContainer _gameObjectForQuestStore
Definition: ObjectMgr.h:1435
bool ObjectMgr::IsReservedName ( std::string const name) const
7497 {
7498  std::wstring wstr;
7499  if (!Utf8toWStr (name, wstr))
7500  return false;
7501 
7502  wstrToLower(wstr);
7503 
7504  return _reservedNamesStore.find(wstr) != _reservedNamesStore.end();
7505 }
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
ReservedNamesContainer _reservedNamesStore
Definition: ObjectMgr.h:1462

+ Here is the call graph for this function:

bool ObjectMgr::IsTavernAreaTrigger ( uint32  Trigger_ID) const
inline
832  {
833  return _tavernAreaTriggerStore.find(Trigger_ID) != _tavernAreaTriggerStore.end();
834  }
TavernAreaTriggerContainer _tavernAreaTriggerStore
Definition: ObjectMgr.h:1434
bool ObjectMgr::IsTransportMap ( uint32  mapId) const
inline
1365 { return _transportMaps.count(mapId) != 0; }
std::set< uint32 > _transportMaps
Definition: ObjectMgr.h:1564

+ Here is the caller graph for this function:

bool ObjectMgr::IsValidCharterName ( std::string const name)
static
7606 {
7607  std::wstring wname;
7608  if (!Utf8toWStr(name, wname))
7609  return false;
7610 
7611  if (wname.size() > MAX_CHARTER_NAME)
7612  return false;
7613 
7614  uint32 minName = sWorld->getIntConfig(CONFIG_MIN_CHARTER_NAME);
7615  if (wname.size() < minName)
7616  return false;
7617 
7618  uint32 strictMask = sWorld->getIntConfig(CONFIG_STRICT_CHARTER_NAMES);
7619 
7620  return isValidString(wname, strictMask, true);
7621 }
#define sWorld
Definition: World.h:887
Definition: World.h:225
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:281
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_CHARTER_NAME
Definition: ObjectMgr.h:647
Definition: World.h:222

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ObjectMgr::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
8481 {
8482  CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(vendor_entry);
8483  if (!cInfo)
8484  {
8485  if (player)
8486  ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
8487  else
8488  TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has data for nonexistent creature template (Entry: %u), ignore", vendor_entry);
8489  return false;
8490  }
8491 
8492  if (!((cInfo->npcflag | ORnpcflag) & UNIT_NPC_FLAG_VENDOR))
8493  {
8494  if (!skip_vendors || skip_vendors->count(vendor_entry) == 0)
8495  {
8496  if (player)
8497  ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
8498  else
8499  TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has data for creature template (Entry: %u) without vendor flag, ignore", vendor_entry);
8500 
8501  if (skip_vendors)
8502  skip_vendors->insert(vendor_entry);
8503  }
8504  return false;
8505  }
8506 
8507  if ((type == ITEM_VENDOR_TYPE_ITEM && !sObjectMgr->GetItemTemplate(id)) ||
8508  (type == ITEM_VENDOR_TYPE_CURRENCY && !sCurrencyTypesStore.LookupEntry(id)))
8509  {
8510  if (player)
8511  ChatHandler(player->GetSession()).PSendSysMessage(LANG_ITEM_NOT_FOUND, id, type);
8512  else
8513  TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u, type %u), ignore", vendor_entry, id, type);
8514  return false;
8515  }
8516 
8517  if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
8518  {
8519  if (player)
8520  ChatHandler(player->GetSession()).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
8521  else
8522  TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", id, ExtendedCost, vendor_entry);
8523  return false;
8524  }
8525 
8526  if (type == ITEM_VENDOR_TYPE_ITEM) // not applicable to currencies
8527  {
8528  if (maxcount > 0 && incrtime == 0)
8529  {
8530  if (player)
8531  ChatHandler(player->GetSession()).PSendSysMessage("MaxCount != 0 (%u) but IncrTime == 0", maxcount);
8532  else
8533  TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, id, vendor_entry);
8534  return false;
8535  }
8536  else if (maxcount == 0 && incrtime > 0)
8537  {
8538  if (player)
8539  ChatHandler(player->GetSession()).PSendSysMessage("MaxCount == 0 but IncrTime<>= 0");
8540  else
8541  TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", id, vendor_entry);
8542  return false;
8543  }
8544  }
8545 
8546  VendorItemData const* vItems = GetNpcVendorItemList(vendor_entry);
8547  if (!vItems)
8548  return true; // later checks for non-empty lists
8549 
8550  if (vItems->FindItemCostPair(id, ExtendedCost, type))
8551  {
8552  if (player)
8553  ChatHandler(player->GetSession()).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, id, ExtendedCost, type);
8554  else
8555  TC_LOG_ERROR("sql.sql", "Table `npc_vendor` has duplicate items %u (with extended cost %u, type %u) for vendor (Entry: %u), ignoring", id, ExtendedCost, type, vendor_entry);
8556  return false;
8557  }
8558 
8559  if (type == ITEM_VENDOR_TYPE_CURRENCY && maxcount == 0)
8560  {
8561  TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have Item (Entry: %u, type: %u) with missing maxcount for vendor (%u), ignore", id, type, vendor_entry);
8562  return false;
8563  }
8564 
8565  return true;
8566 }
VendorItem const * FindItemCostPair(uint32 item_id, uint32 extendedCost, uint8 type) const
Definition: Creature.cpp:78
DB2Storage< CurrencyTypesEntry > sCurrencyTypesStore("CurrencyTypes.db2", CurrencyTypesFormat, HOTFIX_SEL_CURRENCY_TYPES)
uint64 npcflag
Definition: Creature.h:98
Definition: Unit.h:742
Definition: Language.h:310
Definition: Language.h:359
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: Language.h:232
DB2Storage< ItemExtendedCostEntry > sItemExtendedCostStore("ItemExtendedCost.db2", ItemExtendedCostFormat, HOTFIX_SEL_ITEM_EXTENDED_COST)
Definition: ItemTemplate.h:292
Definition: Language.h:235
VendorItemData const * GetNpcVendorItemList(uint32 entry) const
Definition: ObjectMgr.h:1270
Definition: Chat.h:56
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: Creature.h:383
Definition: Creature.h:79
Definition: ItemTemplate.h:293

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ObjectMgr::LoadAccessRequirements ( )
6186 {
6187  uint32 oldMSTime = getMSTime();
6188 
6189  if (!_accessRequirementStore.empty())
6190  {
6191  for (AccessRequirementContainer::iterator itr = _accessRequirementStore.begin(); itr != _accessRequirementStore.end(); ++itr)
6192  delete itr->second;
6193 
6194  _accessRequirementStore.clear(); // need for reload case
6195  }
6196 
6197  // 0 1 2 3 4 5 6 7 8 9
6198  QueryResult result = WorldDatabase.Query("SELECT mapid, difficulty, level_min, level_max, item, item2, quest_done_A, quest_done_H, completed_achievement, quest_failed_text FROM access_requirement");
6199 
6200  if (!result)
6201  {
6202  TC_LOG_INFO("server.loading", ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty.");
6203  return;
6204  }
6205 
6206  uint32 count = 0;
6207 
6208  do
6209  {
6210  Field* fields = result->Fetch();
6211 
6212  uint32 mapid = fields[0].GetUInt32();
6213  if (!sMapStore.LookupEntry(mapid))
6214  {
6215  TC_LOG_ERROR("sql.sql", "Map %u referenced in `access_requirement` does not exist, skipped.", mapid);
6216  continue;
6217  }
6218 
6219  uint32 difficulty = fields[1].GetUInt8();
6220  if (!GetMapDifficultyData(mapid, Difficulty(difficulty)))
6221  {
6222  TC_LOG_ERROR("sql.sql", "Map %u referenced in `access_requirement` does not have difficulty %u, skipped", mapid, difficulty);
6223  continue;
6224  }
6225 
6226  uint64 requirement_ID = MAKE_PAIR64(mapid, difficulty);
6227 
6228  AccessRequirement* ar = new AccessRequirement();
6229  ar->levelMin = fields[2].GetUInt8();
6230  ar->levelMax = fields[3].GetUInt8();
6231  ar->item = fields[4].GetUInt32();
6232  ar->item2 = fields[5].GetUInt32();
6233  ar->quest_A = fields[6].GetUInt32();
6234  ar->quest_H = fields[7].GetUInt32();
6235  ar->achievement = fields[8].GetUInt32();
6236  ar->questFailedText = fields[9].GetString();
6237 
6238  if (ar->item)
6239  {
6240  ItemTemplate const* pProto = GetItemTemplate(ar->item);
6241  if (!pProto)
6242  {
6243  TC_LOG_ERROR("sql.sql", "Key item %u does not exist for map %u difficulty %u, removing key requirement.", ar->item, mapid, difficulty);
6244  ar->item = 0;
6245  }
6246  }
6247 
6248  if (ar->item2)
6249  {
6250  ItemTemplate const* pProto = GetItemTemplate(ar->item2);
6251  if (!pProto)
6252  {
6253  TC_LOG_ERROR("sql.sql", "Second item %u does not exist for map %u difficulty %u, removing key requirement.", ar->item2, mapid, difficulty);
6254  ar->item2 = 0;
6255  }
6256  }
6257 
6258  if (ar->quest_A)
6259  {
6260  if (!GetQuestTemplate(ar->quest_A))
6261  {
6262  TC_LOG_ERROR("sql.sql", "Required Alliance Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar->quest_A, mapid, difficulty);
6263  ar->quest_A = 0;
6264  }
6265  }
6266 
6267  if (ar->quest_H)
6268  {
6269  if (!GetQuestTemplate(ar->quest_H))
6270  {
6271  TC_LOG_ERROR("sql.sql", "Required Horde Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar->quest_H, mapid, difficulty);
6272  ar->quest_H = 0;
6273  }
6274  }
6275 
6276  if (ar->achievement)
6277  {
6278  if (!sAchievementMgr->GetAchievement(ar->achievement))
6279  {
6280  TC_LOG_ERROR("sql.sql", "Required Achievement %u not exist for map %u difficulty %u, remove quest done requirement.", ar->achievement, mapid, difficulty);
6281  ar->achievement = 0;
6282  }
6283  }
6284 
6285  _accessRequirementStore[requirement_ID] = ar;
6286  ++count;
6287 
6288  } while (result->NextRow());
6289 
6290  TC_LOG_INFO("server.loading", ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
6291 }
Difficulty
Definition: DBCEnums.h:402
MapDifficultyEntry const * GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
Definition: DBCStores.cpp:724
Quest const * GetQuestTemplate(uint32 quest_id) const
Definition: ObjectMgr.h:815
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint64 MAKE_PAIR64(uint32 l, uint32 h)
Definition: ObjectDefines.h:34
uint8 GetUInt8() const
Definition: Field.h:70
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
AccessRequirementContainer _accessRequirementStore
Definition: ObjectMgr.h:1440
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
Definition: ItemTemplate.h:647
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
DBCStorage< MapEntry > sMapStore(Mapfmt)
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
ItemTemplate const * GetItemTemplate(uint32 entry)
Definition: ObjectMgr.cpp:2782
std::string GetString() const
Definition: Field.h:276
#define sAchievementMgr
Definition: AchievementMgr.h:501

+ Here is the call graph for this function:

void ObjectMgr::LoadAreaPhases ( )
9074 {
9075  _phases.clear();
9076 
9077  uint32 oldMSTime = getMSTime();
9078 
9079  // 0 1
9080  QueryResult result = WorldDatabase.Query("SELECT AreaId, PhaseId FROM `phase_area`");
9081 
9082  if (!result)
9083  {
9084  TC_LOG_INFO("server.loading", ">> Loaded 0 phase areas. DB table `phase_area` is empty.");
9085  return;
9086  }
9087 
9088  uint32 count = 0;
9089  do
9090  {
9091  Field* fields = result->Fetch();
9092 
9093  PhaseInfoStruct phase;
9094  uint32 area = fields[0].GetUInt32();
9095  phase.Id = fields[1].GetUInt32();
9096  _phases[area].push_back(phase);
9097 
9098  ++count;
9099  } while (result->NextRow());
9100 
9101  TC_LOG_INFO("server.loading", ">> Loaded %u phase areas in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
9102 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
Definition: ObjectMgr.h:690
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32 Id
Definition: ObjectMgr.h:692
PhaseInfo _phases
Definition: ObjectMgr.h:1483
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201

+ Here is the call graph for this function:

void ObjectMgr::LoadAreaTriggerScripts ( )
5708 {
5709  uint32 oldMSTime = getMSTime();
5710 
5711  _areaTriggerScriptStore.clear(); // need for reload case
5712 
5713  QueryResult result = WorldDatabase.Query("SELECT entry, ScriptName FROM areatrigger_scripts");
5714  if (!result)
5715  {
5716  TC_LOG_INFO("server.loading", ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty.");
5717  return;
5718  }
5719 
5720  do
5721  {
5722  Field* fields = result->Fetch();
5723 
5724  uint32 triggerId = fields[0].GetUInt32();
5725  std::string const scriptName = fields[1].GetString();
5726 
5727  AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(triggerId);
5728  if (!atEntry)
5729  {
5730  TC_LOG_ERROR("sql.sql", "AreaTrigger (ID: %u) does not exist in `AreaTrigger.dbc`.", triggerId);
5731  continue;
5732  }
5733  _areaTriggerScriptStore[triggerId] = GetScriptId(scriptName);
5734  }
5735  while (result->NextRow());
5736 
5737  TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " areatrigger scripts in %u ms", _areaTriggerScriptStore.size(), GetMSTimeDiffToNow(oldMSTime));
5738 }
#define SZFMTD
Definition: Define.h:143
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerfmt)
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
AreaTriggerScriptContainer _areaTriggerScriptStore
Definition: ObjectMgr.h:1439
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetScriptId(std::string const &name)
Definition: ObjectMgr.cpp:8627
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
Definition: DBCStructure.h:74
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

void ObjectMgr::LoadAreaTriggerTeleports ( )
6132 {
6133  uint32 oldMSTime = getMSTime();
6134 
6135  _areaTriggerStore.clear(); // needed for reload case
6136 
6137  // 0 1
6138  QueryResult result = WorldDatabase.Query("SELECT ID, PortLocID FROM areatrigger_teleport");
6139  if (!result)
6140  {
6141  TC_LOG_INFO("server.loading", ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty.");
6142  return;
6143  }
6144 
6145  uint32 count = 0;
6146 
6147  do
6148  {
6149  Field* fields = result->Fetch();
6150 
6151  ++count;
6152 
6153  uint32 Trigger_ID = fields[0].GetUInt32();
6154  uint32 PortLocID = fields[1].GetUInt32();
6155 
6156  WorldSafeLocsEntry const* portLoc = sWorldSafeLocsStore.LookupEntry(PortLocID);
6157  if (!portLoc)
6158  {
6159  TC_LOG_ERROR("sql.sql", "Area Trigger (ID: %u) has a non-existing Port Loc (ID: %u) in WorldSafeLocs.dbc, skipped", Trigger_ID, PortLocID);
6160  continue;
6161  }
6162 
6163  AreaTriggerStruct at;
6164 
6165  at.target_mapId = portLoc->MapID;
6166  at.target_X = portLoc->Loc.X;
6167  at.target_Y = portLoc->Loc.Y;
6168  at.target_Z = portLoc->Loc.Z;
6169  at.target_Orientation = (portLoc->Facing * M_PI) / 180; // Orientation is initially in degrees
6170 
6171  AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
6172  if (!atEntry)
6173  {
6174  TC_LOG_ERROR("sql.sql", "Area Trigger (ID: %u) does not exist in AreaTrigger.dbc.", Trigger_ID);
6175  continue;
6176  }
6177 
6178  _areaTriggerStore[Trigger_ID] = at;
6179 
6180  } while (result->NextRow());
6181 
6182  TC_LOG_INFO("server.loading", ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
6183 }
Definition: ObjectMgr.h:400
float Z
Definition: DBCEnums.h:36
float Y
Definition: DBCEnums.h:35
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsfmt)
#define M_PI
Definition: Common.h:163
float Facing
Definition: DBCStructure.h:1439
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerfmt)
Class used to access individual fields of database query result.
Definition: Field.h:56
float target_Orientation
Definition: ObjectMgr.h:406
uint32 getMSTime()
Definition: Timer.h:24
Definition: DBCStructure.h:1434
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
float target_Y
Definition: ObjectMgr.h:404
uint32 MapID
Definition: DBCStructure.h:1437
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
float X
Definition: DBCEnums.h:34
DBCPosition3D Loc
Definition: DBCStructure.h:1438
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
float target_Z
Definition: ObjectMgr.h:405
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
Definition: DBCStructure.h:74
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
AreaTriggerContainer _areaTriggerStore
Definition: ObjectMgr.h:1438
float target_X
Definition: ObjectMgr.h:403
uint32 target_mapId
Definition: ObjectMgr.h:402

+ Here is the call graph for this function:

void ObjectMgr::LoadCharacterTemplates ( )
9233 {
9234  uint32 oldMSTime = getMSTime();
9235  _characterTemplateStore.clear();
9236 
9238  PreparedQueryResult templates = CharacterDatabase.Query(stmt);
9239 
9240  if (!templates)
9241  {
9242  TC_LOG_INFO("server.loading", ">> Loaded 0 character templates. DB table `character_template` is empty.");
9243  return;
9244  }
9245 
9246  PreparedQueryResult classes;
9247  uint32 count = 0;
9248 
9249  do
9250  {
9251  Field* fields = templates->Fetch();
9252 
9253  uint32 templateSetId = fields[0].GetUInt32();
9254 
9256  stmt->setUInt32(0, templateSetId);
9257  classes = CharacterDatabase.Query(stmt);
9258 
9259  if (classes)
9260  {
9261  CharacterTemplate templ;
9262  templ.TemplateSetId = templateSetId;
9263  templ.Name = fields[1].GetString();
9264  templ.Description = fields[2].GetString();
9265  templ.Level = fields[3].GetUInt8();
9266 
9267  do
9268  {
9269  fields = classes->Fetch();
9270 
9271  uint8 factionGroup = fields[0].GetUInt8();
9272  uint8 classID = fields[1].GetUInt8();
9273 
9276  {
9277  TC_LOG_ERROR("sql.sql", "Faction group %u defined for character template %u in `character_template_class` is invalid. Skipped.", factionGroup, templateSetId);
9278  continue;
9279  }
9280 
9281  ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(classID);
9282  if (!classEntry)
9283  {
9284  TC_LOG_ERROR("sql.sql", "Class %u defined for character template %u in `character_template_class` does not exists, skipped.", classID, templateSetId);
9285  continue;
9286  }
9287 
9288  templ.Classes.emplace_back(factionGroup, classID);
9289 
9290  } while (classes->NextRow());
9291 
9292  if (!templ.Classes.empty())
9293  {
9294  _characterTemplateStore[templateSetId] = templ;
9295  ++count;
9296  }
9297  }
9298  else
9299  {
9300  TC_LOG_ERROR("sql.sql", "Character template %u does not have any classes defined in `character_template_class`. Skipped.", templateSetId);
9301  continue;
9302  }
9303  } while (templates->NextRow());
9304  TC_LOG_INFO("server.loading", ">> Loaded %u character templates in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
9305 }
CharacterTemplateContainer _characterTemplateStore
Definition: ObjectMgr.h:1553
Definition: DBCEnums.h:470
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
DBCStorage< ChrClassesEntry > sChrClassesStore(ChrClassesfmt)
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
std::string Description
Definition: ObjectMgr.h:619
Definition: PreparedStatement.h:74
uint8 GetUInt8() const
Definition: Field.h:70
Definition: DBCStructure.h:181
Definition: DBCEnums.h:469
uint32_t uint32
Definition: Define.h:150
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
std::vector< CharcterTemplateClass > Classes
Definition: ObjectMgr.h:617
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
std::string Name
Definition: ObjectMgr.h:618
Definition: CharacterDatabase.h:62
Definition: ObjectMgr.h:614
uint32 TemplateSetId
Definition: ObjectMgr.h:616
uint8 Level
Definition: ObjectMgr.h:620
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: CharacterDatabase.h:61
std::string GetString() const
Definition: Field.h:276
Definition: DBCEnums.h:471

+ Here is the call graph for this function:

void ObjectMgr::LoadCreatureAddons ( )
988 {
989  uint32 oldMSTime = getMSTime();
990 
991  // 0 1 2 3 4 5 6
992  QueryResult result = WorldDatabase.Query("SELECT guid, path_id, mount, bytes1, bytes2, emote, auras FROM creature_addon");
993 
994  if (!result)
995  {
996  TC_LOG_INFO("server.loading", ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty.");
997  return;
998  }
999 
1000  uint32 count = 0;
1001  do
1002  {
1003  Field* fields = result->Fetch();
1004 
1005  ObjectGuid::LowType guid = fields[0].GetUInt64();
1006 
1007  CreatureData const* creData = GetCreatureData(guid);
1008  if (!creData)
1009  {
1010  TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") does not exist but has a record in `creature_addon`", guid);
1011  continue;
1012  }
1013 
1014  CreatureAddon& creatureAddon = _creatureAddonStore[guid];
1015 
1016  creatureAddon.path_id = fields[1].GetUInt32();
1017  if (creData->movementType == WAYPOINT_MOTION_TYPE && !creatureAddon.path_id)
1018  {
1019  const_cast<CreatureData*>(creData)->movementType = IDLE_MOTION_TYPE;
1020  TC_LOG_ERROR("sql.sql", "Creature (GUID " UI64FMTD ") has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid);
1021  }
1022 
1023  creatureAddon.mount = fields[2].GetUInt32();
1024  creatureAddon.bytes1 = fields[3].GetUInt32();
1025  creatureAddon.bytes2 = fields[4].GetUInt32();
1026  creatureAddon.emote = fields[5].GetUInt32();
1027 
1028  Tokenizer tokens(fields[6].GetString(), ' ');
1029  uint8 i = 0;
1030  creatureAddon.auras.resize(tokens.size());
1031  for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
1032  {
1033  uint32 spellId = uint32(atoul(*itr));
1034  SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(spellId);
1035  if (!AdditionalSpellInfo)
1036  {
1037  TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") has wrong spell %u defined in `auras` field in `creature_addon`.", guid, spellId);
1038  continue;
1039  }
1040 
1041  if (AdditionalSpellInfo->HasAura(DIFFICULTY_NONE, SPELL_AURA_CONTROL_VEHICLE))
1042  TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") has SPELL_AURA_CONTROL_VEHICLE aura %u defined in `auras` field in `creature_addon`.", guid, spellId);
1043 
1044  if (std::find(creatureAddon.auras.begin(), creatureAddon.auras.end(), spellId) != creatureAddon.auras.end())
1045  {
1046  TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") has duplicate aura (spell %u) in `auras` field in `creature_addon`.", guid, spellId);
1047  continue;
1048  }
1049 
1050  creatureAddon.auras[i++] = spellId;
1051  }
1052 
1053  if (creatureAddon.mount)
1054  {
1055  if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount))
1056  {
1057  TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") has invalid displayInfoId (%u) for mount defined in `creature_addon`", guid, creatureAddon.mount);
1058  creatureAddon.mount = 0;
1059  }
1060  }
1061 
1062  if (!sEmotesStore.LookupEntry(creatureAddon.emote))
1063  {
1064  TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote);
1065  creatureAddon.emote = 0;
1066  }
1067 
1068  ++count;
1069  }
1070  while (result->NextRow());
1071 
1072  TC_LOG_INFO("server.loading", ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1073 }
Definition: Creature.h:287
uint32 mount
Definition: Creature.h:356
Definition: DBCEnums.h:404
Definition: MotionMaster.h:37
uint64 GetUInt64() const
Definition: Field.h:184
uint8 movementType
Definition: Creature.h:307
Definition: SpellInfo.h:326
Definition: Util.h:45
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
uint32 path_id
Definition: Creature.h:355
CreatureData const * GetCreatureData(ObjectGuid::LowType guid) const
Definition: ObjectMgr.h:1152
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32 bytes2
Definition: Creature.h:358
uint64 LowType
Definition: ObjectGuid.h:199
DBCStorage< EmotesEntry > sEmotesStore(Emotesfmt)
bool HasAura(uint32 difficulty, AuraType aura) const
Definition: SpellInfo.cpp:1193
uint32 bytes1
Definition: Creature.h:357
StorageType::const_iterator const_iterator
Definition: Util.h:52
Definition: SpellAuraDefines.h:296
unsigned long atoul(char const *str)
Definition: Common.h:90
#define UI64FMTD
Definition: Define.h:137
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
DB2Storage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore("CreatureDisplayInfo.db2", CreatureDisplayInfoFormat, HOTFIX_SEL_CREATURE_DISPLAY_INFO)
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
CreatureAddonContainer _creatureAddonStore
Definition: ObjectMgr.h:1520
Definition: Creature.h:353
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
std::vector< uint32 > auras
Definition: Creature.h:360
uint32 GetUInt32() const
Definition: Field.h:146
uint32 emote
Definition: Creature.h:359
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
Definition: MotionMaster.h:39

+ Here is the call graph for this function:

void ObjectMgr::LoadCreatureClassLevelStats ( )
8668 {
8669  uint32 oldMSTime = getMSTime();
8670  // 0 1 2 3 4 5 6 7 8 9 10 11
8671  QueryResult result = WorldDatabase.Query("SELECT level, class, basemana, basearmor, attackpower, rangedattackpower, damage_base, damage_exp1, damage_exp2, damage_exp3, damage_exp4, damage_exp5 FROM creature_classlevelstats");
8672 
8673  if (!result)
8674  {
8675  TC_LOG_INFO("server.loading", ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty.");
8676  return;
8677  }
8678 
8679  uint32 count = 0;
8680  do
8681  {
8682  Field* fields = result->Fetch();
8683 
8684  uint8 Level = fields[0].GetUInt8();
8685  uint8 Class = fields[1].GetUInt8();
8686 
8687  if (!Class || ((1 << (Class - 1)) & CLASSMASK_ALL_CREATURES) == 0)
8688  TC_LOG_ERROR("sql.sql", "Creature base stats for level %u has invalid class %u", Level, Class);
8689 
8690  GtNpcTotalHpEntry const* HpExp0 = sGtNpcTotalHpStore.EvaluateTable(Level - 1, Class - 1);
8691  GtNpcTotalHpExp1Entry const* HpExp1 = sGtNpcTotalHpExp1Store.EvaluateTable(Level - 1, Class - 1);
8692  GtNpcTotalHpExp2Entry const* HpExp2 = sGtNpcTotalHpExp2Store.EvaluateTable(Level - 1, Class - 1);
8693  GtNpcTotalHpExp3Entry const* HpExp3 = sGtNpcTotalHpExp3Store.EvaluateTable(Level - 1, Class - 1);
8694  GtNpcTotalHpExp4Entry const* HpExp4 = sGtNpcTotalHpExp4Store.EvaluateTable(Level - 1, Class - 1);
8695  GtNpcTotalHpExp5Entry const* HpExp5 = sGtNpcTotalHpExp5Store.EvaluateTable(Level - 1, Class - 1);
8696 
8697  CreatureBaseStats stats;
8698 
8699  stats.BaseHealth[0] = uint32(HpExp0->HP);
8700  stats.BaseHealth[1] = uint32(HpExp1->HP);
8701  stats.BaseHealth[2] = uint32(HpExp2->HP);
8702  stats.BaseHealth[3] = uint32(HpExp3->HP);
8703  stats.BaseHealth[4] = uint32(HpExp4->HP);
8704  stats.BaseHealth[5] = uint32(HpExp5->HP);
8705 
8706  for (uint8 i = 0; i < MAX_EXPANSIONS; ++i)
8707  {
8708  stats.BaseDamage[i] = fields[6 + i].GetFloat();
8709  if (stats.BaseDamage[i] < 0.0f)
8710  {
8711  TC_LOG_ERROR("sql.sql", "Creature base stats for class %u, level %u has invalid negative base damage[%u] - set to 0.0", Class, Level, i);
8712  stats.BaseDamage[i] = 0.0f;
8713  }
8714  }
8715 
8716  stats.BaseMana = fields[2].GetUInt32();
8717  stats.BaseArmor = fields[3].GetUInt32();
8718 
8719  stats.AttackPower = fields[4].GetUInt16();
8720  stats.RangedAttackPower = fields[5].GetUInt16();
8721 
8722  _creatureBaseStatsStore[MAKE_PAIR16(Level, Class)] = stats;
8723 
8724  ++count;
8725  }
8726  while (result->NextRow());
8727 
8728  CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
8729  for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
8730  {
8731  for (uint16 lvl = itr->second.minlevel; lvl <= itr->second.maxlevel; ++lvl)
8732  {
8733  if (_creatureBaseStatsStore.find(MAKE_PAIR16(lvl, itr->second.unit_class)) == _creatureBaseStatsStore.end())
8734  TC_LOG_ERROR("sql.sql", "Missing base stats for creature class %u level %u", itr->second.unit_class, lvl);
8735  }
8736  }
8737 
8738  TC_LOG_INFO("server.loading", ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
8739 }
float HP
Definition: DBCStructure.h:584
uint16 MAKE_PAIR16(uint8 l, uint8 h)
Definition: ObjectDefines.h:49
float HP
Definition: DBCStructure.h:564
GameTable< GtNpcTotalHpEntry > sGtNpcTotalHpStore(GtNpcTotalHpfmt)
CreatureBaseStatsContainer _creatureBaseStatsStore
Definition: ObjectMgr.h:1492
float GetFloat() const
Definition: Field.h:222
Definition: DBCStructure.h:582
GameTable< GtNpcTotalHpExp3Entry > sGtNpcTotalHpExp3Store(GtNpcTotalHpExp3fmt)
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
GameTable< GtNpcTotalHpExp1Entry > sGtNpcTotalHpExp1Store(GtNpcTotalHpExp1fmt)
Definition: DBCStructure.h:557
Definition: DBCStructure.h:567
uint32 BaseMana
Definition: Creature.h:221
GameTable< GtNpcTotalHpExp4Entry > sGtNpcTotalHpExp4Store(GtNpcTotalHpExp4fmt)
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint8 GetUInt8() const
Definition: Field.h:70
uint32 AttackPower
Definition: Creature.h:223
uint32 BaseHealth[MAX_EXPANSIONS]
Definition: Creature.h:220
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint16_t uint16
Definition: Define.h:151
Definition: DBCStructure.h:577
uint16 GetUInt16() const
Definition: Field.h:108
GameTable< GtNpcTotalHpExp5Entry > sGtNpcTotalHpExp5Store(GtNpcTotalHpExp5fmt)
float BaseDamage[MAX_EXPANSIONS]
Definition: Creature.h:225
float HP
Definition: DBCStructure.h:559
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
Definition: DBCStructure.h:562
uint32 RangedAttackPower
Definition: Creature.h:224
uint32 BaseArmor
Definition: Creature.h:222
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
Definition: SharedDefines.h:85
uint32 GetUInt32() const
Definition: Field.h:146
#define CLASSMASK_ALL_CREATURES
Definition: SharedDefines.h:205
uint8_t uint8
Definition: Define.h:152
Definition: DBCStructure.h:572
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
float HP
Definition: DBCStructure.h:574
std::unordered_map< uint32, CreatureTemplate > CreatureTemplateContainer
Definition: Creature.h:213
float HP
Definition: DBCStructure.h:569
GameTable< GtNpcTotalHpExp2Entry > sGtNpcTotalHpExp2Store(GtNpcTotalHpExp2fmt)
Definition: Creature.h:218
float HP
Definition: DBCStructure.h:579

+ Here is the call graph for this function:

void ObjectMgr::LoadCreatureLocales ( )
307 {
308  uint32 oldMSTime = getMSTime();
309 
310  _creatureLocaleStore.clear(); // need for reload case
311 
312  // 0 1 2 3 4 5
313  QueryResult result = WorldDatabase.Query("SELECT entry, locale, Name, NameAlt, Title, TitleAlt FROM creature_template_locale");
314  if (!result)
315  return;
316 
317  do
318  {
319  Field* fields = result->Fetch();
320 
321  uint32 id = fields[0].GetUInt32();
322  std::string localeName = fields[1].GetString();
323 
324  std::string name = fields[2].GetString();
325  std::string nameAlt = fields[3].GetString();
326  std::string title = fields[4].GetString();
327  std::string titleAlt = fields[5].GetString();
328 
330  LocaleConstant locale = GetLocaleByName(localeName);
331  if (locale == LOCALE_enUS)
332  continue;
333 
334  AddLocaleString(name, locale, data.Name);
335  AddLocaleString(nameAlt, locale, data.NameAlt);
336  AddLocaleString(title, locale, data.Title);
337  AddLocaleString(titleAlt, locale, data.TitleAlt);
338 
339  } while (result->NextRow());
340 
341  TC_LOG_INFO("server.loading", ">> Loaded %u creature locale strings in %u ms", uint32(_creatureLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
342 }
Definition: Creature.h:258
StringVector Title
Definition: Creature.h:262
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
StringVector TitleAlt
Definition: Creature.h:263
CreatureLocaleContainer _creatureLocaleStore
Definition: ObjectMgr.h:1527
LocaleConstant
Definition: Common.h:115
LocaleConstant GetLocaleByName(const std::string &name)
Definition: Common.cpp:37
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
static void AddLocaleString(std::string const &value, LocaleConstant localeConstant, StringVector &data)
Definition: ObjectMgr.cpp:295
StringVector Name
Definition: Creature.h:260
Definition: Common.h:117
StringVector NameAlt
Definition: Creature.h:261
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
uint32_t uint32
Definition: g3dmath.h:168
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

void ObjectMgr::LoadCreatureModelInfo ( )
1321 {
1322  uint32 oldMSTime = getMSTime();
1323 
1324  QueryResult result = WorldDatabase.Query("SELECT DisplayID, BoundingRadius, CombatReach, DisplayID_Other_Gender FROM creature_model_info");
1325 
1326  if (!result)
1327  {
1328  TC_LOG_INFO("server.loading", ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty.");
1329  return;
1330  }
1331 
1332  _creatureModelStore.rehash(result->GetRowCount());
1333  uint32 count = 0;
1334 
1335  // List of model FileDataIDs that the client treats as invisible stalker
1336  uint32 trigggerCreatureModelFileID[5] = { 124640, 124641, 124642, 343863, 439302 };
1337 
1338  do
1339  {
1340  Field* fields = result->Fetch();
1341 
1342  uint32 displayId = fields[0].GetUInt32();
1343 
1344  CreatureDisplayInfoEntry const* creatureDisplay = sCreatureDisplayInfoStore.LookupEntry(displayId);
1345  if (!creatureDisplay)
1346  {
1347  TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has a non-existent DisplayID (ID: %u). Skipped.", displayId);
1348  continue;
1349  }
1350 
1351  CreatureModelInfo& modelInfo = _creatureModelStore[displayId];
1352 
1353  modelInfo.bounding_radius = fields[1].GetFloat();
1354  modelInfo.combat_reach = fields[2].GetFloat();
1355  modelInfo.displayId_other_gender = fields[3].GetUInt32();
1356  modelInfo.gender = creatureDisplay->Gender;
1357  modelInfo.is_trigger = false;
1358 
1359  // Checks
1360 
1361  // to remove when the purpose of GENDER_UNKNOWN is known
1362  if (modelInfo.gender == GENDER_UNKNOWN)
1363  {
1364  // We don't need more errors
1365  //TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has an unimplemented Gender (ID: %i) being used by DisplayID (ID: %u). Gender set to GENDER_MALE.", modelInfo.gender, modelId);
1366  modelInfo.gender = GENDER_MALE;
1367  }
1368 
1369  if (modelInfo.displayId_other_gender && !sCreatureDisplayInfoStore.LookupEntry(modelInfo.displayId_other_gender))
1370  {
1371  TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has a non-existent DisplayID_Other_Gender (ID: %u) being used by DisplayID (ID: %u).", modelInfo.displayId_other_gender, displayId);
1372  modelInfo.displayId_other_gender = 0;
1373  }
1374 
1375  if (modelInfo.combat_reach < 0.1f)
1376  modelInfo.combat_reach = DEFAULT_COMBAT_REACH;
1377 
1378  if (CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(creatureDisplay->ModelID))
1379  {
1380  for (uint32 i = 0; i < 5; ++i)
1381  {
1382  if (modelData->FileDataID == trigggerCreatureModelFileID[i])
1383  {
1384  modelInfo.is_trigger = true;
1385  break;
1386  }
1387  }
1388  }
1389 
1390  ++count;
1391  }
1392  while (result->NextRow());
1393 
1394  TC_LOG_INFO("server.loading", ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1395 }
float GetFloat() const
Definition: Field.h:222
Definition: DBCStructure.h:294
Class used to access individual fields of database query result.
Definition: Field.h:56
bool is_trigger
Definition: Creature.h:323
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: SharedDefines.h:93
DBCStorage< CreatureModelDataEntry > sCreatureModelDataStore(CreatureModelDatafmt)
Definition: Creature.h:317
CreatureModelContainer _creatureModelStore
Definition: ObjectMgr.h:1519
Definition: SharedDefines.h:92
uint32_t uint32
Definition: Define.h:150
DB2Storage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore("CreatureDisplayInfo.db2", CreatureDisplayInfoFormat, HOTFIX_SEL_CREATURE_DISPLAY_INFO)
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
float combat_reach
Definition: Creature.h:320
int32 Gender
Definition: DB2Structure.h:173
uint32 displayId_other_gender
Definition: Creature.h:322
uint32 ModelID
Definition: DB2Structure.h:156
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
float bounding_radius
Definition: Creature.h:319
Definition: DB2Structure.h:153
#define DEFAULT_COMBAT_REACH
Definition: Object.h:45
int8 gender
Definition: Creature.h:321

+ Here is the call graph for this function:

void ObjectMgr::LoadCreatureQuestEnders ( )
7444 {
7446 
7447  for (QuestRelations::iterator itr = _creatureQuestInvolvedRelations.begin(); itr != _creatureQuestInvolvedRelations.end(); ++itr)
7448  {
7449  CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first);
7450  if (!cInfo)
7451  TC_LOG_ERROR("sql.sql", "Table `creature_questender` has data for nonexistent creature entry (%u) and existed quest %u", itr->first, itr->second);
7452  else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
7453  TC_LOG_ERROR("sql.sql", "Table `creature_questender` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
7454  }
7455 }
void LoadQuestRelationsHelper(QuestRelations &map, QuestRelationsReverse *reverseMap, std::string const &table, bool starter, bool go)
Definition: ObjectMgr.cpp:7354
uint64 npcflag
Definition: Creature.h:98
Definition: Unit.h:736
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
QuestRelations _creatureQuestInvolvedRelations
Definition: ObjectMgr.h:1457
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: Creature.h:79
QuestRelationsReverse _creatureQuestInvolvedRelationsReverse
Definition: ObjectMgr.h:1458

+ Here is the call graph for this function:

void ObjectMgr::LoadCreatureQuestItems ( )
9396 {
9397  uint32 oldMSTime = getMSTime();
9398 
9399  // 0 1 2
9400  QueryResult result = WorldDatabase.Query("SELECT CreatureEntry, ItemId, Idx FROM creature_questitem ORDER BY Idx ASC");
9401 
9402  if (!result)
9403  {
9404  TC_LOG_INFO("server.loading", ">> Loaded 0 creature quest items. DB table `creature_questitem` is empty.");
9405  return;
9406  }
9407 
9408  uint32 count = 0;
9409  do
9410  {
9411  Field* fields = result->Fetch();
9412 
9413  uint32 entry = fields[0].GetUInt32();
9414  uint32 item = fields[1].GetUInt32();
9415  uint32 idx = fields[2].GetUInt32();
9416 
9417  CreatureTemplate const* creatureInfo = GetCreatureTemplate(entry);
9418  if (!creatureInfo)
9419  {
9420  TC_LOG_ERROR("sql.sql", "Table `creature_questitem` has data for nonexistent creature (entry: %u, idx: %u), skipped", entry, idx);
9421  continue;
9422  };
9423 
9424  ItemEntry const* db2Data = sItemStore.LookupEntry(item);
9425  if (!db2Data)
9426  {
9427  TC_LOG_ERROR("sql.sql", "Table `creature_questitem` has nonexistent item (ID: %u) in creature (entry: %u, idx: %u), skipped", item, entry, idx);
9428  continue;
9429  };
9430 
9431  _creatureQuestItemStore[entry].push_back(item);
9432 
9433  ++count;
9434  }
9435  while (result->NextRow());
9436 
9437  TC_LOG_INFO("server.loading", ">> Loaded %u creature quest items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
9438 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
DB2Storage< ItemEntry > sItemStore("Item.db2", ItemFormat, HOTFIX_SEL_ITEM)
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
CreatureQuestItemMap _creatureQuestItemStore
Definition: ObjectMgr.h:1523
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
Definition: DB2Structure.h:710
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: Creature.h:79

+ Here is the call graph for this function:

void ObjectMgr::LoadCreatureQuestStarters ( )
7430 {
7431  LoadQuestRelationsHelper(_creatureQuestRelations, nullptr, "creature_queststarter", true, false);
7432 
7433  for (QuestRelations::iterator itr = _creatureQuestRelations.begin(); itr != _creatureQuestRelations.end(); ++itr)
7434  {
7435  CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first);
7436  if (!cInfo)
7437  TC_LOG_ERROR("sql.sql", "Table `creature_queststarter` has data for nonexistent creature entry (%u) and existed quest %u", itr->first, itr->second);
7438  else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
7439  TC_LOG_ERROR("sql.sql", "Table `creature_queststarter` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
7440  }
7441 }
void LoadQuestRelationsHelper(QuestRelations &map, QuestRelationsReverse *reverseMap, std::string const &table, bool starter, bool go)
Definition: ObjectMgr.cpp:7354
uint64 npcflag
Definition: Creature.h:98
Definition: Unit.h:736
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
QuestRelations _creatureQuestRelations
Definition: ObjectMgr.h:1456
Definition: Creature.h:79

+ Here is the call graph for this function:

void ObjectMgr::LoadCreatures ( )
1718 {
1719  uint32 oldMSTime = getMSTime();
1720 
1721  // 0 1 2 3 4 5 6 7 8 9 10
1722  QueryResult result = WorldDatabase.Query("SELECT creature.guid, id, map, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, "
1723  // 11 12 13 14 15 16 17 18 19 20 21 22
1724  "currentwaypoint, curhealth, curmana, MovementType, spawnMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.dynamicflags, creature.phaseid, creature.phasegroup "
1725  "FROM creature "
1726  "LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid "
1727  "LEFT OUTER JOIN pool_creature ON creature.guid = pool_creature.guid");
1728 
1729  if (!result)
1730  {
1731  TC_LOG_ERROR("server.loading", ">> Loaded 0 creatures. DB table `creature` is empty.");
1732  return;
1733  }
1734 
1735  // Build single time for check spawnmask
1736  std::map<uint32, uint32> spawnMasks;
1737  for (auto& mapDifficultyPair : sMapDifficultyMap)
1738  for (auto& difficultyPair : mapDifficultyPair.second)
1739  spawnMasks[mapDifficultyPair.first] |= (1 << difficultyPair.first);
1740 
1741 
1742  _creatureDataStore.rehash(result->GetRowCount());
1743 
1744  do
1745  {
1746  Field* fields = result->Fetch();
1747 
1748  ObjectGuid::LowType guid = fields[0].GetUInt64();
1749  uint32 entry = fields[1].GetUInt32();
1750 
1751  CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
1752  if (!cInfo)
1753  {
1754  TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD ") with non existing creature entry %u, skipped.", guid, entry);
1755  continue;
1756  }
1757 
1758  CreatureData& data = _creatureDataStore[guid];
1759  data.id = entry;
1760  data.mapid = fields[2].GetUInt16();
1761  data.displayid = fields[3].GetUInt32();
1762  data.equipmentId = fields[4].GetInt8();
1763  data.posX = fields[5].GetFloat();
1764  data.posY = fields[6].GetFloat();
1765  data.posZ = fields[7].GetFloat();
1766  data.orientation = fields[8].GetFloat();
1767  data.spawntimesecs = fields[9].GetUInt32();
1768  data.spawndist = fields[10].GetFloat();
1769  data.currentwaypoint= fields[11].GetUInt32();
1770  data.curhealth = fields[12].GetUInt32();
1771  data.curmana = fields[13].GetUInt32();
1772  data.movementType = fields[14].GetUInt8();
1773  data.spawnMask = fields[15].GetUInt32();
1774  int16 gameEvent = fields[16].GetInt8();
1775  uint32 PoolId = fields[17].GetUInt32();
1776  data.npcflag = fields[18].GetUInt64();
1777  data.unit_flags = fields[19].GetUInt32();
1778  data.dynamicflags = fields[20].GetUInt32();
1779  data.phaseid = fields[21].GetUInt32();
1780  data.phaseGroup = fields[22].GetUInt32();
1781 
1782  MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
1783  if (!mapEntry)
1784  {
1785  TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD ") that spawned at nonexistent map (Id: %u), skipped.", guid, data.mapid);
1786  continue;
1787  }
1788 
1789  // Skip spawnMask check for transport maps
1790  if (!IsTransportMap(data.mapid) && data.spawnMask & ~spawnMasks[data.mapid])
1791  TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD ") that have wrong spawn mask %u including unsupported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.mapid);
1792 
1793  bool ok = true;
1794  for (uint32 diff = 0; diff < MAX_CREATURE_DIFFICULTIES && ok; ++diff)
1795  {
1796  if (_difficultyEntries[diff].find(data.id) != _difficultyEntries[diff].end())
1797  {
1798  TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD ") that is listed as difficulty %u template (entry: %u) in `creature_template`, skipped.",
1799  guid, diff + 1, data.id);
1800  ok = false;
1801  }
1802  }
1803  if (!ok)
1804  continue;
1805 
1806  // -1 random, 0 no equipment
1807  if (data.equipmentId != 0)
1808  {
1809  if (!GetEquipmentInfo(data.id, data.equipmentId))
1810  {
1811  TC_LOG_ERROR("sql.sql", "Table `creature` has creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", data.id, data.equipmentId);
1812  data.equipmentId = 0;
1813  }
1814  }
1815 
1817  {
1818  if (!mapEntry || !mapEntry->IsDungeon())
1819  TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD " Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature is not in instance.", guid, data.id);
1820  }
1821 
1822  if (data.spawndist < 0.0f)
1823  {
1824  TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD " Entry: %u) with `spawndist`< 0, set to 0.", guid, data.id);
1825  data.spawndist = 0.0f;
1826  }
1827  else if (data.movementType == RANDOM_MOTION_TYPE)
1828  {
1829  if (data.spawndist == 0.0f)
1830  {
1831  TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD " Entry: %u) with `MovementType`=1 (random movement) but with `spawndist`=0, replace by idle movement type (0).", guid, data.id);
1833  }
1834  }
1835  else if (data.movementType == IDLE_MOTION_TYPE)
1836  {
1837  if (data.spawndist != 0.0f)
1838  {
1839  TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD " Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.", guid, data.id);
1840  data.spawndist = 0.0f;
1841  }
1842  }
1843 
1844  if (std::abs(data.orientation) > 2 * float(M_PI))
1845  {
1846  TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD " Entry: %u) with abs(`orientation`) > 2*PI (orientation is expressed in radians), normalized.", guid, data.id);
1848  }
1849 
1850  data.phaseMask = 1;
1851 
1852  if (data.phaseGroup && data.phaseid)
1853  {
1854  TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: " UI64FMTD " Entry: %u) with both `phaseid` and `phasegroup` set, `phasegroup` set to 0", guid, data.id);
1855  data.phaseGroup = 0;
1856  }
1857 
1858  if (data.phaseid)
1859  {
1860  PhaseEntry const* phase = sPhaseStore.LookupEntry(data.phaseid);
1861  if (!phase)
1862  {
1863  TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: " UI64FMTD " Entry: %u) with `phaseid` %u does not exist, set to 0", guid, data.id, data.phaseid);
1864  data.phaseid = 0;
1865  }
1866  }
1867 
1868  if (data.phaseGroup)
1869  {
1870  if (sDB2Manager.GetPhasesForGroup(data.phaseGroup).empty())
1871  {
1872  TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: " UI64FMTD " Entry: %u) with `phasegroup` %u does not exist, set to 0", guid, data.id, data.phaseGroup);
1873  data.phaseGroup = 0;
1874  }
1875  }
1876 
1878  {
1879  uint32 zoneId = 0;
1880  uint32 areaId = 0;
1881  sMapMgr->GetZoneAndAreaId(zoneId, areaId, data.mapid, data.posX, data.posY, data.posZ);
1882 
1884 
1885  stmt->setUInt32(0, zoneId);
1886  stmt->setUInt32(1, areaId);
1887  stmt->setUInt64(2, guid);
1888 
1889  WorldDatabase.Execute(stmt);
1890  }
1891 
1892  // Add to grid if not managed by the game event or pool system
1893  if (gameEvent == 0 && PoolId == 0)
1894  AddCreatureToGrid(guid, &data);
1895  }
1896  while (result->NextRow());
1897 
1898  TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " creatures in %u ms", _creatureDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
1899 }
Definition: Creature.h:287
CreatureDataContainer _creatureDataStore
Definition: ObjectMgr.h:1517
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
#define sDB2Manager
Definition: DB2Stores.h:224
Definition: MotionMaster.h:37
#define MAX_CREATURE_DIFFICULTIES
Definition: Creature.h:76
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: Creature.h:42
uint64 GetUInt64() const
Definition: Field.h:184
uint32 phaseid
Definition: Creature.h:312
uint8 movementType
Definition: Creature.h:307
float GetFloat() const
Definition: Field.h:222
uint32 id
Definition: Creature.h:293
#define M_PI
Definition: Common.h:163
#define SZFMTD
Definition: Define.h:143
uint32 displayid
Definition: Creature.h:296
MapDifficultyMap sMapDifficultyMap
Definition: DBCStores.cpp:115
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 curhealth
Definition: Creature.h:305
uint32 curmana
Definition: Creature.h:306
uint32 getMSTime()
Definition: Timer.h:24
Definition: DBCStructure.h:830
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: MotionMaster.h:38
float spawndist
Definition: Creature.h:303
void AddCreatureToGrid(ObjectGuid::LowType guid, CreatureData const *data)
Definition: ObjectMgr.cpp:1901
bool IsTransportMap(uint32 mapId) const
Definition: ObjectMgr.h:1365
uint32 flags_extra
Definition: Creature.h:142
static float NormalizeOrientation(float o)
Definition: Position.h:211
#define sWorld
Definition: World.h:887
uint64 LowType
Definition: ObjectGuid.h:199
Definition: PreparedStatement.h:74
float posX
Definition: Creature.h:298
uint32 phaseGroup
Definition: Creature.h:313
uint8 GetUInt8() const
Definition: Field.h:70
uint32 spawntimesecs
Definition: Creature.h:302
Definition: WorldDatabase.h:99
float posY
Definition: Creature.h:299
#define UI64FMTD
Definition: Define.h:137
int8 equipmentId
Definition: Creature.h:297
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
EquipmentInfo const * GetEquipmentInfo(uint32 entry, int8 &id)
Definition: ObjectMgr.cpp:1153
bool IsDungeon() const
Definition: DBCStructure.h:857
DBCStorage< PhaseEntry > sPhaseStore(Phasefmt)
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
uint16 GetUInt16() const
Definition: Field.h:108
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
Definition: DBCStructure.h:824
std::set< uint32 > _difficultyEntries[MAX_CREATURE_DIFFICULTIES]
Definition: ObjectMgr.h:1546
uint32 dynamicflags
Definition: Creature.h:311
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
uint32 spawnMask
Definition: Creature.h:308
uint32 unit_flags
Definition: Creature.h:310
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
DBCStorage< MapEntry > sMapStore(Mapfmt)
uint32 currentwaypoint
Definition: Creature.h:304
#define sMapMgr
Definition: MapManager.h:194
uint32 GetUInt32() const
Definition: Field.h:146
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
float orientation
Definition: Creature.h:301
uint16 mapid
Definition: Creature.h:294
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
int16_t int16
Definition: Define.h:147
uint32 phaseMask
Definition: Creature.h:295
int8 GetInt8() const
Definition: Field.h:89
uint64 npcflag
Definition: Creature.h:309
float posZ
Definition: Creature.h:300
Definition: Creature.h:79

+ Here is the call graph for this function:

void ObjectMgr::LoadCreatureTemplate ( Field fields)
456 {
457  uint32 entry = fields[0].GetUInt32();
458 
459  CreatureTemplate& creatureTemplate = _creatureTemplateStore[entry];
460 
461  creatureTemplate.Entry = entry;
462 
463  for (uint8 i = 0; i < MAX_CREATURE_DIFFICULTIES; ++i)
464  creatureTemplate.DifficultyEntry[i] = fields[1 + i].GetUInt32();
465 
466  for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)
467  creatureTemplate.KillCredit[i] = fields[4 + i].GetUInt32();
468 
469  creatureTemplate.Modelid1 = fields[6].GetUInt32();
470  creatureTemplate.Modelid2 = fields[7].GetUInt32();
471  creatureTemplate.Modelid3 = fields[8].GetUInt32();
472  creatureTemplate.Modelid4 = fields[9].GetUInt32();
473  creatureTemplate.Name = fields[10].GetString();
474  creatureTemplate.FemaleName = fields[11].GetString();
475  creatureTemplate.SubName = fields[12].GetString();
476  creatureTemplate.IconName = fields[13].GetString();
477  creatureTemplate.GossipMenuId = fields[14].GetUInt32();
478  creatureTemplate.minlevel = fields[15].GetInt16();
479  creatureTemplate.maxlevel = fields[16].GetInt16();
480  creatureTemplate.expansion = fields[17].GetInt16();
481  creatureTemplate.expansionUnknown = fields[18].GetUInt16();
482  creatureTemplate.faction = fields[19].GetUInt16();
483  creatureTemplate.npcflag = fields[20].GetUInt64();
484  creatureTemplate.speed_walk = fields[21].GetFloat();
485  creatureTemplate.speed_run = fields[22].GetFloat();
486  creatureTemplate.scale = fields[23].GetFloat();
487  creatureTemplate.rank = uint32(fields[24].GetUInt8());
488  creatureTemplate.dmgschool = uint32(fields[25].GetInt8());
489  creatureTemplate.BaseAttackTime = fields[26].GetUInt32();
490  creatureTemplate.RangeAttackTime = fields[27].GetUInt32();
491  creatureTemplate.BaseVariance = fields[28].GetFloat();
492  creatureTemplate.RangeVariance = fields[29].GetFloat();
493  creatureTemplate.unit_class = uint32(fields[30].GetUInt8());
494  creatureTemplate.unit_flags = fields[31].GetUInt32();
495  creatureTemplate.unit_flags2 = fields[32].GetUInt32();
496  creatureTemplate.dynamicflags = fields[33].GetUInt32();
497  creatureTemplate.family = uint32(fields[34].GetUInt8());
498  creatureTemplate.trainer_type = uint32(fields[35].GetUInt8());
499  creatureTemplate.trainer_class = uint32(fields[36].GetUInt8());
500  creatureTemplate.trainer_race = uint32(fields[37].GetUInt8());
501  creatureTemplate.type = uint32(fields[38].GetUInt8());
502  creatureTemplate.type_flags = fields[39].GetUInt32();
503  creatureTemplate.type_flags2 = fields[40].GetUInt32();
504  creatureTemplate.lootid = fields[41].GetUInt32();
505  creatureTemplate.pickpocketLootId = fields[42].GetUInt32();
506  creatureTemplate.SkinLootId = fields[43].GetUInt32();
507 
508  for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
509  creatureTemplate.resistance[i] = fields[44 + i - 1].GetInt16();
510 
511  for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
512  creatureTemplate.spells[i] = fields[50 + i].GetUInt32();
513 
514  creatureTemplate.VehicleId = fields[58].GetUInt32();
515  creatureTemplate.mingold = fields[59].GetUInt32();
516  creatureTemplate.maxgold = fields[60].GetUInt32();
517  creatureTemplate.AIName = fields[61].GetString();
518  creatureTemplate.MovementType = uint32(fields[62].GetUInt8());
519  creatureTemplate.InhabitType = uint32(fields[63].GetUInt8());
520  creatureTemplate.HoverHeight = fields[64].GetFloat();
521  creatureTemplate.ModHealth = fields[65].GetFloat();
522  creatureTemplate.ModHealthExtra = fields[66].GetFloat();
523  creatureTemplate.ModMana = fields[67].GetFloat();
524  creatureTemplate.ModManaExtra = fields[68].GetFloat();
525  creatureTemplate.ModArmor = fields[69].GetFloat();
526  creatureTemplate.ModDamage = fields[70].GetFloat();
527  creatureTemplate.ModExperience = fields[71].GetFloat();
528  creatureTemplate.RacialLeader = fields[72].GetBool();
529 
530  creatureTemplate.movementId = fields[73].GetUInt32();
531  creatureTemplate.RegenHealth = fields[74].GetBool();
532  creatureTemplate.MechanicImmuneMask = fields[75].GetUInt32();
533  creatureTemplate.flags_extra = fields[76].GetUInt32();
534  creatureTemplate.ScriptID = GetScriptId(fields[77].GetString());
535 }
bool RegenHealth
Definition: Creature.h:140
int16 maxlevel
Definition: Creature.h:94
#define MAX_CREATURE_DIFFICULTIES
Definition: Creature.h:76
int32 expansion
Definition: Creature.h:95
float ModManaExtra
Definition: Creature.h:134
uint32 expansionUnknown
Definition: Creature.h:96
uint32 SkinLootId
Definition: Creature.h:121
uint32 spells[CREATURE_MAX_SPELLS]
Definition: Creature.h:123
std::string Name
Definition: Creature.h:88
uint64 GetUInt64() const
Definition: Field.h:184
#define CREATURE_MAX_SPELLS
Definition: Creature.h:75
float scale
Definition: Creature.h:101
uint32 rank
Definition: Creature.h:102
float GetFloat() const
Definition: Field.h:222
uint32 type_flags2
Definition: Creature.h:118
int16 minlevel
Definition: Creature.h:93
float ModExperience
Definition: Creature.h:137
std::string AIName
Definition: Creature.h:127
float HoverHeight
Definition: Creature.h:130
uint32 dynamicflags
Definition: Creature.h:111
uint64 npcflag
Definition: Creature.h:98
float ModHealth
Definition: Creature.h:131
float speed_run
Definition: Creature.h:100
CreatureTemplateContainer _creatureTemplateStore
Definition: ObjectMgr.h:1518
float speed_walk
Definition: Creature.h:99
uint32 InhabitType
Definition: Creature.h:129
uint32 KillCredit[MAX_KILL_CREDIT]
Definition: Creature.h:83
uint32 GossipMenuId
Definition: Creature.h:92
uint32 MechanicImmuneMask
Definition: Creature.h:141
uint32 flags_extra
Definition: Creature.h:142
#define MAX_SPELL_SCHOOL
Definition: SharedDefines.h:283
uint32 faction
Definition: Creature.h:97
Definition: SharedDefines.h:275
uint32 unit_flags2
Definition: Creature.h:110
#define MAX_KILL_CREDIT
Definition: Creature.h:72
uint32 trainer_type
Definition: Creature.h:113
uint32 MovementType
Definition: Creature.h:128
float ModDamage
Definition: Creature.h:136
uint32 mingold
Definition: Creature.h:125
uint32 Entry
Definition: Creature.h:81
std::string IconName
Definition: Creature.h:91
std::string FemaleName
Definition: Creature.h:89
uint32 unit_flags
Definition: Creature.h:109
uint32_t uint32
Definition: Define.h:150
uint32 trainer_class
Definition: Creature.h:114
uint16 GetUInt16() const
Definition: Field.h:108
int32 resistance[MAX_SPELL_SCHOOL]
Definition: Creature.h:122
float ModMana
Definition: Creature.h:133
uint32 GetScriptId(std::string const &name)
Definition: ObjectMgr.cpp:8627
float ModHealthExtra
Definition: Creature.h:132
float RangeVariance
Definition: Creature.h:107
uint32 VehicleId
Definition: Creature.h:124
int16 GetInt16() const
Definition: Field.h:127
uint32 RangeAttackTime
Definition: Creature.h:105
uint32 Modelid1
Definition: Creature.h:84
uint32 Modelid3
Definition: Creature.h:86
uint32 Modelid2
Definition: Creature.h:85
uint32 trainer_race
Definition: Creature.h:115
uint32 GetUInt32() const
Definition: Field.h:146
uint32 BaseAttackTime
Definition: Creature.h:104
uint32 dmgschool
Definition: Creature.h:103
uint8_t uint8
Definition: Define.h:152
uint32 family
Definition: Creature.h:112
float ModArmor
Definition: Creature.h:135
bool RacialLeader
Definition: Creature.h:138
uint32_t uint32
Definition: g3dmath.h:168
bool GetBool() const
Definition: Field.h:65
float BaseVariance
Definition: Creature.h:106
uint32 Modelid4
Definition: Creature.h:87
uint32 lootid
Definition: Creature.h:119
uint32 pickpocketLootId
Definition: Creature.h:120
uint32 maxgold
Definition: Creature.h:126
std::string GetString() const
Definition: Field.h:276
uint32 movementId
Definition: Creature.h:139
uint32 ScriptID
Definition: Creature.h:143
uint32 unit_class
Definition: Creature.h:108
std::string SubName
Definition: Creature.h:90
Definition: Creature.h:79
uint32 DifficultyEntry[MAX_CREATURE_DIFFICULTIES]
Definition: Creature.h:82
uint32 type
Definition: Creature.h:116
uint32 type_flags
Definition: Creature.h:117

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ObjectMgr::LoadCreatureTemplateAddons ( )
538 {
539  uint32 oldMSTime = getMSTime();
540 
541  // 0 1 2 3 4 5 6
542  QueryResult result = WorldDatabase.Query("SELECT entry, path_id, mount, bytes1, bytes2, emote, auras FROM creature_template_addon");
543 
544  if (!result)
545  {
546  TC_LOG_INFO("server.loading", ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty.");
547  return;
548  }
549 
550  uint32 count = 0;
551  do
552  {
553  Field* fields = result->Fetch();
554 
555  uint32 entry = fields[0].GetUInt32();
556 
557  if (!sObjectMgr->GetCreatureTemplate(entry))
558  {
559  TC_LOG_ERROR("sql.sql", "Creature template (Entry: %u) does not exist but has a record in `creature_template_addon`", entry);
560  continue;
561  }
562 
563  CreatureAddon& creatureAddon = _creatureTemplateAddonStore[entry];
564 
565  creatureAddon.path_id = fields[1].GetUInt32();
566  creatureAddon.mount = fields[2].GetUInt32();
567  creatureAddon.bytes1 = fields[3].GetUInt32();
568  creatureAddon.bytes2 = fields[4].GetUInt32();
569  creatureAddon.emote = fields[5].GetUInt32();
570 
571  Tokenizer tokens(fields[6].GetString(), ' ');
572  uint8 i = 0;
573  creatureAddon.auras.resize(tokens.size());
574  for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
575  {
576  uint32 spellId = uint32(atoul(*itr));
577  SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(spellId);
578  if (!AdditionalSpellInfo)
579  {
580  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong spell %u defined in `auras` field in `creature_template_addon`.", entry, spellId);
581  continue;
582  }
583 
584  if (AdditionalSpellInfo->HasAura(DIFFICULTY_NONE, SPELL_AURA_CONTROL_VEHICLE))
585  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has SPELL_AURA_CONTROL_VEHICLE aura %u defined in `auras` field in `creature_template_addon`.", entry, spellId);
586 
587  if (std::find(creatureAddon.auras.begin(), creatureAddon.auras.end(), spellId) != creatureAddon.auras.end())
588  {
589  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has duplicate aura (spell %u) in `auras` field in `creature_template_addon`.", entry, spellId);
590  continue;
591  }
592 
593  creatureAddon.auras[i++] = spellId;
594  }
595 
596  if (creatureAddon.mount)
597  {
598  if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount))
599  {
600  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid displayInfoId (%u) for mount defined in `creature_template_addon`", entry, creatureAddon.mount);
601  creatureAddon.mount = 0;
602  }
603  }
604 
605  if (!sEmotesStore.LookupEntry(creatureAddon.emote))
606  {
607  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid emote (%u) defined in `creature_template_addon`.", entry, creatureAddon.emote);
608  creatureAddon.emote = 0;
609  }
610 
611  ++count;
612  }
613  while (result->NextRow());
614 
615  TC_LOG_INFO("server.loading", ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
616 }
uint32 mount
Definition: Creature.h:356
Definition: DBCEnums.h:404
Definition: SpellInfo.h:326
Definition: Util.h:45
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
uint32 path_id
Definition: Creature.h:355
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32 bytes2
Definition: Creature.h:358
#define sObjectMgr
Definition: ObjectMgr.h:1567
DBCStorage< EmotesEntry > sEmotesStore(Emotesfmt)
bool HasAura(uint32 difficulty, AuraType aura) const
Definition: SpellInfo.cpp:1193
uint32 bytes1
Definition: Creature.h:357
StorageType::const_iterator const_iterator
Definition: Util.h:52
Definition: SpellAuraDefines.h:296
unsigned long atoul(char const *str)
Definition: Common.h:90
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
DB2Storage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore("CreatureDisplayInfo.db2", CreatureDisplayInfoFormat, HOTFIX_SEL_CREATURE_DISPLAY_INFO)
CreatureTemplateAddonContainer _creatureTemplateAddonStore
Definition: ObjectMgr.h:1524
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
Definition: Creature.h:353
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
std::vector< uint32 > auras
Definition: Creature.h:360
uint32 GetUInt32() const
Definition: Field.h:146
uint32 emote
Definition: Creature.h:359
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

void ObjectMgr::LoadCreatureTemplates ( )
412 {
413  uint32 oldMSTime = getMSTime();
414 
415  // 0 1 2 3 4 5 6 7 8
416  QueryResult result = WorldDatabase.Query("SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, "
417  // 9 10 11 12 13 14 15 16 17 18 19 20 21 22
418  "modelid4, name, femaleName, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, exp_unk, faction, npcflag, speed_walk, speed_run, "
419  // 23 24 25 26 27 28 29 30 31 32
420  "scale, rank, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, "
421  // 33 34 35 36 37 38
422  "dynamicflags, family, trainer_type, trainer_class, trainer_race, type, "
423  // 39 40 41 42 43 44 45 46 47 48 49
424  "type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, "
425  // 50 51 52 53 54 55 56 57 58 59 60 61 62
426  "spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, VehicleId, mingold, maxgold, AIName, MovementType, "
427  // 63 64 65 66 67 68 69 70 71
428  "InhabitType, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, ArmorModifier, DamageModifier, ExperienceModifier, "
429  // 72 73 74 75 76 77
430  "RacialLeader, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template");
431 
432  if (!result)
433  {
434  TC_LOG_INFO("server.loading", ">> Loaded 0 creature template definitions. DB table `creature_template` is empty.");
435  return;
436  }
437 
438  _creatureTemplateStore.rehash(result->GetRowCount());
439  uint32 count = 0;
440  do
441  {
442  Field* fields = result->Fetch();
443  LoadCreatureTemplate(fields);
444  ++count;
445  }
446  while (result->NextRow());
447 
448  // Checking needs to be done after loading because of the difficulty self referencing
449  for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr)
450  CheckCreatureTemplate(&itr->second);
451 
452  TC_LOG_INFO("server.loading", ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
453 }
Class used to access individual fields of database query result.
Definition: Field.h:56
CreatureTemplateContainer _creatureTemplateStore
Definition: ObjectMgr.h:1518
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
void LoadCreatureTemplate(Field *fields)
Definition: ObjectMgr.cpp:455
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
void CheckCreatureTemplate(CreatureTemplate const *cInfo)
Definition: ObjectMgr.cpp:618

+ Here is the call graph for this function:

void ObjectMgr::LoadEquipmentTemplates ( )
1180 {
1181  uint32 oldMSTime = getMSTime();
1182 
1183  // 0 1 2 3 4
1184  QueryResult result = WorldDatabase.Query("SELECT CreatureID, ID, ItemID1, ItemID2, ItemID3 FROM creature_equip_template");
1185 
1186  if (!result)
1187  {
1188  TC_LOG_INFO("server.loading", ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!");
1189  return;
1190  }
1191 
1192  uint32 count = 0;
1193  do
1194  {
1195  Field* fields = result->Fetch();
1196 
1197  uint32 entry = fields[0].GetUInt32();
1198 
1199  if (!sObjectMgr->GetCreatureTemplate(entry))
1200  {
1201  TC_LOG_ERROR("sql.sql", "Creature template (CreatureID: %u) does not exist but has a record in `creature_equip_template`", entry);
1202  continue;
1203  }
1204 
1205  uint8 id = fields[1].GetUInt8();
1206  if (!id)
1207  {
1208  TC_LOG_ERROR("sql.sql", "Creature equipment template with id 0 found for creature %u, skipped.", entry);
1209  continue;
1210  }
1211 
1212  EquipmentInfo& equipmentInfo = _equipmentInfoStore[entry][id];
1213 
1214  equipmentInfo.ItemEntry[0] = fields[2].GetUInt32();
1215  equipmentInfo.ItemEntry[1] = fields[3].GetUInt32();
1216  equipmentInfo.ItemEntry[2] = fields[4].GetUInt32();
1217 
1218  for (uint8 i = 0; i < MAX_EQUIPMENT_ITEMS; ++i)
1219  {
1220  if (!equipmentInfo.ItemEntry[i])
1221  continue;
1222 
1223  ItemEntry const* dbcItem = sItemStore.LookupEntry(equipmentInfo.ItemEntry[i]);
1224 
1225  if (!dbcItem)
1226  {
1227  TC_LOG_ERROR("sql.sql", "Unknown item (ID=%u) in creature_equip_template.ItemID%u for CreatureID = %u and ID=%u, forced to 0.",
1228  equipmentInfo.ItemEntry[i], i+1, entry, id);
1229  equipmentInfo.ItemEntry[i] = 0;
1230  continue;
1231  }
1232 
1233  if (dbcItem->InventoryType != INVTYPE_WEAPON &&
1234  dbcItem->InventoryType != INVTYPE_SHIELD &&
1235  dbcItem->InventoryType != INVTYPE_RANGED &&
1236  dbcItem->InventoryType != INVTYPE_2HWEAPON &&
1237  dbcItem->InventoryType != INVTYPE_WEAPONMAINHAND &&
1238  dbcItem->InventoryType != INVTYPE_WEAPONOFFHAND &&
1239  dbcItem->InventoryType != INVTYPE_HOLDABLE &&
1240  dbcItem->InventoryType != INVTYPE_THROWN &&
1241  dbcItem->InventoryType != INVTYPE_RANGEDRIGHT)
1242  {
1243  TC_LOG_ERROR("sql.sql", "Item (ID=%u) in creature_equip_template.ItemID%u for CreatureID = %u and ID = %u is not equipable in a hand, forced to 0.",
1244  equipmentInfo.ItemEntry[i], i+1, entry, id);
1245  equipmentInfo.ItemEntry[i] = 0;
1246  }
1247  }
1248 
1249  ++count;
1250  }
1251  while (result->NextRow());
1252 
1253  TC_LOG_INFO("server.loading", ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1254 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint8 GetUInt8() const
Definition: Field.h:70
Definition: ItemTemplate.h:345
Definition: ItemTemplate.h:346
Definition: ItemTemplate.h:354
Definition: ItemTemplate.h:347
DB2Storage< ItemEntry > sItemStore("Item.db2", ItemFormat, HOTFIX_SEL_ITEM)
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
Definition: ItemTemplate.h:357
Definition: ItemTemplate.h:349
Definition: ItemTemplate.h:353
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
Definition: DB2Structure.h:710
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
EquipmentInfoContainer _equipmentInfoStore
Definition: ObjectMgr.h:1525
Definition: ItemTemplate.h:358
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
uint32 InventoryType
Definition: DB2Structure.h:717
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
#define MAX_EQUIPMENT_ITEMS
Definition: Unit.h:1297
Definition: ItemTemplate.h:355
Definition: Creature.h:277
uint32 ItemEntry[MAX_EQUIPMENT_ITEMS]
Definition: Creature.h:279

+ Here is the call graph for this function:

void ObjectMgr::LoadEventScripts ( )
4926 {
4928 
4929  std::set<uint32> evt_scripts;
4930  // Load all possible script entries from gameobjects
4931  GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates();
4932  for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr)
4933  if (uint32 eventId = itr->second.GetEventScriptId())
4934  evt_scripts.insert(eventId);
4935 
4936  // Load all possible script entries from spells
4937  for (uint32 i = 1; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
4938  if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(i))
4939  for (SpellEffectInfo const* effect : spell->GetEffectsForDifficulty(DIFFICULTY_NONE))
4940  if (effect && effect->Effect == SPELL_EFFECT_SEND_EVENT)
4941  if (effect->MiscValue)
4942  evt_scripts.insert(effect->MiscValue);
4943 
4944  for (size_t path_idx = 0; path_idx < sTaxiPathNodesByPath.size(); ++path_idx)
4945  {
4946  for (size_t node_idx = 0; node_idx < sTaxiPathNodesByPath[path_idx].size(); ++node_idx)
4947  {
4948  TaxiPathNodeEntry const* node = sTaxiPathNodesByPath[path_idx][node_idx];
4949 
4950  if (node->ArrivalEventID)
4951  evt_scripts.insert(node->ArrivalEventID);
4952 
4953  if (node->DepartureEventID)
4954  evt_scripts.insert(node->DepartureEventID);
4955  }
4956  }
4957 
4958  // Then check if all scripts are in above list of possible script entries
4959  for (ScriptMapMap::const_iterator itr = sEventScripts.begin(); itr != sEventScripts.end(); ++itr)
4960  {
4961  std::set<uint32>::const_iterator itr2 = evt_scripts.find(itr->first);
4962  if (itr2 == evt_scripts.end())
4963  TC_LOG_ERROR("sql.sql", "Table `event_scripts` has script (Id: %u) not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u",
4964  itr->first, SPELL_EFFECT_SEND_EVENT);
4965  }
4966 }
Definition: DBCEnums.h:404
Definition: SpellInfo.h:326
TaxiPathNodesByPath sTaxiPathNodesByPath
Definition: DB2Stores.cpp:139
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 ArrivalEventID
Definition: DB2Structure.h:1354
void LoadScripts(ScriptsType type)
Definition: ObjectMgr.cpp:4578
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: SpellInfo.h:238
uint32_t uint32
Definition: Define.h:150
Definition: DB2Structure.h:1345
ScriptMapMap sEventScripts
Definition: ObjectMgr.cpp:52
Definition: SharedDefines.h:1071
std::unordered_map< uint32, GameObjectTemplate > GameObjectTemplateContainer
Definition: GameObject.h:769
uint32 DepartureEventID
Definition: DB2Structure.h:1355
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: ObjectMgr.h:143

+ Here is the call graph for this function:

void ObjectMgr::LoadExplorationBaseXP ( )
6781 {
6782  uint32 oldMSTime = getMSTime();
6783 
6784  QueryResult result = WorldDatabase.Query("SELECT level, basexp FROM exploration_basexp");
6785 
6786  if (!result)
6787  {
6788  TC_LOG_ERROR("server.loading", ">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty.");
6789  return;
6790  }
6791 
6792  uint32 count = 0;
6793 
6794  do
6795  {
6796  Field* fields = result->Fetch();
6797  uint8 level = fields[0].GetUInt8();
6798  uint32 basexp = fields[1].GetInt32();
6799  _baseXPTable[level] = basexp;
6800  ++count;
6801  }
6802  while (result->NextRow());
6803 
6804  TC_LOG_INFO("server.loading", ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
6805 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint8 GetUInt8() const
Definition: Field.h:70
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
BaseXPContainer _baseXPTable
Definition: ObjectMgr.h:1506
int32 GetInt32() const
Definition: Field.h:165
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

void ObjectMgr::LoadFactionChangeAchievements ( )
8742 {
8743  uint32 oldMSTime = getMSTime();
8744 
8745  QueryResult result = WorldDatabase.Query("SELECT alliance_id, horde_id FROM player_factionchange_achievement");
8746 
8747  if (!result)
8748  {
8749  TC_LOG_ERROR("server.loading", ">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty.");
8750  return;
8751  }
8752 
8753  uint32 count = 0;
8754 
8755  do
8756  {
8757  Field* fields = result->Fetch();
8758 
8759  uint32 alliance = fields[0].GetUInt32();
8760  uint32 horde = fields[1].GetUInt32();
8761 
8762  if (!sAchievementMgr->GetAchievement(alliance))
8763  TC_LOG_ERROR("sql.sql", "Achievement %u (alliance_id) referenced in `player_factionchange_achievement` does not exist, pair skipped!", alliance);
8764  else if (!sAchievementMgr->GetAchievement(horde))
8765  TC_LOG_ERROR("sql.sql", "Achievement %u (horde_id) referenced in `player_factionchange_achievement` does not exist, pair skipped!", horde);
8766  else
8767  FactionChangeAchievements[alliance] = horde;
8768 
8769  ++count;
8770  }
8771  while (result->NextRow());
8772 
8773  TC_LOG_INFO("server.loading", ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
8774 }
CharacterConversionMap FactionChangeAchievements
Definition: ObjectMgr.h:1351
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
#define sAchievementMgr
Definition: AchievementMgr.h:501

+ Here is the call graph for this function:

void ObjectMgr::LoadFactionChangeItems ( )
8777 {
8778  uint32 oldMSTime = getMSTime();
8779 
8780  QueryResult result = WorldDatabase.Query("SELECT alliance_id, horde_id FROM player_factionchange_items");
8781 
8782  if (!result)
8783  {
8784  TC_LOG_INFO("server.loading", ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty.");
8785  return;
8786  }
8787 
8788  uint32 count = 0;
8789 
8790  do
8791  {
8792  Field* fields = result->Fetch();
8793 
8794  uint32 alliance = fields[0].GetUInt32();
8795  uint32 horde = fields[1].GetUInt32();
8796 
8797  if (!GetItemTemplate(alliance))
8798  TC_LOG_ERROR("sql.sql", "Item %u (alliance_id) referenced in `player_factionchange_items` does not exist, pair skipped!", alliance);
8799  else if (!GetItemTemplate(horde))
8800  TC_LOG_ERROR("sql.sql", "Item %u (horde_id) referenced in `player_factionchange_items` does not exist, pair skipped!", horde);
8801  else
8802  FactionChangeItems[alliance] = horde;
8803 
8804  ++count;
8805  }
8806  while (result->NextRow());
8807 
8808  TC_LOG_INFO("server.loading", ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
8809 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
CharacterConversionMap FactionChangeItems
Definition: ObjectMgr.h:1352
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
ItemTemplate const * GetItemTemplate(uint32 entry)
Definition: ObjectMgr.cpp:2782

+ Here is the call graph for this function:

void ObjectMgr::LoadFactionChangeQuests ( )
8812 {
8813  uint32 oldMSTime = getMSTime();
8814 
8815  QueryResult result = WorldDatabase.Query("SELECT alliance_id, horde_id FROM player_factionchange_quests");
8816 
8817  if (!result)
8818  {
8819  TC_LOG_ERROR("server.loading", ">> Loaded 0 faction change quest pairs. DB table `player_factionchange_quests` is empty.");
8820  return;
8821  }
8822 
8823  uint32 count = 0;
8824 
8825  do
8826  {
8827  Field* fields = result->Fetch();
8828 
8829  uint32 alliance = fields[0].GetUInt32();
8830  uint32 horde = fields[1].GetUInt32();
8831 
8832  if (!sObjectMgr->GetQuestTemplate(alliance))
8833  TC_LOG_ERROR("sql.sql", "Quest %u (alliance_id) referenced in `player_factionchange_quests` does not exist, pair skipped!", alliance);
8834  else if (!sObjectMgr->GetQuestTemplate(horde))
8835  TC_LOG_ERROR("sql.sql", "Quest %u (horde_id) referenced in `player_factionchange_quests` does not exist, pair skipped!", horde);
8836  else
8837  FactionChangeQuests[alliance] = horde;
8838 
8839  ++count;
8840  }
8841  while (result->NextRow());
8842 
8843  TC_LOG_INFO("server.loading", ">> Loaded %u faction change quest pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
8844 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32_t uint32
Definition: Define.h:150
CharacterConversionMap FactionChangeQuests
Definition: ObjectMgr.h:1353
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

void ObjectMgr::LoadFactionChangeReputations ( )
8847 {
8848  uint32 oldMSTime = getMSTime();
8849 
8850  QueryResult result = WorldDatabase.Query("SELECT alliance_id, horde_id FROM player_factionchange_reputations");
8851 
8852  if (!result)
8853  {
8854  TC_LOG_INFO("server.loading", ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty.");
8855  return;
8856  }
8857 
8858  uint32 count = 0;
8859 
8860  do
8861  {
8862  Field* fields = result->Fetch();
8863 
8864  uint32 alliance = fields[0].GetUInt32();
8865  uint32 horde = fields[1].GetUInt32();
8866 
8867  if (!sFactionStore.LookupEntry(alliance))
8868  TC_LOG_ERROR("sql.sql", "Reputation %u (alliance_id) referenced in `player_factionchange_reputations` does not exist, pair skipped!", alliance);
8869  else if (!sFactionStore.LookupEntry(horde))
8870  TC_LOG_ERROR("sql.sql", "Reputation %u (horde_id) referenced in `player_factionchange_reputations` does not exist, pair skipped!", horde);
8871  else
8872  FactionChangeReputation[alliance] = horde;
8873 
8874  ++count;
8875  }
8876  while (result->NextRow());
8877 
8878  TC_LOG_INFO("server.loading", ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
8879 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
DBCStorage< FactionEntry > sFactionStore(Factionfmt)
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
CharacterConversionMap FactionChangeReputation
Definition: ObjectMgr.h:1354

+ Here is the call graph for this function:

void ObjectMgr::LoadFactionChangeSpells ( )
8882 {
8883  uint32 oldMSTime = getMSTime();
8884 
8885  QueryResult result = WorldDatabase.Query("SELECT alliance_id, horde_id FROM player_factionchange_spells");
8886 
8887  if (!result)
8888  {
8889  TC_LOG_ERROR("server.loading", ">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty.");
8890  return;
8891  }
8892 
8893  uint32 count = 0;
8894 
8895  do
8896  {
8897  Field* fields = result->Fetch();
8898 
8899  uint32 alliance = fields[0].GetUInt32();
8900  uint32 horde = fields[1].GetUInt32();
8901 
8902  if (!sSpellMgr->GetSpellInfo(alliance))
8903  TC_LOG_ERROR("sql.sql", "Spell %u (alliance_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance);
8904  else if (!sSpellMgr->GetSpellInfo(horde))
8905  TC_LOG_ERROR("sql.sql", "Spell %u (horde_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", horde);
8906  else
8907  FactionChangeSpells[alliance] = horde;
8908 
8909  ++count;
8910  }
8911  while (result->NextRow());
8912 
8913  TC_LOG_INFO("server.loading", ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
8914 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
CharacterConversionMap FactionChangeSpells
Definition: ObjectMgr.h:1355

+ Here is the call graph for this function:

void ObjectMgr::LoadFactionChangeTitles ( )
8917 {
8918  uint32 oldMSTime = getMSTime();
8919 
8920  QueryResult result = WorldDatabase.Query("SELECT alliance_id, horde_id FROM player_factionchange_titles");
8921 
8922  if (!result)
8923  {
8924  TC_LOG_INFO("server.loading", ">> Loaded 0 faction change title pairs. DB table `player_factionchange_title` is empty.");
8925  return;
8926  }
8927 
8928  uint32 count = 0;
8929 
8930  do
8931  {
8932  Field* fields = result->Fetch();
8933 
8934  uint32 alliance = fields[0].GetUInt32();
8935  uint32 horde = fields[1].GetUInt32();
8936 
8937  if (!sCharTitlesStore.LookupEntry(alliance))
8938  TC_LOG_ERROR("sql.sql", "Title %u (alliance_id) referenced in `player_factionchange_title` does not exist, pair skipped!", alliance);
8939  else if (!sCharTitlesStore.LookupEntry(horde))
8940  TC_LOG_ERROR("sql.sql", "Title %u (horde_id) referenced in `player_factionchange_title` does not exist, pair skipped!", horde);
8941  else
8942  FactionChangeTitles[alliance] = horde;
8943 
8944  ++count;
8945  }
8946  while (result->NextRow());
8947 
8948  TC_LOG_INFO("server.loading", ">> Loaded %u faction change title pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
8949 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
DBCStorage< CharTitlesEntry > sCharTitlesStore(CharTitlesfmt)
CharacterConversionMap FactionChangeTitles
Definition: ObjectMgr.h:1356
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

void ObjectMgr::LoadFishingBaseSkillLevel ( )
7752 {
7753  uint32 oldMSTime = getMSTime();
7754 
7755  _fishingBaseForAreaStore.clear(); // for reload case
7756 
7757  QueryResult result = WorldDatabase.Query("SELECT entry, skill FROM skill_fishing_base_level");
7758 
7759  if (!result)
7760  {
7761  TC_LOG_ERROR("server.loading", ">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty.");
7762  return;
7763  }
7764 
7765  uint32 count = 0;
7766 
7767  do
7768  {
7769  Field* fields = result->Fetch();
7770  uint32 entry = fields[0].GetUInt32();
7771  int32 skill = fields[1].GetInt16();
7772 
7773  AreaTableEntry const* fArea = sAreaTableStore.LookupEntry(entry);
7774  if (!fArea)
7775  {
7776  TC_LOG_ERROR("sql.sql", "AreaId %u defined in `skill_fishing_base_level` does not exist", entry);
7777  continue;
7778  }
7779 
7780  _fishingBaseForAreaStore[entry] = skill;
7781  ++count;
7782  }
7783  while (result->NextRow());
7784 
7785  TC_LOG_INFO("server.loading", ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
7786 }
Definition: DBCStructure.h:37
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTablefmt)
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
int16 GetInt16() const
Definition: Field.h:127
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
FishingBaseSkillContainer _fishingBaseForAreaStore
Definition: ObjectMgr.h:1509
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

void ObjectMgr::LoadGameObjectAddons ( )
1076 {
1077  uint32 oldMSTime = getMSTime();
1078 
1079  // 0 1 2
1080  QueryResult result = WorldDatabase.Query("SELECT guid, invisibilityType, invisibilityValue FROM gameobject_addon");
1081 
1082  if (!result)
1083  {
1084  TC_LOG_INFO("server.loading", ">> Loaded 0 gameobject addon definitions. DB table `gameobject_addon` is empty.");
1085  return;
1086  }
1087 
1088  uint32 count = 0;
1089  do
1090  {
1091  Field* fields = result->Fetch();
1092 
1093  ObjectGuid::LowType guid = fields[0].GetUInt64();
1094 
1095  const GameObjectData* goData = GetGOData(guid);
1096  if (!goData)
1097  {
1098  TC_LOG_ERROR("sql.sql", "GameObject (GUID: " UI64FMTD ") does not exist but has a record in `gameobject_addon`", guid);
1099  continue;
1100  }
1101 
1102  GameObjectAddon& gameObjectAddon = _gameObjectAddonStore[guid];
1103  gameObjectAddon.invisibilityType = InvisibilityType(fields[1].GetUInt8());
1104  gameObjectAddon.InvisibilityValue = fields[2].GetUInt32();
1105 
1106  if (gameObjectAddon.invisibilityType >= TOTAL_INVISIBILITY_TYPES)
1107  {
1108  TC_LOG_ERROR("sql.sql", "GameObject (GUID: " UI64FMTD ") has invalid InvisibilityType in `gameobject_addon`", guid);
1109  gameObjectAddon.invisibilityType = INVISIBILITY_GENERAL;
1110  gameObjectAddon.InvisibilityValue = 0;
1111  }
1112 
1113  if (gameObjectAddon.invisibilityType && !gameObjectAddon.InvisibilityValue)
1114  {
1115  TC_LOG_ERROR("sql.sql", "GameObject (GUID: " UI64FMTD ") has InvisibilityType set but has no InvisibilityValue in `gameobject_addon`, set to 1", guid);
1116  gameObjectAddon.InvisibilityValue = 1;
1117  }
1118 
1119  ++count;
1120  }
1121  while (result->NextRow());
1122 
1123  TC_LOG_INFO("server.loading", ">> Loaded %u gameobject addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1124 }
GameObjectAddonContainer _gameObjectAddonStore
Definition: ObjectMgr.h:1521
uint64 GetUInt64() const
Definition: Field.h:184
Definition: GameObject.h:811
Definition: SharedDefines.h:1697
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint64 LowType
Definition: ObjectGuid.h:199
InvisibilityType
Definition: SharedDefines.h:1695
#define UI64FMTD
Definition: Define.h:137
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
InvisibilityType invisibilityType
Definition: GameObject.h:813
GameObjectData const * GetGOData(ObjectGuid::LowType guid) const
Definition: ObjectMgr.h:1209
Definition: SharedDefines.h:1736
Definition: GameObject.h:833
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32 InvisibilityValue
Definition: GameObject.h:814

+ Here is the call graph for this function:

void ObjectMgr::LoadGameObjectForQuests ( )
7644 {
7645  uint32 oldMSTime = getMSTime();
7646 
7647  _gameObjectForQuestStore.clear(); // need for reload case
7648 
7649  if (sObjectMgr->GetGameObjectTemplates()->empty())
7650  {
7651  TC_LOG_INFO("server.loading", ">> Loaded 0 GameObjects for quests");
7652  return;
7653  }
7654 
7655  uint32 count = 0;
7656 
7657  // collect GO entries for GO that must activated
7658  GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates();
7659  for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr)
7660  {
7661  switch (itr->second.type)
7662  {
7664  _gameObjectForQuestStore.insert(itr->second.entry);
7665  ++count;
7666  break;
7667  case GAMEOBJECT_TYPE_CHEST:
7668  {
7669  // scan GO chest with loot including quest items
7670  uint32 loot_id = (itr->second.GetLootId());
7671 
7672  // find quest loot for GO
7673  if (itr->second.chest.questID || LootTemplates_Gameobject.HaveQuestLootFor(loot_id))
7674  {
7675  _gameObjectForQuestStore.insert(itr->second.entry);
7676  ++count;
7677  }
7678  break;
7679  }
7681  {
7682  if (itr->second.generic.questID > 0) //quests objects
7683  {
7684  _gameObjectForQuestStore.insert(itr->second.entry);
7685  ++count;
7686  }
7687  break;
7688  }
7690  {
7691  if (itr->second.goober.questID > 0) //quests objects
7692  {
7693  _gameObjectForQuestStore.insert(itr->second.entry);
7694  ++count;
7695  }
7696  break;
7697  }
7698  default:
7699  break;
7700  }
7701  }
7702 
7703  TC_LOG_INFO("server.loading", ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
7704 }
GameObjectForQuestContainer _gameObjectForQuestStore
Definition: ObjectMgr.h:1435
uint32 getMSTime()
Definition: Timer.h:24
#define sObjectMgr
Definition: ObjectMgr.h:1567
LootStore LootTemplates_Gameobject("gameobject_loot_template","gameobject entry", true)
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:2067
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
Definition: SharedDefines.h:2075
std::unordered_map< uint32, GameObjectTemplate > GameObjectTemplateContainer
Definition: GameObject.h:769
Definition: SharedDefines.h:2068
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
Definition: SharedDefines.h:2070
bool HaveQuestLootFor(uint32 loot_id) const
Definition: LootMgr.cpp:198

+ Here is the call graph for this function:

void ObjectMgr::LoadGameObjectLocales ( )
6471 {
6472  uint32 oldMSTime = getMSTime();
6473 
6474  _gameObjectLocaleStore.clear(); // need for reload case
6475 
6476  // 0 1 2 3 4
6477  QueryResult result = WorldDatabase.Query("SELECT entry, locale, name, castBarCaption, unk1 FROM gameobject_template_locale");
6478  if (!result)
6479  return;
6480 
6481  do
6482  {
6483  Field* fields = result->Fetch();
6484 
6485  uint32 id = fields[0].GetUInt32();
6486  std::string localeName = fields[1].GetString();
6487 
6488  std::string name = fields[2].GetString();
6489  std::string castBarCaption = fields[3].GetString();
6490  std::string unk1 = fields[4].GetString();
6491 
6493  LocaleConstant locale = GetLocaleByName(localeName);
6494  if (locale == LOCALE_enUS)
6495  continue;
6496 
6497  AddLocaleString(name, locale, data.Name);
6498  AddLocaleString(castBarCaption, locale, data.CastBarCaption);
6499  AddLocaleString(unk1, locale, data.Unk1);
6500 
6501  } while (result->NextRow());
6502 
6503  TC_LOG_INFO("server.loading", ">> Loaded %u gameobject_template_locale strings in %u ms", uint32(_gameObjectLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
6504 }
StringVector CastBarCaption
Definition: GameObject.h:806
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
StringVector Name
Definition: GameObject.h:805
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
GameObjectLocaleContainer _gameObjectLocaleStore
Definition: ObjectMgr.h:1529
StringVector Unk1
Definition: GameObject.h:807
LocaleConstant
Definition: Common.h:115
LocaleConstant GetLocaleByName(const std::string &name)
Definition: Common.cpp:37
Definition: GameObject.h:803
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
static void AddLocaleString(std::string const &value, LocaleConstant localeConstant, StringVector &data)
Definition: ObjectMgr.cpp:295
Definition: Common.h:117
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
uint32_t uint32
Definition: g3dmath.h:168
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

void ObjectMgr::LoadGameobjectQuestEnders ( )
7416 {
7418 
7419  for (QuestRelations::iterator itr = _goQuestInvolvedRelations.begin(); itr != _goQuestInvolvedRelations.end(); ++itr)
7420  {
7421  GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first);
7422  if (!goInfo)
7423  TC_LOG_ERROR("sql.sql", "Table `gameobject_questender` has data for nonexistent gameobject entry (%u) and existed quest %u", itr->first, itr->second);
7424  else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
7425  TC_LOG_ERROR("sql.sql", "Table `gameobject_questender` has data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
7426  }
7427 }
GameObjectTemplate const * GetGameObjectTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9104
QuestRelations _goQuestInvolvedRelations
Definition: ObjectMgr.h:1454
void LoadQuestRelationsHelper(QuestRelations &map, QuestRelationsReverse *reverseMap, std::string const &table, bool starter, bool go)
Definition: ObjectMgr.cpp:7354
Definition: GameObject.h:34
Definition: SharedDefines.h:2067
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32 type
Definition: GameObject.h:37
QuestRelationsReverse _goQuestInvolvedRelationsReverse
Definition: ObjectMgr.h:1455

+ Here is the call graph for this function:

void ObjectMgr::LoadGameObjectQuestItems ( )
9351 {
9352  uint32 oldMSTime = getMSTime();
9353 
9354  // 0 1 2
9355  QueryResult result = WorldDatabase.Query("SELECT GameObjectEntry, ItemId, Idx FROM gameobject_questitem ORDER BY Idx ASC");
9356 
9357  if (!result)
9358  {
9359  TC_LOG_INFO("server.loading", ">> Loaded 0 gameobject quest items. DB table `gameobject_questitem` is empty.");
9360  return;
9361  }
9362 
9363  uint32 count = 0;
9364  do
9365  {
9366  Field* fields = result->Fetch();
9367 
9368  uint32 entry = fields[0].GetUInt32();
9369  uint32 item = fields[1].GetUInt32();
9370  uint32 idx = fields[2].GetUInt32();
9371 
9372  GameObjectTemplate const* goInfo = GetGameObjectTemplate(entry);
9373  if (!goInfo)
9374  {
9375  TC_LOG_ERROR("sql.sql", "Table `gameobject_questitem` has data for nonexistent gameobject (entry: %u, idx: %u), skipped", entry, idx);
9376  continue;
9377  };
9378 
9379  ItemEntry const* db2Data = sItemStore.LookupEntry(item);
9380  if (!db2Data)
9381  {
9382  TC_LOG_ERROR("sql.sql", "Table `gameobject_questitem` has nonexistent item (ID: %u) in gameobject (entry: %u, idx: %u), skipped", item, entry, idx);
9383  continue;
9384  };
9385 
9386  _gameObjectQuestItemStore[entry].push_back(item);
9387 
9388  ++count;
9389  }
9390  while (result->NextRow());
9391 
9392  TC_LOG_INFO("server.loading", ">> Loaded %u gameobject quest items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
9393 }
GameObjectTemplate const * GetGameObjectTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9104
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
Definition: GameObject.h:34
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
DB2Storage< ItemEntry > sItemStore("Item.db2", ItemFormat, HOTFIX_SEL_ITEM)
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
GameObjectQuestItemMap _gameObjectQuestItemStore
Definition: ObjectMgr.h:1522
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
Definition: DB2Structure.h:710
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

void ObjectMgr::LoadGameobjectQuestStarters ( )
7402 {
7403  LoadQuestRelationsHelper(_goQuestRelations, nullptr, "gameobject_queststarter", true, true);
7404 
7405  for (QuestRelations::iterator itr = _goQuestRelations.begin(); itr != _goQuestRelations.end(); ++itr)
7406  {
7407  GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first);
7408  if (!goInfo)
7409  TC_LOG_ERROR("sql.sql", "Table `gameobject_queststarter` has data for nonexistent gameobject entry (%u) and existed quest %u", itr->first, itr->second);
7410  else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
7411  TC_LOG_ERROR("sql.sql", "Table `gameobject_queststarter` has data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
7412  }
7413 }
GameObjectTemplate const * GetGameObjectTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9104
void LoadQuestRelationsHelper(QuestRelations &map, QuestRelationsReverse *reverseMap, std::string const &table, bool starter, bool go)
Definition: ObjectMgr.cpp:7354
Definition: GameObject.h:34
QuestRelations _goQuestRelations
Definition: ObjectMgr.h:1453
Definition: SharedDefines.h:2067
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32 type
Definition: GameObject.h:37

+ Here is the call graph for this function:

void ObjectMgr::LoadGameobjects ( )
2032 {
2033  uint32 oldMSTime = getMSTime();
2034 
2035  // 0 1 2 3 4 5 6
2036  QueryResult result = WorldDatabase.Query("SELECT gameobject.guid, id, map, position_x, position_y, position_z, orientation, "
2037  // 7 8 9 10 11 12 13 14 15 16 17 18
2038  "rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, eventEntry, pool_entry, phaseid, phasegroup "
2039  "FROM gameobject LEFT OUTER JOIN game_event_gameobject ON gameobject.guid = game_event_gameobject.guid "
2040  "LEFT OUTER JOIN pool_gameobject ON gameobject.guid = pool_gameobject.guid");
2041 
2042  if (!result)
2043  {
2044  TC_LOG_ERROR("server.loading", ">> Loaded 0 gameobjects. DB table `gameobject` is empty.");
2045  return;
2046  }
2047 
2048  // build single time for check spawnmask
2049  std::map<uint32, uint32> spawnMasks;
2050  for (auto& mapDifficultyPair : sMapDifficultyMap)
2051  for (auto& difficultyPair : mapDifficultyPair.second)
2052  spawnMasks[mapDifficultyPair.first] |= (1 << difficultyPair.first);
2053 
2054  _gameObjectDataStore.rehash(result->GetRowCount());
2055 
2056  do
2057  {
2058  Field* fields = result->Fetch();
2059 
2060  ObjectGuid::LowType guid = fields[0].GetUInt64();
2061  uint32 entry = fields[1].GetUInt32();
2062 
2063  GameObjectTemplate const* gInfo = GetGameObjectTemplate(entry);
2064  if (!gInfo)
2065  {
2066  TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD ") with non existing gameobject entry %u, skipped.", guid, entry);
2067  continue;
2068  }
2069 
2070  if (!gInfo->displayId)
2071  {
2072  switch (gInfo->type)
2073  {
2074  case GAMEOBJECT_TYPE_TRAP:
2076  break;
2077  default:
2078  TC_LOG_ERROR("sql.sql", "Gameobject (GUID: " UI64FMTD " Entry %u GoType: %u) doesn't have a displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
2079  break;
2080  }
2081  }
2082 
2083  if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId))
2084  {
2085  TC_LOG_ERROR("sql.sql", "Gameobject (GUID: " UI64FMTD " Entry %u GoType: %u) has an invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
2086  continue;
2087  }
2088 
2089  GameObjectData& data = _gameObjectDataStore[guid];
2090 
2091  data.id = entry;
2092  data.mapid = fields[2].GetUInt16();
2093  data.posX = fields[3].GetFloat();
2094  data.posY = fields[4].GetFloat();
2095  data.posZ = fields[5].GetFloat();
2096  data.orientation = fields[6].GetFloat();
2097  data.rotation0 = fields[7].GetFloat();
2098  data.rotation1 = fields[8].GetFloat();
2099  data.rotation2 = fields[9].GetFloat();
2100  data.rotation3 = fields[10].GetFloat();
2101  data.spawntimesecs = fields[11].GetInt32();
2102 
2103  MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
2104  if (!mapEntry)
2105  {
2106  TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) spawned on a non-existed map (Id: %u), skip", guid, data.id, data.mapid);
2107  continue;
2108  }
2109 
2110  if (data.spawntimesecs == 0 && gInfo->IsDespawnAtAction())
2111  {
2112  TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id);
2113  }
2114 
2115  data.animprogress = fields[12].GetUInt8();
2116  data.artKit = 0;
2117 
2118  uint32 go_state = fields[13].GetUInt8();
2119  if (go_state >= MAX_GO_STATE)
2120  {
2122  {
2123  TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state);
2124  continue;
2125  }
2126  }
2127  data.go_state = GOState(go_state);
2128 
2129  data.spawnMask = fields[14].GetUInt32();
2130 
2131  if (!IsTransportMap(data.mapid) && data.spawnMask & ~spawnMasks[data.mapid])
2132  TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) that has wrong spawn mask %u including unsupported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid);
2133 
2134  int16 gameEvent = fields[15].GetInt8();
2135  uint32 PoolId = fields[16].GetUInt32();
2136  data.phaseid = fields[17].GetUInt32();
2137  data.phaseGroup = fields[18].GetUInt32();
2138 
2139  if (data.phaseGroup && data.phaseid)
2140  {
2141  TC_LOG_ERROR("sql.sql", "Table `gameobject` have gameobject (GUID: " UI64FMTD " Entry: %u) with both `phaseid` and `phasegroup` set, `phasegroup` set to 0", guid, data.id);
2142  data.phaseGroup = 0;
2143  }
2144 
2145  if (data.phaseid)
2146  {
2147  PhaseEntry const* phase = sPhaseStore.LookupEntry(data.phaseid);
2148  if (!phase)
2149  {
2150  TC_LOG_ERROR("sql.sql", "Table `gameobject` have gameobject (GUID: " UI64FMTD " Entry: %u) with `phaseid` %u does not exist, set to 0", guid, data.id, data.phaseid);
2151  data.phaseid = 0;
2152  }
2153  }
2154 
2155  if (data.phaseGroup)
2156  {
2157  if (sDB2Manager.GetPhasesForGroup(data.phaseGroup).empty())
2158  {
2159  TC_LOG_ERROR("sql.sql", "Table `gameobject` have gameobject (GUID: " UI64FMTD " Entry: %u) with `phaseGroup` %u does not exist, set to 0", guid, data.id, data.phaseGroup);
2160  data.phaseGroup = 0;
2161  }
2162  }
2163 
2164  if (std::abs(data.orientation) > 2 * float(M_PI))
2165  {
2166  TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with abs(`orientation`) > 2*PI (orientation is expressed in radians), normalized.", guid, data.id);
2168  }
2169 
2170  if (data.rotation2 < -1.0f || data.rotation2 > 1.0f)
2171  {
2172  TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with invalid rotation2 (%f) value, skip", guid, data.id, data.rotation2);
2173  continue;
2174  }
2175 
2176  if (data.rotation3 < -1.0f || data.rotation3 > 1.0f)
2177  {
2178  TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with invalid rotation3 (%f) value, skip", guid, data.id, data.rotation3);
2179  continue;
2180  }
2181 
2182  if (!MapManager::IsValidMapCoord(data.mapid, data.posX, data.posY, data.posZ, data.orientation))
2183  {
2184  TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with invalid coordinates, skip", guid, data.id);
2185  continue;
2186  }
2187 
2188  data.phaseMask = 1;
2189 
2191  {
2192  uint32 zoneId = 0;
2193  uint32 areaId = 0;
2194  sMapMgr->GetZoneAndAreaId(zoneId, areaId, data.mapid, data.posX, data.posY, data.posZ);
2195 
2197 
2198  stmt->setUInt32(0, zoneId);
2199  stmt->setUInt32(1, areaId);
2200  stmt->setUInt64(2, guid);
2201 
2202  WorldDatabase.Execute(stmt);
2203  }
2204 
2205  if (gameEvent == 0 && PoolId == 0) // if not this is to be managed by GameEvent System or Pool system
2206  AddGameobjectToGrid(guid, &data);
2207  }
2208  while (result->NextRow());
2209 
2210  TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " gameobjects in %u ms", _gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
2211 }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
GameObjectTemplate const * GetGameObjectTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9104
#define sDB2Manager
Definition: DB2Stores.h:224
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 spawnMask
Definition: GameObject.h:852
float posZ
Definition: GameObject.h:843
Definition: GameObject.h:825
uint64 GetUInt64() const
Definition: Field.h:184
float rotation0
Definition: GameObject.h:845
int32 spawntimesecs
Definition: GameObject.h:849
float GetFloat() const
Definition: Field.h:222
#define M_PI
Definition: Common.h:163
#define SZFMTD
Definition: Define.h:143
float rotation2
Definition: GameObject.h:847
#define MAX_GO_STATE
Definition: GameObject.h:829
MapDifficultyMap sMapDifficultyMap
Definition: DBCStores.cpp:115
Class used to access individual fields of database query result.
Definition: Field.h:56
GameObjectDataContainer _gameObjectDataStore
Definition: ObjectMgr.h:1528
float rotation3
Definition: GameObject.h:848
uint32 getMSTime()
Definition: Timer.h:24
Definition: GameObject.h:34
Definition: DBCStructure.h:830
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: SharedDefines.h:2073
uint32 phaseid
Definition: GameObject.h:854
bool IsTransportMap(uint32 mapId) const
Definition: ObjectMgr.h:1365
uint32 displayId
Definition: GameObject.h:38
static float NormalizeOrientation(float o)
Definition: Position.h:211
#define sWorld
Definition: World.h:887
uint64 LowType
Definition: ObjectGuid.h:199
float orientation
Definition: GameObject.h:844
Definition: PreparedStatement.h:74
void AddGameobjectToGrid(ObjectGuid::LowType guid, GameObjectData const *data)
Definition: ObjectMgr.cpp:2213
uint8 GetUInt8() const
Definition: Field.h:70
uint8 artKit
Definition: GameObject.h:853
#define MAX_GO_STATE_TRANSPORT_STOP_FRAMES
Definition: GameObject.h:830
#define UI64FMTD
Definition: Define.h:137
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 id
Definition: GameObject.h:838
DBCStorage< PhaseEntry > sPhaseStore(Phasefmt)
uint16 GetUInt16() const
Definition: Field.h:108
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: WorldDatabase.h:100
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
DBCStorage< GameObjectDisplayInfoEntry > sGameObjectDisplayInfoStore(GameObjectDisplayInfofmt)
Definition: DBCStructure.h:824
bool IsDespawnAtAction() const
Definition: GameObject.h:628
GOState
Definition: GameObject.h:820
int32 GetInt32() const
Definition: Field.h:165
Definition: GameObject.h:833
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
DBCStorage< MapEntry > sMapStore(Mapfmt)
uint16 mapid
Definition: GameObject.h:839
static bool IsValidMapCoord(uint32 mapid, float x, float y)
Definition: MapManager.h:83
uint32 animprogress
Definition: GameObject.h:850
#define sMapMgr
Definition: MapManager.h:194
uint32 GetUInt32() const
Definition: Field.h:146
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
float rotation1
Definition: GameObject.h:846
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
uint32 phaseGroup
Definition: GameObject.h:855
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
int16_t int16
Definition: Define.h:147
int8 GetInt8() const
Definition: Field.h:89
float posX
Definition: GameObject.h:841
uint32 phaseMask
Definition: GameObject.h:840
Definition: SharedDefines.h:2076
Definition: SharedDefines.h:2071
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:

void ObjectMgr::LoadGameObjectTemplate ( )
6566 {
6567  uint32 oldMSTime = getMSTime();
6568 
6569  for (GameObjectsEntry const* db2go : sGameObjectsStore)
6570  {
6572  go.entry = db2go->ID;
6573  go.type = db2go->Type;
6574  go.displayId = db2go->DisplayID;
6575  go.name = db2go->Name->Str[sWorld->GetDefaultDbcLocale()];
6576  go.faction = 0;
6577  go.flags = 0;
6578  go.size = db2go->Size;
6579  memset(go.raw.data, 0, sizeof(go.raw.data));
6580  memcpy(go.raw.data, db2go->Data, std::min(sizeof(db2go->Data), sizeof(go.raw.data)));
6581  go.unkInt32 = 0;
6582  go.ScriptId = 0;
6583  }
6584 
6585  // 0 1 2 3 4 5 6 7 8 9
6586  QueryResult result = WorldDatabase.Query("SELECT entry, type, displayId, name, IconName, castBarCaption, unk1, faction, flags, size, "
6587  // 10 11 12 13 14 15 16 17 18 19 20 21 22
6588  "Data0, Data1, Data2, Data3, Data4, Data5, Data6, Data7, Data8, Data9, Data10, Data11, Data12, "
6589  // 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
6590  "Data13, Data14, Data15, Data16, Data17, Data18, Data19, Data20, Data21, Data22, Data23, Data24, Data25, Data26, Data27, Data28, "
6591  // 39 40 41 42 43 44 45
6592  "Data29, Data30, Data31, Data32, unkInt32, AIName, ScriptName "
6593  "FROM gameobject_template");
6594 
6595  if (!result)
6596  {
6597  TC_LOG_INFO("server.loading", ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty.");
6598  return;
6599  }
6600 
6601  _gameObjectTemplateStore.rehash(result->GetRowCount());
6602  uint32 count = 0;
6603  do
6604  {
6605  Field* fields = result->Fetch();
6606 
6607  uint32 entry = fields[0].GetUInt32();
6608 
6610 
6611  got.entry = entry;
6612  got.type = uint32(fields[1].GetUInt8());
6613  got.displayId = fields[2].GetUInt32();
6614  got.name = fields[3].GetString();
6615  got.IconName = fields[4].GetString();
6616  got.castBarCaption = fields[5].GetString();
6617  got.unk1 = fields[6].GetString();
6618  got.faction = uint32(fields[7].GetUInt16());
6619  got.flags = fields[8].GetUInt32();
6620  got.size = fields[9].GetFloat();
6621 
6622  for (uint8 i = 0; i < MAX_GAMEOBJECT_DATA; ++i)
6623  got.raw.data[i] = fields[10 + i].GetUInt32();
6624 
6625  got.unkInt32 = fields[43].GetInt32();
6626  got.AIName = fields[44].GetString();
6627  got.ScriptId = GetScriptId(fields[45].GetString());
6628 
6629  // Checks
6630 
6631  switch (got.type)
6632  {
6633  case GAMEOBJECT_TYPE_DOOR: //0
6634  {
6635  if (got.door.open)
6636  CheckGOLockId(&got, got.door.open, 1);
6637  CheckGONoDamageImmuneId(&got, got.door.noDamageImmune, 3);
6638  break;
6639  }
6640  case GAMEOBJECT_TYPE_BUTTON: //1
6641  {
6642  if (got.button.open)
6643  CheckGOLockId(&got, got.button.open, 1);
6644  CheckGONoDamageImmuneId(&got, got.button.noDamageImmune, 4);
6645  break;
6646  }
6647  case GAMEOBJECT_TYPE_QUESTGIVER: //2
6648  {
6649  if (got.questgiver.open)
6650  CheckGOLockId(&got, got.questgiver.open, 0);
6651  CheckGONoDamageImmuneId(&got, got.questgiver.noDamageImmune, 5);
6652  break;
6653  }
6654  case GAMEOBJECT_TYPE_CHEST: //3
6655  {
6656  if (got.chest.open)
6657  CheckGOLockId(&got, got.chest.open, 0);
6658 
6659  CheckGOConsumable(&got, got.chest.consumable, 3);
6660 
6661  if (got.chest.linkedTrap) // linked trap
6662  CheckGOLinkedTrapId(&got, got.chest.linkedTrap, 7);
6663  break;
6664  }
6665  case GAMEOBJECT_TYPE_TRAP: //6
6666  {
6667  if (got.trap.open)
6668  CheckGOLockId(&got, got.trap.open, 0);
6669  break;
6670  }
6671  case GAMEOBJECT_TYPE_CHAIR: //7
6672  CheckAndFixGOChairHeightId(&got, got.chair.chairheight, 1);
6673  break;
6674  case GAMEOBJECT_TYPE_SPELL_FOCUS: //8
6675  {
6676  if (got.spellFocus.spellFocusType)
6677  {
6678  if (!sSpellFocusObjectStore.LookupEntry(got.spellFocus.spellFocusType))
6679  TC_LOG_ERROR("sql.sql", "GameObject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.",
6680  entry, got.type, got.spellFocus.spellFocusType, got.spellFocus.spellFocusType);
6681  }
6682 
6683  if (got.spellFocus.linkedTrap) // linked trap
6684  CheckGOLinkedTrapId(&got, got.spellFocus.linkedTrap, 2);
6685  break;
6686  }
6687  case GAMEOBJECT_TYPE_GOOBER: //10
6688  {
6689  if (got.goober.open)
6690  CheckGOLockId(&got, got.goober.open, 0);
6691 
6692  CheckGOConsumable(&got, got.goober.consumable, 3);
6693 
6694  if (got.goober.pageID) // pageId
6695  {
6696  if (!GetPageText(got.goober.pageID))
6697  TC_LOG_ERROR("sql.sql", "GameObject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.",
6698  entry, got.type, got.goober.pageID, got.goober.pageID);
6699  }
6700  CheckGONoDamageImmuneId(&got, got.goober.noDamageImmune, 11);
6701  if (got.goober.linkedTrap) // linked trap
6702  CheckGOLinkedTrapId(&got, got.goober.linkedTrap, 12);
6703  break;
6704  }
6705  case GAMEOBJECT_TYPE_AREADAMAGE: //12
6706  {
6707  if (got.areaDamage.open)
6708  CheckGOLockId(&got, got.areaDamage.open, 0);
6709  break;
6710  }
6711  case GAMEOBJECT_TYPE_CAMERA: //13
6712  {
6713  if (got.camera.open)
6714  CheckGOLockId(&got, got.camera.open, 0);
6715  break;
6716  }
6718  {
6719  if (got.moTransport.taxiPathID)
6720  {
6721  if (got.moTransport.taxiPathID >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[got.moTransport.taxiPathID].empty())
6722  TC_LOG_ERROR("sql.sql", "GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.",
6723  entry, got.type, got.moTransport.taxiPathID, got.moTransport.taxiPathID);
6724  }
6725  if (uint32 transportMap = got.moTransport.mapID)
6726  _transportMaps.insert(transportMap);
6727  break;
6728  }
6729  case GAMEOBJECT_TYPE_RITUAL: //18
6730  break;
6731  case GAMEOBJECT_TYPE_SPELLCASTER: //22
6732  {
6733  // always must have spell
6734  CheckGOSpellId(&got, got.spellCaster.spell, 0);
6735  break;
6736  }
6737  case GAMEOBJECT_TYPE_FLAGSTAND: //24
6738  {
6739  if (got.flagStand.open)
6740  CheckGOLockId(&got, got.flagStand.open, 0);
6741  CheckGONoDamageImmuneId(&got, got.flagStand.noDamageImmune, 5);
6742  break;
6743  }
6744  case GAMEOBJECT_TYPE_FISHINGHOLE: //25
6745  {
6746  if (got.fishingHole.open)
6747  CheckGOLockId(&got, got.fishingHole.open, 4);
6748  break;
6749  }
6750  case GAMEOBJECT_TYPE_FLAGDROP: //26
6751  {
6752  if (got.flagDrop.open)
6753  CheckGOLockId(&got, got.flagDrop.open, 0);
6754  CheckGONoDamageImmuneId(&got, got.flagDrop.noDamageImmune, 3);
6755  break;
6756  }
6757  case GAMEOBJECT_TYPE_BARBER_CHAIR: //32
6758  CheckAndFixGOChairHeightId(&got, got.barberChair.chairheight, 0);
6759 
6760  if (got.barberChair.SitAnimKit && !sAnimKitStore.LookupEntry(got.barberChair.SitAnimKit))
6761  {
6762  TC_LOG_ERROR("sql.sql", "GameObject (Entry: %u GoType: %u) have data2 = %u but AnimKit.dbc (Id: %u) not exist, set to 0.",
6763  entry, got.type, got.barberChair.SitAnimKit, got.barberChair.SitAnimKit);
6764  got.barberChair.SitAnimKit = 0;
6765  }
6766  break;
6768  if (uint32 transportMap = got.garrisonBuilding.mapID)
6769  _transportMaps.insert(transportMap);
6770  break;
6771  }
6772 
6773  ++count;
6774  }
6775  while (result->NextRow());
6776 
6777  TC_LOG_INFO("server.loading", ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
6778 }
GameObjectTemplateContainer _gameObjectTemplateStore
Definition: ObjectMgr.h:1530
struct GameObjectTemplate::@221::@255 barberChair
std::string castBarCaption
Definition: GameObject.h:41
std::string unk1
Definition: GameObject.h:42
uint32 camera
Definition: GameObject.h:281
struct GameObjectTemplate::@221::@261 garrisonBuilding
struct GameObjectTemplate::@221::@230 chair
void CheckGOLockId(GameObjectTemplate const *goInfo, uint32 dataN, uint32 N)
Definition: ObjectMgr.cpp:6506
float GetFloat() const
Definition: Field.h:222
struct GameObjectTemplate::@221::@235 areaDamage
PageText const * GetPageText(uint32 pageEntry)
Definition: ObjectMgr.cpp:5163
struct GameObjectTemplate::@221::@249 flagDrop
Class used to access individual fields of database query result.
Definition: Field.h:56
std::string AIName
Definition: GameObject.h:624
DB2Storage< GameObjectsEntry > sGameObjectsStore("GameObjects.db2", GameObjectsFormat, HOTFIX_SEL_GAMEOBJECTS)
Definition: SharedDefines.h:2103
struct GameObjectTemplate::@221::@224 button
uint32 getMSTime()
Definition: Timer.h:24
Definition: GameObject.h:34
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: SharedDefines.h:2091
struct GameObjectTemplate::@221::@247 flagStand
Definition: SharedDefines.h:2073
TaxiPathNodesByPath sTaxiPathNodesByPath
Definition: DB2Stores.cpp:139
uint32 displayId
Definition: GameObject.h:38
Definition: DB2Structure.h:400
#define sWorld
Definition: World.h:887
uint32 faction
Definition: GameObject.h:43
void CheckGOSpellId(GameObjectTemplate const *goInfo, uint32 dataN, uint32 N)
Definition: ObjectMgr.cpp:6525
float size
Definition: GameObject.h:45
std::string IconName
Definition: GameObject.h:40
void CheckGONoDamageImmuneId(GameObjectTemplate *goTemplate, uint32 dataN, uint32 N)
Definition: ObjectMgr.cpp:6546
struct GameObjectTemplate::@221::@225 questgiver
void CheckAndFixGOChairHeightId(GameObjectTemplate const *goInfo, uint32 &dataN, uint32 N)
Definition: ObjectMgr.cpp:6534
void CheckGOConsumable(GameObjectTemplate const *goInfo, uint32 dataN, uint32 N)
Definition: ObjectMgr.cpp:6555
T min(const T &x, const T &y)
Definition: g3dmath.h:305
struct GameObjectTemplate::@221::@229 trap
Definition: SharedDefines.h:2078
Definition: SharedDefines.h:2066
Definition: SharedDefines.h:2080
struct GameObjectTemplate::@221::@226 chest
DBCStorage< SpellFocusObjectEntry > sSpellFocusObjectStore(SpellFocusObjectfmt)
Definition: SharedDefines.h:2089
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
int32 unkInt32
Definition: GameObject.h:46
struct GameObjectTemplate::@221::@245 spellCaster
uint32 entry
Definition: GameObject.h:36
uint32 ScriptId
Definition: GameObject.h:625
struct GameObjectTemplate::@221::@233 goober
uint32 GetScriptId(std::string const &name)
Definition: ObjectMgr.cpp:8627
Definition: SharedDefines.h:2090
int32 GetInt32() const
Definition: Field.h:165
std::set< uint32 > _transportMaps
Definition: ObjectMgr.h:1564
void CheckGOLinkedTrapId(GameObjectTemplate const *goInfo, uint32 dataN, uint32 N)
Definition: ObjectMgr.cpp:6515
Definition: SharedDefines.h:2067
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
Definition: SharedDefines.h:2072
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
Definition: SharedDefines.h:2075
std::string name
Definition: GameObject.h:39
struct GameObjectTemplate::@221::@272 raw
Definition: SharedDefines.h:2083
struct GameObjectTemplate::@221::@238 moTransport
uint32 GetUInt32() const
Definition: Field.h:146
DBCStorage< AnimKitEntry > sAnimKitStore(AnimKitfmt)
uint8_t uint8
Definition: Define.h:152
Definition: SharedDefines.h:2097
Definition: SharedDefines.h:2068
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
struct GameObjectTemplate::@221::@248 fishingHole
struct GameObjectTemplate::@221::@223 door
uint32_t uint32
Definition: g3dmath.h:168
uint32 flags
Definition: GameObject.h:44
Definition: SharedDefines.h:2087
struct GameObjectTemplate::@221::@231 spellFocus
std::string GetString() const
Definition: Field.h:276
Definition: SharedDefines.h:2077
Definition: SharedDefines.h:2071
uint32 type
Definition: GameObject.h:37
Definition: SharedDefines.h:2065
#define MAX_GAMEOBJECT_DATA
Definition: SharedDefines.h:2117

+ Here is the call graph for this function:

void ObjectMgr::LoadGameTele ( )
7896 {
7897  uint32 oldMSTime = getMSTime();
7898 
7899  _gameTeleStore.clear(); // for reload case
7900 
7901  // 0 1 2 3 4 5 6
7902  QueryResult result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, map, name FROM game_tele");
7903 
7904  if (!result)
7905  {
7906  TC_LOG_ERROR("server.loading", ">> Loaded 0 GameTeleports. DB table `game_tele` is empty!");
7907  return;
7908  }
7909 
7910  uint32 count = 0;
7911 
7912  do
7913  {
7914  Field* fields = result->Fetch();
7915 
7916  uint32 id = fields[0].GetUInt32();
7917 
7918  GameTele gt;
7919 
7920  gt.position_x = fields[1].GetFloat();
7921  gt.position_y = fields[2].GetFloat();
7922  gt.position_z = fields[3].GetFloat();
7923  gt.orientation = fields[4].GetFloat();
7924  gt.mapId = fields[5].GetUInt16();
7925  gt.name = fields[6].GetString();
7926 
7928  {
7929  TC_LOG_ERROR("sql.sql", "Wrong position for id %u (name: %s) in `game_tele` table, ignoring.", id, gt.name.c_str());
7930  continue;
7931  }
7932 
7933  if (!Utf8toWStr(gt.name, gt.wnameLow))
7934  {
7935  TC_LOG_ERROR("sql.sql", "Wrong UTF8 name for id %u in `game_tele` table, ignoring.", id);
7936  continue;
7937  }
7938 
7939  wstrToLower(gt.wnameLow);
7940 
7941  _gameTeleStore[id] = gt;
7942 
7943  ++count;
7944  }
7945  while (result->NextRow());
7946 
7947  TC_LOG_INFO("server.loading", ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
7948 }
std::wstring wnameLow
Definition: ObjectMgr.h:133
std::string name
Definition: ObjectMgr.h:132
float GetFloat() const
Definition: Field.h:222
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
float orientation
Definition: ObjectMgr.h:130
float position_x
Definition: ObjectMgr.h:127
GameTeleContainer _gameTeleStore
Definition: ObjectMgr.h:1464
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
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
float position_z
Definition: ObjectMgr.h:129
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint16 GetUInt16() const
Definition: Field.h:108
float position_y
Definition: ObjectMgr.h:128
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
static bool IsValidMapCoord(uint32 mapid, float x, float y)
Definition: MapManager.h:83
uint32 mapId
Definition: ObjectMgr.h:131
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

void ObjectMgr::LoadGossipMenu ( )
8318 {
8319  uint32 oldMSTime = getMSTime();
8320 
8321  _gossipMenusStore.clear();
8322 
8323  QueryResult result = WorldDatabase.Query("SELECT entry, text_id FROM gossip_menu");
8324 
8325  if (!result)
8326  {
8327  TC_LOG_ERROR("server.loading", ">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!");
8328  return;
8329  }
8330 
8331  uint32 count = 0;
8332 
8333  do
8334  {
8335  Field* fields = result->Fetch();
8336 
8337  GossipMenus gMenu;
8338 
8339  gMenu.entry = fields[0].GetUInt16();
8340  gMenu.text_id = fields[1].GetUInt32();
8341 
8342  if (!GetNpcText(gMenu.text_id))
8343  {
8344  TC_LOG_ERROR("sql.sql", "Table gossip_menu entry %u are using non-existing text_id %u", gMenu.entry, gMenu.text_id);
8345  continue;
8346  }
8347 
8348  _gossipMenusStore.insert(GossipMenusContainer::value_type(gMenu.entry, gMenu));
8349 
8350  ++count;
8351  }
8352  while (result->NextRow());
8353 
8354  TC_LOG_INFO("server.loading", ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
8355 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32 text_id
Definition: ObjectMgr.h:531
Definition: ObjectMgr.h:528
GossipMenusContainer _gossipMenusStore
Definition: ObjectMgr.h:1447
NpcText const * GetNpcText(uint32 textID) const
Definition: ObjectMgr.cpp:5346
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint16 GetUInt16() const
Definition: Field.h:108
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 entry
Definition: ObjectMgr.h:530
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

void ObjectMgr::LoadGossipMenuItems ( )
8358 {
8359  uint32 oldMSTime = getMSTime();
8360 
8361  _gossipMenuItemsStore.clear();
8362 
8363  QueryResult result = WorldDatabase.Query(
8364  // 0 1 2 3 4 5 6 7 8 9 10 11 12
8365  "SELECT menu_id, id, option_icon, option_text, OptionBroadcastTextID, option_id, npc_option_npcflag, action_menu_id, action_poi_id, box_coded, box_money, box_text, BoxBroadcastTextID "
8366  "FROM gossip_menu_option ORDER BY menu_id, id");
8367 
8368  if (!result)
8369  {
8370  TC_LOG_ERROR("server.loading", ">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!");
8371  return;
8372  }
8373 
8374  uint32 count = 0;
8375 
8376  do
8377  {
8378  Field* fields = result->Fetch();
8379 
8380  GossipMenuItems gMenuItem;
8381 
8382  gMenuItem.MenuId = fields[0].GetUInt16();
8383  gMenuItem.OptionIndex = fields[1].GetUInt16();
8384  gMenuItem.OptionIcon = fields[2].GetUInt32();
8385  gMenuItem.OptionText = fields[3].GetString();
8386  gMenuItem.OptionBroadcastTextId = fields[4].GetUInt32();
8387  gMenuItem.OptionType = fields[5].GetUInt8();
8388  gMenuItem.OptionNpcflag = fields[6].GetUInt64();
8389  gMenuItem.ActionMenuId = fields[7].GetUInt32();
8390  gMenuItem.ActionPoiId = fields[8].GetUInt32();
8391  gMenuItem.BoxCoded = fields[9].GetBool();
8392  gMenuItem.BoxMoney = fields[10].GetUInt32();
8393  gMenuItem.BoxText = fields[11].GetString();
8394  gMenuItem.BoxBroadcastTextId = fields[12].GetUInt32();
8395 
8396  if (gMenuItem.OptionIcon >= GOSSIP_ICON_MAX)
8397  {
8398  TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon);
8399  gMenuItem.OptionIcon = GOSSIP_ICON_CHAT;
8400  }
8401 
8402  if (gMenuItem.OptionBroadcastTextId)
8403  {
8404  if (!sBroadcastTextStore.LookupEntry(gMenuItem.OptionBroadcastTextId))
8405  {
8406  TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u has non-existing or incompatible OptionBroadcastTextId %u, ignoring.", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionBroadcastTextId);
8407  gMenuItem.OptionBroadcastTextId = 0;
8408  }
8409  }
8410 
8411  if (gMenuItem.OptionType >= GOSSIP_OPTION_MAX)
8412  TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionType);
8413 
8414  if (gMenuItem.ActionPoiId && !GetPointOfInterest(gMenuItem.ActionPoiId))
8415  {
8416  TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionPoiId);
8417  gMenuItem.ActionPoiId = 0;
8418  }
8419 
8420  if (gMenuItem.BoxBroadcastTextId)
8421  {
8422  if (!sBroadcastTextStore.LookupEntry(gMenuItem.BoxBroadcastTextId))
8423  {
8424  TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u has non-existing or incompatible BoxBroadcastTextId %u, ignoring.", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.BoxBroadcastTextId);
8425  gMenuItem.BoxBroadcastTextId = 0;
8426  }
8427  }
8428 
8429  _gossipMenuItemsStore.insert(GossipMenuItemsContainer::value_type(gMenuItem.MenuId, gMenuItem));
8430  ++count;
8431  }
8432  while (result->NextRow());
8433 
8434  TC_LOG_INFO("server.loading", ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
8435 }
std::string OptionText
Definition: ObjectMgr.h:515
Definition: GossipDef.h:54
uint64 GetUInt64() const
Definition: Field.h:184
DB2Storage< BroadcastTextEntry > sBroadcastTextStore("BroadcastText.db2", BroadcastTextFormat, HOTFIX_SEL_BROADCAST_TEXT)
uint32 BoxBroadcastTextId
Definition: ObjectMgr.h:524
uint32 OptionType
Definition: ObjectMgr.h:517
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 ActionPoiId
Definition: ObjectMgr.h:520
uint32 MenuId
Definition: ObjectMgr.h:512
uint32 getMSTime()
Definition: Timer.h:24
std::string BoxText
Definition: ObjectMgr.h:523
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: GossipDef.h:81
uint8 GetUInt8() const
Definition: Field.h:70
uint32 BoxMoney
Definition: ObjectMgr.h:522
Definition: ObjectMgr.h:510
uint64 OptionNpcflag
Definition: ObjectMgr.h:518
PointOfInterest const * GetPointOfInterest(uint32 id) const
Definition: ObjectMgr.h:901
uint32 OptionIndex
Definition: ObjectMgr.h:513
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint16 GetUInt16() const
Definition: Field.h:108
bool BoxCoded
Definition: ObjectMgr.h:521
uint32 ActionMenuId
Definition: ObjectMgr.h:519
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
Definition: GossipDef.h:59
uint32 GetUInt32() const
Definition: Field.h:146
uint32 OptionBroadcastTextId
Definition: ObjectMgr.h:516
uint8 OptionIcon
Definition: ObjectMgr.h:514
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
bool GetBool() const
Definition: Field.h:65
std::string GetString() const
Definition: Field.h:276
GossipMenuItemsContainer _gossipMenuItemsStore
Definition: ObjectMgr.h:1448

+ Here is the call graph for this function:

void ObjectMgr::LoadGossipMenuItemsLocales ( )
345 {
346  uint32 oldMSTime = getMSTime();
347 
348  _gossipMenuItemsLocaleStore.clear(); // need for reload case
349 
350  QueryResult result = WorldDatabase.Query("SELECT menu_id, id, "
351  "option_text_loc1, box_text_loc1, option_text_loc2, box_text_loc2, "
352  "option_text_loc3, box_text_loc3, option_text_loc4, box_text_loc4, "
353  "option_text_loc5, box_text_loc5, option_text_loc6, box_text_loc6, "
354  "option_text_loc7, box_text_loc7, option_text_loc8, box_text_loc8 "
355  "FROM locales_gossip_menu_option");
356 
357  if (!result)
358  return;
359 
360  do
361  {
362  Field* fields = result->Fetch();
363 
364  uint16 menuId = fields[0].GetUInt16();
365  uint16 id = fields[1].GetUInt16();
366 
368 
369  for (uint8 i = OLD_TOTAL_LOCALES - 1; i > 0; --i)
370  {
371  LocaleConstant locale = (LocaleConstant) i;
372  AddLocaleString(fields[2 + 2 * (i - 1)].GetString(), locale, data.OptionText);
373  AddLocaleString(fields[2 + 2 * (i - 1) + 1].GetString(), locale, data.BoxText);
374  }
375  }
376  while (result->NextRow());
377 
378  TC_LOG_INFO("server.loading", ">> Loaded %u gossip_menu_option locale strings in %u ms", uint32(_gossipMenuItemsLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
379 }
Definition: Creature.h:266
GossipMenuItemsLocaleContainer _gossipMenuItemsLocaleStore
Definition: ObjectMgr.h:1538
Class used to access individual fields of database query result.
Definition: Field.h:56
const uint8 OLD_TOTAL_LOCALES
Definition: Common.h:133
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
LocaleConstant
Definition: Common.h:115
StringVector BoxText
Definition: Creature.h:269
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint16_t uint16
Definition: Define.h:151
uint16 GetUInt16() const
Definition: Field.h:108
StringVector OptionText
Definition: Creature.h:268
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
static void AddLocaleString(std::string const &value, LocaleConstant localeConstant, StringVector &data)
Definition: ObjectMgr.cpp:295
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
uint32_t uint32
Definition: g3dmath.h:168
uint32 MAKE_PAIR32(uint16 l, uint16 h)
Definition: ObjectDefines.h:54

+ Here is the call graph for this function:

void ObjectMgr::LoadGraveyardZones ( )
5844 {
5845  uint32 oldMSTime = getMSTime();
5846 
5847  GraveYardStore.clear(); // needed for reload case
5848 
5849  // 0 1 2
5850  QueryResult result = WorldDatabase.Query("SELECT ID, GhostZone, Faction FROM graveyard_zone");
5851 
5852  if (!result)
5853  {
5854  TC_LOG_INFO("server.loading", ">> Loaded 0 graveyard-zone links. DB table `graveyard_zone` is empty.");
5855  return;
5856  }
5857 
5858  uint32 count = 0;
5859 
5860  do
5861  {
5862  ++count;
5863 
5864  Field* fields = result->Fetch();
5865 
5866  uint32 safeLocId = fields[0].GetUInt32();
5867  uint32 zoneId = fields[1].GetUInt32();
5868  uint32 team = fields[2].GetUInt16();
5869 
5870  WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(safeLocId);
5871  if (!entry)
5872  {
5873  TC_LOG_ERROR("sql.sql", "Table `graveyard_zone` has a record for non-existing graveyard (WorldSafeLocsID: %u), skipped.", safeLocId);
5874  continue;
5875  }
5876 
5877  AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(zoneId);
5878  if (!areaEntry)
5879  {
5880  TC_LOG_ERROR("sql.sql", "Table `graveyard_zone` has a record for non-existing Zone (ID: %u), skipped.", zoneId);
5881  continue;
5882  }
5883 
5884  if (areaEntry->ParentAreaID != 0)
5885  {
5886  TC_LOG_ERROR("sql.sql", "Table `graveyard_zone` has a record for SubZone (ID: %u) instead of zone, skipped.", zoneId);
5887  continue;
5888  }
5889 
5890  if (team != 0 && team != HORDE && team != ALLIANCE)
5891  {
5892  TC_LOG_ERROR("sql.sql", "Table `graveyard_zone` has a record for non player faction (%u), skipped.", team);
5893  continue;
5894  }
5895 
5896  if (!AddGraveYardLink(safeLocId, zoneId, team, false))
5897  TC_LOG_ERROR("sql.sql", "Table `graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId);
5898  } while (result->NextRow());
5899 
5900  TC_LOG_INFO("server.loading", ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
5901 }
Definition: DBCStructure.h:37
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsfmt)
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
Definition: DBCStructure.h:1434
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTablefmt)
Definition: SharedDefines.h:1000
bool AddGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool persist=true)
Definition: ObjectMgr.cpp:6055
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint16 GetUInt16() const
Definition: Field.h:108
uint32 ParentAreaID
Definition: DBCStructure.h:41
Definition: SharedDefines.h:999
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
GraveYardContainer GraveYardStore
Definition: ObjectMgr.h:1342
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

void ObjectMgr::LoadInstanceEncounters ( )
5253 {
5254  uint32 oldMSTime = getMSTime();
5255 
5256  // 0 1 2 3
5257  QueryResult result = WorldDatabase.Query("SELECT entry, creditType, creditEntry, lastEncounterDungeon FROM instance_encounters");
5258  if (!result)
5259  {
5260  TC_LOG_ERROR("server.loading", ">> Loaded 0 instance encounters, table is empty!");
5261  return;
5262  }
5263 
5264  uint32 count = 0;
5265  std::map<uint32, DungeonEncounterEntry const*> dungeonLastBosses;
5266  do
5267  {
5268  Field* fields = result->Fetch();
5269  uint32 entry = fields[0].GetUInt32();
5270  uint8 creditType = fields[1].GetUInt8();
5271  uint32 creditEntry = fields[2].GetUInt32();
5272  uint32 lastEncounterDungeon = fields[3].GetUInt16();
5273  DungeonEncounterEntry const* dungeonEncounter = sDungeonEncounterStore.LookupEntry(entry);
5274  if (!dungeonEncounter)
5275  {
5276  TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid encounter id %u, skipped!", entry);
5277  continue;
5278  }
5279 
5280  if (lastEncounterDungeon && !sLFGMgr->GetLFGDungeonEntry(lastEncounterDungeon))
5281  {
5282  TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", entry, dungeonEncounter->Name_lang, lastEncounterDungeon);
5283  continue;
5284  }
5285 
5286  std::map<uint32, DungeonEncounterEntry const*>::const_iterator itr = dungeonLastBosses.find(lastEncounterDungeon);
5287  if (lastEncounterDungeon)
5288  {
5289  if (itr != dungeonLastBosses.end())
5290  {
5291  TC_LOG_ERROR("sql.sql", "Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", entry, dungeonEncounter->Name_lang, itr->second->ID, itr->second->Name_lang);
5292  continue;
5293  }
5294 
5295  dungeonLastBosses[lastEncounterDungeon] = dungeonEncounter;
5296  }
5297 
5298  switch (creditType)
5299  {
5301  {
5302  CreatureTemplate const* creatureInfo = GetCreatureTemplate(creditEntry);
5303  if (!creatureInfo)
5304  {
5305  TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->Name_lang);
5306  continue;
5307  }
5308  const_cast<CreatureTemplate*>(creatureInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS;
5309  break;
5310  }
5312  if (!sSpellMgr->GetSpellInfo(creditEntry))
5313  {
5314  TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->Name_lang);
5315  continue;
5316  }
5317  break;
5318  default:
5319  TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", creditType, entry, dungeonEncounter->Name_lang);
5320  continue;
5321  }
5322 
5323  if (!dungeonEncounter->DifficultyID)
5324  {
5325  for (uint32 i = 0; i < MAX_DIFFICULTY; ++i)
5326  {
5327  if (GetMapDifficultyData(dungeonEncounter->MapID, Difficulty(i)))
5328  {
5329  DungeonEncounterList& encounters = _dungeonEncounterStore[MAKE_PAIR64(dungeonEncounter->MapID, i)];
5330  encounters.push_back(new DungeonEncounter(dungeonEncounter, EncounterCreditType(creditType), creditEntry, lastEncounterDungeon));
5331  }
5332  }
5333  }
5334  else
5335  {
5336  DungeonEncounterList& encounters = _dungeonEncounterStore[MAKE_PAIR64(dungeonEncounter->MapID, dungeonEncounter->DifficultyID)];
5337  encounters.push_back(new DungeonEncounter(dungeonEncounter, EncounterCreditType(creditType), creditEntry, lastEncounterDungeon));
5338  }
5339 
5340  ++count;
5341  } while (result->NextRow());
5342 
5343  TC_LOG_INFO("server.loading", ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
5344 }
DungeonEncounterContainer _dungeonEncounterStore
Definition: ObjectMgr.h:1441
Difficulty
Definition: DBCEnums.h:402
EncounterCreditType
Definition: ObjectMgr.h:670
MapDifficultyEntry const * GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
Definition: DBCStores.cpp:724
Definition: DBCStructure.h:356
Definition: ObjectMgr.h:676
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
Definition: DBCEnums.h:426
uint32 DifficultyID
Definition: DBCStructure.h:360
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint64 MAKE_PAIR64(uint32 l, uint32 h)
Definition: ObjectDefines.h:34
uint8 GetUInt8() const
Definition: Field.h:70
Definition: ObjectMgr.h:672
#define sLFGMgr
Definition: LFGMgr.h:481
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
uint16 GetUInt16() const
Definition: Field.h:108
char * Name_lang
Definition: DBCStructure.h:363
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
std::list< DungeonEncounter const * > DungeonEncounterList
Definition: ObjectMgr.h:687
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
uint32 MapID
Definition: DBCStructure.h:359
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: Creature.h:58
Definition: Creature.h:79
Definition: ObjectMgr.h:673
DBCStorage< DungeonEncounterEntry > sDungeonEncounterStore(DungeonEncounterfmt)

+ Here is the call graph for this function:

void ObjectMgr::LoadInstanceTemplate ( )
5203 {
5204  uint32 oldMSTime = getMSTime();
5205 
5206  // 0 1 2 4
5207  QueryResult result = WorldDatabase.Query("SELECT map, parent, script, allowMount FROM instance_template");
5208 
5209  if (!result)
5210  {
5211  TC_LOG_INFO("server.loading", ">> Loaded 0 instance templates. DB table `page_text` is empty!");
5212  return;
5213  }
5214 
5215  uint32 count = 0;
5216  do
5217  {
5218  Field* fields = result->Fetch();
5219 
5220  uint16 mapID = fields[0].GetUInt16();
5221 
5222  if (!MapManager::IsValidMAP(mapID, true))
5223  {
5224  TC_LOG_ERROR("sql.sql", "ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", mapID);
5225  continue;
5226  }
5227 
5228  InstanceTemplate instanceTemplate;
5229 
5230  instanceTemplate.AllowMount = fields[3].GetBool();
5231  instanceTemplate.Parent = uint32(fields[1].GetUInt16());
5232  instanceTemplate.ScriptId = sObjectMgr->GetScriptId(fields[2].GetString());
5233 
5234  _instanceTemplateStore[mapID] = instanceTemplate;
5235 
5236  ++count;
5237  }
5238  while (result->NextRow());
5239 
5240  TC_LOG_INFO("server.loading", ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
5241 }
Definition: Map.h:222
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
static bool IsValidMAP(uint32 mapid, bool startUp)
Definition: MapManager.cpp:247
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 Parent
Definition: Map.h:224
InstanceTemplateContainer _instanceTemplateStore
Definition: ObjectMgr.h:1478
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint16_t uint16
Definition: Define.h:151
uint16 GetUInt16() const
Definition: Field.h:108
uint32 ScriptId
Definition: Map.h:225
bool AllowMount
Definition: Map.h:226
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
bool GetBool() const
Definition: Field.h:65

+ Here is the call graph for this function:

void ObjectMgr::LoadItemScriptNames ( )
2758 {
2759  uint32 oldMSTime = getMSTime();
2760  uint32 count = 0;
2761 
2762  QueryResult result = WorldDatabase.Query("SELECT Id, ScriptName FROM item_script_names");
2763  if (result)
2764  {
2765  do
2766  {
2767  Field* fields = result->Fetch();
2768  uint32 itemId = fields[0].GetUInt32();
2769  if (!GetItemTemplate(itemId))
2770  {
2771  TC_LOG_ERROR("sql.sql", "Item %u specified in `item_script_names` does not exist, skipped.", itemId);
2772  continue;
2773  }
2774 
2775  _itemTemplateStore[itemId].ScriptId = GetScriptId(fields[1].GetString());
2776  ++count;
2777  } while (result->NextRow());
2778  }
2779 
2780  TC_LOG_INFO("server.loading", ">> Loaded %u item script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
2781 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
ItemTemplateContainer _itemTemplateStore
Definition: ObjectMgr.h:1534
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetScriptId(std::string const &name)
Definition: ObjectMgr.cpp:8627
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
ItemTemplate const * GetItemTemplate(uint32 entry)
Definition: ObjectMgr.cpp:2782

+ Here is the call graph for this function:

void ObjectMgr::LoadItemTemplateAddon ( )
2721 {
2722  uint32 oldMSTime = getMSTime();
2723  uint32 count = 0;
2724 
2725  QueryResult result = WorldDatabase.Query("SELECT Id, FlagsCu, FoodType, MinMoneyLoot, MaxMoneyLoot, SpellPPMChance FROM item_template_addon");
2726  if (result)
2727  {
2728  do
2729  {
2730  Field* fields = result->Fetch();
2731  uint32 itemId = fields[0].GetUInt32();
2732  if (!GetItemTemplate(itemId))
2733  {
2734  TC_LOG_ERROR("sql.sql", "Item %u specified in `item_template_addon` does not exist, skipped.", itemId);
2735  continue;
2736  }
2737 
2738  uint32 minMoneyLoot = fields[3].GetUInt32();
2739  uint32 maxMoneyLoot = fields[4].GetUInt32();
2740  if (minMoneyLoot > maxMoneyLoot)
2741  {
2742  TC_LOG_ERROR("sql.sql", "Minimum money loot specified in `item_template_addon` for item %u was greater than maximum amount, swapping.", itemId);
2743  std::swap(minMoneyLoot, maxMoneyLoot);
2744  }
2745  ItemTemplate& itemTemplate = _itemTemplateStore[itemId];
2746  itemTemplate.FlagsCu = fields[1].GetUInt32();
2747  itemTemplate.FoodType = fields[2].GetUInt8();
2748  itemTemplate.MinMoneyLoot = minMoneyLoot;
2749  itemTemplate.MaxMoneyLoot = maxMoneyLoot;
2750  itemTemplate.SpellPPMRate = fields[5].GetFloat();
2751  ++count;
2752  } while (result->NextRow());
2753  }
2754  TC_LOG_INFO("server.loading", ">> Loaded %u item addon templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
2755 }
float GetFloat() const
Definition: Field.h:222
uint32 FoodType
Definition: ItemTemplate.h:713
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 MaxMoneyLoot
Definition: ItemTemplate.h:715
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
ItemTemplateContainer _itemTemplateStore
Definition: ObjectMgr.h:1534
uint8 GetUInt8() const
Definition: Field.h:70
float SpellPPMRate
Definition: ItemTemplate.h:717
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 FlagsCu
Definition: ItemTemplate.h:716
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
Definition: ItemTemplate.h:647
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32 MinMoneyLoot
Definition: ItemTemplate.h:714
ItemTemplate const * GetItemTemplate(uint32 entry)
Definition: ObjectMgr.cpp:2782

+ Here is the call graph for this function:

void ObjectMgr::LoadItemTemplates ( )
2623 {
2624  uint32 oldMSTime = getMSTime();
2625  uint32 sparseCount = 0;
2626 
2627  for (ItemSparseEntry const* sparse : sItemSparseStore)
2628  {
2629  ItemEntry const* db2Data = sItemStore.LookupEntry(sparse->ID);
2630  if (!db2Data)
2631  continue;
2632 
2633  ItemTemplate& itemTemplate = _itemTemplateStore[sparse->ID];
2634 
2635  itemTemplate.BasicData = db2Data;
2636  itemTemplate.ExtendedData = sparse;
2637 
2638  itemTemplate.MaxDurability = FillMaxDurability(db2Data->Class, db2Data->SubClass, sparse->InventoryType, sparse->Quality, sparse->ItemLevel);
2639  itemTemplate.ScriptId = 0;
2640  FillDisenchantFields(&itemTemplate.DisenchantID, &itemTemplate.RequiredDisenchantSkill, itemTemplate);
2641  itemTemplate.FoodType = 0;
2642  itemTemplate.MinMoneyLoot = 0;
2643  itemTemplate.MaxMoneyLoot = 0;
2644  itemTemplate.FlagsCu = 0;
2645  itemTemplate.SpellPPMRate = 0.0f;
2646 
2647  if (std::vector<ItemSpecOverrideEntry const*> const* itemSpecOverrides = sDB2Manager.GetItemSpecOverrides(sparse->ID))
2648  {
2649  for (ItemSpecOverrideEntry const* itemSpecOverride : *itemSpecOverrides)
2650  itemTemplate.Specializations[0].insert(itemSpecOverride->SpecID);
2651 
2652  itemTemplate.Specializations[1] = itemTemplate.Specializations[0];
2653  }
2654  else
2655  {
2656  ItemSpecStats itemSpecStats(db2Data, sparse);
2657 
2658  if (itemSpecStats.ItemSpecStatCount)
2659  {
2660  for (ItemSpecEntry const* itemSpec : sItemSpecStore)
2661  {
2662  if (itemSpecStats.ItemType != itemSpec->ItemType)
2663  continue;
2664 
2665  bool hasPrimary = false;
2666  bool hasSecondary = itemSpec->SecondaryStat == ITEM_SPEC_STAT_NONE;
2667  for (uint32 i = 0; i < itemSpecStats.ItemSpecStatCount; ++i)
2668  {
2669  if (itemSpecStats.ItemSpecStatTypes[i] == itemSpec->PrimaryStat)
2670  hasPrimary = true;
2671  if (itemSpecStats.ItemSpecStatTypes[i] == itemSpec->SecondaryStat)
2672  hasSecondary = true;
2673  }
2674 
2675  if (!hasPrimary || !hasSecondary)
2676  continue;
2677 
2678  if (ChrSpecializationEntry const* specialization = sChrSpecializationStore.LookupEntry(itemSpec->SpecID))
2679  if ((1 << (specialization->ClassID - 1)) & sparse->AllowableClass)
2680  itemTemplate.Specializations[itemSpec->MaxLevel > 40].insert(itemSpec->SpecID);
2681  }
2682  }
2683  }
2684 
2685  ++sparseCount;
2686  }
2687 
2688  // Load item effects (spells)
2689  for (ItemEffectEntry const* effectEntry : sItemEffectStore)
2690  {
2691  auto itemItr = _itemTemplateStore.find(effectEntry->ItemID);
2692  if (itemItr == _itemTemplateStore.end())
2693  continue;
2694 
2695  itemItr->second.Effects.push_back(effectEntry);
2696  }
2697 
2698  // Check if item templates for DBC referenced character start outfit are present
2699  std::set<uint32> notFoundOutfit;
2700  for (CharStartOutfitEntry const* entry : sCharStartOutfitStore)
2701  {
2702  for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j)
2703  {
2704  if (entry->ItemID[j] <= 0)
2705  continue;
2706 
2707  uint32 item_id = entry->ItemID[j];
2708 
2709  if (!GetItemTemplate(item_id))
2710  notFoundOutfit.insert(item_id);
2711  }
2712  }
2713 
2714  for (std::set<uint32>::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr)
2715  TC_LOG_ERROR("sql.sql", "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr);
2716 
2717  TC_LOG_INFO("server.loading", ">> Loaded %u item templates in %u ms", sparseCount, GetMSTimeDiffToNow(oldMSTime));
2718 }
#define sDB2Manager
Definition: DB2Stores.h:224
uint32 SubClass
Definition: DB2Structure.h:714
ItemEntry const * BasicData
Definition: ItemTemplate.h:649
DB2Storage< CharStartOutfitEntry > sCharStartOutfitStore("CharStartOutfit.db2", CharStartOutfitFormat, HOTFIX_SEL_CHAR_START_OUTFIT)
Definition: DB2Structure.h:696
Definition: DB2Structure.h:792
uint32 FoodType
Definition: ItemTemplate.h:713
DB2Storage< ItemSpecEntry > sItemSpecStore("ItemSpec.db2", ItemSpecFormat, HOTFIX_SEL_ITEM_SPEC)
Definition: DB2Structure.h:127
uint32 MaxMoneyLoot
Definition: ItemTemplate.h:715
uint32 getMSTime()
Definition: Timer.h:24
std::unordered_set< uint32 > Specializations[2]
Definition: ItemTemplate.h:718
ItemTemplateContainer _itemTemplateStore
Definition: ObjectMgr.h:1534
Definition: ObjectMgr.cpp:2445
Definition: DB2Structure.h:858
Definition: DB2Structure.h:869
float SpellPPMRate
Definition: ItemTemplate.h:717
Definition: DBCStructure.h:245
Definition: DBCEnums.h:583
uint32 DisenchantID
Definition: ItemTemplate.h:711
DB2Storage< ItemEntry > sItemStore("Item.db2", ItemFormat, HOTFIX_SEL_ITEM)
uint32_t uint32
Definition: Define.h:150
void FillDisenchantFields(uint32 *disenchantID, uint32 *requiredDisenchantSkill, ItemTemplate const &itemTemplate)
Definition: ObjectMgr.cpp:2404
uint32 RequiredDisenchantSkill
Definition: ItemTemplate.h:712
DB2Storage< ItemSparseEntry > sItemSparseStore("Item-sparse.db2", ItemSparseFormat, HOTFIX_SEL_ITEM_SPARSE)
uint32 MaxDurability
Definition: ItemTemplate.h:706
uint32 FlagsCu
Definition: ItemTemplate.h:716
DBCStorage< ChrSpecializationEntry > sChrSpecializationStore(ChrSpecializationfmt)
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
ItemSparseEntry const * ExtendedData
Definition: ItemTemplate.h:650
Definition: ItemTemplate.h:647
Definition: DB2Structure.h:710
DB2Storage< ItemEffectEntry > sItemEffectStore("ItemEffect.db2", ItemEffectFormat, HOTFIX_SEL_ITEM_EFFECT)
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
uint32 Class
Definition: DB2Structure.h:713
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32 MinMoneyLoot
Definition: ItemTemplate.h:714
ItemTemplate const * GetItemTemplate(uint32 entry)
Definition: ObjectMgr.cpp:2782
uint32 FillMaxDurability(uint32 itemClass, uint32 itemSubClass, uint32 inventoryType, uint32 quality, uint32 itemLevel)
Definition: ObjectMgr.cpp:2321
#define MAX_OUTFIT_ITEMS
Definition: DB2Structure.h:125
uint32 ScriptId
Definition: ItemTemplate.h:710

+ Here is the call graph for this function:

void ObjectMgr::LoadLinkedRespawn ( )
1398 {
1399  uint32 oldMSTime = getMSTime();
1400 
1401  _linkedRespawnStore.clear();
1402  // 0 1 2
1403  QueryResult result = WorldDatabase.Query("SELECT guid, linkedGuid, linkType FROM linked_respawn ORDER BY guid ASC");
1404 
1405  if (!result)
1406  {
1407  TC_LOG_ERROR("server.loading", ">> Loaded 0 linked respawns. DB table `linked_respawn` is empty.");
1408  return;
1409  }
1410 
1411  do
1412  {
1413  Field* fields = result->Fetch();
1414 
1415  ObjectGuid::LowType guidLow = fields[0].GetUInt64();
1416  ObjectGuid::LowType linkedGuidLow = fields[1].GetUInt64();
1417  uint8 linkType = fields[2].GetUInt8();
1418 
1419  ObjectGuid guid, linkedGuid;
1420  bool error = false;
1421  switch (linkType)
1422  {
1423  case CREATURE_TO_CREATURE:
1424  {
1425  const CreatureData* slave = GetCreatureData(guidLow);
1426  if (!slave)
1427  {
1428  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (guid) '" UI64FMTD "' not found in creature table", guidLow);
1429  error = true;
1430  break;
1431  }
1432 
1433  const CreatureData* master = GetCreatureData(linkedGuidLow);
1434  if (!master)
1435  {
1436  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (linkedGuid) '" UI64FMTD "' not found in creature table", linkedGuidLow);
1437  error = true;
1438  break;
1439  }
1440 
1441  const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
1442  if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
1443  {
1444  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '" UI64FMTD "' linking to Creature '" UI64FMTD "' on an unpermitted map.", guidLow, linkedGuidLow);
1445  error = true;
1446  break;
1447  }
1448 
1449  if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
1450  {
1451  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '" UI64FMTD "' linking to Creature '" UI64FMTD "' with not corresponding spawnMask", guidLow, linkedGuidLow);
1452  error = true;
1453  break;
1454  }
1455 
1456  guid = ObjectGuid::Create<HighGuid::Creature>(slave->mapid, slave->id, guidLow);
1457  linkedGuid = ObjectGuid::Create<HighGuid::Creature>(master->mapid, master->id, linkedGuidLow);
1458  break;
1459  }
1460  case CREATURE_TO_GO:
1461  {
1462  const CreatureData* slave = GetCreatureData(guidLow);
1463  if (!slave)
1464  {
1465  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (guid) '" UI64FMTD "' not found in creature table", guidLow);
1466  error = true;
1467  break;
1468  }
1469 
1470  const GameObjectData* master = GetGOData(linkedGuidLow);
1471  if (!master)
1472  {
1473  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (linkedGuid) '" UI64FMTD "' not found in gameobject table", linkedGuidLow);
1474  error = true;
1475  break;
1476  }
1477 
1478  const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
1479  if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
1480  {
1481  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '" UI64FMTD "' linking to Gameobject '" UI64FMTD "' on an unpermitted map.", guidLow, linkedGuidLow);
1482  error = true;
1483  break;
1484  }
1485 
1486  if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
1487  {
1488  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '" UI64FMTD "' linking to Gameobject '" UI64FMTD "' with not corresponding spawnMask", guidLow, linkedGuidLow);
1489  error = true;
1490  break;
1491  }
1492 
1493  guid = ObjectGuid::Create<HighGuid::Creature>(slave->mapid, slave->id, guidLow);
1494  linkedGuid = ObjectGuid::Create<HighGuid::GameObject>(master->mapid, master->id, linkedGuidLow);
1495  break;
1496  }
1497  case GO_TO_GO:
1498  {
1499  const GameObjectData* slave = GetGOData(guidLow);
1500  if (!slave)
1501  {
1502  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (guid) '" UI64FMTD "' not found in gameobject table", guidLow);
1503  error = true;
1504  break;
1505  }
1506 
1507  const GameObjectData* master = GetGOData(linkedGuidLow);
1508  if (!master)
1509  {
1510  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (linkedGuid) '" UI64FMTD "' not found in gameobject table", linkedGuidLow);
1511  error = true;
1512  break;
1513  }
1514 
1515  const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
1516  if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
1517  {
1518  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '" UI64FMTD "' linking to Gameobject '" UI64FMTD "' on an unpermitted map.", guidLow, linkedGuidLow);
1519  error = true;
1520  break;
1521  }
1522 
1523  if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
1524  {
1525  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '" UI64FMTD "' linking to Gameobject '" UI64FMTD "' with not corresponding spawnMask", guidLow, linkedGuidLow);
1526  error = true;
1527  break;
1528  }
1529 
1530  guid = ObjectGuid::Create<HighGuid::GameObject>(slave->mapid, slave->id, guidLow);
1531  linkedGuid = ObjectGuid::Create<HighGuid::GameObject>(master->mapid, master->id, linkedGuidLow);
1532  break;
1533  }
1534  case GO_TO_CREATURE:
1535  {
1536  const GameObjectData* slave = GetGOData(guidLow);
1537  if (!slave)
1538  {
1539  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (guid) '" UI64FMTD "' not found in gameobject table", guidLow);
1540  error = true;
1541  break;
1542  }
1543 
1544  const CreatureData* master = GetCreatureData(linkedGuidLow);
1545  if (!master)
1546  {
1547  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (linkedGuid) '" UI64FMTD "' not found in creature table", linkedGuidLow);
1548  error = true;
1549  break;
1550  }
1551 
1552  const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
1553  if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
1554  {
1555  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '" UI64FMTD "' linking to Creature '" UI64FMTD "' on an unpermitted map.", guidLow, linkedGuidLow);
1556  error = true;
1557  break;
1558  }
1559 
1560  if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
1561  {
1562  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '" UI64FMTD "' linking to Creature '" UI64FMTD "' with not corresponding spawnMask", guidLow, linkedGuidLow);
1563  error = true;
1564  break;
1565  }
1566 
1567  guid = ObjectGuid::Create<HighGuid::GameObject>(slave->mapid, slave->id, guidLow);
1568  linkedGuid = ObjectGuid::Create<HighGuid::Creature>(master->mapid, master->id, linkedGuidLow);
1569  break;
1570  }
1571  }
1572 
1573  if (!error)
1574  _linkedRespawnStore[guid] = linkedGuid;
1575  }
1576  while (result->NextRow());
1577 
1578  TC_LOG_INFO("server.loading", ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime));
1579 }
Definition: Creature.h:287
uint32 spawnMask
Definition: GameObject.h:852
uint64 GetUInt64() const
Definition: Field.h:184
uint32 id
Definition: Creature.h:293
Class used to access individual fields of database query result.
Definition: Field.h:56
bool Instanceable() const
Definition: DBCStructure.h:859
uint32 getMSTime()
Definition: Timer.h:24
Definition: DBCStructure.h:830
CreatureData const * GetCreatureData(ObjectGuid::LowType guid) const
Definition: ObjectMgr.h:1152
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint64_t uint64
Definition: g3dmath.h:170
uint64 LowType
Definition: ObjectGuid.h:199
uint8 GetUInt8() const
Definition: Field.h:70
Definition: ObjectMgr.h:1560
#define UI64FMTD
Definition: Define.h:137
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 id
Definition: GameObject.h:838
GameObjectData const * GetGOData(ObjectGuid::LowType guid) const
Definition: ObjectMgr.h:1209
Definition: GameObject.h:833
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
uint32 spawnMask
Definition: Creature.h:308
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
DBCStorage< MapEntry > sMapStore(Mapfmt)
uint16 mapid
Definition: GameObject.h:839
LinkedRespawnContainer _linkedRespawnStore
Definition: ObjectMgr.h:1526
uint8_t uint8
Definition: Define.h:152
uint16 mapid
Definition: Creature.h:294
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: ObjectGuid.h:189
Definition: ObjectMgr.h:1558
Definition: ObjectMgr.h:1557
Definition: ObjectMgr.h:1559

+ Here is the call graph for this function:

void ObjectMgr::LoadMailLevelRewards ( )
8054 {
8055  uint32 oldMSTime = getMSTime();
8056 
8057  _mailLevelRewardStore.clear(); // for reload case
8058 
8059  // 0 1 2 3
8060  QueryResult result = WorldDatabase.Query("SELECT level, raceMask, mailTemplateId, senderEntry FROM mail_level_reward");
8061 
8062  if (!result)
8063  {
8064  TC_LOG_ERROR("server.loading", ">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty.");
8065  return;
8066  }
8067 
8068  uint32 count = 0;
8069 
8070  do
8071  {
8072  Field* fields = result->Fetch();
8073 
8074  uint8 level = fields[0].GetUInt8();
8075  uint32 raceMask = fields[1].GetUInt32();
8076  uint32 mailTemplateId = fields[2].GetUInt32();
8077  uint32 senderEntry = fields[3].GetUInt32();
8078 
8079  if (level > MAX_LEVEL)
8080  {
8081  TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` has data for level %u that more supported by client (%u), ignoring.", level, MAX_LEVEL);
8082  continue;
8083  }
8084 
8085  if (!(raceMask & RACEMASK_ALL_PLAYABLE))
8086  {
8087  TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` has raceMask (%u) for level %u that not include any player races, ignoring.", raceMask, level);
8088  continue;
8089  }
8090 
8091  if (!sMailTemplateStore.LookupEntry(mailTemplateId))
8092  {
8093  TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` has invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level);
8094  continue;
8095  }
8096 
8097  if (!GetCreatureTemplate(senderEntry))
8098  {
8099  TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` has nonexistent sender creature entry (%u) for level %u that invalid not include any player races, ignoring.", senderEntry, level);
8100  continue;
8101  }
8102 
8103  _mailLevelRewardStore[level].push_back(MailLevelReward(raceMask, mailTemplateId, senderEntry));
8104 
8105  ++count;
8106  }
8107  while (result->NextRow());
8108 
8109  TC_LOG_INFO("server.loading", ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
8110 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
DB2Storage< MailTemplateEntry > sMailTemplateStore("MailTemplate.db2", MailTemplateFormat, HOTFIX_SEL_MAIL_TEMPLATE)
uint8 GetUInt8() const
Definition: Field.h:70
Definition: ObjectMgr.h:455
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
Definition: DBCEnums.h:50
MailLevelRewardContainer _mailLevelRewardStore
Definition: ObjectMgr.h:1490
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
#define RACEMASK_ALL_PLAYABLE
Definition: SharedDefines.h:133
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

void ObjectMgr::LoadNPCSpellClickSpells ( )
7269 {
7270  uint32 oldMSTime = getMSTime();
7271 
7272  _spellClickInfoStore.clear();
7273  // 0 1 2 3
7274  QueryResult result = WorldDatabase.Query("SELECT npc_entry, spell_id, cast_flags, user_type FROM npc_spellclick_spells");
7275 
7276  if (!result)
7277  {
7278  TC_LOG_ERROR("server.loading", ">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty.");
7279  return;
7280  }
7281 
7282  uint32 count = 0;
7283 
7284  do
7285  {
7286  Field* fields = result->Fetch();
7287 
7288  uint32 npc_entry = fields[0].GetUInt32();
7289  CreatureTemplate const* cInfo = GetCreatureTemplate(npc_entry);
7290  if (!cInfo)
7291  {
7292  TC_LOG_ERROR("sql.sql", "Table npc_spellclick_spells references unknown creature_template %u. Skipping entry.", npc_entry);
7293  continue;
7294  }
7295 
7296  uint32 spellid = fields[1].GetUInt32();
7297  SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spellid);
7298  if (!spellinfo)
7299  {
7300  TC_LOG_ERROR("sql.sql", "Table npc_spellclick_spells creature: %u references unknown spellid %u. Skipping entry.", npc_entry, spellid);
7301  continue;
7302  }
7303 
7304  uint8 userType = fields[3].GetUInt16();
7305  if (userType >= SPELL_CLICK_USER_MAX)
7306  TC_LOG_ERROR("sql.sql", "Table npc_spellclick_spells creature: %u references unknown user type %u. Skipping entry.", npc_entry, uint32(userType));
7307 
7308  uint8 castFlags = fields[2].GetUInt8();
7309  SpellClickInfo info;
7310  info.spellId = spellid;
7311  info.castFlags = castFlags;
7312  info.userType = SpellClickUserTypes(userType);
7313  _spellClickInfoStore.insert(SpellClickInfoContainer::value_type(npc_entry, info));
7314 
7315  ++count;
7316  }
7317  while (result->NextRow());
7318 
7319  // all spellclick data loaded, now we check if there are creatures with NPC_FLAG_SPELLCLICK but with no data
7320  // NOTE: It *CAN* be the other way around: no spellclick flag but with spellclick data, in case of creature-only vehicle accessories
7321  CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
7322  for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
7323  {
7324  if ((itr->second.npcflag & UNIT_NPC_FLAG_SPELLCLICK) && _spellClickInfoStore.find(itr->second.Entry) == _spellClickInfoStore.end())
7325  {
7326  TC_LOG_ERROR("sql.sql", "npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", itr->second.Entry);
7327  const_cast<CreatureTemplate*>(&itr->second)->npcflag &= ~UNIT_NPC_FLAG_SPELLCLICK;
7328  }
7329  }
7330 
7331  TC_LOG_INFO("server.loading", ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
7332 }
SpellClickUserTypes userType
Definition: ObjectMgr.h:391
SpellClickInfoContainer _spellClickInfoStore
Definition: ObjectMgr.h:1468
Definition: Unit.h:759
SpellClickUserTypes
Definition: SharedDefines.h:859
uint8 castFlags
Definition: ObjectMgr.h:390
Definition: SpellInfo.h:326
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: ObjectMgr.h:387
uint8 GetUInt8() const
Definition: Field.h:70
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
uint16 GetUInt16() const
Definition: Field.h:108
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
uint32 spellId
Definition: ObjectMgr.h:389
std::unordered_map< uint32, CreatureTemplate > CreatureTemplateContainer
Definition: Creature.h:213
Definition: SharedDefines.h:865
Definition: Creature.h:79

+ Here is the call graph for this function:

void ObjectMgr::LoadNPCText ( )
5355 {
5356  uint32 oldMSTime = getMSTime();
5357 
5358  QueryResult result = WorldDatabase.Query("SELECT ID, "
5359  "Probability0, Probability1, Probability2, Probability3, Probability4, Probability5, Probability6, Probability7, "
5360  "BroadcastTextID0, BroadcastTextID1, BroadcastTextID2, BroadcastTextID3, BroadcastTextID4, BroadcastTextID5, BroadcastTextID6, BroadcastTextID7"
5361  " FROM npc_text");
5362  if (!result)
5363  {
5364  TC_LOG_INFO("server.loading", ">> Loaded 0 npc texts, table is empty!");
5365  return;
5366  }
5367 
5368  _npcTextStore.rehash(result->GetRowCount());
5369 
5370  do
5371  {
5372  Field* fields = result->Fetch();
5373 
5374  uint32 textID = fields[0].GetUInt32();
5375  if (!textID)
5376  {
5377  TC_LOG_ERROR("sql.sql", "Table `npc_text` has record with reserved id 0, ignore.");
5378  continue;
5379  }
5380 
5381  NpcText& npcText = _npcTextStore[textID];
5382 
5383  for (uint8 i = 0; i < MAX_NPC_TEXT_OPTIONS; ++i)
5384  {
5385  npcText.Data[i].Probability = fields[1 + i].GetFloat();
5386  npcText.Data[i].BroadcastTextID = fields[9 + i].GetUInt32();
5387  }
5388 
5389  for (uint8 i = 0; i < MAX_NPC_TEXT_OPTIONS; i++)
5390  {
5391  if (npcText.Data[i].BroadcastTextID)
5392  {
5393  if (!sBroadcastTextStore.LookupEntry(npcText.Data[i].BroadcastTextID))
5394  {
5395  TC_LOG_ERROR("sql.sql", "NPCText (ID: %u) has a non-existing or incompatible BroadcastText (ID: %u, Index: %u)", textID, npcText.Data[i].BroadcastTextID, i);
5396  npcText.Data[i].BroadcastTextID = 0;
5397  }
5398  }
5399  }
5400 
5401  for (uint8 i = 0; i < MAX_NPC_TEXT_OPTIONS; i++)
5402  {
5403  if (npcText.Data[i].Probability > 0 && npcText.Data[i].BroadcastTextID == 0)
5404  {
5405  TC_LOG_ERROR("sql.sql", "NPCText (ID: %u) has a probability (Index: %u) set, but no BroadcastTextID to go with it", textID, i);
5406  npcText.Data[i].Probability = 0;
5407  }
5408  }
5409  }
5410  while (result->NextRow());
5411 
5412  TC_LOG_INFO("server.loading", ">> Loaded %u npc texts in %u ms", uint32(_npcTextStore.size()), GetMSTimeDiffToNow(oldMSTime));
5413 }
NpcTextContainer _npcTextStore
Definition: ObjectMgr.h:1436
float GetFloat() const
Definition: Field.h:222
Definition: NPCHandler.h:30
DB2Storage< BroadcastTextEntry > sBroadcastTextStore("BroadcastText.db2", BroadcastTextFormat, HOTFIX_SEL_BROADCAST_TEXT)
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
#define MAX_NPC_TEXT_OPTIONS
Definition: NPCHandler.h:28
float Probability
Definition: NPCHandler.h:24
NpcTextData Data[MAX_NPC_TEXT_OPTIONS]
Definition: NPCHandler.h:32
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
uint32 BroadcastTextID
Definition: NPCHandler.h:25
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

void ObjectMgr::LoadPageTextLocales ( )
5173 {
5174  uint32 oldMSTime = getMSTime();
5175 
5176  _pageTextLocaleStore.clear(); // needed for reload case
5177 
5178  // 0 1 2
5179  QueryResult result = WorldDatabase.Query("SELECT ID, locale, Text FROM page_text_locale");
5180  if (!result)
5181  return;
5182 
5183  do
5184  {
5185  Field* fields = result->Fetch();
5186 
5187  uint32 id = fields[0].GetUInt32();
5188  std::string localeName = fields[1].GetString();
5189  std::string text = fields[2].GetString();
5190 
5192  LocaleConstant locale = GetLocaleByName(localeName);
5193  if (locale == LOCALE_enUS)
5194  continue;
5195 
5196  AddLocaleString(text, locale, data.Text);
5197  } while (result->NextRow());
5198 
5199  TC_LOG_INFO("server.loading", ">> Loaded %u PageText locale strings in %u ms", uint32(_pageTextLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
5200 }
PageTextLocaleContainer _pageTextLocaleStore
Definition: ObjectMgr.h:1537
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
LocaleConstant
Definition: Common.h:115
LocaleConstant GetLocaleByName(const std::string &name)
Definition: Common.cpp:37
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
StringVector Text
Definition: NPCHandler.h:37
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
static void AddLocaleString(std::string const &value, LocaleConstant localeConstant, StringVector &data)
Definition: ObjectMgr.cpp:295
Definition: Common.h:117
uint32 GetUInt32() const
Definition: Field.h:146
Definition: NPCHandler.h:35
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
uint32_t uint32
Definition: g3dmath.h:168
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

void ObjectMgr::LoadPageTexts ( )
5123 {
5124  uint32 oldMSTime = getMSTime();
5125 
5126  // 0 1 2
5127  QueryResult result = WorldDatabase.Query("SELECT ID, Text, NextPageID FROM page_text");
5128  if (!result)
5129  {
5130  TC_LOG_INFO("server.loading", ">> Loaded 0 page texts. DB table `page_text` is empty!");
5131  return;
5132  }
5133 
5134  uint32 count = 0;
5135  do
5136  {
5137  Field* fields = result->Fetch();
5138 
5139  uint32 id = fields[0].GetUInt32();
5140 
5141  PageText& pageText = _pageTextStore[id];
5142  pageText.Text = fields[1].GetString();
5143  pageText.NextPageID = fields[2].GetUInt32();
5144 
5145  ++count;
5146  }
5147  while (result->NextRow());
5148 
5149  for (PageTextContainer::const_iterator itr = _pageTextStore.begin(); itr != _pageTextStore.end(); ++itr)
5150  {
5151  if (itr->second.NextPageID)
5152  {
5153  PageTextContainer::const_iterator itr2 = _pageTextStore.find(itr->second.NextPageID);
5154  if (itr2 == _pageTextStore.end())
5155  TC_LOG_ERROR("sql.sql", "Page text (ID: %u) has non-existing `NextPageID` (%u)", itr->first, itr->second.NextPageID);
5156 
5157  }
5158  }
5159 
5160  TC_LOG_INFO("server.loading", ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
5161 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
PageTextContainer _pageTextStore
Definition: ObjectMgr.h:1477
std::string Text
Definition: ObjectMgr.h:57
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32 NextPageID
Definition: ObjectMgr.h:58
Definition: ObjectMgr.h:55
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

void ObjectMgr::LoadPetLevelInfo ( )
2889 {
2890  uint32 oldMSTime = getMSTime();
2891 
2892  // 0 1 2 3 4 5 6 7 8 9
2893  QueryResult result = WorldDatabase.Query("SELECT creature_entry, level, hp, mana, str, agi, sta, inte, spi, armor FROM pet_levelstats");
2894 
2895  if (!result)
2896  {
2897  TC_LOG_ERROR("server.loading", ">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty.");
2898  return;
2899  }
2900 
2901  uint32 count = 0;
2902 
2903  do
2904  {
2905  Field* fields = result->Fetch();
2906 
2907  uint32 creature_id = fields[0].GetUInt32();
2908  if (!sObjectMgr->GetCreatureTemplate(creature_id))
2909  {
2910  TC_LOG_ERROR("sql.sql", "Wrong creature id %u in `pet_levelstats` table, ignoring.", creature_id);
2911  continue;
2912  }
2913 
2914  uint32 current_level = fields[1].GetUInt8();
2915  if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
2916  {
2917  if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
2918  TC_LOG_ERROR("sql.sql", "Wrong (> %u) level %u in `pet_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level);
2919  else
2920  {
2921  TC_LOG_INFO("misc", "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.", current_level);
2922  ++count; // make result loading percent "expected" correct in case disabled detail mode for example.
2923  }
2924  continue;
2925  }
2926  else if (current_level < 1)
2927  {
2928  TC_LOG_ERROR("sql.sql", "Wrong (<1) level %u in `pet_levelstats` table, ignoring.", current_level);
2929  continue;
2930  }
2931 
2932  PetLevelInfo*& pInfoMapEntry = _petInfoStore[creature_id];
2933 
2934  if (pInfoMapEntry == NULL)
2935  pInfoMapEntry = new PetLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
2936 
2937  // data for level 1 stored in [0] array element, ...
2938  PetLevelInfo* pLevelInfo = &pInfoMapEntry[current_level-1];
2939 
2940  pLevelInfo->health = fields[2].GetUInt16();
2941  pLevelInfo->mana = fields[3].GetUInt16();
2942  pLevelInfo->armor = fields[9].GetUInt32();
2943 
2944  for (int i = 0; i < MAX_STATS; i++)
2945  {
2946  pLevelInfo->stats[i] = fields[i+4].GetUInt16();
2947  }
2948 
2949  ++count;
2950  }
2951  while (result->NextRow());
2952 
2953  // Fill gaps and check integrity
2954  for (PetLevelInfoContainer::iterator itr = _petInfoStore.begin(); itr != _petInfoStore.end(); ++itr)
2955  {
2956  PetLevelInfo* pInfo = itr->second;
2957 
2958  // fatal error if no level 1 data
2959  if (!pInfo || pInfo[0].health == 0)
2960  {
2961  TC_LOG_ERROR("sql.sql", "Creature %u does not have pet stats data for Level 1!", itr->first);
2962  exit(1);
2963  }
2964 
2965  // fill level gaps
2966  for (uint8 level = 1; level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
2967  {
2968  if (pInfo[level].health == 0)
2969  {
2970  TC_LOG_ERROR("sql.sql", "Creature %u has no data for Level %i pet stats data, using data of Level %i.", itr->first, level + 1, level);
2971  pInfo[level] = pInfo[level - 1];
2972  }
2973  }
2974  }
2975 
2976  TC_LOG_INFO("server.loading", ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
2977 }
uint16 mana
Definition: ObjectMgr.h:451
Definition: ObjectMgr.h:445
uint16 stats[MAX_STATS]
Definition: ObjectMgr.h:449
uint16 armor
Definition: ObjectMgr.h:452
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: DBCEnums.h:54
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
#define sWorld
Definition: World.h:887
#define sObjectMgr
Definition: ObjectMgr.h:1567
#define MAX_STATS
Definition: SharedDefines.h:244
uint8 GetUInt8() const
Definition: Field.h:70
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint16 GetUInt16() const
Definition: Field.h:108
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
PetLevelInfoContainer _petInfoStore
Definition: ObjectMgr.h:1496
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint16 health
Definition: ObjectMgr.h:450
Definition: World.h:235

+ Here is the call graph for this function:

void ObjectMgr::LoadPetNames ( )
6820 {
6821  uint32 oldMSTime = getMSTime();
6822  // 0 1 2
6823  QueryResult result = WorldDatabase.Query("SELECT word, entry, half FROM pet_name_generation");
6824 
6825  if (!result)
6826  {
6827  TC_LOG_INFO("server.loading", ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!");
6828  return;
6829  }
6830 
6831  uint32 count = 0;
6832 
6833  do
6834  {
6835  Field* fields = result->Fetch();
6836  std::string word = fields[0].GetString();
6837  uint32 entry = fields[1].GetUInt32();
6838  bool half = fields[2].GetBool();
6839  if (half)
6840  _petHalfName1[entry].push_back(word);
6841  else
6842  _petHalfName0[entry].push_back(word);
6843  ++count;
6844  }
6845  while (result->NextRow());
6846 
6847  TC_LOG_INFO("server.loading", ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
6848 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
HalfNameContainer _petHalfName0
Definition: ObjectMgr.h:1513
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
bool GetBool() const
Definition: Field.h:65
std::string GetString() const
Definition: Field.h:276
HalfNameContainer _petHalfName1
Definition: ObjectMgr.h:1514

+ Here is the call graph for this function:

void ObjectMgr::LoadPetNumber ( )
6851 {
6852  uint32 oldMSTime = getMSTime();
6853 
6854  QueryResult result = CharacterDatabase.Query("SELECT MAX(id) FROM character_pet");
6855  if (result)
6856  {
6857  Field* fields = result->Fetch();
6858  _hiPetNumber = fields[0].GetUInt32()+1;
6859  }
6860 
6861  TC_LOG_INFO("server.loading", ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime));
6862 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
uint32 _hiPetNumber
Definition: ObjectMgr.h:1408
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201

+ Here is the call graph for this function:

void ObjectMgr::LoadPlayerInfo ( )
3026 {
3027  // Load playercreate
3028  {
3029  uint32 oldMSTime = getMSTime();
3030  // 0 1 2 3 4 5 6
3031  QueryResult result = WorldDatabase.Query("SELECT race, class, map, zone, position_x, position_y, position_z, orientation FROM playercreateinfo");
3032 
3033  if (!result)
3034  {
3035  TC_LOG_ERROR("server.loading", ">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty.");
3036  exit(1);
3037  }
3038  else
3039  {
3040  uint32 count = 0;
3041 
3042  do
3043  {
3044  Field* fields = result->Fetch();
3045 
3046  uint32 current_race = fields[0].GetUInt8();
3047  uint32 current_class = fields[1].GetUInt8();
3048  uint32 mapId = fields[2].GetUInt16();
3049  uint32 areaId = fields[3].GetUInt32(); // zone
3050  float positionX = fields[4].GetFloat();
3051  float positionY = fields[5].GetFloat();
3052  float positionZ = fields[6].GetFloat();
3053  float orientation = fields[7].GetFloat();
3054 
3055  if (current_race >= MAX_RACES)
3056  {
3057  TC_LOG_ERROR("sql.sql", "Wrong race %u in `playercreateinfo` table, ignoring.", current_race);
3058  continue;
3059  }
3060 
3061  ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race);
3062  if (!rEntry)
3063  {
3064  TC_LOG_ERROR("sql.sql", "Wrong race %u in `playercreateinfo` table, ignoring.", current_race);
3065  continue;
3066  }
3067 
3068  if (current_class >= MAX_CLASSES)
3069  {
3070  TC_LOG_ERROR("sql.sql", "Wrong class %u in `playercreateinfo` table, ignoring.", current_class);
3071  continue;
3072  }
3073 
3074  if (!sChrClassesStore.LookupEntry(current_class))
3075  {
3076  TC_LOG_ERROR("sql.sql", "Wrong class %u in `playercreateinfo` table, ignoring.", current_class);
3077  continue;
3078  }
3079 
3080  // accept DB data only for valid position (and non instanceable)
3081  if (!MapManager::IsValidMapCoord(mapId, positionX, positionY, positionZ, orientation))
3082  {
3083  TC_LOG_ERROR("sql.sql", "Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race);
3084  continue;
3085  }
3086 
3087  if (sMapStore.LookupEntry(mapId)->Instanceable())
3088  {
3089  TC_LOG_ERROR("sql.sql", "Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race);
3090  continue;
3091  }
3092 
3093  PlayerInfo* info = new PlayerInfo();
3094  info->mapId = mapId;
3095  info->areaId = areaId;
3096  info->positionX = positionX;
3097  info->positionY = positionY;
3098  info->positionZ = positionZ;
3099  info->orientation = orientation;
3100  info->displayId_m = rEntry->MaleDisplayID;
3101  info->displayId_f = rEntry->FemaleDisplayID;
3102  _playerInfo[current_race][current_class] = info;
3103 
3104  ++count;
3105  }
3106  while (result->NextRow());
3107 
3108  TC_LOG_INFO("server.loading", ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
3109  }
3110  }
3111 
3112  // Load playercreate items
3113  TC_LOG_INFO("server.loading", "Loading Player Create Items Data...");
3114  {
3115  uint32 oldMSTime = getMSTime();
3116  // 0 1 2 3
3117  QueryResult result = WorldDatabase.Query("SELECT race, class, itemid, amount FROM playercreateinfo_item");
3118 
3119  if (!result)
3120  {
3121  TC_LOG_INFO("server.loading", ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty.");
3122  }
3123  else
3124  {
3125  uint32 count = 0;
3126 
3127  do
3128  {
3129  Field* fields = result->Fetch();
3130 
3131  uint32 current_race = fields[0].GetUInt8();
3132  if (current_race >= MAX_RACES)
3133  {
3134  TC_LOG_ERROR("sql.sql", "Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race);
3135  continue;
3136  }
3137 
3138  uint32 current_class = fields[1].GetUInt8();
3139  if (current_class >= MAX_CLASSES)
3140  {
3141  TC_LOG_ERROR("sql.sql", "Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class);
3142  continue;
3143  }
3144 
3145  uint32 item_id = fields[2].GetUInt32();
3146 
3147  if (!GetItemTemplate(item_id))
3148  {
3149  TC_LOG_ERROR("sql.sql", "Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.", item_id, current_race, current_class);
3150  continue;
3151  }
3152 
3153  int32 amount = fields[3].GetInt8();
3154 
3155  if (!amount)
3156  {
3157  TC_LOG_ERROR("sql.sql", "Item id %u (class %u race %u) have amount == 0 in `playercreateinfo_item` table, ignoring.", item_id, current_race, current_class);
3158  continue;
3159  }
3160 
3161  if (!current_race || !current_class)
3162  {
3163  uint32 min_race = current_race ? current_race : 1;
3164  uint32 max_race = current_race ? current_race + 1 : MAX_RACES;
3165  uint32 min_class = current_class ? current_class : 1;
3166  uint32 max_class = current_class ? current_class + 1 : MAX_CLASSES;
3167  for (uint32 r = min_race; r < max_race; ++r)
3168  for (uint32 c = min_class; c < max_class; ++c)
3169  PlayerCreateInfoAddItemHelper(r, c, item_id, amount);
3170  }
3171  else
3172  PlayerCreateInfoAddItemHelper(current_race, current_class, item_id, amount);
3173 
3174  ++count;
3175  }
3176  while (result->NextRow());
3177 
3178  TC_LOG_INFO("server.loading", ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
3179  }
3180  }
3181 
3182  // Load playercreate skills
3183  TC_LOG_INFO("server.loading", "Loading Player Create Skill Data...");
3184  {
3185  uint32 oldMSTime = getMSTime();
3186 
3188  if (rcInfo->Availability == 1)
3189  for (uint32 raceIndex = RACE_HUMAN; raceIndex < MAX_RACES; ++raceIndex)
3190  if (rcInfo->RaceMask == -1 || ((1 << (raceIndex - 1)) & rcInfo->RaceMask))
3191  for (uint32 classIndex = CLASS_WARRIOR; classIndex < MAX_CLASSES; ++classIndex)
3192  if (rcInfo->ClassMask == -1 || ((1 << (classIndex - 1)) & rcInfo->ClassMask))
3193  if (PlayerInfo* info = _playerInfo[raceIndex][classIndex])
3194  info->skills.push_back(rcInfo);
3195 
3196  TC_LOG_INFO("server.loading", ">> Loaded player create skills in %u ms", GetMSTimeDiffToNow(oldMSTime));
3197  }
3198 
3199  // Load playercreate custom spells
3200  TC_LOG_INFO("server.loading", "Loading Player Create Custom Spell Data...");
3201  {
3202  uint32 oldMSTime = getMSTime();
3203 
3204  QueryResult result = WorldDatabase.PQuery("SELECT racemask, classmask, Spell FROM playercreateinfo_spell_custom");
3205 
3206  if (!result)
3207  {
3208  TC_LOG_ERROR("server.loading", ">> Loaded 0 player create custom spells. DB table `playercreateinfo_spell_custom` is empty.");
3209  }
3210  else
3211  {
3212  uint32 count = 0;
3213 
3214  do
3215  {
3216  Field* fields = result->Fetch();
3217  uint32 raceMask = fields[0].GetUInt32();
3218  uint32 classMask = fields[1].GetUInt32();
3219  uint32 spellId = fields[2].GetUInt32();
3220 
3221  if (raceMask != 0 && !(raceMask & RACEMASK_ALL_PLAYABLE))
3222  {
3223  TC_LOG_ERROR("sql.sql", "Wrong race mask %u in `playercreateinfo_spell_custom` table, ignoring.", raceMask);
3224  continue;
3225  }
3226 
3227  if (classMask != 0 && !(classMask & CLASSMASK_ALL_PLAYABLE))
3228  {
3229  TC_LOG_ERROR("sql.sql", "Wrong class mask %u in `playercreateinfo_spell_custom` table, ignoring.", classMask);
3230  continue;
3231  }
3232 
3233  for (uint32 raceIndex = RACE_HUMAN; raceIndex < MAX_RACES; ++raceIndex)
3234  {
3235  if (raceMask == 0 || ((1 << (raceIndex - 1)) & raceMask))
3236  {
3237  for (uint32 classIndex = CLASS_WARRIOR; classIndex < MAX_CLASSES; ++classIndex)
3238  {
3239  if (classMask == 0 || ((1 << (classIndex - 1)) & classMask))
3240  {
3241  if (PlayerInfo* info = _playerInfo[raceIndex][classIndex])
3242  {
3243  info->customSpells.push_back(spellId);
3244  ++count;
3245  }
3246  // We need something better here, the check is not accounting for spells used by multiple races/classes but not all of them.
3247  // Either split the masks per class, or per race, which kind of kills the point yet.
3248  // else if (raceMask != 0 && classMask != 0)
3249  // TC_LOG_ERROR("sql.sql", "Racemask/classmask (%u/%u) combination was found containing an invalid race/class combination (%u/%u) in `%s` (Spell %u), ignoring.", raceMask, classMask, raceIndex, classIndex, tableName.c_str(), spellId);
3250  }
3251  }
3252  }
3253  }
3254  }
3255  while (result->NextRow());
3256 
3257  TC_LOG_INFO("server.loading", ">> Loaded %u custom player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
3258  }
3259  }
3260 
3261  // Load playercreate cast spell
3262  TC_LOG_INFO("server.loading", "Loading Player Create Cast Spell Data...");
3263  {
3264  uint32 oldMSTime = getMSTime();
3265 
3266  QueryResult result = WorldDatabase.PQuery("SELECT raceMask, classMask, spell FROM playercreateinfo_cast_spell");
3267 
3268  if (!result)
3269  TC_LOG_ERROR("server.loading", ">> Loaded 0 player create cast spells. DB table `playercreateinfo_cast_spell` is empty.");
3270  else
3271  {
3272  uint32 count = 0;
3273 
3274  do
3275  {
3276  Field* fields = result->Fetch();
3277  uint32 raceMask = fields[0].GetUInt32();
3278  uint32 classMask = fields[1].GetUInt32();
3279  uint32 spellId = fields[2].GetUInt32();
3280 
3281  if (raceMask != 0 && !(raceMask & RACEMASK_ALL_PLAYABLE))
3282  {
3283  TC_LOG_ERROR("sql.sql", "Wrong race mask %u in `playercreateinfo_cast_spell` table, ignoring.", raceMask);
3284  continue;
3285  }
3286 
3287  if (classMask != 0 && !(classMask & CLASSMASK_ALL_PLAYABLE))
3288  {
3289  TC_LOG_ERROR("sql.sql", "Wrong class mask %u in `playercreateinfo_cast_spell` table, ignoring.", classMask);
3290  continue;
3291  }
3292 
3293  for (uint32 raceIndex = RACE_HUMAN; raceIndex < MAX_RACES; ++raceIndex)
3294  {
3295  if (raceMask == 0 || ((1 << (raceIndex - 1)) & raceMask))
3296  {
3297  for (uint32 classIndex = CLASS_WARRIOR; classIndex < MAX_CLASSES; ++classIndex)
3298  {
3299  if (classMask == 0 || ((1 << (classIndex - 1)) & classMask))
3300  {
3301  if (PlayerInfo* info = _playerInfo[raceIndex][classIndex])
3302  {
3303  info->castSpells.push_back(spellId);
3304  ++count;
3305  }
3306  }
3307  }
3308  }
3309  }
3310  } while (result->NextRow());
3311 
3312  TC_LOG_INFO("server.loading", ">> Loaded %u player create cast spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
3313  }
3314  }
3315 
3316  // Load playercreate actions
3317  TC_LOG_INFO("server.loading", "Loading Player Create Action Data...");
3318  {
3319  uint32 oldMSTime = getMSTime();
3320 
3321  // 0 1 2 3 4
3322  QueryResult result = WorldDatabase.Query("SELECT race, class, button, action, type FROM playercreateinfo_action");
3323 
3324  if (!result)
3325  {
3326  TC_LOG_ERROR("server.loading", ">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty.");
3327  }
3328  else
3329  {
3330  uint32 count = 0;
3331 
3332  do
3333  {
3334  Field* fields = result->Fetch();
3335 
3336  uint32 current_race = fields[0].GetUInt8();
3337  if (current_race >= MAX_RACES)
3338  {
3339  TC_LOG_ERROR("sql.sql", "Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race);
3340  continue;
3341  }
3342 
3343  uint32 current_class = fields[1].GetUInt8();
3344  if (current_class >= MAX_CLASSES)
3345  {
3346  TC_LOG_ERROR("sql.sql", "Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class);
3347  continue;
3348  }
3349 
3350  if (PlayerInfo* info = _playerInfo[current_race][current_class])
3351  info->action.push_back(PlayerCreateInfoAction(fields[2].GetUInt16(), fields[3].GetUInt32(), fields[4].GetUInt16()));
3352 
3353  ++count;
3354  }
3355  while (result->NextRow());
3356 
3357  TC_LOG_INFO("server.loading", ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
3358  }
3359  }
3360 
3361  // Loading levels data (class/race dependent)
3362  TC_LOG_INFO("server.loading", "Loading Player Create Level Stats Data...");
3363  {
3364  uint32 oldMSTime = getMSTime();
3365 
3366  // 0 1 2 3 4 5 6 7
3367  QueryResult result = WorldDatabase.Query("SELECT race, class, level, str, agi, sta, inte, spi FROM player_levelstats");
3368 
3369  if (!result)
3370  {
3371  TC_LOG_ERROR("server.loading", ">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty.");
3372  exit(1);
3373  }
3374 
3375  uint32 count = 0;
3376 
3377  do
3378  {
3379  Field* fields = result->Fetch();
3380 
3381  uint32 current_race = fields[0].GetUInt8();
3382  if (current_race >= MAX_RACES)
3383  {
3384  TC_LOG_ERROR("sql.sql", "Wrong race %u in `player_levelstats` table, ignoring.", current_race);
3385  continue;
3386  }
3387 
3388  uint32 current_class = fields[1].GetUInt8();
3389  if (current_class >= MAX_CLASSES)
3390  {
3391  TC_LOG_ERROR("sql.sql", "Wrong class %u in `player_levelstats` table, ignoring.", current_class);
3392  continue;
3393  }
3394 
3395  uint32 current_level = fields[2].GetUInt8();
3396  if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
3397  {
3398  if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
3399  TC_LOG_ERROR("sql.sql", "Wrong (> %u) level %u in `player_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level);
3400  else
3401  {
3402  TC_LOG_INFO("misc", "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_levelstats` table, ignoring.", current_level);
3403  ++count; // make result loading percent "expected" correct in case disabled detail mode for example.
3404  }
3405  continue;
3406  }
3407 
3408  if (PlayerInfo* info = _playerInfo[current_race][current_class])
3409  {
3410  if (!info->levelInfo)
3411  info->levelInfo = new PlayerLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
3412 
3413  PlayerLevelInfo& levelInfo = info->levelInfo[current_level - 1];
3414  for (int i = 0; i < MAX_STATS; i++)
3415  levelInfo.stats[i] = fields[i + 3].GetUInt16();
3416  }
3417 
3418  ++count;
3419  }
3420  while (result->NextRow());
3421 
3422  // Fill gaps and check integrity
3423  for (int race = 0; race < MAX_RACES; ++race)
3424  {
3425  // skip non existed races
3426  if (!sChrRacesStore.LookupEntry(race))
3427  continue;
3428 
3429  for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
3430  {
3431  // skip non existed classes
3432  if (!sChrClassesStore.LookupEntry(class_))
3433  continue;
3434 
3435  PlayerInfo* info = _playerInfo[race][class_];
3436  if (!info)
3437  continue;
3438 
3439  // skip expansion races if not playing with expansion
3440  if (sWorld->getIntConfig(CONFIG_EXPANSION) < EXPANSION_THE_BURNING_CRUSADE && (race == RACE_BLOODELF || race == RACE_DRAENEI))
3441  continue;
3442 
3443  // skip expansion classes if not playing with expansion
3445  continue;
3446 
3447  // skip expansion races if not playing with expansion
3448  if (sWorld->getIntConfig(CONFIG_EXPANSION) < EXPANSION_CATACLYSM && (race == RACE_GOBLIN || race == RACE_WORGEN))
3449  continue;
3450 
3451  // fatal error if no level 1 data
3452  if (!info->levelInfo || info->levelInfo[0].stats[0] == 0)
3453  {
3454  TC_LOG_ERROR("sql.sql", "Race %i Class %i Level 1 does not have stats data!", race, class_);
3455  exit(1);
3456  }
3457 
3458  // fill level gaps
3459  for (uint8 level = 1; level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
3460  {
3461  if (info->levelInfo[level].stats[0] == 0)
3462  {
3463  TC_LOG_ERROR("sql.sql", "Race %i Class %i Level %i does not have stats data. Using stats data of level %i.", race, class_, level + 1, level);
3464  info->levelInfo[level] = info->levelInfo[level - 1];
3465  }
3466  }
3467  }
3468  }
3469 
3470  TC_LOG_INFO("server.loading", ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
3471  }
3472 
3473  // Loading xp per level data
3474  TC_LOG_INFO("server.loading", "Loading Player Create XP Data...");
3475  {
3476  uint32 oldMSTime = getMSTime();
3477 
3478  _playerXPperLevel.resize(sGtOCTLevelExperienceStore.GetTableRowCount() + 1, 0);
3479 
3480  // 0 1
3481  QueryResult result = WorldDatabase.Query("SELECT Level, Experience FROM player_xp_for_level");
3482 
3483  // load the DBC's levels at first...
3485  for (uint32 level = 0; level < sGtOCTLevelExperienceStore.GetTableRowCount(); ++level)
3486  {
3487  exp = sGtOCTLevelExperienceStore.EvaluateTable(level, 0);
3488  _playerXPperLevel[level + 1] = exp->Data;
3489  }
3490 
3491  uint32 count = 0;
3492 
3493  // ...overwrite if needed (custom values)
3494  if (result)
3495  {
3496  do
3497  {
3498  Field* fields = result->Fetch();
3499 
3500  uint32 current_level = fields[0].GetUInt8();
3501  uint32 current_xp = fields[1].GetUInt32();
3502 
3503  if (current_level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
3504  {
3505  if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
3506  TC_LOG_ERROR("sql.sql", "Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level);
3507  else
3508  {
3509  TC_LOG_INFO("misc", "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_xp_for_level` table, ignoring.", current_level);
3510  ++count; // make result loading percent "expected" correct in case disabled detail mode for example.
3511  }
3512  continue;
3513  }
3514  //PlayerXPperLevel
3515  _playerXPperLevel[current_level] = current_xp;
3516  ++count;
3517  } while (result->NextRow());
3518  }
3519 
3520  // fill level gaps - only accounting levels > MAX_LEVEL
3521  for (uint8 level = 1; level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
3522  {
3523  if (_playerXPperLevel[level] == 0)
3524  {
3525  TC_LOG_ERROR("sql.sql", "Level %i does not have XP for level data. Using data of level [%i] + 12000.", level + 1, level);
3526  _playerXPperLevel[level] = _playerXPperLevel[level - 1] + 12000;
3527  }
3528  }
3529 
3530  TC_LOG_INFO("server.loading", ">> Loaded %u xp for level definition(s) from database in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
3531  }
3532 }
Quat exp(const Quat &q)
Definition: Quat.h:729
Definition: SharedDefines.h:110
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesfmt)
Definition: SharedDefines.h:172
DBCStorage< ChrClassesEntry > sChrClassesStore(ChrClassesfmt)
Definition: DBCStructure.h:204
Definition: SharedDefines.h:80
float GetFloat() const
Definition: Field.h:222
QueryResult PQuery(Format &&sql, T *conn, Args &&...args)
Definition: DatabaseWorkerPool.h:165
void PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint32 itemId, int32 count)
Definition: ObjectMgr.cpp:2991
Class used to access individual fields of database query result.
Definition: Field.h:56
float Data
Definition: DBCStructure.h:594
float positionZ
Definition: Player.h:405
uint32 areaId
Definition: Player.h:402
uint32 getMSTime()
Definition: Timer.h:24
float orientation
Definition: Player.h:406
Definition: Player.h:396
Definition: SharedDefines.h:112
Definition: DBCEnums.h:54
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
PlayerLevelInfo * levelInfo
Definition: Player.h:415
float positionY
Definition: Player.h:404
#define sWorld
Definition: World.h:887
float positionX
Definition: Player.h:403
Definition: SharedDefines.h:81
uint16 stats[MAX_STATS]
Definition: Player.h:377
DBCStorage< SkillRaceClassInfoEntry > sSkillRaceClassInfoStore(SkillRaceClassInfofmt)
#define MAX_STATS
Definition: SharedDefines.h:244
Definition: SharedDefines.h:167
uint8 GetUInt8() const
Definition: Field.h:70
Definition: Player.h:382
uint32 MaleDisplayID
Definition: DBCStructure.h:210
Definition: SharedDefines.h:123
Definition: SharedDefines.h:82
int32_t int32
Definition: Define.h:146
#define CLASSMASK_ALL_PLAYABLE
Definition: SharedDefines.h:183
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:102
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 FemaleDisplayID
Definition: DBCStructure.h:211
uint16 GetUInt16() const
Definition: Field.h:108
Definition: DBCStructure.h:982
uint16 displayId_m
Definition: Player.h:407
PlayerXPperLevel _playerXPperLevel
Definition: ObjectMgr.h:1503
uint32 mapId
Definition: Player.h:401
#define MAX_CLASSES
Definition: SharedDefines.h:181
Definition: World.h:278
#define MAX_RACES
Definition: SharedDefines.h:131
GameTable< GtOCTLevelExperienceEntry > sGtOCTLevelExperienceStore(GtOCTLevelExperiencefmt)
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
DBCStorage< MapEntry > sMapStore(Mapfmt)
static bool IsValidMapCoord(uint32 mapid, float x, float y)
Definition: MapManager.h:83
#define RACEMASK_ALL_PLAYABLE
Definition: SharedDefines.h:133
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
PlayerInfo * _playerInfo[MAX_RACES][MAX_CLASSES]
Definition: ObjectMgr.h:1500
Definition: SharedDefines.h:111
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
int8 GetInt8() const
Definition: Field.h:89
ItemTemplate const * GetItemTemplate(uint32 entry)
Definition: ObjectMgr.cpp:2782
Definition: DBCStructure.h:592
Definition: Player.h:373
Definition: World.h:235
uint16 displayId_f
Definition: Player.h:408

+ Here is the call graph for this function:

void ObjectMgr::LoadPointOfInterestLocales ( )
382 {
383  uint32 oldMSTime = getMSTime();
384 
385  _pointOfInterestLocaleStore.clear(); // need for reload case
386 
387  // 0 1 2
388  QueryResult result = WorldDatabase.Query("SELECT ID, locale, Name FROM points_of_interest_locale");
389  if (!result)
390  return;
391 
392  do
393  {
394  Field* fields = result->Fetch();
395 
396  uint32 id = fields[0].GetUInt32();
397  std::string localeName = fields[1].GetString();
398  std::string name = fields[2].GetString();
399 
401  LocaleConstant locale = GetLocaleByName(localeName);
402  if (locale == LOCALE_enUS)
403  continue;
404 
405  AddLocaleString(name, locale, data.Name);
406  } while (result->NextRow());
407 
408  TC_LOG_INFO("server.loading", ">> Loaded %u points_of_interest locale strings in %u ms", uint32(_pointOfInterestLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
409 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
Definition: Creature.h:272
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
LocaleConstant
Definition: Common.h:115
StringVector Name
Definition: Creature.h:274
LocaleConstant GetLocaleByName(const std::string &name)
Definition: Common.cpp:37
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
PointOfInterestLocaleContainer _pointOfInterestLocaleStore
Definition: ObjectMgr.h:1539
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
static void AddLocaleString(std::string const &value, LocaleConstant localeConstant, StringVector &data)
Definition: ObjectMgr.cpp:295
Definition: Common.h:117
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
uint32_t uint32
Definition: g3dmath.h:168
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

void ObjectMgr::LoadPointsOfInterest ( )
7141 {
7142  uint32 oldMSTime = getMSTime();
7143 
7144  _pointsOfInterestStore.clear(); // need for reload case
7145 
7146  uint32 count = 0;
7147 
7148  // 0 1 2 3 4 5 6
7149  QueryResult result = WorldDatabase.Query("SELECT ID, PositionX, PositionY, Icon, Flags, Importance, Name FROM points_of_interest");
7150 
7151  if (!result)
7152  {
7153  TC_LOG_ERROR("server.loading", ">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty.");
7154  return;
7155  }
7156 
7157  do
7158  {
7159  Field* fields = result->Fetch();
7160 
7161  uint32 id = fields[0].GetUInt32();
7162 
7163  PointOfInterest pointOfInterest;
7164  pointOfInterest.ID = id;
7165  pointOfInterest.Pos.x = fields[1].GetFloat();
7166  pointOfInterest.Pos.y = fields[2].GetFloat();
7167  pointOfInterest.Icon = fields[3].GetUInt32();
7168  pointOfInterest.Flags = fields[4].GetUInt32();
7169  pointOfInterest.Importance = fields[5].GetUInt32();
7170  pointOfInterest.Name = fields[6].GetString();
7171 
7172  if (!Trinity::IsValidMapCoord(pointOfInterest.Pos.x, pointOfInterest.Pos.y))
7173  {
7174  TC_LOG_ERROR("sql.sql", "Table `points_of_interest` (ID: %u) have invalid coordinates (PositionX: %f PositionY: %f), ignored.", id, pointOfInterest.Pos.x, pointOfInterest.Pos.y);
7175  continue;
7176  }
7177 
7178  _pointsOfInterestStore[id] = pointOfInterest;
7179 
7180  ++count;
7181  } while (result->NextRow());
7182 
7183  TC_LOG_INFO("server.loading", ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
7184 }
PointOfInterestContainer _pointsOfInterestStore
Definition: ObjectMgr.h:1449
uint32 Flags
Definition: ObjectMgr.h:505
float GetFloat() const
Definition: Field.h:222
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
float y
Definition: Vector2.h:50
bool IsValidMapCoord(float c)
Definition: GridDefines.h:218
uint32 ID
Definition: ObjectMgr.h:502
uint32 Importance
Definition: ObjectMgr.h:506
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
std::string Name
Definition: ObjectMgr.h:507
float x
Definition: Vector2.h:49
Definition: ObjectMgr.h:500
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32 Icon
Definition: ObjectMgr.h:504
std::string GetString() const
Definition: Field.h:276
G3D::Vector2 Pos
Definition: ObjectMgr.h:503

+ Here is the call graph for this function:

void ObjectMgr::LoadQuestAreaTriggers ( )
5545 {
5546  uint32 oldMSTime = getMSTime();
5547 
5548  _questAreaTriggerStore.clear(); // need for reload case
5549 
5550  QueryResult result = WorldDatabase.Query("SELECT id, quest FROM areatrigger_involvedrelation");
5551 
5552  if (!result)
5553  {
5554  TC_LOG_INFO("server.loading", ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty.");
5555  return;
5556  }
5557 
5558  uint32 count = 0;
5559 
5560  do
5561  {
5562  ++count;
5563 
5564  Field* fields = result->Fetch();
5565 
5566  uint32 trigger_ID = fields[0].GetUInt32();
5567  uint32 quest_ID = fields[1].GetUInt32();
5568 
5569  AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(trigger_ID);
5570  if (!atEntry)
5571  {
5572  TC_LOG_ERROR("sql.sql", "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", trigger_ID);
5573  continue;
5574  }
5575 
5576  Quest const* quest = GetQuestTemplate(quest_ID);
5577 
5578  if (!quest)
5579  {
5580  TC_LOG_ERROR("sql.sql", "Table `areatrigger_involvedrelation` has record (id: %u) for not existing quest %u", trigger_ID, quest_ID);
5581  continue;
5582  }
5583 
5585  {
5586  TC_LOG_ERROR("sql.sql", "Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.", trigger_ID, quest_ID);
5587 
5588  // this will prevent quest completing without objective
5589  const_cast<Quest*>(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT);
5590 
5591  // continue; - quest modified to required objective and trigger can be allowed.
5592  }
5593 
5594  _questAreaTriggerStore[trigger_ID].insert(quest_ID);
5595 
5596  } while (result->NextRow());
5597 
5598  TC_LOG_INFO("server.loading", ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
5599 }
Definition: QuestDef.h:279
Quest const * GetQuestTemplate(uint32 quest_id) const
Definition: ObjectMgr.h:815
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerfmt)
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
bool HasSpecialFlag(uint32 flag) const
Definition: QuestDef.h:300
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
Definition: DBCStructure.h:74
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
QuestAreaTriggerContainer _questAreaTriggerStore
Definition: ObjectMgr.h:1433

+ Here is the call graph for this function:

void ObjectMgr::LoadQuestGreetings ( )
5615 {
5616  uint32 oldMSTime = getMSTime();
5617 
5618  _questGreetingStore.clear(); // need for reload case
5619 
5620  // 0 1 2 3
5621  QueryResult result = WorldDatabase.Query("SELECT ID, type, GreetEmoteType, GreetEmoteDelay, Greeting FROM quest_greeting");
5622  if (!result)
5623  {
5624  TC_LOG_INFO("server.loading", ">> Loaded 0 npc texts, table is empty!");
5625  return;
5626  }
5627 
5628  _questGreetingStore.rehash(result->GetRowCount());
5629 
5630  do
5631  {
5632  Field* fields = result->Fetch();
5633 
5634  uint32 id = fields[0].GetUInt32();
5635  uint8 type = fields[1].GetUInt8();
5636  // overwrite
5637  switch (type)
5638  {
5639  case 0: // Creature
5640  type = TYPEID_UNIT;
5641  if (!sObjectMgr->GetCreatureTemplate(id))
5642  {
5643  TC_LOG_ERROR("sql.sql", "Table `quest_greeting`: creature template entry %u does not exist.", id);
5644  continue;
5645  }
5646  break;
5647  case 1: // GameObject
5648  type = TYPEID_GAMEOBJECT;
5649  if (!sObjectMgr->GetGameObjectTemplate(id))
5650  {
5651  TC_LOG_ERROR("sql.sql", "Table `quest_greeting`: gameobject template entry %u does not exist.", id);
5652  continue;
5653  }
5654  break;
5655  default:
5656  continue;
5657  }
5658 
5659  uint16 greetEmoteType = fields[2].GetUInt16();
5660  uint32 greetEmoteDelay = fields[3].GetUInt32();
5661  std::string greeting = fields[4].GetString();
5662 
5663  _questGreetingStore[type][id] = new QuestGreeting(greetEmoteType, greetEmoteDelay, greeting);
5664  }
5665  while (result->NextRow());
5666 
5667  TC_LOG_INFO("server.loading", ">> Loaded %u quest_greeting in %u ms", uint32(_questGreetingStore.size()), GetMSTimeDiffToNow(oldMSTime));
5668 }
QuestGreetingContainer _questGreetingStore
Definition: ObjectMgr.h:1437
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
Definition: ObjectGuid.h:32
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint8 GetUInt8() const
Definition: Field.h:70
Definition: ObjectGuid.h:34
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint16_t uint16
Definition: Define.h:151
uint16 GetUInt16() const
Definition: Field.h:108
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
Definition: ObjectMgr.h:576
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

void ObjectMgr::LoadQuestObjectivesLocale ( )
4548 {
4549  uint32 oldMSTime = getMSTime();
4550 
4551  _questObjectivesLocaleStore.clear(); // need for reload case
4552  // 0 1 2
4553  QueryResult result = WorldDatabase.Query("SELECT Id, locale, Description FROM quest_objectives_locale");
4554  if (!result)
4555  return;
4556 
4557  do
4558  {
4559  Field* fields = result->Fetch();
4560 
4561  uint32 id = fields[0].GetUInt32();
4562  std::string localeName = fields[1].GetString();
4563 
4564  std::string Description = fields[2].GetString();
4565 
4567  LocaleConstant locale = GetLocaleByName(localeName);
4568  if (locale == LOCALE_enUS)
4569  continue;
4570 
4571  AddLocaleString(Description, locale, data.Description);
4572  }
4573  while (result->NextRow());
4574 
4575  TC_LOG_INFO("server.loading", ">> Loaded %u Quest Objectives locale strings in %u ms", uint32(_questObjectivesLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
4576 }
QuestObjectivesLocaleContainer _questObjectivesLocaleStore
Definition: ObjectMgr.h:1536
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
StringVector Description
Definition: QuestDef.h:258
LocaleConstant
Definition: Common.h:115
LocaleConstant GetLocaleByName(const std::string &name)
Definition: Common.cpp:37
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
static void AddLocaleString(std::string const &value, LocaleConstant localeConstant, StringVector &data)
Definition: ObjectMgr.cpp:295
Definition: Common.h:117
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
uint32_t uint32
Definition: g3dmath.h:168
std::string GetString() const
Definition: Field.h:276
Definition: QuestDef.h:256

+ Here is the call graph for this function:

void ObjectMgr::LoadQuestPOI ( )
7187 {
7188  uint32 oldMSTime = getMSTime();
7189 
7190  _questPOIStore.clear(); // need for reload case
7191 
7192  uint32 count = 0;
7193 
7194  // 0 1 2 3 4 5 6 7 8 9 10 11 12 13
7195  QueryResult result = WorldDatabase.Query("SELECT QuestID, BlobIndex, Idx1, ObjectiveIndex, QuestObjectiveID, QuestObjectID, MapID, WorldMapAreaId, Floor, Priority, Flags, WorldEffectID, PlayerConditionID, WoDUnk1 FROM quest_poi order by QuestID, Idx1");
7196  if (!result)
7197  {
7198  TC_LOG_ERROR("server.loading", ">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty.");
7199  return;
7200  }
7201 
7202  // 0 1 2 3
7203  QueryResult points = WorldDatabase.Query("SELECT QuestID, Idx1, X, Y FROM quest_poi_points ORDER BY QuestID DESC, Idx1, Idx2");
7204 
7205  std::vector<std::vector<std::vector<QuestPOIPoint>>> POIs;
7206 
7207  if (points)
7208  {
7209  // The first result should have the highest questId
7210  Field* fields = points->Fetch();
7211  uint32 questIdMax = fields[0].GetInt32();
7212  POIs.resize(questIdMax + 1);
7213 
7214  do
7215  {
7216  fields = points->Fetch();
7217 
7218  int32 QuestID = fields[0].GetInt32();
7219  int32 Idx1 = fields[1].GetInt32();
7220  int32 X = fields[2].GetInt32();
7221  int32 Y = fields[3].GetInt32();
7222 
7223  if (int32(POIs[QuestID].size()) <= Idx1 + 1)
7224  POIs[QuestID].resize(Idx1 + 10);
7225 
7226  QuestPOIPoint point(X, Y);
7227  POIs[QuestID][Idx1].push_back(point);
7228  } while (points->NextRow());
7229  }
7230 
7231  do
7232  {
7233  Field* fields = result->Fetch();
7234 
7235  int32 QuestID = fields[0].GetInt32();
7236  int32 BlobIndex = fields[1].GetInt32();
7237  int32 Idx1 = fields[2].GetInt32();
7238  int32 ObjectiveIndex = fields[3].GetInt32();
7239  int32 QuestObjectiveID = fields[4].GetInt32();
7240  int32 QuestObjectID = fields[5].GetInt32();
7241  int32 MapID = fields[6].GetInt32();
7242  int32 WorldMapAreaId = fields[7].GetInt32();
7243  int32 Floor = fields[8].GetInt32();
7244  int32 Priority = fields[9].GetInt32();
7245  int32 Flags = fields[10].GetInt32();
7246  int32 WorldEffectID = fields[11].GetInt32();
7247  int32 PlayerConditionID = fields[12].GetInt32();
7248  int32 WoDUnk1 = fields[13].GetInt32();
7249 
7250  if (!sObjectMgr->GetQuestTemplate(QuestID))
7251  TC_LOG_ERROR("sql.sql", "`quest_poi` quest id (%u) Idx1 (%u) does not exist in `quest_template`", QuestID, Idx1);
7252 
7253  QuestPOI POI(BlobIndex, ObjectiveIndex, QuestObjectiveID, QuestObjectID, MapID, WorldMapAreaId, Floor, Priority, Flags, WorldEffectID, PlayerConditionID, WoDUnk1);
7254  if (QuestID < int32(POIs.size()) && Idx1 < int32(POIs[QuestID].size()))
7255  {
7256  POI.points = POIs[QuestID][Idx1];
7257  _questPOIStore[QuestID].push_back(POI);
7258  }
7259  else
7260  TC_LOG_ERROR("server.loading", "Table quest_poi references unknown quest points for quest %i POI id %i", QuestID, BlobIndex);
7261 
7262  ++count;
7263  } while (result->NextRow());
7264 
7265  TC_LOG_INFO("server.loading", ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
7266 }
#define X
Definition: CollisionDetection.cpp:2281
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: ObjectMgr.h:551
#define sObjectMgr
Definition: ObjectMgr.h:1567
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
QuestPOIContainer _questPOIStore
Definition: ObjectMgr.h:1451
Definition: ObjectMgr.h:542
int32 GetInt32() const
Definition: Field.h:165
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
int32_t int32
Definition: g3dmath.h:167
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
#define Y
Definition: CollisionDetection.cpp:2282

+ Here is the call graph for this function:

void ObjectMgr::LoadQuestRelationsHelper ( QuestRelations map,
QuestRelationsReverse reverseMap,
std::string const table,
bool  starter,
bool  go 
)
private
7355 {
7356  uint32 oldMSTime = getMSTime();
7357 
7358  map.clear(); // need for reload case
7359 
7360  uint32 count = 0;
7361 
7362  QueryResult result = WorldDatabase.PQuery("SELECT id, quest, pool_entry FROM %s qr LEFT JOIN pool_quest pq ON qr.quest = pq.entry", table.c_str());
7363 
7364  if (!result)
7365  {
7366  TC_LOG_ERROR("server.loading", ">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str());
7367  return;
7368  }
7369 
7370  PooledQuestRelation* poolRelationMap = go ? &sPoolMgr->mQuestGORelation : &sPoolMgr->mQuestCreatureRelation;
7371  if (starter)
7372  poolRelationMap->clear();
7373 
7374  do
7375  {
7376  uint32 id = result->Fetch()[0].GetUInt32();
7377  uint32 quest = result->Fetch()[1].GetUInt32();
7378  uint32 poolId = result->Fetch()[2].GetUInt32();
7379 
7380  if (_questTemplates.find(quest) == _questTemplates.end())
7381  {
7382  TC_LOG_ERROR("sql.sql", "Table `%s`: Quest %u listed for entry %u does not exist.", table.c_str(), quest, id);
7383  continue;
7384  }
7385 
7386  if (!poolId || !starter)
7387  {
7388  map.insert(QuestRelations::value_type(id, quest));
7389  if (reverseMap)
7390  reverseMap->insert(QuestRelationsReverse::value_type(quest, id));
7391  }
7392  else if (starter)
7393  poolRelationMap->insert(PooledQuestRelation::value_type(quest, id));
7394 
7395  ++count;
7396  } while (result->NextRow());
7397 
7398  TC_LOG_INFO("server.loading", ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime));
7399 }
QueryResult PQuery(Format &&sql, T *conn, Args &&...args)
Definition: DatabaseWorkerPool.h:165
QuestMap _questTemplates
Definition: ObjectMgr.h:1426
std::multimap< uint32, uint32 > PooledQuestRelation
Definition: PoolMgr.h:100
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
#define sPoolMgr
Definition: PoolMgr.h:166
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ObjectMgr::LoadQuests ( )
3647 {
3648  uint32 oldMSTime = getMSTime();
3649 
3650  // For reload case
3651  for (QuestMap::const_iterator itr=_questTemplates.begin(); itr != _questTemplates.end(); ++itr)
3652  delete itr->second;
3653  _questTemplates.clear();
3654 
3655  mExclusiveQuestGroups.clear();
3656 
3657  QueryResult result = WorldDatabase.Query("SELECT "
3658  //0 1 2 3 4 5 6 7 8 9 10
3659  "ID, QuestType, QuestLevel, QuestPackageID, MinLevel, QuestSortID, QuestInfoID, SuggestedGroupNum, RewardNextQuest, RewardXPDifficulty, RewardXPMultiplier, "
3660  //11 12 13 14 15 16 17 18 19 20 21
3661  "RewardMoney, RewardMoneyDifficulty, RewardMoneyMultiplier, RewardBonusMoney, RewardDisplaySpell, RewardSpell, RewardHonor, RewardKillHonor, StartItem, Flags, FlagsEx, "
3662  //22 23 24 25 26 27 28 29
3663  "RewardItem1, RewardAmount1, ItemDrop1, ItemDropQuantity1, RewardItem2, RewardAmount2, ItemDrop2, ItemDropQuantity2, "
3664  //30 31 32 33 34 35 36 37
3665  "RewardItem3, RewardAmount3, ItemDrop3, ItemDropQuantity3, RewardItem4, RewardAmount4, ItemDrop4, ItemDropQuantity4, "
3666  //38 39 40 41 42 43
3667  "RewardChoiceItemID1, RewardChoiceItemQuantity1, RewardChoiceItemDisplayID1, RewardChoiceItemID2, RewardChoiceItemQuantity2, RewardChoiceItemDisplayID2, "
3668  //44 45 46 47 48 49
3669  "RewardChoiceItemID3, RewardChoiceItemQuantity3, RewardChoiceItemDisplayID3, RewardChoiceItemID4, RewardChoiceItemQuantity4, RewardChoiceItemDisplayID4, "
3670  //50 51 52 53 54 55
3671  "RewardChoiceItemID5, RewardChoiceItemQuantity5, RewardChoiceItemDisplayID5, RewardChoiceItemID6, RewardChoiceItemQuantity6, RewardChoiceItemDisplayID6, "
3672  //56 57 58 59 60 61 62 63 64 65 66
3673  "POIContinent, POIx, POIy, POIPriority, RewardTitle, RewardTalents, RewardArenaPoints, RewardSkillLineID, RewardNumSkillUps, PortraitGiver, PortraitTurnIn, "
3674  //67 68 69 70 71 72
3675  "RewardFactionID1, RewardFactionValue1, RewardFactionOverride1, RewardFactionID2, RewardFactionValue2, RewardFactionOverride2, "
3676  //73 74 75 76 77 78
3677  "RewardFactionID3, RewardFactionValue3, RewardFactionOverride3, RewardFactionID4, RewardFactionValue4, RewardFactionOverride4, "
3678  //79 80 81 82
3679  "RewardFactionID5, RewardFactionValue5, RewardFactionOverride5, RewardFactionFlags, "
3680  //83 84 85 86 87 88 89 90
3681  "RewardCurrencyID1, RewardCurrencyQty1, RewardCurrencyID2, RewardCurrencyQty2, RewardCurrencyID3, RewardCurrencyQty3, RewardCurrencyID4, RewardCurrencyQty4, "
3682  //91 92 93 94 95
3683  "AcceptedSoundKitID, CompleteSoundKitID, AreaGroupID, TimeAllowed, AllowableRaces, "
3684  //96 97 98 99 100 101 102 103 104
3685  "LogTitle, LogDescription, QuestDescription, AreaDescription, PortraitGiverText, PortraitGiverName, PortraitTurnInText, PortraitTurnInName, QuestCompletionLog"
3686  " FROM quest_template");
3687  if (!result)
3688  {
3689  TC_LOG_ERROR("server.loading", ">> Loaded 0 quests definitions. DB table `quest_template` is empty.");
3690  return;
3691  }
3692 
3693  // create multimap previous quest for each existed quest
3694  // some quests can have many previous maps set by NextQuestId in previous quest
3695  // for example set of race quests can lead to single not race specific quest
3696  do
3697  {
3698  Field* fields = result->Fetch();
3699 
3700  Quest* newQuest = new Quest(fields);
3701  _questTemplates[newQuest->GetQuestId()] = newQuest;
3702  } while (result->NextRow());
3703 
3704  // Load `quest_details`
3705  // 0 1 2 3 4 5 6 7 8
3706  result = WorldDatabase.Query("SELECT ID, Emote1, Emote2, Emote3, Emote4, EmoteDelay1, EmoteDelay2, EmoteDelay3, EmoteDelay4 FROM quest_details");
3707 
3708  if (!result)
3709  {
3710  TC_LOG_ERROR("server.loading", ">> Loaded 0 quest details. DB table `quest_details` is empty.");
3711  }
3712  else
3713  {
3714  do
3715  {
3716  Field* fields = result->Fetch();
3717  uint32 questId = fields[0].GetUInt32();
3718 
3719  auto itr = _questTemplates.find(questId);
3720  if (itr != _questTemplates.end())
3721  itr->second->LoadQuestDetails(fields);
3722  else
3723  TC_LOG_ERROR("server.loading", "Table `quest_details` has data for quest %u but such quest does not exist", questId);
3724  } while (result->NextRow());
3725  }
3726 
3727  // Load `quest_request_items`
3728  // 0 1 2 3 4 5
3729  result = WorldDatabase.Query("SELECT ID, EmoteOnComplete, EmoteOnIncomplete, EmoteOnCompleteDelay, EmoteOnIncompleteDelay, CompletionText FROM quest_request_items");
3730 
3731  if (!result)
3732  {
3733  TC_LOG_ERROR("server.loading", ">> Loaded 0 quest request items. DB table `quest_request_items` is empty.");
3734  }
3735  else
3736  {
3737  do
3738  {
3739  Field* fields = result->Fetch();
3740  uint32 questId = fields[0].GetUInt32();
3741 
3742  auto itr = _questTemplates.find(questId);
3743  if (itr != _questTemplates.end())
3744  itr->second->LoadQuestRequestItems(fields);
3745  else
3746  TC_LOG_ERROR("server.loading", "Table `quest_request_items` has data for quest %u but such quest does not exist", questId);
3747  } while (result->NextRow());
3748  }
3749 
3750  // Load `quest_offer_reward`
3751  // 0 1 2 3 4 5 6 7 8 9
3752  result = WorldDatabase.Query("SELECT ID, Emote1, Emote2, Emote3, Emote4, EmoteDelay1, EmoteDelay2, EmoteDelay3, EmoteDelay4, RewardText FROM quest_offer_reward");
3753 
3754  if (!result)
3755  {
3756  TC_LOG_ERROR("server.loading", ">> Loaded 0 quest reward emotes. DB table `quest_offer_reward` is empty.");
3757  }
3758  else
3759  {
3760  do
3761  {
3762  Field* fields = result->Fetch();
3763  uint32 questId = fields[0].GetUInt32();
3764 
3765  auto itr = _questTemplates.find(questId);
3766  if (itr != _questTemplates.end())
3767  itr->second->LoadQuestOfferReward(fields);
3768  else
3769  TC_LOG_ERROR("server.loading", "Table `quest_offer_reward` has data for quest %u but such quest does not exist", questId);
3770  } while (result->NextRow());
3771  }
3772 
3773  // Load `quest_template_addon`
3774  // 0 1 2 3 4 5 6 7 8
3775  result = WorldDatabase.Query("SELECT ID, MaxLevel, AllowableClasses, SourceSpellID, PrevQuestID, NextQuestID, ExclusiveGroup, RewardMailTemplateID, RewardMailDelay, "
3776  //9 10 11 12 13 14 15 16
3777  "RequiredSkillID, RequiredSkillPoints, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, ProvidedItemCount, SpecialFlags FROM quest_template_addon");
3778 
3779  if (!result)
3780  {
3781  TC_LOG_ERROR("server.loading", ">> Loaded 0 quest template addons. DB table `quest_template_addon` is empty.");
3782  }
3783  else
3784  {
3785  do
3786  {
3787  Field* fields = result->Fetch();
3788  uint32 questId = fields[0].GetUInt32();
3789 
3790  auto itr = _questTemplates.find(questId);
3791  if (itr != _questTemplates.end())
3792  itr->second->LoadQuestTemplateAddon(fields);
3793  else
3794  TC_LOG_ERROR("server.loading", "Table `quest_template_addon` has data for quest %u but such quest does not exist", questId);
3795  } while (result->NextRow());
3796  }
3797 
3798  // Load `quest_objectives` order by descending storage index to reduce resizes
3799  // 0 1 2 3 4 5 6 7 8
3800  result = WorldDatabase.Query("SELECT ID, QuestID, Type, StorageIndex, ObjectID, Amount, Flags, UnkFloat, Description FROM quest_objectives ORDER BY StorageIndex DESC");
3801 
3802  if (!result)
3803  {
3804  TC_LOG_ERROR("server.loading", ">> Loaded 0 quest objectives. DB table `quest_objectives` is empty.");
3805  }
3806  else
3807  {
3808  do
3809  {
3810  Field* fields = result->Fetch();
3811  uint32 questId = fields[1].GetUInt32();
3812 
3813  auto itr = _questTemplates.find(questId);
3814  if (itr != _questTemplates.end())
3815  itr->second->LoadQuestObjective(fields);
3816  else
3817  TC_LOG_ERROR("server.loading", "Table `quest_objectives` has objective for quest %u but such quest does not exist", questId);
3818  } while (result->NextRow());
3819  }
3820 
3821  // Load `quest_visual_effect` join table with quest_objectives because visual effects are based on objective ID (core stores objectives by their index in quest)
3822  // 0 1 2 3 4
3823  result = WorldDatabase.Query("SELECT v.ID, o.ID, o.QuestID, v.Index, v.VisualEffect FROM quest_visual_effect AS v LEFT JOIN quest_objectives AS o ON v.ID = o.ID ORDER BY v.Index DESC");
3824 
3825  if (!result)
3826  {
3827  TC_LOG_ERROR("server.loading", ">> Loaded 0 quest visual effects. DB table `quest_visual_effect` is empty.");
3828  }
3829  else
3830  {
3831  do
3832  {
3833  Field* fields = result->Fetch();
3834  uint32 vID = fields[0].GetUInt32();
3835  uint32 oID = fields[1].GetUInt32();
3836 
3837  if (!vID)
3838  {
3839  TC_LOG_ERROR("server.loading", "Table `quest_visual_effect` has visual effect for null objective id");
3840  continue;
3841  }
3842 
3843  // objID will be null if match for table join is not found
3844  if (vID != oID)
3845  {
3846  TC_LOG_ERROR("server.loading", "Table `quest_visual_effect` has visual effect for objective %u but such objective does not exist.", vID);
3847  continue;
3848  }
3849 
3850  uint32 questId = fields[2].GetUInt32();
3851 
3852  // Do not throw error here because error for non existing quest is thrown while loading quest objectives. we do not need duplication
3853  auto itr = _questTemplates.find(questId);
3854  if (itr != _questTemplates.end())
3855  itr->second->LoadQuestObjectiveVisualEffect(fields);
3856  } while (result->NextRow());
3857  }
3858 
3859  std::map<uint32, uint32> usedMailTemplates;
3860 
3861  // Post processing
3862  for (QuestMap::iterator iter = _questTemplates.begin(); iter != _questTemplates.end(); ++iter)
3863  {
3864  // skip post-loading checks for disabled quests
3866  continue;
3867 
3868  Quest* qinfo = iter->second;
3869 
3870  // additional quest integrity checks (GO, creature_template and item_template must be loaded already)
3871 
3872  if (qinfo->GetQuestType() >= MAX_QUEST_TYPES)
3873  TC_LOG_ERROR("sql.sql", "Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestType());
3874 
3876  {
3877  TC_LOG_ERROR("sql.sql", "Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u",
3880  }
3881 
3882  if (qinfo->Flags & QUEST_FLAGS_DAILY && qinfo->Flags & QUEST_FLAGS_WEEKLY)
3883  {
3884  TC_LOG_ERROR("sql.sql", "Weekly Quest %u is marked as daily quest in `Flags`, removed daily flag.", qinfo->GetQuestId());
3885  qinfo->Flags &= ~QUEST_FLAGS_DAILY;
3886  }
3887 
3888  if (qinfo->Flags & QUEST_FLAGS_DAILY)
3889  {
3891  {
3892  TC_LOG_DEBUG("sql.sql", "Daily Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
3894  }
3895  }
3896 
3897  if (qinfo->Flags & QUEST_FLAGS_WEEKLY)
3898  {
3900  {
3901  TC_LOG_DEBUG("sql.sql", "Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
3903  }
3904  }
3905 
3907  {
3909  {
3910  TC_LOG_DEBUG("sql.sql", "Monthly quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
3912  }
3913  }
3914 
3915  if (qinfo->Flags & QUEST_FLAGS_TRACKING)
3916  {
3917  // at auto-reward can be rewarded only RewardChoiceItemId[0]
3918  for (int j = 1; j < QUEST_REWARD_CHOICES_COUNT; ++j )
3919  {
3920  if (uint32 id = qinfo->RewardChoiceItemId[j])
3921  {
3922  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardChoiceItemId%d` = %u but item from `RewardChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_TRACKING.",
3923  qinfo->GetQuestId(), j+1, id, j+1);
3924  // no changes, quest ignore this data
3925  }
3926  }
3927  }
3928 
3929  if (qinfo->MinLevel == -1 || qinfo->MinLevel > DEFAULT_MAX_LEVEL)
3930  {
3931  TC_LOG_ERROR("sql.sql", "Quest %u should be disabled because `MinLevel` = %i", qinfo->GetQuestId(), int32(qinfo->MinLevel));
3932  // no changes needed, sending -1 in SMSG_QUEST_QUERY_RESPONSE is valid
3933  }
3934 
3935  // client quest log visual (area case)
3936  if (qinfo->QuestSortID > 0)
3937  {
3938  if (!sAreaTableStore.LookupEntry(qinfo->QuestSortID))
3939  {
3940  TC_LOG_ERROR("sql.sql", "Quest %u has `QuestSortID` = %u (zone case) but zone with this id does not exist.",
3941  qinfo->GetQuestId(), qinfo->QuestSortID);
3942  // no changes, quest not dependent from this value but can have problems at client
3943  }
3944  }
3945  // client quest log visual (sort case)
3946  if (qinfo->QuestSortID < 0)
3947  {
3948  QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->QuestSortID));
3949  if (!qSort)
3950  {
3951  TC_LOG_ERROR("sql.sql", "Quest %u has `QuestSortID` = %i (sort case) but quest sort with this id does not exist.",
3952  qinfo->GetQuestId(), qinfo->QuestSortID);
3953  // no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check)
3954  }
3955  //check for proper RequiredSkillId value (skill case)
3956  if (uint32 skill_id = SkillByQuestSort(-int32(qinfo->QuestSortID)))
3957  {
3958  if (qinfo->RequiredSkillId != skill_id)
3959  {
3960  TC_LOG_ERROR("sql.sql", "Quest %u has `QuestSortID` = %i but `RequiredSkillId` does not have a corresponding value (%d).",
3961  qinfo->GetQuestId(), qinfo->QuestSortID, skill_id);
3962  //override, and force proper value here?
3963  }
3964  }
3965  }
3966 
3967  // AllowableClasses, can be 0/CLASSMASK_ALL_PLAYABLE to allow any class
3968  if (qinfo->AllowableClasses)
3969  {
3970  if (!(qinfo->AllowableClasses & CLASSMASK_ALL_PLAYABLE))
3971  {
3972  TC_LOG_ERROR("sql.sql", "Quest %u does not contain any playable classes in `AllowableClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->AllowableClasses);
3973  qinfo->AllowableClasses = 0;
3974  }
3975  }
3976  // AllowableRaces, can be -1/RACEMASK_ALL_PLAYABLE to allow any race
3977  if (qinfo->AllowableRaces != -1)
3978  {
3979  if (qinfo->AllowableRaces > 0 && !(uint32(qinfo->AllowableRaces) & RACEMASK_ALL_PLAYABLE))
3980  {
3981  TC_LOG_ERROR("sql.sql", "Quest %u does not contain any playable races in `AllowableRaces` (%d), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->AllowableRaces);
3982  qinfo->AllowableRaces = -1;
3983  }
3984  }
3985  // RequiredSkillId, can be 0
3986  if (qinfo->RequiredSkillId)
3987  {
3988  if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkillId))
3989  {
3990  TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredSkillId` = %u but this skill does not exist",
3991  qinfo->GetQuestId(), qinfo->RequiredSkillId);
3992  }
3993  }
3994 
3995  if (qinfo->RequiredSkillPoints)
3996  {
3997  if (qinfo->RequiredSkillPoints > sWorld->GetConfigMaxSkillValue())
3998  {
3999  TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredSkillPoints` = %u but max possible skill is %u, quest can't be done.",
4000  qinfo->GetQuestId(), qinfo->RequiredSkillPoints, sWorld->GetConfigMaxSkillValue());
4001  // no changes, quest can't be done for this requirement
4002  }
4003  }
4004  // else Skill quests can have 0 skill level, this is ok
4005 
4006  if (qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction))
4007  {
4008  TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.",
4009  qinfo->GetQuestId(), qinfo->RequiredMinRepFaction, qinfo->RequiredMinRepFaction);
4010  // no changes, quest can't be done for this requirement
4011  }
4012 
4013  if (qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction))
4014  {
4015  TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.",
4016  qinfo->GetQuestId(), qinfo->RequiredMaxRepFaction, qinfo->RequiredMaxRepFaction);
4017  // no changes, quest can't be done for this requirement
4018  }
4019 
4021  {
4022  TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.",
4024  // no changes, quest can't be done for this requirement
4025  }
4026 
4027  if (qinfo->RequiredMinRepValue && qinfo->RequiredMaxRepValue && qinfo->RequiredMaxRepValue <= qinfo->RequiredMinRepValue)
4028  {
4029  TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.",
4030  qinfo->GetQuestId(), qinfo->RequiredMaxRepValue, qinfo->RequiredMinRepValue);
4031  // no changes, quest can't be done for this requirement
4032  }
4033 
4034  if (!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue != 0)
4035  {
4036  TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect",
4037  qinfo->GetQuestId(), qinfo->RequiredMinRepValue);
4038  // warning
4039  }
4040 
4041  if (!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue != 0)
4042  {
4043  TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect",
4044  qinfo->GetQuestId(), qinfo->RequiredMaxRepValue);
4045  // warning
4046  }
4047 
4048  if (qinfo->RewardTitleId && !sCharTitlesStore.LookupEntry(qinfo->RewardTitleId))
4049  {
4050  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.",
4051  qinfo->GetQuestId(), qinfo->RewardTitleId, qinfo->RewardTitleId);
4052  qinfo->RewardTitleId = 0;
4053  // quest can't reward this title
4054  }
4055 
4056  if (qinfo->SourceItemId)
4057  {
4058  if (!sObjectMgr->GetItemTemplate(qinfo->SourceItemId))
4059  {
4060  TC_LOG_ERROR("sql.sql", "Quest %u has `SourceItemId` = %u but item with entry %u does not exist, quest can't be done.",
4061  qinfo->GetQuestId(), qinfo->SourceItemId, qinfo->SourceItemId);
4062  qinfo->SourceItemId = 0; // quest can't be done for this requirement
4063  }
4064  else if (qinfo->SourceItemIdCount == 0)
4065  {
4066  TC_LOG_ERROR("sql.sql", "Quest %u has `StartItem` = %u but `ProvidedItemCount` = 0, set to 1 but need fix in DB.",
4067  qinfo->GetQuestId(), qinfo->SourceItemId);
4068  qinfo->SourceItemIdCount = 1; // update to 1 for allow quest work for backward compatibility with DB
4069  }
4070  }
4071  else if (qinfo->SourceItemIdCount>0)
4072  {
4073  TC_LOG_ERROR("sql.sql", "Quest %u has `SourceItemId` = 0 but `SourceItemIdCount` = %u, useless value.",
4074  qinfo->GetQuestId(), qinfo->SourceItemIdCount);
4075  qinfo->SourceItemIdCount=0; // no quest work changes in fact
4076  }
4077 
4078  if (qinfo->SourceSpellID)
4079  {
4080  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->SourceSpellID);
4081  if (!spellInfo)
4082  {
4083  TC_LOG_ERROR("sql.sql", "Quest %u has `SourceSpellid` = %u but spell %u doesn't exist, quest can't be done.",
4084  qinfo->GetQuestId(), qinfo->SourceSpellID, qinfo->SourceSpellID);
4085  qinfo->SourceSpellID = 0; // quest can't be done for this requirement
4086  }
4087  else if (!SpellMgr::IsSpellValid(spellInfo))
4088  {
4089  TC_LOG_ERROR("sql.sql", "Quest %u has `SourceSpellid` = %u but spell %u is broken, quest can't be done.",
4090  qinfo->GetQuestId(), qinfo->SourceSpellID, qinfo->SourceSpellID);
4091  qinfo->SourceSpellID = 0; // quest can't be done for this requirement
4092  }
4093  }
4094 
4095  for (QuestObjective const& obj : qinfo->GetObjectives())
4096  {
4097  // Check storage index for objectives which store data
4098  if (obj.StorageIndex < 0)
4099  {
4100  switch (obj.Type)
4101  {
4103  case QUEST_OBJECTIVE_ITEM:
4110  TC_LOG_ERROR("sql.sql", "Quest %u objective %u has invalid StorageIndex = %d for objective type %u", qinfo->GetQuestId(), obj.ID, obj.StorageIndex, obj.Type);
4111  break;
4112  default:
4113  break;
4114  }
4115  }
4116 
4117  switch (obj.Type)
4118  {
4119  case QUEST_OBJECTIVE_ITEM:
4121  if (!sObjectMgr->GetItemTemplate(obj.ObjectID))
4122  TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing item entry %u, quest can't be done.",
4123  qinfo->GetQuestId(), obj.ID, obj.ObjectID);
4124  break;
4127  if (!sObjectMgr->GetCreatureTemplate(obj.ObjectID))
4128  TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing creature entry %u, quest can't be done.",
4129  qinfo->GetQuestId(), obj.ID, uint32(obj.ObjectID));
4130  break;
4133  if (!sObjectMgr->GetGameObjectTemplate(obj.ObjectID))
4134  TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing gameobject entry %u, quest can't be done.",
4135  qinfo->GetQuestId(), obj.ID, uint32(obj.ObjectID));
4136  break;
4138  // Need checks (is it creature only?)
4140  break;
4143  if (!sFactionStore.LookupEntry(obj.ObjectID))
4144  TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing faction id %d", qinfo->GetQuestId(), obj.ID, obj.ObjectID);
4145  break;
4148  if (obj.Amount <= 0)
4149  TC_LOG_ERROR("sql.sql", "Quest %u objective %u has invalid player kills count %d", qinfo->GetQuestId(), obj.ID, obj.Amount);
4150  break;
4154  if (!sCurrencyTypesStore.LookupEntry(obj.ObjectID))
4155  TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing currency %d", qinfo->GetQuestId(), obj.ID, obj.ObjectID);
4156  if (obj.Amount <= 0)
4157  TC_LOG_ERROR("sql.sql", "Quest %u objective %u has invalid currency amount %d", qinfo->GetQuestId(), obj.ID, obj.Amount);
4158  break;
4160  if (!sSpellMgr->GetSpellInfo(obj.ObjectID))
4161  TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing spell id %d", qinfo->GetQuestId(), obj.ID, obj.ObjectID);
4162  break;
4164  if (obj.ObjectID && !sObjectMgr->GetCreatureTemplate(obj.ObjectID))
4165  TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing creature entry %u, quest can't be done.",
4166  qinfo->GetQuestId(), obj.ID, uint32(obj.ObjectID));
4167  break;
4169  if (!sBattlePetSpeciesStore.LookupEntry(obj.ObjectID))
4170  TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing battlepet species id %d", qinfo->GetQuestId(), obj.ID, obj.ObjectID);
4171  break;
4173  if (!sCriteriaTreeStore.LookupEntry(obj.ObjectID))
4174  TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing criteria tree id %d", qinfo->GetQuestId(), obj.ID, obj.ObjectID);
4175  break;
4177  if (sAreaTriggerStore.LookupEntry(uint32(obj.ObjectID)))
4178  _questAreaTriggerStore[obj.ObjectID].insert(qinfo->ID);
4179  else if (obj.ObjectID != -1)
4180  TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing areatrigger id %d", qinfo->GetQuestId(), obj.ID, obj.ObjectID);
4181  break;
4182  case QUEST_OBJECTIVE_MONEY:
4184  break;
4185  default:
4186  TC_LOG_ERROR("sql.sql", "Quest %u objective %u has unhandled type %u", qinfo->GetQuestId(), obj.ID, obj.Type);
4187  break;
4188  }
4189  }
4190 
4191  for (uint8 j = 0; j < QUEST_ITEM_DROP_COUNT; ++j)
4192  {
4193  uint32 id = qinfo->ItemDrop[j];
4194  if (id)
4195  {
4196  if (!sObjectMgr->GetItemTemplate(id))
4197  {
4198  TC_LOG_ERROR("sql.sql", "Quest %u has `ItemDrop%d` = %u but item with entry %u does not exist, quest can't be done.",
4199  qinfo->GetQuestId(), j+1, id, id);
4200  // no changes, quest can't be done for this requirement
4201  }
4202  }
4203  else
4204  {
4205  if (qinfo->ItemDropQuantity[j]>0)
4206  {
4207  TC_LOG_ERROR("sql.sql", "Quest %u has `ItemDrop%d` = 0 but `ItemDropQuantity%d` = %u.",
4208  qinfo->GetQuestId(), j+1, j+1, qinfo->ItemDropQuantity[j]);
4209  // no changes, quest ignore this data
4210  }
4211  }
4212  }
4213 
4214  for (uint8 j = 0; j < QUEST_REWARD_CHOICES_COUNT; ++j)
4215  {
4216  uint32 id = qinfo->RewardChoiceItemId[j];
4217  if (id)
4218  {
4219  if (!sObjectMgr->GetItemTemplate(id))
4220  {
4221  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
4222  qinfo->GetQuestId(), j+1, id, id);
4223  qinfo->RewardChoiceItemId[j] = 0; // no changes, quest will not reward this
4224  }
4225 
4226  if (!qinfo->RewardChoiceItemCount[j])
4227  {
4228  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardChoiceItemId%d` = %u but `RewardChoiceItemCount%d` = 0, quest can't be done.",
4229  qinfo->GetQuestId(), j+1, id, j+1);
4230  // no changes, quest can't be done
4231  }
4232  }
4233  else if (qinfo->RewardChoiceItemCount[j]>0)
4234  {
4235  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardChoiceItemId%d` = 0 but `RewardChoiceItemCount%d` = %u.",
4236  qinfo->GetQuestId(), j+1, j+1, qinfo->RewardChoiceItemCount[j]);
4237  // no changes, quest ignore this data
4238  }
4239  }
4240 
4241  for (uint8 j = 0; j < QUEST_REWARD_ITEM_COUNT; ++j)
4242  {
4243  uint32 id = qinfo->RewardItemId[j];
4244  if (id)
4245  {
4246  if (!sObjectMgr->GetItemTemplate(id))
4247  {
4248  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
4249  qinfo->GetQuestId(), j+1, id, id);
4250  qinfo->RewardItemId[j] = 0; // no changes, quest will not reward this item
4251  }
4252 
4253  if (!qinfo->RewardItemCount[j])
4254  {
4255  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardItemId%d` = %u but `RewardItemCount%d` = 0, quest will not reward this item.",
4256  qinfo->GetQuestId(), j+1, id, j+1);
4257  // no changes
4258  }
4259  }
4260  else if (qinfo->RewardItemCount[j]>0)
4261  {
4262  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardItemId%d` = 0 but `RewardItemCount%d` = %u.",
4263  qinfo->GetQuestId(), j+1, j+1, qinfo->RewardItemCount[j]);
4264  // no changes, quest ignore this data
4265  }
4266  }
4267 
4268  for (uint8 j = 0; j < QUEST_REWARD_REPUTATIONS_COUNT; ++j)
4269  {
4270  if (qinfo->RewardFactionId[j])
4271  {
4272  if (abs(qinfo->RewardFactionValue[j]) > 9)
4273  {
4274  TC_LOG_ERROR("sql.sql", "Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewardFactionValue[j]);
4275  }
4276  if (!sFactionStore.LookupEntry(qinfo->RewardFactionId[j]))
4277  {
4278  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardFactionId%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewardFactionId[j], qinfo->RewardFactionId[j]);
4279  qinfo->RewardFactionId[j] = 0; // quest will not reward this
4280  }
4281  }
4282 
4283  else if (qinfo->RewardFactionOverride[j] != 0)
4284  {
4285  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardFactionId%d` = 0 but `RewardFactionValueIdOverride%d` = %i.",
4286  qinfo->GetQuestId(), j+1, j+1, qinfo->RewardFactionOverride[j]);
4287  // no changes, quest ignore this data
4288  }
4289  }
4290 
4291  if (qinfo->RewardDisplaySpell)
4292  {
4293  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewardDisplaySpell);
4294 
4295  if (!spellInfo)
4296  {
4297  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSpell` = %u but spell %u does not exist, spell removed as display reward.",
4298  qinfo->GetQuestId(), qinfo->RewardDisplaySpell, qinfo->RewardDisplaySpell);
4299  qinfo->RewardDisplaySpell = 0; // no spell reward will display for this quest
4300  }
4301 
4302  else if (!SpellMgr::IsSpellValid(spellInfo))
4303  {
4304  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSpell` = %u but spell %u is broken, quest will not have a spell reward.",
4305  qinfo->GetQuestId(), qinfo->RewardDisplaySpell, qinfo->RewardDisplaySpell);
4306  qinfo->RewardDisplaySpell = 0; // no spell reward will display for this quest
4307  }
4308  }
4309 
4310  if (qinfo->RewardSpell > 0)
4311  {
4312  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewardSpell);
4313 
4314  if (!spellInfo)
4315  {
4316  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.",
4317  qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell);
4318  qinfo->RewardSpell = 0; // no spell will be cast on player
4319  }
4320 
4321  else if (!SpellMgr::IsSpellValid(spellInfo))
4322  {
4323  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSpellCast` = %u but spell %u is broken, quest will not have a spell reward.",
4324  qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell);
4325  qinfo->RewardSpell = 0; // no spell will be cast on player
4326  }
4327  }
4328 
4329  if (qinfo->RewardMailTemplateId)
4330  {
4331  if (!sMailTemplateStore.LookupEntry(qinfo->RewardMailTemplateId))
4332  {
4333  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.",
4334  qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId);
4335  qinfo->RewardMailTemplateId = 0; // no mail will send to player
4336  qinfo->RewardMailDelay = 0; // no mail will send to player
4337  }
4338  else if (usedMailTemplates.find(qinfo->RewardMailTemplateId) != usedMailTemplates.end())
4339  {
4340  std::map<uint32, uint32>::const_iterator used_mt_itr = usedMailTemplates.find(qinfo->RewardMailTemplateId);
4341  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.",
4342  qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId, used_mt_itr->second);
4343  qinfo->RewardMailTemplateId = 0; // no mail will send to player
4344  qinfo->RewardMailDelay = 0; // no mail will send to player
4345  }
4346  else
4347  usedMailTemplates[qinfo->RewardMailTemplateId] = qinfo->GetQuestId();
4348  }
4349 
4350  if (qinfo->NextQuestInChain)
4351  {
4352  QuestMap::iterator qNextItr = _questTemplates.find(qinfo->NextQuestInChain);
4353  if (qNextItr == _questTemplates.end())
4354  {
4355  TC_LOG_ERROR("sql.sql", "Quest %u has `NextQuestInChain` = %u but quest %u does not exist, quest chain will not work.",
4356  qinfo->GetQuestId(), qinfo->NextQuestInChain, qinfo->NextQuestInChain);
4357  qinfo->NextQuestInChain = 0;
4358  }
4359  else
4360  qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId());
4361  }
4362 
4363  for (uint8 j = 0; j < QUEST_REWARD_CURRENCY_COUNT; ++j)
4364  {
4365  if (qinfo->RewardCurrencyId[j])
4366  {
4367  if (qinfo->RewardCurrencyCount[j] == 0)
4368  {
4369  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardCurrencyId%d` = %u but `RewardCurrencyCount%d` = 0, quest can't be done.",
4370  qinfo->GetQuestId(), j+1, qinfo->RewardCurrencyId[j], j+1);
4371  // no changes, quest can't be done for this requirement
4372  }
4373 
4374  if (!sCurrencyTypesStore.LookupEntry(qinfo->RewardCurrencyId[j]))
4375  {
4376  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardCurrencyId%d` = %u but currency with entry %u does not exist, quest can't be done.",
4377  qinfo->GetQuestId(), j+1, qinfo->RewardCurrencyId[j], qinfo->RewardCurrencyId[j]);
4378  qinfo->RewardCurrencyCount[j] = 0; // prevent incorrect work of quest
4379  }
4380  }
4381  else if (qinfo->RewardCurrencyCount[j] > 0)
4382  {
4383  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardCurrencyId%d` = 0 but `RewardCurrencyCount%d` = %u, quest can't be done.",
4384  qinfo->GetQuestId(), j+1, j+1, qinfo->RewardCurrencyCount[j]);
4385  qinfo->RewardCurrencyCount[j] = 0; // prevent incorrect work of quest
4386  }
4387  }
4388 
4389  if (qinfo->SoundAccept)
4390  {
4391  if (!sSoundEntriesStore.LookupEntry(qinfo->SoundAccept))
4392  {
4393  TC_LOG_ERROR("sql.sql", "Quest %u has `SoundAccept` = %u but sound %u does not exist, set to 0.",
4394  qinfo->GetQuestId(), qinfo->SoundAccept, qinfo->SoundAccept);
4395  qinfo->SoundAccept = 0; // no sound will be played
4396  }
4397  }
4398 
4399  if (qinfo->SoundTurnIn)
4400  {
4401  if (!sSoundEntriesStore.LookupEntry(qinfo->SoundTurnIn))
4402  {
4403  TC_LOG_ERROR("sql.sql", "Quest %u has `SoundTurnIn` = %u but sound %u does not exist, set to 0.",
4404  qinfo->GetQuestId(), qinfo->SoundTurnIn, qinfo->SoundTurnIn);
4405  qinfo->SoundTurnIn = 0; // no sound will be played
4406  }
4407  }
4408 
4409  if (qinfo->RewardSkillId)
4410  {
4411  if (!sSkillLineStore.LookupEntry(qinfo->RewardSkillId))
4412  {
4413  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSkillId` = %u but this skill does not exist",
4414  qinfo->GetQuestId(), qinfo->RewardSkillId);
4415  }
4416  if (!qinfo->RewardSkillPoints)
4417  {
4418  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSkillId` = %u but `RewardSkillPoints` is 0",
4419  qinfo->GetQuestId(), qinfo->RewardSkillId);
4420  }
4421  }
4422 
4423  if (qinfo->RewardSkillPoints)
4424  {
4425  if (qinfo->RewardSkillPoints > sWorld->GetConfigMaxSkillValue())
4426  {
4427  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSkillPoints` = %u but max possible skill is %u, quest can't be done.",
4428  qinfo->GetQuestId(), qinfo->RewardSkillPoints, sWorld->GetConfigMaxSkillValue());
4429  // no changes, quest can't be done for this requirement
4430  }
4431  if (!qinfo->RewardSkillId)
4432  {
4433  TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSkillPoints` = %u but `RewardSkillId` is 0",
4434  qinfo->GetQuestId(), qinfo->RewardSkillPoints);
4435  }
4436  }
4437 
4438  // fill additional data stores
4439  if (qinfo->PrevQuestID)
4440  {
4441  if (_questTemplates.find(abs(qinfo->GetPrevQuestId())) == _questTemplates.end())
4442  TC_LOG_ERROR("sql.sql", "Quest %d has PrevQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetPrevQuestId());
4443  else
4444  qinfo->prevQuests.push_back(qinfo->PrevQuestID);
4445  }
4446 
4447  if (qinfo->NextQuestID)
4448  {
4449  QuestMap::iterator qNextItr = _questTemplates.find(abs(qinfo->GetNextQuestId()));
4450  if (qNextItr == _questTemplates.end())
4451  TC_LOG_ERROR("sql.sql", "Quest %d has NextQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId());
4452  else
4453  {
4454  int32 signedQuestId = qinfo->NextQuestID < 0 ? -int32(qinfo->GetQuestId()) : int32(qinfo->GetQuestId());
4455  qNextItr->second->prevQuests.push_back(signedQuestId);
4456  }
4457  }
4458 
4459  if (qinfo->ExclusiveGroup)
4460  mExclusiveQuestGroups.insert(std::pair<int32, uint32>(qinfo->ExclusiveGroup, qinfo->GetQuestId()));
4461  if (qinfo->LimitTime)
4463  }
4464 
4465  // check QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE
4466  for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
4467  {
4468  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i);
4469  if (!spellInfo)
4470  continue;
4471 
4472  for (SpellEffectInfo const* effect : spellInfo->GetEffectsForDifficulty(DIFFICULTY_NONE))
4473  {
4474  if (!effect || effect->Effect != SPELL_EFFECT_QUEST_COMPLETE)
4475  continue;
4476 
4477  uint32 quest_id = effect->MiscValue;
4478 
4479  Quest const* quest = GetQuestTemplate(quest_id);
4480 
4481  // some quest referenced in spells not exist (outdated spells)
4482  if (!quest)
4483  continue;
4484 
4486  {
4487  TC_LOG_ERROR("sql.sql", "Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u, but quest not have flag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id);
4488 
4489  // this will prevent quest completing without objective
4490  const_cast<Quest*>(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT);
4491  }
4492  }
4493  }
4494 
4495  TC_LOG_INFO("server.loading", ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime));
4496 }
uint32 RewardItemId[QUEST_REWARD_ITEM_COUNT]
Definition: QuestDef.h:425
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
Definition: DBCEnums.h:404
Definition: QuestDef.h:226
uint32 RewardSkillId
Definition: QuestDef.h:439
uint32 ID
Definition: QuestDef.h:403
uint32 SpecialFlags
Definition: QuestDef.h:499
uint32 Id
Definition: SpellInfo.h:329
Definition: QuestDef.h:211
bool IsDisabledFor(DisableType type, uint32 entry, Unit const *unit, uint8 flags)
Definition: DisableMgr.cpp:277
uint32 SourceItemIdCount
Definition: QuestDef.h:498
Definition: QuestDef.h:231
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
Definition: QuestDef.h:201
Definition: QuestDef.h:221
Definition: SharedDefines.h:1026
uint32 RequiredSkillId
Definition: QuestDef.h:492
Definition: QuestDef.h:279
Definition: QuestDef.h:214
Quest const * GetQuestTemplate(uint32 quest_id) const
Definition: ObjectMgr.h:815
Definition: QuestDef.h:209
Definition: SpellInfo.h:326
DB2Storage< CurrencyTypesEntry > sCurrencyTypesStore("CurrencyTypes.db2", CurrencyTypesFormat, HOTFIX_SEL_CURRENCY_TYPES)
uint32 RewardSpell
Definition: QuestDef.h:419
uint32 SkillByQuestSort(int32 QuestSort)
Definition: SharedDefines.h:4122
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerfmt)
Definition: QuestDef.h:261
QuestMap _questTemplates
Definition: ObjectMgr.h:1426
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 RequiredMaxRepFaction
Definition: QuestDef.h:496
uint32 SoundTurnIn
Definition: QuestDef.h:450
QuestObjectives const & GetObjectives() const
Definition: QuestDef.h:345
Definition: QuestDef.h:154
uint32 RewardFactionId[QUEST_REWARD_REPUTATIONS_COUNT]
Definition: QuestDef.h:443
uint32 ItemDropQuantity[QUEST_ITEM_DROP_COUNT]
Definition: QuestDef.h:428
Definition: QuestDef.h:233
static const int32 Reputation_Cap
Definition: ReputationMgr.h:75
uint32 getMSTime()
Definition: Timer.h:24
DB2Storage< QuestSortEntry > sQuestSortStore("QuestSort.db2", QuestSortFormat, HOTFIX_SEL_QUEST_SORT)
int32 PrevQuestID
Definition: QuestDef.h:487
DB2Storage< BattlePetSpeciesEntry > sBattlePetSpeciesStore("BattlePetSpecies.db2", BattlePetSpeciesFormat, HOTFIX_SEL_BATTLE_PET_SPECIES)
Definition: QuestDef.h:213
arena_t NULL
Definition: jemalloc_internal.h:624
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: QuestDef.h:224
Definition: QuestDef.h:212
int32 AllowableRaces
Definition: QuestDef.h:453
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
#define sWorld
Definition: World.h:887
Definition: QuestDef.h:225
uint32 RewardCurrencyCount[QUEST_REWARD_CURRENCY_COUNT]
Definition: QuestDef.h:448
#define sObjectMgr
Definition: ObjectMgr.h:1567
DBCStorage< CharTitlesEntry > sCharTitlesStore(CharTitlesfmt)
DB2Storage< MailTemplateEntry > sMailTemplateStore("MailTemplate.db2", MailTemplateFormat, HOTFIX_SEL_MAIL_TEMPLATE)
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTablefmt)
uint32 RewardTitleId
Definition: QuestDef.h:436
uint32 RewardCurrencyId[QUEST_REWARD_CURRENCY_COUNT]
Definition: QuestDef.h:447
#define QUEST_REWARD_CURRENCY_COUNT
Definition: QuestDef.h:51
Definition: QuestDef.h:228
uint32 RewardChoiceItemId[QUEST_REWARD_CHOICES_COUNT]
Definition: QuestDef.h:429
uint32 RequiredMinRepFaction
Definition: QuestDef.h:494
Definition: QuestDef.h:152
uint32 ItemDrop[QUEST_ITEM_DROP_COUNT]
Definition: QuestDef.h:427
uint32 RewardDisplaySpell
Definition: QuestDef.h:418
Definition: QuestDef.h:230
Definition: QuestDef.h:220
int32 QuestSortID
Definition: QuestDef.h:408
uint32 GetQuestId() const
Definition: QuestDef.h:304
uint32 SourceSpellID
Definition: QuestDef.h:486
int32 RequiredMinRepValue
Definition: QuestDef.h:495
uint32 RewardMailTemplateId
Definition: QuestDef.h:490
bool HasSpecialFlag(uint32 flag) const
Definition: QuestDef.h:300
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: SpellInfo.h:238
int32_t int32
Definition: Define.h:146
#define CLASSMASK_ALL_PLAYABLE
Definition: SharedDefines.h:183
uint32_t uint32
Definition: Define.h:150
DB2Storage< CriteriaTreeEntry > sCriteriaTreeStore("CriteriaTree.db2", CriteriaTreeFormat, HOTFIX_SEL_CRITERIA_TREE)
int32 RewardFactionValue[QUEST_REWARD_REPUTATIONS_COUNT]
Definition: QuestDef.h:444
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
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetQuestType() const
Definition: QuestDef.h:305
int32 ExclusiveGroup
Definition: QuestDef.h:489
Definition: QuestDef.h:227
Definition: QuestDef.h:157
Definition: SharedDefines.h:3775
uint32 AllowableClasses
Definition: QuestDef.h:485
Definition: DBCEnums.h:46
Definition: DisableMgr.h:30
Definition: QuestDef.h:229
void SetSpecialFlag(uint32 flag)
Definition: QuestDef.h:301
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
uint32 LimitTime
Definition: QuestDef.h:452
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
Definition: DB2Structure.h:1088
#define QUEST_REWARD_CHOICES_COUNT
Definition: QuestDef.h:46
Definition: QuestDef.h:223
uint32 RewardSkillPoints
Definition: QuestDef.h:440
int32 GetNextQuestId() const
Definition: QuestDef.h:323
#define RACEMASK_ALL_PLAYABLE
Definition: SharedDefines.h:133
uint32 GetUInt32() const
Definition: Field.h:146
int32_t int32
Definition: g3dmath.h:167
SpellEffectInfoVector GetEffectsForDifficulty(uint32 difficulty) const
Definition: SpellInfo.cpp:3311
Definition: QuestDef.h:234
uint32 SourceItemId
Definition: QuestDef.h:422
ExclusiveQuestGroups mExclusiveQuestGroups
Definition: ObjectMgr.h:1109
int32 RequiredMaxRepValue
Definition: QuestDef.h:497
Definition: QuestDef.h:232
uint8_t uint8
Definition: Define.h:152
int32 NextQuestID
Definition: QuestDef.h:488
Definition: QuestDef.h:215
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
int32 RewardFactionOverride[QUEST_REWARD_REPUTATIONS_COUNT]
Definition: QuestDef.h:445
DBCStorage< FactionEntry > sFactionStore(Factionfmt)
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
#define QUEST_REWARD_ITEM_COUNT
Definition: QuestDef.h:47
QuestAreaTriggerContainer _questAreaTriggerStore
Definition: ObjectMgr.h:1433
uint32_t uint32
Definition: g3dmath.h:168
uint32 RewardMailDelay
Definition: QuestDef.h:491
Definition: QuestDef.h:222
int32 MinLevel
Definition: QuestDef.h:407
uint32 NextQuestInChain
Definition: QuestDef.h:411
#define QUEST_ITEM_DROP_COUNT
Definition: QuestDef.h:45
Definition: QuestDef.h:236
PrevQuests prevQuests
Definition: QuestDef.h:392
uint32 RequiredSkillPoints
Definition: QuestDef.h:493
int32 GetPrevQuestId() const
Definition: QuestDef.h:322
Definition: QuestDef.h:235
uint32 RewardChoiceItemCount[QUEST_REWARD_CHOICES_COUNT]
Definition: QuestDef.h:430
uint32 SoundAccept
Definition: QuestDef.h:449
Definition: QuestDef.h:206
DB2Storage< SoundEntriesEntry > sSoundEntriesStore("SoundEntries.db2", SoundEntriesFormat, HOTFIX_SEL_SOUND_ENTRIES)
#define QUEST_REWARD_REPUTATIONS_COUNT
Definition: QuestDef.h:49
uint32 RewardItemCount[QUEST_REWARD_ITEM_COUNT]
Definition: QuestDef.h:426
Definition: QuestDef.h:205
uint32 Flags
Definition: QuestDef.h:423

+ Here is the call graph for this function:

void ObjectMgr::LoadQuestStartersAndEnders ( )
inline
929  {
930  TC_LOG_INFO("server.loading", "Loading GO Start Quest Data...");
932  TC_LOG_INFO("server.loading", "Loading GO End Quest Data...");
934  TC_LOG_INFO("server.loading", "Loading Creature Start Quest Data...");
936  TC_LOG_INFO("server.loading", "Loading Creature End Quest Data...");
938  }
void LoadCreatureQuestStarters()
Definition: ObjectMgr.cpp:7429
void LoadGameobjectQuestStarters()
Definition: ObjectMgr.cpp:7401
void LoadGameobjectQuestEnders()
Definition: ObjectMgr.cpp:7415
void LoadCreatureQuestEnders()
Definition: ObjectMgr.cpp:7443
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
void ObjectMgr::LoadQuestTemplateLocale ( )
4499 {
4500  uint32 oldMSTime = getMSTime();
4501 
4502  _questTemplateLocaleStore.clear(); // need for reload case
4503  // 0 1
4504  QueryResult result = WorldDatabase.Query("SELECT Id, locale, "
4505  // 2 3 4 5 6 7 8 9 10
4506  "LogTitle, LogDescription, QuestDescription, AreaDescription, PortraitGiverText, PortraitGiverName, PortraitTurnInText, PortraitTurnInName, QuestCompletionLog"
4507  " FROM quest_template_locale");
4508  if (!result)
4509  return;
4510 
4511  do
4512  {
4513  Field* fields = result->Fetch();
4514 
4515  uint32 id = fields[0].GetUInt32();
4516  std::string localeName = fields[1].GetString();
4517 
4518  std::string logTitle = fields[2].GetString();
4519  std::string logDescription = fields[3].GetString();
4520  std::string questDescription = fields[4].GetString();
4521  std::string areaDescription = fields[5].GetString();
4522  std::string portraitGiverText = fields[6].GetString();
4523  std::string portraitGiverName = fields[7].GetString();
4524  std::string portraitTurnInText = fields[8].GetString();
4525  std::string portraitTurnInName = fields[9].GetString();
4526  std::string questCompletionLog = fields[10].GetString();
4527 
4529  LocaleConstant locale = GetLocaleByName(localeName);
4530  if (locale == LOCALE_enUS)
4531  continue;
4532 
4533  AddLocaleString(logTitle, locale, data.LogTitle);
4534  AddLocaleString(logDescription, locale, data.LogDescription);
4535  AddLocaleString(questDescription, locale, data.QuestDescription);
4536  AddLocaleString(areaDescription, locale, data.AreaDescription);
4537  AddLocaleString(portraitGiverText, locale, data.PortraitGiverText);
4538  AddLocaleString(portraitGiverName, locale, data.PortraitGiverName);
4539  AddLocaleString(portraitTurnInText, locale, data.PortraitTurnInText);
4540  AddLocaleString(portraitTurnInName, locale, data.PortraitTurnInName);
4541  AddLocaleString(questCompletionLog, locale, data.QuestCompletionLog);
4542  } while (result->NextRow());
4543 
4544  TC_LOG_INFO("server.loading", ">> Loaded %u Quest Tempalate locale strings in %u ms", uint32(_questTemplateLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
4545 }
Class used to access individual fields of database query result.
Definition: Field.h:56
Definition: QuestDef.h:239
StringVector AreaDescription
Definition: QuestDef.h:244
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
StringVector PortraitGiverText
Definition: QuestDef.h:245
StringVector PortraitTurnInText
Definition: QuestDef.h:247
LocaleConstant
Definition: Common.h:115
LocaleConstant GetLocaleByName(const std::string &name)
Definition: Common.cpp:37
uint32_t uint32
Definition: Define.h:150
StringVector PortraitTurnInName
Definition: QuestDef.h:248
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
QuestTemplateLocaleContainer _questTemplateLocaleStore
Definition: ObjectMgr.h:1535
StringVector PortraitGiverName
Definition: QuestDef.h:246
StringVector LogTitle
Definition: QuestDef.h:241
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
static void AddLocaleString(std::string const &value, LocaleConstant localeConstant, StringVector &data)
Definition: ObjectMgr.cpp:295
Definition: Common.h:117
uint32 GetUInt32() const
Definition: Field.h:146
StringVector QuestCompletionLog
Definition: QuestDef.h:249
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
uint32_t uint32
Definition: g3dmath.h:168
StringVector QuestDescription
Definition: QuestDef.h:243
StringVector LogDescription
Definition: QuestDef.h:242
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

void ObjectMgr::LoadRaceAndClassExpansionRequirements ( )
9152 {
9153  uint32 oldMSTime = getMSTime();
9155 
9156  // 0 1
9157  QueryResult result = WorldDatabase.Query("SELECT raceID, expansion FROM `race_expansion_requirement`");
9158 
9159  if (result)
9160  {
9161  uint32 count = 0;
9162  do
9163  {
9164  Field* fields = result->Fetch();
9165 
9166  uint8 raceID = fields[0].GetInt8();
9167  uint8 expansion = fields[1].GetInt8();
9168 
9169  ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(raceID);
9170  if (!raceEntry)
9171  {
9172  TC_LOG_ERROR("sql.sql", "Race %u defined in `race_expansion_requirement` does not exists, skipped.", raceID);
9173  continue;
9174  }
9175 
9176  if (expansion >= MAX_EXPANSIONS)
9177  {
9178  TC_LOG_ERROR("sql.sql", "Race %u defined in `race_expansion_requirement` has incorrect expansion %u, skipped.", raceID, expansion);
9179  continue;
9180  }
9181 
9182  _raceExpansionRequirementStore[raceID] = expansion;
9183 
9184  ++count;
9185  }
9186  while (result->NextRow());
9187  TC_LOG_INFO("server.loading", ">> Loaded %u race expansion requirements in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
9188  }
9189  else
9190  TC_LOG_INFO("server.loading", ">> Loaded 0 race expansion requirements. DB table `race_expansion_requirement` is empty.");
9191 
9192  oldMSTime = getMSTime();
9194 
9195  // 0 1
9196  result = WorldDatabase.Query("SELECT classID, expansion FROM `class_expansion_requirement`");
9197 
9198  if (result)
9199  {
9200  uint32 count = 0;
9201  do
9202  {
9203  Field* fields = result->Fetch();
9204 
9205  uint8 classID = fields[0].GetInt8();
9206  uint8 expansion = fields[1].GetInt8();
9207 
9208  ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(classID);
9209  if (!classEntry)
9210  {
9211  TC_LOG_ERROR("sql.sql", "Class %u defined in `class_expansion_requirement` does not exists, skipped.", classID);
9212  continue;
9213  }
9214 
9215  if (expansion >= MAX_EXPANSIONS)
9216  {
9217  TC_LOG_ERROR("sql.sql", "Class %u defined in `class_expansion_requirement` has incorrect expansion %u, skipped.", classID, expansion);
9218  continue;
9219  }
9220 
9221  _classExpansionRequirementStore[classID] = expansion;
9222 
9223  ++count;
9224  }
9225  while (result->NextRow());
9226  TC_LOG_INFO("server.loading", ">> Loaded %u class expansion requirements in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
9227  }
9228  else
9229  TC_LOG_INFO("server.loading", ">> Loaded 0 class expansion requirements. DB table `class_expansion_requirement` is empty.");
9230 }
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesfmt)
DBCStorage< ChrClassesEntry > sChrClassesStore(ChrClassesfmt)
Definition: DBCStructure.h:204
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
ExpansionRequirementContainer _raceExpansionRequirementStore
Definition: ObjectMgr.h:1549
Definition: DBCStructure.h:181
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
Definition: SharedDefines.h:85
uint8_t uint8
Definition: Define.h:152
ExpansionRequirementContainer _classExpansionRequirementStore
Definition: ObjectMgr.h:1550
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
int8 GetInt8() const
Definition: Field.h:89

+ Here is the call graph for this function:

void ObjectMgr::LoadRealmNames ( )
9308 {
9309  uint32 oldMSTime = getMSTime();
9310  _realmNameStore.clear();
9311 
9312  // 0 1
9313  QueryResult result = LoginDatabase.Query("SELECT id, name FROM `realmlist`");
9314 
9315  if (!result)
9316  {
9317  TC_LOG_INFO("server.loading", ">> Loaded 0 realm names. DB table `realmlist` is empty.");
9318  return;
9319  }
9320 
9321  uint32 count = 0;
9322  do
9323  {
9324  Field* fields = result->Fetch();
9325 
9326  uint32 realmId = fields[0].GetUInt32();
9327  std::string realmName = fields[1].GetString();
9328 
9329  _realmNameStore[realmId] = realmName;
9330 
9331  ++count;
9332  }
9333  while (result->NextRow());
9334  TC_LOG_INFO("server.loading", ">> Loaded %u realm names in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
9335 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
RealmNameContainer _realmNameStore
Definition: ObjectMgr.h:1551
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

int ObjectMgr::LoadReferenceVendor ( int32  vendor,
int32  item,
uint8  type,
std::set< uint32 > *  skip_vendors 
)
8225 {
8226  // find all items from the reference vendor
8228  stmt->setUInt32(0, uint32(item));
8229  stmt->setUInt8(1, referenceType);
8230  PreparedQueryResult result = WorldDatabase.Query(stmt);
8231 
8232  if (!result)
8233  return 0;
8234 
8235  uint32 count = 0;
8236  do
8237  {
8238  Field* fields = result->Fetch();
8239 
8240  int32 item_id = fields[0].GetInt32();
8241 
8242  // if item is a negative, its a reference
8243  if (item_id < 0)
8244  count += LoadReferenceVendor(vendor, -item_id, referenceType, skip_vendors);
8245  else
8246  {
8247  int32 maxcount = fields[1].GetUInt32();
8248  uint32 incrtime = fields[2].GetUInt32();
8249  uint32 ExtendedCost = fields[3].GetUInt32();
8250  uint8 type = fields[4].GetUInt8();
8251 
8252  if (!IsVendorItemValid(vendor, item_id, maxcount, incrtime, ExtendedCost, type, NULL, skip_vendors))
8253  continue;
8254 
8255  VendorItemData& vList = _cacheVendorItemStore[vendor];
8256 
8257  vList.AddItem(item_id, maxcount, incrtime, ExtendedCost, type);
8258  ++count;
8259  }
8260  } while (result->NextRow());
8261 
8262  return count;
8263 }
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
Class used to access individual fields of database query result.
Definition: Field.h:56
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
arena_t NULL
Definition: jemalloc_internal.h:624
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: PreparedStatement.h:74
uint8 GetUInt8() const
Definition: Field.h:70
Definition: WorldDatabase.h:46
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
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
int32 GetInt32() const
Definition: Field.h:165
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
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
Definition: ObjectMgr.cpp:8480
uint8_t uint8
Definition: Define.h:152
uint32_t uint32
Definition: g3dmath.h:168
Definition: Creature.h:383
void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, uint8 type)
Definition: Creature.h:396
int LoadReferenceVendor(int32 vendor, int32 item, uint8 type, std::set< uint32 > *skip_vendors)
Definition: ObjectMgr.cpp:8224

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ObjectMgr::LoadReputationOnKill ( )
6974 {
6975  uint32 oldMSTime = getMSTime();
6976 
6977  // For reload case
6978  _repOnKillStore.clear();
6979 
6980  uint32 count = 0;
6981 
6982  // 0 1 2
6983  QueryResult result = WorldDatabase.Query("SELECT creature_id, RewOnKillRepFaction1, RewOnKillRepFaction2, "
6984  // 3 4 5 6 7 8 9
6985  "IsTeamAward1, MaxStanding1, RewOnKillRepValue1, IsTeamAward2, MaxStanding2, RewOnKillRepValue2, TeamDependent "
6986  "FROM creature_onkill_reputation");
6987 
6988  if (!result)
6989  {
6990  TC_LOG_ERROR("server.loading", ">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty.");
6991  return;
6992  }
6993 
6994  do
6995  {
6996  Field* fields = result->Fetch();
6997 
6998  uint32 creature_id = fields[0].GetUInt32();
6999 
7000  ReputationOnKillEntry repOnKill;
7001  repOnKill.RepFaction1 = fields[1].GetInt16();
7002  repOnKill.RepFaction2 = fields[2].GetInt16();
7003  repOnKill.IsTeamAward1 = fields[3].GetBool();
7004  repOnKill.ReputationMaxCap1 = fields[4].GetUInt8();
7005  repOnKill.RepValue1 = fields[5].GetInt32();
7006  repOnKill.IsTeamAward2 = fields[6].GetBool();
7007  repOnKill.ReputationMaxCap2 = fields[7].GetUInt8();
7008  repOnKill.RepValue2 = fields[8].GetInt32();
7009  repOnKill.TeamDependent = fields[9].GetBool();
7010 
7011  if (!GetCreatureTemplate(creature_id))
7012  {
7013  TC_LOG_ERROR("sql.sql", "Table `creature_onkill_reputation` has data for nonexistent creature entry (%u), skipped", creature_id);
7014  continue;
7015  }
7016 
7017  if (repOnKill.RepFaction1)
7018  {
7019  FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repOnKill.RepFaction1);
7020  if (!factionEntry1)
7021  {
7022  TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction1);
7023  continue;
7024  }
7025  }
7026 
7027  if (repOnKill.RepFaction2)
7028  {
7029  FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repOnKill.RepFaction2);
7030  if (!factionEntry2)
7031  {
7032  TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction2);
7033  continue;
7034  }
7035  }
7036 
7037  _repOnKillStore[creature_id] = repOnKill;
7038 
7039  ++count;
7040  } while (result->NextRow());
7041 
7042  TC_LOG_INFO("server.loading", ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
7043 }
RepOnKillContainer _repOnKillStore
Definition: ObjectMgr.h:1444
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32 ReputationMaxCap2
Definition: ObjectMgr.h:486
uint32 RepFaction2
Definition: ObjectMgr.h:483
uint8 GetUInt8() const
Definition: Field.h:70
bool TeamDependent
Definition: ObjectMgr.h:490
uint32_t uint32
Definition: Define.h:150
Definition: ObjectMgr.h:480
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
int32 RepValue2
Definition: ObjectMgr.h:487
uint32 ReputationMaxCap1
Definition: ObjectMgr.h:484
Definition: DBCStructure.h:405
int32 GetInt32() const
Definition: Field.h:165
int16 GetInt16() const
Definition: Field.h:127
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
bool IsTeamAward1
Definition: ObjectMgr.h:488
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
DBCStorage< FactionEntry > sFactionStore(Factionfmt)
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
bool GetBool() const
Definition: Field.h:65
uint32 RepFaction1
Definition: ObjectMgr.h:482
bool IsTeamAward2
Definition: ObjectMgr.h:489
int32 RepValue1
Definition: ObjectMgr.h:485

+ Here is the call graph for this function:

void ObjectMgr::LoadReputationRewardRate ( )
6886 {
6887  uint32 oldMSTime = getMSTime();
6888 
6889  _repRewardRateStore.clear(); // for reload case
6890 
6891  uint32 count = 0; // 0 1 2 3 4 5 6 7
6892  QueryResult result = WorldDatabase.Query("SELECT faction, quest_rate, quest_daily_rate, quest_weekly_rate, quest_monthly_rate, quest_repeatable_rate, creature_rate, spell_rate FROM reputation_reward_rate");
6893  if (!result)
6894  {
6895  TC_LOG_ERROR("server.loading", ">> Loaded `reputation_reward_rate`, table is empty!");
6896  return;
6897  }
6898 
6899  do
6900  {
6901  Field* fields = result->Fetch();
6902 
6903  uint32 factionId = fields[0].GetUInt32();
6904 
6905  RepRewardRate repRate;
6906 
6907  repRate.questRate = fields[1].GetFloat();
6908  repRate.questDailyRate = fields[2].GetFloat();
6909  repRate.questWeeklyRate = fields[3].GetFloat();
6910  repRate.questMonthlyRate = fields[4].GetFloat();
6911  repRate.questRepeatableRate = fields[5].GetFloat();
6912  repRate.creatureRate = fields[6].GetFloat();
6913  repRate.spellRate = fields[7].GetFloat();
6914 
6915  FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId);
6916  if (!factionEntry)
6917  {
6918  TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_reward_rate`", factionId);
6919  continue;
6920  }
6921 
6922  if (repRate.questRate < 0.0f)
6923  {
6924  TC_LOG_ERROR("sql.sql", "Table reputation_reward_rate has quest_rate with invalid rate %f, skipping data for faction %u", repRate.questRate, factionId);
6925  continue;
6926  }
6927 
6928  if (repRate.questDailyRate < 0.0f)
6929  {
6930  TC_LOG_ERROR("sql.sql", "Table reputation_reward_rate has quest_daily_rate with invalid rate %f, skipping data for faction %u", repRate.questDailyRate, factionId);
6931  continue;
6932  }
6933 
6934  if (repRate.questWeeklyRate < 0.0f)
6935  {
6936  TC_LOG_ERROR("sql.sql", "Table reputation_reward_rate has quest_weekly_rate with invalid rate %f, skipping data for faction %u", repRate.questWeeklyRate, factionId);
6937  continue;
6938  }
6939 
6940  if (repRate.questMonthlyRate < 0.0f)
6941  {
6942  TC_LOG_ERROR("sql.sql", "Table reputation_reward_rate has quest_monthly_rate with invalid rate %f, skipping data for faction %u", repRate.questMonthlyRate, factionId);
6943  continue;
6944  }
6945 
6946  if (repRate.questRepeatableRate < 0.0f)
6947  {
6948  TC_LOG_ERROR("sql.sql", "Table reputation_reward_rate has quest_repeatable_rate with invalid rate %f, skipping data for faction %u", repRate.questRepeatableRate, factionId);
6949  continue;
6950  }
6951 
6952  if (repRate.creatureRate < 0.0f)
6953  {
6954  TC_LOG_ERROR("sql.sql", "Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creatureRate, factionId);
6955  continue;
6956  }
6957 
6958  if (repRate.spellRate < 0.0f)
6959  {
6960  TC_LOG_ERROR("sql.sql", "Table reputation_reward_rate has spell_rate with invalid rate %f, skipping data for faction %u", repRate.spellRate, factionId);
6961  continue;
6962  }
6963 
6964  _repRewardRateStore[factionId] = repRate;
6965 
6966  ++count;
6967  }
6968  while (result->NextRow());
6969 
6970  TC_LOG_INFO("server.loading", ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
6971 }
float GetFloat() const
Definition: Field.h:222
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: ObjectMgr.h:469
float creatureRate
Definition: ObjectMgr.h:476
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
float questRepeatableRate
Definition: ObjectMgr.h:475
Definition: DBCStructure.h:405
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
float questWeeklyRate
Definition: ObjectMgr.h:473
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
float questMonthlyRate
Definition: ObjectMgr.h:474
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
DBCStorage< FactionEntry > sFactionStore(Factionfmt)
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
float questRate
Definition: ObjectMgr.h:471
float questDailyRate
Definition: ObjectMgr.h:472
float spellRate
Definition: ObjectMgr.h:477
RepRewardRateContainer _repRewardRateStore
Definition: ObjectMgr.h:1443

+ Here is the call graph for this function:

void ObjectMgr::LoadReputationSpilloverTemplate ( )
7046 {
7047  uint32 oldMSTime = getMSTime();
7048 
7049  _repSpilloverTemplateStore.clear(); // for reload case
7050 
7051  uint32 count = 0; // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
7052  QueryResult result = WorldDatabase.Query("SELECT faction, faction1, rate_1, rank_1, faction2, rate_2, rank_2, faction3, rate_3, rank_3, faction4, rate_4, rank_4, faction5, rate_5, rank_5 FROM reputation_spillover_template");
7053 
7054  if (!result)
7055  {
7056  TC_LOG_INFO("server.loading", ">> Loaded `reputation_spillover_template`, table is empty.");
7057  return;
7058  }
7059 
7060  do
7061  {
7062  Field* fields = result->Fetch();
7063 
7064  uint32 factionId = fields[0].GetUInt16();
7065 
7066  RepSpilloverTemplate repTemplate;
7067 
7068  repTemplate.faction[0] = fields[1].GetUInt16();
7069  repTemplate.faction_rate[0] = fields[2].GetFloat();
7070  repTemplate.faction_rank[0] = fields[3].GetUInt8();
7071  repTemplate.faction[1] = fields[4].GetUInt16();
7072  repTemplate.faction_rate[1] = fields[5].GetFloat();
7073  repTemplate.faction_rank[1] = fields[6].GetUInt8();
7074  repTemplate.faction[2] = fields[7].GetUInt16();
7075  repTemplate.faction_rate[2] = fields[8].GetFloat();
7076  repTemplate.faction_rank[2] = fields[9].GetUInt8();
7077  repTemplate.faction[3] = fields[10].GetUInt16();
7078  repTemplate.faction_rate[3] = fields[11].GetFloat();
7079  repTemplate.faction_rank[3] = fields[12].GetUInt8();
7080  repTemplate.faction[4] = fields[13].GetUInt16();
7081  repTemplate.faction_rate[4] = fields[14].GetFloat();
7082  repTemplate.faction_rank[4] = fields[15].GetUInt8();
7083 
7084  FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId);
7085 
7086  if (!factionEntry)
7087  {
7088  TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", factionId);
7089  continue;
7090  }
7091 
7092  if (factionEntry->ParentFactionID == 0)
7093  {
7094  TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u in `reputation_spillover_template` does not belong to any team, skipping", factionId);
7095  continue;
7096  }
7097 
7098  bool invalidSpilloverFaction = false;
7099  for (uint32 i = 0; i < MAX_SPILLOVER_FACTIONS; ++i)
7100  {
7101  if (repTemplate.faction[i])
7102  {
7103  FactionEntry const* factionSpillover = sFactionStore.LookupEntry(repTemplate.faction[i]);
7104 
7105  if (!factionSpillover)
7106  {
7107  TC_LOG_ERROR("sql.sql", "Spillover faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template` for faction %u, skipping", repTemplate.faction[i], factionId);
7108  invalidSpilloverFaction = true;
7109  break;
7110  }
7111 
7112  if (!factionSpillover->CanHaveReputation())
7113  {
7114  TC_LOG_ERROR("sql.sql", "Spillover faction (faction.dbc) %u for faction %u in `reputation_spillover_template` can not be listed for client, and then useless, skipping", repTemplate.faction[i], factionId);
7115  invalidSpilloverFaction = true;
7116  break;
7117  }
7118 
7119  if (repTemplate.faction_rank[i] >= MAX_REPUTATION_RANK)
7120  {
7121  TC_LOG_ERROR("sql.sql", "Rank %u used in `reputation_spillover_template` for spillover faction %u is not valid, skipping", repTemplate.faction_rank[i], repTemplate.faction[i]);
7122  invalidSpilloverFaction = true;
7123  break;
7124  }
7125  }
7126  }
7127 
7128  if (invalidSpilloverFaction)
7129  continue;
7130 
7131  _repSpilloverTemplateStore[factionId] = repTemplate;
7132 
7133  ++count;
7134  }
7135  while (result->NextRow());
7136 
7137  TC_LOG_INFO("server.loading", ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
7138 }
uint32 ParentFactionID
Definition: DBCStructure.h:413
float GetFloat() const
Definition: Field.h:222
Class used to access individual fields of database query result.
Definition: Field.h:56
#define MAX_SPILLOVER_FACTIONS
Definition: SharedDefines.h:226
uint32 getMSTime()
Definition: Timer.h:24
uint32 faction_rank[MAX_SPILLOVER_FACTIONS]
Definition: ObjectMgr.h:497
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
float faction_rate[MAX_SPILLOVER_FACTIONS]
Definition: ObjectMgr.h:496
#define MAX_REPUTATION_RANK
Definition: SharedDefines.h:224
RepSpilloverTemplateContainer _repSpilloverTemplateStore
Definition: ObjectMgr.h:1445
uint8 GetUInt8() const
Definition: Field.h:70
uint32 faction[MAX_SPILLOVER_FACTIONS]
Definition: ObjectMgr.h:495
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint16 GetUInt16() const
Definition: Field.h:108
Definition: DBCStructure.h:405
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
DBCStorage< FactionEntry > sFactionStore(Factionfmt)
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
bool CanHaveReputation() const
Definition: DBCStructure.h:425
Definition: ObjectMgr.h:493

+ Here is the call graph for this function:

void ObjectMgr::LoadReservedPlayersNames ( )
7458 {
7459  uint32 oldMSTime = getMSTime();
7460 
7461  _reservedNamesStore.clear(); // need for reload case
7462 
7463  QueryResult result = CharacterDatabase.Query("SELECT name FROM reserved_name");
7464 
7465  if (!result)
7466  {
7467  TC_LOG_INFO("server.loading", ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!");
7468  return;
7469  }
7470 
7471  uint32 count = 0;
7472 
7473  Field* fields;
7474  do
7475  {
7476  fields = result->Fetch();
7477  std::string name= fields[0].GetString();
7478 
7479  std::wstring wstr;
7480  if (!Utf8toWStr (name, wstr))
7481  {
7482  TC_LOG_ERROR("misc", "Table `reserved_name` has invalid name: %s", name.c_str());
7483  continue;
7484  }
7485 
7486  wstrToLower(wstr);
7487 
7488  _reservedNamesStore.insert(wstr);
7489  ++count;
7490  }
7491  while (result->NextRow());
7492 
7493  TC_LOG_INFO("server.loading", ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
7494 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
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
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
ReservedNamesContainer _reservedNamesStore
Definition: ObjectMgr.h:1462
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

void ObjectMgr::LoadScriptNames ( )
8569 {
8570  uint32 oldMSTime = getMSTime();
8571 
8572  _scriptNamesStore.emplace_back("");
8573 
8574  QueryResult result = WorldDatabase.Query(
8575  "SELECT DISTINCT(ScriptName) FROM achievement_criteria_data WHERE ScriptName <> '' AND type = 11 "
8576  "UNION "
8577  "SELECT DISTINCT(ScriptName) FROM battleground_template WHERE ScriptName <> '' "
8578  "UNION "
8579  "SELECT DISTINCT(ScriptName) FROM creature_template WHERE ScriptName <> '' "
8580  "UNION "
8581  "SELECT DISTINCT(ScriptName) FROM gameobject_template WHERE ScriptName <> '' "
8582  "UNION "
8583  "SELECT DISTINCT(ScriptName) FROM item_script_names WHERE ScriptName <> '' "
8584  "UNION "
8585  "SELECT DISTINCT(ScriptName) FROM areatrigger_scripts WHERE ScriptName <> '' "
8586  "UNION "
8587  "SELECT DISTINCT(ScriptName) FROM spell_script_names WHERE ScriptName <> '' "
8588  "UNION "
8589  "SELECT DISTINCT(ScriptName) FROM transports WHERE ScriptName <> '' "
8590  "UNION "
8591  "SELECT DISTINCT(ScriptName) FROM game_weather WHERE ScriptName <> '' "
8592  "UNION "
8593  "SELECT DISTINCT(ScriptName) FROM conditions WHERE ScriptName <> '' "
8594  "UNION "
8595  "SELECT DISTINCT(ScriptName) FROM outdoorpvp_template WHERE ScriptName <> '' "
8596  "UNION "
8597  "SELECT DISTINCT(script) FROM instance_template WHERE script <> ''");
8598 
8599  if (!result)
8600  {
8601  TC_LOG_ERROR("server.loading", ">> Loaded empty set of Script Names!");
8602  return;
8603  }
8604 
8605  do
8606  {
8607  _scriptNamesStore.push_back((*result)[0].GetString());
8608  }
8609  while (result->NextRow());
8610 
8611  std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end());
8612 
8613 #ifdef SCRIPTS
8614  for (size_t i = 1; i < _scriptNamesStore.size(); ++i)
8615  UnusedScriptNames.push_back(_scriptNamesStore[i]);
8616 #endif
8617 
8618  TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " ScriptNames in %u ms", _scriptNamesStore.size(), GetMSTimeDiffToNow(oldMSTime));
8619 }
#define SZFMTD
Definition: Define.h:143
ScriptNameContainer _scriptNamesStore
Definition: ObjectMgr.h:1466
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
UnusedScriptNamesContainer UnusedScriptNames
Definition: ScriptMgr.cpp:40

+ Here is the call graph for this function:

void ObjectMgr::LoadScripts ( ScriptsType  type)
private
4579 {
4580  uint32 oldMSTime = getMSTime();
4581 
4582  ScriptMapMap* scripts = GetScriptsMapByType(type);
4583  if (!scripts)
4584  return;
4585 
4586  std::string tableName = GetScriptsTableNameByType(type);
4587  if (tableName.empty())
4588  return;
4589 
4590  if (sScriptMgr->IsScriptScheduled()) // function cannot be called when scripts are in use.
4591  return;
4592 
4593  TC_LOG_INFO("server.loading", "Loading %s...", tableName.c_str());
4594 
4595  scripts->clear(); // need for reload support
4596 
4597  bool isSpellScriptTable = (type == SCRIPTS_SPELL);
4598  // 0 1 2 3 4 5 6 7 8 9
4599  QueryResult result = WorldDatabase.PQuery("SELECT id, delay, command, datalong, datalong2, dataint, x, y, z, o%s FROM %s", isSpellScriptTable ? ", effIndex" : "", tableName.c_str());
4600 
4601  if (!result)
4602  {
4603  TC_LOG_INFO("server.loading", ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str());
4604  return;
4605  }
4606 
4607  uint32 count = 0;
4608 
4609  do
4610  {
4611  Field* fields = result->Fetch();
4612  ScriptInfo tmp;
4613  tmp.type = type;
4614  tmp.id = fields[0].GetUInt32();
4615  if (isSpellScriptTable)
4616  tmp.id |= fields[10].GetUInt8() << 24;
4617  tmp.delay = fields[1].GetUInt32();
4618  tmp.command = ScriptCommands(fields[2].GetUInt32());
4619  tmp.Raw.nData[0] = fields[3].GetUInt32();
4620  tmp.Raw.nData[1] = fields[4].GetUInt32();
4621  tmp.Raw.nData[2] = fields[5].GetInt32();
4622  tmp.Raw.fData[0] = fields[6].GetFloat();
4623  tmp.Raw.fData[1] = fields[7].GetFloat();
4624  tmp.Raw.fData[2] = fields[8].GetFloat();
4625  tmp.Raw.fData[3] = fields[9].GetFloat();
4626 
4627  // generic command args check
4628  switch (tmp.command)
4629  {
4630  case SCRIPT_COMMAND_TALK:
4631  {
4632  if (tmp.Talk.ChatType > CHAT_TYPE_WHISPER && tmp.Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER)
4633  {
4634  TC_LOG_ERROR("sql.sql", "Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u",
4635  tableName.c_str(), tmp.Talk.ChatType, tmp.id);
4636  continue;
4637  }
4638  if (!sBroadcastTextStore.LookupEntry(uint32(tmp.Talk.TextID)))
4639  {
4640  TC_LOG_ERROR("sql.sql", "Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u",
4641  tableName.c_str(), tmp.Talk.TextID, tmp.id);
4642  continue;
4643  }
4644 
4645  break;
4646  }
4647 
4648  case SCRIPT_COMMAND_EMOTE:
4649  {
4650  if (!sEmotesStore.LookupEntry(tmp.Emote.EmoteID))
4651  {
4652  TC_LOG_ERROR("sql.sql", "Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u",
4653  tableName.c_str(), tmp.Emote.EmoteID, tmp.id);
4654  continue;
4655  }
4656  break;
4657  }
4658 
4660  {
4661  if (!sMapStore.LookupEntry(tmp.TeleportTo.MapID))
4662  {
4663  TC_LOG_ERROR("sql.sql", "Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",
4664  tableName.c_str(), tmp.TeleportTo.MapID, tmp.id);
4665  continue;
4666  }
4667 
4668  if (!Trinity::IsValidMapCoord(tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation))
4669  {
4670  TC_LOG_ERROR("sql.sql", "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",
4671  tableName.c_str(), tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation, tmp.id);
4672  continue;
4673  }
4674  break;
4675  }
4676 
4678  {
4679  Quest const* quest = GetQuestTemplate(tmp.QuestExplored.QuestID);
4680  if (!quest)
4681  {
4682  TC_LOG_ERROR("sql.sql", "Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",
4683  tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id);
4684  continue;
4685  }
4686 
4688  {
4689  TC_LOG_ERROR("sql.sql", "Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.",
4690  tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id);
4691 
4692  // this will prevent quest completing without objective
4693  const_cast<Quest*>(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT);
4694 
4695  // continue; - quest objective requirement set and command can be allowed
4696  }
4697 
4698  if (float(tmp.QuestExplored.Distance) > DEFAULT_VISIBILITY_DISTANCE)
4699  {
4700  TC_LOG_ERROR("sql.sql", "Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",
4701  tableName.c_str(), tmp.QuestExplored.Distance, tmp.id);
4702  continue;
4703  }
4704 
4705  if (tmp.QuestExplored.Distance && float(tmp.QuestExplored.Distance) > DEFAULT_VISIBILITY_DISTANCE)
4706  {
4707  TC_LOG_ERROR("sql.sql", "Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check",
4708  tableName.c_str(), tmp.QuestExplored.Distance, tmp.id, DEFAULT_VISIBILITY_DISTANCE);
4709  continue;
4710  }
4711 
4712  if (tmp.QuestExplored.Distance && float(tmp.QuestExplored.Distance) < INTERACTION_DISTANCE)
4713  {
4714  TC_LOG_ERROR("sql.sql", "Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check",
4715  tableName.c_str(), tmp.QuestExplored.Distance, tmp.id, INTERACTION_DISTANCE);
4716  continue;
4717  }
4718 
4719  break;
4720  }
4721 
4723  {
4724  if (!GetCreatureTemplate(tmp.KillCredit.CreatureEntry))
4725  {
4726  TC_LOG_ERROR("sql.sql", "Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u",
4727  tableName.c_str(), tmp.KillCredit.CreatureEntry, tmp.id);
4728  continue;
4729  }
4730  break;
4731  }
4732 
4734  {
4735  GameObjectData const* data = GetGOData(tmp.RespawnGameobject.GOGuid);
4736  if (!data)
4737  {
4738  TC_LOG_ERROR("sql.sql", "Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
4739  tableName.c_str(), tmp.RespawnGameobject.GOGuid, tmp.id);
4740  continue;
4741  }
4742 
4743  GameObjectTemplate const* info = GetGameObjectTemplate(data->id);
4744  if (!info)
4745  {
4746  TC_LOG_ERROR("sql.sql", "Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
4747  tableName.c_str(), tmp.RespawnGameobject.GOGuid, data->id, tmp.id);
4748  continue;
4749  }
4750 
4751  if (info->type == GAMEOBJECT_TYPE_FISHINGNODE ||
4752  info->type == GAMEOBJECT_TYPE_FISHINGHOLE ||
4753  info->type == GAMEOBJECT_TYPE_DOOR ||
4754  info->type == GAMEOBJECT_TYPE_BUTTON ||
4755  info->type == GAMEOBJECT_TYPE_TRAP)
4756  {
4757  TC_LOG_ERROR("sql.sql", "Table `%s` has gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
4758  tableName.c_str(), info->entry, tmp.id);
4759  continue;
4760  }
4761  break;
4762  }
4763 
4765  {
4766  if (!Trinity::IsValidMapCoord(tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation))
4767  {
4768  TC_LOG_ERROR("sql.sql", "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",
4769  tableName.c_str(), tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation, tmp.id);
4770  continue;
4771  }
4772 
4773  if (!GetCreatureTemplate(tmp.TempSummonCreature.CreatureEntry))
4774  {
4775  TC_LOG_ERROR("sql.sql", "Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",
4776  tableName.c_str(), tmp.TempSummonCreature.CreatureEntry, tmp.id);
4777  continue;
4778  }
4779  break;
4780  }
4781 
4784  {
4785  GameObjectData const* data = GetGOData(tmp.ToggleDoor.GOGuid);
4786  if (!data)
4787  {
4788  TC_LOG_ERROR("sql.sql", "Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u",
4789  tableName.c_str(), tmp.ToggleDoor.GOGuid, GetScriptCommandName(tmp.command).c_str(), tmp.id);
4790  continue;
4791  }
4792 
4793  GameObjectTemplate const* info = GetGameObjectTemplate(data->id);
4794  if (!info)
4795  {
4796  TC_LOG_ERROR("sql.sql", "Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u",
4797  tableName.c_str(), tmp.ToggleDoor.GOGuid, data->id, GetScriptCommandName(tmp.command).c_str(), tmp.id);
4798  continue;
4799  }
4800 
4801  if (info->type != GAMEOBJECT_TYPE_DOOR)
4802  {
4803  TC_LOG_ERROR("sql.sql", "Table `%s` has gameobject type (%u) unsupported by command %s for script id %u",
4804  tableName.c_str(), info->entry, GetScriptCommandName(tmp.command).c_str(), tmp.id);
4805  continue;
4806  }
4807 
4808  break;
4809  }
4810 
4812  {
4813  if (!sSpellMgr->GetSpellInfo(tmp.RemoveAura.SpellID))
4814  {
4815  TC_LOG_ERROR("sql.sql", "Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u",
4816  tableName.c_str(), tmp.RemoveAura.SpellID, tmp.id);
4817  continue;
4818  }
4819  if (tmp.RemoveAura.Flags & ~0x1) // 1 bits (0, 1)
4820  {
4821  TC_LOG_ERROR("sql.sql", "Table `%s` using unknown flags in datalong2 (%u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u",
4822  tableName.c_str(), tmp.RemoveAura.Flags, tmp.id);
4823  continue;
4824  }
4825  break;
4826  }
4827 
4829  {
4830  if (!sSpellMgr->GetSpellInfo(tmp.CastSpell.SpellID))
4831  {
4832  TC_LOG_ERROR("sql.sql", "Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
4833  tableName.c_str(), tmp.CastSpell.SpellID, tmp.id);
4834  continue;
4835  }
4836  if (tmp.CastSpell.Flags > 4) // targeting type
4837  {
4838  TC_LOG_ERROR("sql.sql", "Table `%s` using unknown target in datalong2 (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
4839  tableName.c_str(), tmp.CastSpell.Flags, tmp.id);
4840  continue;
4841  }
4842  if (tmp.CastSpell.Flags != 4 && tmp.CastSpell.CreatureEntry & ~0x1) // 1 bit (0, 1)
4843  {
4844  TC_LOG_ERROR("sql.sql", "Table `%s` using unknown flags in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
4845  tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id);
4846  continue;
4847  }
4848  else if (tmp.CastSpell.Flags == 4 && !GetCreatureTemplate(tmp.CastSpell.CreatureEntry))
4849  {
4850  TC_LOG_ERROR("sql.sql", "Table `%s` using invalid creature entry in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
4851  tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id);
4852  continue;
4853  }
4854  break;
4855  }
4856 
4858  {
4859  if (!GetItemTemplate(tmp.CreateItem.ItemEntry))
4860  {
4861  TC_LOG_ERROR("sql.sql", "Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u",
4862  tableName.c_str(), tmp.CreateItem.ItemEntry, tmp.id);
4863  continue;
4864  }
4865  if (!tmp.CreateItem.Amount)
4866  {
4867  TC_LOG_ERROR("sql.sql", "Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u",
4868  tableName.c_str(), tmp.CreateItem.Amount, tmp.id);
4869  continue;
4870  }
4871  break;
4872  }
4874  {
4875  if (!sAnimKitStore.LookupEntry(tmp.PlayAnimKit.AnimKitID))
4876  {
4877  TC_LOG_ERROR("sql.sql", "Table `%s` has invalid AnimKid id (datalong = %u) in SCRIPT_COMMAND_PLAY_ANIMKIT for script id %u",
4878  tableName.c_str(), tmp.PlayAnimKit.AnimKitID, tmp.id);
4879  continue;
4880  }
4881  break;
4882  }
4883  default:
4884  break;
4885  }
4886 
4887  if (scripts->find(tmp.id) == scripts->end())
4888  {
4889  ScriptMap emptyMap;
4890  (*scripts)[tmp.id] = emptyMap;
4891  }
4892  (*scripts)[tmp.id].insert(std::pair<uint32, ScriptInfo>(tmp.delay, tmp));
4893 
4894  ++count;
4895  }
4896  while (result->NextRow());
4897 
4898  TC_LOG_INFO("server.loading", ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
4899 }
#define INTERACTION_DISTANCE
Definition: Object.h:34
GameObjectTemplate const * GetGameObjectTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9104
std::string GetScriptCommandName(ScriptCommands command)
Definition: ObjectMgr.cpp:81
Definition: ObjectMgr.h:97
Definition: ObjectMgr.h:96
std::multimap< uint32, ScriptInfo > ScriptMap
Definition: ObjectMgr.h:375
Definition: ObjectMgr.h:95
struct ScriptInfo::@280::@297 CreateItem
Definition: ObjectMgr.h:94
Definition: QuestDef.h:279
float GetFloat() const
Definition: Field.h:222
Quest const * GetQuestTemplate(uint32 quest_id) const
Definition: ObjectMgr.h:815
QueryResult PQuery(Format &&sql, T *conn, Args &&...args)
Definition: DatabaseWorkerPool.h:165
DB2Storage< BroadcastTextEntry > sBroadcastTextStore("BroadcastText.db2", BroadcastTextFormat, HOTFIX_SEL_BROADCAST_TEXT)
ScriptCommands command
Definition: ObjectMgr.h:187
Class used to access individual fields of database query result.
Definition: Field.h:56
Definition: ObjectMgr.h:103
Definition: ObjectMgr.h:142
std::map< uint32, ScriptMap > ScriptMapMap
Definition: ObjectMgr.h:376
ScriptCommands
Definition: ObjectMgr.h:84
uint32 getMSTime()
Definition: Timer.h:24
Definition: ObjectMgr.h:101
uint32 id
Definition: ObjectMgr.h:185
Definition: GameObject.h:34
struct ScriptInfo::@280::@284 Emote
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: ObjectMgr.h:182
Definition: SharedDefines.h:2082
ScriptsType type
Definition: ObjectMgr.h:184
Definition: ObjectMgr.h:87
DBCStorage< EmotesEntry > sEmotesStore(Emotesfmt)
struct ScriptInfo::@280::@291 RespawnGameobject
uint8 GetUInt8() const
Definition: Field.h:70
struct ScriptInfo::@280::@283 Talk
Definition: ObjectMgr.h:86
std::string GetScriptsTableNameByType(ScriptsType type)
Definition: ObjectMgr.cpp:55
Definition: SharedDefines.h:2066
struct ScriptInfo::@280::@306 PlayAnimKit
uint32 delay
Definition: ObjectMgr.h:186
bool IsValidMapCoord(float c)
Definition: GridDefines.h:218
struct ScriptInfo::@280::@294 RemoveAura
struct ScriptInfo::@280::@282 Raw
bool HasSpecialFlag(uint32 flag) const
Definition: QuestDef.h:300
struct ScriptInfo::@280::@293 ToggleDoor
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: SharedDefines.h:4273
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 id
Definition: GameObject.h:838
struct ScriptInfo::@280::@295 CastSpell
ScriptMapMap * GetScriptsMapByType(ScriptsType type)
Definition: ObjectMgr.cpp:68
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
uint32 entry
Definition: GameObject.h:36
Definition: ObjectMgr.h:92
GameObjectData const * GetGOData(ObjectGuid::LowType guid) const
Definition: ObjectMgr.h:1209
Definition: SharedDefines.h:2090
int32 GetInt32() const
Definition: Field.h:165
Definition: GameObject.h:833
struct ScriptInfo::@280::@292 TempSummonCreature
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
Definition: ObjectMgr.h:100
DBCStorage< MapEntry > sMapStore(Mapfmt)
Definition: ObjectMgr.h:98
Definition: ObjectMgr.h:116
uint32 GetUInt32() const
Definition: Field.h:146
DBCStorage< AnimKitEntry > sAnimKitStore(AnimKitfmt)
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define sScriptMgr
Definition: ScriptMgr.h:837
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
struct ScriptInfo::@280::@290 KillCredit
struct ScriptInfo::@280::@288 TeleportTo
ItemTemplate const * GetItemTemplate(uint32 entry)
Definition: ObjectMgr.cpp:2782
Definition: ObjectMgr.h:93
Definition: SharedDefines.h:2071
uint32 type
Definition: GameObject.h:37
struct ScriptInfo::@280::@289 QuestExplored
Definition: SharedDefines.h:2065
#define DEFAULT_VISIBILITY_DISTANCE
Definition: Object.h:40
Definition: Creature.h:344

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ObjectMgr::LoadSkillTiers ( )
7789 {
7790  uint32 oldMSTime = getMSTime();
7791 
7792  QueryResult result = WorldDatabase.Query("SELECT ID, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, "
7793  " Value11, Value12, Value13, Value14, Value15, Value16 FROM skill_tiers");
7794 
7795  if (!result)
7796  {
7797  TC_LOG_ERROR("server.loading", ">> Loaded 0 skill max values. DB table `skill_tiers` is empty.");
7798  return;
7799  }
7800 
7801  do
7802  {
7803  Field* fields = result->Fetch();
7804  uint32 id = fields[0].GetUInt32();
7805  SkillTiersEntry& tier = _skillTiers[id];
7806  for (uint32 i = 0; i < MAX_SKILL_STEP; ++i)
7807  tier.Value[i] = fields[1 + i].GetUInt32();
7808 
7809  } while (result->NextRow());
7810 
7811  TC_LOG_INFO("server.loading", ">> Loaded %u skill max values in %u ms", uint32(_skillTiers.size()), GetMSTimeDiffToNow(oldMSTime));
7812 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32 Value[MAX_SKILL_STEP]
Definition: ObjectMgr.h:639
Definition: ObjectMgr.h:636
std::unordered_map< uint32, SkillTiersEntry > _skillTiers
Definition: ObjectMgr.h:1510
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
#define MAX_SKILL_STEP
Definition: ObjectMgr.h:634
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

void ObjectMgr::LoadSpellScriptNames ( )
4998 {
4999  uint32 oldMSTime = getMSTime();
5000 
5001  _spellScriptsStore.clear(); // need for reload case
5002 
5003  QueryResult result = WorldDatabase.Query("SELECT spell_id, ScriptName FROM spell_script_names");
5004 
5005  if (!result)
5006  {
5007  TC_LOG_INFO("server.loading", ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!");
5008  return;
5009  }
5010 
5011  uint32 count = 0;
5012 
5013  do
5014  {
5015 
5016  Field* fields = result->Fetch();
5017 
5018  int32 spellId = fields[0].GetInt32();
5019  std::string const scriptName = fields[1].GetString();
5020 
5021  bool allRanks = false;
5022  if (spellId < 0)
5023  {
5024  allRanks = true;
5025  spellId = -spellId;
5026  }
5027 
5028  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
5029  if (!spellInfo)
5030  {
5031  TC_LOG_ERROR("sql.sql", "Scriptname: `%s` spell (Id: %d) does not exist.", scriptName.c_str(), fields[0].GetInt32());
5032  continue;
5033  }
5034 
5035  if (allRanks)
5036  {
5037  if (!spellInfo->IsRanked())
5038  TC_LOG_ERROR("sql.sql", "Scriptname: `%s` spell (Id: %d) has no ranks of spell.", scriptName.c_str(), fields[0].GetInt32());
5039 
5040  if (spellInfo->GetFirstRankSpell()->Id != uint32(spellId))
5041  {
5042  TC_LOG_ERROR("sql.sql", "Scriptname: `%s` spell (Id: %d) is not first rank of spell.", scriptName.c_str(), fields[0].GetInt32());
5043  continue;
5044  }
5045  while (spellInfo)
5046  {
5047  _spellScriptsStore.insert(SpellScriptsContainer::value_type(spellInfo->Id, GetScriptId(scriptName)));
5048  spellInfo = spellInfo->GetNextRankSpell();
5049  }
5050  }
5051  else
5052  {
5053  if (spellInfo->IsRanked())
5054  TC_LOG_ERROR("sql.sql", "Scriptname: `%s` spell (Id: %d) is ranked spell. Perhaps not all ranks are assigned to this script.", scriptName.c_str(), spellId);
5055 
5056  _spellScriptsStore.insert(SpellScriptsContainer::value_type(spellInfo->Id, GetScriptId(scriptName)));
5057  }
5058 
5059  ++count;
5060  }
5061  while (result->NextRow());
5062 
5063  TC_LOG_INFO("server.loading", ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
5064 }
uint32 Id
Definition: SpellInfo.h:329
Definition: SpellInfo.h:326
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
SpellInfo const * GetFirstRankSpell() const
Definition: SpellInfo.cpp:2753
#define sSpellMgr
Definition: SpellMgr.h:756
int32_t int32
Definition: Define.h:146
SpellScriptsContainer _spellScriptsStore
Definition: ObjectMgr.h:1470
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
bool IsRanked() const
Definition: SpellInfo.cpp:2741
uint32 GetScriptId(std::string const &name)
Definition: ObjectMgr.cpp:8627
int32 GetInt32() const
Definition: Field.h:165
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
SpellInfo const * GetNextRankSpell() const
Definition: SpellInfo.cpp:2765
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

void ObjectMgr::LoadSpellScripts ( )
4902 {
4904 
4905  // check ids
4906  for (ScriptMapMap::const_iterator itr = sSpellScripts.begin(); itr != sSpellScripts.end(); ++itr)
4907  {
4908  uint32 spellId = uint32(itr->first) & 0x00FFFFFF;
4909  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
4910 
4911  if (!spellInfo)
4912  {
4913  TC_LOG_ERROR("sql.sql", "Table `spell_scripts` has not existing spell (Id: %u) as script id", spellId);
4914  continue;
4915  }
4916 
4917  uint8 i = (uint8)((uint32(itr->first) >> 24) & 0x000000FF);
4918  //check for correct spellEffect
4919  SpellEffectInfo const* effect = spellInfo->GetEffect(i);
4920  if (effect && (!effect->Effect || (effect->Effect != SPELL_EFFECT_SCRIPT_EFFECT && effect->Effect != SPELL_EFFECT_DUMMY)))
4921  TC_LOG_ERROR("sql.sql", "Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i);
4922  }
4923 }
ScriptMapMap sSpellScripts
Definition: ObjectMgr.cpp:51
Definition: SpellInfo.h:326
Definition: ObjectMgr.h:142
void LoadScripts(ScriptsType type)
Definition: ObjectMgr.cpp:4578
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: SpellInfo.h:238
uint32_t uint32
Definition: Define.h:150
SpellEffectInfo const * GetEffect(uint32 difficulty, uint32 index) const
Definition: SpellInfo.cpp:3348
uint8_t uint8
Definition: g3dmath.h:164
Definition: SharedDefines.h:1013
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
Definition: SharedDefines.h:1087
uint32 Effect
Definition: SpellInfo.h:243

+ Here is the call graph for this function:

void ObjectMgr::LoadTavernAreaTriggers ( )
5671 {
5672  uint32 oldMSTime = getMSTime();
5673 
5674  _tavernAreaTriggerStore.clear(); // need for reload case
5675 
5676  QueryResult result = WorldDatabase.Query("SELECT id FROM areatrigger_tavern");
5677 
5678  if (!result)
5679  {
5680  TC_LOG_INFO("server.loading", ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty.");
5681  return;
5682  }
5683 
5684  uint32 count = 0;
5685 
5686  do
5687  {
5688  ++count;
5689 
5690  Field* fields = result->Fetch();
5691 
5692  uint32 Trigger_ID = fields[0].GetUInt32();
5693 
5694  AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
5695  if (!atEntry)
5696  {
5697  TC_LOG_ERROR("sql.sql", "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
5698  continue;
5699  }
5700 
5701  _tavernAreaTriggerStore.insert(Trigger_ID);
5702  } while (result->NextRow());
5703 
5704  TC_LOG_INFO("server.loading", ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
5705 }
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerfmt)
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
TavernAreaTriggerContainer _tavernAreaTriggerStore
Definition: ObjectMgr.h:1434
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
Definition: DBCStructure.h:74
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

void ObjectMgr::LoadTempSummons ( )
1630 {
1631  uint32 oldMSTime = getMSTime();
1632 
1633  _tempSummonDataStore.clear(); // needed for reload case
1634 
1635  // 0 1 2 3 4 5 6 7 8 9
1636  QueryResult result = WorldDatabase.Query("SELECT summonerId, summonerType, groupId, entry, position_x, position_y, position_z, orientation, summonType, summonTime FROM creature_summon_groups");
1637 
1638  if (!result)
1639  {
1640  TC_LOG_INFO("server.loading", ">> Loaded 0 temp summons. DB table `creature_summon_groups` is empty.");
1641  return;
1642  }
1643 
1644  uint32 count = 0;
1645  do
1646  {
1647  Field* fields = result->Fetch();
1648 
1649  uint32 summonerId = fields[0].GetUInt32();
1650  SummonerType summonerType = SummonerType(fields[1].GetUInt8());
1651  uint8 group = fields[2].GetUInt8();
1652 
1653  switch (summonerType)
1654  {
1656  if (!GetCreatureTemplate(summonerId))
1657  {
1658  TC_LOG_ERROR("sql.sql", "Table `creature_summon_groups` has summoner with non existing entry %u for creature summoner type, skipped.", summonerId);
1659  continue;
1660  }
1661  break;
1663  if (!GetGameObjectTemplate(summonerId))
1664  {
1665  TC_LOG_ERROR("sql.sql", "Table `creature_summon_groups` has summoner with non existing entry %u for gameobject summoner type, skipped.", summonerId);
1666  continue;
1667  }
1668  break;
1669  case SUMMONER_TYPE_MAP:
1670  if (!sMapStore.LookupEntry(summonerId))
1671  {
1672  TC_LOG_ERROR("sql.sql", "Table `creature_summon_groups` has summoner with non existing entry %u for map summoner type, skipped.", summonerId);
1673  continue;
1674  }
1675  break;
1676  default:
1677  TC_LOG_ERROR("sql.sql", "Table `creature_summon_groups` has unhandled summoner type %u for summoner %u, skipped.", summonerType, summonerId);
1678  continue;
1679  }
1680 
1681  TempSummonData data;
1682  data.entry = fields[3].GetUInt32();
1683 
1684  if (!GetCreatureTemplate(data.entry))
1685  {
1686  TC_LOG_ERROR("sql.sql", "Table `creature_summon_groups` has creature in group [Summoner ID: %u, Summoner Type: %u, Group ID: %u] with non existing creature entry %u, skipped.", summonerId, summonerType, group, data.entry);
1687  continue;
1688  }
1689 
1690  float posX = fields[4].GetFloat();
1691  float posY = fields[5].GetFloat();
1692  float posZ = fields[6].GetFloat();
1693  float orientation = fields[7].GetFloat();
1694 
1695  data.pos.Relocate(posX, posY, posZ, orientation);
1696 
1697  data.type = TempSummonType(fields[8].GetUInt8());
1698 
1699  if (data.type > TEMPSUMMON_MANUAL_DESPAWN)
1700  {
1701  TC_LOG_ERROR("sql.sql", "Table `creature_summon_groups` has unhandled temp summon type %u in group [Summoner ID: %u, Summoner Type: %u, Group ID: %u] for creature entry %u, skipped.", data.type, summonerId, summonerType, group, data.entry);
1702  continue;
1703  }
1704 
1705  data.time = fields[9].GetUInt32();
1706 
1707  TempSummonGroupKey key(summonerId, summonerType, group);
1708  _tempSummonDataStore[key].push_back(data);
1709 
1710  ++count;
1711 
1712  } while (result->NextRow());
1713 
1714  TC_LOG_INFO("server.loading", ">> Loaded %u temp summons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1715 }
GameObjectTemplate const * GetGameObjectTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9104
TempSummonType type
Summon type, see TempSummonType for available types.
Definition: TemporarySummon.h:36
Definition: Object.h:61
Definition: TemporarySummon.h:28
float GetFloat() const
Definition: Field.h:222
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
Stores data for temp summons.
Definition: TemporarySummon.h:32
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: TemporarySummon.h:27
SummonerType
Definition: TemporarySummon.h:24
TempSummonType
Definition: Object.h:52
uint8 GetUInt8() const
Definition: Field.h:70
void Relocate(float x, float y)
Definition: Position.h:67
TempSummonDataContainer _tempSummonDataStore
Stores temp summon data grouped by summoner's entry, summoner's type and group id.
Definition: ObjectMgr.h:1532
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9113
Key for storing temp summon data in TempSummonDataContainer.
Definition: ObjectMgr.h:62
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
DBCStorage< MapEntry > sMapStore(Mapfmt)
uint32 time
Despawn time, usable only with certain temp summon types.
Definition: TemporarySummon.h:37
uint32 GetUInt32() const
Definition: Field.h:146
uint32 entry
Entry of summoned creature.
Definition: TemporarySummon.h:34
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
Definition: TemporarySummon.h:26
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Position pos
Position, where should be creature spawned.
Definition: TemporarySummon.h:35

+ Here is the call graph for this function:

void ObjectMgr::LoadTerrainPhaseInfo ( )
8996 {
8997  _terrainPhaseInfoStore.clear();
8998 
8999  uint32 oldMSTime = getMSTime();
9000 
9001  // 0 1
9002  QueryResult result = WorldDatabase.Query("SELECT Id, TerrainSwapMap FROM `terrain_phase_info`");
9003 
9004  if (!result)
9005  {
9006  TC_LOG_INFO("server.loading", ">> Loaded 0 terrain phase infos. DB table `terrain_phase_info` is empty.");
9007  return;
9008  }
9009 
9010  uint32 count = 0;
9011  do
9012  {
9013  Field* fields = result->Fetch();
9014 
9015  uint32 phaseId = fields[0].GetUInt32();
9016 
9017  PhaseEntry const* phase = sPhaseStore.LookupEntry(phaseId);
9018  if (!phase)
9019  {
9020  TC_LOG_ERROR("sql.sql", "Phase %u defined in `terrain_phase_info` does not exist, skipped.", phaseId);
9021  continue;
9022  }
9023 
9024  uint32 terrainSwap = fields[1].GetUInt32();
9025 
9026  _terrainPhaseInfoStore[phaseId].push_back(terrainSwap);
9027 
9028  ++count;
9029  }
9030  while (result->NextRow());
9031 
9032  TC_LOG_INFO("server.loading", ">> Loaded %u terrain phase infos in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
9033 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
TerrainPhaseInfo _terrainPhaseInfoStore
Definition: ObjectMgr.h:1480
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
DBCStorage< PhaseEntry > sPhaseStore(Phasefmt)
Definition: DBCStructure.h:824
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

void ObjectMgr::LoadTerrainSwapDefaults ( )
8952 {
8953  _terrainMapDefaultStore.clear();
8954 
8955  uint32 oldMSTime = getMSTime();
8956 
8957  // 0 1
8958  QueryResult result = WorldDatabase.Query("SELECT MapId, TerrainSwapMap FROM `terrain_swap_defaults`");
8959 
8960  if (!result)
8961  {
8962  TC_LOG_INFO("server.loading", ">> Loaded 0 terrain swap defaults. DB table `terrain_swap_defaults` is empty.");
8963  return;
8964  }
8965 
8966  uint32 count = 0;
8967  do
8968  {
8969  Field* fields = result->Fetch();
8970 
8971  uint32 mapId = fields[0].GetUInt32();
8972 
8973  if (!sMapStore.LookupEntry(mapId))
8974  {
8975  TC_LOG_ERROR("sql.sql", "Map %u defined in `terrain_swap_defaults` does not exist, skipped.", mapId);
8976  continue;
8977  }
8978 
8979  uint32 terrainSwap = fields[1].GetUInt32();
8980 
8981  if (!sMapStore.LookupEntry(terrainSwap))
8982  {
8983  TC_LOG_ERROR("sql.sql", "TerrainSwapMap %u defined in `terrain_swap_defaults` does not exist, skipped.", terrainSwap);
8984  continue;
8985  }
8986 
8987  _terrainMapDefaultStore[mapId].push_back(terrainSwap);
8988 
8989  ++count;
8990  } while (result->NextRow());
8991 
8992  TC_LOG_INFO("server.loading", ">> Loaded %u terrain swap defaults in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
8993 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
DBCStorage< MapEntry > sMapStore(Mapfmt)
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
TerrainPhaseInfo _terrainMapDefaultStore
Definition: ObjectMgr.h:1481

+ Here is the call graph for this function:

void ObjectMgr::LoadTerrainWorldMaps ( )
9036 {
9037  _terrainWorldMapStore.clear();
9038 
9039  uint32 oldMSTime = getMSTime();
9040 
9041  // 0 1
9042  QueryResult result = WorldDatabase.Query("SELECT TerrainSwapMap, WorldMapArea FROM `terrain_worldmap`");
9043 
9044  if (!result)
9045  {
9046  TC_LOG_INFO("server.loading", ">> Loaded 0 terrain world maps. DB table `terrain_worldmap` is empty.");
9047  return;
9048  }
9049 
9050  uint32 count = 0;
9051  do
9052  {
9053  Field* fields = result->Fetch();
9054 
9055  uint32 mapId = fields[0].GetUInt32();
9056 
9057  if (!sMapStore.LookupEntry(mapId))
9058  {
9059  TC_LOG_ERROR("sql.sql", "TerrainSwapMap %u defined in `terrain_worldmap` does not exist, skipped.", mapId);
9060  continue;
9061  }
9062 
9063  uint32 worldMapArea = fields[1].GetUInt32();
9064 
9065  _terrainWorldMapStore[mapId].push_back(worldMapArea);
9066 
9067  ++count;
9068  } while (result->NextRow());
9069 
9070  TC_LOG_INFO("server.loading", ">> Loaded %u terrain world maps in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
9071 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
TerrainUIPhaseInfo _terrainWorldMapStore
Definition: ObjectMgr.h:1482
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
DBCStorage< MapEntry > sMapStore(Mapfmt)
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

void ObjectMgr::LoadTrainerSpell ( )
8185 {
8186  uint32 oldMSTime = getMSTime();
8187 
8188  // For reload case
8189  _cacheTrainerSpellStore.clear();
8190 
8191  QueryResult result = WorldDatabase.Query("SELECT b.ID, a.SpellID, a.MoneyCost, a.ReqSkillLine, a.ReqSkillRank, a.Reqlevel FROM npc_trainer AS a "
8192  "INNER JOIN npc_trainer AS b ON a.ID = -(b.SpellID) "
8193  "UNION SELECT * FROM npc_trainer WHERE SpellID > 0");
8194 
8195  if (!result)
8196  {
8197  TC_LOG_ERROR("server.loading", ">> Loaded 0 Trainers. DB table `npc_trainer` is empty!");
8198 
8199  return;
8200  }
8201 
8202  uint32 count = 0;
8203 
8204  do
8205  {
8206  Field* fields = result->Fetch();
8207 
8208  uint32 ID = fields[0].GetUInt32();
8209  uint32 SpellID = fields[1].GetUInt32();
8210  uint32 MoneyCost = fields[2].GetUInt32();
8211  uint32 ReqSkillLine = fields[3].GetUInt16();
8212  uint32 ReqSkillRank = fields[4].GetUInt16();
8213  uint32 ReqLevel = fields[5].GetUInt8();
8214 
8215  AddSpellToTrainer(ID, SpellID, MoneyCost, ReqSkillLine, ReqSkillRank, ReqLevel);
8216 
8217  ++count;
8218  }
8219  while (result->NextRow());
8220 
8221  TC_LOG_INFO("server.loading", ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
8222 }
CacheTrainerSpellContainer _cacheTrainerSpellStore
Definition: ObjectMgr.h:1544
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint8 GetUInt8() const
Definition: Field.h:70
void AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel)
Definition: ObjectMgr.cpp:8112
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint16 GetUInt16() const
Definition: Field.h:108
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

bool ObjectMgr::LoadTrinityStrings ( )
7707 {
7708  uint32 oldMSTime = getMSTime();
7709 
7710  _trinityStringStore.clear(); // for reload case
7711 
7712  QueryResult result = WorldDatabase.Query("SELECT entry, content_default, content_loc1, content_loc2, content_loc3, content_loc4, content_loc5, content_loc6, content_loc7, content_loc8 FROM trinity_string");
7713  if (!result)
7714  {
7715  TC_LOG_ERROR("server.loading", ">> Loaded 0 trinity strings. DB table `trinity_string` is empty.");
7716  return false;
7717  }
7718 
7719  do
7720  {
7721  Field* fields = result->Fetch();
7722 
7723  uint32 entry = fields[0].GetUInt32();
7724 
7725  TrinityString& data = _trinityStringStore[entry];
7726 
7727  data.Content.resize(DEFAULT_LOCALE + 1);
7728 
7729  for (int8 i = OLD_TOTAL_LOCALES - 1; i >= 0; --i)
7730  AddLocaleString(fields[i + 1].GetString(), LocaleConstant(i), data.Content);
7731  }
7732  while (result->NextRow());
7733 
7734  TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " trinity strings in %u ms", _trinityStringStore.size(), GetMSTimeDiffToNow(oldMSTime));
7735  return true;
7736 }
int8_t int8
Definition: Define.h:148
#define SZFMTD
Definition: Define.h:143
Class used to access individual fields of database query result.
Definition: Field.h:56
const uint8 OLD_TOTAL_LOCALES
Definition: Common.h:133
TrinityStringContainer _trinityStringStore
Definition: ObjectMgr.h:1541
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: ObjectMgr.h:421
LocaleConstant
Definition: Common.h:115
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
StringVector Content
Definition: ObjectMgr.h:423
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
static void AddLocaleString(std::string const &value, LocaleConstant localeConstant, StringVector &data)
Definition: ObjectMgr.cpp:295
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
#define DEFAULT_LOCALE
Definition: Common.h:134

+ Here is the call graph for this function:

void ObjectMgr::LoadVehicleAccessories ( )
2846 {
2847  uint32 oldMSTime = getMSTime();
2848 
2849  _vehicleAccessoryStore.clear(); // needed for reload case
2850 
2851  uint32 count = 0;
2852 
2853  // 0 1 2 3 4 5
2854  QueryResult result = WorldDatabase.Query("SELECT `guid`, `accessory_entry`, `seat_id`, `minion`, `summontype`, `summontimer` FROM `vehicle_accessory`");
2855 
2856  if (!result)
2857  {
2858  TC_LOG_INFO("server.loading", ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime));
2859  return;
2860  }
2861 
2862  do
2863  {
2864  Field* fields = result->Fetch();
2865 
2866  ObjectGuid::LowType uiGUID = fields[0].GetUInt64();
2867  uint32 uiAccessory = fields[1].GetUInt32();
2868  int8 uiSeat = int8(fields[2].GetInt16());
2869  bool bMinion = fields[3].GetBool();
2870  uint8 uiSummonType = fields[4].GetUInt8();
2871  uint32 uiSummonTimer= fields[5].GetUInt32();
2872 
2873  if (!sObjectMgr->GetCreatureTemplate(uiAccessory))
2874  {
2875  TC_LOG_ERROR("sql.sql", "Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory);
2876  continue;
2877  }
2878 
2879  _vehicleAccessoryStore[uiGUID].push_back(VehicleAccessory(uiAccessory, uiSeat, bMinion, uiSummonType, uiSummonTimer));
2880 
2881  ++count;
2882  }
2883  while (result->NextRow());
2884 
2885  TC_LOG_INFO("server.loading", ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
2886 }
int8_t int8
Definition: Define.h:148
uint64 GetUInt64() const
Definition: Field.h:184
Definition: VehicleDefines.h:103
Class used to access individual fields of database query result.
Definition: Field.h:56
int8_t int8
Definition: g3dmath.h:163
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint64 LowType
Definition: ObjectGuid.h:199
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint8 GetUInt8() const
Definition: Field.h:70
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
VehicleAccessoryContainer _vehicleAccessoryStore
Definition: ObjectMgr.h:1473
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
bool GetBool() const
Definition: Field.h:65

+ Here is the call graph for this function:

void ObjectMgr::LoadVehicleTemplateAccessories ( )
2791 {
2792  uint32 oldMSTime = getMSTime();
2793 
2794  _vehicleTemplateAccessoryStore.clear(); // needed for reload case
2795 
2796  uint32 count = 0;
2797 
2798  // 0 1 2 3 4 5
2799  QueryResult result = WorldDatabase.Query("SELECT `entry`, `accessory_entry`, `seat_id`, `minion`, `summontype`, `summontimer` FROM `vehicle_template_accessory`");
2800 
2801  if (!result)
2802  {
2803  TC_LOG_ERROR("server.loading", ">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty.");
2804  return;
2805  }
2806 
2807  do
2808  {
2809  Field* fields = result->Fetch();
2810 
2811  uint32 entry = fields[0].GetUInt32();
2812  uint32 accessory = fields[1].GetUInt32();
2813  int8 seatId = fields[2].GetInt8();
2814  bool isMinion = fields[3].GetBool();
2815  uint8 summonType = fields[4].GetUInt8();
2816  uint32 summonTimer = fields[5].GetUInt32();
2817 
2818  if (!sObjectMgr->GetCreatureTemplate(entry))
2819  {
2820  TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry %u does not exist.", entry);
2821  continue;
2822  }
2823 
2824  if (!sObjectMgr->GetCreatureTemplate(accessory))
2825  {
2826  TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: Accessory %u does not exist.", accessory);
2827  continue;
2828  }
2829 
2830  if (_spellClickInfoStore.find(entry) == _spellClickInfoStore.end())
2831  {
2832  TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", entry);
2833  continue;
2834  }
2835 
2836  _vehicleTemplateAccessoryStore[entry].push_back(VehicleAccessory(accessory, seatId, isMinion, summonType, summonTimer));
2837 
2838  ++count;
2839  }
2840  while (result->NextRow());
2841 
2842  TC_LOG_INFO("server.loading", ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
2843 }
SpellClickInfoContainer _spellClickInfoStore
Definition: ObjectMgr.h:1468
int8_t int8
Definition: Define.h:148
Definition: VehicleDefines.h:103
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
VehicleAccessoryTemplateContainer _vehicleTemplateAccessoryStore
Definition: ObjectMgr.h:1472
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint8 GetUInt8() const
Definition: Field.h:70
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
int8 GetInt8() const
Definition: Field.h:89
bool GetBool() const
Definition: Field.h:65

+ Here is the call graph for this function:

void ObjectMgr::LoadVendors ( )
8266 {
8267  uint32 oldMSTime = getMSTime();
8268 
8269  // For reload case
8270  for (CacheVendorItemContainer::iterator itr = _cacheVendorItemStore.begin(); itr != _cacheVendorItemStore.end(); ++itr)
8271  itr->second.Clear();
8272  _cacheVendorItemStore.clear();
8273 
8274  std::set<uint32> skip_vendors;
8275 
8276  QueryResult result = WorldDatabase.Query("SELECT entry, item, maxcount, incrtime, ExtendedCost, type FROM npc_vendor ORDER BY entry, slot ASC");
8277  if (!result)
8278  {
8279 
8280  TC_LOG_ERROR("server.loading", ">> Loaded 0 Vendors. DB table `npc_vendor` is empty!");
8281  return;
8282  }
8283 
8284  uint32 count = 0;
8285 
8286  do
8287  {
8288  Field* fields = result->Fetch();
8289 
8290  uint32 entry = fields[0].GetUInt32();
8291  int32 item_id = fields[1].GetInt32();
8292 
8293  // if item is a negative, its a reference
8294  if (item_id < 0)
8295  count += LoadReferenceVendor(entry, -item_id, 0, &skip_vendors);
8296  else
8297  {
8298  uint32 maxcount = fields[2].GetUInt32();
8299  uint32 incrtime = fields[3].GetUInt32();
8300  uint32 ExtendedCost = fields[4].GetUInt32();
8301  uint8 type = fields[5].GetUInt8();
8302 
8303  if (!IsVendorItemValid(entry, item_id, maxcount, incrtime, ExtendedCost, type, NULL, &skip_vendors))
8304  continue;
8305 
8306  VendorItemData& vList = _cacheVendorItemStore[entry];
8307 
8308  vList.AddItem(item_id, maxcount, incrtime, ExtendedCost, type);
8309  ++count;
8310  }
8311  }
8312  while (result->NextRow());
8313 
8314  TC_LOG_INFO("server.loading", ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
8315 }
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
arena_t NULL
Definition: jemalloc_internal.h:624
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint8 GetUInt8() const
Definition: Field.h:70
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
CacheVendorItemContainer _cacheVendorItemStore
Definition: ObjectMgr.h:1543
int32 GetInt32() const
Definition: Field.h:165
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
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
Definition: ObjectMgr.cpp:8480
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: Creature.h:383
void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, uint8 type)
Definition: Creature.h:396
int LoadReferenceVendor(int32 vendor, int32 item, uint8 type, std::set< uint32 > *skip_vendors)
Definition: ObjectMgr.cpp:8224

+ Here is the call graph for this function:

void ObjectMgr::LoadWaypointScripts ( )
4970 {
4972 
4973  std::set<uint32> actionSet;
4974 
4975  for (ScriptMapMap::const_iterator itr = sWaypointScripts.begin(); itr != sWaypointScripts.end(); ++itr)
4976  actionSet.insert(itr->first);
4977 
4979  PreparedQueryResult result = WorldDatabase.Query(stmt);
4980 
4981  if (result)
4982  {
4983  do
4984  {
4985  Field* fields = result->Fetch();
4986  uint32 action = fields[0].GetUInt32();
4987 
4988  actionSet.erase(action);
4989  }
4990  while (result->NextRow());
4991  }
4992 
4993  for (std::set<uint32>::iterator itr = actionSet.begin(); itr != actionSet.end(); ++itr)
4994  TC_LOG_ERROR("sql.sql", "There is no waypoint which links to the waypoint script %u", *itr);
4995 }
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
Class used to access individual fields of database query result.
Definition: Field.h:56
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: PreparedStatement.h:74
void LoadScripts(ScriptsType type)
Definition: ObjectMgr.cpp:4578
uint32_t uint32
Definition: Define.h:150
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: ObjectMgr.h:144
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: WorldDatabase.h:70
ScriptMapMap sWaypointScripts
Definition: ObjectMgr.cpp:53

+ Here is the call graph for this function:

GameObjectData& ObjectMgr::NewGOData ( ObjectGuid::LowType  guid)
inline
1215 { return _gameObjectDataStore[guid]; }
GameObjectDataContainer _gameObjectDataStore
Definition: ObjectMgr.h:1528

+ Here is the caller graph for this function:

CreatureData& ObjectMgr::NewOrExistCreatureData ( ObjectGuid::LowType  guid)
inline
1158 { return _creatureDataStore[guid]; }
CreatureDataContainer _creatureDataStore
Definition: ObjectMgr.h:1517

+ Here is the caller graph for this function:

ObjectMgr& ObjectMgr::operator= ( ObjectMgr const )
delete
ObjectMgr& ObjectMgr::operator= ( ObjectMgr &&  )
delete
void ObjectMgr::PlayerCreateInfoAddItemHelper ( uint32  race_,
uint32  class_,
uint32  itemId,
int32  count 
)
private
2992 {
2993  if (!_playerInfo[race_][class_])
2994  return;
2995 
2996  if (count > 0)
2997  _playerInfo[race_][class_]->item.push_back(PlayerCreateInfoItem(itemId, count));
2998  else
2999  {
3000  if (count < -1)
3001  TC_LOG_ERROR("sql.sql", "Invalid count %i specified on item %u be removed from original player create info (use -1)!", count, itemId);
3002 
3003  for (uint32 gender = 0; gender < GENDER_NONE; ++gender)
3004  {
3005  if (CharStartOutfitEntry const* entry = sDB2Manager.GetCharStartOutfitEntry(race_, class_, gender))
3006  {
3007  bool found = false;
3008  for (uint8 x = 0; x < MAX_OUTFIT_ITEMS; ++x)
3009  {
3010  if (entry->ItemID[x] > 0 && uint32(entry->ItemID[x]) == itemId)
3011  {
3012  found = true;
3013  const_cast<CharStartOutfitEntry*>(entry)->ItemID[x] = 0;
3014  break;
3015  }
3016  }
3017 
3018  if (!found)
3019  TC_LOG_ERROR("sql.sql", "Item %u specified to be removed from original create info not found in dbc!", itemId);
3020  }
3021  }
3022  }
3023 }
#define sDB2Manager
Definition: DB2Stores.h:224
Definition: DB2Structure.h:127
Definition: Player.h:363
uint32_t uint32
Definition: Define.h:150
PlayerCreateInfoItems item
Definition: Player.h:409
uint8_t uint8
Definition: Define.h:152
PlayerInfo * _playerInfo[MAX_RACES][MAX_CLASSES]
Definition: ObjectMgr.h:1500
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
G3D::int16 x
Definition: Vector2int16.h:37
#define MAX_OUTFIT_ITEMS
Definition: DB2Structure.h:125
Definition: SharedDefines.h:95

+ Here is the caller graph for this function:

void ObjectMgr::RemoveCreatureFromGrid ( ObjectGuid::LowType  guid,
CreatureData const data 
)
1916 {
1917  uint32 mask = data->spawnMask;
1918  for (uint8 i = 0; mask != 0; i++, mask >>= 1)
1919  {
1920  if (mask & 1)
1921  {
1922  CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY);
1923  CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
1924  cell_guids.creatures.erase(guid);
1925  }
1926  }
1927 }
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::RemoveGameobjectFromGrid ( ObjectGuid::LowType  guid,
GameObjectData const data 
)
2228 {
2229  uint32 mask = data->spawnMask;
2230  for (uint8 i = 0; mask != 0; i++, mask >>= 1)
2231  {
2232  if (mask & 1)
2233  {
2234  CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY);
2235  CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
2236  cell_guids.gameobjects.erase(guid);
2237  }
2238  }
2239 }
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:

void ObjectMgr::RemoveGraveYardLink ( uint32  id,
uint32  zoneId,
uint32  team,
bool  persist = false 
)
6083 {
6084  GraveYardMapBoundsNonConst range = GraveYardStore.equal_range(zoneId);
6085  if (range.first == range.second)
6086  {
6087  //TC_LOG_ERROR("sql.sql", "Table `graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team);
6088  return;
6089  }
6090 
6091  bool found = false;
6092 
6093 
6094  for (; range.first != range.second; ++range.first)
6095  {
6096  GraveYardData & data = range.first->second;
6097 
6098  // skip not matching safezone id
6099  if (data.safeLocId != id)
6100  continue;
6101 
6102  // skip enemy faction graveyard at same map (normal area, city, or battleground)
6103  // team == 0 case can be at call from .neargrave
6104  if (data.team != 0 && team != 0 && data.team != team)
6105  continue;
6106 
6107  found = true;
6108  break;
6109  }
6110 
6111  // no match, return
6112  if (!found)
6113  return;
6114 
6115  // remove from links
6116  GraveYardStore.erase(range.first);
6117 
6118  // remove link from DB
6119  if (persist)
6120  {
6122 
6123  stmt->setUInt32(0, id);
6124  stmt->setUInt32(1, zoneId);
6125  stmt->setUInt16(2, uint16(team));
6126 
6127  WorldDatabase.Execute(stmt);
6128  }
6129 }
std::pair< GraveYardContainer::iterator, GraveYardContainer::iterator > GraveYardMapBoundsNonConst
Definition: ObjectMgr.h:597
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: ObjectMgr.h:589
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
Definition: WorldDatabase.h:41
GraveYardContainer GraveYardStore
Definition: ObjectMgr.h:1342

+ Here is the call graph for this function:

bool ObjectMgr::RemoveVendorItem ( uint32  entry,
uint32  item,
uint8  type,
bool  persist = true 
)
8458 {
8459  CacheVendorItemContainer::iterator iter = _cacheVendorItemStore.find(entry);
8460  if (iter == _cacheVendorItemStore.end())
8461  return false;
8462 
8463  if (!iter->second.RemoveItem(item, type))
8464  return false;
8465 
8466  if (persist)
8467  {
8469 
8470  stmt->setUInt32(0, entry);
8471  stmt->setUInt32(1, item);
8472  stmt->setUInt8(2, type);
8473 
8474  WorldDatabase.Execute(stmt);
8475  }
8476 
8477  return true;
8478 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
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
Definition: WorldDatabase.h:45
CacheVendorItemContainer _cacheVendorItemStore
Definition: ObjectMgr.h:1543
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115

+ Here is the call graph for this function:

void ObjectMgr::ReturnOrDeleteOldMails ( bool  serverUp)
5417 {
5418  uint32 oldMSTime = getMSTime();
5419 
5420  time_t curTime = time(NULL);
5421  tm lt;
5422  localtime_r(&curTime, &lt);
5423  uint64 basetime(curTime);
5424  TC_LOG_INFO("misc", "Returning mails current time: hour: %d, minute: %d, second: %d ", lt.tm_hour, lt.tm_min, lt.tm_sec);
5425 
5426  // Delete all old mails without item and without body immediately, if starting server
5427  if (!serverUp)
5428  {
5430  stmt->setUInt64(0, basetime);
5431  CharacterDatabase.Execute(stmt);
5432  }
5434  stmt->setUInt64(0, basetime);
5436  if (!result)
5437  {
5438  TC_LOG_INFO("server.loading", ">> No expired mails found.");
5439  return; // any mails need to be returned or deleted
5440  }
5441 
5442  std::map<uint32 /*messageId*/, MailItemInfoVec> itemsCache;
5444  stmt->setUInt32(0, (uint32)basetime);
5445  if (PreparedQueryResult items = CharacterDatabase.Query(stmt))
5446  {
5447  MailItemInfo item;
5448  do
5449  {
5450  Field* fields = items->Fetch();
5451  item.item_guid = fields[0].GetUInt64();
5452  item.item_template = fields[1].GetUInt32();
5453  uint32 mailId = fields[2].GetUInt32();
5454  itemsCache[mailId].push_back(item);
5455  } while (items->NextRow());
5456  }
5457 
5458  uint32 deletedCount = 0;
5459  uint32 returnedCount = 0;
5460  do
5461  {
5462  Field* fields = result->Fetch();
5463  Mail* m = new Mail;
5464  m->messageID = fields[0].GetUInt32();
5465  m->messageType = fields[1].GetUInt8();
5466  m->sender = fields[2].GetUInt64();
5467  m->receiver = fields[3].GetUInt64();
5468  bool has_items = fields[4].GetBool();
5469  m->expire_time = time_t(fields[5].GetUInt32());
5470  m->deliver_time = 0;
5471  m->COD = fields[6].GetUInt64();
5472  m->checked = fields[7].GetUInt8();
5473  m->mailTemplateId = fields[8].GetInt16();
5474 
5475  Player* player = NULL;
5476  if (serverUp)
5477  player = ObjectAccessor::FindConnectedPlayer(ObjectGuid::Create<HighGuid::Player>(m->receiver));
5478 
5479  if (player && player->m_mailsLoaded)
5480  { // this code will run very improbably (the time is between 4 and 5 am, in game is online a player, who has old mail
5481  // his in mailbox and he has already listed his mails)
5482  delete m;
5483  continue;
5484  }
5485 
5486  // Delete or return mail
5487  if (has_items)
5488  {
5489  // read items from cache
5490  m->items.swap(itemsCache[m->messageID]);
5491 
5492  // if it is mail from non-player, or if it's already return mail, it shouldn't be returned, but deleted
5494  {
5495  // mail open and then not returned
5496  for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
5497  {
5499  stmt->setUInt64(0, itr2->item_guid);
5500  CharacterDatabase.Execute(stmt);
5501  }
5502  }
5503  else
5504  {
5505  // Mail will be returned
5507  stmt->setUInt64(0, m->receiver);
5508  stmt->setUInt64(1, m->sender);
5509  stmt->setUInt32(2, basetime + 30 * DAY);
5510  stmt->setUInt32(3, basetime);
5512  stmt->setUInt32(5, m->messageID);
5513  CharacterDatabase.Execute(stmt);
5514  for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
5515  {
5516  // Update receiver in mail items for its proper delivery, and in instance_item for avoid lost item at sender delete
5518  stmt->setUInt64(0, m->sender);
5519  stmt->setUInt64(1, itr2->item_guid);
5520  CharacterDatabase.Execute(stmt);
5521 
5523  stmt->setUInt64(0, m->sender);
5524  stmt->setUInt64(1, itr2->item_guid);
5525  CharacterDatabase.Execute(stmt);
5526  }
5527  delete m;
5528  ++returnedCount;
5529  continue;
5530  }
5531  }
5532 
5534  stmt->setUInt32(0, m->messageID);
5535  CharacterDatabase.Execute(stmt);
5536  delete m;
5537  ++deletedCount;
5538  }
5539  while (result->NextRow());
5540 
5541  TC_LOG_INFO("server.loading", ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime));
5542 }
std::vector< MailItemInfo > items
Definition: Mail.h:176
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
std::vector< MailItemInfo > MailItemInfoVec
Definition: Mail.h:164
uint64 GetUInt64() const
Definition: Field.h:184
Definition: CharacterDatabase.h:133
uint16 mailTemplateId
Definition: Mail.h:171
This mail was copied. Do not allow making a copy of items in mail.
Definition: Mail.h:51
Definition: CharacterDatabase.h:132
Class used to access individual fields of database query result.
Definition: Field.h:56
uint8 messageType
Definition: Mail.h:169
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
uint32 checked
Definition: Mail.h:182
uint32 getMSTime()
Definition: Timer.h:24
Definition: CharacterDatabase.h:131
arena_t NULL
Definition: jemalloc_internal.h:624
uint64 COD
Definition: Mail.h:181
uint32 item_template
Definition: Mail.h:162
Definition: Mail.h:38
ObjectGuid::LowType receiver
Definition: Mail.h:173
Definition: PreparedStatement.h:74
Definition: Mail.h:159
Definition: Mail.h:166
uint8 GetUInt8() const
Definition: Field.h:70
Definition: CharacterDatabase.h:145
ObjectGuid::LowType item_guid
Definition: Mail.h:161
Definition: Common.h:99
Definition: CharacterDatabase.h:127
uint32_t uint32
Definition: Define.h:150
time_t deliver_time
Definition: Mail.h:179
uint64_t uint64
Definition: Define.h:149
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: CharacterDatabase.h:135
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
int16 GetInt16() const
Definition: Field.h:127
TC_COMMON_API struct tm * localtime_r(const time_t *time, struct tm *result)
uint8_t uint8
Definition: g3dmath.h:164
time_t expire_time
Definition: Mail.h:178
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
Definition: CharacterDatabase.h:134
uint32 GetUInt32() const
Definition: Field.h:146
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
bool GetBool() const
Definition: Field.h:65
Definition: Mail.h:49
uint32 messageID
Definition: Mail.h:168
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
Definition: CharacterDatabase.h:136
ObjectGuid::LowType sender
Definition: Mail.h:172

+ Here is the call graph for this function:

bool ObjectMgr::SetCreatureLinkedRespawn ( ObjectGuid::LowType  guid,
ObjectGuid::LowType  linkedGuid 
)
1582 {
1583  if (!guidLow)
1584  return false;
1585 
1586  CreatureData const* master = GetCreatureData(guidLow);
1587  ASSERT(master);
1588  ObjectGuid guid = ObjectGuid::Create<HighGuid::Creature>(master->mapid, master->id, guidLow);
1589 
1590  if (!linkedGuidLow) // we're removing the linking
1591  {
1592  _linkedRespawnStore.erase(guid);
1594  stmt->setUInt64(0, guidLow);
1595  WorldDatabase.Execute(stmt);
1596  return true;
1597  }
1598 
1599  CreatureData const* slave = GetCreatureData(linkedGuidLow);
1600  if (!slave)
1601  {
1602  TC_LOG_ERROR("sql.sql", "Creature '" UI64FMTD "' linking to non-existent creature '" UI64FMTD "'.", guidLow, linkedGuidLow);
1603  return false;
1604  }
1605 
1606  MapEntry const* map = sMapStore.LookupEntry(master->mapid);
1607  if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
1608  {
1609  TC_LOG_ERROR("sql.sql", "Creature '" UI64FMTD "' linking to '" UI64FMTD "' on an unpermitted map.", guidLow, linkedGuidLow);
1610  return false;
1611  }
1612 
1613  if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
1614  {
1615  TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '" UI64FMTD "' linking to '" UI64FMTD "' with not corresponding spawnMask", guidLow, linkedGuidLow);
1616  return false;
1617  }
1618 
1619  ObjectGuid linkedGuid = ObjectGuid::Create<HighGuid::Creature>(slave->mapid, slave->id, linkedGuidLow);
1620 
1621  _linkedRespawnStore[guid] = linkedGuid;
1623  stmt->setUInt64(0, guidLow);
1624  stmt->setUInt64(1, linkedGuidLow);
1625  WorldDatabase.Execute(stmt);
1626  return true;
1627 }
Definition: Creature.h:287
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 id
Definition: Creature.h:293
bool Instanceable() const
Definition: DBCStructure.h:859
Definition: DBCStructure.h:830
CreatureData const * GetCreatureData(ObjectGuid::LowType guid) const
Definition: ObjectMgr.h:1152
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: PreparedStatement.h:74
Definition: WorldDatabase.h:34
#define UI64FMTD
Definition: Define.h:137
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
uint32 spawnMask
Definition: Creature.h:308
DBCStorage< MapEntry > sMapStore(Mapfmt)
LinkedRespawnContainer _linkedRespawnStore
Definition: ObjectMgr.h:1526
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
#define ASSERT
Definition: Errors.h:55
uint16 mapid
Definition: Creature.h:294
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: ObjectGuid.h:189
Definition: WorldDatabase.h:33

+ Here is the call graph for this function:

void ObjectMgr::SetDBCLocaleIndex ( LocaleConstant  locale)
inline
1228 { DBCLocaleIndex = locale; }
LocaleConstant DBCLocaleIndex
Definition: ObjectMgr.h:1475
void ObjectMgr::SetHighestGuids ( )
6344 {
6345  QueryResult result = CharacterDatabase.Query("SELECT MAX(guid) FROM characters");
6346  if (result)
6347  GetGuidSequenceGenerator<HighGuid::Player>().Set((*result)[0].GetUInt64() + 1);
6348 
6349  result = CharacterDatabase.Query("SELECT MAX(guid) FROM item_instance");
6350  if (result)
6351  GetGuidSequenceGenerator<HighGuid::Item>().Set((*result)[0].GetUInt64() + 1);
6352 
6353  // Cleanup other tables from nonexistent guids ( >= _hiItemGuid)
6354  CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item >= '%u'", GetGuidSequenceGenerator<HighGuid::Item>().GetNextAfterMaxUsed()); // One-time query
6355  CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid >= '%u'", GetGuidSequenceGenerator<HighGuid::Item>().GetNextAfterMaxUsed()); // One-time query
6356  CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE itemguid >= '%u'", GetGuidSequenceGenerator<HighGuid::Item>().GetNextAfterMaxUsed()); // One-time query
6357  CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE item_guid >= '%u'", GetGuidSequenceGenerator<HighGuid::Item>().GetNextAfterMaxUsed()); // One-time query
6358 
6359  result = WorldDatabase.Query("SELECT MAX(guid) FROM transports");
6360  if (result)
6361  GetGuidSequenceGenerator<HighGuid::Transport>().Set((*result)[0].GetUInt64() + 1);
6362 
6363  result = CharacterDatabase.Query("SELECT MAX(id) FROM auctionhouse");
6364  if (result)
6365  _auctionId = (*result)[0].GetUInt32()+1;
6366 
6367  result = CharacterDatabase.Query("SELECT MAX(id) FROM mail");
6368  if (result)
6369  _mailId = (*result)[0].GetUInt32()+1;
6370 
6371  result = CharacterDatabase.Query("SELECT MAX(arenateamid) FROM arena_team");
6372  if (result)
6373  sArenaTeamMgr->SetNextArenaTeamId((*result)[0].GetUInt32()+1);
6374 
6375  result = CharacterDatabase.Query("SELECT MAX(setguid) FROM character_equipmentsets");
6376  if (result)
6377  _equipmentSetGuid = (*result)[0].GetUInt64()+1;
6378 
6379  result = CharacterDatabase.Query("SELECT MAX(guildId) FROM guild");
6380  if (result)
6381  sGuildMgr->SetNextGuildId((*result)[0].GetUInt64()+1);
6382 
6383  result = CharacterDatabase.Query("SELECT MAX(guid) FROM groups");
6384  if (result)
6385  sGroupMgr->SetGroupDbStoreSize((*result)[0].GetUInt32()+1);
6386 
6387  result = CharacterDatabase.Query("SELECT MAX(itemId) from character_void_storage");
6388  if (result)
6389  _voidItemId = (*result)[0].GetUInt64()+1;
6390 
6391  result = WorldDatabase.Query("SELECT MAX(guid) FROM creature");
6392  if (result)
6393  _creatureSpawnId = (*result)[0].GetUInt64() + 1;
6394 
6395  result = WorldDatabase.Query("SELECT MAX(guid) FROM gameobject");
6396  if (result)
6397  _gameObjectSpawnId = (*result)[0].GetUInt64() + 1;
6398 }
#define sGuildMgr
Definition: GuildMgr.h:61
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint64 _voidItemId
Definition: ObjectMgr.h:1409
uint64 _gameObjectSpawnId
Definition: ObjectMgr.h:1411
uint32 _mailId
Definition: ObjectMgr.h:1407
void PExecute(Format &&sql, Args &&...args)
Definition: DatabaseWorkerPool.h:99
uint32 _auctionId
Definition: ObjectMgr.h:1404
#define sGroupMgr
Definition: GroupMgr.h:59
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define sArenaTeamMgr
Definition: ArenaTeamMgr.h:53
uint64 _equipmentSetGuid
Definition: ObjectMgr.h:1405
uint64 _creatureSpawnId
Definition: ObjectMgr.h:1410

+ Here is the call graph for this function:

void ObjectMgr::ValidateSpellScripts ( )
5067 {
5068  uint32 oldMSTime = getMSTime();
5069 
5070  if (_spellScriptsStore.empty())
5071  {
5072  TC_LOG_INFO("server.loading", ">> Validated 0 scripts.");
5073  return;
5074  }
5075 
5076  uint32 count = 0;
5077 
5078  for (SpellScriptsContainer::iterator itr = _spellScriptsStore.begin(); itr != _spellScriptsStore.end();)
5079  {
5080  SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(itr->first);
5081  std::vector<std::pair<SpellScriptLoader *, SpellScriptsContainer::iterator> > SpellScriptLoaders;
5082  sScriptMgr->CreateSpellScriptLoaders(itr->first, SpellScriptLoaders);
5083  itr = _spellScriptsStore.upper_bound(itr->first);
5084 
5085  for (std::vector<std::pair<SpellScriptLoader *, SpellScriptsContainer::iterator> >::iterator sitr = SpellScriptLoaders.begin(); sitr != SpellScriptLoaders.end(); ++sitr)
5086  {
5087  SpellScript* spellScript = sitr->first->GetSpellScript();
5088  AuraScript* auraScript = sitr->first->GetAuraScript();
5089  bool valid = true;
5090  if (!spellScript && !auraScript)
5091  {
5092  TC_LOG_ERROR("scripts", "Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second).c_str());
5093  valid = false;
5094  }
5095  if (spellScript)
5096  {
5097  spellScript->_Init(&sitr->first->GetName(), spellEntry->Id);
5098  spellScript->_Register();
5099  if (!spellScript->_Validate(spellEntry))
5100  valid = false;
5101  delete spellScript;
5102  }
5103  if (auraScript)
5104  {
5105  auraScript->_Init(&sitr->first->GetName(), spellEntry->Id);
5106  auraScript->_Register();
5107  if (!auraScript->_Validate(spellEntry))
5108  valid = false;
5109  delete auraScript;
5110  }
5111  if (!valid)
5112  {
5113  _spellScriptsStore.erase(sitr->second);
5114  }
5115  }
5116  ++count;
5117  }
5118 
5119  TC_LOG_INFO("server.loading", ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
5120 }
uint32 Id
Definition: SpellInfo.h:329
Definition: SpellInfo.h:326
uint32 getMSTime()
Definition: Timer.h:24
Definition: SpellScript.h:152
virtual void _Init(std::string const *scriptname, uint32 spellId)
Definition: SpellScript.cpp:48
virtual void _Register()
Definition: SpellScript.cpp:34
bool _Validate(SpellInfo const *entry) override
Definition: SpellScript.cpp:305
#define sSpellMgr
Definition: SpellMgr.h:756
SpellScriptsContainer _spellScriptsStore
Definition: ObjectMgr.h:1470
uint32_t uint32
Definition: Define.h:150
bool _Validate(SpellInfo const *entry) override
Definition: SpellScript.cpp:664
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define sScriptMgr
Definition: ScriptMgr.h:837
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
std::string const & GetScriptName(uint32 id) const
Definition: ObjectMgr.cpp:8621
Definition: SpellScript.h:475

+ Here is the call graph for this function:

Friends And Related Function Documentation

friend class PlayerDumpReader
friend

Member Data Documentation

AccessRequirementContainer ObjectMgr::_accessRequirementStore
private
AreaTriggerScriptContainer ObjectMgr::_areaTriggerScriptStore
private
AreaTriggerContainer ObjectMgr::_areaTriggerStore
private
uint32 ObjectMgr::_auctionId
private
BaseXPContainer ObjectMgr::_baseXPTable
private
CacheTrainerSpellContainer ObjectMgr::_cacheTrainerSpellStore
private
CacheVendorItemContainer ObjectMgr::_cacheVendorItemStore
private
CharacterTemplateContainer ObjectMgr::_characterTemplateStore
private
ExpansionRequirementContainer ObjectMgr::_classExpansionRequirementStore
private
CreatureAddonContainer ObjectMgr::_creatureAddonStore
private
CreatureBaseStatsContainer ObjectMgr::_creatureBaseStatsStore
private
CreatureDataContainer ObjectMgr::_creatureDataStore
private
CreatureLocaleContainer ObjectMgr::_creatureLocaleStore
private
CreatureModelContainer ObjectMgr::_creatureModelStore
private
QuestRelations ObjectMgr::_creatureQuestInvolvedRelations
private
QuestRelationsReverse ObjectMgr::_creatureQuestInvolvedRelationsReverse
private
CreatureQuestItemMap ObjectMgr::_creatureQuestItemStore
private
QuestRelations ObjectMgr::_creatureQuestRelations
private
uint64 ObjectMgr::_creatureSpawnId
private
CreatureTemplateAddonContainer ObjectMgr::_creatureTemplateAddonStore
private
CreatureTemplateContainer ObjectMgr::_creatureTemplateStore
private
std::set<uint32> ObjectMgr::_difficultyEntries[MAX_CREATURE_DIFFICULTIES]
private
DungeonEncounterContainer ObjectMgr::_dungeonEncounterStore
private
EquipmentInfoContainer ObjectMgr::_equipmentInfoStore
private
uint64 ObjectMgr::_equipmentSetGuid
private
FishingBaseSkillContainer ObjectMgr::_fishingBaseForAreaStore
private
GameObjectAddonContainer ObjectMgr::_gameObjectAddonStore
private
GameObjectDataContainer ObjectMgr::_gameObjectDataStore
private
GameObjectForQuestContainer ObjectMgr::_gameObjectForQuestStore
private
GameObjectLocaleContainer ObjectMgr::_gameObjectLocaleStore
private
GameObjectQuestItemMap ObjectMgr::_gameObjectQuestItemStore
private
uint64 ObjectMgr::_gameObjectSpawnId
private
GameObjectTemplateContainer ObjectMgr::_gameObjectTemplateStore
private
GameTeleContainer ObjectMgr::_gameTeleStore
private
QuestRelations ObjectMgr::_goQuestInvolvedRelations
private
QuestRelationsReverse ObjectMgr::_goQuestInvolvedRelationsReverse
private
QuestRelations ObjectMgr::_goQuestRelations
private
GossipMenuItemsLocaleContainer ObjectMgr::_gossipMenuItemsLocaleStore
private
GossipMenuItemsContainer ObjectMgr::_gossipMenuItemsStore
private
GossipMenusContainer ObjectMgr::_gossipMenusStore
private
std::map<HighGuid, std::unique_ptr<ObjectGuidGeneratorBase> > ObjectMgr::_guidGenerators
private
std::set<uint32> ObjectMgr::_hasDifficultyEntries[MAX_CREATURE_DIFFICULTIES]
private
uint32 ObjectMgr::_hiPetNumber
private
HotfixData ObjectMgr::_hotfixData
private
InstanceTemplateContainer ObjectMgr::_instanceTemplateStore
private
ItemTemplateContainer ObjectMgr::_itemTemplateStore
private
uint32 ObjectMgr::_itemTextId
private
LinkedRespawnContainer ObjectMgr::_linkedRespawnStore
private
uint32 ObjectMgr::_mailId
private
MailLevelRewardContainer ObjectMgr::_mailLevelRewardStore
private
MapObjectGuids ObjectMgr::_mapObjectGuidsStore
private
NpcTextContainer ObjectMgr::_npcTextStore
private
PageTextLocaleContainer ObjectMgr::_pageTextLocaleStore
private
PageTextContainer ObjectMgr::_pageTextStore
private
HalfNameContainer ObjectMgr::_petHalfName0
private
HalfNameContainer ObjectMgr::_petHalfName1
private
PetLevelInfoContainer ObjectMgr::_petInfoStore
private
PhaseInfo ObjectMgr::_phases
private
PlayerInfo* ObjectMgr::_playerInfo[MAX_RACES][MAX_CLASSES]
private
PlayerXPperLevel ObjectMgr::_playerXPperLevel
private
PointOfInterestLocaleContainer ObjectMgr::_pointOfInterestLocaleStore
private
PointOfInterestContainer ObjectMgr::_pointsOfInterestStore
private
QuestAreaTriggerContainer ObjectMgr::_questAreaTriggerStore
private
QuestGreetingContainer ObjectMgr::_questGreetingStore
private
QuestObjectivesLocaleContainer ObjectMgr::_questObjectivesLocaleStore
private
QuestPOIContainer ObjectMgr::_questPOIStore
private
QuestTemplateLocaleContainer ObjectMgr::_questTemplateLocaleStore
private
QuestMap ObjectMgr::_questTemplates
private
ExpansionRequirementContainer ObjectMgr::_raceExpansionRequirementStore
private
RealmNameContainer ObjectMgr::_realmNameStore
private
RepOnKillContainer ObjectMgr::_repOnKillStore
private
RepRewardRateContainer ObjectMgr::_repRewardRateStore
private
RepSpilloverTemplateContainer ObjectMgr::_repSpilloverTemplateStore
private
ReservedNamesContainer ObjectMgr::_reservedNamesStore
private
ScriptNameContainer ObjectMgr::_scriptNamesStore
private
std::unordered_map<uint32, SkillTiersEntry> ObjectMgr::_skillTiers
private
SpellClickInfoContainer ObjectMgr::_spellClickInfoStore
private
SpellScriptsContainer ObjectMgr::_spellScriptsStore
private
TavernAreaTriggerContainer ObjectMgr::_tavernAreaTriggerStore
private
TempSummonDataContainer ObjectMgr::_tempSummonDataStore
private

Stores temp summon data grouped by summoner's entry, summoner's type and group id.

TerrainPhaseInfo ObjectMgr::_terrainMapDefaultStore
private
TerrainPhaseInfo ObjectMgr::_terrainPhaseInfoStore
private
TerrainUIPhaseInfo ObjectMgr::_terrainWorldMapStore
private
std::set<uint32> ObjectMgr::_transportMaps
private
TrinityStringContainer ObjectMgr::_trinityStringStore
private
VehicleAccessoryContainer ObjectMgr::_vehicleAccessoryStore
private
VehicleAccessoryTemplateContainer ObjectMgr::_vehicleTemplateAccessoryStore
private
uint64 ObjectMgr::_voidItemId
private
LocaleConstant ObjectMgr::DBCLocaleIndex
private
CharacterConversionMap ObjectMgr::FactionChangeAchievements
CharacterConversionMap ObjectMgr::FactionChangeItems
CharacterConversionMap ObjectMgr::FactionChangeQuests
CharacterConversionMap ObjectMgr::FactionChangeReputation
CharacterConversionMap ObjectMgr::FactionChangeSpells
CharacterConversionMap ObjectMgr::FactionChangeTitles
GraveYardContainer ObjectMgr::GraveYardStore
ExclusiveQuestGroups ObjectMgr::mExclusiveQuestGroups

The documentation for this class was generated from the following files: