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

GameObjectTemplate const * GetGameObjectTemplate (uint32 entry)
 
bool IsGameObjectStaticTransport (uint32 entry)
 
GameObjectTemplateContainer const * GetGameObjectTemplates () const
 
int LoadReferenceVendor (int32 vendor, int32 item_id, std::set< uint32 > *skip_vendors)
 
void LoadGameObjectTemplate ()
 
void LoadGameObjectTemplateAddons ()
 
void AddGameobjectInfo (GameObjectTemplate *goinfo)
 
CreatureTemplate const * GetCreatureTemplate (uint32 entry)
 
CreatureTemplateContainer const * GetCreatureTemplates () const
 
CreatureModelInfo const * GetCreatureModelInfo (uint32 modelId) const
 
CreatureModelInfo const * GetCreatureModelRandomGender (CreatureModel *model, CreatureTemplate const *creatureTemplate) const
 
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)
 
ItemTemplateContainer const * GetItemTemplateStore () const
 
std::vector< ItemTemplate * > const * GetItemTemplateStoreFast () const
 
ItemSetNameEntry const * GetItemSetNameEntry (uint32 itemId)
 
InstanceTemplate const * GetInstanceTemplate (uint32 mapId)
 
PetLevelInfo const * GetPetLevelInfo (uint32 creature_id, uint8 level) const
 
PlayerClassInfo const * GetPlayerClassInfo (uint32 class_) 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)
 
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
 
GossipText const * GetGossipText (uint32 Text_ID) const
 
AreaTrigger const * GetAreaTrigger (uint32 trigger) const
 
AreaTriggerTeleport const * GetAreaTriggerTeleport (uint32 trigger) const
 
DungeonProgressionRequirements const * GetAccessRequirement (uint32 mapid, Difficulty difficulty) const
 
AreaTriggerTeleport const * GetGoBackTrigger (uint32 Map) const
 
AreaTriggerTeleport const * GetMapEntranceTrigger (uint32 Map) const
 
AreaTriggerScriptContainer const & GetAllAreaTriggerScriptData () const
 
uint32 GetAreaTriggerScriptId (uint32 trigger_id)
 
SpellScriptsBounds GetSpellScriptsBounds (uint32 spell_id)
 
RepRewardRate const * GetRepRewardRate (uint32 factionId) const
 
ReputationOnKillEntry const * GetReputationOnKilEntry (uint32 id) const
 
int32 GetBaseReputationOf (FactionEntry const *factionEntry, uint8 race, uint8 playerClass)
 
RepSpilloverTemplate const * GetRepSpilloverTemplate (uint32 factionId) const
 
PointOfInterest const * GetPointOfInterest (uint32 id) const
 
QuestPOIVector const * GetQuestPOIVector (uint32 questId)
 
VehicleAccessoryList const * GetVehicleAccessoryList (Vehicle *veh) const
 
DungeonEncounterList const * GetDungeonEncounterList (uint32 mapId, Difficulty difficulty)
 
void LoadQuests ()
 
void LoadQuestMoneyRewards ()
 
void LoadQuestStartersAndEnders ()
 
void LoadGameobjectQuestStarters ()
 
void LoadGameobjectQuestEnders ()
 
void LoadCreatureQuestStarters ()
 
void LoadCreatureQuestEnders ()
 
QuestRelationsGetGOQuestRelationMap ()
 
QuestRelationsGetGOQuestInvolvedRelationMap ()
 
QuestRelationBounds GetGOQuestRelationBounds (uint32 go_entry)
 
QuestRelationBounds GetGOQuestInvolvedRelationBounds (uint32 go_entry)
 
QuestRelationsGetCreatureQuestRelationMap ()
 
QuestRelationsGetCreatureQuestInvolvedRelationMap ()
 
QuestRelationBounds GetCreatureQuestRelationBounds (uint32 creature_entry)
 
QuestRelationBounds GetCreatureQuestInvolvedRelationBounds (uint32 creature_entry)
 
void LoadEventScripts ()
 
void LoadSpellScripts ()
 
void LoadWaypointScripts ()
 
void LoadSpellScriptNames ()
 
void ValidateSpellScripts ()
 
void InitializeSpellInfoPrecomputedData ()
 
bool LoadModuleStrings ()
 
bool LoadModuleStringsLocale ()
 
bool LoadAcoreStrings ()
 
void LoadBroadcastTexts ()
 
void LoadBroadcastTextLocales ()
 
void LoadCreatureClassLevelStats ()
 
void LoadCreatureLocales ()
 
void LoadCreatureTemplates ()
 
void LoadCreatureTemplate (Field *fields, bool triggerHook=false)
 Loads a creature template from a database result. More...
 
void LoadCreatureTemplateModels ()
 
void LoadCreatureTemplateAddons ()
 
void LoadCreatureTemplateResistances ()
 
void LoadCreatureTemplateSpells ()
 
void LoadCreatureCustomIDs ()
 Load config option Creatures.CustomIDs into Store. More...
 
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 LoadVehicleSeatAddon ()
 
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
 
int32 GetFishingBaseSkillLevel (uint32 entry) const
 
void ReturnOrDeleteOldMails (bool serverUp)
 
CreatureBaseStats const * GetCreatureBaseStats (uint8 level, uint8 unitClass)
 
void SetHighestGuids ()
 
template<HighGuid type>
ObjectGuidGeneratorBaseGetGenerator ()
 
uint32 GenerateAuctionID ()
 
uint64 GenerateEquipmentSetGuid ()
 
uint32 GenerateMailID ()
 
uint32 GeneratePetNumber ()
 
ObjectGuid::LowType GenerateCreatureSpawnId ()
 
ObjectGuid::LowType GenerateGameObjectSpawnId ()
 
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)
 
void DeleteCreatureData (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
 
QuestOfferRewardLocale const * GetQuestOfferRewardLocale (uint32 entry) const
 
QuestRequestItemsLocale const * GetQuestRequestItemsLocale (uint32 entry) const
 
NpcTextLocale const * GetNpcTextLocale (uint32 entry) const
 
QuestGreeting const * GetQuestGreeting (TypeID type, uint32 id) const
 
GameObjectDataNewGOData (ObjectGuid::LowType guid)
 
void DeleteGOData (ObjectGuid::LowType guid)
 
ModuleString const * GetModuleString (std::string module, uint32 id) const
 
std::string const * GetModuleString (std::string module, uint32 id, LocaleConstant locale) const
 
AcoreString const * GetAcoreString (uint32 entry) const
 
char const * GetAcoreString (uint32 entry, LocaleConstant locale) const
 
char const * GetAcoreStringForDBCLocale (uint32 entry) const
 
LocaleConstant GetDBCLocaleIndex () const
 
void SetDBCLocaleIndex (LocaleConstant locale)
 
void AddCreatureToGrid (ObjectGuid::LowType guid, CreatureData const *data)
 
void RemoveCreatureFromGrid (ObjectGuid::LowType guid, CreatureData const *data)
 
void AddGameobjectToGrid (ObjectGuid::LowType guid, GameObjectData const *data)
 
void RemoveGameobjectFromGrid (ObjectGuid::LowType guid, GameObjectData const *data)
 
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 LoadReservedPlayerNamesDB ()
 
void LoadReservedPlayerNamesDBC ()
 
bool IsReservedName (std::string_view name) const
 
void AddReservedPlayerName (std::string const &name)
 
void LoadProfanityNamesFromDB ()
 
void LoadProfanityNamesFromDBC ()
 
bool IsProfanityName (std::string_view name) const
 
void AddProfanityPlayerName (std::string const &name)
 
GameTele const * GetGameTele (uint32 id) const
 
GameTele const * GetGameTele (std::string_view name, bool exactSearch=false) const
 
GameTeleContainer const & GetGameTeleMap () const
 
bool AddGameTele (GameTele &data)
 
bool DeleteGameTele (std::string_view name)
 
TrainerSpellData const * GetNpcTrainerSpells (uint32 entry) const
 
VendorItemData const * GetNpcVendorItemList (uint32 entry) const
 
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 ()
 
ScriptNameContainerGetScriptNames ()
 
std::string const & GetScriptName (uint32 id) const
 
uint32 GetScriptId (std::string const &name)
 
SpellClickInfoMapBounds GetSpellClickInfoMapBounds (uint32 creature_id) const
 
GossipMenusMapBounds GetGossipMenusMapBounds (uint32 uiMenuId) const
 
GossipMenusMapBoundsNonConst GetGossipMenusMapBoundsNonConst (uint32 uiMenuId)
 
GossipMenuItemsMapBounds GetGossipMenuItemsMapBounds (uint32 uiMenuId) const
 
GossipMenuItemsMapBoundsNonConst GetGossipMenuItemsMapBoundsNonConst (uint32 uiMenuId)
 
void LoadFactionChangeAchievements ()
 
void LoadFactionChangeItems ()
 
void LoadFactionChangeQuests ()
 
void LoadFactionChangeReputations ()
 
void LoadFactionChangeSpells ()
 
void LoadFactionChangeTitles ()
 
bool IsTransportMap (uint32 mapId) const
 
VehicleSeatAddon const * GetVehicleSeatAddon (uint32 seatId) const
 
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
 

Static Public Member Functions

static ObjectMgrinstance ()
 
static CreatureModel const * 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)
 
static std::string_view GetLocaleString (std::vector< std::string > const &data, std::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

 ObjectMgr ()
 
 ~ObjectMgr ()
 
template<HighGuid high>
ObjectGuidGeneratorBaseGetGuidSequenceGenerator ()
 
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
 

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
 
ProfanityNamesContainer _profanityNamesStore
 
GameTeleContainer _gameTeleStore
 
ScriptNameContainer _scriptNamesStore
 
SpellClickInfoContainer _spellClickInfoStore
 
SpellScriptsContainer _spellScriptsStore
 
VehicleAccessoryContainer _vehicleTemplateAccessoryStore
 
VehicleAccessoryContainer _vehicleAccessoryStore
 
VehicleSeatAddonContainer _vehicleSeatAddonStore
 
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. More...
 
BroadcastTextContainer _broadcastTextStore
 
ItemTemplateContainer _itemTemplateStore
 
std::vector< ItemTemplate * > _itemTemplateStoreFast
 
ItemLocaleContainer _itemLocaleStore
 
ItemSetNameLocaleContainer _itemSetNameLocaleStore
 
QuestLocaleContainer _questLocaleStore
 
QuestOfferRewardLocaleContainer _questOfferRewardLocaleStore
 
QuestRequestItemsLocaleContainer _questRequestItemsLocaleStore
 
NpcTextLocaleContainer _npcTextLocaleStore
 
PageTextLocaleContainer _pageTextLocaleStore
 
ModuleStringContainer _moduleStringStore
 
AcoreStringContainer _acoreStringStore
 
GossipMenuItemsLocaleContainer _gossipMenuItemsLocaleStore
 
PointOfInterestLocaleContainer _pointOfInterestLocaleStore
 
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
 

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 
1615 {
1617 CREATURE_TO_GO, // Creature is dependant on GO
1618 GO_TO_GO,
1619 GO_TO_CREATURE, // GO is dependant on creature
1620 };
@ CREATURE_TO_GO
Definition: ObjectMgr.h:1617
@ CREATURE_TO_CREATURE
Definition: ObjectMgr.h:1616
@ GO_TO_GO
Definition: ObjectMgr.h:1618
@ GO_TO_CREATURE
Definition: ObjectMgr.h:1619

Constructor & Destructor Documentation

◆ ObjectMgr()

ObjectMgr::ObjectMgr ( )
private
299 :
300 _auctionId(1),
302 _mailId(1),
303 _hiPetNumber(1),
307{
308 for (uint8 i = 0; i < MAX_CLASSES; ++i)
309 {
310 _playerClassInfo[i] = nullptr;
311 for (uint8 j = 0; j < MAX_RACES; ++j)
312 _playerInfo[j][i] = nullptr;
313 }
314}
@ LOCALE_enUS
Definition: Common.h:66
std::uint8_t uint8
Definition: Define.h:109
#define MAX_RACES
Definition: SharedDefines.h:95
#define MAX_CLASSES
Definition: SharedDefines.h:155
PlayerInfo * _playerInfo[MAX_RACES][MAX_CLASSES]
Definition: ObjectMgr.h:1546
ObjectGuid::LowType _gameObjectSpawnId
Definition: ObjectMgr.h:1457
uint32 _mailId
Definition: ObjectMgr.h:1451
ObjectGuid::LowType _creatureSpawnId
Definition: ObjectMgr.h:1456
LocaleConstant DBCLocaleIndex
Definition: ObjectMgr.h:1524
PlayerClassInfo * _playerClassInfo[MAX_CLASSES]
Definition: ObjectMgr.h:1542
uint64 _equipmentSetGuid
Definition: ObjectMgr.h:1450
uint32 _auctionId
Definition: ObjectMgr.h:1449
uint32 _hiPetNumber
Definition: ObjectMgr.h:1453

References _playerClassInfo, _playerInfo, MAX_CLASSES, and MAX_RACES.

◆ ~ObjectMgr()

ObjectMgr::~ObjectMgr ( )
private
317{
318 for (QuestMap::iterator i = _questTemplates.begin(); i != _questTemplates.end(); ++i)
319 delete i->second;
320
321 for (PetLevelInfoContainer::iterator i = _petInfoStore.begin(); i != _petInfoStore.end(); ++i)
322 delete[] i->second;
323
324 // free only if loaded
325 for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
326 {
327 if (_playerClassInfo[class_])
328 delete[] _playerClassInfo[class_]->levelInfo;
329 delete _playerClassInfo[class_];
330 }
331
332 for (int race = 0; race < MAX_RACES; ++race)
333 {
334 for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
335 {
336 if (_playerInfo[race][class_])
337 delete[] _playerInfo[race][class_]->levelInfo;
338 delete _playerInfo[race][class_];
339 }
340 }
341
342 for (CacheVendorItemContainer::iterator itr = _cacheVendorItemStore.begin(); itr != _cacheVendorItemStore.end(); ++itr)
343 itr->second.Clear();
344
346
347 for (DungeonEncounterContainer::iterator itr = _dungeonEncounterStore.begin(); itr != _dungeonEncounterStore.end(); ++itr)
348 for (DungeonEncounterList::iterator encounterItr = itr->second.begin(); encounterItr != itr->second.end(); ++encounterItr)
349 delete *encounterItr;
350
351 for (DungeonProgressionRequirementsContainer::iterator itr = _accessRequirementStore.begin(); itr != _accessRequirementStore.end(); ++itr)
352 {
353 std::unordered_map<uint8, DungeonProgressionRequirements*> difficulties = itr->second;
354 for (auto difficultiesItr = difficulties.begin(); difficultiesItr != difficulties.end(); ++difficultiesItr)
355 {
356 for (auto questItr = difficultiesItr->second->quests.begin(); questItr != difficultiesItr->second->quests.end(); ++questItr)
357 {
358 delete* questItr;
359 }
360
361 for (auto achievementItr = difficultiesItr->second->achievements.begin(); achievementItr != difficultiesItr->second->achievements.end(); ++achievementItr)
362 {
363 delete* achievementItr;
364 }
365
366 for (auto itemsItr = difficultiesItr->second->items.begin(); itemsItr != difficultiesItr->second->items.end(); ++itemsItr)
367 {
368 delete* itemsItr;
369 }
370
371 delete difficultiesItr->second;
372 }
373 }
374}
PlayerClassLevelInfo * levelInfo
Definition: Player.h:299
PlayerLevelInfo * levelInfo
Definition: Player.h:353
CacheTrainerSpellContainer _cacheTrainerSpellStore
Definition: ObjectMgr.h:1607
PetLevelInfoContainer _petInfoStore
Definition: ObjectMgr.h:1540
QuestMap _questTemplates
Definition: ObjectMgr.h:1472
DungeonProgressionRequirementsContainer _accessRequirementStore
Definition: ObjectMgr.h:1486
DungeonEncounterContainer _dungeonEncounterStore
Definition: ObjectMgr.h:1487
CacheVendorItemContainer _cacheVendorItemStore
Definition: ObjectMgr.h:1606

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 
)
2302{
2303 uint8 mask = data->spawnMask;
2304 for (uint8 i = 0; mask != 0; i++, mask >>= 1)
2305 {
2306 if (mask & 1)
2307 {
2308 CellCoord cellCoord = Acore::ComputeCellCoord(data->posX, data->posY);
2309 CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
2310 cell_guids.creatures.insert(guid);
2311 }
2312 }
2313}
uint32 MAKE_PAIR32(uint16 l, uint16 h)
Definition: ObjectDefines.h:87
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:190
Definition: ObjectMgr.h:478
CellGuidSet creatures
Definition: ObjectMgr.h:479
MapObjectGuids _mapObjectGuidsStore
Definition: ObjectMgr.h:1567
uint32 GetId() const
Definition: GridDefines.h:147

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 
)
2381{
2382 CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
2383 if (!cInfo)
2384 return 0;
2385
2386 uint32 level = cInfo->minlevel == cInfo->maxlevel ? cInfo->minlevel : urand(cInfo->minlevel, cInfo->maxlevel); // Only used for extracting creature base stats
2387 CreatureBaseStats const* stats = GetCreatureBaseStats(level, cInfo->unit_class);
2388 Map* map = sMapMgr->CreateBaseMap(mapId);
2389 if (!map)
2390 return 0;
2391
2393 CreatureData& data = NewOrExistCreatureData(spawnId);
2394 data.spawnMask = spawnId;
2395 data.id1 = entry;
2396 data.id2 = 0;
2397 data.id3 = 0;
2398 data.mapid = mapId;
2399 data.displayid = 0;
2400 data.equipmentId = 0;
2401 data.posX = x;
2402 data.posY = y;
2403 data.posZ = z;
2404 data.orientation = o;
2405 data.spawntimesecs = spawntimedelay;
2406 data.wander_distance = 0;
2407 data.currentwaypoint = 0;
2408 data.curhealth = stats->GenerateHealth(cInfo);
2409 data.curmana = stats->GenerateMana(cInfo);
2410 data.movementType = cInfo->MovementType;
2411 data.spawnMask = 1;
2413 data.dbData = false;
2414 data.npcflag = cInfo->npcflag;
2415 data.unit_flags = cInfo->unit_flags;
2416 data.dynamicflags = cInfo->dynamicflags;
2417
2418 AddCreatureToGrid(spawnId, &data);
2419
2420 // Spawn if necessary (loaded grids only)
2421 if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
2422 {
2423 Creature* creature = new Creature();
2424 if (!creature->LoadCreatureFromDB(spawnId, map, true, true))
2425 {
2426 LOG_ERROR("sql.sql", "AddCreature: Cannot add creature entry {} to map", entry);
2427 delete creature;
2428 return 0;
2429 }
2430 }
2431
2432 return spawnId;
2433}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
std::uint32_t uint32
Definition: Define.h:107
#define sMapMgr
Definition: MapMgr.h:219
@ PHASEMASK_NORMAL
Definition: Object.h:59
Definition: Creature.h:43
bool LoadCreatureFromDB(ObjectGuid::LowType guid, Map *map, bool addToMap=true, bool allowDuplicate=false)
Definition: Creature.cpp:1692
Definition: CreatureData.h:186
uint32 unit_flags
Definition: CreatureData.h:214
uint8 minlevel
Definition: CreatureData.h:195
uint8 maxlevel
Definition: CreatureData.h:196
uint32 MovementType
Definition: CreatureData.h:234
uint32 npcflag
Definition: CreatureData.h:199
uint32 unit_class
Definition: CreatureData.h:213
uint32 dynamicflags
Definition: CreatureData.h:216
Definition: CreatureData.h:303
uint32 GenerateMana(CreatureTemplate const *info) const
Definition: CreatureData.h:318
uint32 GenerateHealth(CreatureTemplate const *info) const
Definition: CreatureData.h:313
Definition: CreatureData.h:370
float wander_distance
Definition: CreatureData.h:384
uint32 phaseMask
Definition: CreatureData.h:376
uint32 spawntimesecs
Definition: CreatureData.h:383
uint32 dynamicflags
Definition: CreatureData.h:392
uint32 npcflag
Definition: CreatureData.h:390
bool dbData
Definition: CreatureData.h:394
uint32 displayid
Definition: CreatureData.h:377
uint8 movementType
Definition: CreatureData.h:388
uint8 spawnMask
Definition: CreatureData.h:389
uint32 unit_flags
Definition: CreatureData.h:391
uint32 id2
Definition: CreatureData.h:373
uint32 curhealth
Definition: CreatureData.h:386
float orientation
Definition: CreatureData.h:382
uint32 curmana
Definition: CreatureData.h:387
uint32 id3
Definition: CreatureData.h:374
float posY
Definition: CreatureData.h:380
float posX
Definition: CreatureData.h:379
int8 equipmentId
Definition: CreatureData.h:378
uint32 currentwaypoint
Definition: CreatureData.h:385
uint16 mapid
Definition: CreatureData.h:375
float posZ
Definition: CreatureData.h:381
uint32 id1
Definition: CreatureData.h:372
uint32 LowType
Definition: ObjectGuid.h:122
CreatureBaseStats const * GetCreatureBaseStats(uint8 level, uint8 unitClass)
Definition: ObjectMgr.cpp:9740
void AddCreatureToGrid(ObjectGuid::LowType guid, CreatureData const *data)
Definition: ObjectMgr.cpp:2301
ObjectGuid::LowType GenerateCreatureSpawnId()
Definition: ObjectMgr.cpp:7055
CreatureData & NewOrExistCreatureData(ObjectGuid::LowType spawnId)
Definition: ObjectMgr.h:1204
CreatureTemplate const * GetCreatureTemplate(uint32 entry)
Definition: ObjectMgr.cpp:10088
Definition: Map.h:311
bool IsRemovalGrid(float x, float y) const
Definition: Map.h:361
bool Instanceable() const
Definition: Map.h:445

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 
)
2605{
2606 uint8 mask = data->spawnMask;
2607 for (uint8 i = 0; mask != 0; i++, mask >>= 1)
2608 {
2609 if (mask & 1)
2610 {
2611 CellCoord cellCoord = Acore::ComputeCellCoord(data->posX, data->posY);
2612 CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
2613 cell_guids.gameobjects.insert(guid);
2614 }
2615 }
2616}
CellGuidSet gameobjects
Definition: ObjectMgr.h:480

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)
8972{
8973 // find max id
8974 uint32 new_id = 0;
8975 for (GameTeleContainer::const_iterator itr = _gameTeleStore.begin(); itr != _gameTeleStore.end(); ++itr)
8976 if (itr->first > new_id)
8977 new_id = itr->first;
8978
8979 // use next
8980 ++new_id;
8981
8982 if (!Utf8toWStr(tele.name, tele.wnameLow))
8983 return false;
8984
8985 wstrToLower(tele.wnameLow);
8986
8987 _gameTeleStore[new_id] = tele;
8988
8990
8991 stmt->SetData(0, new_id);
8992 stmt->SetData(1, tele.position_x);
8993 stmt->SetData(2, tele.position_y);
8994 stmt->SetData(3, tele.position_z);
8995 stmt->SetData(4, tele.orientation);
8996 stmt->SetData(5, uint16(tele.mapId));
8997 stmt->SetData(6, tele.name);
8998
8999 WorldDatabase.Execute(stmt);
9000
9001 return true;
9002}
bool Utf8toWStr(char const *utf8str, std::size_t csize, wchar_t *wstr, std::size_t &wsize)
Definition: Util.cpp:281
void wstrToLower(std::wstring &str)
Definition: Util.cpp:382
std::uint16_t uint16
Definition: Define.h:108
@ WORLD_INS_GAME_TELE
Definition: WorldDatabase.h:41
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: PreparedStatement.h:157
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:77
GameTeleContainer _gameTeleStore
Definition: ObjectMgr.h:1512

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 
)
2330{
2331 GameObjectTemplate const* goinfo = GetGameObjectTemplate(entry);
2332 if (!goinfo)
2333 return 0;
2334
2335 Map* map = sMapMgr->CreateBaseMap(mapId);
2336 if (!map)
2337 return 0;
2338
2340
2341 GameObjectData& data = NewGOData(spawnId);
2342 data.id = entry;
2343 data.mapid = mapId;
2344 data.posX = x;
2345 data.posY = y;
2346 data.posZ = z;
2347 data.orientation = o;
2348 data.rotation.x = rotation0;
2349 data.rotation.y = rotation1;
2350 data.rotation.z = rotation2;
2351 data.rotation.w = rotation3;
2352 data.spawntimesecs = spawntimedelay;
2353 data.animprogress = 100;
2354 data.spawnMask = 1;
2355 data.go_state = GO_STATE_READY;
2357 data.artKit = goinfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT ? 21 : 0;
2358 data.dbData = false;
2359
2360 AddGameobjectToGrid(spawnId, &data);
2361
2362 // Spawn if necessary (loaded grids only)
2363 // We use spawn coords to spawn
2364 if (!map->Instanceable() && map->IsGridLoaded(x, y))
2365 {
2366 GameObject* go = sObjectMgr->IsGameObjectStaticTransport(data.id) ? new StaticTransport() : new GameObject();
2367 if (!go->LoadGameObjectFromDB(spawnId, map))
2368 {
2369 LOG_ERROR("sql.sql", "AddGOData: cannot add gameobject entry {} to map", entry);
2370 delete go;
2371 return 0;
2372 }
2373 }
2374
2375 LOG_DEBUG("maps", "AddGOData: spawnId {} entry {} map {} x {} y {} z {} o {}", spawnId, entry, mapId, x, y, z, o);
2376
2377 return spawnId;
2378}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:169
@ GAMEOBJECT_TYPE_CAPTURE_POINT
Definition: SharedDefines.h:1589
#define sObjectMgr
Definition: ObjectMgr.h:1635
@ GO_STATE_READY
Definition: GameObjectData.h:690
Definition: GameObject.h:120
bool LoadGameObjectFromDB(ObjectGuid::LowType guid, Map *map, bool addToMap=true)
Definition: GameObject.cpp:1123
Definition: GameObjectData.h:31
uint32 type
Definition: GameObjectData.h:33
Definition: GameObjectData.h:696
bool dbData
Definition: GameObjectData.h:712
float orientation
Definition: GameObjectData.h:704
float posZ
Definition: GameObjectData.h:703
uint8 artKit
Definition: GameObjectData.h:711
int32 spawntimesecs
Definition: GameObjectData.h:706
uint8 spawnMask
Definition: GameObjectData.h:710
G3D::Quat rotation
Definition: GameObjectData.h:705
uint32 animprogress
Definition: GameObjectData.h:708
uint16 mapid
Definition: GameObjectData.h:699
float posX
Definition: GameObjectData.h:701
uint32 phaseMask
Definition: GameObjectData.h:700
float posY
Definition: GameObjectData.h:702
uint32 id
Definition: GameObjectData.h:698
GOState go_state
Definition: GameObjectData.h:709
Definition: Transport.h:112
void AddGameobjectToGrid(ObjectGuid::LowType guid, GameObjectData const *data)
Definition: ObjectMgr.cpp:2604
GameObjectTemplate const * GetGameObjectTemplate(uint32 entry)
Definition: ObjectMgr.cpp:10064
ObjectGuid::LowType GenerateGameObjectSpawnId()
Definition: ObjectMgr.cpp:7065
GameObjectData & NewGOData(ObjectGuid::LowType guid)
Definition: ObjectMgr.h:1289
bool IsGridLoaded(float x, float y) const
Definition: Map.h:367

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()

