AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
ObjectMgr Class Reference

#include "ObjectMgr.h"

Classes

struct  GameobjectInstanceSavedState
 

Public Types

typedef std::unordered_map< uint32, Item * > ItemMap
 
typedef std::unordered_map< uint32, Quest * > QuestMap
 
typedef std::unordered_map< uint32, AreaTriggerAreaTriggerContainer
 
typedef std::unordered_map< uint32, AreaTriggerTeleportAreaTriggerTeleportContainer
 
typedef std::unordered_map< uint32, uint32AreaTriggerScriptContainer
 
typedef std::unordered_map< uint32, std::unordered_map< uint8, DungeonProgressionRequirements * > > DungeonProgressionRequirementsContainer
 
typedef std::unordered_map< uint32, RepRewardRateRepRewardRateContainer
 
typedef std::unordered_map< uint32, ReputationOnKillEntryRepOnKillContainer
 
typedef std::unordered_map< uint32, RepSpilloverTemplateRepSpilloverTemplateContainer
 
typedef std::unordered_map< uint32, PointOfInterestPointOfInterestContainer
 
typedef std::vector< std::string > ScriptNameContainer
 
typedef std::map< uint32, uint32CharacterConversionMap
 
typedef std::multimap< int32, uint32ExclusiveQuestGroups
 
typedef std::pair< ExclusiveQuestGroups::const_iterator, ExclusiveQuestGroups::const_iterator > ExclusiveQuestGroupsBounds
 

Public Member Functions

GameObjectTemplateContainer const * GetGameObjectTemplates () const
 
void AddGameobjectInfo (GameObjectTemplate *goinfo)
 
CreatureTemplateContainer const * GetCreatureTemplates () const
 
ItemTemplateContainer const * GetItemTemplateStore () const
 
std::vector< ItemTemplate * > const * GetItemTemplateStoreFast () const
 
ItemSetNameEntry const * GetItemSetNameEntry (uint32 itemId)
 
PlayerClassInfo const * GetPlayerClassInfo (uint32 class_) const
 
GameObjectQuestItemList const * GetGameObjectQuestItemList (uint32 id) const
 
GameObjectQuestItemMap const * GetGameObjectQuestItemMap () const
 
CreatureQuestItemList const * GetCreatureQuestItemList (uint32 id) const
 
CreatureQuestItemMap const * GetCreatureQuestItemMap () const
 
Quest const * GetQuestTemplate (uint32 quest_id) const
 
QuestMap const & GetQuestTemplates () const
 
uint32 GetQuestForAreaTrigger (uint32 Trigger_ID) const
 
bool IsTavernAreaTrigger (uint32 triggerID, uint32 faction) const
 
AreaTrigger const * GetAreaTrigger (uint32 trigger) const
 
AreaTriggerTeleport const * GetAreaTriggerTeleport (uint32 trigger) const
 
DungeonProgressionRequirements const * GetAccessRequirement (uint32 mapid, Difficulty difficulty) const
 
RepRewardRate const * GetRepRewardRate (uint32 factionId) const
 
ReputationOnKillEntry const * GetReputationOnKilEntry (uint32 id) const
 
RepSpilloverTemplate const * GetRepSpilloverTemplate (uint32 factionId) const
 
PointOfInterest const * GetPointOfInterest (uint32 id) const
 
QuestPOIVector const * GetQuestPOIVector (uint32 questId)
 
DungeonEncounterList const * GetDungeonEncounterList (uint32 mapId, Difficulty difficulty)
 
void LoadQuestStartersAndEnders ()
 
QuestRelationsGetGOQuestRelationMap ()
 
QuestRelationsGetGOQuestInvolvedRelationMap ()
 
QuestRelationBounds GetGOQuestRelationBounds (uint32 go_entry)
 
QuestRelationBounds GetGOQuestInvolvedRelationBounds (uint32 go_entry)
 
QuestRelationsGetCreatureQuestRelationMap ()
 
QuestRelationsGetCreatureQuestInvolvedRelationMap ()
 
QuestRelationBounds GetCreatureQuestRelationBounds (uint32 creature_entry)
 
QuestRelationBounds GetCreatureQuestInvolvedRelationBounds (uint32 creature_entry)
 
int32 GetFishingBaseSkillLevel (uint32 entry) const
 
template<HighGuid type>
ObjectGuidGeneratorBaseGetGenerator ()
 
MailLevelReward const * GetMailLevelReward (uint32 level, uint32 raceMask)
 
CellObjectGuids const & GetCellObjectGuids (uint16 mapid, uint8 spawnMode, uint32 cell_id)
 
CellObjectGuidsMap const & GetMapObjectGuids (uint16 mapid, uint8 spawnMode)
 
std::vector< TempSummonData > const * GetSummonGroup (uint32 summonerId, SummonerType summonerType, uint8 group) const
 
ServerMailContainer const & GetAllServerMailStore () const
 
BroadcastText const * GetBroadcastText (uint32 id) const
 
CreatureDataContainer const & GetAllCreatureData () const
 
CreatureData const * GetCreatureData (ObjectGuid::LowType spawnId) const
 
CreatureDataNewOrExistCreatureData (ObjectGuid::LowType spawnId)
 
ObjectGuid GetLinkedRespawnGuid (ObjectGuid guid) const
 
GameObjectDataContainer const & GetAllGOData () const
 
GameObjectData const * GetGameObjectData (ObjectGuid::LowType spawnId) const
 
CreatureLocale const * GetCreatureLocale (uint32 entry) const
 
GameObjectLocale const * GetGameObjectLocale (uint32 entry) const
 
ItemLocale const * GetItemLocale (uint32 entry) const
 
ItemSetNameLocale const * GetItemSetNameLocale (uint32 entry) const
 
PageTextLocale const * GetPageTextLocale (uint32 entry) const
 
QuestLocale const * GetQuestLocale (uint32 entry) const
 
GossipMenuItemsLocale const * GetGossipMenuItemsLocale (uint32 entry) const
 
PointOfInterestLocale const * GetPointOfInterestLocale (uint32 poi_id) const
 
QuestGreetingLocale const * GetQuestGreetingLocale (TypeID type, uint32 id) const
 
QuestOfferRewardLocale const * GetQuestOfferRewardLocale (uint32 entry) const
 
QuestRequestItemsLocale const * GetQuestRequestItemsLocale (uint32 entry) const
 
NpcTextLocale const * GetNpcTextLocale (uint32 entry) const
 
GameObjectDataNewGOData (ObjectGuid::LowType guid)
 
AcoreString const * GetAcoreString (uint32 entry) const
 
char const * GetAcoreStringForDBCLocale (uint32 entry) const
 
LocaleConstant GetDBCLocaleIndex () const
 
void SetDBCLocaleIndex (LocaleConstant locale)
 
GameTele const * GetGameTele (uint32 id) const
 
GameTeleContainer const & GetGameTeleMap () const
 
TrainerSpellData const * GetNpcTrainerSpells (uint32 entry) const
 
VendorItemData const * GetNpcVendorItemList (uint32 entry) const
 
ScriptNameContainerGetScriptNames ()
 
SpellClickInfoMapBounds GetSpellClickInfoMapBounds (uint32 creature_id) const
 
GossipMenusMapBounds GetGossipMenusMapBounds (uint32 uiMenuId) const
 
GossipMenusMapBoundsNonConst GetGossipMenusMapBoundsNonConst (uint32 uiMenuId)
 
GossipMenuItemsMapBounds GetGossipMenuItemsMapBounds (uint32 uiMenuId) const
 
GossipMenuItemsMapBoundsNonConst GetGossipMenuItemsMapBoundsNonConst (uint32 uiMenuId)
 
bool IsTransportMap (uint32 mapId) const
 

Static Public Member Functions

static std::string_view GetLocaleString (std::vector< std::string > const &data, size_t locale)
 
static void GetLocaleString (const std::vector< std::string > &data, int loc_idx, std::string &value)
 

Public Attributes

ExclusiveQuestGroups mExclusiveQuestGroups
 
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, GossipTextGossipTextContainer
 
typedef std::unordered_map< uint32, uint32QuestAreaTriggerContainer
 
typedef std::unordered_map< uint32, uint32TavernAreaTriggerContainer
 
typedef std::set< std::wstring > ReservedNamesContainer
 
typedef std::set< std::wstring > ProfanityNamesContainer
 
typedef std::map< uint32, PetLevelInfo * > PetLevelInfoContainer
 
typedef std::vector< uint32PlayerXPperLevel
 
typedef std::map< uint32, uint32BaseXPContainer
 
typedef std::map< uint32, int32FishingBaseSkillContainer
 
typedef std::map< uint32, std::vector< std::string > > HalfNameContainer
 
typedef std::map< std::pair< uint32, LocaleConstant >, std::vector< std::string > > HalfNameContainerLocale
 
typedef std::unordered_map< uint32, ItemSetNameEntryItemSetNameContainer
 

Private Member Functions

template<HighGuid high>
ObjectGuidGeneratorBaseGetGuidSequenceGenerator ()
 

Private Attributes

uint32 _auctionId
 
uint64 _equipmentSetGuid
 
uint32 _mailId
 
std::mutex _mailIdMutex
 
uint32 _hiPetNumber
 
std::mutex _hiPetNumberMutex
 
ObjectGuid::LowType _creatureSpawnId
 
ObjectGuid::LowType _gameObjectSpawnId
 
std::map< HighGuid, std::unique_ptr< ObjectGuidGeneratorBase > > _guidGenerators
 
QuestMap _questTemplates
 
std::vector< Quest * > _questTemplatesFast
 
QuestAreaTriggerContainer _questAreaTriggerStore
 
TavernAreaTriggerContainer _tavernAreaTriggerStore
 
GossipTextContainer _gossipTextStore
 
QuestGreetingContainer _questGreetingStore
 
AreaTriggerContainer _areaTriggerStore
 
AreaTriggerTeleportContainer _areaTriggerTeleportStore
 
AreaTriggerScriptContainer _areaTriggerScriptStore
 
DungeonProgressionRequirementsContainer _accessRequirementStore
 
DungeonEncounterContainer _dungeonEncounterStore
 
RepRewardRateContainer _repRewardRateStore
 
RepOnKillContainer _repOnKillStore
 
RepSpilloverTemplateContainer _repSpilloverTemplateStore
 
GossipMenusContainer _gossipMenusStore
 
GossipMenuItemsContainer _gossipMenuItemsStore
 
PointOfInterestContainer _pointsOfInterestStore
 
QuestPOIContainer _questPOIStore
 
QuestRelations _goQuestRelations
 
QuestRelations _goQuestInvolvedRelations
 
QuestRelations _creatureQuestRelations
 
QuestRelations _creatureQuestInvolvedRelations
 
ReservedNamesContainer _reservedNamesStore
 
ReservedNamesContainer _profanityNamesStore
 
GameTeleContainer _gameTeleStore
 
ScriptNameContainer _scriptNamesStore
 
SpellClickInfoContainer _spellClickInfoStore
 
SpellScriptsContainer _spellScriptsStore
 
VehicleAccessoryContainer _vehicleTemplateAccessoryStore
 
VehicleAccessoryContainer _vehicleAccessoryStore
 
LocaleConstant DBCLocaleIndex
 
PageTextContainer _pageTextStore
 
InstanceTemplateContainer _instanceTemplateStore
 
MailLevelRewardContainer _mailLevelRewardStore
 
CreatureBaseStatsContainer _creatureBaseStatsStore
 
PetLevelInfoContainer _petInfoStore
 
PlayerClassInfo_playerClassInfo [MAX_CLASSES]
 
PlayerInfo_playerInfo [MAX_RACES][MAX_CLASSES]
 
PlayerXPperLevel _playerXPperLevel
 
BaseXPContainer _baseXPTable
 
FishingBaseSkillContainer _fishingBaseForAreaStore
 
HalfNameContainer _petHalfName0
 
HalfNameContainer _petHalfName1
 
HalfNameContainerLocale _petHalfLocaleName0
 
HalfNameContainerLocale _petHalfLocaleName1
 
ItemSetNameContainer _itemSetNameStore
 
MapObjectGuids _mapObjectGuidsStore
 
CellObjectGuidsMap _emptyCellObjectGuidsMap
 
CellObjectGuids _emptyCellObjectGuids
 
CreatureDataContainer _creatureDataStore
 
CreatureTemplateContainer _creatureTemplateStore
 
CreatureCustomIDsContainer _creatureCustomIDsStore
 
std::vector< CreatureTemplate * > _creatureTemplateStoreFast
 
CreatureModelContainer _creatureModelStore
 
CreatureAddonContainer _creatureAddonStore
 
CreatureAddonContainer _creatureTemplateAddonStore
 
std::unordered_map< ObjectGuid::LowType, CreatureMovementData_creatureMovementOverrides
 
GameObjectAddonContainer _gameObjectAddonStore
 
GameObjectQuestItemMap _gameObjectQuestItemStore
 
CreatureQuestItemMap _creatureQuestItemStore
 
EquipmentInfoContainer _equipmentInfoStore
 
LinkedRespawnContainer _linkedRespawnStore
 
CreatureLocaleContainer _creatureLocaleStore
 
GameObjectDataContainer _gameObjectDataStore
 
GameObjectLocaleContainer _gameObjectLocaleStore
 
GameObjectTemplateContainer _gameObjectTemplateStore
 
GameObjectTemplateAddonContainer _gameObjectTemplateAddonStore
 
TempSummonDataContainer _tempSummonDataStore
 Stores temp summon data grouped by summoner's entry, summoner's type and group id.
 
BroadcastTextContainer _broadcastTextStore
 
ItemTemplateContainer _itemTemplateStore
 
std::vector< ItemTemplate * > _itemTemplateStoreFast
 
ItemLocaleContainer _itemLocaleStore
 
ItemSetNameLocaleContainer _itemSetNameLocaleStore
 
QuestLocaleContainer _questLocaleStore
 
QuestOfferRewardLocaleContainer _questOfferRewardLocaleStore
 
QuestRequestItemsLocaleContainer _questRequestItemsLocaleStore
 
NpcTextLocaleContainer _npcTextLocaleStore
 
PageTextLocaleContainer _pageTextLocaleStore
 
AcoreStringContainer _acoreStringStore
 
GossipMenuItemsLocaleContainer _gossipMenuItemsLocaleStore
 
PointOfInterestLocaleContainer _pointOfInterestLocaleStore
 
QuestGreetingLocaleContainer _questGreetingLocaleStore
 
CacheVendorItemContainer _cacheVendorItemStore
 
CacheTrainerSpellContainer _cacheTrainerSpellStore
 
ServerMailContainer _serverMailStore
 
std::set< uint32_difficultyEntries [MAX_DIFFICULTY - 1]
 
std::set< uint32_hasDifficultyEntries [MAX_DIFFICULTY - 1]
 
std::set< uint32_transportMaps
 
QuestMoneyRewardStore _questMoneyRewards
 
std::vector< GameobjectInstanceSavedStateGameobjectInstanceSavedStateList
 

Friends

class PlayerDumpReader
 

ProfanityNames

Checks NamesProfanity.dbc for reserved names

Parameters
nameName to check for match in NamesProfanity.dbc
Returns
true/false
 ObjectMgr ()
 
 ~ObjectMgr ()
 
void LoadScripts (ScriptsType type)
 
void LoadQuestRelationsHelper (QuestRelations &map, 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
 
static ObjectMgrinstance ()
 
static uint32 ChooseDisplayId (CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
 
static void ChooseCreatureFlags (CreatureTemplate const *cinfo, uint32 &npcflag, uint32 &unit_flags, uint32 &dynamicflags, CreatureData const *data=nullptr)
 
static uint8 CheckPlayerName (std::string_view name, bool create=false)
 
static PetNameInvalidReason CheckPetName (std::string_view name)
 
static bool IsValidCharterName (std::string_view name)
 
static bool IsValidChannelName (std::string const &name)
 
static bool CheckDeclinedNames (std::wstring w_ownname, DeclinedName const &names)
 
static void AddLocaleString (std::string &&s, LocaleConstant locale, std::vector< std::string > &data)
 
GameObjectTemplate const * GetGameObjectTemplate (uint32 entry)
 
bool IsGameObjectStaticTransport (uint32 entry)
 
int LoadReferenceVendor (int32 vendor, int32 item_id, std::set< uint32 > *skip_vendors)
 
void LoadGameObjectTemplate ()
 
void LoadGameObjectTemplateAddons ()
 
CreatureTemplate const * GetCreatureTemplate (uint32 entry)
 
CreatureModelInfo const * GetCreatureModelInfo (uint32 modelId) const
 
CreatureModelInfo const * GetCreatureModelRandomGender (uint32 *displayID)
 
EquipmentInfo const * GetEquipmentInfo (uint32 entry, int8 &id)
 
CreatureAddon const * GetCreatureAddon (ObjectGuid::LowType lowguid)
 
GameObjectAddon const * GetGameObjectAddon (ObjectGuid::LowType lowguid)
 
GameObjectTemplateAddon const * GetGameObjectTemplateAddon (uint32 entry) const
 
CreatureAddon const * GetCreatureTemplateAddon (uint32 entry)
 
CreatureMovementData const * GetCreatureMovementOverride (ObjectGuid::LowType spawnId) const
 
ItemTemplate const * GetItemTemplate (uint32 entry)
 
InstanceTemplate const * GetInstanceTemplate (uint32 mapId)
 
PetLevelInfo const * GetPetLevelInfo (uint32 creature_id, uint8 level) const
 
void GetPlayerClassLevelInfo (uint32 class_, uint8 level, PlayerClassLevelInfo *info) const
 
PlayerInfo const * GetPlayerInfo (uint32 race, uint32 class_) const
 
void GetPlayerLevelInfo (uint32 race, uint32 class_, uint8 level, PlayerLevelInfo *info) const
 
uint32 GetNearestTaxiNode (float x, float y, float z, uint32 mapid, uint32 teamId)
 
void GetTaxiPath (uint32 source, uint32 destination, uint32 &path, uint32 &cost)
 
uint32 GetTaxiMountDisplayId (uint32 id, TeamId teamId, bool allowed_alt_team=false)
 
GossipText const * GetGossipText (uint32 Text_ID) const
 
AreaTriggerTeleport const * GetGoBackTrigger (uint32 Map) const
 
AreaTriggerTeleport const * GetMapEntranceTrigger (uint32 Map) const
 
uint32 GetAreaTriggerScriptId (uint32 trigger_id)
 
SpellScriptsBounds GetSpellScriptsBounds (uint32 spell_id)
 
int32 GetBaseReputationOf (FactionEntry const *factionEntry, uint8 race, uint8 playerClass)
 
VehicleAccessoryList const * GetVehicleAccessoryList (Vehicle *veh) const
 
void LoadQuests ()
 
void LoadQuestMoneyRewards ()
 
void LoadGameobjectQuestStarters ()
 
void LoadGameobjectQuestEnders ()
 
void LoadCreatureQuestStarters ()
 
void LoadCreatureQuestEnders ()
 
void LoadEventScripts ()
 
void LoadSpellScripts ()
 
void LoadWaypointScripts ()
 
void LoadSpellScriptNames ()
 
void ValidateSpellScripts ()
 
void InitializeSpellInfoPrecomputedData ()
 
bool LoadAcoreStrings ()
 
void LoadBroadcastTexts ()
 
void LoadBroadcastTextLocales ()
 
void LoadCreatureClassLevelStats ()
 
void LoadCreatureLocales ()
 
void LoadCreatureTemplates ()
 
void LoadCreatureTemplate (Field *fields)
 
void LoadCreatureTemplateAddons ()
 
void LoadCreatureTemplateResistances ()
 
void LoadCreatureTemplateSpells ()
 
void LoadCreatureCustomIDs ()
 Load config option Creatures.CustomIDs into Store.
 
void CheckCreatureTemplate (CreatureTemplate const *cInfo)
 
void CheckCreatureMovement (char const *table, uint64 id, CreatureMovementData &creatureMovement)
 
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 LoadCreatureMovementOverrides ()
 
void LoadGameObjectLocales ()
 
void LoadGameobjects ()
 
void LoadItemTemplates ()
 
void LoadItemLocales ()
 
void LoadItemSetNames ()
 
void LoadItemSetNameLocales ()
 
void LoadQuestLocales ()
 
void LoadNpcTextLocales ()
 
void LoadQuestOfferRewardLocale ()
 
void LoadQuestRequestItemsLocale ()
 
void LoadPageTextLocales ()
 
void LoadGossipMenuItemsLocales ()
 
void LoadPointOfInterestLocales ()
 
void LoadQuestGreetingsLocales ()
 
void LoadInstanceTemplate ()
 
void LoadInstanceEncounters ()
 
void LoadMailLevelRewards ()
 
void LoadMailServerTemplates ()
 
void LoadVehicleTemplateAccessories ()
 
void LoadVehicleAccessories ()
 
void LoadGossipText ()
 
void LoadAreaTriggers ()
 
void LoadAreaTriggerTeleports ()
 
void LoadAccessRequirements ()
 
void LoadQuestAreaTriggers ()
 
void LoadQuestGreetings ()
 
void LoadAreaTriggerScripts ()
 
void LoadTavernAreaTriggers ()
 
void LoadGameObjectForQuests ()
 
void LoadPageTexts ()
 
PageText const * GetPageText (uint32 pageEntry)
 
void LoadPlayerInfo ()
 
void LoadPetLevelInfo ()
 
void LoadExplorationBaseXP ()
 
void LoadPetNames ()
 
void LoadPetNamesLocales ()
 
void LoadPetNumber ()
 
void LoadFishingBaseSkillLevel ()
 
void ChangeFishingBaseSkillLevel (uint32 entry, int32 skill)
 
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, uint32 reqSpell)
 
std::string GeneratePetName (uint32 entry)
 
std::string GeneratePetNameLocale (uint32 entry, LocaleConstant locale)
 
uint32 GetBaseXP (uint8 level)
 
uint32 GetXPForLevel (uint8 level) const
 
void ReturnOrDeleteOldMails (bool serverUp)
 
CreatureBaseStats const * GetCreatureBaseStats (uint8 level, uint8 unitClass)
 
void SetHighestGuids ()
 
uint32 GenerateAuctionID ()
 
uint64 GenerateEquipmentSetGuid ()
 
uint32 GenerateMailID ()
 
uint32 GeneratePetNumber ()
 
ObjectGuid::LowType GenerateCreatureSpawnId ()
 
ObjectGuid::LowType GenerateGameObjectSpawnId ()
 
void DeleteCreatureData (ObjectGuid::LowType spawnId)
 
QuestGreeting const * GetQuestGreeting (TypeID type, uint32 id) const
 
void DeleteGOData (ObjectGuid::LowType guid)
 
char const * GetAcoreString (uint32 entry, LocaleConstant locale) const
 
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)
 
uint32 AddGOData (uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay=0, float rotation0=0, float rotation1=0, float rotation2=0, float rotation3=0)
 
uint32 AddCreData (uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay=0)
 
void LoadReservedPlayersNames ()
 
bool IsReservedName (std::string_view name) const
 
void AddReservedPlayerName (std::string const &name)
 
void LoadProfanityPlayersNames ()
 
bool IsProfanityName (std::string_view name) const
 
void AddProfanityPlayerName (std::string const &name)
 
GameTele const * GetGameTele (std::string_view name) const
 
bool AddGameTele (GameTele &data)
 
bool DeleteGameTele (std::string_view name)
 
void AddVendorItem (uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedCost, bool persist=true)
 
bool RemoveVendorItem (uint32 entry, uint32 item, bool persist=true)
 
bool IsVendorItemValid (uint32 vendor_entry, uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, Player *player=nullptr, std::set< uint32 > *skip_vendors=nullptr, uint32 ORnpcflag=0) const
 
void LoadScriptNames ()
 
std::string const & GetScriptName (uint32 id) const
 
uint32 GetScriptId (std::string const &name)
 
void LoadFactionChangeAchievements ()
 
void LoadFactionChangeItems ()
 
void LoadFactionChangeQuests ()
 
void LoadFactionChangeReputations ()
 
void LoadFactionChangeSpells ()
 
void LoadFactionChangeTitles ()
 
uint32 GetQuestMoneyReward (uint8 level, uint32 questMoneyDifficulty) const
 
void SendServerMail (Player *player, uint32 id, uint32 reqLevel, uint32 reqPlayTime, uint32 rewardMoneyA, uint32 rewardMoneyH, uint32 rewardItemA, uint32 rewardItemCountA, uint32 rewardItemH, uint32 rewardItemCountH, std::string subject, std::string body, uint8 active) const
 
void LoadInstanceSavedGameobjectStateData ()
 
bool FindInstanceSavedGameobjectState (uint32 id, uint32 guid)
 
uint8 GetInstanceSavedGameobjectState (uint32 id, uint32 guid)
 
void SetInstanceSavedGameobjectState (uint32 id, uint32 guid, uint8 state)
 
void NewInstanceSavedGameobjectState (uint32 id, uint32 guid, uint8 state)
 

Detailed Description

Member Typedef Documentation

◆ AreaTriggerContainer

typedef std::unordered_map<uint32, AreaTrigger> ObjectMgr::AreaTriggerContainer

◆ AreaTriggerScriptContainer

typedef std::unordered_map<uint32, uint32> ObjectMgr::AreaTriggerScriptContainer

◆ AreaTriggerTeleportContainer

◆ BaseXPContainer

typedef std::map<uint32, uint32> ObjectMgr::BaseXPContainer
private

◆ CharacterConversionMap

◆ DungeonProgressionRequirementsContainer

◆ ExclusiveQuestGroups

typedef std::multimap<int32, uint32> ObjectMgr::ExclusiveQuestGroups

◆ ExclusiveQuestGroupsBounds

typedef std::pair<ExclusiveQuestGroups::const_iterator, ExclusiveQuestGroups::const_iterator> ObjectMgr::ExclusiveQuestGroupsBounds

◆ FishingBaseSkillContainer

◆ GossipTextContainer

typedef std::unordered_map<uint32, GossipText> ObjectMgr::GossipTextContainer
private

◆ HalfNameContainer

typedef std::map<uint32, std::vector<std::string> > ObjectMgr::HalfNameContainer
private

◆ HalfNameContainerLocale

typedef std::map<std::pair<uint32, LocaleConstant>, std::vector<std::string> > ObjectMgr::HalfNameContainerLocale
private

◆ ItemMap

typedef std::unordered_map<uint32, Item*> ObjectMgr::ItemMap

◆ ItemSetNameContainer

typedef std::unordered_map<uint32, ItemSetNameEntry> ObjectMgr::ItemSetNameContainer
private

◆ PetLevelInfoContainer

◆ PlayerXPperLevel

typedef std::vector<uint32> ObjectMgr::PlayerXPperLevel
private

◆ PointOfInterestContainer

◆ ProfanityNamesContainer

typedef std::set<std::wstring> ObjectMgr::ProfanityNamesContainer
private

◆ QuestAreaTriggerContainer

typedef std::unordered_map<uint32, uint32> ObjectMgr::QuestAreaTriggerContainer
private

◆ QuestMap

typedef std::unordered_map<uint32, Quest*> ObjectMgr::QuestMap

◆ RepOnKillContainer

◆ RepRewardRateContainer

◆ RepSpilloverTemplateContainer

◆ ReservedNamesContainer

typedef std::set<std::wstring> ObjectMgr::ReservedNamesContainer
private

◆ ScriptNameContainer

typedef std::vector<std::string> ObjectMgr::ScriptNameContainer

◆ TavernAreaTriggerContainer

typedef std::unordered_map<uint32, uint32> ObjectMgr::TavernAreaTriggerContainer
private

Member Enumeration Documentation

◆ CreatureLinkedRespawnType

Enumerator
CREATURE_TO_CREATURE 
CREATURE_TO_GO 
GO_TO_GO 
GO_TO_CREATURE 
1620 {
1622 CREATURE_TO_GO, // Creature is dependant on GO
1623 GO_TO_GO,
1624 GO_TO_CREATURE, // GO is dependant on creature
1625 };
@ CREATURE_TO_GO
Definition: ObjectMgr.h:1622
@ CREATURE_TO_CREATURE
Definition: ObjectMgr.h:1621
@ GO_TO_GO
Definition: ObjectMgr.h:1623
@ GO_TO_CREATURE
Definition: ObjectMgr.h:1624

Constructor & Destructor Documentation

◆ ObjectMgr()

ObjectMgr::ObjectMgr ( )
private
355 :
356 _auctionId(1),
358 _mailId(1),
359 _hiPetNumber(1),
363{
364 for (uint8 i = 0; i < MAX_CLASSES; ++i)
365 {
366 _playerClassInfo[i] = nullptr;
367 for (uint8 j = 0; j < MAX_RACES; ++j)
368 _playerInfo[j][i] = nullptr;
369 }
370}
@ LOCALE_enUS
Definition: Common.h:75
std::uint8_t uint8
Definition: Define.h:110
#define MAX_RACES
Definition: SharedDefines.h:94
#define MAX_CLASSES
Definition: SharedDefines.h:127
PlayerInfo * _playerInfo[MAX_RACES][MAX_CLASSES]
Definition: ObjectMgr.h:1551
ObjectGuid::LowType _gameObjectSpawnId
Definition: ObjectMgr.h:1463
uint32 _mailId
Definition: ObjectMgr.h:1457
ObjectGuid::LowType _creatureSpawnId
Definition: ObjectMgr.h:1462
LocaleConstant DBCLocaleIndex
Definition: ObjectMgr.h:1529
PlayerClassInfo * _playerClassInfo[MAX_CLASSES]
Definition: ObjectMgr.h:1547
uint64 _equipmentSetGuid
Definition: ObjectMgr.h:1456
uint32 _auctionId
Definition: ObjectMgr.h:1455
uint32 _hiPetNumber
Definition: ObjectMgr.h:1459

References _playerClassInfo, _playerInfo, MAX_CLASSES, and MAX_RACES.

◆ ~ObjectMgr()

ObjectMgr::~ObjectMgr ( )
private
373{
374 for (QuestMap::iterator i = _questTemplates.begin(); i != _questTemplates.end(); ++i)
375 delete i->second;
376
377 for (PetLevelInfoContainer::iterator i = _petInfoStore.begin(); i != _petInfoStore.end(); ++i)
378 delete[] i->second;
379
380 // free only if loaded
381 for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
382 {
383 if (_playerClassInfo[class_])
384 delete[] _playerClassInfo[class_]->levelInfo;
385 delete _playerClassInfo[class_];
386 }
387
388 for (int race = 0; race < MAX_RACES; ++race)
389 {
390 for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
391 {
392 if (_playerInfo[race][class_])
393 delete[] _playerInfo[race][class_]->levelInfo;
394 delete _playerInfo[race][class_];
395 }
396 }
397
398 for (CacheVendorItemContainer::iterator itr = _cacheVendorItemStore.begin(); itr != _cacheVendorItemStore.end(); ++itr)
399 itr->second.Clear();
400
402
403 for (DungeonEncounterContainer::iterator itr = _dungeonEncounterStore.begin(); itr != _dungeonEncounterStore.end(); ++itr)
404 for (DungeonEncounterList::iterator encounterItr = itr->second.begin(); encounterItr != itr->second.end(); ++encounterItr)
405 delete *encounterItr;
406
407 for (DungeonProgressionRequirementsContainer::iterator itr = _accessRequirementStore.begin(); itr != _accessRequirementStore.end(); ++itr)
408 {
409 std::unordered_map<uint8, DungeonProgressionRequirements*> difficulties = itr->second;
410 for (auto difficultiesItr = difficulties.begin(); difficultiesItr != difficulties.end(); ++difficultiesItr)
411 {
412 for (auto questItr = difficultiesItr->second->quests.begin(); questItr != difficultiesItr->second->quests.end(); ++questItr)
413 {
414 delete* questItr;
415 }
416
417 for (auto achievementItr = difficultiesItr->second->achievements.begin(); achievementItr != difficultiesItr->second->achievements.end(); ++achievementItr)
418 {
419 delete* achievementItr;
420 }
421
422 for (auto itemsItr = difficultiesItr->second->items.begin(); itemsItr != difficultiesItr->second->items.end(); ++itemsItr)
423 {
424 delete* itemsItr;
425 }
426
427 delete difficultiesItr->second;
428 }
429 }
430}
PlayerClassLevelInfo * levelInfo
Definition: Player.h:300
PlayerLevelInfo * levelInfo
Definition: Player.h:354
CacheTrainerSpellContainer _cacheTrainerSpellStore
Definition: ObjectMgr.h:1612
PetLevelInfoContainer _petInfoStore
Definition: ObjectMgr.h:1545
QuestMap _questTemplates
Definition: ObjectMgr.h:1478
DungeonProgressionRequirementsContainer _accessRequirementStore
Definition: ObjectMgr.h:1492
DungeonEncounterContainer _dungeonEncounterStore
Definition: ObjectMgr.h:1493
CacheVendorItemContainer _cacheVendorItemStore
Definition: ObjectMgr.h:1611

References _accessRequirementStore, _cacheTrainerSpellStore, _cacheVendorItemStore, _dungeonEncounterStore, _petInfoStore, _playerClassInfo, _playerInfo, _questTemplates, PlayerClassInfo::levelInfo, PlayerInfo::levelInfo, MAX_CLASSES, and MAX_RACES.

Member Function Documentation

◆ AddCreatureToGrid()

void ObjectMgr::AddCreatureToGrid ( ObjectGuid::LowType  guid,
CreatureData const *  data 
)
2339{
2340 uint8 mask = data->spawnMask;
2341 for (uint8 i = 0; mask != 0; i++, mask >>= 1)
2342 {
2343 if (mask & 1)
2344 {
2345 CellCoord cellCoord = Acore::ComputeCellCoord(data->posX, data->posY);
2346 CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
2347 cell_guids.creatures.insert(guid);
2348 }
2349 }
2350}
uint32 MAKE_PAIR32(uint16 l, uint16 h)
Definition: ObjectDefines.h:87
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:191
Definition: ObjectMgr.h:479
CellGuidSet creatures
Definition: ObjectMgr.h:480
MapObjectGuids _mapObjectGuidsStore
Definition: ObjectMgr.h:1572
uint32 GetId() const
Definition: GridDefines.h:148

References _mapObjectGuidsStore, Acore::ComputeCellCoord(), CellObjectGuids::creatures, CoordPair< LIMIT >::GetId(), MAKE_PAIR32(), CreatureData::mapid, CreatureData::posX, CreatureData::posY, and CreatureData::spawnMask.

Referenced by AddCreData(), and LoadCreatures().

◆ AddCreData()

uint32 ObjectMgr::AddCreData ( uint32  entry,
uint32  map,
float  x,
float  y,
float  z,
float  o,
uint32  spawntimedelay = 0 
)
2418{
2419 CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
2420 if (!cInfo)
2421 return 0;
2422
2423 uint32 level = cInfo->minlevel == cInfo->maxlevel ? cInfo->minlevel : urand(cInfo->minlevel, cInfo->maxlevel); // Only used for extracting creature base stats
2424 CreatureBaseStats const* stats = GetCreatureBaseStats(level, cInfo->unit_class);
2425 Map* map = sMapMgr->CreateBaseMap(mapId);
2426 if (!map)
2427 return 0;
2428
2430 CreatureData& data = NewOrExistCreatureData(spawnId);
2431 data.spawnMask = spawnId;
2432 data.id1 = entry;
2433 data.id2 = 0;
2434 data.id3 = 0;
2435 data.mapid = mapId;
2436 data.displayid = 0;
2437 data.equipmentId = 0;
2438 data.posX = x;
2439 data.posY = y;
2440 data.posZ = z;
2441 data.orientation = o;
2442 data.spawntimesecs = spawntimedelay;
2443 data.wander_distance = 0;
2444 data.currentwaypoint = 0;
2445 data.curhealth = stats->GenerateHealth(cInfo);
2446 data.curmana = stats->GenerateMana(cInfo);
2447 data.movementType = cInfo->MovementType;
2448 data.spawnMask = 1;
2450 data.dbData = false;
2451 data.npcflag = cInfo->npcflag;
2452 data.unit_flags = cInfo->unit_flags;
2453 data.dynamicflags = cInfo->dynamicflags;
2454
2455 AddCreatureToGrid(spawnId, &data);
2456
2457 // Spawn if necessary (loaded grids only)
2458 if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
2459 {
2460 Creature* creature = new Creature();
2461 if (!creature->LoadCreatureFromDB(spawnId, map, true, false, true))
2462 {
2463 LOG_ERROR("sql.sql", "AddCreature: Cannot add creature entry {} to map", entry);
2464 delete creature;
2465 return 0;
2466 }
2467 }
2468
2469 return spawnId;
2470}
std::uint32_t uint32
Definition: Define.h:108
#define LOG_ERROR(filterType__,...)
Definition: Log.h:159
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ PHASEMASK_NORMAL
Definition: Object.h:56
#define sMapMgr
Definition: MapMgr.h:221
Definition: Creature.h:46
bool LoadCreatureFromDB(ObjectGuid::LowType guid, Map *map, bool addToMap=true, bool gridLoad=false, bool allowDuplicate=false)
Definition: Creature.cpp:1661
Definition: CreatureData.h:176
uint32 unit_flags
Definition: CreatureData.h:207
uint8 minlevel
Definition: CreatureData.h:188
uint8 maxlevel
Definition: CreatureData.h:189
uint32 MovementType
Definition: CreatureData.h:227
uint32 npcflag
Definition: CreatureData.h:192
uint32 unit_class
Definition: CreatureData.h:206
uint32 dynamicflags
Definition: CreatureData.h:209
Definition: CreatureData.h:292
uint32 GenerateMana(CreatureTemplate const *info) const
Definition: CreatureData.h:307
uint32 GenerateHealth(CreatureTemplate const *info) const
Definition: CreatureData.h:302
Definition: CreatureData.h:359
float wander_distance
Definition: CreatureData.h:373
uint32 phaseMask
Definition: CreatureData.h:365
uint32 spawntimesecs
Definition: CreatureData.h:372
uint32 dynamicflags
Definition: CreatureData.h:381
uint32 npcflag
Definition: CreatureData.h:379
bool dbData
Definition: CreatureData.h:383
uint32 displayid
Definition: CreatureData.h:366
uint8 movementType
Definition: CreatureData.h:377
uint8 spawnMask
Definition: CreatureData.h:378
uint32 unit_flags
Definition: CreatureData.h:380
uint32 id2
Definition: CreatureData.h:362
uint32 curhealth
Definition: CreatureData.h:375
float orientation
Definition: CreatureData.h:371
uint32 curmana
Definition: CreatureData.h:376
uint32 id3
Definition: CreatureData.h:363
float posY
Definition: CreatureData.h:369
float posX
Definition: CreatureData.h:368
int8 equipmentId
Definition: CreatureData.h:367
uint32 currentwaypoint
Definition: CreatureData.h:374
uint16 mapid
Definition: CreatureData.h:364
float posZ
Definition: CreatureData.h:370
uint32 id1
Definition: CreatureData.h:361
uint32 LowType
Definition: ObjectGuid.h:124
CreatureBaseStats const * GetCreatureBaseStats(uint8 level, uint8 unitClass)
Definition: ObjectMgr.cpp:9612
void AddCreatureToGrid(ObjectGuid::LowType guid, CreatureData const *data)
Definition: ObjectMgr.cpp:2338
ObjectGuid::LowType GenerateCreatureSpawnId()
Definition: ObjectMgr.cpp:7040
CreatureData & NewOrExistCreatureData(ObjectGuid::LowType spawnId)
Definition: ObjectMgr.h:1206
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9960
Definition: Map.h:312
bool IsRemovalGrid(float x, float y) const
Definition: Map.h:362
bool Instanceable() const
Definition: Map.h:446

References AddCreatureToGrid(), CreatureData::curhealth, CreatureData::curmana, CreatureData::currentwaypoint, CreatureData::dbData, CreatureData::displayid, CreatureTemplate::dynamicflags, CreatureData::dynamicflags, CreatureData::equipmentId, GenerateCreatureSpawnId(), CreatureBaseStats::GenerateHealth(), CreatureBaseStats::GenerateMana(), GetCreatureBaseStats(), GetCreatureTemplate(), CreatureData::id1, CreatureData::id2, CreatureData::id3, Map::Instanceable(), Map::IsRemovalGrid(), Creature::LoadCreatureFromDB(), LOG_ERROR, CreatureData::mapid, CreatureTemplate::maxlevel, CreatureTemplate::minlevel, CreatureTemplate::MovementType, CreatureData::movementType, NewOrExistCreatureData(), CreatureTemplate::npcflag, CreatureData::npcflag, CreatureData::orientation, CreatureData::phaseMask, PHASEMASK_NORMAL, CreatureData::posX, CreatureData::posY, CreatureData::posZ, sMapMgr, CreatureData::spawnMask, CreatureData::spawntimesecs, CreatureTemplate::unit_class, CreatureTemplate::unit_flags, CreatureData::unit_flags, urand(), and CreatureData::wander_distance.

◆ AddGameobjectInfo()

void ObjectMgr::AddGameobjectInfo ( GameObjectTemplate goinfo)

◆ AddGameobjectToGrid()

void ObjectMgr::AddGameobjectToGrid ( ObjectGuid::LowType  guid,
GameObjectData const *  data 
)
2645{
2646 uint8 mask = data->spawnMask;
2647 for (uint8 i = 0; mask != 0; i++, mask >>= 1)
2648 {
2649 if (mask & 1)
2650 {
2651 CellCoord cellCoord = Acore::ComputeCellCoord(data->posX, data->posY);
2652 CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
2653 cell_guids.gameobjects.insert(guid);
2654 }
2655 }
2656}
CellGuidSet gameobjects
Definition: ObjectMgr.h:481

References _mapObjectGuidsStore, Acore::ComputeCellCoord(), CellObjectGuids::gameobjects, CoordPair< LIMIT >::GetId(), MAKE_PAIR32(), GameObjectData::mapid, GameObjectData::posX, GameObjectData::posY, and GameObjectData::spawnMask.

Referenced by AddGOData(), and LoadGameobjects().

◆ AddGameTele()

bool ObjectMgr::AddGameTele ( GameTele data)
8844{
8845 // find max id
8846 uint32 new_id = 0;
8847 for (GameTeleContainer::const_iterator itr = _gameTeleStore.begin(); itr != _gameTeleStore.end(); ++itr)
8848 if (itr->first > new_id)
8849 new_id = itr->first;
8850
8851 // use next
8852 ++new_id;
8853
8854 if (!Utf8toWStr(tele.name, tele.wnameLow))
8855 return false;
8856
8857 wstrToLower(tele.wnameLow);
8858
8859 _gameTeleStore[new_id] = tele;
8860
8862
8863 stmt->SetData(0, new_id);
8864 stmt->SetData(1, tele.position_x);
8865 stmt->SetData(2, tele.position_y);
8866 stmt->SetData(3, tele.position_z);
8867 stmt->SetData(4, tele.orientation);
8868 stmt->SetData(5, uint16(tele.mapId));
8869 stmt->SetData(6, tele.name);
8870
8871 WorldDatabase.Execute(stmt);
8872
8873 return true;
8874}
std::uint16_t uint16
Definition: Define.h:109
void wstrToLower(std::wstring &str)
Definition: Util.cpp:383
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:282
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
@ WORLD_INS_GAME_TELE
Definition: WorldDatabase.h:41
Definition: PreparedStatement.h:158
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78
GameTeleContainer _gameTeleStore
Definition: ObjectMgr.h:1518

References _gameTeleStore, GameTele::mapId, GameTele::name, GameTele::orientation, GameTele::position_x, GameTele::position_y, GameTele::position_z, PreparedStatementBase::SetData(), Utf8toWStr(), GameTele::wnameLow, WORLD_INS_GAME_TELE, WorldDatabase, and wstrToLower().

◆ AddGOData()

uint32 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 
)
2367{
2368 GameObjectTemplate const* goinfo = GetGameObjectTemplate(entry);
2369 if (!goinfo)
2370 return 0;
2371
2372 Map* map = sMapMgr->CreateBaseMap(mapId);
2373 if (!map)
2374 return 0;
2375
2377
2378 GameObjectData& data = NewGOData(spawnId);
2379 data.id = entry;
2380 data.mapid = mapId;
2381 data.posX = x;
2382 data.posY = y;
2383 data.posZ = z;
2384 data.orientation = o;
2385 data.rotation.x = rotation0;
2386 data.rotation.y = rotation1;
2387 data.rotation.z = rotation2;
2388 data.rotation.w = rotation3;
2389 data.spawntimesecs = spawntimedelay;
2390 data.animprogress = 100;
2391 data.spawnMask = 1;
2392 data.go_state = GO_STATE_READY;
2394 data.artKit = goinfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT ? 21 : 0;
2395 data.dbData = false;
2396
2397 AddGameobjectToGrid(spawnId, &data);
2398
2399 // Spawn if necessary (loaded grids only)
2400 // We use spawn coords to spawn
2401 if (!map->Instanceable() && map->IsGridLoaded(x, y))
2402 {
2403 GameObject* go = sObjectMgr->IsGameObjectStaticTransport(data.id) ? new StaticTransport() : new GameObject();
2404 if (!go->LoadGameObjectFromDB(spawnId, map))
2405 {
2406 LOG_ERROR("sql.sql", "AddGOData: cannot add gameobject entry {} to map", entry);
2407 delete go;
2408 return 0;
2409 }
2410 }
2411
2412 LOG_DEBUG("maps", "AddGOData: spawnId {} entry {} map {} x {} y {} z {} o {}", spawnId, entry, mapId, x, y, z, o);
2413
2414 return spawnId;
2415}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:171
@ GO_STATE_READY
Definition: GameObjectData.h:691
#define sObjectMgr
Definition: ObjectMgr.h:1640
@ GAMEOBJECT_TYPE_CAPTURE_POINT
Definition: SharedDefines.h:1561
Definition: GameObject.h:122
bool LoadGameObjectFromDB(ObjectGuid::LowType guid, Map *map, bool addToMap=true)
Definition: GameObject.cpp:1120
Definition: GameObjectData.h:32
uint32 type
Definition: GameObjectData.h:34
Definition: GameObjectData.h:697
bool dbData
Definition: GameObjectData.h:713
float orientation
Definition: GameObjectData.h:705
float posZ
Definition: GameObjectData.h:704
uint8 artKit
Definition: GameObjectData.h:712
int32 spawntimesecs
Definition: GameObjectData.h:707
uint8 spawnMask
Definition: GameObjectData.h:711
G3D::Quat rotation
Definition: GameObjectData.h:706
uint32 animprogress
Definition: GameObjectData.h:709
uint16 mapid
Definition: GameObjectData.h:700
float posX
Definition: GameObjectData.h:702
uint32 phaseMask
Definition: GameObjectData.h:701
float posY
Definition: GameObjectData.h:703
uint32 id
Definition: GameObjectData.h:699
GOState go_state
Definition: GameObjectData.h:710
Definition: Transport.h:112
void AddGameobjectToGrid(ObjectGuid::LowType guid, GameObjectData const *data)
Definition: ObjectMgr.cpp:2644
GameObjectTemplate const * GetGameObjectTemplate(uint32 entry)
Definition: ObjectMgr.cpp:9936
ObjectGuid::LowType GenerateGameObjectSpawnId()
Definition: ObjectMgr.cpp:7050
GameObjectData & NewGOData(ObjectGuid::LowType guid)
Definition: ObjectMgr.h:1311
bool IsGridLoaded(float x, float y) const
Definition: Map.h:368

References AddGameobjectToGrid(), GameObjectData::animprogress, GameObjectData::artKit, GameObjectData::dbData, GAMEOBJECT_TYPE_CAPTURE_POINT, GenerateGameObjectSpawnId(), GetGameObjectTemplate(), GameObjectData::go_state, GO_STATE_READY, GameObjectData::id, Map::Instanceable(), Map::IsGridLoaded(), GameObject::LoadGameObjectFromDB(), LOG_DEBUG, LOG_ERROR, GameObjectData::mapid, NewGOData(), GameObjectData::orientation, GameObjectData::phaseMask, PHASEMASK_NORMAL, GameObjectData::posX, GameObjectData::posY, GameObjectData::posZ, GameObjectData::rotation, sMapMgr, sObjectMgr, GameObjectData::spawnMask, GameObjectData::spawntimesecs, and GameObjectTemplate::type.

◆ AddLocaleString()

void ObjectMgr::AddLocaleString ( std::string &&  s,
LocaleConstant  locale,
std::vector< std::string > &  data 
)
static

◆ AddProfanityPlayerName()

void ObjectMgr::AddProfanityPlayerName ( std::string const &  name)
8263{
8264 if (!IsProfanityName(name))
8265 {
8266 std::wstring wstr;
8267 if (!Utf8toWStr(name, wstr))
8268 {
8269 LOG_ERROR("server", "Could not add invalid name to profanity player names: {}", name);
8270 return;
8271 }
8272 wstrToLower(wstr);
8273
8274 _profanityNamesStore.insert(wstr);
8275
8277 stmt->SetData(0, name);
8278 CharacterDatabase.Execute(stmt);
8279 }
8280}
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
@ CHAR_INS_PROFANITY_PLAYER_NAME
Definition: CharacterDatabase.h:513
bool IsProfanityName(std::string_view name) const
Definition: ObjectMgr.cpp:8247
ReservedNamesContainer _profanityNamesStore
Definition: ObjectMgr.h:1516

References _profanityNamesStore, CHAR_INS_PROFANITY_PLAYER_NAME, CharacterDatabase, IsProfanityName(), LOG_ERROR, PreparedStatementBase::SetData(), Utf8toWStr(), and wstrToLower().

◆ AddReservedPlayerName()

void ObjectMgr::AddReservedPlayerName ( std::string const &  name)
8188{
8189 if (!IsReservedName(name))
8190 {
8191 std::wstring wstr;
8192 if (!Utf8toWStr(name, wstr))
8193 {
8194 LOG_ERROR("server", "Could not add invalid name to reserved player names: {}", name);
8195 return;
8196 }
8197 wstrToLower(wstr);
8198
8199 _reservedNamesStore.insert(wstr);
8200
8202 stmt->SetData(0, name);
8203 CharacterDatabase.Execute(stmt);
8204 }
8205}
@ CHAR_INS_RESERVED_PLAYER_NAME
Definition: CharacterDatabase.h:512
bool IsReservedName(std::string_view name) const
Definition: ObjectMgr.cpp:8172
ReservedNamesContainer _reservedNamesStore
Definition: ObjectMgr.h:1512

References _reservedNamesStore, CHAR_INS_RESERVED_PLAYER_NAME, CharacterDatabase, IsReservedName(), LOG_ERROR, PreparedStatementBase::SetData(), Utf8toWStr(), and wstrToLower().

◆ AddSpellToTrainer()

void ObjectMgr::AddSpellToTrainer ( uint32  entry,
uint32  spell,
uint32  spellCost,
uint32  reqSkill,
uint32  reqSkillValue,
uint32  reqLevel,
uint32  reqSpell 
)
8965{
8966 if (entry >= ACORE_TRAINER_START_REF)
8967 return;
8968
8969 CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
8970 if (!cInfo)
8971 {
8972 LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry for a non-existing creature template (Entry: {}), ignoring", entry);
8973 return;
8974 }
8975
8976 if (!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER))
8977 {
8978 LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry for a creature template (Entry: {}) without trainer flag, ignoring", entry);
8979 return;
8980 }
8981
8982 SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spell);
8983 if (!spellinfo)
8984 {
8985 LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: {}) for a non-existing spell (Spell: {}), ignoring", entry, spell);
8986 return;
8987 }
8988
8989 if (!SpellMgr::ComputeIsSpellValid(spellinfo))
8990 {
8991 LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: {}) for a broken spell (Spell: {}), ignoring", entry, spell);
8992 return;
8993 }
8994
8995 if (GetTalentSpellCost(spell))
8996 {
8997 LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: {}) for a non-existing spell (Spell: {}) which is a talent, ignoring", entry, spell);
8998 return;
8999 }
9000
9001 if (reqSpell && !sSpellMgr->GetSpellInfo(reqSpell))
9002 {
9003 LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: {}) for a non-existing reqSpell (Spell: {}), ignoring", entry, reqSpell);
9004 return;
9005 }
9006
9008
9009 TrainerSpell& trainerSpell = data.spellList[spell];
9010 trainerSpell.spell = spell;
9011 trainerSpell.spellCost = spellCost;
9012 trainerSpell.reqSkill = reqSkill;
9013 trainerSpell.reqSkillValue = reqSkillValue;
9014 trainerSpell.reqLevel = reqLevel;
9015 trainerSpell.reqSpell = reqSpell;
9016
9017 if (!trainerSpell.reqLevel)
9018 trainerSpell.reqLevel = spellinfo->SpellLevel;
9019
9020 // calculate learned spell for profession case when stored cast-spell
9021 trainerSpell.learnedSpell[0] = spell;
9022 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
9023 {
9024 if (spellinfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL)
9025 continue;
9026 if (trainerSpell.learnedSpell[0] == spell)
9027 trainerSpell.learnedSpell[0] = 0;
9028 // player must be able to cast spell on himself
9029 if (spellinfo->Effects[i].TargetA.GetTarget() != 0 && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ALLY
9030 && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ANY && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_CASTER)
9031 {
9032 LOG_ERROR("sql.sql", "Table `npc_trainer` has spell {} for trainer entry {} with learn effect which has incorrect target type, ignoring learn effect!", spell, entry);
9033 continue;
9034 }
9035
9036 trainerSpell.learnedSpell[i] = spellinfo->Effects[i].TriggerSpell;
9037
9038 if (trainerSpell.learnedSpell[i])
9039 {
9040 SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainerSpell.learnedSpell[i]);
9041 if (learnedSpellInfo && learnedSpellInfo->IsProfession())
9042 data.trainerType = 2;
9043 }
9044 }
9045
9046 return;
9047}
uint32 GetTalentSpellCost(uint32 spellId)
Definition: DBCStores.cpp:679
@ UNIT_NPC_FLAG_TRAINER
Definition: Unit.h:520
#define ACORE_TRAINER_START_REF
Definition: ObjectMgr.h:494
#define sSpellMgr
Definition: SpellMgr.h:818
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1610
@ SPELL_EFFECT_LEARN_SPELL
Definition: SharedDefines.h:786
@ TARGET_UNIT_TARGET_ALLY
Definition: SharedDefines.h:1397
@ TARGET_UNIT_TARGET_ANY
Definition: SharedDefines.h:1401
@ TARGET_UNIT_CASTER
Definition: SharedDefines.h:1382
Definition: CreatureData.h:496
uint32 reqSkillValue
Definition: CreatureData.h:506
uint32 learnedSpell[3]
Definition: CreatureData.h:508
uint32 reqSpell
Definition: CreatureData.h:509
uint32 spellCost
Definition: CreatureData.h:504
uint32 reqSkill
Definition: CreatureData.h:505
uint32 reqLevel
Definition: CreatureData.h:507
uint32 spell
Definition: CreatureData.h:503
Definition: CreatureData.h:518
TrainerSpellMap spellList
Definition: CreatureData.h:522
uint32 trainerType
Definition: CreatureData.h:523
Definition: SpellInfo.h:314
uint32 SpellLevel
Definition: SpellInfo.h:358
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:391
bool IsProfession() const
Definition: SpellInfo.cpp:937
static bool ComputeIsSpellValid(SpellInfo const *spellInfo, bool msg=true)
Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book,...
Definition: SpellMgr.cpp:371