◆ AddProfanityPlayerName()

void ObjectMgr::AddProfanityPlayerName ( std::string const &  name)
8340{
8341 if (!IsProfanityName(name))
8342 {
8343 std::wstring wstr;
8344 if (!Utf8toWStr(name, wstr))
8345 {
8346 LOG_ERROR("server", "Could not add invalid name to profanity player names: {}", name);
8347 return;
8348 }
8349 wstrToLower(wstr);
8350
8351 _profanityNamesStore.insert(wstr);
8352
8354 stmt->SetData(0, name);
8355 CharacterDatabase.Execute(stmt);
8356 }
8357}
@ CHAR_INS_PROFANITY_PLAYER_NAME
Definition: CharacterDatabase.h:518
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
ProfanityNamesContainer _profanityNamesStore
Definition: ObjectMgr.h:1510
bool IsProfanityName(std::string_view name) const
Definition: ObjectMgr.cpp:8324

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

◆ AddReservedPlayerName()

void ObjectMgr::AddReservedPlayerName ( std::string const &  name)
8237{
8238 if (!IsReservedName(name))
8239 {
8240 std::wstring wstr;
8241 if (!Utf8toWStr(name, wstr))
8242 {
8243 LOG_ERROR("server", "Could not add invalid name to reserved player names: {}", name);
8244 return;
8245 }
8246 wstrToLower(wstr);
8247
8248 _reservedNamesStore.insert(wstr);
8249
8251 stmt->SetData(0, name);
8252 CharacterDatabase.Execute(stmt);
8253 }
8254}
@ CHAR_INS_RESERVED_PLAYER_NAME
Definition: CharacterDatabase.h:517
bool IsReservedName(std::string_view name) const
Definition: ObjectMgr.cpp:8221
ReservedNamesContainer _reservedNamesStore
Definition: ObjectMgr.h:1506

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 
)
9093{
9094 if (entry >= ACORE_TRAINER_START_REF)
9095 return;
9096
9097 CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
9098 if (!cInfo)
9099 {
9100 LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry for a non-existing creature template (Entry: {}), ignoring", entry);
9101 return;
9102 }
9103
9104 if (!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER))
9105 {
9106 LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry for a creature template (Entry: {}) without trainer flag, ignoring", entry);
9107 return;
9108 }
9109
9110 SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spell);
9111 if (!spellinfo)
9112 {
9113 LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: {}) for a non-existing spell (Spell: {}), ignoring", entry, spell);
9114 return;
9115 }
9116
9117 if (!SpellMgr::ComputeIsSpellValid(spellinfo))
9118 {
9119 LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: {}) for a broken spell (Spell: {}), ignoring", entry, spell);
9120 return;
9121 }
9122
9123 if (GetTalentSpellCost(spell))
9124 {
9125 LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: {}) for a non-existing spell (Spell: {}) which is a talent, ignoring", entry, spell);
9126 return;
9127 }
9128
9129 if (reqSpell && !sSpellMgr->GetSpellInfo(reqSpell))
9130 {
9131 LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: {}) for a non-existing reqSpell (Spell: {}), ignoring", entry, reqSpell);
9132 return;
9133 }
9134
9136
9137 TrainerSpell& trainerSpell = data.spellList[spell];
9138 trainerSpell.spell = spell;
9139 trainerSpell.spellCost = spellCost;
9140 trainerSpell.reqSkill = reqSkill;
9141 trainerSpell.reqSkillValue = reqSkillValue;
9142 trainerSpell.reqLevel = reqLevel;
9143 trainerSpell.reqSpell = reqSpell;
9144
9145 if (!trainerSpell.reqLevel)
9146 trainerSpell.reqLevel = spellinfo->SpellLevel;
9147
9148 // calculate learned spell for profession case when stored cast-spell
9149 trainerSpell.learnedSpell[0] = spell;
9150 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
9151 {
9152 if (spellinfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL)
9153 continue;
9154 if (trainerSpell.learnedSpell[0] == spell)
9155 trainerSpell.learnedSpell[0] = 0;
9156 // player must be able to cast spell on himself
9157 if (spellinfo->Effects[i].TargetA.GetTarget() != 0 && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ALLY
9158 && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ANY && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_CASTER)
9159 {
9160 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);
9161 continue;
9162 }
9163
9164 trainerSpell.learnedSpell[i] = spellinfo->Effects[i].TriggerSpell;
9165
9166 if (trainerSpell.learnedSpell[i])
9167 {
9168 SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainerSpell.learnedSpell[i]);
9169 if (learnedSpellInfo && learnedSpellInfo->IsProfession())
9170 data.trainerType = 2;
9171 }
9172 }
9173
9174 return;
9175}
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1636
@ SPELL_EFFECT_LEARN_SPELL
Definition: SharedDefines.h:814
@ TARGET_UNIT_TARGET_ALLY
Definition: SharedDefines.h:1425
@ TARGET_UNIT_TARGET_ANY
Definition: SharedDefines.h:1429
@ TARGET_UNIT_CASTER
Definition: SharedDefines.h:1410
#define ACORE_TRAINER_START_REF
Definition: ObjectMgr.h:493
#define sSpellMgr
Definition: SpellMgr.h:825
@ UNIT_NPC_FLAG_TRAINER
Definition: UnitDefines.h:298
uint32 GetTalentSpellCost(uint32 spellId)
Definition: DBCStores.cpp:686
Definition: CreatureData.h:507
uint32 reqSkillValue
Definition: CreatureData.h:517
uint32 learnedSpell[3]
Definition: CreatureData.h:519
uint32 reqSpell
Definition: CreatureData.h:520
uint32 spellCost
Definition: CreatureData.h:515
uint32 reqSkill
Definition: CreatureData.h:516
uint32 reqLevel
Definition: CreatureData.h:518
uint32 spell
Definition: CreatureData.h:514
Definition: CreatureData.h:529
TrainerSpellMap spellList
Definition: CreatureData.h:533
uint32 trainerType
Definition: CreatureData.h:534
Definition: SpellInfo.h:316
uint32 SpellLevel
Definition: SpellInfo.h:360
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:393
bool IsProfession() const
Definition: SpellInfo.cpp:953
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:370

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 
)
9418{
9419 VendorItemData& vList = _cacheVendorItemStore[entry];
9420 vList.AddItem(item, maxcount, incrtime, extendedCost);
9421
9422 if (persist)
9423 {
9425
9426 stmt->SetData(0, entry);
9427 stmt->SetData(1, item);
9428 stmt->SetData(2, maxcount);
9429 stmt->SetData(3, incrtime);
9430 stmt->SetData(4, extendedCost);
9431
9432 WorldDatabase.Execute(stmt);
9433 }
9434}
@ WORLD_INS_NPC_VENDOR
Definition: WorldDatabase.h:43
Definition: CreatureData.h:469
void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost)
Definition: CreatureData.h:481

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
4333{
4334 // base data (last known level)
4335 *info = _playerInfo[race][_class]->levelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) - 1];
4336
4337 // if conversion from uint32 to uint8 causes unexpected behaviour, change lvl to uint32
4338 for (uint8 lvl = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) - 1; lvl < level; ++lvl)
4339 {
4340 switch (_class)
4341 {
4342 case CLASS_WARRIOR:
4343 info->stats[STAT_STRENGTH] += (lvl > 23 ? 2 : (lvl > 1 ? 1 : 0));
4344 info->stats[STAT_STAMINA] += (lvl > 23 ? 2 : (lvl > 1 ? 1 : 0));
4345 info->stats[STAT_AGILITY] += (lvl > 36 ? 1 : (lvl > 6 && (lvl % 2) ? 1 : 0));
4346 info->stats[STAT_INTELLECT] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
4347 info->stats[STAT_SPIRIT] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
4348 break;
4349 case CLASS_PALADIN:
4350 info->stats[STAT_STRENGTH] += (lvl > 3 ? 1 : 0);
4351 info->stats[STAT_STAMINA] += (lvl > 33 ? 2 : (lvl > 1 ? 1 : 0));
4352 info->stats[STAT_AGILITY] += (lvl > 38 ? 1 : (lvl > 7 && !(lvl % 2) ? 1 : 0));
4353 info->stats[STAT_INTELLECT] += (lvl > 6 && (lvl % 2) ? 1 : 0);
4354 info->stats[STAT_SPIRIT] += (lvl > 7 ? 1 : 0);
4355 break;
4356 case CLASS_HUNTER:
4357 info->stats[STAT_STRENGTH] += (lvl > 4 ? 1 : 0);
4358 info->stats[STAT_STAMINA] += (lvl > 4 ? 1 : 0);
4359 info->stats[STAT_AGILITY] += (lvl > 33 ? 2 : (lvl > 1 ? 1 : 0));
4360 info->stats[STAT_INTELLECT] += (lvl > 8 && (lvl % 2) ? 1 : 0);
4361 info->stats[STAT_SPIRIT] += (lvl > 38 ? 1 : (lvl > 9 && !(lvl % 2) ? 1 : 0));
4362 break;
4363 case CLASS_ROGUE:
4364 info->stats[STAT_STRENGTH] += (lvl > 5 ? 1 : 0);
4365 info->stats[STAT_STAMINA] += (lvl > 4 ? 1 : 0);
4366 info->stats[STAT_AGILITY] += (lvl > 16 ? 2 : (lvl > 1 ? 1 : 0));
4367 info->stats[STAT_INTELLECT] += (lvl > 8 && !(lvl % 2) ? 1 : 0);
4368 info->stats[STAT_SPIRIT] += (lvl > 38 ? 1 : (lvl > 9 && !(lvl % 2) ? 1 : 0));
4369 break;
4370 case CLASS_PRIEST:
4371 info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
4372 info->stats[STAT_STAMINA] += (lvl > 5 ? 1 : 0);
4373 info->stats[STAT_AGILITY] += (lvl > 38 ? 1 : (lvl > 8 && (lvl % 2) ? 1 : 0));
4374 info->stats[STAT_INTELLECT] += (lvl > 22 ? 2 : (lvl > 1 ? 1 : 0));
4375 info->stats[STAT_SPIRIT] += (lvl > 3 ? 1 : 0);
4376 break;
4377 case CLASS_SHAMAN:
4378 info->stats[STAT_STRENGTH] += (lvl > 34 ? 1 : (lvl > 6 && (lvl % 2) ? 1 : 0));
4379 info->stats[STAT_STAMINA] += (lvl > 4 ? 1 : 0);
4380 info->stats[STAT_AGILITY] += (lvl > 7 && !(lvl % 2) ? 1 : 0);
4381 info->stats[STAT_INTELLECT] += (lvl > 5 ? 1 : 0);
4382 info->stats[STAT_SPIRIT] += (lvl > 4 ? 1 : 0);
4383 break;
4384 case CLASS_MAGE:
4385 info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
4386 info->stats[STAT_STAMINA] += (lvl > 5 ? 1 : 0);
4387 info->stats[STAT_AGILITY] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
4388 info->stats[STAT_INTELLECT] += (lvl > 24 ? 2 : (lvl > 1 ? 1 : 0));
4389 info->stats[STAT_SPIRIT] += (lvl > 33 ? 2 : (lvl > 2 ? 1 : 0));
4390 break;
4391 case CLASS_WARLOCK:
4392 info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
4393 info->stats[STAT_STAMINA] += (lvl > 38 ? 2 : (lvl > 3 ? 1 : 0));
4394 info->stats[STAT_AGILITY] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
4395 info->stats[STAT_INTELLECT] += (lvl > 33 ? 2 : (lvl > 2 ? 1 : 0));
4396 info->stats[STAT_SPIRIT] += (lvl > 38 ? 2 : (lvl > 3 ? 1 : 0));
4397 break;
4398 case CLASS_DRUID:
4399 info->stats[STAT_STRENGTH] += (lvl > 38 ? 2 : (lvl > 6 && (lvl % 2) ? 1 : 0));
4400 info->stats[STAT_STAMINA] += (lvl > 32 ? 2 : (lvl > 4 ? 1 : 0));
4401 info->stats[STAT_AGILITY] += (lvl > 38 ? 2 : (lvl > 8 && (lvl % 2) ? 1 : 0));
4402 info->stats[STAT_INTELLECT] += (lvl > 38 ? 3 : (lvl > 4 ? 1 : 0));
4403 info->stats[STAT_SPIRIT] += (lvl > 38 ? 3 : (lvl > 5 ? 1 : 0));
4404 }
4405 }
4406}
@ CLASS_HUNTER
Definition: SharedDefines.h:143
@ CLASS_DRUID
Definition: SharedDefines.h:151
@ CLASS_SHAMAN
Definition: SharedDefines.h:147
@ CLASS_PRIEST
Definition: SharedDefines.h:145
@ CLASS_WARRIOR
Definition: SharedDefines.h:141
@ CLASS_WARLOCK
Definition: SharedDefines.h:149
@ CLASS_MAGE
Definition: SharedDefines.h:148
@ CLASS_PALADIN
Definition: SharedDefines.h:142
@ CLASS_ROGUE
Definition: SharedDefines.h:144
@ STAT_SPIRIT
Definition: SharedDefines.h:262
@ STAT_INTELLECT
Definition: SharedDefines.h:261
@ STAT_AGILITY
Definition: SharedDefines.h:259
@ STAT_STRENGTH
Definition: SharedDefines.h:258
@ STAT_STAMINA
Definition: SharedDefines.h:260
@ CONFIG_MAX_PLAYER_LEVEL
Definition: IWorld.h:235
#define sWorld
Definition: World.h:443

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 
)
8791{
8792 AreaTableEntry const* fArea = sAreaTableStore.LookupEntry(entry);
8793 if (!fArea)
8794 {
8795 LOG_ERROR("sql.sql", "AreaId {} defined in `skill_fishing_base_level` does not exist", entry);
8796 return;
8797 }
8798
8799 _fishingBaseForAreaStore[entry] = skill;
8800
8801 LOG_INFO("server.loading", ">> Fishing base skill level of area {} changed to {}", entry, skill);
8802 LOG_INFO("server.loading", " ");
8803}
#define LOG_INFO(filterType__,...)
Definition: Log.h:165
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
FishingBaseSkillContainer _fishingBaseForAreaStore
Definition: ObjectMgr.h:1555
Definition: DBCStructure.h:518