References _cacheTrainerSpellStore, ACORE_TRAINER_START_REF, SpellMgr::ComputeIsSpellValid(), SpellInfo::Effects, GetCreatureTemplate(), GetTalentSpellCost(), SpellInfo::IsProfession(), TrainerSpell::learnedSpell, LOG_ERROR, MAX_SPELL_EFFECTS, CreatureTemplate::npcflag, TrainerSpell::reqLevel, TrainerSpell::reqSkill, TrainerSpell::reqSkillValue, TrainerSpell::reqSpell, TrainerSpell::spell, SPELL_EFFECT_LEARN_SPELL, TrainerSpell::spellCost, SpellInfo::SpellLevel, TrainerSpellData::spellList, sSpellMgr, TARGET_UNIT_CASTER, TARGET_UNIT_TARGET_ALLY, TARGET_UNIT_TARGET_ANY, TrainerSpellData::trainerType, and UNIT_NPC_FLAG_TRAINER.

Referenced by LoadTrainerSpell().

◆ AddVendorItem()

void ObjectMgr::AddVendorItem ( uint32  entry,
uint32  item,
int32  maxcount,
uint32  incrtime,
uint32  extendedCost,
bool  persist = true 
)
9290{
9291 VendorItemData& vList = _cacheVendorItemStore[entry];
9292 vList.AddItem(item, maxcount, incrtime, extendedCost);
9293
9294 if (persist)
9295 {
9297
9298 stmt->SetData(0, entry);
9299 stmt->SetData(1, item);
9300 stmt->SetData(2, maxcount);
9301 stmt->SetData(3, incrtime);
9302 stmt->SetData(4, extendedCost);
9303
9304 WorldDatabase.Execute(stmt);
9305 }
9306}
@ WORLD_INS_NPC_VENDOR
Definition: WorldDatabase.h:43
Definition: CreatureData.h:458
void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost)
Definition: CreatureData.h:470

References _cacheVendorItemStore, VendorItemData::AddItem(), PreparedStatementBase::SetData(), WORLD_INS_NPC_VENDOR, and WorldDatabase.

◆ BuildPlayerLevelInfo()

void ObjectMgr::BuildPlayerLevelInfo ( uint8  race,
uint8  class_,
uint8  level,
PlayerLevelInfo plinfo 
) const
private
4344{
4345 // base data (last known level)
4346 *info = _playerInfo[race][_class]->levelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) - 1];
4347
4348 // if conversion from uint32 to uint8 causes unexpected behaviour, change lvl to uint32
4349 for (uint8 lvl = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) - 1; lvl < level; ++lvl)
4350 {
4351 switch (_class)
4352 {
4353 case CLASS_WARRIOR:
4354 info->stats[STAT_STRENGTH] += (lvl > 23 ? 2 : (lvl > 1 ? 1 : 0));
4355 info->stats[STAT_STAMINA] += (lvl > 23 ? 2 : (lvl > 1 ? 1 : 0));
4356 info->stats[STAT_AGILITY] += (lvl > 36 ? 1 : (lvl > 6 && (lvl % 2) ? 1 : 0));
4357 info->stats[STAT_INTELLECT] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
4358 info->stats[STAT_SPIRIT] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
4359 break;
4360 case CLASS_PALADIN:
4361 info->stats[STAT_STRENGTH] += (lvl > 3 ? 1 : 0);
4362 info->stats[STAT_STAMINA] += (lvl > 33 ? 2 : (lvl > 1 ? 1 : 0));
4363 info->stats[STAT_AGILITY] += (lvl > 38 ? 1 : (lvl > 7 && !(lvl % 2) ? 1 : 0));
4364 info->stats[STAT_INTELLECT] += (lvl > 6 && (lvl % 2) ? 1 : 0);
4365 info->stats[STAT_SPIRIT] += (lvl > 7 ? 1 : 0);
4366 break;
4367 case CLASS_HUNTER:
4368 info->stats[STAT_STRENGTH] += (lvl > 4 ? 1 : 0);
4369 info->stats[STAT_STAMINA] += (lvl > 4 ? 1 : 0);
4370 info->stats[STAT_AGILITY] += (lvl > 33 ? 2 : (lvl > 1 ? 1 : 0));
4371 info->stats[STAT_INTELLECT] += (lvl > 8 && (lvl % 2) ? 1 : 0);
4372 info->stats[STAT_SPIRIT] += (lvl > 38 ? 1 : (lvl > 9 && !(lvl % 2) ? 1 : 0));
4373 break;
4374 case CLASS_ROGUE:
4375 info->stats[STAT_STRENGTH] += (lvl > 5 ? 1 : 0);
4376 info->stats[STAT_STAMINA] += (lvl > 4 ? 1 : 0);
4377 info->stats[STAT_AGILITY] += (lvl > 16 ? 2 : (lvl > 1 ? 1 : 0));
4378 info->stats[STAT_INTELLECT] += (lvl > 8 && !(lvl % 2) ? 1 : 0);
4379 info->stats[STAT_SPIRIT] += (lvl > 38 ? 1 : (lvl > 9 && !(lvl % 2) ? 1 : 0));
4380 break;
4381 case CLASS_PRIEST:
4382 info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
4383 info->stats[STAT_STAMINA] += (lvl > 5 ? 1 : 0);
4384 info->stats[STAT_AGILITY] += (lvl > 38 ? 1 : (lvl > 8 && (lvl % 2) ? 1 : 0));
4385 info->stats[STAT_INTELLECT] += (lvl > 22 ? 2 : (lvl > 1 ? 1 : 0));
4386 info->stats[STAT_SPIRIT] += (lvl > 3 ? 1 : 0);
4387 break;
4388 case CLASS_SHAMAN:
4389 info->stats[STAT_STRENGTH] += (lvl > 34 ? 1 : (lvl > 6 && (lvl % 2) ? 1 : 0));
4390 info->stats[STAT_STAMINA] += (lvl > 4 ? 1 : 0);
4391 info->stats[STAT_AGILITY] += (lvl > 7 && !(lvl % 2) ? 1 : 0);
4392 info->stats[STAT_INTELLECT] += (lvl > 5 ? 1 : 0);
4393 info->stats[STAT_SPIRIT] += (lvl > 4 ? 1 : 0);
4394 break;
4395 case CLASS_MAGE:
4396 info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
4397 info->stats[STAT_STAMINA] += (lvl > 5 ? 1 : 0);
4398 info->stats[STAT_AGILITY] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
4399 info->stats[STAT_INTELLECT] += (lvl > 24 ? 2 : (lvl > 1 ? 1 : 0));
4400 info->stats[STAT_SPIRIT] += (lvl > 33 ? 2 : (lvl > 2 ? 1 : 0));
4401 break;
4402 case CLASS_WARLOCK:
4403 info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
4404 info->stats[STAT_STAMINA] += (lvl > 38 ? 2 : (lvl > 3 ? 1 : 0));
4405 info->stats[STAT_AGILITY] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
4406 info->stats[STAT_INTELLECT] += (lvl > 33 ? 2 : (lvl > 2 ? 1 : 0));
4407 info->stats[STAT_SPIRIT] += (lvl > 38 ? 2 : (lvl > 3 ? 1 : 0));
4408 break;
4409 case CLASS_DRUID:
4410 info->stats[STAT_STRENGTH] += (lvl > 38 ? 2 : (lvl > 6 && (lvl % 2) ? 1 : 0));
4411 info->stats[STAT_STAMINA] += (lvl > 32 ? 2 : (lvl > 4 ? 1 : 0));
4412 info->stats[STAT_AGILITY] += (lvl > 38 ? 2 : (lvl > 8 && (lvl % 2) ? 1 : 0));
4413 info->stats[STAT_INTELLECT] += (lvl > 38 ? 3 : (lvl > 4 ? 1 : 0));
4414 info->stats[STAT_SPIRIT] += (lvl > 38 ? 3 : (lvl > 5 ? 1 : 0));
4415 }
4416 }
4417}
@ CONFIG_MAX_PLAYER_LEVEL
Definition: IWorld.h:234
@ CLASS_HUNTER
Definition: SharedDefines.h:115
@ CLASS_DRUID
Definition: SharedDefines.h:123
@ CLASS_SHAMAN
Definition: SharedDefines.h:119
@ CLASS_PRIEST
Definition: SharedDefines.h:117
@ CLASS_WARRIOR
Definition: SharedDefines.h:113
@ CLASS_WARLOCK
Definition: SharedDefines.h:121
@ CLASS_MAGE
Definition: SharedDefines.h:120
@ CLASS_PALADIN
Definition: SharedDefines.h:114
@ CLASS_ROGUE
Definition: SharedDefines.h:116
@ STAT_SPIRIT
Definition: SharedDefines.h:234
@ STAT_INTELLECT
Definition: SharedDefines.h:233
@ STAT_AGILITY
Definition: SharedDefines.h:231
@ STAT_STRENGTH
Definition: SharedDefines.h:230
@ STAT_STAMINA
Definition: SharedDefines.h:232
#define sWorld
Definition: World.h:451

References _playerInfo, CLASS_DRUID, CLASS_HUNTER, CLASS_MAGE, CLASS_PALADIN, CLASS_PRIEST, CLASS_ROGUE, CLASS_SHAMAN, CLASS_WARLOCK, CLASS_WARRIOR, CONFIG_MAX_PLAYER_LEVEL, PlayerInfo::levelInfo, STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STAMINA, STAT_STRENGTH, PlayerLevelInfo::stats, and sWorld.

Referenced by GetPlayerLevelInfo().

◆ ChangeFishingBaseSkillLevel()

void ObjectMgr::ChangeFishingBaseSkillLevel ( uint32  entry,
int32  skill 
)
8663{
8664 AreaTableEntry const* fArea = sAreaTableStore.LookupEntry(entry);
8665 if (!fArea)
8666 {
8667 LOG_ERROR("sql.sql", "AreaId {} defined in `skill_fishing_base_level` does not exist", entry);
8668 return;
8669 }
8670
8671 _fishingBaseForAreaStore[entry] = skill;
8672
8673 LOG_INFO("server.loading", ">> Fishing base skill level of area {} changed to {}", entry, skill);
8674 LOG_INFO("server.loading", " ");
8675}
#define LOG_INFO(filterType__,...)
Definition: Log.h:167
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
FishingBaseSkillContainer _fishingBaseForAreaStore
Definition: ObjectMgr.h:1560
Definition: DBCStructure.h:519

References _fishingBaseForAreaStore, LOG_ERROR, LOG_INFO, and sAreaTableStore.

◆ CheckCreatureMovement()

void ObjectMgr::CheckCreatureMovement ( char const *  table,
uint64  id,
CreatureMovementData creatureMovement 
)
1316{
1317 if (creatureMovement.Ground >= CreatureGroundMovementType::Max)
1318 {
1319 LOG_ERROR("sql.sql", "`{}`.`Ground` wrong value ({}) for Id {}, setting to Run.", table, uint32(creatureMovement.Ground), id);
1320 creatureMovement.Ground = CreatureGroundMovementType::Run;
1321 }
1322
1323 if (creatureMovement.Flight >= CreatureFlightMovementType::Max)
1324 {
1325 LOG_ERROR("sql.sql", "`{}`.`Flight` wrong value ({}) for Id {}, setting to None.", table, uint32(creatureMovement.Flight), id);
1326 creatureMovement.Flight = CreatureFlightMovementType::None;
1327 }
1328
1329 if (creatureMovement.Chase >= CreatureChaseMovementType::Max)
1330 {
1331 LOG_ERROR("sql.sql", "`{}`.`Chase` wrong value ({}) for Id {}, setting to Run.", table, uint32(creatureMovement.Chase), id);
1332 creatureMovement.Chase = CreatureChaseMovementType::Run;
1333 }
1334
1335 if (creatureMovement.Random >= CreatureRandomMovementType::Max)
1336 {
1337 LOG_ERROR("sql.sql", "`{}`.`Random` wrong value ({}) for Id {}, setting to Walk.", table, uint32(creatureMovement.Random), id);
1338 creatureMovement.Random = CreatureRandomMovementType::Walk;
1339 }
1340}
CreatureRandomMovementType Random
Definition: CreatureData.h:133
CreatureFlightMovementType Flight
Definition: CreatureData.h:129
CreatureChaseMovementType Chase
Definition: CreatureData.h:132
CreatureGroundMovementType Ground
Definition: CreatureData.h:128

References CreatureMovementData::Chase, CreatureMovementData::Flight, CreatureMovementData::Ground, LOG_ERROR, and CreatureMovementData::Random.

Referenced by CheckCreatureTemplate(), and LoadCreatureMovementOverrides().

◆ CheckCreatureTemplate()

void ObjectMgr::CheckCreatureTemplate ( CreatureTemplate const *  cInfo)

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

958{
959 if (!cInfo)
960 return;
961
962 bool ok = true; // bool to allow continue outside this loop
963 for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
964 {
965 if (!cInfo->DifficultyEntry[diff])
966 continue;
967 ok = false; // will be set to true at the end of this loop again
968
969 CreatureTemplate const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]);
970 if (!difficultyInfo)
971 {
972 LOG_ERROR("sql.sql", "Creature (Entry: {}) has `difficulty_entry_{}`={} but creature entry {} does not exist.",
973 cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff]);
974 continue;
975 }
976
977 bool ok2 = true;
978 for (uint32 diff2 = 0; diff2 < MAX_DIFFICULTY - 1 && ok2; ++diff2)
979 {
980 ok2 = false;
981 if (_difficultyEntries[diff2].find(cInfo->Entry) != _difficultyEntries[diff2].end())
982 {
983 LOG_ERROR("sql.sql", "Creature (Entry: {}) is listed as `difficulty_entry_{}` of another creature, but itself lists {} in `difficulty_entry_{}`.",
984 cInfo->Entry, diff2 + 1, cInfo->DifficultyEntry[diff], diff + 1);
985 continue;
986 }
987
988 if (_difficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _difficultyEntries[diff2].end())
989 {
990 LOG_ERROR("sql.sql", "Creature (Entry: {}) already listed as `difficulty_entry_{}` for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1);
991 continue;
992 }
993
994 if (_hasDifficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _hasDifficultyEntries[diff2].end())
995 {
996 LOG_ERROR("sql.sql", "Creature (Entry: {}) has `difficulty_entry_{}`={} but creature entry {} has itself a value in `difficulty_entry_{}`.",
997 cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff], diff2 + 1);
998 continue;
999 }
1000 ok2 = true;
1001 }
1002 if (!ok2)
1003 continue;
1004
1005 if (cInfo->expansion > difficultyInfo->expansion)
1006 {
1007 LOG_ERROR("sql.sql", "Creature (Entry: {}, expansion {}) has different `expansion` in difficulty {} mode (Entry: {}, expansion {}).",
1008 cInfo->Entry, cInfo->expansion, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->expansion);
1009 }
1010
1011 if (cInfo->faction != difficultyInfo->faction)
1012 {
1013 LOG_ERROR("sql.sql", "Creature (Entry: {}, faction {}) has different `faction` in difficulty {} mode (Entry: {}, faction {}).",
1014 cInfo->Entry, cInfo->faction, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->faction);
1015 }
1016
1017 if (cInfo->unit_class != difficultyInfo->unit_class)
1018 {
1019 LOG_ERROR("sql.sql", "Creature (Entry: {}, class {}) has different `unit_class` in difficulty {} mode (Entry: {}, class {}).",
1020 cInfo->Entry, cInfo->unit_class, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->unit_class);
1021 continue;
1022 }
1023
1024 if (cInfo->npcflag != difficultyInfo->npcflag)
1025 {
1026 LOG_ERROR("sql.sql", "Creature (Entry: {}) has different `npcflag` in difficulty {} mode (Entry: {}).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1027 continue;
1028 }
1029
1030 if (cInfo->family != difficultyInfo->family)
1031 {
1032 LOG_ERROR("sql.sql", "Creature (Entry: {}, family {}) has different `family` in difficulty {} mode (Entry: {}, family {}).",
1033 cInfo->Entry, cInfo->family, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->family);
1034 }
1035
1036 if (cInfo->trainer_class != difficultyInfo->trainer_class)
1037 {
1038 LOG_ERROR("sql.sql", "Creature (Entry: {}) has different `trainer_class` in difficulty {} mode (Entry: {}).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1039 continue;
1040 }
1041
1042 if (cInfo->trainer_race != difficultyInfo->trainer_race)
1043 {
1044 LOG_ERROR("sql.sql", "Creature (Entry: {}) has different `trainer_race` in difficulty {} mode (Entry: {}).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1045 continue;
1046 }
1047
1048 if (cInfo->trainer_type != difficultyInfo->trainer_type)
1049 {
1050 LOG_ERROR("sql.sql", "Creature (Entry: {}) has different `trainer_type` in difficulty {} mode (Entry: {}).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1051 continue;
1052 }
1053
1054 if (cInfo->trainer_spell != difficultyInfo->trainer_spell)
1055 {
1056 LOG_ERROR("sql.sql", "Creature (Entry: {}) has different `trainer_spell` in difficulty {} mode (Entry: {}).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1057 continue;
1058 }
1059
1060 if (cInfo->type != difficultyInfo->type)
1061 {
1062 LOG_ERROR("sql.sql", "Creature (Entry: {}, type {}) has different `type` in difficulty {} mode (Entry: {}, type {}).",
1063 cInfo->Entry, cInfo->type, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->type);
1064 }
1065
1066 if (!cInfo->VehicleId && difficultyInfo->VehicleId)
1067 {
1068 LOG_ERROR("sql.sql", "Creature (Entry: {}, VehicleId {}) has different `VehicleId` in difficulty {} mode (Entry: {}, VehicleId {}).",
1069 cInfo->Entry, cInfo->VehicleId, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->VehicleId);
1070 }
1071
1072 // Xinef: check dmg school
1073 if (cInfo->dmgschool != difficultyInfo->dmgschool)
1074 {
1075 LOG_ERROR("sql.sql", "Creature (Entry: {}) has different `dmgschool` in difficulty {} mode (Entry: {})", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1076 }
1077
1078 if (!difficultyInfo->AIName.empty())
1079 {
1080 LOG_ERROR("sql.sql", "Creature (Entry: {}) lists difficulty {} mode entry {} with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.",
1081 cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1082 continue;
1083 }
1084
1085 if (difficultyInfo->ScriptID)
1086 {
1087 LOG_ERROR("sql.sql", "Creature (Entry: {}) lists difficulty {} mode entry {} with `ScriptName` filled in. `ScriptName` of difficulty 0 mode creature is always used instead.",
1088 cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1089 continue;
1090 }
1091
1092 _hasDifficultyEntries[diff].insert(cInfo->Entry);
1093 _difficultyEntries[diff].insert(cInfo->DifficultyEntry[diff]);
1094 ok = true;
1095 }
1096
1097 if (!cInfo->AIName.empty() && !sCreatureAIRegistry->HasItem(cInfo->AIName))
1098 {
1099 LOG_ERROR("sql.sql", "Creature (Entry: {}) has non-registered `AIName` '{}' set, removing", cInfo->Entry, cInfo->AIName);
1100 const_cast<CreatureTemplate*>(cInfo)->AIName.clear();
1101 }
1102
1103 FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction);
1104 if (!factionTemplate)
1105 LOG_ERROR("sql.sql", "Creature (Entry: {}) has non-existing faction template ({}).", cInfo->Entry, cInfo->faction);
1106
1107 // used later for scale
1108 CreatureDisplayInfoEntry const* displayScaleEntry = nullptr;
1109
1110 if (cInfo->Modelid1)
1111 {
1112 CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid1);
1113 if (!displayEntry)
1114 {
1115 LOG_ERROR("sql.sql", "Creature (Entry: {}) lists non-existing Modelid1 id ({}), this can crash the client.", cInfo->Entry, cInfo->Modelid1);
1116 const_cast<CreatureTemplate*>(cInfo)->Modelid1 = 0;
1117 }
1118 else if (!displayScaleEntry)
1119 displayScaleEntry = displayEntry;
1120
1121 CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid1);
1122 if (!modelInfo)
1123 LOG_ERROR("sql.sql", "No model data exist for `Modelid1` = {} listed by creature (Entry: {}).", cInfo->Modelid1, cInfo->Entry);
1124 }
1125
1126 if (cInfo->Modelid2)
1127 {
1128 CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid2);
1129 if (!displayEntry)
1130 {
1131 LOG_ERROR("sql.sql", "Creature (Entry: {}) lists non-existing Modelid2 id ({}), this can crash the client.", cInfo->Entry, cInfo->Modelid2);
1132 const_cast<CreatureTemplate*>(cInfo)->Modelid2 = 0;
1133 }
1134 else if (!displayScaleEntry)
1135 displayScaleEntry = displayEntry;
1136
1137 CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid2);
1138 if (!modelInfo)
1139 LOG_ERROR("sql.sql", "No model data exist for `Modelid2` = {} listed by creature (Entry: {}).", cInfo->Modelid2, cInfo->Entry);
1140 }
1141
1142 if (cInfo->Modelid3)
1143 {
1144 CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid3);
1145 if (!displayEntry)
1146 {
1147 LOG_ERROR("sql.sql", "Creature (Entry: {}) lists non-existing Modelid3 id ({}), this can crash the client.", cInfo->Entry, cInfo->Modelid3);
1148 const_cast<CreatureTemplate*>(cInfo)->Modelid3 = 0;
1149 }
1150 else if (!displayScaleEntry)
1151 displayScaleEntry = displayEntry;
1152
1153 CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid3);
1154 if (!modelInfo)
1155 LOG_ERROR("sql.sql", "No model data exist for `Modelid3` = {} listed by creature (Entry: {}).", cInfo->Modelid3, cInfo->Entry);
1156 }
1157
1158 if (cInfo->Modelid4)
1159 {
1160 CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid4);
1161 if (!displayEntry)
1162 {
1163 LOG_ERROR("sql.sql", "Creature (Entry: {}) lists non-existing Modelid4 id ({}), this can crash the client.", cInfo->Entry, cInfo->Modelid4);
1164 const_cast<CreatureTemplate*>(cInfo)->Modelid4 = 0;
1165 }
1166 else if (!displayScaleEntry)
1167 displayScaleEntry = displayEntry;
1168
1169 CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid4);
1170 if (!modelInfo)
1171 LOG_ERROR("sql.sql", "No model data exist for `Modelid4` = {} listed by creature (Entry: {}).", cInfo->Modelid4, cInfo->Entry);
1172 }
1173
1174 if (!displayScaleEntry)
1175 LOG_ERROR("sql.sql", "Creature (Entry: {}) does not have any existing display id in Modelid1/Modelid2/Modelid3/Modelid4.", cInfo->Entry);
1176
1177 for (int k = 0; k < MAX_KILL_CREDIT; ++k)
1178 {
1179 if (cInfo->KillCredit[k])
1180 {
1181 if (!GetCreatureTemplate(cInfo->KillCredit[k]))
1182 {
1183 LOG_ERROR("sql.sql", "Creature (Entry: {}) lists non-existing creature entry {} in `KillCredit{}`.", cInfo->Entry, cInfo->KillCredit[k], k + 1);
1184 const_cast<CreatureTemplate*>(cInfo)->KillCredit[k] = 0;
1185 }
1186 }
1187 }
1188
1189 if (!cInfo->unit_class || ((1 << (cInfo->unit_class - 1)) & CLASSMASK_ALL_CREATURES) == 0)
1190 {
1191 LOG_ERROR("sql.sql", "Creature (Entry: {}) has invalid unit_class ({}) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class);
1192 const_cast<CreatureTemplate*>(cInfo)->unit_class = UNIT_CLASS_WARRIOR;
1193 }
1194
1195 if (cInfo->dmgschool >= MAX_SPELL_SCHOOL)
1196 {
1197 LOG_ERROR("sql.sql", "Creature (Entry: {}) has invalid spell school value ({}) in `dmgschool`.", cInfo->Entry, cInfo->dmgschool);
1198 const_cast<CreatureTemplate*>(cInfo)->dmgschool = SPELL_SCHOOL_NORMAL;
1199 }
1200
1201 if (cInfo->BaseAttackTime == 0)
1202 const_cast<CreatureTemplate*>(cInfo)->BaseAttackTime = BASE_ATTACK_TIME;
1203
1204 if (cInfo->RangeAttackTime == 0)
1205 const_cast<CreatureTemplate*>(cInfo)->RangeAttackTime = BASE_ATTACK_TIME;
1206
1207 if ((cInfo->npcflag & UNIT_NPC_FLAG_TRAINER) && cInfo->trainer_type >= MAX_TRAINER_TYPE)
1208 LOG_ERROR("sql.sql", "Creature (Entry: {}) has wrong trainer type {}.", cInfo->Entry, cInfo->trainer_type);
1209
1210 if (cInfo->speed_walk == 0.0f)
1211 {
1212 LOG_ERROR("sql.sql", "Creature (Entry: {}) has wrong value ({}) in speed_walk, set to 1.", cInfo->Entry, cInfo->speed_walk);
1213 const_cast<CreatureTemplate*>(cInfo)->speed_walk = 1.0f;
1214 }
1215
1216 if (cInfo->speed_run == 0.0f)
1217 {
1218 LOG_ERROR("sql.sql", "Creature (Entry: {}) has wrong value ({}) in speed_run, set to 1.14286.", cInfo->Entry, cInfo->speed_run);
1219 const_cast<CreatureTemplate*>(cInfo)->speed_run = 1.14286f;
1220 }
1221
1222 if (cInfo->type && !sCreatureTypeStore.LookupEntry(cInfo->type))
1223 {
1224 LOG_ERROR("sql.sql", "Creature (Entry: {}) has invalid creature type ({}) in `type`.", cInfo->Entry, cInfo->type);
1225 const_cast<CreatureTemplate*>(cInfo)->type = CREATURE_TYPE_HUMANOID;
1226 }
1227
1228 // must exist or used hidden but used in data horse case
1229 if (cInfo->family && !sCreatureFamilyStore.LookupEntry(cInfo->family) && cInfo->family != CREATURE_FAMILY_HORSE_CUSTOM)
1230 {
1231 LOG_ERROR("sql.sql", "Creature (Entry: {}) has invalid creature family ({}) in `family`.", cInfo->Entry, cInfo->family);
1232 const_cast<CreatureTemplate*>(cInfo)->family = 0;
1233 }
1234
1235 CheckCreatureMovement("creature_template_movement", cInfo->Entry, const_cast<CreatureTemplate*>(cInfo)->Movement);
1236
1237 if (cInfo->HoverHeight < 0.0f)
1238 {
1239 LOG_ERROR("sql.sql", "Creature (Entry: {}) has wrong value ({}) in `HoverHeight`", cInfo->Entry, cInfo->HoverHeight);
1240 const_cast<CreatureTemplate*>(cInfo)->HoverHeight = 1.0f;
1241 }
1242
1243 if (cInfo->VehicleId)
1244 {
1245 VehicleEntry const* vehId = sVehicleStore.LookupEntry(cInfo->VehicleId);
1246 if (!vehId)
1247 {
1248 LOG_ERROR("sql.sql", "Creature (Entry: {}) has a non-existing VehicleId ({}). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId);
1249 const_cast<CreatureTemplate*>(cInfo)->VehicleId = 0;
1250 }
1251 }
1252
1253 if (cInfo->PetSpellDataId)
1254 {
1255 CreatureSpellDataEntry const* spellDataId = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId);
1256 if (!spellDataId)
1257 LOG_ERROR("sql.sql", "Creature (Entry: {}) has non-existing PetSpellDataId ({}).", cInfo->Entry, cInfo->PetSpellDataId);
1258 }
1259
1260 for (uint8 j = 0; j < MAX_CREATURE_SPELLS; ++j)
1261 {
1262 if (cInfo->spells[j] && !sSpellMgr->GetSpellInfo(cInfo->spells[j]))
1263 {
1264 LOG_ERROR("sql.sql", "Creature (Entry: {}) has non-existing Spell{} ({}), set to 0.", cInfo->Entry, j + 1, cInfo->spells[j]);
1265 const_cast<CreatureTemplate*>(cInfo)->spells[j] = 0;
1266 }
1267 }
1268
1269 if (cInfo->MovementType >= MAX_DB_MOTION_TYPE)
1270 {
1271 LOG_ERROR("sql.sql", "Creature (Entry: {}) has wrong movement generator type ({}), ignored and set to IDLE.", cInfo->Entry, cInfo->MovementType);
1272 const_cast<CreatureTemplate*>(cInfo)->MovementType = IDLE_MOTION_TYPE;
1273 }
1274
1276 if (cInfo->scale <= 0.0f)
1277 {
1278 if (displayScaleEntry)
1279 const_cast<CreatureTemplate*>(cInfo)->scale = displayScaleEntry->scale;
1280 else
1281 const_cast<CreatureTemplate*>(cInfo)->scale = 1.0f;
1282 }
1283
1284 if (cInfo->expansion > (MAX_EXPANSIONS - 1))
1285 {
1286 LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: {}) with expansion {}. Ignored and set to 0.", cInfo->Entry, cInfo->expansion);
1287 const_cast<CreatureTemplate*>(cInfo)->expansion = 0;
1288 }
1289
1290 if (uint32 badFlags = (cInfo->flags_extra & ~CREATURE_FLAG_EXTRA_DB_ALLOWED))
1291 {
1292 LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: {}) with disallowed `flags_extra` {}, removing incorrect flag.", cInfo->Entry, badFlags);
1293 const_cast<CreatureTemplate*>(cInfo)->flags_extra &= CREATURE_FLAG_EXTRA_DB_ALLOWED;
1294 }
1295
1296 const_cast<CreatureTemplate*>(cInfo)->DamageModifier *= Creature::_GetDamageMod(cInfo->rank);
1297
1298 // Hack for modules
1299 for (auto itr : _creatureCustomIDsStore)
1300 {
1301 if (cInfo->Entry == itr)
1302 return;
1303 }
1304
1305 if ((cInfo->GossipMenuId && !(cInfo->npcflag & UNIT_NPC_FLAG_GOSSIP)) && !(cInfo->flags_extra & CREATURE_FLAG_EXTRA_MODULE))
1306 {
1307 LOG_ERROR("sql.sql", "Creature (Entry: {}) has assigned gossip menu {}, but npcflag does not include UNIT_NPC_FLAG_GOSSIP (1).", cInfo->Entry, cInfo->GossipMenuId);
1308 }
1309 else if ((!cInfo->GossipMenuId && (cInfo->npcflag & UNIT_NPC_FLAG_GOSSIP)) && !(cInfo->flags_extra & CREATURE_FLAG_EXTRA_MODULE))
1310 {
1311 LOG_INFO("sql.sql", "Creature (Entry: {}) has npcflag UNIT_NPC_FLAG_GOSSIP (1), but gossip menu is unassigned.", cInfo->Entry);
1312 }
1313}
#define sCreatureAIRegistry
Definition: CreatureAIFactory.h:48
DBCStorage< VehicleEntry > sVehicleStore(VehicleEntryfmt)
DBCStorage< CreatureSpellDataEntry > sCreatureSpellDataStore(CreatureSpellDatafmt)
DBCStorage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore(CreatureDisplayInfofmt)
DBCStorage< CreatureFamilyEntry > sCreatureFamilyStore(CreatureFamilyfmt)
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
DBCStorage< CreatureTypeEntry > sCreatureTypeStore(CreatureTypefmt)
@ CREATURE_FLAG_EXTRA_DB_ALLOWED
Definition: CreatureData.h:85
@ CREATURE_FLAG_EXTRA_MODULE
Definition: CreatureData.h:73
#define MAX_KILL_CREDIT
Definition: CreatureData.h:34
#define BASE_ATTACK_TIME
Definition: Unit.h:40
@ UNIT_NPC_FLAG_GOSSIP
Definition: Unit.h:516
static constexpr uint32 MAX_CREATURE_SPELLS
Definition: Unit.h:153
@ MAX_DB_MOTION_TYPE
Definition: MotionMaster.h:40
@ IDLE_MOTION_TYPE
Definition: MotionMaster.h:37
spells
Definition: boss_krystallus.cpp:25
#define MAX_DIFFICULTY
Definition: DBCEnums.h:288
@ SPELL_SCHOOL_NORMAL
Definition: SharedDefines.h:255
constexpr auto MAX_SPELL_SCHOOL
Definition: SharedDefines.h:264
@ CREATURE_FAMILY_HORSE_CUSTOM
Definition: SharedDefines.h:2631
@ UNIT_CLASS_WARRIOR
Definition: SharedDefines.h:138
@ CREATURE_TYPE_HUMANOID
Definition: SharedDefines.h:2606
#define CLASSMASK_ALL_CREATURES
Definition: SharedDefines.h:144
@ MAX_EXPANSIONS
Definition: SharedDefines.h:55
#define MAX_TRAINER_TYPE
Definition: SharedDefines.h:2595
static float _GetDamageMod(int32 Rank)
Definition: Creature.cpp:1561
float scale
Definition: CreatureData.h:198
uint32 trainer_spell
Definition: CreatureData.h:212
uint32 trainer_class
Definition: CreatureData.h:213
uint32 type
Definition: CreatureData.h:215
uint32 trainer_race
Definition: CreatureData.h:214
uint32 ScriptID
Definition: CreatureData.h:240
uint32 VehicleId
Definition: CreatureData.h:223
CreatureMovementData Movement
Definition: CreatureData.h:228
uint32 faction
Definition: CreatureData.h:191
uint32 dmgschool
Definition: CreatureData.h:200
uint32 expansion
Definition: CreatureData.h:190
uint32 trainer_type
Definition: CreatureData.h:211
std::string AIName
Definition: CreatureData.h:226
uint32 family
Definition: CreatureData.h:210
Definition: CreatureData.h:388
std::set< uint32 > _difficultyEntries[MAX_DIFFICULTY - 1]
Definition: ObjectMgr.h:1616
CreatureCustomIDsContainer _creatureCustomIDsStore
Definition: ObjectMgr.h:1577
std::set< uint32 > _hasDifficultyEntries[MAX_DIFFICULTY - 1]
Definition: ObjectMgr.h:1617
void CheckCreatureMovement(char const *table, uint64 id, CreatureMovementData &creatureMovement)
Definition: ObjectMgr.cpp:1315
CreatureModelInfo const * GetCreatureModelInfo(uint32 modelId) const
Definition: ObjectMgr.cpp:1708
Definition: DBCStructure.h:721
float scale
Definition: DBCStructure.h:726
Definition: DBCStructure.h:801
Definition: DBCStructure.h:930
Definition: DBCStructure.h:2003

References _creatureCustomIDsStore, _difficultyEntries, Creature::_GetDamageMod(), _hasDifficultyEntries, CreatureTemplate::AIName, BASE_ATTACK_TIME, CreatureTemplate::BaseAttackTime, CheckCreatureMovement(), CLASSMASK_ALL_CREATURES, CREATURE_FAMILY_HORSE_CUSTOM, CREATURE_FLAG_EXTRA_DB_ALLOWED, CREATURE_FLAG_EXTRA_MODULE, CREATURE_TYPE_HUMANOID, CreatureTemplate::DifficultyEntry, CreatureTemplate::dmgschool, CreatureTemplate::Entry, CreatureTemplate::expansion, CreatureTemplate::faction, CreatureTemplate::family, CreatureTemplate::flags_extra, GetCreatureModelInfo(), GetCreatureTemplate(), CreatureTemplate::GossipMenuId, CreatureTemplate::HoverHeight, IDLE_MOTION_TYPE, CreatureTemplate::KillCredit, LOG_ERROR, LOG_INFO, MAX_CREATURE_SPELLS, MAX_DB_MOTION_TYPE, MAX_DIFFICULTY, MAX_EXPANSIONS, MAX_KILL_CREDIT, MAX_SPELL_SCHOOL, MAX_TRAINER_TYPE, CreatureTemplate::Modelid1, CreatureTemplate::Modelid2, CreatureTemplate::Modelid3, CreatureTemplate::Modelid4, CreatureTemplate::Movement, CreatureTemplate::MovementType, CreatureTemplate::npcflag, CreatureTemplate::PetSpellDataId, CreatureTemplate::RangeAttackTime, CreatureTemplate::rank, CreatureTemplate::scale, CreatureDisplayInfoEntry::scale, sCreatureAIRegistry, sCreatureDisplayInfoStore, sCreatureFamilyStore, sCreatureSpellDataStore, sCreatureTypeStore, CreatureTemplate::ScriptID, sFactionTemplateStore, CreatureTemplate::speed_run, CreatureTemplate::speed_walk, SPELL_SCHOOL_NORMAL, CreatureTemplate::spells, sSpellMgr, sVehicleStore, CreatureTemplate::trainer_class, CreatureTemplate::trainer_race, CreatureTemplate::trainer_spell, CreatureTemplate::trainer_type, CreatureTemplate::type, CreatureTemplate::unit_class, UNIT_CLASS_WARRIOR, UNIT_NPC_FLAG_GOSSIP, UNIT_NPC_FLAG_TRAINER, and CreatureTemplate::VehicleId.

Referenced by LoadCreatureTemplates().

◆ CheckDeclinedNames()

bool ObjectMgr::CheckDeclinedNames ( std::wstring  w_ownname,
DeclinedName const &  names 
)
static
8678{
8679 // get main part of the name
8680 std::wstring mainpart = GetMainPartOfName(w_ownname, 0);
8681 // prepare flags
8682 bool x = true;
8683 bool y = true;
8684
8685 // check declined names
8686 for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
8687 {
8688 std::wstring wname;
8689 if (!Utf8toWStr(names.name[i], wname))
8690 return false;
8691
8692 if (mainpart != GetMainPartOfName(wname, i + 1))
8693 x = false;
8694
8695 if (w_ownname != wname)
8696 y = false;
8697 }
8698 return (x || y);
8699}
std::wstring GetMainPartOfName(std::wstring const &wname, uint32 declension)
Definition: Util.cpp:387
#define MAX_DECLINED_NAME_CASES
Definition: Unit.h:969

References GetMainPartOfName(), MAX_DECLINED_NAME_CASES, DeclinedName::name, and Utf8toWStr().

Referenced by WorldSession::HandlePetRename(), and WorldSession::HandleSetPlayerDeclinedNames().

◆ CheckPetName()

PetNameInvalidReason ObjectMgr::CheckPetName ( std::string_view  name)
static
8466{
8467 std::wstring wname;
8468 if (!Utf8toWStr(name, wname))
8469 return PET_NAME_INVALID;
8470
8471 if (wname.size() > MAX_PET_NAME)
8472 return PET_NAME_TOO_LONG;
8473
8474 uint32 minName = sWorld->getIntConfig(CONFIG_MIN_PET_NAME);
8475 if (wname.size() < minName)
8476 return PET_NAME_TOO_SHORT;
8477
8478 uint32 strictMask = sWorld->getIntConfig(CONFIG_STRICT_PET_NAMES);
8479 if (!isValidString(wname, strictMask, false))
8481
8482 // Check for Reserved Name from DBC
8483 if (sWorld->getBoolConfig(CONFIG_STRICT_NAMES_RESERVED))
8484 {
8485 if (ReservedNames(wname))
8486 {
8487 return PET_NAME_RESERVED;
8488 }
8489 }
8490
8491 // Check for Profanity
8492 if (sWorld->getBoolConfig(CONFIG_STRICT_NAMES_PROFANITY))
8493 {
8494 if (ProfanityNames(wname))
8495 {
8496 return PET_NAME_PROFANE;
8497 }
8498 }
8499
8500 return PET_NAME_SUCCESS;
8501}
bool isValidString(std::wstring wstr, uint32 strictMask, bool numericOrSpace, bool create=false)
Definition: ObjectMgr.cpp:8319
bool ReservedNames(std::wstring &name)
Definition: ObjectMgr.cpp:215
bool ProfanityNames(std::wstring &name)
Definition: ObjectMgr.cpp:243
#define MAX_PET_NAME
Definition: ObjectMgr.h:690
@ CONFIG_STRICT_PET_NAMES
Definition: IWorld.h:221
@ CONFIG_MIN_PET_NAME
Definition: IWorld.h:224
@ CONFIG_STRICT_NAMES_PROFANITY
Definition: IWorld.h:183
@ CONFIG_STRICT_NAMES_RESERVED
Definition: IWorld.h:182
@ PET_NAME_INVALID
Definition: SharedDefines.h:3632
@ PET_NAME_RESERVED
Definition: SharedDefines.h:3638
@ PET_NAME_SUCCESS
Definition: SharedDefines.h:3630
@ PET_NAME_MIXED_LANGUAGES
Definition: SharedDefines.h:3636
@ PET_NAME_TOO_SHORT
Definition: SharedDefines.h:3634
@ PET_NAME_TOO_LONG
Definition: SharedDefines.h:3635
@ PET_NAME_PROFANE
Definition: SharedDefines.h:3637

References CONFIG_MIN_PET_NAME, CONFIG_STRICT_NAMES_PROFANITY, CONFIG_STRICT_NAMES_RESERVED, CONFIG_STRICT_PET_NAMES, isValidString(), MAX_PET_NAME, PET_NAME_INVALID, PET_NAME_MIXED_LANGUAGES, PET_NAME_PROFANE, PET_NAME_RESERVED, PET_NAME_SUCCESS, PET_NAME_TOO_LONG, PET_NAME_TOO_SHORT, ProfanityNames(), ReservedNames(), sWorld, and Utf8toWStr().

Referenced by WorldSession::HandlePetRename().

◆ CheckPlayerName()

uint8 ObjectMgr::CheckPlayerName ( std::string_view  name,
bool  create = false 
)
static
8356{
8357 std::wstring wname;
8358
8359 // Check for invalid characters
8360 if (!Utf8toWStr(name, wname))
8362
8363 // Check for too long name
8364 if (wname.size() > MAX_PLAYER_NAME)
8365 return CHAR_NAME_TOO_LONG;
8366
8367 // Check for too short name
8368 uint32 minName = sWorld->getIntConfig(CONFIG_MIN_PLAYER_NAME);
8369 if (wname.size() < minName)
8370 return CHAR_NAME_TOO_SHORT;
8371
8372 // Check for mixed languages
8373 uint32 strictMask = sWorld->getIntConfig(CONFIG_STRICT_PLAYER_NAMES);
8374 if (!isValidString(wname, strictMask, false, create))
8376
8377 // Check for three consecutive letters
8378 wstrToLower(wname);
8379 for (size_t i = 2; i < wname.size(); ++i)
8380 if (wname[i] == wname[i - 1] && wname[i] == wname[i - 2])
8382
8383 // Check Reserved Name from Database
8384 if (sObjectMgr->IsReservedName(name))
8385 {
8386 return CHAR_NAME_RESERVED;
8387 }
8388
8389 if (sObjectMgr->IsProfanityName(name))
8390 {
8391 return CHAR_NAME_PROFANE;
8392 }
8393
8394 // Check for Reserved Name from DBC
8395 if (sWorld->getBoolConfig(CONFIG_STRICT_NAMES_RESERVED))
8396 {
8397 if (ReservedNames(wname))
8398 {
8399 return CHAR_NAME_RESERVED;
8400 }
8401 }
8402
8403 // Check for Profanity
8404 if (sWorld->getBoolConfig(CONFIG_STRICT_NAMES_PROFANITY))
8405 {
8406 if (ProfanityNames(wname))
8407 {
8408 return CHAR_NAME_PROFANE;
8409 }
8410 }
8411
8412 return CHAR_NAME_SUCCESS;
8413}
#define MAX_PLAYER_NAME
Definition: ObjectMgr.h:688
@ CONFIG_STRICT_PLAYER_NAMES
Definition: IWorld.h:218
@ CONFIG_MIN_PLAYER_NAME
Definition: IWorld.h:222
@ CHAR_NAME_TOO_SHORT
Definition: SharedDefines.h:3394
@ CHAR_NAME_THREE_CONSECUTIVE
Definition: SharedDefines.h:3402
@ CHAR_NAME_INVALID_CHARACTER
Definition: SharedDefines.h:3396
@ CHAR_NAME_TOO_LONG
Definition: SharedDefines.h:3395
@ CHAR_NAME_RESERVED
Definition: SharedDefines.h:3399
@ CHAR_NAME_MIXED_LANGUAGES
Definition: SharedDefines.h:3397
@ CHAR_NAME_PROFANE
Definition: SharedDefines.h:3398
@ CHAR_NAME_SUCCESS
Definition: SharedDefines.h:3391

References CHAR_NAME_INVALID_CHARACTER, CHAR_NAME_MIXED_LANGUAGES, CHAR_NAME_PROFANE, CHAR_NAME_RESERVED, CHAR_NAME_SUCCESS, CHAR_NAME_THREE_CONSECUTIVE, CHAR_NAME_TOO_LONG, CHAR_NAME_TOO_SHORT, CONFIG_MIN_PLAYER_NAME, CONFIG_STRICT_NAMES_PROFANITY, CONFIG_STRICT_NAMES_RESERVED, CONFIG_STRICT_PLAYER_NAMES, isValidString(), MAX_PLAYER_NAME, ProfanityNames(), ReservedNames(), sObjectMgr, sWorld, Utf8toWStr(), and wstrToLower().

Referenced by character_commandscript::HandleCharacterRenameCommand(), WorldSession::HandleCharCreateOpcode(), WorldSession::HandleCharCustomizeCallback(), WorldSession::HandleCharFactionOrRaceChangeCallback(), WorldSession::HandleCharRenameOpcode(), PlayerDumpReader::LoadDump(), Player::LoadFromDB(), and character_commandscript::ValidatePDumpTarget().

◆ ChooseCreatureFlags()

void ObjectMgr::ChooseCreatureFlags ( CreatureTemplate const *  cinfo,
uint32 npcflag,
uint32 unit_flags,
uint32 dynamicflags,
CreatureData const *  data = nullptr 
)
static
1727{
1728 npcflag = cinfo->npcflag;
1729 unit_flags = cinfo->unit_flags;
1730 dynamicflags = cinfo->dynamicflags;
1731
1732 if (data)
1733 {
1734 if (data->npcflag)
1735 npcflag = data->npcflag;
1736
1737 if (data->unit_flags)
1738 unit_flags = data->unit_flags;
1739
1740 if (data->dynamicflags)
1741 dynamicflags = data->dynamicflags;
1742 }
1743}

References CreatureTemplate::dynamicflags, CreatureData::dynamicflags, CreatureTemplate::npcflag, CreatureData::npcflag, CreatureTemplate::unit_flags, and CreatureData::unit_flags.

Referenced by Creature::UpdateEntry().

◆ ChooseDisplayId()

uint32 ObjectMgr::ChooseDisplayId ( CreatureTemplate const *  cinfo,
CreatureData const *  data = nullptr 
)
static
1718{
1719 // Load creature model (display id)
1720 if (data && data->displayid)
1721 return data->displayid;
1722
1723 return cinfo->GetRandomValidModelId();
1724}

References CreatureData::displayid, and CreatureTemplate::GetRandomValidModelId().

Referenced by AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraMounted(), AuraEffect::HandleAuraTransform(), Creature::InitEntry(), and SmartScript::ProcessAction().

◆ DeleteCreatureData()

void ObjectMgr::DeleteCreatureData ( ObjectGuid::LowType  spawnId)
8012{
8013 // remove mapid*cellid -> guid_set map
8014 CreatureData const* data = GetCreatureData(guid);
8015 if (data)
8016 RemoveCreatureFromGrid(guid, data);
8017
8018 _creatureDataStore.erase(guid);
8019}
CreatureDataContainer _creatureDataStore
Definition: ObjectMgr.h:1575
void RemoveCreatureFromGrid(ObjectGuid::LowType guid, CreatureData const *data)
Definition: ObjectMgr.cpp:2352
CreatureData const * GetCreatureData(ObjectGuid::LowType spawnId) const
Definition: ObjectMgr.h:1200

References _creatureDataStore, GetCreatureData(), and RemoveCreatureFromGrid().

◆ DeleteGameTele()

bool ObjectMgr::DeleteGameTele ( std::string_view  name)
8877{
8878 // explicit name case
8879 std::wstring wname;
8880 if (!Utf8toWStr(name, wname))
8881 return false;
8882
8883 // converting string that we try to find to lower case
8884 wstrToLower(wname);
8885
8886 for (GameTeleContainer::iterator itr = _gameTeleStore.begin(); itr != _gameTeleStore.end(); ++itr)
8887 {
8888 if (itr->second.wnameLow == wname)
8889 {
8891
8892 stmt->SetData(0, itr->second.name);
8893
8894 WorldDatabase.Execute(stmt);
8895
8896 _gameTeleStore.erase(itr);
8897 return true;
8898 }
8899 }
8900
8901 return false;
8902}
@ WORLD_DEL_GAME_TELE
Definition: WorldDatabase.h:42

References _gameTeleStore, PreparedStatementBase::SetData(), Utf8toWStr(), WORLD_DEL_GAME_TELE, WorldDatabase, and wstrToLower().

◆ DeleteGOData()

void ObjectMgr::DeleteGOData ( ObjectGuid::LowType  guid)
8022{
8023 // remove mapid*cellid -> guid_set map
8024 GameObjectData const* data = GetGameObjectData(guid);
8025 if (data)
8026 RemoveGameobjectFromGrid(guid, data);
8027
8028 _gameObjectDataStore.erase(guid);
8029}
GameObjectData const * GetGameObjectData(ObjectGuid::LowType spawnId) const
Definition: ObjectMgr.h:1217
GameObjectDataContainer _gameObjectDataStore
Definition: ObjectMgr.h:1589
void RemoveGameobjectFromGrid(ObjectGuid::LowType guid, GameObjectData const *data)
Definition: ObjectMgr.cpp:2658

References _gameObjectDataStore, GetGameObjectData(), and RemoveGameobjectFromGrid().

◆ FindInstanceSavedGameobjectState()

bool ObjectMgr::FindInstanceSavedGameobjectState ( uint32  id,
uint32  guid 
)
10142{
10143 for (auto it = GameobjectInstanceSavedStateList.begin(); it != GameobjectInstanceSavedStateList.end(); it++)
10144 {
10145 if (it->m_guid == guid && it->m_instance == id)
10146 {
10147 return true;
10148 }
10149 }
10150 return false;
10151}
std::vector< GameobjectInstanceSavedState > GameobjectInstanceSavedStateList
Definition: ObjectMgr.h:1637

References GameobjectInstanceSavedStateList.

◆ GenerateAuctionID()

uint32 ObjectMgr::GenerateAuctionID ( )
7010{
7011 if (_auctionId >= 0xFFFFFFFE)
7012 {
7013 LOG_ERROR("server.worldserver", "Auctions ids overflow!! Can't continue, shutting down server. ");
7015 }
7016 return _auctionId++;
7017}
@ ERROR_EXIT_CODE
Definition: World.h:55
static void StopNow(uint8 exitcode)
Definition: World.h:261

References _auctionId, ERROR_EXIT_CODE, LOG_ERROR, and World::StopNow().

◆ GenerateCreatureSpawnId()

uint32 ObjectMgr::GenerateCreatureSpawnId ( )
7041{
7042 if (_creatureSpawnId >= uint32(0xFFFFFF))
7043 {
7044 LOG_ERROR("server.worldserver", "Creature spawn id overflow!! Can't continue, shutting down server. Search on forum for TCE00007 for more info.");
7046 }
7047 return _creatureSpawnId++;
7048}

References _creatureSpawnId, ERROR_EXIT_CODE, LOG_ERROR, and World::StopNow().

Referenced by AddCreData().

◆ GenerateEquipmentSetGuid()