References _fishingBaseForAreaStore, LOG_ERROR, LOG_INFO, and sAreaTableStore.

◆ CheckCreatureMovement()

void ObjectMgr::CheckCreatureMovement ( char const *  table,
uint64  id,
CreatureMovementData creatureMovement 
)
1246{
1247 if (creatureMovement.Ground >= CreatureGroundMovementType::Max)
1248 {
1249 LOG_ERROR("sql.sql", "`{}`.`Ground` wrong value ({}) for Id {}, setting to Run.", table, uint32(creatureMovement.Ground), id);
1250 creatureMovement.Ground = CreatureGroundMovementType::Run;
1251 }
1252
1253 if (creatureMovement.Flight >= CreatureFlightMovementType::Max)
1254 {
1255 LOG_ERROR("sql.sql", "`{}`.`Flight` wrong value ({}) for Id {}, setting to None.", table, uint32(creatureMovement.Flight), id);
1256 creatureMovement.Flight = CreatureFlightMovementType::None;
1257 }
1258
1259 if (creatureMovement.Chase >= CreatureChaseMovementType::Max)
1260 {
1261 LOG_ERROR("sql.sql", "`{}`.`Chase` wrong value ({}) for Id {}, setting to Run.", table, uint32(creatureMovement.Chase), id);
1262 creatureMovement.Chase = CreatureChaseMovementType::Run;
1263 }
1264
1265 if (creatureMovement.Random >= CreatureRandomMovementType::Max)
1266 {
1267 LOG_ERROR("sql.sql", "`{}`.`Random` wrong value ({}) for Id {}, setting to Walk.", table, uint32(creatureMovement.Random), id);
1268 creatureMovement.Random = CreatureRandomMovementType::Walk;
1269 }
1270}
CreatureRandomMovementType Random
Definition: CreatureData.h:127
CreatureFlightMovementType Flight
Definition: CreatureData.h:123
CreatureChaseMovementType Chase
Definition: CreatureData.h:126
CreatureGroundMovementType Ground
Definition: CreatureData.h:122

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

Referenced by CheckCreatureTemplate(), and LoadCreatureMovementOverrides().

◆ CheckCreatureTemplate()