uint64 ObjectMgr::GenerateEquipmentSetGuid ( )
7020{
7021 if (_equipmentSetGuid >= uint64(0xFFFFFFFFFFFFFFFELL))
7022 {
7023 LOG_ERROR("server.worldserver", "EquipmentSet guid overflow!! Can't continue, shutting down server. ");
7025 }
7026 return _equipmentSetGuid++;
7027}
std::uint64_t uint64
Definition: Define.h:107

References _equipmentSetGuid, ERROR_EXIT_CODE, LOG_ERROR, and World::StopNow().

◆ GenerateGameObjectSpawnId()

uint32 ObjectMgr::GenerateGameObjectSpawnId ( )
7051{
7052 if (_gameObjectSpawnId >= uint32(0xFFFFFF))
7053 {
7054 LOG_ERROR("server.worldserver", "GameObject spawn id overflow!! Can't continue, shutting down server. Search on forum for TCE00007 for more info. ");
7056 }
7057 return _gameObjectSpawnId++;
7058}

References _gameObjectSpawnId, ERROR_EXIT_CODE, LOG_ERROR, and World::StopNow().

Referenced by AddGOData().

◆ GenerateMailID()

uint32 ObjectMgr::GenerateMailID ( )
7030{
7031 if (_mailId >= 0xFFFFFFFE)
7032 {
7033 LOG_ERROR("server.worldserver", "Mail ids overflow!! Can't continue, shutting down server. ");
7035 }
7036 std::lock_guard<std::mutex> guard(_mailIdMutex);
7037 return _mailId++;
7038}
std::mutex _mailIdMutex
Definition: ObjectMgr.h:1458

References _mailId, _mailIdMutex, ERROR_EXIT_CODE, LOG_ERROR, and World::StopNow().

◆ GeneratePetName()

std::string ObjectMgr::GeneratePetName ( uint32  entry)
7517{
7518 std::vector<std::string>& list0 = _petHalfName0[entry];
7519 std::vector<std::string>& list1 = _petHalfName1[entry];
7520
7521 if (list0.empty() || list1.empty())
7522 {
7523 CreatureTemplate const* cinfo = GetCreatureTemplate(entry);
7524 char const* petname = GetPetName(cinfo->family, sWorld->GetDefaultDbcLocale());
7525 if (!petname)
7526 return cinfo->Name;
7527
7528 return std::string(petname);
7529 }
7530
7531 return *(list0.begin() + urand(0, list0.size() - 1)) + *(list1.begin() + urand(0, list1.size() - 1));
7532}
char const * GetPetName(uint32 petfamily, uint32 dbclang)
Definition: DBCStores.cpp:658
std::string Name
Definition: CreatureData.h:184
HalfNameContainer _petHalfName1
Definition: ObjectMgr.h:1564
HalfNameContainer _petHalfName0
Definition: ObjectMgr.h:1563

References _petHalfName0, _petHalfName1, CreatureTemplate::family, GetCreatureTemplate(), GetPetName(), CreatureTemplate::Name, sWorld, and urand().

Referenced by GeneratePetNameLocale().

◆ GeneratePetNameLocale()

std::string ObjectMgr::GeneratePetNameLocale ( uint32  entry,
LocaleConstant  locale 
)
7504{
7505 std::vector<std::string>& list0 = _petHalfLocaleName0[std::make_pair(entry, locale)];
7506 std::vector<std::string>& list1 = _petHalfLocaleName1[std::make_pair(entry, locale)];
7507
7508 if (list0.empty() || list1.empty())
7509 {
7510 return GeneratePetName(entry);
7511 }
7512
7513 return *(list0.begin() + urand(0, list0.size() - 1)) + *(list1.begin() + urand(0, list1.size() - 1));
7514}
HalfNameContainerLocale _petHalfLocaleName0
Definition: ObjectMgr.h:1566
HalfNameContainerLocale _petHalfLocaleName1
Definition: ObjectMgr.h:1567
std::string GeneratePetName(uint32 entry)
Definition: ObjectMgr.cpp:7516

References _petHalfLocaleName0, _petHalfLocaleName1, GeneratePetName(), and urand().

◆ GeneratePetNumber()

uint32 ObjectMgr::GeneratePetNumber ( )
7535{
7536 std::lock_guard<std::mutex> guard(_hiPetNumberMutex);
7537 return ++_hiPetNumber;
7538}
std::mutex _hiPetNumberMutex
Definition: ObjectMgr.h:1460

References _hiPetNumber, and _hiPetNumberMutex.

◆ GetAccessRequirement()

DungeonProgressionRequirements const * ObjectMgr::GetAccessRequirement ( uint32  mapid,
Difficulty  difficulty 
) const
inline
877 {
878 DungeonProgressionRequirementsContainer::const_iterator itr = _accessRequirementStore.find(mapid);
879 if (itr != _accessRequirementStore.end())
880 {
881 std::unordered_map<uint8, DungeonProgressionRequirements*> difficultiesProgressionRequirements = itr->second;
882 auto difficultiesItr = difficultiesProgressionRequirements.find(difficulty);
883 if (difficultiesItr != difficultiesProgressionRequirements.end())
884 {
885 return difficultiesItr->second;
886 }
887 }
888 return nullptr;
889 }

References _accessRequirementStore.

◆ GetAcoreString() [1/2]

AcoreString const * ObjectMgr::GetAcoreString ( uint32  entry) const
inline
1315 {
1316 AcoreStringContainer::const_iterator itr = _acoreStringStore.find(entry);
1317 if (itr == _acoreStringStore.end())
1318 return nullptr;
1319
1320 return &itr->second;
1321 }
AcoreStringContainer _acoreStringStore
Definition: ObjectMgr.h:1606

References _acoreStringStore.

Referenced by GetAcoreString(), and GetAcoreStringForDBCLocale().

◆ GetAcoreString() [2/2]

char const * ObjectMgr::GetAcoreString ( uint32  entry,
LocaleConstant  locale 
) const
8610{
8611 if (AcoreString const* ts = GetAcoreString(entry))
8612 {
8613 if (ts->Content.size() > size_t(locale) && !ts->Content[locale].empty())
8614 return ts->Content[locale].c_str();
8615
8616 return ts->Content[DEFAULT_LOCALE].c_str();
8617 }
8618
8619 LOG_ERROR("sql.sql", "Acore string entry {} not found in DB.", entry);
8620
8621 return "<error>";
8622}
#define DEFAULT_LOCALE
Definition: Common.h:88
Definition: ObjectMgr.h:497
AcoreString const * GetAcoreString(uint32 entry) const
Definition: ObjectMgr.h:1314

References AcoreString::Content, DEFAULT_LOCALE, GetAcoreString(), and LOG_ERROR.

◆ GetAcoreStringForDBCLocale()

char const * ObjectMgr::GetAcoreStringForDBCLocale ( uint32  entry) const
inline
1323{ return GetAcoreString(entry, DBCLocaleIndex); }

References DBCLocaleIndex, and GetAcoreString().

◆ GetAllCreatureData()

CreatureDataContainer const & ObjectMgr::GetAllCreatureData ( ) const
inline
1199{ return _creatureDataStore; }

References _creatureDataStore.

◆ GetAllGOData()

GameObjectDataContainer const & ObjectMgr::GetAllGOData ( ) const
inline
1216{ return _gameObjectDataStore; }

References _gameObjectDataStore.

◆ GetAllServerMailStore()

ServerMailContainer const & ObjectMgr::GetAllServerMailStore ( ) const
inline
1190{ return _serverMailStore; }
ServerMailContainer _serverMailStore
Definition: ObjectMgr.h:1614

References _serverMailStore.

◆ GetAreaTrigger()

AreaTrigger const * ObjectMgr::GetAreaTrigger ( uint32  trigger) const
inline
861 {
862 AreaTriggerContainer::const_iterator itr = _areaTriggerStore.find(trigger);
863 if (itr != _areaTriggerStore.end())
864 return &itr->second;
865 return nullptr;
866 }
AreaTriggerContainer _areaTriggerStore
Definition: ObjectMgr.h:1489

References _areaTriggerStore.

Referenced by GetGoBackTrigger(), LoadAreaTriggerScripts(), LoadAreaTriggerTeleports(), LoadQuestAreaTriggers(), and LoadTavernAreaTriggers().

◆ GetAreaTriggerScriptId()

uint32 ObjectMgr::GetAreaTriggerScriptId ( uint32  trigger_id)
8702{
8703 AreaTriggerScriptContainer::const_iterator i = _areaTriggerScriptStore.find(trigger_id);
8704 if (i != _areaTriggerScriptStore.end())
8705 return i->second;
8706 return 0;
8707}
AreaTriggerScriptContainer _areaTriggerScriptStore
Definition: ObjectMgr.h:1491

References _areaTriggerScriptStore.

◆ GetAreaTriggerTeleport()

AreaTriggerTeleport const * ObjectMgr::GetAreaTriggerTeleport ( uint32  trigger) const
inline
869 {
870 AreaTriggerTeleportContainer::const_iterator itr = _areaTriggerTeleportStore.find(trigger);
871 if (itr != _areaTriggerTeleportStore.end())
872 return &itr->second;
873 return nullptr;
874 }
AreaTriggerTeleportContainer _areaTriggerTeleportStore
Definition: ObjectMgr.h:1490

References _areaTriggerTeleportStore.

◆ GetBaseReputationOf()

int32 ObjectMgr::GetBaseReputationOf ( FactionEntry const *  factionEntry,
uint8  race,
uint8  playerClass 
)
8716{
8717 if (!factionEntry)
8718 return 0;
8719
8720 uint32 raceMask = (1 << (race - 1));
8721 uint32 classMask = (1 << (playerClass - 1));
8722
8723 for (int i = 0; i < 4; i++)
8724 {
8725 if ((!factionEntry->BaseRepClassMask[i] ||
8726 factionEntry->BaseRepClassMask[i] & classMask) &&
8727 (!factionEntry->BaseRepRaceMask[i] ||
8728 factionEntry->BaseRepRaceMask[i] & raceMask))
8729 return factionEntry->BaseRepValue[i];
8730 }
8731
8732 return 0;
8733}

References FactionEntry::BaseRepClassMask, FactionEntry::BaseRepRaceMask, and FactionEntry::BaseRepValue.

◆ GetBaseXP()

uint32 ObjectMgr::GetBaseXP ( uint8  level)
7445{
7446 return _baseXPTable[level] ? _baseXPTable[level] : 0;
7447}
BaseXPContainer _baseXPTable
Definition: ObjectMgr.h:1557

References _baseXPTable.

◆ GetBroadcastText()

BroadcastText const * ObjectMgr::GetBroadcastText ( uint32  id) const
inline
1193 {
1194 BroadcastTextContainer::const_iterator itr = _broadcastTextStore.find(id);
1195 if (itr != _broadcastTextStore.end())
1196 return &itr->second;
1197 return nullptr;
1198 }
BroadcastTextContainer _broadcastTextStore
Definition: ObjectMgr.h:1596

References _broadcastTextStore.

Referenced by LoadGossipMenuItems(), LoadGossipText(), and LoadScripts().

◆ GetCellObjectGuids()

CellObjectGuids const & ObjectMgr::GetCellObjectGuids ( uint16  mapid,
uint8  spawnMode,
uint32  cell_id 
)
inline
1153 {
1154 MapObjectGuids::const_iterator itr1 = _mapObjectGuidsStore.find(MAKE_PAIR32(mapid, spawnMode));
1155 if (itr1 != _mapObjectGuidsStore.end())
1156 {
1157 CellObjectGuidsMap::const_iterator itr2 = itr1->second.find(cell_id);
1158 if (itr2 != itr1->second.end())
1159 return itr2->second;
1160 }
1161 return _emptyCellObjectGuids;
1162 }
CellObjectGuids _emptyCellObjectGuids
Definition: ObjectMgr.h:1574

References _emptyCellObjectGuids, _mapObjectGuidsStore, and MAKE_PAIR32().

◆ GetCreatureAddon()

CreatureAddon const * ObjectMgr::GetCreatureAddon ( ObjectGuid::LowType  lowguid)
1505{
1506 CreatureAddonContainer::const_iterator itr = _creatureAddonStore.find(lowguid);
1507 if (itr != _creatureAddonStore.end())
1508 return &(itr->second);
1509
1510 return nullptr;
1511}
CreatureAddonContainer _creatureAddonStore
Definition: ObjectMgr.h:1580

References _creatureAddonStore.

◆ GetCreatureBaseStats()

CreatureBaseStats const * ObjectMgr::GetCreatureBaseStats ( uint8  level,
uint8  unitClass 
)
9613{
9614 CreatureBaseStatsContainer::const_iterator it = _creatureBaseStatsStore.find(MAKE_PAIR16(level, unitClass));
9615
9616 if (it != _creatureBaseStatsStore.end())
9617 return &(it->second);
9618
9619 struct DefaultCreatureBaseStats : public CreatureBaseStats
9620 {
9621 DefaultCreatureBaseStats()
9622 {
9623 BaseArmor = 1;
9624 for (uint8 j = 0; j < MAX_EXPANSIONS; ++j)
9625 {
9626 BaseHealth[j] = 1;
9627 BaseDamage[j] = 0.0f;
9628 }
9629 BaseMana = 0;
9630 AttackPower = 0;
9631 RangedAttackPower = 0;
9632 }
9633 };
9634 static const DefaultCreatureBaseStats defStats;
9635 return &defStats;
9636}
uint16 MAKE_PAIR16(uint8 l, uint8 h)
Definition: ObjectDefines.h:82
CreatureBaseStatsContainer _creatureBaseStatsStore
Definition: ObjectMgr.h:1541

References _creatureBaseStatsStore, MAKE_PAIR16(), and MAX_EXPANSIONS.

Referenced by AddCreData().

◆ GetCreatureData()

CreatureData const * ObjectMgr::GetCreatureData ( ObjectGuid::LowType  spawnId) const
inline
1201 {
1202 CreatureDataContainer::const_iterator itr = _creatureDataStore.find(spawnId);
1203 if (itr == _creatureDataStore.end()) return nullptr;
1204 return &itr->second;
1205 }

References _creatureDataStore.

Referenced by DeleteCreatureData(), LoadCreatureAddons(), LoadCreatureMovementOverrides(), LoadLinkedRespawn(), and SetCreatureLinkedRespawn().

◆ GetCreatureLocale()

CreatureLocale const * ObjectMgr::GetCreatureLocale ( uint32  entry) const
inline
1224 {
1225 CreatureLocaleContainer::const_iterator itr = _creatureLocaleStore.find(entry);
1226 if (itr == _creatureLocaleStore.end()) return nullptr;
1227 return &itr->second;
1228 }
CreatureLocaleContainer _creatureLocaleStore
Definition: ObjectMgr.h:1588

References _creatureLocaleStore.

◆ GetCreatureModelInfo()

CreatureModelInfo const * ObjectMgr::GetCreatureModelInfo ( uint32  modelId) const
1709{
1710 CreatureModelContainer::const_iterator itr = _creatureModelStore.find(modelId);
1711 if (itr != _creatureModelStore.end())
1712 return &(itr->second);
1713
1714 return nullptr;
1715}
CreatureModelContainer _creatureModelStore
Definition: ObjectMgr.h:1579

References _creatureModelStore.

Referenced by CheckCreatureTemplate(), and GetCreatureModelRandomGender().

◆ GetCreatureModelRandomGender()

CreatureModelInfo const * ObjectMgr::GetCreatureModelRandomGender ( uint32 displayID)
1746{
1747 CreatureModelInfo const* modelInfo = GetCreatureModelInfo(*displayID);
1748 if (!modelInfo)
1749 return nullptr;
1750
1751 // If a model for another gender exists, 50% chance to use it
1752 if (modelInfo->modelid_other_gender != 0 && urand(0, 1) == 0)
1753 {
1754 CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->modelid_other_gender);
1755 if (!minfo_tmp)
1756 LOG_ERROR("sql.sql", "Model (Entry: {}) has modelid_other_gender {} not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender);
1757 else
1758 {
1759 // Model ID changed
1760 *displayID = modelInfo->modelid_other_gender;
1761 return minfo_tmp;
1762 }
1763 }
1764
1765 return modelInfo;
1766}
uint32 modelid_other_gender
Definition: CreatureData.h:392

References GetCreatureModelInfo(), LOG_ERROR, CreatureModelInfo::modelid_other_gender, and urand().

Referenced by GetTaxiMountDisplayId().

◆ GetCreatureMovementOverride()

CreatureMovementData const * ObjectMgr::GetCreatureMovementOverride ( ObjectGuid::LowType  spawnId) const
1523{
1525}
auto MapGetValuePtr(M &map, typename M::key_type const &key) -> decltype(AddressOrSelf(map.find(key) ->second))
Definition: Containers.h:208
std::unordered_map< ObjectGuid::LowType, CreatureMovementData > _creatureMovementOverrides
Definition: ObjectMgr.h:1582

References _creatureMovementOverrides, and Acore::Containers::MapGetValuePtr().

◆ GetCreatureQuestInvolvedRelationBounds()

QuestRelationBounds ObjectMgr::GetCreatureQuestInvolvedRelationBounds ( uint32  creature_entry)
inline
1005 {
1006 return _creatureQuestInvolvedRelations.equal_range(creature_entry);
1007 }
QuestRelations _creatureQuestInvolvedRelations
Definition: ObjectMgr.h:1508

References _creatureQuestInvolvedRelations.

◆ GetCreatureQuestInvolvedRelationMap()

QuestRelations * ObjectMgr::GetCreatureQuestInvolvedRelationMap ( )
inline

◆ GetCreatureQuestItemList()

CreatureQuestItemList const * ObjectMgr::GetCreatureQuestItemList ( uint32  id) const
inline
824 {
825 CreatureQuestItemMap::const_iterator itr = _creatureQuestItemStore.find(id);
826 if (itr != _creatureQuestItemStore.end())
827 return &itr->second;
828 return nullptr;
829 }
CreatureQuestItemMap _creatureQuestItemStore
Definition: ObjectMgr.h:1585

References _creatureQuestItemStore.

◆ GetCreatureQuestItemMap()

CreatureQuestItemMap const * ObjectMgr::GetCreatureQuestItemMap ( ) const
inline
830{ return &_creatureQuestItemStore; }

References _creatureQuestItemStore.

◆ GetCreatureQuestRelationBounds()

QuestRelationBounds ObjectMgr::GetCreatureQuestRelationBounds ( uint32  creature_entry)
inline
1000 {
1001 return _creatureQuestRelations.equal_range(creature_entry);
1002 }
QuestRelations _creatureQuestRelations
Definition: ObjectMgr.h:1507

References _creatureQuestRelations.

◆ GetCreatureQuestRelationMap()

QuestRelations * ObjectMgr::GetCreatureQuestRelationMap ( )
inline
990 {
992 }

References _creatureQuestRelations.

◆ GetCreatureTemplate()

◆ GetCreatureTemplateAddon()

CreatureAddon const * ObjectMgr::GetCreatureTemplateAddon ( uint32  entry)
1514{
1515 CreatureAddonContainer::const_iterator itr = _creatureTemplateAddonStore.find(entry);
1516 if (itr != _creatureTemplateAddonStore.end())
1517 return &(itr->second);
1518
1519 return nullptr;
1520}
CreatureAddonContainer _creatureTemplateAddonStore
Definition: ObjectMgr.h:1581

References _creatureTemplateAddonStore.

◆ GetCreatureTemplates()

CreatureTemplateContainer const * ObjectMgr::GetCreatureTemplates ( ) const
inline
771{ return &_creatureTemplateStore; }
CreatureTemplateContainer _creatureTemplateStore
Definition: ObjectMgr.h:1576

References _creatureTemplateStore.

◆ GetDBCLocaleIndex()

LocaleConstant ObjectMgr::GetDBCLocaleIndex ( ) const
inline
1324{ return DBCLocaleIndex; }

References DBCLocaleIndex.

◆ GetDungeonEncounterList()

DungeonEncounterList const * ObjectMgr::GetDungeonEncounterList ( uint32  mapId,
Difficulty  difficulty 
)
inline
944 {
945 std::unordered_map<uint32, DungeonEncounterList>::const_iterator itr = _dungeonEncounterStore.find(MAKE_PAIR32(mapId, difficulty));
946 if (itr != _dungeonEncounterStore.end())
947 return &itr->second;
948 return nullptr;
949 }

References _dungeonEncounterStore, and MAKE_PAIR32().

◆ GetEquipmentInfo()

EquipmentInfo const * ObjectMgr::GetEquipmentInfo ( uint32  entry,
int8 id 
)
1528{
1529 EquipmentInfoContainer::const_iterator itr = _equipmentInfoStore.find(entry);
1530 if (itr == _equipmentInfoStore.end())
1531 return nullptr;
1532
1533 if (itr->second.empty())
1534 return nullptr;
1535
1536 if (id == -1) // select a random element
1537 {
1538 EquipmentInfoContainerInternal::const_iterator ritr = itr->second.begin();
1539 std::advance(ritr, urand(0u, itr->second.size() - 1));
1540 id = std::distance(itr->second.begin(), ritr) + 1;
1541 return &ritr->second;
1542 }
1543 else
1544 {
1545 EquipmentInfoContainerInternal::const_iterator itr2 = itr->second.find(id);
1546 if (itr2 != itr->second.end())
1547 return &itr2->second;
1548 }
1549
1550 return nullptr;
1551}
EquipmentInfoContainer _equipmentInfoStore
Definition: ObjectMgr.h:1586

References _equipmentInfoStore, and urand().

Referenced by LoadCreatures().

◆ GetFishingBaseSkillLevel()

int32 ObjectMgr::GetFishingBaseSkillLevel ( uint32  entry) const
inline
1109 {
1110 FishingBaseSkillContainer::const_iterator itr = _fishingBaseForAreaStore.find(entry);
1111 return itr != _fishingBaseForAreaStore.end() ? itr->second : 0;
1112 }

References _fishingBaseForAreaStore.

◆ GetGameObjectAddon()

GameObjectAddon const * ObjectMgr::GetGameObjectAddon ( ObjectGuid::LowType  lowguid)
1496{
1497 GameObjectAddonContainer::const_iterator itr = _gameObjectAddonStore.find(lowguid);
1498 if (itr != _gameObjectAddonStore.end())
1499 return &(itr->second);
1500
1501 return nullptr;
1502}
GameObjectAddonContainer _gameObjectAddonStore
Definition: ObjectMgr.h:1583

References _gameObjectAddonStore.

◆ GetGameObjectData()

GameObjectData const * ObjectMgr::GetGameObjectData ( ObjectGuid::LowType  spawnId) const
inline
1218 {
1219 GameObjectDataContainer::const_iterator itr = _gameObjectDataStore.find(spawnId);
1220 if (itr == _gameObjectDataStore.end()) return nullptr;
1221 return &itr->second;
1222 }

References _gameObjectDataStore.

Referenced by DeleteGOData(), LoadGameObjectAddons(), LoadLinkedRespawn(), and LoadScripts().

◆ GetGameObjectLocale()

GameObjectLocale const * ObjectMgr::GetGameObjectLocale ( uint32  entry) const
inline
1230 {
1231 GameObjectLocaleContainer::const_iterator itr = _gameObjectLocaleStore.find(entry);
1232 if (itr == _gameObjectLocaleStore.end()) return nullptr;
1233 return &itr->second;
1234 }
GameObjectLocaleContainer _gameObjectLocaleStore
Definition: ObjectMgr.h:1590

References _gameObjectLocaleStore.

◆ GetGameObjectQuestItemList()

GameObjectQuestItemList const * ObjectMgr::GetGameObjectQuestItemList ( uint32  id) const
inline
815 {
816 GameObjectQuestItemMap::const_iterator itr = _gameObjectQuestItemStore.find(id);
817 if (itr != _gameObjectQuestItemStore.end())
818 return &itr->second;
819 return nullptr;
820 }
GameObjectQuestItemMap _gameObjectQuestItemStore
Definition: ObjectMgr.h:1584

References _gameObjectQuestItemStore.

◆ GetGameObjectQuestItemMap()

GameObjectQuestItemMap const * ObjectMgr::GetGameObjectQuestItemMap ( ) const
inline

◆ GetGameObjectTemplate()

GameObjectTemplate const * ObjectMgr::GetGameObjectTemplate ( uint32  entry)
9937{
9938 GameObjectTemplateContainer::const_iterator itr = _gameObjectTemplateStore.find(entry);
9939 if (itr != _gameObjectTemplateStore.end())
9940 return &(itr->second);
9941
9942 return nullptr;
9943}
GameObjectTemplateContainer _gameObjectTemplateStore
Definition: ObjectMgr.h:1591

References _gameObjectTemplateStore.

Referenced by AddGOData(), IsGameObjectStaticTransport(), LoadGameobjectQuestEnders(), LoadGameobjectQuestStarters(), LoadGameobjects(), LoadQuests(), LoadScripts(), and LoadTempSummons().

◆ GetGameObjectTemplateAddon()

GameObjectTemplateAddon const * ObjectMgr::GetGameObjectTemplateAddon ( uint32  entry) const
9952{
9953 auto itr = _gameObjectTemplateAddonStore.find(entry);
9954 if (itr != _gameObjectTemplateAddonStore.end())
9955 return &itr->second;
9956
9957 return nullptr;
9958}
GameObjectTemplateAddonContainer _gameObjectTemplateAddonStore
Definition: ObjectMgr.h:1592

References _gameObjectTemplateAddonStore.

◆ GetGameObjectTemplates()

GameObjectTemplateContainer const * ObjectMgr::GetGameObjectTemplates ( ) const
inline

◆ GetGameTele() [1/2]

GameTele const * ObjectMgr::GetGameTele ( std::string_view  name) const
8821{
8822 // explicit name case
8823 std::wstring wname;
8824 if (!Utf8toWStr(name, wname))
8825 return nullptr;
8826
8827 // converting string that we try to find to lower case
8828 wstrToLower(wname);
8829
8830 // Alternative first GameTele what contains wnameLow as substring in case no GameTele location found
8831 const GameTele* alt = nullptr;
8832 for (GameTeleContainer::const_iterator itr = _gameTeleStore.begin(); itr != _gameTeleStore.end(); ++itr)
8833 {
8834 if (itr->second.wnameLow == wname)
8835 return &itr->second;
8836 else if (!alt && itr->second.wnameLow.find(wname) != std::wstring::npos)
8837 alt = &itr->second;
8838 }
8839
8840 return alt;
8841}
Definition: ObjectMgr.h:135

References _gameTeleStore, Utf8toWStr(), GameTele::wnameLow, and wstrToLower().

◆ GetGameTele() [2/2]

GameTele const * ObjectMgr::GetGameTele ( uint32  id) const
inline
1354 {
1355 GameTeleContainer::const_iterator itr = _gameTeleStore.find(id);
1356 if (itr == _gameTeleStore.end()) return nullptr;
1357 return &itr->second;
1358 }

References _gameTeleStore.

◆ GetGameTeleMap()

GameTeleContainer const & ObjectMgr::GetGameTeleMap ( ) const
inline
1360{ return _gameTeleStore; }

References _gameTeleStore.

◆ GetGenerator()

template<HighGuid type>
ObjectGuidGeneratorBase & ObjectMgr::GetGenerator ( )
inline
1122 {
1123 static_assert(ObjectGuidTraits<type>::Global, "Only global guid can be generated in ObjectMgr context");
1124 return GetGuidSequenceGenerator<type>();
1125 }
Definition: ObjectGuid.h:78

◆ GetGoBackTrigger()

AreaTriggerTeleport const * ObjectMgr::GetGoBackTrigger ( uint32  Map) const
6909{
6910 bool useParentDbValue = false;
6911 uint32 parentId = 0;
6912 MapEntry const* mapEntry = sMapStore.LookupEntry(Map);
6913 if (!mapEntry || mapEntry->entrance_map < 0)
6914 return nullptr;
6915
6916 if (mapEntry->IsDungeon())
6917 {
6918 InstanceTemplate const* iTemplate = sObjectMgr->GetInstanceTemplate(Map);
6919
6920 if (!iTemplate)
6921 return nullptr;
6922
6923 parentId = iTemplate->Parent;
6924 useParentDbValue = true;
6925 }
6926
6927 uint32 entrance_map = uint32(mapEntry->entrance_map);
6928 for (AreaTriggerTeleportContainer::const_iterator itr = _areaTriggerTeleportStore.begin(); itr != _areaTriggerTeleportStore.end(); ++itr)
6929 if ((!useParentDbValue && itr->second.target_mapId == entrance_map) || (useParentDbValue && itr->second.target_mapId == parentId))
6930 {
6931 AreaTrigger const* atEntry = GetAreaTrigger(itr->first);
6932 if (atEntry && atEntry->map == Map)
6933 return &itr->second;
6934 }
6935 return nullptr;
6936}
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
Definition: ObjectMgr.h:421
uint32 map
Definition: ObjectMgr.h:423
AreaTrigger const * GetAreaTrigger(uint32 trigger) const
Definition: ObjectMgr.h:860
Definition: Map.h:273
uint32 Parent
Definition: Map.h:274
Definition: DBCStructure.h:1308
int32 entrance_map
Definition: DBCStructure.h:1323
bool IsDungeon() const
Definition: DBCStructure.h:1334

References _areaTriggerTeleportStore, MapEntry::entrance_map, GetAreaTrigger(), MapEntry::IsDungeon(), AreaTrigger::map, InstanceTemplate::Parent, sMapStore, and sObjectMgr.

◆ GetGOQuestInvolvedRelationBounds()

QuestRelationBounds ObjectMgr::GetGOQuestInvolvedRelationBounds ( uint32  go_entry)
inline
985 {
986 return _goQuestInvolvedRelations.equal_range(go_entry);
987 }
QuestRelations _goQuestInvolvedRelations
Definition: ObjectMgr.h:1506

References _goQuestInvolvedRelations.

◆ GetGOQuestInvolvedRelationMap()

QuestRelations * ObjectMgr::GetGOQuestInvolvedRelationMap ( )
inline
975 {
977 }

References _goQuestInvolvedRelations.

◆ GetGOQuestRelationBounds()

QuestRelationBounds ObjectMgr::GetGOQuestRelationBounds ( uint32  go_entry)
inline
980 {
981 return _goQuestRelations.equal_range(go_entry);
982 }
QuestRelations _goQuestRelations
Definition: ObjectMgr.h:1505

References _goQuestRelations.

◆ GetGOQuestRelationMap()

QuestRelations * ObjectMgr::GetGOQuestRelationMap ( )
inline
970 {
971 return &_goQuestRelations;
972 }

References _goQuestRelations.

◆ GetGossipMenuItemsLocale()

GossipMenuItemsLocale const * ObjectMgr::GetGossipMenuItemsLocale ( uint32  entry) const
inline
1260 {
1261 GossipMenuItemsLocaleContainer::const_iterator itr = _gossipMenuItemsLocaleStore.find(entry);
1262 if (itr == _gossipMenuItemsLocaleStore.end()) return nullptr;
1263 return &itr->second;
1264 }
GossipMenuItemsLocaleContainer _gossipMenuItemsLocaleStore
Definition: ObjectMgr.h:1607

References _gossipMenuItemsLocaleStore.

◆ GetGossipMenuItemsMapBounds()

GossipMenuItemsMapBounds ObjectMgr::GetGossipMenuItemsMapBounds ( uint32  uiMenuId) const
inline
1407 {
1408 return _gossipMenuItemsStore.equal_range(uiMenuId);
1409 }
GossipMenuItemsContainer _gossipMenuItemsStore
Definition: ObjectMgr.h:1500

References _gossipMenuItemsStore.

◆ GetGossipMenuItemsMapBoundsNonConst()

GossipMenuItemsMapBoundsNonConst ObjectMgr::GetGossipMenuItemsMapBoundsNonConst ( uint32  uiMenuId)
inline
1411 {
1412 return _gossipMenuItemsStore.equal_range(uiMenuId);
1413 }

References _gossipMenuItemsStore.

◆ GetGossipMenusMapBounds()

GossipMenusMapBounds ObjectMgr::GetGossipMenusMapBounds ( uint32  uiMenuId) const
inline
1397 {
1398 return _gossipMenusStore.equal_range(uiMenuId);
1399 }
GossipMenusContainer _gossipMenusStore
Definition: ObjectMgr.h:1499

References _gossipMenusStore.

◆ GetGossipMenusMapBoundsNonConst()

GossipMenusMapBoundsNonConst ObjectMgr::GetGossipMenusMapBoundsNonConst ( uint32  uiMenuId)
inline
1402 {
1403 return _gossipMenusStore.equal_range(uiMenuId);
1404 }

References _gossipMenusStore.

◆ GetGossipText()

GossipText const * ObjectMgr::GetGossipText ( uint32  Text_ID) const
5963{
5964 GossipTextContainer::const_iterator itr = _gossipTextStore.find(Text_ID);
5965 if (itr != _gossipTextStore.end())
5966 return &itr->second;
5967 return nullptr;
5968}
GossipTextContainer _gossipTextStore
Definition: ObjectMgr.h:1487

References _gossipTextStore.

Referenced by LoadGossipMenu().

◆ GetGuidSequenceGenerator()

template<HighGuid high>
ObjectGuidGeneratorBase & ObjectMgr::GetGuidSequenceGenerator ( )
inlineprivate
1468 {
1469 auto itr = _guidGenerators.find(high);
1470 if (itr == _guidGenerators.end())
1471 itr = _guidGenerators.insert(std::make_pair(high, std::unique_ptr<ObjectGuidGenerator<high>>(new ObjectGuidGenerator<high>()))).first;
1472
1473 return *itr->second;
1474 }
Definition: ObjectGuid.h:299
std::map< HighGuid, std::unique_ptr< ObjectGuidGeneratorBase > > _guidGenerators
Definition: ObjectMgr.h:1476

References _guidGenerators.

◆ GetInstanceSavedGameobjectState()

uint8 ObjectMgr::GetInstanceSavedGameobjectState ( uint32  id,
uint32  guid 
)
10130{
10131 for (auto it = GameobjectInstanceSavedStateList.begin(); it != GameobjectInstanceSavedStateList.end(); it++)
10132 {
10133 if (it->m_guid == guid && it->m_instance == id)
10134 {
10135 return it->m_state;
10136 }
10137 }
10138 return 3; // Any state higher than 2 to get the default state
10139}

References GameobjectInstanceSavedStateList.

◆ GetInstanceTemplate()

InstanceTemplate const * ObjectMgr::GetInstanceTemplate ( uint32  mapId)
5869{
5870 InstanceTemplateContainer::const_iterator itr = _instanceTemplateStore.find(uint16(mapID));
5871 if (itr != _instanceTemplateStore.end())
5872 return &(itr->second);
5873
5874 return nullptr;
5875}
InstanceTemplateContainer _instanceTemplateStore
Definition: ObjectMgr.h:1532

References _instanceTemplateStore.

◆ GetItemLocale()

ItemLocale const * ObjectMgr::GetItemLocale ( uint32  entry) const
inline
1236 {
1237 ItemLocaleContainer::const_iterator itr = _itemLocaleStore.find(entry);
1238 if (itr == _itemLocaleStore.end()) return nullptr;
1239 return &itr->second;
1240 }
ItemLocaleContainer _itemLocaleStore
Definition: ObjectMgr.h:1599

References _itemLocaleStore.

◆ GetItemSetNameEntry()

ItemSetNameEntry const * ObjectMgr::GetItemSetNameEntry ( uint32  itemId)
inline
787 {
788 ItemSetNameContainer::iterator itr = _itemSetNameStore.find(itemId);
789 if (itr != _itemSetNameStore.end())
790 return &itr->second;
791 return nullptr;
792 }
ItemSetNameContainer _itemSetNameStore
Definition: ObjectMgr.h:1570

References _itemSetNameStore.

◆ GetItemSetNameLocale()

ItemSetNameLocale const * ObjectMgr::GetItemSetNameLocale ( uint32  entry) const
inline
1242 {
1243 ItemSetNameLocaleContainer::const_iterator itr = _itemSetNameLocaleStore.find(entry);
1244 if (itr == _itemSetNameLocaleStore.end())return nullptr;
1245 return &itr->second;
1246 }
ItemSetNameLocaleContainer _itemSetNameLocaleStore
Definition: ObjectMgr.h:1600

References _itemSetNameLocaleStore.

◆ GetItemTemplate()

ItemTemplate const * ObjectMgr::GetItemTemplate ( uint32  entry)
3288{
3289 return entry < _itemTemplateStoreFast.size() ? _itemTemplateStoreFast[entry] : nullptr;
3290}
std::vector< ItemTemplate * > _itemTemplateStoreFast
Definition: ObjectMgr.h:1598

References _itemTemplateStoreFast.

Referenced by LoadAccessRequirements(), LoadEquipmentTemplates(), LoadFactionChangeItems(), LoadItemTemplates(), LoadPlayerInfo(), and LoadScripts().

◆ GetItemTemplateStore()

ItemTemplateContainer const * ObjectMgr::GetItemTemplateStore ( ) const
inline
783{ return &_itemTemplateStore; }
ItemTemplateContainer _itemTemplateStore
Definition: ObjectMgr.h:1597

References _itemTemplateStore.

◆ GetItemTemplateStoreFast()

std::vector< ItemTemplate * > const * ObjectMgr::GetItemTemplateStoreFast ( ) const
inline
784{ return &_itemTemplateStoreFast; }

References _itemTemplateStoreFast.

◆ GetLinkedRespawnGuid()

ObjectGuid ObjectMgr::GetLinkedRespawnGuid ( ObjectGuid  guid) const
inline
1209 {
1210 LinkedRespawnContainer::const_iterator itr = _linkedRespawnStore.find(guid);
1211 if (itr == _linkedRespawnStore.end())
1212 return ObjectGuid::Empty;
1213 return itr->second;
1214 }
static ObjectGuid const Empty
Definition: ObjectGuid.h:122
LinkedRespawnContainer _linkedRespawnStore
Definition: ObjectMgr.h:1587

References _linkedRespawnStore, and ObjectGuid::Empty.

◆ GetLocaleString() [1/2]

static void ObjectMgr::GetLocaleString ( const std::vector< std::string > &  data,
int  loc_idx,
std::string &  value 
)
inlinestatic
1424 {
1425 if (data.size() > size_t(loc_idx) && !data[loc_idx].empty())
1426 value = data[loc_idx];
1427 }

◆ GetLocaleString() [2/2]

◆ GetMailLevelReward()

MailLevelReward const * ObjectMgr::GetMailLevelReward ( uint32  level,
uint32  raceMask 
)
inline
1140 {
1141 MailLevelRewardContainer::const_iterator map_itr = _mailLevelRewardStore.find(level);
1142 if (map_itr == _mailLevelRewardStore.end())
1143 return nullptr;
1144
1145 for (const auto & set_itr : map_itr->second)
1146 if (set_itr.raceMask & raceMask)
1147 return &set_itr;
1148
1149 return nullptr;
1150 }
MailLevelRewardContainer _mailLevelRewardStore
Definition: ObjectMgr.h:1539

References _mailLevelRewardStore.

◆ GetMapEntranceTrigger()

AreaTriggerTeleport const * ObjectMgr::GetMapEntranceTrigger ( uint32  Map) const

Searches for the areatrigger which teleports players to the given map

6942{
6943 for (AreaTriggerTeleportContainer::const_iterator itr = _areaTriggerTeleportStore.begin(); itr != _areaTriggerTeleportStore.end(); ++itr)
6944 {
6945 if (itr->second.target_mapId == Map) // Id is used to determine correct Scarlet Monastery instance
6946 {
6947 // xinef: no need to check, already done at loading
6948 //AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
6949 //if (atEntry)
6950 return &itr->second;
6951 }
6952 }
6953 return nullptr;
6954}

References _areaTriggerTeleportStore.

◆ GetMapObjectGuids()

CellObjectGuidsMap const & ObjectMgr::GetMapObjectGuids ( uint16  mapid,
uint8  spawnMode 
)
inline
1165 {
1166 MapObjectGuids::const_iterator itr1 = _mapObjectGuidsStore.find(MAKE_PAIR32(mapid, spawnMode));
1167 if (itr1 != _mapObjectGuidsStore.end())
1168 return itr1->second;
1170 }
CellObjectGuidsMap _emptyCellObjectGuidsMap
Definition: ObjectMgr.h:1573

References _emptyCellObjectGuidsMap, _mapObjectGuidsStore, and MAKE_PAIR32().

◆ GetNearestTaxiNode()

uint32 ObjectMgr::GetNearestTaxiNode ( float  x,
float  y,
float  z,
uint32  mapid,
uint32  teamId 
)
6528{
6529 bool found = false;
6530 float dist = 10000;
6531 uint32 id = 0;
6532
6533 for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
6534 {
6535 TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
6536
6537 if (!node || node->map_id != mapid || (!node->MountCreatureID[teamId == TEAM_ALLIANCE ? 1 : 0] && node->MountCreatureID[0] != 32981)) // dk flight
6538 continue;
6539
6540 uint8 field = (uint8)((i - 1) / 32);
6541 uint32 submask = 1 << ((i - 1) % 32);
6542
6543 // skip not taxi network nodes
6544 if (field >= TaxiMaskSize || (sTaxiNodesMask[field] & submask) == 0)
6545 {
6546 continue;
6547 }
6548
6549 float dist2 = (node->x - x) * (node->x - x) + (node->y - y) * (node->y - y) + (node->z - z) * (node->z - z);
6550 if (found)
6551 {
6552 if (dist2 < dist)
6553 {
6554 dist = dist2;
6555 id = i;
6556 }
6557 }
6558 else
6559 {
6560 found = true;
6561 dist = dist2;
6562 id = i;
6563 }
6564 }
6565
6566 return id;
6567}
TaxiMask sTaxiNodesMask
Definition: DBCStores.cpp:174
DBCStorage< TaxiNodesEntry > sTaxiNodesStore(TaxiNodesEntryfmt)
static constexpr size_t TaxiMaskSize
Definition: DBCStructure.h:2221
@ TEAM_ALLIANCE
Definition: SharedDefines.h:732
Definition: DBCStructure.h:1929
float z
Definition: DBCStructure.h:1934
uint32 map_id
Definition: DBCStructure.h:1931
float x
Definition: DBCStructure.h:1932
float y
Definition: DBCStructure.h:1933
uint32 MountCreatureID[2]
Definition: DBCStructure.h:1937

References TaxiNodesEntry::map_id, TaxiNodesEntry::MountCreatureID, sTaxiNodesMask, sTaxiNodesStore, TaxiMaskSize, TEAM_ALLIANCE, TaxiNodesEntry::x, TaxiNodesEntry::y, and TaxiNodesEntry::z.

◆ GetNpcTextLocale()

NpcTextLocale const * ObjectMgr::GetNpcTextLocale ( uint32  entry) const
inline
1304 {
1305 NpcTextLocaleContainer::const_iterator itr = _npcTextLocaleStore.find(entry);
1306 if (itr == _npcTextLocaleStore.end()) return nullptr;
1307 return &itr->second;
1308 }
NpcTextLocaleContainer _npcTextLocaleStore
Definition: ObjectMgr.h:1604

References _npcTextLocaleStore.

◆ GetNpcTrainerSpells()

TrainerSpellData const * ObjectMgr::GetNpcTrainerSpells ( uint32  entry) const
inline
1365 {
1366 CacheTrainerSpellContainer::const_iterator iter = _cacheTrainerSpellStore.find(entry);
1367 if (iter == _cacheTrainerSpellStore.end())
1368 return nullptr;
1369
1370 return &iter->second;
1371 }

References _cacheTrainerSpellStore.

◆ GetNpcVendorItemList()

VendorItemData const * ObjectMgr::GetNpcVendorItemList ( uint32  entry) const
inline
1374 {
1375 CacheVendorItemContainer::const_iterator iter = _cacheVendorItemStore.find(entry);
1376 if (iter == _cacheVendorItemStore.end())
1377 return nullptr;
1378
1379 return &iter->second;
1380 }

References _cacheVendorItemStore.

Referenced by IsVendorItemValid().

◆ GetPageText()

PageText const * ObjectMgr::GetPageText ( uint32  pageEntry)
5789{
5790 PageTextContainer::const_iterator itr = _pageTextStore.find(pageEntry);
5791 if (itr != _pageTextStore.end())
5792 return &(itr->second);
5793
5794 return nullptr;
5795}
PageTextContainer _pageTextStore
Definition: ObjectMgr.h:1531

References _pageTextStore.

Referenced by LoadGameObjectTemplate(), and LoadItemTemplates().

◆ GetPageTextLocale()

PageTextLocale const * ObjectMgr::GetPageTextLocale ( uint32  entry) const
inline
1248 {
1249 PageTextLocaleContainer::const_iterator itr = _pageTextLocaleStore.find(entry);
1250 if (itr == _pageTextLocaleStore.end()) return nullptr;
1251 return &itr->second;
1252 }
PageTextLocaleContainer _pageTextLocaleStore
Definition: ObjectMgr.h:1605

References _pageTextLocaleStore.

◆ GetPetLevelInfo()