void ObjectMgr::CheckCreatureTemplate ( CreatureTemplate const *  cInfo)
962{
963 if (!cInfo)
964 return;
965
966 bool ok = true; // bool to allow continue outside this loop
967 for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
968 {
969 if (!cInfo->DifficultyEntry[diff])
970 continue;
971 ok = false; // will be set to true at the end of this loop again
972
973 CreatureTemplate const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]);
974 if (!difficultyInfo)
975 {
976 LOG_ERROR("sql.sql", "Creature (Entry: {}) has `difficulty_entry_{}`={} but creature entry {} does not exist.",
977 cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff]);
978 continue;
979 }
980
981 bool ok2 = true;
982 for (uint32 diff2 = 0; diff2 < MAX_DIFFICULTY - 1 && ok2; ++diff2)
983 {
984 ok2 = false;
985 if (_difficultyEntries[diff2].find(cInfo->Entry) != _difficultyEntries[diff2].end())
986 {
987 LOG_ERROR("sql.sql", "Creature (Entry: {}) is listed as `difficulty_entry_{}` of another creature, but itself lists {} in `difficulty_entry_{}`.",
988 cInfo->Entry, diff2 + 1, cInfo->DifficultyEntry[diff], diff + 1);
989 continue;
990 }
991
992 if (_difficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _difficultyEntries[diff2].end())
993 {
994 LOG_ERROR("sql.sql", "Creature (Entry: {}) already listed as `difficulty_entry_{}` for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1);
995 continue;
996 }
997
998 if (_hasDifficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _hasDifficultyEntries[diff2].end())
999 {
1000 LOG_ERROR("sql.sql", "Creature (Entry: {}) has `difficulty_entry_{}`={} but creature entry {} has itself a value in `difficulty_entry_{}`.",
1001 cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff], diff2 + 1);
1002 continue;
1003 }
1004 ok2 = true;
1005 }
1006 if (!ok2)
1007 continue;
1008
1009 if (cInfo->expansion > difficultyInfo->expansion)
1010 {
1011 LOG_ERROR("sql.sql", "Creature (Entry: {}, expansion {}) has different `expansion` in difficulty {} mode (Entry: {}, expansion {}).",
1012 cInfo->Entry, cInfo->expansion, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->expansion);
1013 }
1014
1015 if (cInfo->faction != difficultyInfo->faction)
1016 {
1017 LOG_ERROR("sql.sql", "Creature (Entry: {}, faction {}) has different `faction` in difficulty {} mode (Entry: {}, faction {}).",
1018 cInfo->Entry, cInfo->faction, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->faction);
1019 }
1020
1021 if (cInfo->unit_class != difficultyInfo->unit_class)
1022 {
1023 LOG_ERROR("sql.sql", "Creature (Entry: {}, class {}) has different `unit_class` in difficulty {} mode (Entry: {}, class {}).",
1024 cInfo->Entry, cInfo->unit_class, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->unit_class);
1025 continue;
1026 }
1027
1028 if (cInfo->npcflag != difficultyInfo->npcflag)
1029 {
1030 LOG_ERROR("sql.sql", "Creature (Entry: {}) has different `npcflag` in difficulty {} mode (Entry: {}).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1031 continue;
1032 }
1033
1034 if (cInfo->family != difficultyInfo->family)
1035 {
1036 LOG_ERROR("sql.sql", "Creature (Entry: {}, family {}) has different `family` in difficulty {} mode (Entry: {}, family {}).",
1037 cInfo->Entry, cInfo->family, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->family);
1038 }
1039
1040 if (cInfo->trainer_class != difficultyInfo->trainer_class)
1041 {
1042 LOG_ERROR("sql.sql", "Creature (Entry: {}) has different `trainer_class` in difficulty {} mode (Entry: {}).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1043 continue;
1044 }
1045
1046 if (cInfo->trainer_race != difficultyInfo->trainer_race)
1047 {
1048 LOG_ERROR("sql.sql", "Creature (Entry: {}) has different `trainer_race` in difficulty {} mode (Entry: {}).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1049 continue;
1050 }
1051
1052 if (cInfo->trainer_type != difficultyInfo->trainer_type)
1053 {
1054 LOG_ERROR("sql.sql", "Creature (Entry: {}) has different `trainer_type` in difficulty {} mode (Entry: {}).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1055 continue;
1056 }
1057
1058 if (cInfo->trainer_spell != difficultyInfo->trainer_spell)
1059 {
1060 LOG_ERROR("sql.sql", "Creature (Entry: {}) has different `trainer_spell` in difficulty {} mode (Entry: {}).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1061 continue;
1062 }
1063
1064 if (cInfo->type != difficultyInfo->type)
1065 {
1066 LOG_ERROR("sql.sql", "Creature (Entry: {}, type {}) has different `type` in difficulty {} mode (Entry: {}, type {}).",
1067 cInfo->Entry, cInfo->type, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->type);
1068 }
1069
1070 if (!cInfo->VehicleId && difficultyInfo->VehicleId)
1071 {
1072 LOG_ERROR("sql.sql", "Creature (Entry: {}, VehicleId {}) has different `VehicleId` in difficulty {} mode (Entry: {}, VehicleId {}).",
1073 cInfo->Entry, cInfo->VehicleId, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->VehicleId);
1074 }
1075
1076 // Xinef: check dmg school
1077 if (cInfo->dmgschool != difficultyInfo->dmgschool)
1078 {
1079 LOG_ERROR("sql.sql", "Creature (Entry: {}) has different `dmgschool` in difficulty {} mode (Entry: {})", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1080 }
1081
1082 if (!difficultyInfo->AIName.empty())
1083 {
1084 LOG_ERROR("sql.sql", "Creature (Entry: {}) lists difficulty {} mode entry {} with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.",
1085 cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1086 continue;
1087 }
1088
1089 if (difficultyInfo->ScriptID)
1090 {
1091 LOG_ERROR("sql.sql", "Creature (Entry: {}) lists difficulty {} mode entry {} with `ScriptName` filled in. `ScriptName` of difficulty 0 mode creature is always used instead.",
1092 cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
1093 continue;
1094 }
1095
1096 _hasDifficultyEntries[diff].insert(cInfo->Entry);
1097 _difficultyEntries[diff].insert(cInfo->DifficultyEntry[diff]);
1098 ok = true;
1099 }
1100
1101 if (!cInfo->AIName.empty() && !sCreatureAIRegistry->HasItem(cInfo->AIName))
1102 {
1103 LOG_ERROR("sql.sql", "Creature (Entry: {}) has non-registered `AIName` '{}' set, removing", cInfo->Entry, cInfo->AIName);
1104 const_cast<CreatureTemplate*>(cInfo)->AIName.clear();
1105 }
1106
1107 FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction);
1108 if (!factionTemplate)
1109 LOG_ERROR("sql.sql", "Creature (Entry: {}) has non-existing faction template ({}).", cInfo->Entry, cInfo->faction);
1110
1111 for (int k = 0; k < MAX_KILL_CREDIT; ++k)
1112 {
1113 if (cInfo->KillCredit[k])
1114 {
1115 if (!GetCreatureTemplate(cInfo->KillCredit[k]))
1116 {
1117 LOG_ERROR("sql.sql", "Creature (Entry: {}) lists non-existing creature entry {} in `KillCredit{}`.", cInfo->Entry, cInfo->KillCredit[k], k + 1);
1118 const_cast<CreatureTemplate*>(cInfo)->KillCredit[k] = 0;
1119 }
1120 }
1121 }
1122
1123 if (!cInfo->Models.size())
1124 LOG_ERROR("sql.sql", "Creature (Entry: {}) does not have any existing display id in creature_template_model.", cInfo->Entry);
1125 else if (std::accumulate(cInfo->Models.begin(), cInfo->Models.end(), 0.0f, [](float sum, CreatureModel const& model) { return sum + model.Probability; }) <= 0.0f)
1126 LOG_ERROR("sql.sql", "Creature (Entry: {}) has zero total chance for all models in creature_template_model.", cInfo->Entry);
1127
1128 if (!cInfo->unit_class || ((1 << (cInfo->unit_class - 1)) & CLASSMASK_ALL_CREATURES) == 0)
1129 {
1130 LOG_ERROR("sql.sql", "Creature (Entry: {}) has invalid unit_class ({}) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class);
1131 const_cast<CreatureTemplate*>(cInfo)->unit_class = UNIT_CLASS_WARRIOR;
1132 }
1133
1134 if (cInfo->dmgschool >= MAX_SPELL_SCHOOL)
1135 {
1136 LOG_ERROR("sql.sql", "Creature (Entry: {}) has invalid spell school value ({}) in `dmgschool`.", cInfo->Entry, cInfo->dmgschool);
1137 const_cast<CreatureTemplate*>(cInfo)->dmgschool = SPELL_SCHOOL_NORMAL;
1138 }
1139
1140 if (cInfo->BaseAttackTime == 0)
1141 const_cast<CreatureTemplate*>(cInfo)->BaseAttackTime = BASE_ATTACK_TIME;
1142
1143 if (cInfo->RangeAttackTime == 0)
1144 const_cast<CreatureTemplate*>(cInfo)->RangeAttackTime = BASE_ATTACK_TIME;
1145
1146 if ((cInfo->npcflag & UNIT_NPC_FLAG_TRAINER) && cInfo->trainer_type >= MAX_TRAINER_TYPE)
1147 LOG_ERROR("sql.sql", "Creature (Entry: {}) has wrong trainer type {}.", cInfo->Entry, cInfo->trainer_type);
1148
1149 if (cInfo->speed_walk == 0.0f)
1150 {
1151 LOG_ERROR("sql.sql", "Creature (Entry: {}) has wrong value ({}) in speed_walk, set to 1.", cInfo->Entry, cInfo->speed_walk);
1152 const_cast<CreatureTemplate*>(cInfo)->speed_walk = 1.0f;
1153 }
1154
1155 if (cInfo->speed_run == 0.0f)
1156 {
1157 LOG_ERROR("sql.sql", "Creature (Entry: {}) has wrong value ({}) in speed_run, set to 1.14286.", cInfo->Entry, cInfo->speed_run);
1158 const_cast<CreatureTemplate*>(cInfo)->speed_run = 1.14286f;
1159 }
1160
1161 if (cInfo->type && !sCreatureTypeStore.LookupEntry(cInfo->type))
1162 {
1163 LOG_ERROR("sql.sql", "Creature (Entry: {}) has invalid creature type ({}) in `type`.", cInfo->Entry, cInfo->type);
1164 const_cast<CreatureTemplate*>(cInfo)->type = CREATURE_TYPE_HUMANOID;
1165 }
1166
1167 // must exist or used hidden but used in data horse case
1168 if (cInfo->family && !sCreatureFamilyStore.LookupEntry(cInfo->family) && cInfo->family != CREATURE_FAMILY_HORSE_CUSTOM)
1169 {
1170 LOG_ERROR("sql.sql", "Creature (Entry: {}) has invalid creature family ({}) in `family`.", cInfo->Entry, cInfo->family);
1171 const_cast<CreatureTemplate*>(cInfo)->family = 0;
1172 }
1173
1174 CheckCreatureMovement("creature_template_movement", cInfo->Entry, const_cast<CreatureTemplate*>(cInfo)->Movement);
1175
1176 if (cInfo->HoverHeight < 0.0f)
1177 {
1178 LOG_ERROR("sql.sql", "Creature (Entry: {}) has wrong value ({}) in `HoverHeight`", cInfo->Entry, cInfo->HoverHeight);
1179 const_cast<CreatureTemplate*>(cInfo)->HoverHeight = 1.0f;
1180 }
1181
1182 if (cInfo->VehicleId)
1183 {
1184 VehicleEntry const* vehId = sVehicleStore.LookupEntry(cInfo->VehicleId);
1185 if (!vehId)
1186 {
1187 LOG_ERROR("sql.sql", "Creature (Entry: {}) has a non-existing VehicleId ({}). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId);
1188 const_cast<CreatureTemplate*>(cInfo)->VehicleId = 0;
1189 }
1190 }
1191
1192 if (cInfo->PetSpellDataId)
1193 {
1194 CreatureSpellDataEntry const* spellDataId = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId);
1195 if (!spellDataId)
1196 LOG_ERROR("sql.sql", "Creature (Entry: {}) has non-existing PetSpellDataId ({}).", cInfo->Entry, cInfo->PetSpellDataId);
1197 }
1198
1199 for (uint8 j = 0; j < MAX_CREATURE_SPELLS; ++j)
1200 {
1201 if (cInfo->spells[j] && !sSpellMgr->GetSpellInfo(cInfo->spells[j]))
1202 {
1203 LOG_ERROR("sql.sql", "Creature (Entry: {}) has non-existing Spell{} ({}), set to 0.", cInfo->Entry, j + 1, cInfo->spells[j]);
1204 const_cast<CreatureTemplate*>(cInfo)->spells[j] = 0;
1205 }
1206 }
1207
1208 if (cInfo->MovementType >= MAX_DB_MOTION_TYPE)
1209 {
1210 LOG_ERROR("sql.sql", "Creature (Entry: {}) has wrong movement generator type ({}), ignored and set to IDLE.", cInfo->Entry, cInfo->MovementType);
1211 const_cast<CreatureTemplate*>(cInfo)->MovementType = IDLE_MOTION_TYPE;
1212 }
1213
1214 if (cInfo->expansion > (MAX_EXPANSIONS - 1))
1215 {
1216 LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: {}) with expansion {}. Ignored and set to 0.", cInfo->Entry, cInfo->expansion);
1217 const_cast<CreatureTemplate*>(cInfo)->expansion = 0;
1218 }
1219
1220 if (uint32 badFlags = (cInfo->flags_extra & ~CREATURE_FLAG_EXTRA_DB_ALLOWED))
1221 {
1222 LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: {}) with disallowed `flags_extra` {}, removing incorrect flag.", cInfo->Entry, badFlags);
1223 const_cast<CreatureTemplate*>(cInfo)->flags_extra &= CREATURE_FLAG_EXTRA_DB_ALLOWED;
1224 }
1225
1226 const_cast<CreatureTemplate*>(cInfo)->DamageModifier *= Creature::_GetDamageMod(cInfo->rank);
1227
1228 // Hack for modules
1229 for (auto& itr : _creatureCustomIDsStore)
1230 {
1231 if (cInfo->Entry == itr)
1232 return;
1233 }
1234
1235 if ((cInfo->GossipMenuId && !(cInfo->npcflag & UNIT_NPC_FLAG_GOSSIP)) && !(cInfo->flags_extra & CREATURE_FLAG_EXTRA_MODULE))
1236 {
1237 LOG_ERROR("sql.sql", "Creature (Entry: {}) has assigned gossip menu {}, but npcflag does not include UNIT_NPC_FLAG_GOSSIP (1).", cInfo->Entry, cInfo->GossipMenuId);
1238 }
1239 else if ((!cInfo->GossipMenuId && (cInfo->npcflag & UNIT_NPC_FLAG_GOSSIP)) && !(cInfo->flags_extra & CREATURE_FLAG_EXTRA_MODULE))
1240 {
1241 LOG_INFO("sql.sql", "Creature (Entry: {}) has npcflag UNIT_NPC_FLAG_GOSSIP (1), but gossip menu is unassigned.", cInfo->Entry);
1242 }
1243}
spells
Definition: boss_krystallus.cpp:26
#define MAX_DIFFICULTY
Definition: DBCEnums.h:283
@ SPELL_SCHOOL_NORMAL
Definition: SharedDefines.h:283
constexpr auto MAX_SPELL_SCHOOL
Definition: SharedDefines.h:292
@ CREATURE_FAMILY_HORSE_CUSTOM
Definition: SharedDefines.h:2659
@ UNIT_CLASS_WARRIOR
Definition: SharedDefines.h:166
@ CREATURE_TYPE_HUMANOID
Definition: SharedDefines.h:2634
#define CLASSMASK_ALL_CREATURES
Definition: SharedDefines.h:172
@ MAX_EXPANSIONS
Definition: SharedDefines.h:56
#define MAX_TRAINER_TYPE
Definition: SharedDefines.h:2623
#define sCreatureAIRegistry
Definition: CreatureAIFactory.h:48
#define BASE_ATTACK_TIME
Definition: Unit.h:41
static constexpr uint32 MAX_CREATURE_SPELLS
Definition: Unit.h:45
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:294
@ CREATURE_FLAG_EXTRA_DB_ALLOWED
Definition: CreatureData.h:79
@ CREATURE_FLAG_EXTRA_MODULE
Definition: CreatureData.h:69
#define MAX_KILL_CREDIT
Definition: CreatureData.h:30
DBCStorage< VehicleEntry > sVehicleStore(VehicleEntryfmt)
DBCStorage< CreatureSpellDataEntry > sCreatureSpellDataStore(CreatureSpellDatafmt)
DBCStorage< CreatureFamilyEntry > sCreatureFamilyStore(CreatureFamilyfmt)
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
DBCStorage< CreatureTypeEntry > sCreatureTypeStore(CreatureTypefmt)
@ MAX_DB_MOTION_TYPE
Definition: MotionMaster.h:42
@ IDLE_MOTION_TYPE
Definition: MotionMaster.h:39
static float _GetDamageMod(int32 Rank)
Definition: Creature.cpp:1592
Definition: CreatureData.h:169
uint32 trainer_spell
Definition: CreatureData.h:219
uint32 trainer_class
Definition: CreatureData.h:220
uint32 type
Definition: CreatureData.h:222
uint32 trainer_race
Definition: CreatureData.h:221
uint32 ScriptID
Definition: CreatureData.h:247
uint32 VehicleId
Definition: CreatureData.h:230
CreatureMovementData Movement
Definition: CreatureData.h:235
uint32 faction
Definition: CreatureData.h:198
uint32 dmgschool
Definition: CreatureData.h:207
uint32 expansion
Definition: CreatureData.h:197
uint32 trainer_type
Definition: CreatureData.h:218
std::string AIName
Definition: CreatureData.h:233
uint32 family
Definition: CreatureData.h:217
std::set< uint32 > _difficultyEntries[MAX_DIFFICULTY - 1]
Definition: ObjectMgr.h:1611
CreatureCustomIDsContainer _creatureCustomIDsStore
Definition: ObjectMgr.h:1572
std::set< uint32 > _hasDifficultyEntries[MAX_DIFFICULTY - 1]
Definition: ObjectMgr.h:1612
void CheckCreatureMovement(char const *table, uint64 id, CreatureMovementData &creatureMovement)
Definition: ObjectMgr.cpp:1245
Definition: DBCStructure.h:809
Definition: DBCStructure.h:938
Definition: DBCStructure.h:2026

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, 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::Models, CreatureTemplate::Movement, CreatureTemplate::MovementType, CreatureTemplate::npcflag, CreatureTemplate::PetSpellDataId, CreatureTemplate::RangeAttackTime, CreatureTemplate::rank, sCreatureAIRegistry, 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
8806{
8807 // get main part of the name
8808 std::wstring mainpart = GetMainPartOfName(w_ownname, 0);
8809 // prepare flags
8810 bool x = true;
8811 bool y = true;
8812
8813 // check declined names
8814 for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
8815 {
8816 std::wstring wname;
8817 if (!Utf8toWStr(names.name[i], wname))
8818 return false;
8819
8820 if (mainpart != GetMainPartOfName(wname, i + 1))
8821 x = false;
8822
8823 if (w_ownname != wname)
8824 y = false;
8825 }
8826 return (x || y);
8827}
std::wstring GetMainPartOfName(std::wstring const &wname, uint32_t declension)
Definition: Util.cpp:386
#define MAX_DECLINED_NAME_CASES
Definition: Unit.h:528

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
8512{
8513 std::wstring wname;
8514 if (!Utf8toWStr(name, wname))
8515 return PET_NAME_INVALID;
8516
8517 if (wname.size() > MAX_PET_NAME)
8518 return PET_NAME_TOO_LONG;
8519
8520 uint32 minName = sWorld->getIntConfig(CONFIG_MIN_PET_NAME);
8521 if (wname.size() < minName)
8522 return PET_NAME_TOO_SHORT;
8523
8524 uint32 strictMask = sWorld->getIntConfig(CONFIG_STRICT_PET_NAMES);
8525 if (!isValidString(wname, strictMask, false))
8527
8528 // Check Reserved Name
8529 if (sObjectMgr->IsReservedName(name))
8530 return PET_NAME_RESERVED;
8531
8532 // Check Profanity Name
8533 if (sObjectMgr->IsProfanityName(name))
8534 return PET_NAME_PROFANE;
8535
8536 return PET_NAME_SUCCESS;
8537}
@ PET_NAME_INVALID
Definition: SharedDefines.h:3660
@ PET_NAME_RESERVED
Definition: SharedDefines.h:3666
@ PET_NAME_SUCCESS
Definition: SharedDefines.h:3658
@ PET_NAME_MIXED_LANGUAGES
Definition: SharedDefines.h:3664
@ PET_NAME_TOO_SHORT
Definition: SharedDefines.h:3662
@ PET_NAME_TOO_LONG
Definition: SharedDefines.h:3663
@ PET_NAME_PROFANE
Definition: SharedDefines.h:3665
#define MAX_PET_NAME
Definition: ObjectMgr.h:685
bool isValidString(std::wstring wstr, uint32 strictMask, bool numericOrSpace, bool create=false)
Definition: ObjectMgr.cpp:8396
@ CONFIG_STRICT_PET_NAMES
Definition: IWorld.h:222
@ CONFIG_MIN_PET_NAME
Definition: IWorld.h:225

References CONFIG_MIN_PET_NAME, 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, sObjectMgr, sWorld, and Utf8toWStr().

Referenced by WorldSession::HandlePetRename().

◆ CheckPlayerName()

uint8 ObjectMgr::CheckPlayerName ( std::string_view  name,
bool  create = false 
)
static
8433{
8434 std::wstring wname;
8435
8436 // Check for invalid characters
8437 if (!Utf8toWStr(name, wname))
8439
8440 // Check for too long name
8441 if (wname.size() > MAX_PLAYER_NAME)
8442 return CHAR_NAME_TOO_LONG;
8443
8444 // Check for too short name
8445 uint32 minName = sWorld->getIntConfig(CONFIG_MIN_PLAYER_NAME);
8446 if (wname.size() < minName)
8447 return CHAR_NAME_TOO_SHORT;
8448
8449 // Check for mixed languages
8450 uint32 strictMask = sWorld->getIntConfig(CONFIG_STRICT_PLAYER_NAMES);
8451 if (!isValidString(wname, strictMask, false, create))
8453
8454 // Check for three consecutive letters
8455 wstrToLower(wname);
8456 for (std::size_t i = 2; i < wname.size(); ++i)
8457 if (wname[i] == wname[i - 1] && wname[i] == wname[i - 2])
8459
8460 // Check Reserved Name
8461 if (sObjectMgr->IsReservedName(name))
8462 return CHAR_NAME_RESERVED;
8463
8464 // Check Profanity Name
8465 if (sObjectMgr->IsProfanityName(name))
8466 return CHAR_NAME_PROFANE;
8467
8468 return CHAR_NAME_SUCCESS;
8469}
@ CHAR_NAME_TOO_SHORT
Definition: SharedDefines.h:3422
@ CHAR_NAME_THREE_CONSECUTIVE
Definition: SharedDefines.h:3430
@ CHAR_NAME_INVALID_CHARACTER
Definition: SharedDefines.h:3424
@ CHAR_NAME_TOO_LONG
Definition: SharedDefines.h:3423
@ CHAR_NAME_RESERVED
Definition: SharedDefines.h:3427
@ CHAR_NAME_MIXED_LANGUAGES
Definition: SharedDefines.h:3425
@ CHAR_NAME_PROFANE
Definition: SharedDefines.h:3426
@ CHAR_NAME_SUCCESS
Definition: SharedDefines.h:3419
#define MAX_PLAYER_NAME
Definition: ObjectMgr.h:683
@ CONFIG_STRICT_PLAYER_NAMES
Definition: IWorld.h:219
@ CONFIG_MIN_PLAYER_NAME
Definition: IWorld.h:223

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_PLAYER_NAMES, isValidString(), MAX_PLAYER_NAME, 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
1663{
1664 npcflag = cinfo->npcflag;
1665 unit_flags = cinfo->unit_flags;
1666 dynamicflags = cinfo->dynamicflags;
1667
1668 if (data)
1669 {
1670 if (data->npcflag)
1671 npcflag = data->npcflag;
1672
1673 if (data->unit_flags)
1674 unit_flags = data->unit_flags;
1675
1676 if (data->dynamicflags)
1677 dynamicflags = data->dynamicflags;
1678 }
1679}

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

Referenced by Creature::UpdateEntry().

◆ ChooseDisplayId()

CreatureModel const * ObjectMgr::ChooseDisplayId ( CreatureTemplate const *  cinfo,
CreatureData const *  data = nullptr 
)
static
1648{
1649 // Load creature model (display id)
1650 if (data && data->displayid)
1651 if (CreatureModel const* model = cinfo->GetModelWithDisplayId(data->displayid))
1652 return model;
1653
1654 if (!(cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER))
1655 if (CreatureModel const* model = cinfo->GetRandomValidModel())
1656 return model;
1657
1658 // Triggers by default receive the invisible model
1659 return cinfo->GetFirstInvisibleModel();
1660}
@ CREATURE_FLAG_EXTRA_TRIGGER
Definition: CreatureData.h:52

References CREATURE_FLAG_EXTRA_TRIGGER, CreatureData::displayid, CreatureTemplate::flags_extra, CreatureTemplate::GetFirstInvisibleModel(), CreatureTemplate::GetModelWithDisplayId(), and CreatureTemplate::GetRandomValidModel().

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

◆ DeleteCreatureData()

void ObjectMgr::DeleteCreatureData ( ObjectGuid::LowType  spawnId)
8033{
8034 // remove mapid*cellid -> guid_set map
8035 CreatureData const* data = GetCreatureData(guid);
8036 if (data)
8037 RemoveCreatureFromGrid(guid, data);
8038
8039 _creatureDataStore.erase(guid);
8040}
CreatureDataContainer _creatureDataStore
Definition: ObjectMgr.h:1570
void RemoveCreatureFromGrid(ObjectGuid::LowType guid, CreatureData const *data)
Definition: ObjectMgr.cpp:2315
CreatureData const * GetCreatureData(ObjectGuid::LowType spawnId) const
Definition: ObjectMgr.h:1198

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

◆ DeleteGameTele()

bool ObjectMgr::DeleteGameTele ( std::string_view  name)
9005{
9006 // explicit name case
9007 std::wstring wname;
9008 if (!Utf8toWStr(name, wname))
9009 return false;
9010
9011 // converting string that we try to find to lower case
9012 wstrToLower(wname);
9013
9014 for (GameTeleContainer::iterator itr = _gameTeleStore.begin(); itr != _gameTeleStore.end(); ++itr)
9015 {
9016 if (itr->second.wnameLow == wname)
9017 {
9019
9020 stmt->SetData(0, itr->second.name);
9021
9022 WorldDatabase.Execute(stmt);
9023
9024 _gameTeleStore.erase(itr);
9025 return true;
9026 }
9027 }
9028
9029 return false;
9030}
@ 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)
8043{
8044 // remove mapid*cellid -> guid_set map
8045 GameObjectData const* data = GetGameObjectData(guid);
8046 if (data)
8047 RemoveGameobjectFromGrid(guid, data);
8048
8049 _gameObjectDataStore.erase(guid);
8050}
GameObjectData const * GetGameObjectData(ObjectGuid::LowType spawnId) const
Definition: ObjectMgr.h:1215
GameObjectDataContainer _gameObjectDataStore
Definition: ObjectMgr.h:1584
void RemoveGameobjectFromGrid(ObjectGuid::LowType guid, GameObjectData const *data)
Definition: ObjectMgr.cpp:2618

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

◆ GenerateAuctionID()

uint32 ObjectMgr::GenerateAuctionID ( )
7025{
7026 if (_auctionId >= 0xFFFFFFFE)
7027 {
7028 LOG_ERROR("server.worldserver", "Auctions ids overflow!! Can't continue, shutting down server. ");
7030 }
7031 return _auctionId++;
7032}
@ ERROR_EXIT_CODE
Definition: World.h:54
static void StopNow(uint8 exitcode)
Definition: World.h:253

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

◆ GenerateCreatureSpawnId()

uint32 ObjectMgr::GenerateCreatureSpawnId ( )
7056{
7057 if (_creatureSpawnId >= uint32(0xFFFFFF))
7058 {
7059 LOG_ERROR("server.worldserver", "Creature spawn id overflow!! Can't continue, shutting down server. Search on forum for TCE00007 for more info.");
7061 }
7062 return _creatureSpawnId++;
7063}

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

Referenced by AddCreData().

◆ GenerateEquipmentSetGuid()

uint64 ObjectMgr::GenerateEquipmentSetGuid ( )
7035{
7036 if (_equipmentSetGuid >= uint64(0xFFFFFFFFFFFFFFFELL))
7037 {
7038 LOG_ERROR("server.worldserver", "EquipmentSet guid overflow!! Can't continue, shutting down server. ");
7040 }
7041 return _equipmentSetGuid++;
7042}
std::uint64_t uint64
Definition: Define.h:106

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

◆ GenerateGameObjectSpawnId()

uint32 ObjectMgr::GenerateGameObjectSpawnId ( )
7066{
7067 if (_gameObjectSpawnId >= uint32(0xFFFFFF))
7068 {
7069 LOG_ERROR("server.worldserver", "GameObject spawn id overflow!! Can't continue, shutting down server. Search on forum for TCE00007 for more info. ");
7071 }
7072 return _gameObjectSpawnId++;
7073}

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

Referenced by AddGOData().

◆ GenerateMailID()

uint32 ObjectMgr::GenerateMailID ( )
7045{
7046 if (_mailId >= 0xFFFFFFFE)
7047 {
7048 LOG_ERROR("server.worldserver", "Mail ids overflow!! Can't continue, shutting down server. ");
7050 }
7051 std::lock_guard<std::mutex> guard(_mailIdMutex);
7052 return _mailId++;
7053}
std::mutex _mailIdMutex
Definition: ObjectMgr.h:1452

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

◆ GeneratePetName()

std::string ObjectMgr::GeneratePetName ( uint32  entry)
7532{
7533 std::vector<std::string>& list0 = _petHalfName0[entry];
7534 std::vector<std::string>& list1 = _petHalfName1[entry];
7535
7536 if (list0.empty() || list1.empty())
7537 {
7538 CreatureTemplate const* cinfo = GetCreatureTemplate(entry);
7539 char const* petname = GetPetName(cinfo->family, sWorld->GetDefaultDbcLocale());
7540 if (!petname)
7541 return cinfo->Name;
7542
7543 return std::string(petname);
7544 }
7545
7546 return *(list0.begin() + urand(0, list0.size() - 1)) + *(list1.begin() + urand(0, list1.size() - 1));
7547}
char const * GetPetName(uint32 petfamily, uint32 dbclang)
Definition: DBCStores.cpp:665
std::string Name
Definition: CreatureData.h:191
HalfNameContainer _petHalfName1
Definition: ObjectMgr.h:1559
HalfNameContainer _petHalfName0
Definition: ObjectMgr.h:1558

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

Referenced by GeneratePetNameLocale().

◆ GeneratePetNameLocale()

std::string ObjectMgr::GeneratePetNameLocale ( uint32  entry,
LocaleConstant  locale 
)
7519{
7520 std::vector<std::string>& list0 = _petHalfLocaleName0[std::make_pair(entry, locale)];
7521 std::vector<std::string>& list1 = _petHalfLocaleName1[std::make_pair(entry, locale)];
7522
7523 if (list0.empty() || list1.empty())
7524 {
7525 return GeneratePetName(entry);
7526 }
7527
7528 return *(list0.begin() + urand(0, list0.size() - 1)) + *(list1.begin() + urand(0, list1.size() - 1));
7529}
HalfNameContainerLocale _petHalfLocaleName0
Definition: ObjectMgr.h:1561
HalfNameContainerLocale _petHalfLocaleName1
Definition: ObjectMgr.h:1562
std::string GeneratePetName(uint32 entry)
Definition: ObjectMgr.cpp:7531

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

◆ GeneratePetNumber()

uint32 ObjectMgr::GeneratePetNumber ( )
7550{
7551 std::lock_guard<std::mutex> guard(_hiPetNumberMutex);
7552 return ++_hiPetNumber;
7553}
std::mutex _hiPetNumberMutex
Definition: ObjectMgr.h:1454

References _hiPetNumber, and _hiPetNumberMutex.

◆ GetAccessRequirement()

DungeonProgressionRequirements const * ObjectMgr::GetAccessRequirement ( uint32  mapid,
Difficulty  difficulty 
) const
inline
870 {
871 DungeonProgressionRequirementsContainer::const_iterator itr = _accessRequirementStore.find(mapid);
872 if (itr != _accessRequirementStore.end())
873 {
874 std::unordered_map<uint8, DungeonProgressionRequirements*> difficultiesProgressionRequirements = itr->second;
875 auto difficultiesItr = difficultiesProgressionRequirements.find(difficulty);
876 if (difficultiesItr != difficultiesProgressionRequirements.end())
877 {
878 return difficultiesItr->second;
879 }
880 }
881 return nullptr;
882 }

References _accessRequirementStore.

◆ GetAcoreString() [1/2]

AcoreString const * ObjectMgr::GetAcoreString ( uint32  entry) const
inline
1304 {
1305 AcoreStringContainer::const_iterator itr = _acoreStringStore.find(entry);
1306 if (itr == _acoreStringStore.end())
1307 return nullptr;
1308
1309 return &itr->second;
1310 }
AcoreStringContainer _acoreStringStore
Definition: ObjectMgr.h:1602

References _acoreStringStore.

Referenced by GetAcoreString(), and GetAcoreStringForDBCLocale().

◆ GetAcoreString() [2/2]

char const * ObjectMgr::GetAcoreString ( uint32  entry,
LocaleConstant  locale 
) const
8738{
8739 if (AcoreString const* ts = GetAcoreString(entry))
8740 {
8741 if (ts->Content.size() > std::size_t(locale) && !ts->Content[locale].empty())
8742 return ts->Content[locale].c_str();
8743
8744 return ts->Content[DEFAULT_LOCALE].c_str();
8745 }
8746
8747 LOG_ERROR("sql.sql", "Acore string entry {} not found in DB.", entry);
8748
8749 return "<error>";
8750}
#define DEFAULT_LOCALE
Definition: Common.h:79
Definition: ObjectMgr.h:501
AcoreString const * GetAcoreString(uint32 entry) const
Definition: ObjectMgr.h:1303

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

◆ GetAcoreStringForDBCLocale()

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

References DBCLocaleIndex, and GetAcoreString().

◆ GetAllAreaTriggerScriptData()

AreaTriggerScriptContainer const & ObjectMgr::GetAllAreaTriggerScriptData ( ) const
inline
887{ return _areaTriggerScriptStore; }
AreaTriggerScriptContainer _areaTriggerScriptStore
Definition: ObjectMgr.h:1485

References _areaTriggerScriptStore.

◆ GetAllCreatureData()

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

References _creatureDataStore.

◆ GetAllGOData()

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

References _gameObjectDataStore.

◆ GetAllServerMailStore()

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

References _serverMailStore.

◆ GetAreaTrigger()

AreaTrigger const * ObjectMgr::GetAreaTrigger ( uint32  trigger) const
inline
854 {
855 AreaTriggerContainer::const_iterator itr = _areaTriggerStore.find(trigger);
856 if (itr != _areaTriggerStore.end())
857 return &itr->second;
858 return nullptr;
859 }
AreaTriggerContainer _areaTriggerStore
Definition: ObjectMgr.h:1483

References _areaTriggerStore.

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

◆ GetAreaTriggerScriptId()

uint32 ObjectMgr::GetAreaTriggerScriptId ( uint32  trigger_id)
8830{
8831 AreaTriggerScriptContainer::const_iterator i = _areaTriggerScriptStore.find(trigger_id);
8832 if (i != _areaTriggerScriptStore.end())
8833 return i->second;
8834 return 0;
8835}

References _areaTriggerScriptStore.

◆ GetAreaTriggerTeleport()

AreaTriggerTeleport const * ObjectMgr::GetAreaTriggerTeleport ( uint32  trigger) const
inline
862 {
863 AreaTriggerTeleportContainer::const_iterator itr = _areaTriggerTeleportStore.find(trigger);
864 if (itr != _areaTriggerTeleportStore.end())
865 return &itr->second;
866 return nullptr;
867 }
AreaTriggerTeleportContainer _areaTriggerTeleportStore
Definition: ObjectMgr.h:1484

References _areaTriggerTeleportStore.

◆ GetBaseReputationOf()

int32 ObjectMgr::GetBaseReputationOf ( FactionEntry const *  factionEntry,
uint8  race,
uint8  playerClass 
)
8844{
8845 if (!factionEntry)
8846 return 0;
8847
8848 uint32 raceMask = (1 << (race - 1));
8849 uint32 classMask = (1 << (playerClass - 1));
8850
8851 for (int i = 0; i < 4; i++)
8852 {
8853 if ((!factionEntry->BaseRepClassMask[i] ||
8854 factionEntry->BaseRepClassMask[i] & classMask) &&
8855 (!factionEntry->BaseRepRaceMask[i] ||
8856 factionEntry->BaseRepRaceMask[i] & raceMask))
8857 return factionEntry->BaseRepValue[i];
8858 }
8859
8860 return 0;
8861}

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

◆ GetBaseXP()

uint32 ObjectMgr::GetBaseXP ( uint8  level)
7460{
7461 return _baseXPTable[level] ? _baseXPTable[level] : 0;
7462}
BaseXPContainer _baseXPTable
Definition: ObjectMgr.h:1552

References _baseXPTable.

◆ GetBroadcastText()

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

References _broadcastTextStore.

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

◆ GetCellObjectGuids()

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

References _emptyCellObjectGuids, _mapObjectGuidsStore, and MAKE_PAIR32().

◆ GetCreatureAddon()

CreatureAddon const * ObjectMgr::GetCreatureAddon ( ObjectGuid::LowType  lowguid)
1435{
1436 CreatureAddonContainer::const_iterator itr = _creatureAddonStore.find(lowguid);
1437 if (itr != _creatureAddonStore.end())
1438 return &(itr->second);
1439
1440 return nullptr;
1441}
CreatureAddonContainer _creatureAddonStore
Definition: ObjectMgr.h:1575

References _creatureAddonStore.

◆ GetCreatureBaseStats()

CreatureBaseStats const * ObjectMgr::GetCreatureBaseStats ( uint8  level,
uint8  unitClass 
)
9741{
9742 CreatureBaseStatsContainer::const_iterator it = _creatureBaseStatsStore.find(MAKE_PAIR16(level, unitClass));
9743
9744 if (it != _creatureBaseStatsStore.end())
9745 return &(it->second);
9746
9747 struct DefaultCreatureBaseStats : public CreatureBaseStats
9748 {
9749 DefaultCreatureBaseStats()
9750 {
9751 BaseArmor = 1;
9752 for (uint8 j = 0; j < MAX_EXPANSIONS; ++j)
9753 {
9754 BaseHealth[j] = 1;
9755 BaseDamage[j] = 0.0f;
9756 }
9757 BaseMana = 0;
9758 AttackPower = 0;
9759 RangedAttackPower = 0;
9760 }
9761 };
9762 static const DefaultCreatureBaseStats defStats;
9763 return &defStats;
9764}
uint16 MAKE_PAIR16(uint8 l, uint8 h)
Definition: ObjectDefines.h:82
CreatureBaseStatsContainer _creatureBaseStatsStore
Definition: ObjectMgr.h:1536

References _creatureBaseStatsStore, MAKE_PAIR16(), and MAX_EXPANSIONS.

Referenced by AddCreData().

◆ GetCreatureData()

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

References _creatureDataStore.

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

◆ GetCreatureLocale()

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

References _creatureLocaleStore.

◆ GetCreatureModelInfo()

CreatureModelInfo const * ObjectMgr::GetCreatureModelInfo ( uint32  modelId) const
1639{
1640 CreatureModelContainer::const_iterator itr = _creatureModelStore.find(modelId);
1641 if (itr != _creatureModelStore.end())
1642 return &(itr->second);
1643
1644 return nullptr;
1645}
CreatureModelContainer _creatureModelStore
Definition: ObjectMgr.h:1574

References _creatureModelStore.

Referenced by GetCreatureModelRandomGender(), and LoadCreatureTemplateModels().

◆ GetCreatureModelRandomGender()

CreatureModelInfo const * ObjectMgr::GetCreatureModelRandomGender ( CreatureModel model,
CreatureTemplate const *  creatureTemplate 
) const
1682{
1683 CreatureModelInfo const* modelInfo = GetCreatureModelInfo(model->CreatureDisplayID);
1684 if (!modelInfo)
1685 return nullptr;
1686
1687 // If a model for another gender exists, 50% chance to use it
1688 if (modelInfo->modelid_other_gender != 0 && urand(0, 1) == 0)
1689 {
1690 CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->modelid_other_gender);
1691 if (!minfo_tmp)
1692 LOG_ERROR("sql.sql", "Model (Entry: {}) has modelid_other_gender {} not found in table `creature_model_info`. ", model->CreatureDisplayID, modelInfo->modelid_other_gender);
1693 else
1694 {
1695 // Model ID changed
1696 model->CreatureDisplayID = modelInfo->modelid_other_gender;
1697 if (creatureTemplate)
1698 {
1699 auto itr = std::find_if(creatureTemplate->Models.begin(), creatureTemplate->Models.end(), [&](CreatureModel const& templateModel)
1700 {
1701 return templateModel.CreatureDisplayID == modelInfo->modelid_other_gender;
1702 });
1703 if (itr != creatureTemplate->Models.end())
1704 *model = *itr;
1705 }
1706 return minfo_tmp;
1707 }
1708 }
1709
1710 return modelInfo;
1711}
uint32 CreatureDisplayID
Definition: CreatureData.h:179
Definition: CreatureData.h:398
uint32 modelid_other_gender
Definition: CreatureData.h:402
CreatureModelInfo const * GetCreatureModelInfo(uint32 modelId) const
Definition: ObjectMgr.cpp:1638

References CreatureModel::CreatureDisplayID, GetCreatureModelInfo(), LOG_ERROR, CreatureModelInfo::modelid_other_gender, CreatureTemplate::Models, and urand().

Referenced by GetTaxiMountDisplayId().

◆ GetCreatureMovementOverride()

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

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

◆ GetCreatureQuestInvolvedRelationBounds()

QuestRelationBounds ObjectMgr::GetCreatureQuestInvolvedRelationBounds ( uint32  creature_entry)
inline
999 {
1000 return _creatureQuestInvolvedRelations.equal_range(creature_entry);
1001 }
QuestRelations _creatureQuestInvolvedRelations
Definition: ObjectMgr.h:1502

References _creatureQuestInvolvedRelations.

◆ GetCreatureQuestInvolvedRelationMap()

QuestRelations * ObjectMgr::GetCreatureQuestInvolvedRelationMap ( )
inline

◆ GetCreatureQuestItemList()

CreatureQuestItemList const * ObjectMgr::GetCreatureQuestItemList ( uint32  id) const
inline
817 {
818 CreatureQuestItemMap::const_iterator itr = _creatureQuestItemStore.find(id);
819 if (itr != _creatureQuestItemStore.end())
820 return &itr->second;
821 return nullptr;
822 }
CreatureQuestItemMap _creatureQuestItemStore
Definition: ObjectMgr.h:1580

References _creatureQuestItemStore.

◆ GetCreatureQuestItemMap()

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

References _creatureQuestItemStore.

◆ GetCreatureQuestRelationBounds()

QuestRelationBounds ObjectMgr::GetCreatureQuestRelationBounds ( uint32  creature_entry)
inline
994 {
995 return _creatureQuestRelations.equal_range(creature_entry);
996 }
QuestRelations _creatureQuestRelations
Definition: ObjectMgr.h:1501

References _creatureQuestRelations.

◆ GetCreatureQuestRelationMap()

QuestRelations * ObjectMgr::GetCreatureQuestRelationMap ( )
inline
984 {
986 }

References _creatureQuestRelations.

◆ GetCreatureTemplate()

◆ GetCreatureTemplateAddon()

CreatureAddon const * ObjectMgr::GetCreatureTemplateAddon ( uint32  entry)
1444{
1445 CreatureAddonContainer::const_iterator itr = _creatureTemplateAddonStore.find(entry);
1446 if (itr != _creatureTemplateAddonStore.end())
1447 return &(itr->second);
1448
1449 return nullptr;
1450}
CreatureAddonContainer _creatureTemplateAddonStore
Definition: ObjectMgr.h:1576

References _creatureTemplateAddonStore.

◆ GetCreatureTemplates()

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

References _creatureTemplateStore.

◆ GetDBCLocaleIndex()

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

References DBCLocaleIndex.

◆ GetDungeonEncounterList()

DungeonEncounterList const * ObjectMgr::GetDungeonEncounterList ( uint32  mapId,
Difficulty  difficulty 
)
inline
938 {
939 std::unordered_map<uint32, DungeonEncounterList>::const_iterator itr = _dungeonEncounterStore.find(MAKE_PAIR32(mapId, difficulty));
940 if (itr != _dungeonEncounterStore.end())
941 return &itr->second;
942 return nullptr;
943 }

References _dungeonEncounterStore, and MAKE_PAIR32().

◆ GetEquipmentInfo()

EquipmentInfo const * ObjectMgr::GetEquipmentInfo ( uint32  entry,
int8 id 
)
1458{
1459 EquipmentInfoContainer::const_iterator itr = _equipmentInfoStore.find(entry);
1460 if (itr == _equipmentInfoStore.end())
1461 return nullptr;
1462
1463 if (itr->second.empty())
1464 return nullptr;
1465
1466 if (id == -1) // select a random element
1467 {
1468 EquipmentInfoContainerInternal::const_iterator ritr = itr->second.begin();
1469 std::advance(ritr, urand(0u, itr->second.size() - 1));
1470 id = std::distance(itr->second.begin(), ritr) + 1;
1471 return &ritr->second;
1472 }
1473 else
1474 {
1475 EquipmentInfoContainerInternal::const_iterator itr2 = itr->second.find(id);
1476 if (itr2 != itr->second.end())
1477 return &itr2->second;
1478 }
1479
1480 return nullptr;
1481}
EquipmentInfoContainer _equipmentInfoStore
Definition: ObjectMgr.h:1581

References _equipmentInfoStore, and urand().

Referenced by LoadCreatures().

◆ GetFishingBaseSkillLevel()

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

References _fishingBaseForAreaStore.

◆ GetGameObjectAddon()

GameObjectAddon const * ObjectMgr::GetGameObjectAddon ( ObjectGuid::LowType  lowguid)
1426{
1427 GameObjectAddonContainer::const_iterator itr = _gameObjectAddonStore.find(lowguid);
1428 if (itr != _gameObjectAddonStore.end())
1429 return &(itr->second);
1430
1431 return nullptr;
1432}
GameObjectAddonContainer _gameObjectAddonStore
Definition: ObjectMgr.h:1578

References _gameObjectAddonStore.

◆ GetGameObjectData()

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

References _gameObjectDataStore.

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

◆ GetGameObjectLocale()

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

References _gameObjectLocaleStore.

◆ GetGameObjectQuestItemList()

GameObjectQuestItemList const * ObjectMgr::GetGameObjectQuestItemList ( uint32  id) const
inline
808 {
809 GameObjectQuestItemMap::const_iterator itr = _gameObjectQuestItemStore.find(id);
810 if (itr != _gameObjectQuestItemStore.end())
811 return &itr->second;
812 return nullptr;
813 }
GameObjectQuestItemMap _gameObjectQuestItemStore
Definition: ObjectMgr.h:1579

References _gameObjectQuestItemStore.

◆ GetGameObjectQuestItemMap()

GameObjectQuestItemMap const * ObjectMgr::GetGameObjectQuestItemMap ( ) const
inline

◆ GetGameObjectTemplate()

GameObjectTemplate const * ObjectMgr::GetGameObjectTemplate ( uint32  entry)
10065{
10066 GameObjectTemplateContainer::const_iterator itr = _gameObjectTemplateStore.find(entry);
10067 if (itr != _gameObjectTemplateStore.end())
10068 return &(itr->second);
10069
10070 return nullptr;
10071}
GameObjectTemplateContainer _gameObjectTemplateStore
Definition: ObjectMgr.h:1586

References _gameObjectTemplateStore.

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

◆ GetGameObjectTemplateAddon()

GameObjectTemplateAddon const * ObjectMgr::GetGameObjectTemplateAddon ( uint32  entry) const
10080{
10081 auto itr = _gameObjectTemplateAddonStore.find(entry);
10082 if (itr != _gameObjectTemplateAddonStore.end())
10083 return &itr->second;
10084
10085 return nullptr;
10086}
GameObjectTemplateAddonContainer _gameObjectTemplateAddonStore
Definition: ObjectMgr.h:1587

References _gameObjectTemplateAddonStore.

◆ GetGameObjectTemplates()

GameObjectTemplateContainer const * ObjectMgr::GetGameObjectTemplates ( ) const
inline

◆ GetGameTele() [1/2]

GameTele const * ObjectMgr::GetGameTele ( std::string_view  name,
bool  exactSearch = false 
) const
8949{
8950 // explicit name case
8951 std::wstring wname;
8952 if (!Utf8toWStr(name, wname))
8953 return nullptr;
8954
8955 // converting string that we try to find to lower case
8956 wstrToLower(wname);
8957
8958 // Alternative first GameTele what contains wnameLow as substring in case no GameTele location found
8959 const GameTele* alt = nullptr;
8960 for (GameTeleContainer::const_iterator itr = _gameTeleStore.begin(); itr != _gameTeleStore.end(); ++itr)
8961 {
8962 if (itr->second.wnameLow == wname)
8963 return &itr->second;
8964 else if (!exactSearch && !alt && itr->second.wnameLow.find(wname) != std::wstring::npos)
8965 alt = &itr->second;
8966 }
8967
8968 return alt;
8969}
Definition: ObjectMgr.h:132

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

◆ GetGameTele() [2/2]

GameTele const * ObjectMgr::GetGameTele ( uint32  id) const
inline
1345 {
1346 GameTeleContainer::const_iterator itr = _gameTeleStore.find(id);
1347 if (itr == _gameTeleStore.end()) return nullptr;
1348 return &itr->second;
1349 }

References _gameTeleStore.

◆ GetGameTeleMap()

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

References _gameTeleStore.

◆ GetGenerator()

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

◆ GetGoBackTrigger()

AreaTriggerTeleport const * ObjectMgr::GetGoBackTrigger ( uint32  Map) const
6924{
6925 bool useParentDbValue = false;
6926 uint32 parentId = 0;
6927 MapEntry const* mapEntry = sMapStore.LookupEntry(Map);
6928 if (!mapEntry || mapEntry->entrance_map < 0)
6929 return nullptr;
6930
6931 if (mapEntry->IsDungeon())
6932 {
6933 InstanceTemplate const* iTemplate = sObjectMgr->GetInstanceTemplate(Map);
6934
6935 if (!iTemplate)
6936 return nullptr;
6937
6938 parentId = iTemplate->Parent;
6939 useParentDbValue = true;
6940 }
6941
6942 uint32 entrance_map = uint32(mapEntry->entrance_map);
6943 for (AreaTriggerTeleportContainer::const_iterator itr = _areaTriggerTeleportStore.begin(); itr != _areaTriggerTeleportStore.end(); ++itr)
6944 if ((!useParentDbValue && itr->second.target_mapId == entrance_map) || (useParentDbValue && itr->second.target_mapId == parentId))
6945 {
6946 AreaTrigger const* atEntry = GetAreaTrigger(itr->first);
6947 if (atEntry && atEntry->map == Map)
6948 return &itr->second;
6949 }
6950 return nullptr;
6951}
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
Definition: ObjectMgr.h:420
uint32 map
Definition: ObjectMgr.h:422
AreaTrigger const * GetAreaTrigger(uint32 trigger) const
Definition: ObjectMgr.h:853
Definition: Map.h:272
uint32 Parent
Definition: Map.h:273
Definition: DBCStructure.h:1324
int32 entrance_map
Definition: DBCStructure.h:1339
bool IsDungeon() const
Definition: DBCStructure.h:1350

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

◆ GetGOQuestInvolvedRelationBounds()

QuestRelationBounds ObjectMgr::GetGOQuestInvolvedRelationBounds ( uint32  go_entry)
inline
979 {
980 return _goQuestInvolvedRelations.equal_range(go_entry);
981 }
QuestRelations _goQuestInvolvedRelations
Definition: ObjectMgr.h:1500

References _goQuestInvolvedRelations.

◆ GetGOQuestInvolvedRelationMap()

QuestRelations * ObjectMgr::GetGOQuestInvolvedRelationMap ( )
inline
969 {
971 }

References _goQuestInvolvedRelations.

◆ GetGOQuestRelationBounds()

QuestRelationBounds ObjectMgr::GetGOQuestRelationBounds ( uint32  go_entry)
inline
974 {
975 return _goQuestRelations.equal_range(go_entry);
976 }
QuestRelations _goQuestRelations
Definition: ObjectMgr.h:1499

References _goQuestRelations.

◆ GetGOQuestRelationMap()

QuestRelations * ObjectMgr::GetGOQuestRelationMap ( )
inline
964 {
965 return &_goQuestRelations;
966 }

References _goQuestRelations.

◆ GetGossipMenuItemsLocale()

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

References _gossipMenuItemsLocaleStore.

◆ GetGossipMenuItemsMapBounds()

GossipMenuItemsMapBounds ObjectMgr::GetGossipMenuItemsMapBounds ( uint32  uiMenuId) const
inline
1398 {
1399 return _gossipMenuItemsStore.equal_range(uiMenuId);
1400 }
GossipMenuItemsContainer _gossipMenuItemsStore
Definition: ObjectMgr.h:1494

References _gossipMenuItemsStore.

◆ GetGossipMenuItemsMapBoundsNonConst()

GossipMenuItemsMapBoundsNonConst ObjectMgr::GetGossipMenuItemsMapBoundsNonConst ( uint32  uiMenuId)
inline
1402 {
1403 return _gossipMenuItemsStore.equal_range(uiMenuId);
1404 }

References _gossipMenuItemsStore.

◆ GetGossipMenusMapBounds()

GossipMenusMapBounds ObjectMgr::GetGossipMenusMapBounds ( uint32  uiMenuId) const
inline
1388 {
1389 return _gossipMenusStore.equal_range(uiMenuId);
1390 }
GossipMenusContainer _gossipMenusStore
Definition: ObjectMgr.h:1493

References _gossipMenusStore.

◆ GetGossipMenusMapBoundsNonConst()

GossipMenusMapBoundsNonConst ObjectMgr::GetGossipMenusMapBoundsNonConst ( uint32  uiMenuId)
inline
1393 {
1394 return _gossipMenusStore.equal_range(uiMenuId);
1395 }

References _gossipMenusStore.

◆ GetGossipText()

GossipText const * ObjectMgr::GetGossipText ( uint32  Text_ID) const
5971{
5972 GossipTextContainer::const_iterator itr = _gossipTextStore.find(Text_ID);
5973 if (itr != _gossipTextStore.end())
5974 return &itr->second;
5975 return nullptr;
5976}
GossipTextContainer _gossipTextStore
Definition: ObjectMgr.h:1481

References _gossipTextStore.

Referenced by LoadGossipMenu().

◆ GetGuidSequenceGenerator()

template<HighGuid high>
ObjectGuidGeneratorBase & ObjectMgr::GetGuidSequenceGenerator ( )
inlineprivate
1462 {
1463 auto itr = _guidGenerators.find(high);
1464 if (itr == _guidGenerators.end())
1465 itr = _guidGenerators.insert(std::make_pair(high, std::unique_ptr<ObjectGuidGenerator<high>>(new ObjectGuidGenerator<high>()))).first;
1466
1467 return *itr->second;
1468 }
Definition: ObjectGuid.h:297
std::map< HighGuid, std::unique_ptr< ObjectGuidGeneratorBase > > _guidGenerators
Definition: ObjectMgr.h:1470

References _guidGenerators.

◆ GetInstanceTemplate()

InstanceTemplate const * ObjectMgr::GetInstanceTemplate ( uint32  mapId)
5877{
5878 InstanceTemplateContainer::const_iterator itr = _instanceTemplateStore.find(uint16(mapID));
5879 if (itr != _instanceTemplateStore.end())
5880 return &(itr->second);
5881
5882 return nullptr;
5883}
InstanceTemplateContainer _instanceTemplateStore
Definition: ObjectMgr.h:1527

References _instanceTemplateStore.

◆ GetItemLocale()

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

References _itemLocaleStore.

◆ GetItemSetNameEntry()

ItemSetNameEntry const * ObjectMgr::GetItemSetNameEntry ( uint32  itemId)
inline
780 {
781 ItemSetNameContainer::iterator itr = _itemSetNameStore.find(itemId);
782 if (itr != _itemSetNameStore.end())
783 return &itr->second;
784 return nullptr;
785 }
ItemSetNameContainer _itemSetNameStore
Definition: ObjectMgr.h:1565

References _itemSetNameStore.

◆ GetItemSetNameLocale()

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

References _itemSetNameLocaleStore.

◆ GetItemTemplate()

ItemTemplate const * ObjectMgr::GetItemTemplate ( uint32  entry)
3272{
3273 return entry < _itemTemplateStoreFast.size() ? _itemTemplateStoreFast[entry] : nullptr;
3274}
std::vector< ItemTemplate * > _itemTemplateStoreFast
Definition: ObjectMgr.h:1593

References _itemTemplateStoreFast.

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

◆ GetItemTemplateStore()

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

References _itemTemplateStore.

◆ GetItemTemplateStoreFast()

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

References _itemTemplateStoreFast.

◆ GetLinkedRespawnGuid()

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

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
1415 {
1416 if (data.size() > std::size_t(loc_idx) && !data[loc_idx].empty())
1417 value = data[loc_idx];
1418 }

◆ GetLocaleString() [2/2]

◆ GetMailLevelReward()

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

References _mailLevelRewardStore.

◆ GetMapEntranceTrigger()

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

Searches for the areatrigger which teleports players to the given map

6957{
6958 for (AreaTriggerTeleportContainer::const_iterator itr = _areaTriggerTeleportStore.begin(); itr != _areaTriggerTeleportStore.end(); ++itr)
6959 {
6960 if (itr->second.target_mapId == Map) // Id is used to determine correct Scarlet Monastery instance
6961 {
6962 // xinef: no need to check, already done at loading
6963 //AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
6964 //if (atEntry)
6965 return &itr->second;
6966 }
6967 }
6968 return nullptr;
6969}

References _areaTriggerTeleportStore.

◆ GetMapObjectGuids()

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

References _emptyCellObjectGuidsMap, _mapObjectGuidsStore, and MAKE_PAIR32().

◆ GetModuleString() [1/2]

ModuleString const * ObjectMgr::GetModuleString ( std::string  module,
uint32  id 
) const
inline
1293 {
1294 std::pair<std::string, uint32> pairKey = std::make_pair(module, id);
1295 ModuleStringContainer::const_iterator itr = _moduleStringStore.find(pairKey);
1296 if (itr == _moduleStringStore.end())
1297 return nullptr;
1298
1299 return &itr->second;
1300 }
ModuleStringContainer _moduleStringStore
Definition: ObjectMgr.h:1601

References _moduleStringStore.

Referenced by GetModuleString().

◆ GetModuleString() [2/2]

std::string const * ObjectMgr::GetModuleString ( std::string  module,
uint32  id,
LocaleConstant  locale 
) const
8689{
8690 ModuleString const* ms = GetModuleString(module, id);
8691 if (ms->Content.size())
8692 {
8693 if (ms->Content.size() > size_t(locale) && !ms->Content[locale].empty())
8694 return &ms->Content[locale];
8695
8696 return &ms->Content[DEFAULT_LOCALE];
8697 }
8698
8699 LOG_ERROR("sql.sql", "Module string module {} id {} not found in DB.", module, id);
8700
8701 return (std::string*)"error";
8702}
Definition: ObjectMgr.h:496
std::vector< std::string > Content
Definition: ObjectMgr.h:497
ModuleString const * GetModuleString(std::string module, uint32 id) const
Definition: ObjectMgr.h:1292

References ModuleString::Content, DEFAULT_LOCALE, GetModuleString(), and LOG_ERROR.

◆ GetNearestTaxiNode()

uint32 ObjectMgr::GetNearestTaxiNode ( float  x,
float  y,
float  z,
uint32  mapid,
uint32  teamId 
)
6541{
6542 bool found = false;
6543 float dist = 10000;
6544 uint32 id = 0;
6545
6546 for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
6547 {
6548 TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
6549
6550 if (!node || node->map_id != mapid || (!node->MountCreatureID[teamId == TEAM_ALLIANCE ? 1 : 0] && node->MountCreatureID[0] != 32981)) // dk flight
6551 continue;
6552
6553 uint8 field = (uint8)((i - 1) / 32);
6554 uint32 submask = 1 << ((i - 1) % 32);
6555
6556 // skip not taxi network nodes
6557 if (field >= TaxiMaskSize || (sTaxiNodesMask[field] & submask) == 0)
6558 {
6559 continue;
6560 }
6561
6562 float dist2 = (node->x - x) * (node->x - x) + (node->y - y) * (node->y - y) + (node->z - z) * (node->z - z);
6563 if (found)
6564 {
6565 if (dist2 < dist)
6566 {
6567 dist = dist2;
6568 id = i;
6569 }
6570 }
6571 else
6572 {
6573 found = true;
6574 dist = dist2;
6575 id = i;
6576 }
6577 }
6578
6579 return id;
6580}
static constexpr std::size_t TaxiMaskSize
Definition: DBCStructure.h:2247
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
TaxiMask sTaxiNodesMask
Definition: DBCStores.cpp:176
DBCStorage< TaxiNodesEntry > sTaxiNodesStore(TaxiNodesEntryfmt)
Definition: DBCStructure.h:1952
float z
Definition: DBCStructure.h:1957
uint32 map_id
Definition: DBCStructure.h:1954
float x
Definition: DBCStructure.h:1955
float y
Definition: DBCStructure.h:1956
uint32 MountCreatureID[2]
Definition: DBCStructure.h:1960

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
1282 {
1283 NpcTextLocaleContainer::const_iterator itr = _npcTextLocaleStore.find(entry);
1284 if (itr == _npcTextLocaleStore.end()) return nullptr;
1285 return &itr->second;
1286 }
NpcTextLocaleContainer _npcTextLocaleStore
Definition: ObjectMgr.h:1599

References _npcTextLocaleStore.

◆ GetNpcTrainerSpells()

TrainerSpellData const * ObjectMgr::GetNpcTrainerSpells ( uint32  entry) const
inline
1356 {
1357 CacheTrainerSpellContainer::const_iterator iter = _cacheTrainerSpellStore.find(entry);
1358 if (iter == _cacheTrainerSpellStore.end())
1359 return nullptr;
1360
1361 return &iter->second;
1362 }

References _cacheTrainerSpellStore.

◆ GetNpcVendorItemList()

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

References _cacheVendorItemStore.

Referenced by IsVendorItemValid().

◆ GetPageText()

PageText const * ObjectMgr::GetPageText ( uint32  pageEntry)
5797{
5798 PageTextContainer::const_iterator itr = _pageTextStore.find(pageEntry);
5799 if (itr != _pageTextStore.end())
5800 return &(itr->second);
5801
5802 return nullptr;
5803}
PageTextContainer _pageTextStore
Definition: ObjectMgr.h:1526

References _pageTextStore.

Referenced by LoadGameObjectTemplate(), and LoadItemTemplates().

◆ GetPageTextLocale()

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

References _pageTextLocaleStore.

◆ GetPetLevelInfo()

PetLevelInfo const * ObjectMgr::GetPetLevelInfo ( uint32  creature_id,
uint8  level 
) const
3638{
3639 if (level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
3640 level = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
3641
3642 PetLevelInfoContainer::const_iterator itr = _petInfoStore.find(creature_id);
3643 if (itr == _petInfoStore.end())
3644 return nullptr;
3645
3646 return &itr->second[level - 1]; // data for level 1 stored in [0] array element, ...
3647}

References _petInfoStore, CONFIG_MAX_PLAYER_LEVEL, and sWorld.

◆ GetPlayerClassInfo()

PlayerClassInfo const * ObjectMgr::GetPlayerClassInfo ( uint32  class_) const
inline
792 {
793 if (class_ >= MAX_CLASSES)
794 return nullptr;
795 return _playerClassInfo[class_];
796 }

References _playerClassInfo, and MAX_CLASSES.

◆ GetPlayerClassLevelInfo()

void ObjectMgr::GetPlayerClassLevelInfo ( uint32  class_,
uint8  level,
PlayerClassLevelInfo info 
) const
4305{
4306 if (level < 1 || class_ >= MAX_CLASSES)
4307 return;
4308
4309 PlayerClassInfo const* pInfo = _playerClassInfo[class_];
4310
4311 if (level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
4312 level = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
4313
4314 *info = pInfo->levelInfo[level - 1];
4315}
Definition: Player.h:296

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

◆ GetPlayerInfo()

PlayerInfo const * ObjectMgr::GetPlayerInfo ( uint32  race,
uint32  class_ 
) const
10111{
10112 if (race >= MAX_RACES)
10113 return nullptr;
10114 if (class_ >= MAX_CLASSES)
10115 return nullptr;
10116 PlayerInfo const* info = _playerInfo[race][class_];
10117 if (!info)
10118 return nullptr;
10119 return info;
10120}
Definition: Player.h:335

References _playerInfo, MAX_CLASSES, and MAX_RACES.

◆ GetPlayerLevelInfo()

void ObjectMgr::GetPlayerLevelInfo ( uint32  race,
uint32  class_,
uint8  level,
PlayerLevelInfo info 
) const
4318{
4319 if (level < 1 || race >= MAX_RACES || class_ >= MAX_CLASSES)
4320 return;
4321
4322 PlayerInfo const* pInfo = _playerInfo[race][class_];
4323 if (!pInfo)
4324 return;
4325
4326 if (level <= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
4327 *info = pInfo->levelInfo[level - 1];
4328 else
4329 BuildPlayerLevelInfo(race, class_, level, info);
4330}
void BuildPlayerLevelInfo(uint8 race, uint8 class_, uint8 level, PlayerLevelInfo *plinfo) const
Definition: ObjectMgr.cpp:4332

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

◆ GetPointOfInterest()

PointOfInterest const * ObjectMgr::GetPointOfInterest ( uint32  id) const
inline
920 {
921 PointOfInterestContainer::const_iterator itr = _pointsOfInterestStore.find(id);
922 if (itr != _pointsOfInterestStore.end())
923 return &itr->second;
924 return nullptr;
925 }
PointOfInterestContainer _pointsOfInterestStore
Definition: ObjectMgr.h:1495

References _pointsOfInterestStore.

Referenced by LoadGossipMenuItems().

◆ GetPointOfInterestLocale()

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

References _pointOfInterestLocaleStore.

◆ GetQuestForAreaTrigger()

uint32 ObjectMgr::GetQuestForAreaTrigger ( uint32  Trigger_ID) const
inline
833 {
834 QuestAreaTriggerContainer::const_iterator itr = _questAreaTriggerStore.find(Trigger_ID);
835 if (itr != _questAreaTriggerStore.end())
836 return itr->second;
837 return 0;
838 }
QuestAreaTriggerContainer _questAreaTriggerStore
Definition: ObjectMgr.h:1479

References _questAreaTriggerStore.

◆ GetQuestGreeting()

QuestGreeting const * ObjectMgr::GetQuestGreeting ( TypeID  type,
uint32  id 
) const
6271{
6272 uint8 typeIndex;
6273 if (type == TYPEID_UNIT)
6274 typeIndex = 0;
6275 else if (type == TYPEID_GAMEOBJECT)
6276 typeIndex = 1;
6277 else
6278 return nullptr;
6279
6280 std::pair<uint32, uint8> pairKey = std::make_pair(id, typeIndex);
6281 QuestGreetingContainer::const_iterator itr = _questGreetingStore.find(pairKey);
6282 if (itr == _questGreetingStore.end())
6283 return nullptr;
6284
6285 return &itr->second;
6286}
@ TYPEID_GAMEOBJECT
Definition: ObjectGuid.h:37
@ TYPEID_UNIT
Definition: ObjectGuid.h:35
QuestGreetingContainer _questGreetingStore
Definition: ObjectMgr.h:1482

References _questGreetingStore, TYPEID_GAMEOBJECT, and TYPEID_UNIT.

◆ GetQuestLocale()

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

References _questLocaleStore.

◆ GetQuestMoneyReward()

uint32 ObjectMgr::GetQuestMoneyReward ( uint8  level,
uint32  questMoneyDifficulty 
) const
10247{
10248 if (questMoneyDifficulty < MAX_QUEST_MONEY_REWARDS)
10249 {
10250 auto const& itr = _questMoneyRewards.find(level);
10251 if (itr != _questMoneyRewards.end())
10252 {
10253 return itr->second.at(questMoneyDifficulty);
10254 }
10255 }
10256
10257 return 0;
10258}
static constexpr uint32 MAX_QUEST_MONEY_REWARDS
Definition: ObjectMgr.h:715
QuestMoneyRewardStore _questMoneyRewards
Definition: ObjectMgr.h:1624

References _questMoneyRewards, and MAX_QUEST_MONEY_REWARDS.

◆ GetQuestOfferRewardLocale()

QuestOfferRewardLocale const * ObjectMgr::GetQuestOfferRewardLocale ( uint32  entry) const
inline
1270 {
1271 auto itr = _questOfferRewardLocaleStore.find(entry);
1272 if (itr == _questOfferRewardLocaleStore.end()) return nullptr;
1273 return &itr->second;
1274 }
QuestOfferRewardLocaleContainer _questOfferRewardLocaleStore
Definition: ObjectMgr.h:1597

References _questOfferRewardLocaleStore.

◆ GetQuestPOIVector()

QuestPOIVector const * ObjectMgr::GetQuestPOIVector ( uint32  questId)
inline
928 {
929 QuestPOIContainer::const_iterator itr = _questPOIStore.find(questId);
930 if (itr != _questPOIStore.end())
931 return &itr->second;
932 return nullptr;
933 }
QuestPOIContainer _questPOIStore
Definition: ObjectMgr.h:1497

References _questPOIStore.

◆ GetQuestRequestItemsLocale()

QuestRequestItemsLocale const * ObjectMgr::GetQuestRequestItemsLocale ( uint32  entry) const
inline
1276 {
1277 auto itr = _questRequestItemsLocaleStore.find(entry);
1278 if (itr == _questRequestItemsLocaleStore.end()) return nullptr;
1279 return &itr->second;
1280 }
QuestRequestItemsLocaleContainer _questRequestItemsLocaleStore
Definition: ObjectMgr.h:1598

References _questRequestItemsLocaleStore.

◆ GetQuestTemplate()

Quest const * ObjectMgr::GetQuestTemplate ( uint32  quest_id) const
inline
826 {
827 return quest_id < _questTemplatesFast.size() ? _questTemplatesFast[quest_id] : nullptr;
828 }
std::vector< Quest * > _questTemplatesFast
Definition: ObjectMgr.h:1473

References _questTemplatesFast.

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

◆ GetQuestTemplates()

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

References _questTemplates.

◆ GetRepRewardRate()

RepRewardRate const * ObjectMgr::GetRepRewardRate ( uint32  factionId) const
inline
892 {
893 RepRewardRateContainer::const_iterator itr = _repRewardRateStore.find(factionId);
894 if (itr != _repRewardRateStore.end())
895 return &itr->second;
896
897 return nullptr;
898 }
RepRewardRateContainer _repRewardRateStore
Definition: ObjectMgr.h:1489

References _repRewardRateStore.

◆ GetRepSpilloverTemplate()

RepSpilloverTemplate const * ObjectMgr::GetRepSpilloverTemplate ( uint32  factionId) const
inline
911 {
912 RepSpilloverTemplateContainer::const_iterator itr = _repSpilloverTemplateStore.find(factionId);
913 if (itr != _repSpilloverTemplateStore.end())
914 return &itr->second;
915
916 return nullptr;
917 }
RepSpilloverTemplateContainer _repSpilloverTemplateStore
Definition: ObjectMgr.h:1491

References _repSpilloverTemplateStore.

◆ GetReputationOnKilEntry()

ReputationOnKillEntry const * ObjectMgr::GetReputationOnKilEntry ( uint32  id) const
inline
901 {
902 RepOnKillContainer::const_iterator itr = _repOnKillStore.find(id);
903 if (itr != _repOnKillStore.end())
904 return &itr->second;
905 return nullptr;
906 }
RepOnKillContainer _repOnKillStore
Definition: ObjectMgr.h:1490

References _repOnKillStore.

◆ GetScriptId()

uint32 ObjectMgr::GetScriptId ( std::string const &  name)
9601{
9602 // use binary search to find the script name in the sorted vector
9603 // assume "" is the first element
9604 if (name.empty())
9605 return 0;
9606
9607 ScriptNameContainer::const_iterator itr = std::lower_bound(_scriptNamesStore.begin(), _scriptNamesStore.end(), name);
9608 if (itr == _scriptNamesStore.end() || (*itr != name))
9609 return 0;
9610
9611 return uint32(itr - _scriptNamesStore.begin());
9612}
ScriptNameContainer _scriptNamesStore
Definition: ObjectMgr.h:1514

References _scriptNamesStore.

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

◆ GetScriptName()

std::string const & ObjectMgr::GetScriptName ( uint32  id) const
9595{
9596 static std::string const empty = "";
9597 return (id < _scriptNamesStore.size()) ? _scriptNamesStore[id] : empty;
9598}

References _scriptNamesStore.

Referenced by ValidateSpellScripts().

◆ GetScriptNames()

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

References _scriptNamesStore.

◆ GetSpellClickInfoMapBounds()

SpellClickInfoMapBounds ObjectMgr::GetSpellClickInfoMapBounds ( uint32  creature_id) const
inline
1383 {
1384 return _spellClickInfoStore.equal_range(creature_id);
1385 }
SpellClickInfoContainer _spellClickInfoStore
Definition: ObjectMgr.h:1516

References _spellClickInfoStore.

◆ GetSpellScriptsBounds()

SpellScriptsBounds ObjectMgr::GetSpellScriptsBounds ( uint32  spell_id)
8838{
8839 return SpellScriptsBounds(_spellScriptsStore.lower_bound(spell_id), _spellScriptsStore.upper_bound(spell_id));
8840}
std::pair< SpellScriptsContainer::iterator, SpellScriptsContainer::iterator > SpellScriptsBounds
Definition: ObjectMgr.h:388
SpellScriptsContainer _spellScriptsStore
Definition: ObjectMgr.h:1518

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

References _tempSummonDataStore.

◆ GetTaxiMountDisplayId()

uint32 ObjectMgr::GetTaxiMountDisplayId ( uint32  id,
TeamId  teamId,
bool  allowed_alt_team = false 
)
6607{
6608 CreatureModel mountModel;
6609 CreatureTemplate const* mount_info = nullptr;
6610
6611 // select mount creature id
6612 TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id);
6613 if (node)
6614 {
6615 uint32 mount_entry = node->MountCreatureID[teamId == TEAM_ALLIANCE ? 1 : 0];
6616
6617 // Fix for Alliance not being able to use Acherus taxi
6618 // only one mount type for both sides
6619 if (mount_entry == 0 && allowed_alt_team)
6620 {
6621 // Simply reverse the selection. At least one team in theory should have a valid mount ID to choose.
6622 mount_entry = node->MountCreatureID[teamId];
6623 }
6624
6625 mount_info = GetCreatureTemplate(mount_entry);
6626 if (mount_info)
6627 {
6628 CreatureModel const* model = mount_info->GetRandomValidModel();
6629 if (!model)
6630 {
6631 LOG_ERROR("sql.sql", "No displayid found for the taxi mount with the entry {}! Can't load it!", mount_entry);
6632 return 0;
6633 }
6634 mountModel = *model;
6635 }
6636 }
6637
6638 // minfo is not actually used but the mount_id was updated
6639 GetCreatureModelRandomGender(&mountModel, mount_info);
6640
6641 return mountModel.CreatureDisplayID;
6642}
CreatureModel const * GetRandomValidModel() const
Definition: Creature.cpp:126
CreatureModelInfo const * GetCreatureModelRandomGender(CreatureModel *model, CreatureTemplate const *creatureTemplate) const
Definition: ObjectMgr.cpp:1681

References CreatureModel::CreatureDisplayID, GetCreatureModelRandomGender(), GetCreatureTemplate(), CreatureTemplate::GetRandomValidModel(), LOG_ERROR, TaxiNodesEntry::MountCreatureID, sTaxiNodesStore, and TEAM_ALLIANCE.

◆ GetTaxiPath()

void ObjectMgr::GetTaxiPath ( uint32  source,
uint32  destination,
uint32 path,
uint32 cost 
)
6583{
6584 TaxiPathSetBySource::iterator src_i = sTaxiPathSetBySource.find(source);
6585 if (src_i == sTaxiPathSetBySource.end())
6586 {
6587 path = 0;
6588 cost = 0;
6589 return;
6590 }
6591
6592 TaxiPathSetForSource& pathSet = src_i->second;
6593
6594 TaxiPathSetForSource::iterator dest_i = pathSet.find(destination);
6595 if (dest_i == pathSet.end())
6596 {
6597 path = 0;
6598 cost = 0;
6599 return;
6600 }
6601
6602 cost = dest_i->second->price;
6603 path = dest_i->second->ID;
6604}
std::map< uint32, TaxiPathEntry const * > TaxiPathSetForSource
Definition: DBCStructure.h:2241
TaxiPathSetBySource sTaxiPathSetBySource
Definition: DBCStores.cpp:183

References sTaxiPathSetBySource.

◆ GetVehicleAccessoryList()

VehicleAccessoryList const * ObjectMgr::GetVehicleAccessoryList ( Vehicle veh) const
10094{
10095 if (Creature* cre = veh->GetBase()->ToCreature())
10096 {
10097 // Give preference to GUID-based accessories
10098 VehicleAccessoryContainer::const_iterator itr = _vehicleAccessoryStore.find(cre->GetSpawnId());
10099 if (itr != _vehicleAccessoryStore.end())
10100 return &itr->second;
10101 }
10102
10103 // Otherwise return entry-based
10104 VehicleAccessoryContainer::const_iterator itr = _vehicleTemplateAccessoryStore.find(veh->GetCreatureEntry());
10105 if (itr != _vehicleTemplateAccessoryStore.end())
10106 return &itr->second;
10107 return nullptr;
10108}
Creature * ToCreature()
Definition: Object.h:202
Unit * GetBase() const
May be called from scripts.
Definition: Vehicle.h:37
uint32 GetCreatureEntry() const
Definition: Vehicle.h:39
VehicleAccessoryContainer _vehicleAccessoryStore
Definition: ObjectMgr.h:1521
VehicleAccessoryContainer _vehicleTemplateAccessoryStore
Definition: ObjectMgr.h:1520

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

◆ GetVehicleSeatAddon()

VehicleSeatAddon const * ObjectMgr::GetVehicleSeatAddon ( uint32  seatId) const
inline
1437 {
1438 VehicleSeatAddonContainer::const_iterator itr = _vehicleSeatAddonStore.find(seatId);
1439 if (itr == _vehicleSeatAddonStore.end())
1440 return nullptr;
1441
1442 return &itr->second;
1443 }
VehicleSeatAddonContainer _vehicleSeatAddonStore
Definition: ObjectMgr.h:1522

References _vehicleSeatAddonStore.

◆ GetXPForLevel()

uint32 ObjectMgr::GetXPForLevel ( uint8  level) const
7465{
7466 if (level < _playerXPperLevel.size())
7467 return _playerXPperLevel[level];
7468 return 0;
7469}
PlayerXPperLevel _playerXPperLevel
Definition: ObjectMgr.h:1549

References _playerXPperLevel.

◆ InitializeSpellInfoPrecomputedData()

void ObjectMgr::InitializeSpellInfoPrecomputedData ( )
5744{
5745 uint32 limit = sSpellStore.GetNumRows();
5746 for(uint32 i = 0; i <= limit; ++i)
5747 if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i))
5748 {
5749 const_cast<SpellInfo*>(spellInfo)->SetStackableWithRanks(spellInfo->ComputeIsStackableWithRanks());
5750 const_cast<SpellInfo*>(spellInfo)->SetCritCapable(spellInfo->ComputeIsCritCapable());
5751 const_cast<SpellInfo*>(spellInfo)->SetSpellValid(SpellMgr::ComputeIsSpellValid(spellInfo, false));
5752 }
5753}
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)

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

◆ instance()

ObjectMgr * ObjectMgr::instance ( )
static
377{
378 static ObjectMgr instance;
379 return &instance;
380}
Definition: ObjectMgr.h:722
static ObjectMgr * instance()
Definition: ObjectMgr.cpp:376

References instance().

Referenced by instance().

◆ IsGameObjectStaticTransport()

bool ObjectMgr::IsGameObjectStaticTransport ( uint32  entry)
10074{
10075 GameObjectTemplate const* goinfo = GetGameObjectTemplate(entry);
10076 return goinfo && goinfo->type == GAMEOBJECT_TYPE_TRANSPORT;
10077}
@ GAMEOBJECT_TYPE_TRANSPORT
Definition: SharedDefines.h:1571

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

◆ IsProfanityName()

bool ObjectMgr::IsProfanityName ( std::string_view  name) const
8325{
8326 // pussywizard
8327 if (name.size() >= 2 && (name[name.size() - 2] == 'G' || name[name.size() - 2] == 'g') && (name[name.size() - 1] == 'M' || name[name.size() - 1] == 'm'))
8328 return true;
8329
8330 std::wstring wstr;
8331 if (!Utf8toWStr (name, wstr))
8332 return false;
8333
8334 wstrToLower(wstr);
8335
8336 return _profanityNamesStore.find(wstr) != _profanityNamesStore.end();
8337}

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

Referenced by AddProfanityPlayerName().

◆ IsReservedName()

bool ObjectMgr::IsReservedName ( std::string_view  name) const
8222{
8223 // pussywizard
8224 if (name.size() >= 2 && (name[name.size() - 2] == 'G' || name[name.size() - 2] == 'g') && (name[name.size() - 1] == 'M' || name[name.size() - 1] == 'm'))
8225 return true;
8226
8227 std::wstring wstr;
8228 if (!Utf8toWStr (name, wstr))
8229 return false;
8230
8231 wstrToLower(wstr);
8232
8233 return _reservedNamesStore.find(wstr) != _reservedNamesStore.end();
8234}

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

Referenced by AddReservedPlayerName().

◆ IsTavernAreaTrigger()

bool ObjectMgr::IsTavernAreaTrigger ( uint32  triggerID,
uint32  faction 
) const
inline
841 {
842 auto itr = _tavernAreaTriggerStore.find(triggerID);
843 if (itr != _tavernAreaTriggerStore.end())
844 {
845 return (itr->second & faction) != 0;
846 }
847
848 return false;
849 }
TavernAreaTriggerContainer _tavernAreaTriggerStore
Definition: ObjectMgr.h:1480

References _tavernAreaTriggerStore.

◆ IsTransportMap()

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

References _transportMaps.

◆ IsValidChannelName()

bool ObjectMgr::IsValidChannelName ( std::string const &  name)
static
8498{
8499 std::wstring wname;
8500 if (!Utf8toWStr(name, wname))
8501 return false;
8502
8503 if (wname.size() > MAX_CHANNEL_NAME)
8504 return false;
8505
8506 uint32 strictMask = sWorld->getIntConfig(CONFIG_STRICT_CHANNEL_NAMES);
8507
8508 return isValidString(wname, strictMask, true);
8509}
#define MAX_CHANNEL_NAME
Definition: ObjectMgr.h:687
@ CONFIG_STRICT_CHANNEL_NAMES
Definition: IWorld.h:221

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

◆ IsValidCharterName()

bool ObjectMgr::IsValidCharterName ( std::string_view  name)
static
8472{
8473 std::wstring wname;
8474 if (!Utf8toWStr(name, wname))
8475 return false;
8476
8477 if (wname.size() > MAX_CHARTER_NAME)
8478 return false;
8479
8480 uint32 minName = sWorld->getIntConfig(CONFIG_MIN_CHARTER_NAME);
8481 if (wname.size() < minName)
8482 return false;
8483
8484 // Check Reserved Name
8485 if (sObjectMgr->IsReservedName(name))
8486 return false;
8487
8488 // Check Profanity Name
8489 if (sObjectMgr->IsProfanityName(name))
8490 return false;
8491
8492 uint32 strictMask = sWorld->getIntConfig(CONFIG_STRICT_CHARTER_NAMES);
8493
8494 return isValidString(wname, strictMask, true);
8495}
#define MAX_CHARTER_NAME
Definition: ObjectMgr.h:686
@ CONFIG_MIN_CHARTER_NAME
Definition: IWorld.h:224
@ CONFIG_STRICT_CHARTER_NAMES
Definition: IWorld.h:220

References CONFIG_MIN_CHARTER_NAME, CONFIG_STRICT_CHARTER_NAMES, isValidString(), MAX_CHARTER_NAME, sObjectMgr, 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
9459{
9460 /*
9461 CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(vendor_entry);
9462 if (!cInfo)
9463 {
9464 if (player)
9465 ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
9466 else
9467 LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: {}), ignore", vendor_entry);
9468 return false;
9469 }
9470
9471 if (!((cInfo->npcflag | ORnpcflag) & UNIT_NPC_FLAG_VENDOR))
9472 {
9473 if (!skip_vendors || skip_vendors->count(vendor_entry) == 0)
9474 {
9475 if (player)
9476 ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
9477 else
9478 LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have data for not creature template (Entry: {}) without vendor flag, ignore", vendor_entry);
9479
9480 if (skip_vendors)
9481 skip_vendors->insert(vendor_entry);
9482 }
9483 return false;
9484 }
9485 */
9486
9487 if (!sObjectMgr->GetItemTemplate(item_id))
9488 {
9489 if (player)
9491 else
9492 LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` for Vendor (Entry: {}) have in item list non-existed item ({}), ignore", vendor_entry, item_id);
9493 return false;
9494 }
9495
9496 if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
9497 {
9498 if (player)
9500 else
9501 LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have Item (Entry: {}) with wrong ExtendedCost ({}) for vendor ({}), ignore", item_id, ExtendedCost, vendor_entry);
9502 return false;
9503 }
9504
9505 if (maxcount > 0 && incrtime == 0)
9506 {
9507 if (player)
9508 ChatHandler(player->GetSession()).PSendSysMessage("MaxCount != 0 ({}) but IncrTime == 0", maxcount);
9509 else
9510 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);
9511 return false;
9512 }
9513 else if (maxcount == 0 && incrtime > 0)
9514 {
9515 if (player)
9516 ChatHandler(player->GetSession()).PSendSysMessage("MaxCount == 0 but IncrTime<>= 0");
9517 else
9518 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);
9519 return false;
9520 }
9521
9522 VendorItemData const* vItems = GetNpcVendorItemList(vendor_entry);
9523 if (!vItems)
9524 return true; // later checks for non-empty lists
9525
9526 if (vItems->FindItemCostPair(item_id, ExtendedCost))
9527 {
9528 if (player)
9529 ChatHandler(player->GetSession()).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost);
9530 else
9531 LOG_ERROR("sql.sql", "Table `npc_vendor` has duplicate items {} (with extended cost {}) for vendor (Entry: {}), ignoring", item_id, ExtendedCost, vendor_entry);
9532 return false;
9533 }
9534
9535 return true;
9536}
@ 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
DBCStorage< ItemExtendedCostEntry > sItemExtendedCostStore(ItemExtendedCostEntryfmt)
Definition: Chat.h:37
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:210
VendorItem const * FindItemCostPair(uint32 item_id, uint32 extendedCost) const
Definition: Creature.cpp:110
WorldSession * GetSession() const
Definition: Player.h:1981
VendorItemData const * GetNpcVendorItemList(uint32 entry) const
Definition: ObjectMgr.h:1364

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

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 ( )
8705{
8706 uint32 oldMSTime = getMSTime();
8707
8708 _acoreStringStore.clear(); // for reload case
8709 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");
8710 if (!result)
8711 {
8712 LOG_WARN("server.loading", ">> Loaded 0 acore strings. DB table `acore_strings` is empty.");
8713 LOG_INFO("server.loading", " ");
8714 return false;
8715 }
8716
8717 do
8718 {
8719 Field* fields = result->Fetch();
8720
8721 uint32 entry = fields[0].Get<uint32>();
8722
8723 AcoreString& data = _acoreStringStore[entry];
8724
8725 data.Content.resize(DEFAULT_LOCALE + 1);
8726
8727 for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
8728 AddLocaleString(fields[i + 1].Get<std::string>(), LocaleConstant(i), data.Content);
8729 } while (result->NextRow());
8730
8731 LOG_INFO("server.loading", ">> Loaded {} Acore Strings in {} ms", (uint32)_acoreStringStore.size(), GetMSTimeDiffToNow(oldMSTime));
8732 LOG_INFO("server.loading", " ");
8733
8734 return true;
8735}
LocaleConstant
Definition: Common.h:65
@ TOTAL_LOCALES
Definition: Common.h:76
static void AddLocaleString(std::string &&s, LocaleConstant locale, std::vector< std::string > &data)
Definition: ObjectMgr.cpp:382

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

◆ LoadAreaTriggers()

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

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 ( )
6503{
6504 uint32 oldMSTime = getMSTime();
6505
6506 _areaTriggerScriptStore.clear(); // need for reload case
6507 QueryResult result = WorldDatabase.Query("SELECT entry, ScriptName FROM areatrigger_scripts");
6508
6509 if (!result)
6510 {
6511 LOG_WARN("server.loading", ">> Loaded 0 Areatrigger Scripts. DB Table `areatrigger_scripts` Is Empty.");
6512 LOG_INFO("server.loading", " ");
6513 return;
6514 }
6515
6516 uint32 count = 0;
6517
6518 do
6519 {
6520 ++count;
6521
6522 Field* fields = result->Fetch();
6523
6524 uint32 Trigger_ID = fields[0].Get<uint32>();
6525 std::string scriptName = fields[1].Get<std::string>();
6526
6527 AreaTrigger const* atEntry = GetAreaTrigger(Trigger_ID);
6528 if (!atEntry)
6529 {
6530 LOG_ERROR("sql.sql", "Area trigger (ID:{}) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
6531 continue;
6532 }
6533 _areaTriggerScriptStore[Trigger_ID] = GetScriptId(scriptName);
6534 } while (result->NextRow());
6535
6536 LOG_INFO("server.loading", ">> Loaded {} Areatrigger Scripts in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
6537 LOG_INFO("server.loading", " ");
6538}
uint32 GetScriptId(std::string const &name)
Definition: ObjectMgr.cpp:9600

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

◆ LoadAreaTriggerTeleports()

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

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

◆ LoadBroadcastTextLocales()

void ObjectMgr::LoadBroadcastTextLocales ( )
9700{
9701 uint32 oldMSTime = getMSTime();
9702
9703 // 0 1 2 3
9704 QueryResult result = WorldDatabase.Query("SELECT ID, locale, MaleText, FemaleText FROM broadcast_text_locale");
9705
9706 if (!result)
9707 {
9708 LOG_WARN("server.loading", ">> Loaded 0 broadcast text locales. DB table `broadcast_text_locale` is empty.");
9709 LOG_INFO("server.loading", " ");
9710 return;
9711 }
9712
9713 uint32 locales_count = 0;
9714 do
9715 {
9716 Field* fields = result->Fetch();
9717
9718 uint32 id = fields[0].Get<uint32>();
9719
9720 BroadcastTextContainer::iterator bct = _broadcastTextStore.find(id);
9721 if (bct == _broadcastTextStore.end())
9722 {
9723 LOG_ERROR("sql.sql", "BroadcastText (Id: {}) found in table `broadcast_text_locale` but does not exist in `broadcast_text`. Skipped!", id);
9724 continue;
9725 }
9726
9727 LocaleConstant locale = GetLocaleByName(fields[1].Get<std::string>());
9728 if (locale == LOCALE_enUS)
9729 continue;
9730
9731 AddLocaleString(fields[2].Get<std::string>(), locale, bct->second.MaleText);
9732 AddLocaleString(fields[3].Get<std::string>(), locale, bct->second.FemaleText);
9733 locales_count++;
9734 } while (result->NextRow());
9735
9736 LOG_INFO("server.loading", ">> Loaded {} Broadcast Text Locales in {} ms", locales_count, GetMSTimeDiffToNow(oldMSTime));
9737 LOG_INFO("server.loading", " ");
9738}
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 ( )
9615{
9616 uint32 oldMSTime = getMSTime();
9617
9618 _broadcastTextStore.clear(); // for reload case
9619
9620 // 0 1 2 3 4 5 6 7 8 9 10 11 12
9621 QueryResult result = WorldDatabase.Query("SELECT ID, LanguageID, MaleText, FemaleText, EmoteID1, EmoteID2, EmoteID3, EmoteDelay1, EmoteDelay2, EmoteDelay3, SoundEntriesID, EmotesID, Flags FROM broadcast_text");
9622 if (!result)
9623 {
9624 LOG_WARN("server.loading", ">> Loaded 0 broadcast texts. DB table `broadcast_text` is empty.");
9625 LOG_INFO("server.loading", " ");
9626 return;
9627 }
9628
9629 _broadcastTextStore.rehash(result->GetRowCount());
9630
9631 do
9632 {
9633 Field* fields = result->Fetch();
9634
9635 BroadcastText bct;
9636
9637 bct.Id = fields[0].Get<uint32>();
9638 bct.LanguageID = fields[1].Get<uint32>();
9639 bct.MaleText[DEFAULT_LOCALE] = fields[2].Get<std::string>();
9640 bct.FemaleText[DEFAULT_LOCALE] = fields[3].Get<std::string>();
9641 bct.EmoteId1 = fields[4].Get<uint32>();
9642 bct.EmoteId2 = fields[5].Get<uint32>();
9643 bct.EmoteId3 = fields[6].Get<uint32>();
9644 bct.EmoteDelay1 = fields[7].Get<uint32>();
9645 bct.EmoteDelay2 = fields[8].Get<uint32>();
9646 bct.EmoteDelay3 = fields[9].Get<uint32>();
9647 bct.SoundEntriesId = fields[10].Get<uint32>();
9648 bct.EmotesID = fields[11].Get<uint32>();
9649 bct.Flags = fields[12].Get<uint32>();
9650
9651 if (bct.SoundEntriesId)
9652 {
9653 if (!sSoundEntriesStore.LookupEntry(bct.SoundEntriesId))
9654 {
9655 LOG_DEBUG("misc", "BroadcastText (Id: {}) in table `broadcast_text` has SoundEntriesId {} but sound does not exist.", bct.Id, bct.SoundEntriesId);
9656 bct.SoundEntriesId = 0;
9657 }
9658 }
9659
9661 {
9662 LOG_DEBUG("misc", "BroadcastText (Id: {}) in table `broadcast_text` using Language {} but Language does not exist.", bct.Id, bct.LanguageID);
9664 }
9665
9666 if (bct.EmoteId1)
9667 {
9668 if (!sEmotesStore.LookupEntry(bct.EmoteId1))
9669 {
9670 LOG_DEBUG("misc", "BroadcastText (Id: {}) in table `broadcast_text` has EmoteId1 {} but emote does not exist.", bct.Id, bct.EmoteId1);
9671 bct.EmoteId1 = 0;
9672 }
9673 }
9674
9675 if (bct.EmoteId2)
9676 {
9677 if (!sEmotesStore.LookupEntry(bct.EmoteId2))
9678 {
9679 LOG_DEBUG("misc", "BroadcastText (Id: {}) in table `broadcast_text` has EmoteId2 {} but emote does not exist.", bct.Id, bct.EmoteId2);
9680 bct.EmoteId2 = 0;
9681 }
9682 }
9683
9684 if (bct.EmoteId3)
9685 {
9686 if (!sEmotesStore.LookupEntry(bct.EmoteId3))
9687 {
9688 LOG_DEBUG("misc", "BroadcastText (Id: {}) in table `broadcast_text` has EmoteId3 {} but emote does not exist.", bct.Id, bct.EmoteId3);
9689 bct.EmoteId3 = 0;
9690 }
9691 }
9692
9693 _broadcastTextStore[bct.Id] = bct;
9694 } while (result->NextRow());
9695
9696 LOG_INFO("server.loading", ">> Loaded {} Broadcast Texts in {} ms", _broadcastTextStore.size(), GetMSTimeDiffToNow(oldMSTime));
9697}
@ LANG_UNIVERSAL
Definition: SharedDefines.h:735
LanguageDesc const * GetLanguageDescByID(uint32 lang)
Definition: ObjectMgr.cpp:253
DBCStorage< SoundEntriesEntry > sSoundEntriesStore(SoundEntriesfmt)
DBCStorage< EmotesEntry > sEmotesStore(EmotesEntryfmt)
Definition: ObjectMgr.h:434
uint32 EmoteDelay2
Definition: ObjectMgr.h:449
uint32 Id
Definition: ObjectMgr.h:441
std::vector< std::string > FemaleText
Definition: ObjectMgr.h:444
uint32 EmotesID
Definition: ObjectMgr.h:452
uint32 LanguageID
Definition: ObjectMgr.h:442
uint32 EmoteId2
Definition: ObjectMgr.h:446
uint32 EmoteDelay1
Definition: ObjectMgr.h:448
uint32 SoundEntriesId
Definition: ObjectMgr.h:451
std::vector< std::string > MaleText
Definition: ObjectMgr.h:443
uint32 EmoteId3
Definition: ObjectMgr.h:447
uint32 EmoteId1
Definition: ObjectMgr.h:445
uint32 EmoteDelay3
Definition: ObjectMgr.h:450
uint32 Flags
Definition: ObjectMgr.h:453

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 ( )
1273{
1274 uint32 oldMSTime = getMSTime();
1275
1276 // 0 1 2 3 4 5 6 7
1277 QueryResult result = WorldDatabase.Query("SELECT guid, path_id, mount, bytes1, bytes2, emote, visibilityDistanceType, auras FROM creature_addon");
1278
1279 if (!result)
1280 {
1281 LOG_WARN("server.loading", ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty.");
1282 LOG_INFO("server.loading", " ");
1283 return;
1284 }
1285
1286 uint32 count = 0;
1287 do
1288 {
1289 Field* fields = result->Fetch();
1290
1291 ObjectGuid::LowType guid = fields[0].Get<uint32>();
1292
1293 CreatureData const* creData = GetCreatureData(guid);
1294 if (!creData)
1295 {
1296 LOG_ERROR("sql.sql", "Creature (GUID: {}) does not exist but has a record in `creature_addon`", guid);
1297 continue;
1298 }
1299
1300 CreatureAddon& creatureAddon = _creatureAddonStore[guid];
1301
1302 creatureAddon.path_id = fields[1].Get<uint32>();
1303 if (creData->movementType == WAYPOINT_MOTION_TYPE && !creatureAddon.path_id)
1304 {
1305 const_cast<CreatureData*>(creData)->movementType = IDLE_MOTION_TYPE;
1306 LOG_ERROR("sql.sql", "Creature (GUID {}) has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid);
1307 }
1308
1309 creatureAddon.mount = fields[2].Get<uint32>();
1310 creatureAddon.bytes1 = fields[3].Get<uint32>();
1311 creatureAddon.bytes2 = fields[4].Get<uint32>();
1312 creatureAddon.emote = fields[5].Get<uint32>();
1313 creatureAddon.visibilityDistanceType = VisibilityDistanceType(fields[6].Get<uint8>());
1314
1315 for (std::string_view aura : Acore::Tokenize(fields[7].Get<std::string_view>(), ' ', false))
1316 {
1317 SpellInfo const* spellInfo = nullptr;
1318
1319 if (Optional<uint32> spellId = Acore::StringTo<uint32>(aura))
1320 {
1321 spellInfo = sSpellMgr->GetSpellInfo(*spellId);
1322 }
1323
1324 if (!spellInfo)
1325 {
1326 LOG_ERROR("sql.sql", "Creature (GUID: {}) has wrong spell '{}' defined in `auras` field in `creature_addon`.", guid, aura);
1327 continue;
1328 }
1329
1330 if (std::find(creatureAddon.auras.begin(), creatureAddon.auras.end(), spellInfo->Id) != creatureAddon.auras.end())
1331 {
1332 LOG_ERROR("sql.sql", "Creature (GUID: {}) has duplicate aura (spell {}) in `auras` field in `creature_addon`.", guid, spellInfo->Id);
1333 continue;
1334 }
1335
1336 if (spellInfo->GetDuration() > 0)
1337 {
1338 LOG_DEBUG/*ERROR*/("sql.sql", "Creature (Entry: {}) has temporary aura (spell {}) in `auras` field in `creature_template_addon`.", guid, spellInfo->Id);
1339 // continue;
1340 }
1341
1342 creatureAddon.auras.push_back(spellInfo->Id);
1343 }
1344
1345 if (creatureAddon.mount)
1346 {
1347 if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount))
1348 {
1349 LOG_ERROR("sql.sql", "Creature (GUID: {}) has invalid displayInfoId ({}) for mount defined in `creature_addon`", guid, creatureAddon.mount);
1350 creatureAddon.mount = 0;
1351 }
1352 }
1353
1354 if (!sEmotesStore.LookupEntry(creatureAddon.emote))
1355 {
1356 LOG_ERROR("sql.sql", "Creature (GUID: {}) has invalid emote ({}) defined in `creature_addon`.", guid, creatureAddon.emote);
1357 creatureAddon.emote = 0;
1358 }
1359
1360 if (creatureAddon.visibilityDistanceType >= VisibilityDistanceType::Max)
1361 {
1362 LOG_ERROR("sql.sql", "Creature (GUID: {}) has invalid visibilityDistanceType ({}) defined in `creature_addon`.", guid, AsUnderlyingType(creatureAddon.visibilityDistanceType));
1363 creatureAddon.visibilityDistanceType = VisibilityDistanceType::Normal;
1364 }
1365
1366 ++count;
1367 } while (result->NextRow());
1368
1369 LOG_INFO("server.loading", ">> Loaded {} Creature Addons in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
1370 LOG_INFO("server.loading", " ");
1371}
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:619
VisibilityDistanceType
Definition: ObjectDefines.h:61
DBCStorage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore(CreatureDisplayInfofmt)
@ WAYPOINT_MOTION_TYPE
Definition: MotionMaster.h:41
std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
Definition: Tokenize.cpp:20
Definition: CreatureData.h:440
std::vector< uint32 > auras
Definition: CreatureData.h:446
uint32 mount
Definition: CreatureData.h:442
uint32 emote
Definition: CreatureData.h:445
uint32 path_id
Definition: CreatureData.h:441
VisibilityDistanceType visibilityDistanceType
Definition: CreatureData.h:447
uint32 bytes1
Definition: CreatureData.h:443
uint32 bytes2
Definition: CreatureData.h:444
uint32 Id
Definition: SpellInfo.h:320
int32 GetDuration() const
Definition: SpellInfo.cpp:2338

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 ( )
9767{
9768 uint32 oldMSTime = getMSTime();
9769
9770 QueryResult result = WorldDatabase.Query("SELECT level, class, basehp0, basehp1, basehp2, basemana, basearmor, attackpower, rangedattackpower, damage_base, damage_exp1, damage_exp2 FROM creature_classlevelstats");
9771
9772 if (!result)
9773 {
9774 LOG_WARN("server.loading", ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty.");
9775 LOG_INFO("server.loading", " ");
9776 return;
9777 }
9778
9779 uint32 count = 0;
9780 do
9781 {
9782 Field* fields = result->Fetch();
9783
9784 uint8 Level = fields[0].Get<uint8>();
9785 uint8 Class = fields[1].Get<uint8>();
9786
9787 if (!Class || ((1 << (Class - 1)) & CLASSMASK_ALL_CREATURES) == 0)
9788 LOG_ERROR("sql.sql", "Creature base stats for level {} has invalid class {}", Level, Class);
9789
9790 CreatureBaseStats stats;
9791
9792 for (uint8 i = 0; i < MAX_EXPANSIONS; ++i)
9793 {
9794 stats.BaseHealth[i] = fields[2 + i].Get<uint32>();
9795
9796 if (stats.BaseHealth[i] == 0)
9797 {
9798 LOG_ERROR("sql.sql", "Creature base stats for class {}, level {} has invalid zero base HP[{}] - set to 1", Class, Level, i);
9799 stats.BaseHealth[i] = 1;
9800 }
9801
9802 // xinef: if no data is available, get them from lower expansions
9803 if (stats.BaseHealth[i] <= 1)
9804 {
9805 for (uint8 j = i; j > 0;)
9806 {
9807 --j;
9808 if (stats.BaseHealth[j] > 1)
9809 {
9810 stats.BaseHealth[i] = stats.BaseHealth[j];
9811 break;
9812 }
9813 }
9814 }
9815
9816 stats.BaseDamage[i] = fields[9 + i].Get<float>();
9817 if (stats.BaseDamage[i] < 0.0f)
9818 {
9819 LOG_ERROR("sql.sql", "Creature base stats for class {}, level {} has invalid negative base damage[{}] - set to 0.0", Class, Level, i);
9820 stats.BaseDamage[i] = 0.0f;
9821 }
9822 }
9823
9824 stats.BaseMana = fields[5].Get<uint32>();
9825 stats.BaseArmor = fields[6].Get<uint32>();
9826
9827 stats.AttackPower = fields[7].Get<uint32>();
9828 stats.RangedAttackPower = fields[8].Get<uint32>();
9829
9830 _creatureBaseStatsStore[MAKE_PAIR16(Level, Class)] = stats;
9831
9832 ++count;
9833 } while (result->NextRow());
9834
9835 CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
9836 for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
9837 {
9838 for (uint16 lvl = itr->second.minlevel; lvl <= itr->second.maxlevel; ++lvl)
9839 {
9840 if (_creatureBaseStatsStore.find(MAKE_PAIR16(lvl, itr->second.unit_class)) == _creatureBaseStatsStore.end())
9841 LOG_ERROR("sql.sql", "Missing base stats for creature class {} level {}", itr->second.unit_class, lvl);
9842 }
9843 }
9844
9845 LOG_INFO("server.loading", ">> Loaded {} Creature Base Stats in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
9846 LOG_INFO("server.loading", " ");
9847}
std::unordered_map< uint32, CreatureTemplate > CreatureTemplateContainer
Definition: CreatureData.h:292
uint32 BaseMana
Definition: CreatureData.h:305
float BaseDamage[MAX_EXPANSIONS]
Definition: CreatureData.h:309
uint32 RangedAttackPower
Definition: CreatureData.h:308
uint32 AttackPower
Definition: CreatureData.h:307
uint32 BaseHealth[MAX_EXPANSIONS]
Definition: CreatureData.h:304
float BaseArmor
Definition: CreatureData.h:306

References _creatureBaseStatsStore, CreatureBaseStats::AttackPower, CreatureBaseStats::BaseArmor, CreatureBaseStats::BaseDamage, CreatureBaseStats::BaseHealth, CreatureBaseStats::BaseMana, CLASSMASK_ALL_CREATURES, Field::Get(), getMSTime(),