PetLevelInfo const * ObjectMgr::GetPetLevelInfo ( uint32  creature_id,
uint8  level 
) const
3598{
3599 if (level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
3600 level = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
3601
3602 PetLevelInfoContainer::const_iterator itr = _petInfoStore.find(creature_id);
3603 if (itr == _petInfoStore.end())
3604 return nullptr;
3605
3606 return &itr->second[level - 1]; // data for level 1 stored in [0] array element, ...
3607}

References _petInfoStore, CONFIG_MAX_PLAYER_LEVEL, and sWorld.

◆ GetPlayerClassInfo()

PlayerClassInfo const * ObjectMgr::GetPlayerClassInfo ( uint32  class_) const
inline
799 {
800 if (class_ >= MAX_CLASSES)
801 return nullptr;
802 return _playerClassInfo[class_];
803 }

References _playerClassInfo, and MAX_CLASSES.

◆ GetPlayerClassLevelInfo()

void ObjectMgr::GetPlayerClassLevelInfo ( uint32  class_,
uint8  level,
PlayerClassLevelInfo info 
) const
4316{
4317 if (level < 1 || class_ >= MAX_CLASSES)
4318 return;
4319
4320 PlayerClassInfo const* pInfo = _playerClassInfo[class_];
4321
4322 if (level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
4323 level = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
4324
4325 *info = pInfo->levelInfo[level - 1];
4326}
Definition: Player.h:297

References _playerClassInfo, CONFIG_MAX_PLAYER_LEVEL, PlayerClassInfo::levelInfo, MAX_CLASSES, and sWorld.

◆ GetPlayerInfo()

PlayerInfo const * ObjectMgr::GetPlayerInfo ( uint32  race,
uint32  class_ 
) const
9983{
9984 if (race >= MAX_RACES)
9985 return nullptr;
9986 if (class_ >= MAX_CLASSES)
9987 return nullptr;
9988 PlayerInfo const* info = _playerInfo[race][class_];
9989 if (!info)
9990 return nullptr;
9991 return info;
9992}
Definition: Player.h:336

References _playerInfo, MAX_CLASSES, and MAX_RACES.

◆ GetPlayerLevelInfo()

void ObjectMgr::GetPlayerLevelInfo ( uint32  race,
uint32  class_,
uint8  level,
PlayerLevelInfo info 
) const
4329{
4330 if (level < 1 || race >= MAX_RACES || class_ >= MAX_CLASSES)
4331 return;
4332
4333 PlayerInfo const* pInfo = _playerInfo[race][class_];
4334 if (!pInfo)
4335 return;
4336
4337 if (level <= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
4338 *info = pInfo->levelInfo[level - 1];
4339 else
4340 BuildPlayerLevelInfo(race, class_, level, info);
4341}
void BuildPlayerLevelInfo(uint8 race, uint8 class_, uint8 level, PlayerLevelInfo *plinfo) const
Definition: ObjectMgr.cpp:4343

References _playerInfo, BuildPlayerLevelInfo(), CONFIG_MAX_PLAYER_LEVEL, PlayerInfo::levelInfo, MAX_CLASSES, and MAX_RACES.

◆ GetPointOfInterest()

PointOfInterest const * ObjectMgr::GetPointOfInterest ( uint32  id) const
inline
926 {
927 PointOfInterestContainer::const_iterator itr = _pointsOfInterestStore.find(id);
928 if (itr != _pointsOfInterestStore.end())
929 return &itr->second;
930 return nullptr;
931 }
PointOfInterestContainer _pointsOfInterestStore
Definition: ObjectMgr.h:1501

References _pointsOfInterestStore.

Referenced by LoadGossipMenuItems().

◆ GetPointOfInterestLocale()

PointOfInterestLocale const * ObjectMgr::GetPointOfInterestLocale ( uint32  poi_id) const
inline
1266 {
1267 PointOfInterestLocaleContainer::const_iterator itr = _pointOfInterestLocaleStore.find(poi_id);
1268 if (itr == _pointOfInterestLocaleStore.end()) return nullptr;
1269 return &itr->second;
1270 }
PointOfInterestLocaleContainer _pointOfInterestLocaleStore
Definition: ObjectMgr.h:1608

References _pointOfInterestLocaleStore.

◆ GetQuestForAreaTrigger()

uint32 ObjectMgr::GetQuestForAreaTrigger ( uint32  Trigger_ID) const
inline
840 {
841 QuestAreaTriggerContainer::const_iterator itr = _questAreaTriggerStore.find(Trigger_ID);
842 if (itr != _questAreaTriggerStore.end())
843 return itr->second;
844 return 0;
845 }
QuestAreaTriggerContainer _questAreaTriggerStore
Definition: ObjectMgr.h:1485

References _questAreaTriggerStore.

◆ GetQuestGreeting()

QuestGreeting const * ObjectMgr::GetQuestGreeting ( TypeID  type,
uint32  id 
) const
6263{
6264 uint32 typeIndex;
6265 if (type == TYPEID_UNIT)
6266 typeIndex = 0;
6267 else if (type == TYPEID_GAMEOBJECT)
6268 typeIndex = 1;
6269 else
6270 return nullptr;
6271
6273}
@ TYPEID_GAMEOBJECT
Definition: ObjectGuid.h:39
@ TYPEID_UNIT
Definition: ObjectGuid.h:37
QuestGreetingContainer _questGreetingStore
Definition: ObjectMgr.h:1488

References _questGreetingStore, Acore::Containers::MapGetValuePtr(), TYPEID_GAMEOBJECT, and TYPEID_UNIT.

◆ GetQuestGreetingLocale()

QuestGreetingLocale const * ObjectMgr::GetQuestGreetingLocale ( TypeID  type,
uint32  id 
) const
inline
1272 {
1273 uint32 typeIndex;
1274 if (type == TYPEID_UNIT)
1275 {
1276 typeIndex = 0;
1277 }
1278 else if (type == TYPEID_GAMEOBJECT)
1279 {
1280 typeIndex = 1;
1281 }
1282 else
1283 {
1284 return nullptr;
1285 }
1286
1287 QuestGreetingLocaleContainer::const_iterator itr = _questGreetingLocaleStore.find(MAKE_PAIR32(typeIndex, id));
1288 if (itr == _questGreetingLocaleStore.end()) return nullptr;
1289 return &itr->second;
1290 }
QuestGreetingLocaleContainer _questGreetingLocaleStore
Definition: ObjectMgr.h:1609

References _questGreetingLocaleStore, MAKE_PAIR32(), TYPEID_GAMEOBJECT, and TYPEID_UNIT.

◆ GetQuestLocale()

QuestLocale const * ObjectMgr::GetQuestLocale ( uint32  entry) const
inline
1254 {
1255 QuestLocaleContainer::const_iterator itr = _questLocaleStore.find(entry);
1256 if (itr == _questLocaleStore.end()) return nullptr;
1257 return &itr->second;
1258 }
QuestLocaleContainer _questLocaleStore
Definition: ObjectMgr.h:1601

References _questLocaleStore.

◆ GetQuestMoneyReward()

uint32 ObjectMgr::GetQuestMoneyReward ( uint8  level,
uint32  questMoneyDifficulty 
) const
10089{
10090 if (questMoneyDifficulty < MAX_QUEST_MONEY_REWARDS)
10091 {
10092 auto const& itr = _questMoneyRewards.find(level);
10093 if (itr != _questMoneyRewards.end())
10094 {
10095 return itr->second.at(questMoneyDifficulty);
10096 }
10097 }
10098
10099 return 0;
10100}
static constexpr uint32 MAX_QUEST_MONEY_REWARDS
Definition: ObjectMgr.h:722
QuestMoneyRewardStore _questMoneyRewards
Definition: ObjectMgr.h:1629

References _questMoneyRewards, and MAX_QUEST_MONEY_REWARDS.

◆ GetQuestOfferRewardLocale()

QuestOfferRewardLocale const * ObjectMgr::GetQuestOfferRewardLocale ( uint32  entry) const
inline
1292 {
1293 auto itr = _questOfferRewardLocaleStore.find(entry);
1294 if (itr == _questOfferRewardLocaleStore.end()) return nullptr;
1295 return &itr->second;
1296 }
QuestOfferRewardLocaleContainer _questOfferRewardLocaleStore
Definition: ObjectMgr.h:1602

References _questOfferRewardLocaleStore.

◆ GetQuestPOIVector()

QuestPOIVector const * ObjectMgr::GetQuestPOIVector ( uint32  questId)
inline
934 {
935 QuestPOIContainer::const_iterator itr = _questPOIStore.find(questId);
936 if (itr != _questPOIStore.end())
937 return &itr->second;
938 return nullptr;
939 }
QuestPOIContainer _questPOIStore
Definition: ObjectMgr.h:1503

References _questPOIStore.

◆ GetQuestRequestItemsLocale()

QuestRequestItemsLocale const * ObjectMgr::GetQuestRequestItemsLocale ( uint32  entry) const
inline
1298 {
1299 auto itr = _questRequestItemsLocaleStore.find(entry);
1300 if (itr == _questRequestItemsLocaleStore.end()) return nullptr;
1301 return &itr->second;
1302 }
QuestRequestItemsLocaleContainer _questRequestItemsLocaleStore
Definition: ObjectMgr.h:1603

References _questRequestItemsLocaleStore.

◆ GetQuestTemplate()

Quest const * ObjectMgr::GetQuestTemplate ( uint32  quest_id) const
inline
833 {
834 return quest_id < _questTemplatesFast.size() ? _questTemplatesFast[quest_id] : nullptr;
835 }
std::vector< Quest * > _questTemplatesFast
Definition: ObjectMgr.h:1479

References _questTemplatesFast.

Referenced by LoadAccessRequirements(), LoadQuestAreaTriggers(), LoadQuests(), and LoadScripts().

◆ GetQuestTemplates()

QuestMap const & ObjectMgr::GetQuestTemplates ( ) const
inline
837{ return _questTemplates; }

References _questTemplates.

◆ GetRepRewardRate()

RepRewardRate const * ObjectMgr::GetRepRewardRate ( uint32  factionId) const
inline
898 {
899 RepRewardRateContainer::const_iterator itr = _repRewardRateStore.find(factionId);
900 if (itr != _repRewardRateStore.end())
901 return &itr->second;
902
903 return nullptr;
904 }
RepRewardRateContainer _repRewardRateStore
Definition: ObjectMgr.h:1495

References _repRewardRateStore.

◆ GetRepSpilloverTemplate()

RepSpilloverTemplate const * ObjectMgr::GetRepSpilloverTemplate ( uint32  factionId) const
inline
917 {
918 RepSpilloverTemplateContainer::const_iterator itr = _repSpilloverTemplateStore.find(factionId);
919 if (itr != _repSpilloverTemplateStore.end())
920 return &itr->second;
921
922 return nullptr;
923 }
RepSpilloverTemplateContainer _repSpilloverTemplateStore
Definition: ObjectMgr.h:1497

References _repSpilloverTemplateStore.

◆ GetReputationOnKilEntry()

ReputationOnKillEntry const * ObjectMgr::GetReputationOnKilEntry ( uint32  id) const
inline
907 {
908 RepOnKillContainer::const_iterator itr = _repOnKillStore.find(id);
909 if (itr != _repOnKillStore.end())
910 return &itr->second;
911 return nullptr;
912 }
RepOnKillContainer _repOnKillStore
Definition: ObjectMgr.h:1496

References _repOnKillStore.

◆ GetScriptId()

uint32 ObjectMgr::GetScriptId ( std::string const &  name)
9473{
9474 // use binary search to find the script name in the sorted vector
9475 // assume "" is the first element
9476 if (name.empty())
9477 return 0;
9478
9479 ScriptNameContainer::const_iterator itr = std::lower_bound(_scriptNamesStore.begin(), _scriptNamesStore.end(), name);
9480 if (itr == _scriptNamesStore.end() || (*itr != name))
9481 return 0;
9482
9483 return uint32(itr - _scriptNamesStore.begin());
9484}
ScriptNameContainer _scriptNamesStore
Definition: ObjectMgr.h:1520

References _scriptNamesStore.

Referenced by LoadAreaTriggerScripts(), LoadCreatures(), LoadCreatureTemplate(), LoadGameobjects(), LoadGameObjectTemplate(), and LoadSpellScriptNames().

◆ GetScriptName()

std::string const & ObjectMgr::GetScriptName ( uint32  id) const
9467{
9468 static std::string const empty = "";
9469 return (id < _scriptNamesStore.size()) ? _scriptNamesStore[id] : empty;
9470}

References _scriptNamesStore.

Referenced by ValidateSpellScripts().

◆ GetScriptNames()

ScriptNameContainer & ObjectMgr::GetScriptNames ( )
inline
1387{ return _scriptNamesStore; }

References _scriptNamesStore.

◆ GetSpellClickInfoMapBounds()

SpellClickInfoMapBounds ObjectMgr::GetSpellClickInfoMapBounds ( uint32  creature_id) const
inline
1392 {
1393 return _spellClickInfoStore.equal_range(creature_id);
1394 }
SpellClickInfoContainer _spellClickInfoStore
Definition: ObjectMgr.h:1522

References _spellClickInfoStore.

◆ GetSpellScriptsBounds()

SpellScriptsBounds ObjectMgr::GetSpellScriptsBounds ( uint32  spell_id)
8710{
8711 return SpellScriptsBounds(_spellScriptsStore.lower_bound(spell_id), _spellScriptsStore.upper_bound(spell_id));
8712}
std::pair< SpellScriptsContainer::iterator, SpellScriptsContainer::iterator > SpellScriptsBounds
Definition: ObjectMgr.h:389
SpellScriptsContainer _spellScriptsStore
Definition: ObjectMgr.h:1524

References _spellScriptsStore.

◆ GetSummonGroup()

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
1182 {
1183 TempSummonDataContainer::const_iterator itr = _tempSummonDataStore.find(TempSummonGroupKey(summonerId, summonerType, group));
1184 if (itr != _tempSummonDataStore.end())
1185 return &itr->second;
1186
1187 return nullptr;
1188 }
Key for storing temp summon data in TempSummonDataContainer.
Definition: ObjectMgr.h:67
TempSummonDataContainer _tempSummonDataStore
Stores temp summon data grouped by summoner's entry, summoner's type and group id.
Definition: ObjectMgr.h:1594

References _tempSummonDataStore.

◆ GetTaxiMountDisplayId()

uint32 ObjectMgr::GetTaxiMountDisplayId ( uint32  id,
TeamId  teamId,
bool  allowed_alt_team = false 
)
6594{
6595 uint32 mount_id = 0;
6596
6597 // select mount creature id
6598 TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id);
6599 if (node)
6600 {
6601 uint32 mount_entry = node->MountCreatureID[teamId == TEAM_ALLIANCE ? 1 : 0];
6602
6603 // Fix for Alliance not being able to use Acherus taxi
6604 // only one mount type for both sides
6605 if (mount_entry == 0 && allowed_alt_team)
6606 {
6607 // Simply reverse the selection. At least one team in theory should have a valid mount ID to choose.
6608 mount_entry = node->MountCreatureID[teamId];
6609 }
6610
6611 CreatureTemplate const* mount_info = GetCreatureTemplate(mount_entry);
6612 if (mount_info)
6613 {
6614 mount_id = mount_info->GetRandomValidModelId();
6615 if (!mount_id)
6616 {
6617 LOG_ERROR("sql.sql", "No displayid found for the taxi mount with the entry {}! Can't load it!", mount_entry);
6618 return 0;
6619 }
6620 }
6621 }
6622
6623 // minfo is not actually used but the mount_id was updated
6625
6626 return mount_id;
6627}
uint32 GetRandomValidModelId() const
Definition: Creature.cpp:120
CreatureModelInfo const * GetCreatureModelRandomGender(uint32 *displayID)
Definition: ObjectMgr.cpp:1745

References GetCreatureModelRandomGender(), GetCreatureTemplate(), CreatureTemplate::GetRandomValidModelId(), LOG_ERROR, TaxiNodesEntry::MountCreatureID, sTaxiNodesStore, and TEAM_ALLIANCE.

◆ GetTaxiPath()

void ObjectMgr::GetTaxiPath ( uint32  source,
uint32  destination,
uint32 path,
uint32 cost 
)
6570{
6571 TaxiPathSetBySource::iterator src_i = sTaxiPathSetBySource.find(source);
6572 if (src_i == sTaxiPathSetBySource.end())
6573 {
6574 path = 0;
6575 cost = 0;
6576 return;
6577 }
6578
6579 TaxiPathSetForSource& pathSet = src_i->second;
6580
6581 TaxiPathSetForSource::iterator dest_i = pathSet.find(destination);
6582 if (dest_i == pathSet.end())
6583 {
6584 path = 0;
6585 cost = 0;
6586 return;
6587 }
6588
6589 cost = dest_i->second->price;
6590 path = dest_i->second->ID;
6591}
TaxiPathSetBySource sTaxiPathSetBySource
Definition: DBCStores.cpp:181
std::map< uint32, TaxiPathEntry const * > TaxiPathSetForSource
Definition: DBCStructure.h:2215

References sTaxiPathSetBySource.

◆ GetVehicleAccessoryList()

VehicleAccessoryList const * ObjectMgr::GetVehicleAccessoryList ( Vehicle veh) const
9966{
9967 if (Creature* cre = veh->GetBase()->ToCreature())
9968 {
9969 // Give preference to GUID-based accessories
9970 VehicleAccessoryContainer::const_iterator itr = _vehicleAccessoryStore.find(cre->GetSpawnId());
9971 if (itr != _vehicleAccessoryStore.end())
9972 return &itr->second;
9973 }
9974
9975 // Otherwise return entry-based
9976 VehicleAccessoryContainer::const_iterator itr = _vehicleTemplateAccessoryStore.find(veh->GetCreatureEntry());
9977 if (itr != _vehicleTemplateAccessoryStore.end())
9978 return &itr->second;
9979 return nullptr;
9980}
Creature * ToCreature()
Definition: Object.h:197
Unit * GetBase() const
May be called from scripts.
Definition: Vehicle.h:39
uint32 GetCreatureEntry() const
Definition: Vehicle.h:41
VehicleAccessoryContainer _vehicleAccessoryStore
Definition: ObjectMgr.h:1527
VehicleAccessoryContainer _vehicleTemplateAccessoryStore
Definition: ObjectMgr.h:1526

References _vehicleAccessoryStore, _vehicleTemplateAccessoryStore, Vehicle::GetBase(), Vehicle::GetCreatureEntry(), and Object::ToCreature().

◆ GetXPForLevel()

uint32 ObjectMgr::GetXPForLevel ( uint8  level) const
7450{
7451 if (level < _playerXPperLevel.size())
7452 return _playerXPperLevel[level];
7453 return 0;
7454}
PlayerXPperLevel _playerXPperLevel
Definition: ObjectMgr.h:1554

References _playerXPperLevel.

◆ InitializeSpellInfoPrecomputedData()

void ObjectMgr::InitializeSpellInfoPrecomputedData ( )
5736{
5737 uint32 limit = sSpellStore.GetNumRows();
5738 for(uint32 i = 0; i <= limit; ++i)
5739 if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i))
5740 {
5741 const_cast<SpellInfo*>(spellInfo)->SetStackableWithRanks(spellInfo->ComputeIsStackableWithRanks());
5742 const_cast<SpellInfo*>(spellInfo)->SetCritCapable(spellInfo->ComputeIsCritCapable());
5743 const_cast<SpellInfo*>(spellInfo)->SetSpellValid(SpellMgr::ComputeIsSpellValid(spellInfo, false));
5744 }
5745}
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)

References SpellMgr::ComputeIsSpellValid(), sSpellMgr, and sSpellStore.

◆ instance()

ObjectMgr * ObjectMgr::instance ( )
static
433{
434 static ObjectMgr instance;
435 return &instance;
436}
Definition: ObjectMgr.h:729
static ObjectMgr * instance()
Definition: ObjectMgr.cpp:432

References instance().

Referenced by instance().

◆ IsGameObjectStaticTransport()

bool ObjectMgr::IsGameObjectStaticTransport ( uint32  entry)
9946{
9947 GameObjectTemplate const* goinfo = GetGameObjectTemplate(entry);
9948 return goinfo && goinfo->type == GAMEOBJECT_TYPE_TRANSPORT;
9949}
@ GAMEOBJECT_TYPE_TRANSPORT
Definition: SharedDefines.h:1543

References GAMEOBJECT_TYPE_TRANSPORT, GetGameObjectTemplate(), and GameObjectTemplate::type.

◆ IsProfanityName()

bool ObjectMgr::IsProfanityName ( std::string_view  name) const
8248{
8249 // pussywizard
8250 if (name.size() >= 2 && (name[name.size() - 2] == 'G' || name[name.size() - 2] == 'g') && (name[name.size() - 1] == 'M' || name[name.size() - 1] == 'm'))
8251 return true;
8252
8253 std::wstring wstr;
8254 if (!Utf8toWStr (name, wstr))
8255 return false;
8256
8257 wstrToLower(wstr);
8258
8259 return _profanityNamesStore.find(wstr) != _profanityNamesStore.end();
8260}

References _profanityNamesStore, Utf8toWStr(), and wstrToLower().

Referenced by AddProfanityPlayerName().

◆ IsReservedName()

bool ObjectMgr::IsReservedName ( std::string_view  name) const
8173{
8174 // pussywizard
8175 if (name.size() >= 2 && (name[name.size() - 2] == 'G' || name[name.size() - 2] == 'g') && (name[name.size() - 1] == 'M' || name[name.size() - 1] == 'm'))
8176 return true;
8177
8178 std::wstring wstr;
8179 if (!Utf8toWStr (name, wstr))
8180 return false;
8181
8182 wstrToLower(wstr);
8183
8184 return _reservedNamesStore.find(wstr) != _reservedNamesStore.end();
8185}

References _reservedNamesStore, Utf8toWStr(), and wstrToLower().

Referenced by AddReservedPlayerName().

◆ IsTavernAreaTrigger()

bool ObjectMgr::IsTavernAreaTrigger ( uint32  triggerID,
uint32  faction 
) const
inline
848 {
849 auto itr = _tavernAreaTriggerStore.find(triggerID);
850 if (itr != _tavernAreaTriggerStore.end())
851 {
852 return (itr->second & faction) != 0;
853 }
854
855 return false;
856 }
TavernAreaTriggerContainer _tavernAreaTriggerStore
Definition: ObjectMgr.h:1486

References _tavernAreaTriggerStore.

◆ IsTransportMap()

bool ObjectMgr::IsTransportMap ( uint32  mapId) const
inline
1443{ return _transportMaps.count(mapId) != 0; }
std::set< uint32 > _transportMaps
Definition: ObjectMgr.h:1627

References _transportMaps.

◆ IsValidChannelName()

bool ObjectMgr::IsValidChannelName ( std::string const &  name)
static
8452{
8453 std::wstring wname;
8454 if (!Utf8toWStr(name, wname))
8455 return false;
8456
8457 if (wname.size() > MAX_CHANNEL_NAME)
8458 return false;
8459
8460 uint32 strictMask = sWorld->getIntConfig(CONFIG_STRICT_CHANNEL_NAMES);
8461
8462 return isValidString(wname, strictMask, true);
8463}
#define MAX_CHANNEL_NAME
Definition: ObjectMgr.h:692
@ CONFIG_STRICT_CHANNEL_NAMES
Definition: IWorld.h:220

References CONFIG_STRICT_CHANNEL_NAMES, isValidString(), MAX_CHANNEL_NAME, sWorld, and Utf8toWStr().

◆ IsValidCharterName()

bool ObjectMgr::IsValidCharterName ( std::string_view  name)
static
8416{
8417 std::wstring wname;
8418 if (!Utf8toWStr(name, wname))
8419 return false;
8420
8421 if (wname.size() > MAX_CHARTER_NAME)
8422 return false;
8423
8424 uint32 minName = sWorld->getIntConfig(CONFIG_MIN_CHARTER_NAME);
8425 if (wname.size() < minName)
8426 return false;
8427
8428 // Check for Reserved Name from DBC
8429 if (sWorld->getBoolConfig(CONFIG_STRICT_NAMES_RESERVED))
8430 {
8431 if (ReservedNames(wname))
8432 {
8433 return false;
8434 }
8435 }
8436
8437 // Check for Profanity
8438 if (sWorld->getBoolConfig(CONFIG_STRICT_NAMES_PROFANITY))
8439 {
8440 if (ProfanityNames(wname))
8441 {
8442 return false;
8443 }
8444 }
8445
8446 uint32 strictMask = sWorld->getIntConfig(CONFIG_STRICT_CHARTER_NAMES);
8447
8448 return isValidString(wname, strictMask, true);
8449}
#define MAX_CHARTER_NAME
Definition: ObjectMgr.h:691
@ CONFIG_MIN_CHARTER_NAME
Definition: IWorld.h:223
@ CONFIG_STRICT_CHARTER_NAMES
Definition: IWorld.h:219

References CONFIG_MIN_CHARTER_NAME, CONFIG_STRICT_CHARTER_NAMES, CONFIG_STRICT_NAMES_PROFANITY, CONFIG_STRICT_NAMES_RESERVED, isValidString(), MAX_CHARTER_NAME, ProfanityNames(), ReservedNames(), sWorld, and Utf8toWStr().

Referenced by WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandlePetitionRenameOpcode(), ArenaTeam::SetName(), and Guild::SetName().

◆ IsVendorItemValid()

bool ObjectMgr::IsVendorItemValid ( uint32  vendor_entry,
uint32  item,
int32  maxcount,
uint32  ptime,
uint32  ExtendedCost,
Player player = nullptr,
std::set< uint32 > *  skip_vendors = nullptr,
uint32  ORnpcflag = 0 
) const
9331{
9332 /*
9333 CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(vendor_entry);
9334 if (!cInfo)
9335 {
9336 if (player)
9337 ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
9338 else
9339 LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: {}), ignore", vendor_entry);
9340 return false;
9341 }
9342
9343 if (!((cInfo->npcflag | ORnpcflag) & UNIT_NPC_FLAG_VENDOR))
9344 {
9345 if (!skip_vendors || skip_vendors->count(vendor_entry) == 0)
9346 {
9347 if (player)
9348 ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
9349 else
9350 LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have data for not creature template (Entry: {}) without vendor flag, ignore", vendor_entry);
9351
9352 if (skip_vendors)
9353 skip_vendors->insert(vendor_entry);
9354 }
9355 return false;
9356 }
9357 */
9358
9359 if (!sObjectMgr->GetItemTemplate(item_id))
9360 {
9361 if (player)
9363 else
9364 LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` for Vendor (Entry: {}) have in item list non-existed item ({}), ignore", vendor_entry, item_id);
9365 return false;
9366 }
9367
9368 if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
9369 {
9370 if (player)
9372 else
9373 LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have Item (Entry: {}) with wrong ExtendedCost ({}) for vendor ({}), ignore", item_id, ExtendedCost, vendor_entry);
9374 return false;
9375 }
9376
9377 if (maxcount > 0 && incrtime == 0)
9378 {
9379 if (player)
9380 ChatHandler(player->GetSession()).PSendSysMessage("MaxCount != 0 (%u) but IncrTime == 0", maxcount);
9381 else
9382 LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has `maxcount` ({}) for item {} of vendor (Entry: {}) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry);
9383 return false;
9384 }
9385 else if (maxcount == 0 && incrtime > 0)
9386 {
9387 if (player)
9388 ChatHandler(player->GetSession()).PSendSysMessage("MaxCount == 0 but IncrTime<>= 0");
9389 else
9390 LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has `maxcount`=0 for item {} of vendor (Entry: {}) but `incrtime`<>0, ignore", item_id, vendor_entry);
9391 return false;
9392 }
9393
9394 VendorItemData const* vItems = GetNpcVendorItemList(vendor_entry);
9395 if (!vItems)
9396 return true; // later checks for non-empty lists
9397
9398 if (vItems->FindItemCostPair(item_id, ExtendedCost))
9399 {
9400 if (player)
9401 ChatHandler(player->GetSession()).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost);
9402 else
9403 LOG_ERROR("sql.sql", "Table `npc_vendor` has duplicate items {} (with extended cost {}) for vendor (Entry: {}), ignoring", item_id, ExtendedCost, vendor_entry);
9404 return false;
9405 }
9406
9407 return true;
9408}
DBCStorage< ItemExtendedCostEntry > sItemExtendedCostStore(ItemExtendedCostEntryfmt)
@ LANG_ITEM_ALREADY_IN_LIST
Definition: Language.h:248
@ LANG_ITEM_NOT_FOUND
Definition: Language.h:245
@ LANG_EXTENDED_COST_NOT_EXIST
Definition: Language.h:372
Definition: Chat.h:38
void PSendSysMessage(char const *fmt, Args &&... args)
Definition: Chat.h:60
VendorItem const * FindItemCostPair(uint32 item_id, uint32 extendedCost) const
Definition: Creature.cpp:112
WorldSession * GetSession() const
Definition: Player.h:1948
VendorItemData const * GetNpcVendorItemList(uint32 entry) const
Definition: ObjectMgr.h:1373

References VendorItemData::FindItemCostPair(), GetNpcVendorItemList(), Player::GetSession(), LANG_EXTENDED_COST_NOT_EXIST, LANG_ITEM_ALREADY_IN_LIST, LANG_ITEM_NOT_FOUND, LOG_ERROR, ChatHandler::PSendSysMessage(), sItemExtendedCostStore, and sObjectMgr.

Referenced by LoadReferenceVendor(), and LoadVendors().

◆ LoadAccessRequirements()

void ObjectMgr::LoadAccessRequirements ( )
6741{
6742 uint32 oldMSTime = getMSTime();
6743
6744 if (!_accessRequirementStore.empty())
6745 {
6746 for (DungeonProgressionRequirementsContainer::iterator itr = _accessRequirementStore.begin(); itr != _accessRequirementStore.end(); ++itr)
6747 {
6748 std::unordered_map<uint8, DungeonProgressionRequirements*> difficulties = itr->second;
6749 for (auto difficultiesItr = difficulties.begin(); difficultiesItr != difficulties.end(); ++difficultiesItr)
6750 {
6751 for (auto questItr = difficultiesItr->second->quests.begin(); questItr != difficultiesItr->second->quests.end(); ++questItr)
6752 {
6753 delete* questItr;
6754 }
6755
6756 for (auto achievementItr = difficultiesItr->second->achievements.begin(); achievementItr != difficultiesItr->second->achievements.end(); ++achievementItr)
6757 {
6758 delete* achievementItr;
6759 }
6760
6761 for (auto itemsItr = difficultiesItr->second->items.begin(); itemsItr != difficultiesItr->second->items.end(); ++itemsItr)
6762 {
6763 delete* itemsItr;
6764 }
6765
6766 delete difficultiesItr->second;
6767 }
6768 }
6769
6770 _accessRequirementStore.clear(); // need for reload case
6771 }
6772 // 0 1 2 3 4 5
6773 QueryResult access_template_result = WorldDatabase.Query("SELECT id, map_id, difficulty, min_level, max_level, min_avg_item_level FROM dungeon_access_template");
6774 if (!access_template_result)
6775 {
6776 LOG_WARN("server.loading", ">> Loaded 0 access requirement definitions. DB table `dungeon_access_template` is empty.");
6777 LOG_INFO("server.loading", " ");
6778 return;
6779 }
6780
6781 uint32 count = 0;
6782 uint32 countProgressionRequirements = 0;
6783
6784 do
6785 {
6786 Field* fields = access_template_result->Fetch();
6787
6788 //Get the common variables for the access requirements
6789 uint8 dungeon_access_id = fields[0].Get<uint8>();
6790 uint32 mapid = fields[1].Get<uint32>();
6791 uint8 difficulty = fields[2].Get<uint8>();
6792
6793 //Set up the access requirements
6795 ar->levelMin = fields[3].Get<uint8>();
6796 ar->levelMax = fields[4].Get<uint8>();
6797 ar->reqItemLevel = fields[5].Get<uint16>();
6798
6799 // 0 1 2 3 4 6
6800 QueryResult progression_requirements_results = WorldDatabase.Query("SELECT requirement_type, requirement_id, requirement_note, faction, priority, leader_only FROM dungeon_access_requirements where dungeon_access_id = {}", dungeon_access_id);
6801 if (progression_requirements_results)
6802 {
6803 do
6804 {
6805 Field* progression_requirement_row = progression_requirements_results->Fetch();
6806
6807 const uint8 requirement_type = progression_requirement_row[0].Get<uint8>();
6808 const uint32 requirement_id = progression_requirement_row[1].Get<uint32>();
6809 const std::string requirement_note = progression_requirement_row[2].Get<std::string>();
6810 const uint8 requirement_faction = progression_requirement_row[3].Get<uint8>();
6811 const uint8 requirement_priority = progression_requirement_row[4].IsNull() ? UINT8_MAX : progression_requirement_row[4].Get<uint8>();
6812 const bool requirement_checkLeaderOnly = progression_requirement_row[5].Get<bool>();
6813
6814 ProgressionRequirement* progression_requirement = new ProgressionRequirement();
6815 progression_requirement->id = requirement_id;
6816 progression_requirement->note = requirement_note;
6817 progression_requirement->faction = (TeamId)requirement_faction;
6818 progression_requirement->priority = requirement_priority;
6819 progression_requirement->checkLeaderOnly = requirement_checkLeaderOnly;
6820
6821 std::vector<ProgressionRequirement*>* currentRequirementsList = nullptr;
6822
6823 switch (requirement_type)
6824 {
6825 case 0:
6826 {
6827 //Achievement
6828 if (!sAchievementStore.LookupEntry(progression_requirement->id))
6829 {
6830 LOG_ERROR("sql.sql", "Required achievement {} for faction {} does not exist for map {} difficulty {}, remove or fix this achievement requirement.", progression_requirement->id, requirement_faction, mapid, difficulty);
6831 break;
6832 }
6833
6834 currentRequirementsList = &ar->achievements;
6835 break;
6836 }
6837 case 1:
6838 {
6839 //Quest
6840 if (!GetQuestTemplate(progression_requirement->id))
6841 {
6842 LOG_ERROR("sql.sql", "Required quest {} for faction {} does not exist for map {} difficulty {}, remove or fix this quest requirement.", progression_requirement->id, requirement_faction, mapid, difficulty);
6843 break;
6844 }
6845
6846 currentRequirementsList = &ar->quests;
6847 break;
6848 }
6849 case 2:
6850 {
6851 //Item
6852 ItemTemplate const* pProto = GetItemTemplate(progression_requirement->id);
6853 if (!pProto)
6854 {
6855 LOG_ERROR("sql.sql", "Required item {} for faction {} does not exist for map {} difficulty {}, remove or fix this item requirement.", progression_requirement->id, requirement_faction, mapid, difficulty);
6856 break;
6857 }
6858
6859 currentRequirementsList = &ar->items;
6860 break;
6861 }
6862 default:
6863 LOG_ERROR("sql.sql", "requirement_type of {} is not valid for map {} difficulty {}. Please use 0 for achievements, 1 for quest, 2 for items or remove this entry from the db.", requirement_type, mapid, difficulty);
6864 break;
6865 }
6866
6867 //Check if array is valid and delete the progression requirement
6868 if (!currentRequirementsList)
6869 {
6870 delete progression_requirement;
6871 continue;
6872 }
6873
6874 //Insert into the array
6875 if (currentRequirementsList->size() > requirement_priority)
6876 {
6877 currentRequirementsList->insert(currentRequirementsList->begin() + requirement_priority, progression_requirement);
6878 }
6879 else
6880 {
6881 currentRequirementsList->push_back(progression_requirement);
6882 }
6883
6884 } while (progression_requirements_results->NextRow());
6885 }
6886
6887 //Sort all arrays for priority
6888 auto sortFunction = [](const ProgressionRequirement* const a, const ProgressionRequirement* const b) {return a->priority > b->priority; };
6889 std::sort(ar->achievements.begin(), ar->achievements.end(), sortFunction);
6890 std::sort(ar->quests.begin(), ar->quests.end(), sortFunction);
6891 std::sort(ar->items.begin(), ar->items.end(), sortFunction);
6892
6893 countProgressionRequirements += ar->achievements.size();
6894 countProgressionRequirements += ar->quests.size();
6895 countProgressionRequirements += ar->items.size();
6896 count++;
6897
6898 _accessRequirementStore[mapid][difficulty] = ar;
6899 } while (access_template_result->NextRow());
6900
6901 LOG_INFO("server.loading", ">> Loaded {} Rows From dungeon_access_template And {} Rows From dungeon_access_requirements in {} ms", count, countProgressionRequirements, GetMSTimeDiffToNow(oldMSTime));
6902 LOG_INFO("server.loading", " ");
6903}
#define LOG_WARN(filterType__,...)
Definition: Log.h:163
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:131
uint32 getMSTime()
Definition: Timer.h:103
std::shared_ptr< ResultSet > QueryResult
Definition: DatabaseEnvFwd.h:28
DBCStorage< AchievementEntry > sAchievementStore(Achievementfmt)
TeamId
Definition: SharedDefines.h:731
Class used to access individual fields of database query result.
Definition: Field.h:99
bool IsNull() const
Definition: Field.h:107
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition: Field.h:113
Definition: ItemTemplate.h:628
Definition: Player.h:925
uint32 priority
Definition: Player.h:929
Definition: Player.h:934
ItemTemplate const * GetItemTemplate(uint32 entry)
Definition: ObjectMgr.cpp:3287
Quest const * GetQuestTemplate(uint32 quest_id) const
Definition: ObjectMgr.h:832

References _accessRequirementStore, Field::Get(), GetItemTemplate(), getMSTime(), GetMSTimeDiffToNow(), GetQuestTemplate(), Field::IsNull(), LOG_ERROR, LOG_INFO, LOG_WARN, ProgressionRequirement::priority, sAchievementStore, and WorldDatabase.

◆ LoadAcoreStrings()

bool ObjectMgr::LoadAcoreStrings ( )
8577{
8578 uint32 oldMSTime = getMSTime();
8579
8580 _acoreStringStore.clear(); // for reload case
8581 QueryResult result = WorldDatabase.Query("SELECT entry, content_default, locale_koKR, locale_frFR, locale_deDE, locale_zhCN, locale_zhTW, locale_esES, locale_esMX, locale_ruRU FROM acore_string");
8582 if (!result)
8583 {
8584 LOG_WARN("server.loading", ">> Loaded 0 acore strings. DB table `acore_strings` is empty.");
8585 LOG_INFO("server.loading", " ");
8586 return false;
8587 }
8588
8589 do
8590 {
8591 Field* fields = result->Fetch();
8592
8593 uint32 entry = fields[0].Get<uint32>();
8594
8595 AcoreString& data = _acoreStringStore[entry];
8596
8597 data.Content.resize(DEFAULT_LOCALE + 1);
8598
8599 for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
8600 AddLocaleString(fields[i + 1].Get<std::string>(), LocaleConstant(i), data.Content);
8601 } while (result->NextRow());
8602
8603 LOG_INFO("server.loading", ">> Loaded {} Acore Strings in {} ms", (uint32)_acoreStringStore.size(), GetMSTimeDiffToNow(oldMSTime));
8604 LOG_INFO("server.loading", " ");
8605
8606 return true;
8607}
LocaleConstant
Definition: Common.h:74
@ TOTAL_LOCALES
Definition: Common.h:85
static void AddLocaleString(std::string &&s, LocaleConstant locale, std::vector< std::string > &data)
Definition: ObjectMgr.cpp:438

References _acoreStringStore, AddLocaleString(), DEFAULT_LOCALE, Field::Get(), getMSTime(), GetMSTimeDiffToNow(), LOG_INFO, LOG_WARN, TOTAL_LOCALES, and WorldDatabase.

◆ LoadAreaTriggers()

void ObjectMgr::LoadAreaTriggers ( )
6630{
6631 uint32 oldMSTime = getMSTime();
6632
6633 _areaTriggerStore.clear();
6634
6635 QueryResult result = WorldDatabase.Query("SELECT entry, map, x, y, z, radius, length, width, height, orientation FROM areatrigger");
6636
6637 if (!result)
6638 {
6639 LOG_WARN("server.loading", ">> Loaded 0 area trigger definitions. DB table `areatrigger` is empty.");
6640 LOG_INFO("server.loading", " ");
6641 return;
6642 }
6643
6644 uint32 count = 0;
6645
6646 do
6647 {
6648 Field* fields = result->Fetch();
6649
6650 ++count;
6651
6652 AreaTrigger at;
6653
6654 at.entry = fields[0].Get<uint32>();
6655 at.map = fields[1].Get<uint32>();
6656 at.x = fields[2].Get<float>();
6657 at.y = fields[3].Get<float>();
6658 at.z = fields[4].Get<float>();
6659 at.radius = fields[5].Get<float>();
6660 at.length = fields[6].Get<float>();
6661 at.width = fields[7].Get<float>();
6662 at.height = fields[8].Get<float>();
6663 at.orientation = fields[9].Get<float>();
6664
6665 MapEntry const* mapEntry = sMapStore.LookupEntry(at.map);
6666 if (!mapEntry)
6667 {
6668 LOG_ERROR("sql.sql", "Area trigger (ID:{}) map (ID: {}) does not exist in `Map.dbc`.", at.entry, at.map);
6669 continue;
6670 }
6671
6672 _areaTriggerStore[at.entry] = at;
6673 } while (result->NextRow());
6674
6675 LOG_INFO("server.loading", ">> Loaded {} Area Trigger Definitions in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
6676 LOG_INFO("server.loading", " ");
6677}
float height
Definition: ObjectMgr.h:430
float x
Definition: ObjectMgr.h:424
float y
Definition: ObjectMgr.h:425
float orientation
Definition: ObjectMgr.h:431
float length
Definition: ObjectMgr.h:428
uint32 entry
Definition: ObjectMgr.h:422
float radius
Definition: ObjectMgr.h:427
float z
Definition: ObjectMgr.h:426
float width
Definition: ObjectMgr.h:429

References _areaTriggerStore, AreaTrigger::entry, Field::Get(), getMSTime(), GetMSTimeDiffToNow(), AreaTrigger::height, AreaTrigger::length, LOG_ERROR, LOG_INFO, LOG_WARN, AreaTrigger::map, AreaTrigger::orientation, AreaTrigger::radius, sMapStore, AreaTrigger::width, WorldDatabase, AreaTrigger::x, AreaTrigger::y, and AreaTrigger::z.

◆ LoadAreaTriggerScripts()

void ObjectMgr::LoadAreaTriggerScripts ( )
6490{
6491 uint32 oldMSTime = getMSTime();
6492
6493 _areaTriggerScriptStore.clear(); // need for reload case
6494 QueryResult result = WorldDatabase.Query("SELECT entry, ScriptName FROM areatrigger_scripts");
6495
6496 if (!result)
6497 {
6498 LOG_WARN("server.loading", ">> Loaded 0 Areatrigger Scripts. DB Table `areatrigger_scripts` Is Empty.");
6499 LOG_INFO("server.loading", " ");
6500 return;
6501 }
6502
6503 uint32 count = 0;
6504
6505 do
6506 {
6507 ++count;
6508
6509 Field* fields = result->Fetch();
6510
6511 uint32 Trigger_ID = fields[0].Get<uint32>();
6512 std::string scriptName = fields[1].Get<std::string>();
6513
6514 AreaTrigger const* atEntry = GetAreaTrigger(Trigger_ID);
6515 if (!atEntry)
6516 {
6517 LOG_ERROR("sql.sql", "Area trigger (ID:{}) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
6518 continue;
6519 }
6520 _areaTriggerScriptStore[Trigger_ID] = GetScriptId(scriptName);
6521 } while (result->NextRow());
6522
6523 LOG_INFO("server.loading", ">> Loaded {} Areatrigger Scripts in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
6524 LOG_INFO("server.loading", " ");
6525}
uint32 GetScriptId(std::string const &name)
Definition: ObjectMgr.cpp:9472

References _areaTriggerScriptStore, Field::Get(), GetAreaTrigger(), getMSTime(), GetMSTimeDiffToNow(), GetScriptId(), LOG_ERROR, LOG_INFO, LOG_WARN, and WorldDatabase.

◆ LoadAreaTriggerTeleports()

void ObjectMgr::LoadAreaTriggerTeleports ( )
6680{
6681 uint32 oldMSTime = getMSTime();
6682
6683 _areaTriggerTeleportStore.clear(); // need for reload case
6684
6685 // 0 1 2 3 4 5
6686 QueryResult result = WorldDatabase.Query("SELECT ID, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
6687
6688 if (!result)
6689 {
6690 LOG_WARN("server.loading", ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty.");
6691 LOG_INFO("server.loading", " ");
6692 return;
6693 }
6694
6695 uint32 count = 0;
6696
6697 do
6698 {
6699 Field* fields = result->Fetch();
6700
6701 ++count;
6702
6703 uint32 Trigger_ID = fields[0].Get<uint32>();
6704
6706
6707 at.target_mapId = fields[1].Get<uint16>();
6708 at.target_X = fields[2].Get<float>();
6709 at.target_Y = fields[3].Get<float>();
6710 at.target_Z = fields[4].Get<float>();
6711 at.target_Orientation = fields[5].Get<float>();
6712
6713 AreaTrigger const* atEntry = GetAreaTrigger(Trigger_ID);
6714 if (!atEntry)
6715 {
6716 LOG_ERROR("sql.sql", "Area trigger (ID:{}) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
6717 continue;
6718 }
6719
6720 MapEntry const* mapEntry = sMapStore.LookupEntry(at.target_mapId);
6721 if (!mapEntry)
6722 {
6723 LOG_ERROR("sql.sql", "Area trigger (ID:{}) target map (ID: {}) does not exist in `Map.dbc`.", Trigger_ID, at.target_mapId);
6724 continue;
6725 }
6726
6727 if (at.target_X == 0 && at.target_Y == 0 && at.target_Z == 0)
6728 {
6729 LOG_ERROR("sql.sql", "Area trigger (ID:{}) target coordinates not provided.", Trigger_ID);
6730 continue;
6731 }
6732
6733 _areaTriggerTeleportStore[Trigger_ID] = at;
6734 } while (result->NextRow());
6735
6736 LOG_INFO("server.loading", ">> Loaded {} Area Trigger Teleport Definitions in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
6737 LOG_INFO("server.loading", " ");
6738}
Definition: ObjectMgr.h:412
uint32 target_mapId
Definition: ObjectMgr.h:413

References _areaTriggerTeleportStore, Field::Get(), GetAreaTrigger(), getMSTime(), GetMSTimeDiffToNow(), LOG_ERROR, LOG_INFO, LOG_WARN, sMapStore, AreaTriggerTeleport::target_mapId, and WorldDatabase.

◆ LoadBroadcastTextLocales()

void ObjectMgr::LoadBroadcastTextLocales ( )
9572{
9573 uint32 oldMSTime = getMSTime();
9574
9575 // 0 1 2 3
9576 QueryResult result = WorldDatabase.Query("SELECT ID, locale, MaleText, FemaleText FROM broadcast_text_locale");
9577
9578 if (!result)
9579 {
9580 LOG_WARN("server.loading", ">> Loaded 0 broadcast text locales. DB table `broadcast_text_locale` is empty.");
9581 LOG_INFO("server.loading", " ");
9582 return;
9583 }
9584
9585 uint32 locales_count = 0;
9586 do
9587 {
9588 Field* fields = result->Fetch();
9589
9590 uint32 id = fields[0].Get<uint32>();
9591
9592 BroadcastTextContainer::iterator bct = _broadcastTextStore.find(id);
9593 if (bct == _broadcastTextStore.end())
9594 {
9595 LOG_ERROR("sql.sql", "BroadcastText (Id: {}) found in table `broadcast_text_locale` but does not exist in `broadcast_text`. Skipped!", id);
9596 continue;
9597 }
9598
9599 LocaleConstant locale = GetLocaleByName(fields[1].Get<std::string>());
9600 if (locale == LOCALE_enUS)
9601 continue;
9602
9603 AddLocaleString(fields[2].Get<std::string>(), locale, bct->second.MaleText);
9604 AddLocaleString(fields[3].Get<std::string>(), locale, bct->second.FemaleText);
9605 locales_count++;
9606 } while (result->NextRow());
9607
9608 LOG_INFO("server.loading", ">> Loaded {} Broadcast Text Locales in {} ms", locales_count, GetMSTimeDiffToNow(oldMSTime));
9609 LOG_INFO("server.loading", " ");
9610}
LocaleConstant GetLocaleByName(const std::string &name)
Definition: Common.cpp:33

References _broadcastTextStore, AddLocaleString(), Field::Get(), GetLocaleByName(), getMSTime(), GetMSTimeDiffToNow(), LOCALE_enUS, LOG_ERROR, LOG_INFO, LOG_WARN, and WorldDatabase.

◆ LoadBroadcastTexts()

void ObjectMgr::LoadBroadcastTexts ( )
9487{
9488 uint32 oldMSTime = getMSTime();
9489
9490 _broadcastTextStore.clear(); // for reload case
9491
9492 // 0 1 2 3 4 5 6 7 8 9 10 11 12
9493 QueryResult result = WorldDatabase.Query("SELECT ID, LanguageID, MaleText, FemaleText, EmoteID1, EmoteID2, EmoteID3, EmoteDelay1, EmoteDelay2, EmoteDelay3, SoundEntriesID, EmotesID, Flags FROM broadcast_text");
9494 if (!result)
9495 {
9496 LOG_WARN("server.loading", ">> Loaded 0 broadcast texts. DB table `broadcast_text` is empty.");
9497 LOG_INFO("server.loading", " ");
9498 return;
9499 }
9500
9501 _broadcastTextStore.rehash(result->GetRowCount());
9502
9503 do
9504 {
9505 Field* fields = result->Fetch();
9506
9507 BroadcastText bct;
9508
9509 bct.Id = fields[0].Get<uint32>();
9510 bct.LanguageID = fields[1].Get<uint32>();
9511 bct.MaleText[DEFAULT_LOCALE] = fields[2].Get<std::string>();
9512 bct.FemaleText[DEFAULT_LOCALE] = fields[3].Get<std::string>();
9513 bct.EmoteId1 = fields[4].Get<uint32>();
9514 bct.EmoteId2 = fields[5].Get<uint32>();
9515 bct.EmoteId3 = fields[6].Get<uint32>();
9516 bct.EmoteDelay1 = fields[7].Get<uint32>();
9517 bct.EmoteDelay2 = fields[8].Get<uint32>();
9518 bct.EmoteDelay3 = fields[9].Get<uint32>();
9519 bct.SoundEntriesId = fields[10].Get<uint32>();
9520 bct.EmotesID = fields[11].Get<uint32>();
9521 bct.Flags = fields[12].Get<uint32>();
9522
9523 if (bct.SoundEntriesId)
9524 {
9525 if (!sSoundEntriesStore.LookupEntry(bct.SoundEntriesId))
9526 {
9527 LOG_DEBUG("misc", "BroadcastText (Id: {}) in table `broadcast_text` has SoundEntriesId {} but sound does not exist.", bct.Id, bct.SoundEntriesId);
9528 bct.SoundEntriesId = 0;
9529 }
9530 }
9531
9533 {
9534 LOG_DEBUG("misc", "BroadcastText (Id: {}) in table `broadcast_text` using Language {} but Language does not exist.", bct.Id, bct.LanguageID);
9536 }
9537
9538 if (bct.EmoteId1)
9539 {
9540 if (!sEmotesStore.LookupEntry(bct.EmoteId1))
9541 {
9542 LOG_DEBUG("misc", "BroadcastText (Id: {}) in table `broadcast_text` has EmoteId1 {} but emote does not exist.", bct.Id, bct.EmoteId1);
9543 bct.EmoteId1 = 0;
9544 }
9545 }
9546
9547 if (bct.EmoteId2)
9548 {
9549 if (!sEmotesStore.LookupEntry(bct.EmoteId2))
9550 {
9551 LOG_DEBUG("misc", "BroadcastText (Id: {}) in table `broadcast_text` has EmoteId2 {} but emote does not exist.", bct.Id, bct.EmoteId2);
9552 bct.EmoteId2 = 0;
9553 }
9554 }
9555
9556 if (bct.EmoteId3)
9557 {
9558 if (!sEmotesStore.LookupEntry(bct.EmoteId3))
9559 {
9560 LOG_DEBUG("misc", "BroadcastText (Id: {}) in table `broadcast_text` has EmoteId3 {} but emote does not exist.", bct.Id, bct.EmoteId3);
9561 bct.EmoteId3 = 0;
9562 }
9563 }
9564
9565 _broadcastTextStore[bct.Id] = bct;
9566 } while (result->NextRow());
9567
9568 LOG_INFO("server.loading", ">> Loaded {} Broadcast Texts in {} ms", _broadcastTextStore.size(), GetMSTimeDiffToNow(oldMSTime));
9569}
DBCStorage< SoundEntriesEntry > sSoundEntriesStore(SoundEntriesfmt)
DBCStorage< EmotesEntry > sEmotesStore(EmotesEntryfmt)
LanguageDesc const * GetLanguageDescByID(uint32 lang)
Definition: ObjectMgr.cpp:309
@ LANG_UNIVERSAL
Definition: SharedDefines.h:707
Definition: ObjectMgr.h:435
uint32 EmoteDelay2
Definition: ObjectMgr.h:450
uint32 Id
Definition: ObjectMgr.h:442
std::vector< std::string > FemaleText
Definition: ObjectMgr.h:445
uint32 EmotesID
Definition: ObjectMgr.h:453
uint32 LanguageID
Definition: ObjectMgr.h:443
uint32 EmoteId2
Definition: ObjectMgr.h:447
uint32 EmoteDelay1
Definition: ObjectMgr.h:449
uint32 SoundEntriesId
Definition: ObjectMgr.h:452
std::vector< std::string > MaleText
Definition: ObjectMgr.h:444
uint32 EmoteId3
Definition: ObjectMgr.h:448
uint32 EmoteId1
Definition: ObjectMgr.h:446
uint32 EmoteDelay3
Definition: ObjectMgr.h:451
uint32 Flags
Definition: ObjectMgr.h:454

References _broadcastTextStore, DEFAULT_LOCALE, BroadcastText::EmoteDelay1, BroadcastText::EmoteDelay2, BroadcastText::EmoteDelay3, BroadcastText::EmoteId1, BroadcastText::EmoteId2, BroadcastText::EmoteId3, BroadcastText::EmotesID, BroadcastText::FemaleText, BroadcastText::Flags, Field::Get(), GetLanguageDescByID(), getMSTime(), GetMSTimeDiffToNow(), BroadcastText::Id, LANG_UNIVERSAL, BroadcastText::LanguageID, LOG_DEBUG, LOG_INFO, LOG_WARN, BroadcastText::MaleText, sEmotesStore, BroadcastText::SoundEntriesId, sSoundEntriesStore, and WorldDatabase.

◆ LoadCreatureAddons()

void ObjectMgr::LoadCreatureAddons ( )
1343{
1344 uint32 oldMSTime = getMSTime();
1345
1346 // 0 1 2 3 4 5 6 7
1347 QueryResult result = WorldDatabase.Query("SELECT guid, path_id, mount, bytes1, bytes2, emote, visibilityDistanceType, auras FROM creature_addon");
1348
1349 if (!result)
1350 {
1351 LOG_WARN("server.loading", ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty.");
1352 LOG_INFO("server.loading", " ");
1353 return;
1354 }
1355
1356 uint32 count = 0;
1357 do
1358 {
1359 Field* fields = result->Fetch();
1360
1361 ObjectGuid::LowType guid = fields[0].Get<uint32>();
1362
1363 CreatureData const* creData = GetCreatureData(guid);
1364 if (!creData)
1365 {
1366 LOG_ERROR("sql.sql", "Creature (GUID: {}) does not exist but has a record in `creature_addon`", guid);
1367 continue;
1368 }
1369
1370 CreatureAddon& creatureAddon = _creatureAddonStore[guid];
1371
1372 creatureAddon.path_id = fields[1].Get<uint32>();
1373 if (creData->movementType == WAYPOINT_MOTION_TYPE && !creatureAddon.path_id)
1374 {
1375 const_cast<CreatureData*>(creData)->movementType = IDLE_MOTION_TYPE;
1376 LOG_ERROR("sql.sql", "Creature (GUID {}) has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid);
1377 }
1378
1379 creatureAddon.mount = fields[2].Get<uint32>();
1380 creatureAddon.bytes1 = fields[3].Get<uint32>();
1381 creatureAddon.bytes2 = fields[4].Get<uint32>();
1382 creatureAddon.emote = fields[5].Get<uint32>();
1383 creatureAddon.visibilityDistanceType = VisibilityDistanceType(fields[6].Get<uint8>());
1384
1385 for (std::string_view aura : Acore::Tokenize(fields[7].Get<std::string_view>(), ' ', false))
1386 {
1387 SpellInfo const* spellInfo = nullptr;
1388
1389 if (Optional<uint32> spellId = Acore::StringTo<uint32>(aura))
1390 {
1391 spellInfo = sSpellMgr->GetSpellInfo(*spellId);
1392 }
1393
1394 if (!spellInfo)
1395 {
1396 LOG_ERROR("sql.sql", "Creature (GUID: {}) has wrong spell '{}' defined in `auras` field in `creature_addon`.", guid, aura);
1397 continue;
1398 }
1399
1400 if (std::find(creatureAddon.auras.begin(), creatureAddon.auras.end(), spellInfo->Id) != creatureAddon.auras.end())
1401 {
1402 LOG_ERROR("sql.sql", "Creature (GUID: {}) has duplicate aura (spell {}) in `auras` field in `creature_addon`.", guid, spellInfo->Id);
1403 continue;
1404 }
1405
1406 if (spellInfo->GetDuration() > 0)
1407 {
1408 LOG_DEBUG/*ERROR*/("sql.sql", "Creature (Entry: {}) has temporary aura (spell {}) in `auras` field in `creature_template_addon`.", guid, spellInfo->Id);
1409 // continue;
1410 }
1411
1412 creatureAddon.auras.push_back(spellInfo->Id);
1413 }
1414
1415 if (creatureAddon.mount)
1416 {
1417 if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount))
1418 {
1419 LOG_ERROR("sql.sql", "Creature (GUID: {}) has invalid displayInfoId ({}) for mount defined in `creature_addon`", guid, creatureAddon.mount);
1420 creatureAddon.mount = 0;
1421 }
1422 }
1423
1424 if (!sEmotesStore.LookupEntry(creatureAddon.emote))
1425 {
1426 LOG_ERROR("sql.sql", "Creature (GUID: {}) has invalid emote ({}) defined in `creature_addon`.", guid, creatureAddon.emote);
1427 creatureAddon.emote = 0;
1428 }
1429
1430 if (creatureAddon.visibilityDistanceType >= VisibilityDistanceType::Max)
1431 {
1432 LOG_ERROR("sql.sql", "Creature (GUID: {}) has invalid visibilityDistanceType ({}) defined in `creature_addon`.", guid, AsUnderlyingType(creatureAddon.visibilityDistanceType));
1433 creatureAddon.visibilityDistanceType = VisibilityDistanceType::Normal;
1434 }
1435
1436 ++count;
1437 } while (result->NextRow());
1438
1439 LOG_INFO("server.loading", ">> Loaded {} Creature Addons in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
1440 LOG_INFO("server.loading", " ");
1441}
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:24
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
Definition: Util.h:614
VisibilityDistanceType
Definition: ObjectDefines.h:61
@ WAYPOINT_MOTION_TYPE
Definition: MotionMaster.h:39
std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
Definition: Tokenize.cpp:20
Definition: CreatureData.h:429
std::vector< uint32 > auras
Definition: CreatureData.h:435
uint32 mount
Definition: CreatureData.h:431
uint32 emote
Definition: CreatureData.h:434
uint32 path_id
Definition: CreatureData.h:430
VisibilityDistanceType visibilityDistanceType
Definition: CreatureData.h:436
uint32 bytes1
Definition: CreatureData.h:432
uint32 bytes2
Definition: CreatureData.h:433
uint32 Id
Definition: SpellInfo.h:318
int32 GetDuration() const
Definition: SpellInfo.cpp:2321

References _creatureAddonStore, AsUnderlyingType(), CreatureAddon::auras, CreatureAddon::bytes1, CreatureAddon::bytes2, CreatureAddon::emote, Field::Get(), GetCreatureData(), SpellInfo::GetDuration(), getMSTime(), GetMSTimeDiffToNow(), SpellInfo::Id, IDLE_MOTION_TYPE, LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARN, CreatureAddon::mount, CreatureAddon::path_id, sCreatureDisplayInfoStore, sEmotesStore, sSpellMgr, Acore::Tokenize(), CreatureAddon::visibilityDistanceType, WAYPOINT_MOTION_TYPE, and WorldDatabase.

◆ LoadCreatureClassLevelStats()

void ObjectMgr::LoadCreatureClassLevelStats ( )
9639{
9640 uint32 oldMSTime = getMSTime();
9641
9642 QueryResult result = WorldDatabase.Query("SELECT level, class, basehp0, basehp1, basehp2, basemana, basearmor, attackpower, rangedattackpower, damage_base, damage_exp1, damage_exp2 FROM creature_classlevelstats");
9643
9644 if (!result)
9645 {
9646 LOG_WARN("server.loading", ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty.");
9647 LOG_INFO("server.loading", " ");
9648 return;
9649 }
9650
9651 uint32 count = 0;
9652 do
9653 {
9654 Field* fields = result->Fetch();
9655
9656 uint8 Level = fields[0].Get<uint8>();
9657 uint8 Class = fields[1].Get<uint8>();
9658
9659 if (!Class || ((1 << (Class - 1)) & CLASSMASK_ALL_CREATURES) == 0)
9660 LOG_ERROR("sql.sql", "Creature base stats for level {} has invalid class {}", Level, Class);
9661
9662 CreatureBaseStats stats;
9663
9664 for (uint8 i = 0; i < MAX_EXPANSIONS; ++i)
9665 {
9666 stats.BaseHealth[i] = fields[2 + i].Get<uint32>();
9667
9668 if (stats.BaseHealth[i] == 0)
9669 {
9670 LOG_ERROR("sql.sql", "Creature base stats for class {}, level {} has invalid zero base HP[{}] - set to 1", Class, Level, i);
9671 stats.