OregonCore  revision be9e804-git
Your Favourite TBC server
ObjectMgr Class Reference

#include <ObjectMgr.h>

Public Types

typedef UNORDERED_MAP< uint32, Item * > ItemMap
 
typedef std::set< Group * > GroupSet
 
typedef UNORDERED_MAP< uint32, Guild * > GuildMap
 
typedef UNORDERED_MAP< uint32, ArenaTeam * > ArenaTeamMap
 
typedef UNORDERED_MAP< uint32, Quest * > QuestMap
 
typedef UNORDERED_MAP< uint32, AreaTriggerAreaTriggerMap
 
typedef UNORDERED_MAP< uint32, uint32AreaTriggerScriptMap
 
typedef UNORDERED_MAP< uint32, AccessRequirementAccessRequirementMap
 
typedef UNORDERED_MAP< uint32, ReputationOnKillEntryRepOnKillMap
 
typedef UNORDERED_MAP< uint32, RepSpilloverTemplateRepSpilloverTemplateMap
 
typedef UNORDERED_MAP< uint32, PointOfInterestPointOfInterestMap
 
typedef UNORDERED_MAP< uint32, WeatherZoneChancesWeatherZoneMap
 
typedef UNORDERED_MAP< uint32, PetCreateSpellEntryPetCreateSpellMap
 
typedef std::vector< std::string > ScriptNameMap
 
typedef UNORDERED_MAP< uint64, uint64ReferFriendMap
 
typedef std::multimap< int32, uint32ExclusiveQuestGroups
 

Public Member Functions

 ObjectMgr ()
 
 ~ObjectMgr ()
 
PlayerGetPlayer (const char *name, bool force=false) const
 
PlayerGetPlayer (uint64 guid, bool force=false) const
 
RAFLinkStatus GetRAFLinkStatus (uint64 account, uint64 *linked=NULL) const
 
RAFLinkStatus GetRAFLinkStatus (const Player *plr) const
 
RAFLinkStatus GetRAFLinkStatus (uint64 AccOne, uint64 AccTwo) const
 
RAFLinkStatus GetRAFLinkStatus (const Player *plr1, const Player *plr2) const
 
void LinkIntoRAF (uint64 AccReferrer, uint64 AccReferred)
 
void UnlinkFromRAF (uint64 account)
 
PlayerGetRAFLinkedBuddyForPlayer (const Player *plr1) const
 
void LoadGameobjectInfo ()
 
void AddGameobjectInfo (GameObjectInfo *goinfo)
 
GroupGetGroupByLeader (const uint64 &guid) const
 
void AddGroup (Group *group)
 
void RemoveGroup (Group *group)
 
GuildGetGuildByLeader (uint64 const &guid) const
 
GuildGetGuildById (const uint32 GuildId) const
 
GuildGetGuildByName (const std::string &guildname) const
 
std::string GetGuildNameById (const uint32 GuildId) const
 
void AddGuild (Guild *guild)
 
void RemoveGuild (uint32 Id)
 
ArenaTeamGetArenaTeamById (const uint32 arenateamid) const
 
ArenaTeamGetArenaTeamByName (const std::string &arenateamname) const
 
ArenaTeamGetArenaTeamByCaptain (uint64 const &guid) const
 
void AddArenaTeam (ArenaTeam *arenaTeam)
 
void RemoveArenaTeam (uint32 Id)
 
ArenaTeamMap::iterator GetArenaTeamMapBegin ()
 
ArenaTeamMap::iterator GetArenaTeamMapEnd ()
 
CreatureModelInfo const * GetCreatureModelInfo (uint32 modelid)
 
CreatureModelInfo const * GetCreatureModelRandomGender (uint32 display_id)
 
uint32 ChooseDisplayId (uint32 team, const CreatureInfo *cinfo, const CreatureData *data=NULL)
 
EquipmentInfo const * GetEquipmentInfo (uint32 entry)
 
EquipmentInfoRaw const * GetEquipmentInfoRaw (uint32 entry)
 
PetLevelInfo const * GetPetLevelInfo (uint32 creature_id, uint32 level) const
 
PlayerClassInfo const * GetPlayerClassInfo (uint32 class_) const
 
void GetPlayerClassLevelInfo (uint32 class_, uint32 level, PlayerClassLevelInfo *info) const
 
PlayerInfo const * GetPlayerInfo (uint32 race, uint32 class_) const
 
void GetPlayerLevelInfo (uint32 race, uint32 class_, uint32 level, PlayerLevelInfo *info) const
 
uint64 GetPlayerGUIDByName (std::string name) const
 
bool GetPlayerNameByGUID (const uint64 &guid, std::string &name) const
 
uint32 GetPlayerTeamByGUID (const uint64 &guid) const
 
uint32 GetPlayerAccountIdByGUID (const uint64 &guid) const
 
uint32 GetPlayerAccountIdByPlayerName (const std::string &name) const
 
uint32 GetNearestTaxiNode (float x, float y, float z, uint32 mapid)
 
void GetTaxiPath (uint32 source, uint32 destination, uint32 &path, uint32 &cost)
 
uint16 GetTaxiMount (uint32 id, uint32 team)
 
Quest const * GetQuestTemplate (uint32 quest_id) const
 
QuestMap const & GetQuestTemplates () const
 
uint32 GetQuestForAreaTrigger (uint32 Trigger_ID) const
 
bool IsTavernAreaTrigger (uint32 Trigger_ID) const
 
bool IsGameObjectForQuests (uint32 entry) const
 
uint32 GetBattleMasterBG (uint32 entry) const
 
void AddGossipText (GossipText *pGText)
 
GossipTextGetGossipText (uint32 Text_ID)
 
WorldSafeLocsEntry const * GetDefaultGraveYard (uint32 team)
 
WorldSafeLocsEntry const * GetClosestGraveYard (float x, float y, float z, uint32 MapId, uint32 team)
 
bool AddGraveYardLink (uint32 id, uint32 zone, uint32 team, bool inDB=true)
 
void RemoveGraveYardLink (uint32 id, uint32 zone, uint32 team, bool inDB=false)
 
void LoadGraveyardZones ()
 
GraveYardData const * FindGraveYardData (uint32 id, uint32 zone)
 
AreaTrigger const * GetAreaTrigger (uint32 trigger) const
 
AccessRequirement const * GetAccessRequirement (uint32 requirement) const
 
AreaTrigger const * GetGoBackTrigger (uint32 Map) const
 
AreaTrigger const * GetMapEntranceTrigger (uint32 Map) const
 
uint32 GetAreaTriggerScriptId (uint32 trigger_id)
 
ReputationOnKillEntry const * GetReputationOnKilEntry (uint32 id) const
 
RepSpilloverTemplate const * GetRepSpilloverTemplate (uint32 factionId) const
 
PetCreateSpellEntry const * GetPetCreateSpellEntry (uint32 id) const
 
PointOfInterest const * GetPointOfInterest (uint32 id) const
 
void LoadGuilds ()
 
void LoadArenaTeams ()
 
void LoadGroups ()
 
void LoadQuests ()
 
void LoadQuestStartersAndEnders ()
 
void LoadGameobjectQuestStarters ()
 
void LoadGameobjectQuestEnders ()
 
void LoadCreatureQuestStarters ()
 
void LoadCreatureQuestEnders ()
 
QuestRelationsGetGOQuestRelationMap ()
 
QuestRelationsGetCreatureQuestRelationMap ()
 
CreatureBaseStats const * GetCreatureClassLvlStats (uint32 level, uint32 unitClass, int32 expansion) const
 
void LoadGameObjectScripts ()
 
void LoadQuestEndScripts ()
 
void LoadQuestStartScripts ()
 
void LoadEventScripts ()
 
void LoadSpellScripts ()
 
void LoadGossipScripts ()
 
void LoadWaypointScripts ()
 
void LoadReferredFriends ()
 
void LoadTransportEvents ()
 
bool LoadOregonStrings (DatabaseType &db, char const *table, int32 min_value, int32 max_value)
 
bool LoadOregonStrings ()
 
void LoadDbScriptStrings ()
 
void LoadPetCreateSpells ()
 
void LoadCreatureLocales ()
 
void LoadCreatureTemplates ()
 
void LoadTempSummons ()
 
void LoadCreatures ()
 
void LoadCreatureLinkedRespawn ()
 
bool CheckCreatureLinkedRespawn (uint32 guid, uint32 linkedGuid) const
 
bool SetCreatureLinkedRespawn (uint32 guid, uint32 linkedGuid)
 
void LoadCreatureRespawnTimes ()
 
void LoadCreatureAddons ()
 
void LoadCreatureClassLevelStats ()
 
void LoadCreatureModelInfo ()
 
void LoadEquipmentTemplates ()
 
void LoadGameObjectLocales ()
 
void LoadGameobjects ()
 
void LoadGameobjectRespawnTimes ()
 
void LoadItemTemplates ()
 
void LoadItemLocales ()
 
void LoadQuestLocales ()
 
void LoadNpcTextLocales ()
 
void LoadPageTextLocales ()
 
void LoadGossipMenuItemsLocales ()
 
void LoadPointOfInterestLocales ()
 
void LoadInstanceTemplate ()
 
void LoadGossipText ()
 
void LoadAreaTriggerTeleports ()
 
void LoadAccessRequirements ()
 
void LoadQuestAreaTriggers ()
 
void LoadAreaTriggerScripts ()
 
void LoadTavernAreaTriggers ()
 
void LoadBattleMastersEntry ()
 
void LoadGameObjectForQuests ()
 
void LoadItemTexts ()
 
void LoadPageTexts ()
 
void LoadPlayerInfo ()
 
void LoadPetLevelInfo ()
 
void LoadExplorationBaseXP ()
 
void LoadPetNames ()
 
void LoadPetNumber ()
 
void LoadCorpses ()
 
void LoadFishingBaseSkillLevel ()
 
void LoadReputationOnKill ()
 
void LoadReputationSpilloverTemplate ()
 
void LoadPointsOfInterest ()
 
void LoadWeatherZoneChances ()
 
void LoadGameTele ()
 
void LoadNpcTextId ()
 
void LoadGossipMenu ()
 
void LoadGossipMenuItems ()
 
void LoadVendors ()
 
void LoadTrainerSpell ()
 
std::string GeneratePetName (uint32 entry)
 
uint32 GetBaseXP (uint32 level)
 
int32 GetFishingBaseSkillLevel (uint32 entry) const
 
void ReturnOrDeleteOldMails (bool serverUp)
 
void SetHighestGuids ()
 
uint32 GenerateLowGuid (HighGuid guidhigh)
 
uint32 GenerateAuctionID ()
 
uint32 GenerateMailID ()
 
uint32 GenerateItemTextID ()
 
uint32 GeneratePetNumber ()
 
uint32 GenerateArenaTeamId ()
 
uint32 GenerateGuildId ()
 
uint32 CreateItemText (std::string text)
 
std::string GetItemText (uint32 id)
 
std::vector< TempSummonData > const * GetSummonGroup (uint32 summonerId, SummonerType summonerType, uint8 group) const
 
WeatherZoneChances const * GetWeatherChances (uint32 zone_id) const
 
CellObjectGuids const & GetCellObjectGuids (uint16 mapid, uint8 spawnMode, uint32 cell_id)
 
CreatureData const * GetCreatureData (uint32 guid) const
 
CreatureDataNewOrExistCreatureData (uint32 guid)
 
void DeleteCreatureData (uint32 guid)
 
uint32 GetLinkedRespawnGuid (uint32 guid) const
 
CreatureLocale const * GetCreatureLocale (uint32 entry) const
 
GameObjectLocale const * GetGameObjectLocale (uint32 entry) const
 
ItemLocale const * GetItemLocale (uint32 entry) const
 
QuestLocale const * GetQuestLocale (uint32 entry) const
 
NpcTextLocale const * GetNpcTextLocale (uint32 entry) const
 
PageTextLocale const * GetPageTextLocale (uint32 entry) const
 
GossipMenuItemsLocale const * GetGossipMenuItemsLocale (uint32 entry) const
 
PointOfInterestLocale const * GetPointOfInterestLocale (uint32 poi_id) const
 
GameObjectData const * GetGOData (uint32 guid) const
 
GameObjectDataNewGOData (uint32 guid)
 
void DeleteGOData (uint32 guid)
 
OregonStringLocale const * GetOregonStringLocale (int32 entry) const
 
const char * GetOregonString (int32 entry, int locale_idx) const
 
const char * GetOregonStringForDBCLocale (int32 entry) const
 
int32 GetDBCLocaleIndex () const
 
void SetDBCLocaleIndex (uint32 lang)
 
void AddCorpseCellData (uint32 mapid, uint32 cellid, uint32 player_guid, uint32 instance)
 
void DeleteCorpseCellData (uint32 mapid, uint32 cellid, uint32 player_guid)
 
time_t GetCreatureRespawnTime (uint32 loguid, uint32 instance)
 
void SaveCreatureRespawnTime (uint32 loguid, uint32 instance, time_t t)
 
time_t GetGORespawnTime (uint32 loguid, uint32 instance)
 
void SaveGORespawnTime (uint32 loguid, uint32 instance, time_t t)
 
void DeleteRespawnTimeForInstance (uint32 instance)
 
void AddCreatureToGrid (uint32 guid, CreatureData const *data)
 
void RemoveCreatureFromGrid (uint32 guid, CreatureData const *data)
 
void AddGameobjectToGrid (uint32 guid, GameObjectData const *data)
 
void RemoveGameobjectFromGrid (uint32 guid, GameObjectData const *data)
 
uint32 AddGOData (uint32 entry, uint32 artKit, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay=0, float rotation0=0, float rotation1=0, float rotation2=0, float rotation3=0)
 
uint32 AddCreData (uint32 entry, uint32 team, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay=0)
 
void LoadReservedPlayersNames ()
 
bool IsReservedName (const std::string &name) const
 
int GetIndexForLocale (LocaleConstant loc)
 
LocaleConstant GetLocaleForIndex (int i)
 
uint32 GetGuildBankTabPrice (uint8 Index) const
 
GameTele const * GetGameTele (uint32 id) const
 
GameTele const * GetGameTele (const std::string &name) const
 
GameTeleMap const & GetGameTeleMap () const
 
bool AddGameTele (GameTele &data)
 
bool DeleteGameTele (const std::string &name)
 
uint32 GetNpcGossip (uint32 entry) const
 
TrainerSpellData const * GetNpcTrainerSpells (uint32 entry) const
 
VendorItemData const * GetNpcVendorItemList (uint32 entry) const
 
void AddVendorItem (uint32 entry, uint32 item, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb=true)
 
bool RemoveVendorItem (uint32 entry, uint32 item, bool savetodb=true)
 
bool IsVendorItemValid (uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player *pl=NULL, std::set< uint32 > *skip_vendors=NULL, uint32 ORnpcflag=0) const
 
void LoadScriptNames ()
 
ScriptNameMapGetScriptNames ()
 
const char * GetScriptName (uint32 id)
 
uint32 GetScriptId (const char *name)
 
GossipMenusMapBounds GetGossipMenusMapBounds (uint32 uiMenuId) const
 
GossipMenusMapBoundsNonConst GetGossipMenusMapBoundsNonConst (uint32 uiMenuId)
 
GossipMenuItemsMapBounds GetGossipMenuItemsMapBounds (uint32 uiMenuId) const
 
GossipMenuItemsMapBoundsNonConst GetGossipMenuItemsMapBoundsNonConst (uint32 uiMenuId)
 

Static Public Member Functions

static GameObjectInfo const * GetGameObjectInfo (uint32 id)
 
static CreatureInfo const * GetCreatureTemplate (uint32 id)
 
static void ChooseCreatureFlags (const CreatureInfo *cinfo, uint32 &npcflag, uint32 &unit_flags, uint32 &dynamicflags, const CreatureData *data=NULL)
 
static CreatureDataAddon const * GetCreatureAddon (uint32 lowguid)
 
static CreatureDataAddon const * GetCreatureTemplateAddon (uint32 entry)
 
static ItemTemplate const * GetItemTemplate (uint32 id)
 
static InstanceTemplate const * GetInstanceTemplate (uint32 map)
 
static bool IsValidName (const std::string &name, bool create=false)
 
static bool IsValidCharterName (const std::string &name)
 
static bool IsValidPetName (const std::string &name)
 
static bool CheckDeclinedNames (std::wstring mainpart, DeclinedName const &names)
 
static void AddLocaleString (std::string const &s, LocaleConstant locale, StringVector &data)
 
static void GetLocaleString (const StringVector &data, int loc_idx, std::string &value)
 

Public Attributes

UNORDERED_MAP< uint32, uint32TransportEventMap
 
QuestRelations mGOQuestRelations
 
QuestRelations mGOQuestInvolvedRelations
 
QuestRelations mCreatureQuestRelations
 
QuestRelations mCreatureQuestInvolvedRelations
 
ExclusiveQuestGroups mExclusiveQuestGroups
 

Protected Types

typedef UNORDERED_MAP< uint32, GossipText * > GossipTextMap
 
typedef UNORDERED_MAP< uint32, uint32QuestAreaTriggerMap
 
typedef UNORDERED_MAP< uint32, uint32BattleMastersMap
 
typedef UNORDERED_MAP< uint32, std::string > ItemTextMap
 
typedef std::set< uint32TavernAreaTriggerSet
 
typedef std::set< uint32GameObjectForQuestSet
 
typedef std::set< std::string > ReservedNamesMap
 
typedef std::vector< LocaleConstantLocalForIndex
 

Protected Member Functions

int GetOrNewIndexForLocale (LocaleConstant loc)
 

Protected Attributes

uint32 m_auctionid
 
uint32 m_mailid
 
uint32 m_ItemTextId
 
uint32 m_arenaTeamId
 
uint32 m_guildId
 
uint32 m_hiPetNumber
 
uint32 m_hiCharGuid
 
uint32 m_hiCreatureGuid
 
uint32 m_hiPetGuid
 
uint32 m_hiItemGuid
 
uint32 m_hiGoGuid
 
uint32 m_hiDoGuid
 
uint32 m_hiCorpseGuid
 
QuestMap mQuestTemplates
 
GroupSet mGroupSet
 
GuildMap mGuildMap
 
ArenaTeamMap mArenaTeamMap
 
ItemMap mItems
 
ItemTextMap mItemTexts
 
QuestAreaTriggerMap mQuestAreaTriggerMap
 
BattleMastersMap mBattleMastersMap
 
TavernAreaTriggerSet mTavernAreaTriggerSet
 
GameObjectForQuestSet mGameObjectForQuestSet
 
GossipTextMap mGossipText
 
AreaTriggerMap mAreaTriggers
 
AreaTriggerScriptMap mAreaTriggerScripts
 
AccessRequirementMap mAccessRequirements
 
RepOnKillMap mRepOnKill
 
RepSpilloverTemplateMap m_RepSpilloverTemplateMap
 
GossipMenusMap m_mGossipMenusMap
 
GossipMenuItemsMap m_mGossipMenuItemsMap
 
PointOfInterestMap mPointsOfInterest
 
WeatherZoneMap mWeatherZoneMap
 
PetCreateSpellMap mPetCreateSpell
 
ReservedNamesMap m_ReservedNames
 
GraveYardMap mGraveYardMap
 
GameTeleMap m_GameTeleMap
 
ScriptNameMap m_scriptNames
 
ReferFriendMap m_referrerFriends
 
ReferFriendMap m_referredFriends
 
LocalForIndex m_LocalForIndex
 
int DBCLocaleIndex
 

Private Types

typedef std::map< uint32, PetLevelInfo * > PetLevelInfoMap
 
typedef std::map< uint32, uint32BaseXPMap
 
typedef std::map< uint32, int32FishingBaseSkillMap
 
typedef std::map< uint32, std::vector< std::string > > HalfNameMap
 
typedef std::vector< uint32GuildBankTabPriceMap
 

Private Member Functions

void LoadScripts (ScriptsType type)
 
void CheckScripts (ScriptsType type, std::set< int32 > &ids)
 
void ConvertCreatureAddonAuras (CreatureDataAddon *addon, char const *table, char const *guidEntryStr)
 
void LoadQuestRelationsHelper (QuestRelations &map, std::string table, bool starter, bool go)
 
void BuildPlayerLevelInfo (uint8 race, uint8 class_, uint8 level, PlayerLevelInfo *plinfo) const
 

Private Attributes

PetLevelInfoMap petInfo
 
PlayerClassInfo playerClassInfo [MAX_CLASSES]
 
PlayerInfo playerInfo [MAX_RACES][MAX_CLASSES]
 
BaseXPMap mBaseXPTable
 
FishingBaseSkillMap mFishingBaseForArea
 
HalfNameMap PetHalfName0
 
HalfNameMap PetHalfName1
 
CreatureBaseStats m_creatureClassLvlStats [DEFAULT_MAX_CREATURE_LEVEL+1][MAX_CREATURE_CLASS][MAX_EXPANSION+1]
 
MapObjectGuids mMapObjectGuids
 
CreatureDataMap mCreatureDataMap
 
CreatureLinkedRespawnMap mCreatureLinkedRespawnMap
 
CreatureLocaleMap mCreatureLocaleMap
 
GameObjectDataMap mGameObjectDataMap
 
GameObjectLocaleMap mGameObjectLocaleMap
 
ItemLocaleMap mItemLocaleMap
 
QuestLocaleMap mQuestLocaleMap
 
NpcTextLocaleMap mNpcTextLocaleMap
 
PageTextLocaleMap mPageTextLocaleMap
 
OregonStringLocaleMap mOregonStringLocaleMap
 
GossipMenuItemsLocaleMap mGossipMenuItemsLocaleMap
 
PointOfInterestLocaleMap mPointOfInterestLocaleMap
 
RespawnTimes mCreatureRespawnTimes
 
RespawnTimes mGORespawnTimes
 
GuildBankTabPriceMap mGuildBankTabPrice
 
CacheNpcTextIdMap m_mCacheNpcTextIdMap
 
CacheVendorItemMap m_mCacheVendorItemMap
 
CacheTrainerSpellMap m_mCacheTrainerSpellMap
 
TempSummonDataContainer _tempSummonDataStore
 Stores temp summon data grouped by summoner's entry, summoner's type and group id. More...
 

Friends

class PlayerDumpReader
 

Detailed Description

Definition at line 526 of file ObjectMgr.h.

Member Typedef Documentation

Definition at line 540 of file ObjectMgr.h.

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

Definition at line 1277 of file ObjectMgr.h.

Definition at line 1210 of file ObjectMgr.h.

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

Definition at line 926 of file ObjectMgr.h.

typedef std::map<uint32, int32> ObjectMgr::FishingBaseSkillMap
private

Definition at line 1280 of file ObjectMgr.h.

typedef std::set<uint32> ObjectMgr::GameObjectForQuestSet
protected

Definition at line 1213 of file ObjectMgr.h.

Definition at line 1208 of file ObjectMgr.h.

typedef std::set< Group* > ObjectMgr::GroupSet

Definition at line 536 of file ObjectMgr.h.

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

Definition at line 1306 of file ObjectMgr.h.

Definition at line 538 of file ObjectMgr.h.

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

Definition at line 1283 of file ObjectMgr.h.

Definition at line 534 of file ObjectMgr.h.

typedef UNORDERED_MAP<uint32, std::string> ObjectMgr::ItemTextMap
protected

Definition at line 1211 of file ObjectMgr.h.

typedef std::vector<LocaleConstant> ObjectMgr::LocalForIndex
protected

Definition at line 1256 of file ObjectMgr.h.

typedef std::map<uint32, PetLevelInfo*> ObjectMgr::PetLevelInfoMap
private

Definition at line 1268 of file ObjectMgr.h.

Definition at line 1209 of file ObjectMgr.h.

Definition at line 542 of file ObjectMgr.h.

Definition at line 562 of file ObjectMgr.h.

typedef std::set<std::string> ObjectMgr::ReservedNamesMap
protected

Definition at line 1244 of file ObjectMgr.h.

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

Definition at line 560 of file ObjectMgr.h.

typedef std::set<uint32> ObjectMgr::TavernAreaTriggerSet
protected

Definition at line 1212 of file ObjectMgr.h.

Constructor & Destructor Documentation

ObjectMgr::ObjectMgr ( )

Definition at line 280 of file ObjectMgr.cpp.

References GUILD_BANK_MAX_TABS.

281 {
282  m_hiCharGuid = 1;
283  m_hiCreatureGuid = 1;
284  m_hiPetGuid = 1;
285  m_hiItemGuid = 1;
286  m_hiGoGuid = 1;
287  m_hiDoGuid = 1;
288  m_hiCorpseGuid = 1;
289  m_hiPetNumber = 1;
290  m_ItemTextId = 1;
291  m_mailid = 1;
292  m_guildId = 1;
293  m_arenaTeamId = 1;
294  m_auctionid = 1;
295 
297  mGuildBankTabPrice[0] = 100;
298  mGuildBankTabPrice[1] = 250;
299  mGuildBankTabPrice[2] = 500;
300  mGuildBankTabPrice[3] = 1000;
301  mGuildBankTabPrice[4] = 2500;
302  mGuildBankTabPrice[5] = 5000;
303 }
uint32 m_auctionid
Definition: ObjectMgr.h:1190
GuildBankTabPriceMap mGuildBankTabPrice
Definition: ObjectMgr.h:1307
uint32 m_hiPetGuid
Definition: ObjectMgr.h:1200
uint32 m_hiGoGuid
Definition: ObjectMgr.h:1202
uint32 m_hiItemGuid
Definition: ObjectMgr.h:1201
uint32 m_arenaTeamId
Definition: ObjectMgr.h:1193
uint32 m_hiCharGuid
Definition: ObjectMgr.h:1198
uint32 m_hiPetNumber
Definition: ObjectMgr.h:1195
uint32 m_hiCreatureGuid
Definition: ObjectMgr.h:1199
uint32 m_mailid
Definition: ObjectMgr.h:1191
uint32 m_hiDoGuid
Definition: ObjectMgr.h:1203
uint32 m_guildId
Definition: ObjectMgr.h:1194
#define GUILD_BANK_MAX_TABS
uint32 m_ItemTextId
Definition: ObjectMgr.h:1192
uint32 m_hiCorpseGuid
Definition: ObjectMgr.h:1204
ObjectMgr::~ObjectMgr ( )

Definition at line 305 of file ObjectMgr.cpp.

References MAX_CLASSES, and MAX_RACES.

306 {
307  for (QuestMap::iterator i = mQuestTemplates.begin(); i != mQuestTemplates.end(); ++i)
308  delete i->second;
309  mQuestTemplates.clear();
310 
311  for (GossipTextMap::iterator i = mGossipText.begin(); i != mGossipText.end(); ++i)
312  delete i->second;
313  mGossipText.clear();
314 
315  mAreaTriggers.clear();
316 
317  for (PetLevelInfoMap::iterator i = petInfo.begin(); i != petInfo.end(); ++i)
318  delete[] i->second;
319  petInfo.clear();
320 
321  // free only if loaded
322  for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
323  delete[] playerClassInfo[class_].levelInfo;
324 
325  for (int race = 0; race < MAX_RACES; ++race)
326  for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
327  delete[] playerInfo[race][class_].levelInfo;
328 
329  // free group and guild objects
330  for (GroupSet::iterator itr = mGroupSet.begin(); itr != mGroupSet.end(); ++itr)
331  delete (*itr);
332 
333  for (GuildMap::iterator itr = mGuildMap.begin(); itr != mGuildMap.end(); ++itr)
334  delete itr->second;
335  mGuildMap.clear();
336 
337  for (ArenaTeamMap::iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
338  delete itr->second;
339 
340  for (CacheVendorItemMap::iterator itr = m_mCacheVendorItemMap.begin(); itr != m_mCacheVendorItemMap.end(); ++itr)
341  itr->second.Clear();
342 
343  for (CacheTrainerSpellMap::iterator itr = m_mCacheTrainerSpellMap.begin(); itr != m_mCacheTrainerSpellMap.end(); ++itr)
344  itr->second.Clear();
345 }
PlayerInfo playerInfo[MAX_RACES][MAX_CLASSES]
Definition: ObjectMgr.h:1275
PlayerClassInfo playerClassInfo[MAX_CLASSES]
Definition: ObjectMgr.h:1272
AreaTriggerMap mAreaTriggers
Definition: ObjectMgr.h:1228
GroupSet mGroupSet
Definition: ObjectMgr.h:1215
QuestMap mQuestTemplates
Definition: ObjectMgr.h:1206
GossipTextMap mGossipText
Definition: ObjectMgr.h:1227
CacheTrainerSpellMap m_mCacheTrainerSpellMap
Definition: ObjectMgr.h:1311
PetLevelInfoMap petInfo
Definition: ObjectMgr.h:1270
#define MAX_CLASSES
Definition: SharedDefines.h:91
ArenaTeamMap mArenaTeamMap
Definition: ObjectMgr.h:1217
CacheVendorItemMap m_mCacheVendorItemMap
Definition: ObjectMgr.h:1310
#define MAX_RACES
Definition: SharedDefines.h:66
GuildMap mGuildMap
Definition: ObjectMgr.h:1216

Member Function Documentation

void ObjectMgr::AddArenaTeam ( ArenaTeam arenaTeam)

Definition at line 429 of file ObjectMgr.cpp.

References ArenaTeam::GetId().

430 {
431  mArenaTeamMap[arenaTeam->GetId()] = arenaTeam;
432 }
uint32 GetId() const
Definition: ArenaTeam.h:124
ArenaTeamMap mArenaTeamMap
Definition: ObjectMgr.h:1217
void ObjectMgr::AddCorpseCellData ( uint32  mapid,
uint32  cellid,
uint32  player_guid,
uint32  instance 
)

Definition at line 6496 of file ObjectMgr.cpp.

References CellObjectGuids::corpses, and MAKE_PAIR32.

6497 {
6498  // corpses are always added to spawn mode 0 and they are spawned by their instance id
6499  CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(mapid, 0)][cellid];
6500  cell_guids.corpses[player_guid] = instance;
6501 }
#define MAKE_PAIR32(l, h)
Definition: Common.h:171
CellCorpseSet corpses
Definition: ObjectMgr.h:357
MapObjectGuids mMapObjectGuids
Definition: ObjectMgr.h:1290
void ObjectMgr::AddCreatureToGrid ( uint32  guid,
CreatureData const *  data 
)

Definition at line 1443 of file ObjectMgr.cpp.

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

1444 {
1445  uint8 mask = data->spawnMask;
1446  for (uint8 i = 0; mask != 0; i++, mask >>= 1)
1447  {
1448  if (mask & 1)
1449  {
1450  CellCoord cellCoord = Oregon::ComputeCellCoord(data->posX, data->posY);
1451  CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
1452  cell_guids.creatures.insert(guid);
1453  }
1454  }
1455 }
#define MAKE_PAIR32(l, h)
Definition: Common.h:171
ACE_UINT8 uint8
Definition: Define.h:73
MapObjectGuids mMapObjectGuids
Definition: ObjectMgr.h:1290
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:167
CellGuidSet creatures
Definition: ObjectMgr.h:355
uint32 GetId() const
Definition: GridDefines.h:136
uint32 ObjectMgr::AddCreData ( uint32  entry,
uint32  team,
uint32  map,
float  x,
float  y,
float  z,
float  o,
uint32  spawntimedelay = 0 
)

Definition at line 1518 of file ObjectMgr.cpp.

References CreatureData::curhealth, CreatureData::curmana, CreatureData::currentwaypoint, CreatureData::dbData, CreatureData::displayid, CreatureInfo::dynamicflags, CreatureData::dynamicflags, CreatureInfo::equipmentId, CreatureData::equipmentId, GetCreatureTemplate(), HIGHGUID_UNIT, CreatureData::id, Oregon::Singleton< MapManager, Oregon::ClassLevelLockable< MapManager, ACE_Thread_Mutex > >::Instance(), Creature::LoadCreatureFromDB(), CreatureData::mapid, CreatureInfo::maxhealth, CreatureInfo::maxmana, CreatureInfo::MovementType, CreatureData::movementType, CreatureInfo::npcflag, CreatureData::npcflag, CreatureData::orientation, CreatureData::posX, CreatureData::posY, CreatureData::posZ, sLog, CreatureData::spawndist, CreatureData::spawnMask, CreatureData::spawntimesecs, CreatureInfo::unit_flags, and CreatureData::unit_flags.

1519 {
1520  CreatureInfo const* cInfo = GetCreatureTemplate(entry);
1521  if (!cInfo)
1522  return 0;
1523 
1525  CreatureData& data = NewOrExistCreatureData(guid);
1526  data.id = entry;
1527  data.mapid = mapId;
1528  data.displayid = 0;
1529  data.equipmentId = cInfo->equipmentId;
1530  data.posX = x;
1531  data.posY = y;
1532  data.posZ = z;
1533  data.orientation = o;
1534  data.spawntimesecs = spawntimedelay;
1535  data.spawndist = 0;
1536  data.currentwaypoint = 0;
1537  data.curhealth = cInfo->maxhealth;
1538  data.curmana = cInfo->maxmana;
1539  data.movementType = cInfo->MovementType;
1540  data.spawnMask = 1;
1541  data.dbData = false;
1542  data.npcflag = cInfo->npcflag;
1543  data.unit_flags = cInfo->unit_flags;
1544  data.dynamicflags = cInfo->dynamicflags;
1545 
1546  AddCreatureToGrid(guid, &data);
1547 
1548  // Spawn if necessary (loaded grids only)
1549  if (Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(mapId)))
1550  {
1551  // We use spawn coords to spawn
1552  if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
1553  {
1554  Creature* creature = new Creature;
1555  if (!creature->LoadCreatureFromDB(guid, map))
1556  {
1557  sLog.outError("AddCreature: cannot add creature entry %u to map", entry);
1558  delete creature;
1559  return 0;
1560  }
1561  }
1562  }
1563 
1564  return guid;
1565 }
uint32 npcflag
Definition: Creature.h:151
bool LoadCreatureFromDB(uint32 guid, Map *map, bool addToMap=true)
Definition: Creature.cpp:1295
void AddCreatureToGrid(uint32 guid, CreatureData const *data)
Definition: ObjectMgr.cpp:1443
uint8 spawnMask
Definition: Creature.h:289
uint8 movementType
Definition: Creature.h:288
uint32 id
Definition: Creature.h:274
uint32 displayid
Definition: Creature.h:277
uint32 GenerateLowGuid(HighGuid guidhigh)
Definition: ObjectMgr.cpp:5713
uint32 curhealth
Definition: Creature.h:286
uint32 curmana
Definition: Creature.h:287
#define sLog
Log class singleton.
Definition: Log.h:187
float spawndist
Definition: Creature.h:284
uint32 dynamicflags
Definition: Creature.h:163
bool dbData
Definition: Creature.h:293
float posX
Definition: Creature.h:279
uint32 spawntimesecs
Definition: Creature.h:283
static CreatureInfo const * GetCreatureTemplate(uint32 id)
Definition: ObjectMgr.cpp:439
uint32 equipmentId
Definition: Creature.h:193
float posY
Definition: Creature.h:280
uint32 maxhealth
Definition: Creature.h:146
uint32 maxmana
Definition: Creature.h:148
uint32 npcflag
Definition: Creature.h:290
Definition: Map.h:266
uint32 unit_flags
Definition: Creature.h:162
int32 equipmentId
Definition: Creature.h:278
uint32 MovementType
Definition: Creature.h:185
uint32 dynamicflags
Definition: Creature.h:292
uint32 unit_flags
Definition: Creature.h:291
uint32 currentwaypoint
Definition: Creature.h:285
float orientation
Definition: Creature.h:282
uint16 mapid
Definition: Creature.h:275
ACE_UINT32 uint32
Definition: Define.h:71
CreatureData & NewOrExistCreatureData(uint32 guid)
Definition: ObjectMgr.h:968
float posZ
Definition: Creature.h:281
void ObjectMgr::AddGameobjectInfo ( GameObjectInfo goinfo)
void ObjectMgr::AddGameobjectToGrid ( uint32  guid,
GameObjectData const *  data 
)

Definition at line 1657 of file ObjectMgr.cpp.

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

1658 {
1659  uint8 mask = data->spawnMask;
1660  for (uint8 i = 0; mask != 0; i++, mask >>= 1)
1661  {
1662  if (mask & 1)
1663  {
1664  CellCoord cellCoord = Oregon::ComputeCellCoord(data->posX, data->posY);
1665  CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
1666  cell_guids.gameobjects.insert(guid);
1667  }
1668  }
1669 }
#define MAKE_PAIR32(l, h)
Definition: Common.h:171
ACE_UINT8 uint8
Definition: Define.h:73
MapObjectGuids mMapObjectGuids
Definition: ObjectMgr.h:1290
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:167
CellGuidSet gameobjects
Definition: ObjectMgr.h:356
uint32 GetId() const
Definition: GridDefines.h:136
bool ObjectMgr::AddGameTele ( GameTele data)

Definition at line 7170 of file ObjectMgr.cpp.

References GameTele::mapId, GameTele::name, GameTele::orientation, Database::PExecuteLog(), GameTele::position_x, GameTele::position_y, GameTele::position_z, Utf8toWStr(), GameTele::wnameLow, WorldDatabase, and wstrToLower().

7171 {
7172  // find max id
7173  uint32 new_id = 0;
7174  for (GameTeleMap::const_iterator itr = m_GameTeleMap.begin(); itr != m_GameTeleMap.end(); ++itr)
7175  if (itr->first > new_id)
7176  new_id = itr->first;
7177 
7178  // use next
7179  ++new_id;
7180 
7181  if (!Utf8toWStr(tele.name, tele.wnameLow))
7182  return false;
7183 
7184  wstrToLower(tele.wnameLow);
7185 
7186  m_GameTeleMap[new_id] = tele;
7187 
7188  return WorldDatabase.PExecuteLog("INSERT INTO game_tele (id,position_x,position_y,position_z,orientation,map,name) VALUES (%u,%f,%f,%f,%f,%d,'%s')",
7189  new_id, tele.position_x, tele.position_y, tele.position_z, tele.orientation, tele.mapId, tele.name.c_str());
7190 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:255
void wstrToLower(std::wstring &str)
Definition: Util.h:308
bool PExecuteLog(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:221
GameTeleMap m_GameTeleMap
Definition: ObjectMgr.h:1249
ACE_UINT32 uint32
Definition: Define.h:71
uint32 ObjectMgr::AddGOData ( uint32  entry,
uint32  artKit,
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 
)

Definition at line 1471 of file ObjectMgr.cpp.

References GameObjectData::animprogress, GameObjectData::artKit, MapManager::CreateBaseMap(), GameObjectData::dbData, GetGameObjectInfo(), GameObjectData::go_state, GO_STATE_READY, HIGHGUID_GAMEOBJECT, GameObjectData::id, Oregon::Singleton< MapManager, Oregon::ClassLevelLockable< MapManager, ACE_Thread_Mutex > >::Instance(), Map::Instanceable(), Map::IsGridLoaded(), GameObject::LoadGameObjectFromDB(), GameObjectData::mapid, GameObjectData::orientation, GameObjectData::posX, GameObjectData::posY, GameObjectData::posZ, GameObjectData::rotation0, GameObjectData::rotation1, GameObjectData::rotation2, GameObjectData::rotation3, sLog, GameObjectData::spawnMask, and GameObjectData::spawntimesecs.

1472 {
1473  GameObjectInfo const* goinfo = GetGameObjectInfo(entry);
1474  if (!goinfo)
1475  return 0;
1476 
1477  Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(mapId));
1478  if (!map)
1479  return 0;
1480 
1482  GameObjectData& data = NewGOData(guid);
1483  data.id = entry;
1484  data.mapid = mapId;
1485  data.posX = x;
1486  data.posY = y;
1487  data.posZ = z;
1488  data.orientation = o;
1489  data.rotation0 = rotation0;
1490  data.rotation1 = rotation1;
1491  data.rotation2 = rotation2;
1492  data.rotation3 = rotation3;
1493  data.spawntimesecs = spawntimedelay;
1494  data.animprogress = 100;
1495  data.spawnMask = 1;
1496  data.go_state = GO_STATE_READY;
1497  data.artKit = artKit;
1498  data.dbData = false;
1499 
1500  AddGameobjectToGrid(guid, &data);
1501 
1502  // Spawn if necessary (loaded grids only)
1503  // We use spawn coords to spawn
1504  if (!map->Instanceable() && map->IsGridLoaded(x, y))
1505  {
1506  GameObject* go = new GameObject;
1507  if (!go->LoadGameObjectFromDB(guid, map))
1508  {
1509  sLog.outError("AddGOData: cannot add gameobject entry %u to map", entry);
1510  delete go;
1511  return 0;
1512  }
1513  }
1514 
1515  return guid;
1516 }
int32 spawntimesecs
Definition: GameObject.h:568
uint32 GenerateLowGuid(HighGuid guidhigh)
Definition: ObjectMgr.cpp:5713
#define sLog
Log class singleton.
Definition: Log.h:187
bool IsGridLoaded(float x, float y) const
Definition: Map.h:307
float orientation
Definition: GameObject.h:563
GameObjectData & NewGOData(uint32 guid)
Definition: ObjectMgr.h:1034
Map const * CreateBaseMap(uint32 id) const
Definition: MapManager.h:41
static GameObjectInfo const * GetGameObjectInfo(uint32 id)
Definition: ObjectMgr.h:592
Definition: Map.h:266
uint32 animprogress
Definition: GameObject.h:569
bool Instanceable() const
Definition: Map.h:422
ACE_UINT32 uint32
Definition: Define.h:71
void AddGameobjectToGrid(uint32 guid, GameObjectData const *data)
Definition: ObjectMgr.cpp:1657
GOState go_state
Definition: GameObject.h:570
bool LoadGameObjectFromDB(uint32 guid, Map *map, bool addToMap=true)
Definition: GameObject.cpp:680
void ObjectMgr::AddGossipText ( GossipText pGText)

Definition at line 4654 of file ObjectMgr.cpp.

References ASSERT, and GossipText::Text_ID.

4655 {
4656  ASSERT(pGText->Text_ID);
4657  ASSERT(mGossipText.find(pGText->Text_ID) == mGossipText.end());
4658  mGossipText[pGText->Text_ID] = pGText;
4659 }
uint32 Text_ID
Definition: NPCHandler.h:60
GossipTextMap mGossipText
Definition: ObjectMgr.h:1227
#define ASSERT
Definition: Errors.h:29
bool ObjectMgr::AddGraveYardLink ( uint32  id,
uint32  zone,
uint32  team,
bool  inDB = true 
)

Definition at line 5320 of file ObjectMgr.cpp.

References ScriptInfo::id, Database::PExecuteLog(), GraveYardData::safeLocId, GraveYardData::team, and WorldDatabase.

5321 {
5322  if (FindGraveYardData(id, zoneId))
5323  return false;
5324 
5325  // add link to loaded data
5326  GraveYardData data;
5327  data.safeLocId = id;
5328  data.team = team;
5329 
5330  mGraveYardMap.insert(GraveYardMap::value_type(zoneId, data));
5331 
5332  // add link to DB
5333  if (inDB)
5334  {
5335  WorldDatabase.PExecuteLog("INSERT INTO graveyard_zone (ID, GhostZone, Faction) "
5336  "VALUES ('%u', '%u','%u')", id, zoneId, team);
5337  }
5338 
5339  return true;
5340 }
uint32 team
Definition: ObjectMgr.h:488
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
uint32 safeLocId
Definition: ObjectMgr.h:487
GraveYardMap mGraveYardMap
Definition: ObjectMgr.h:1247
bool PExecuteLog(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:221
GraveYardData const * FindGraveYardData(uint32 id, uint32 zone)
Definition: ObjectMgr.cpp:5306
void ObjectMgr::AddGroup ( Group group)
inline

Definition at line 601 of file ObjectMgr.h.

602  {
603  mGroupSet.insert(group);
604  }
GroupSet mGroupSet
Definition: ObjectMgr.h:1215
void ObjectMgr::AddGuild ( Guild guild)

Definition at line 392 of file ObjectMgr.cpp.

References Guild::GetId().

393 {
394  mGuildMap[guild->GetId()] = guild;
395 }
uint32 GetId()
Definition: Guild.h:278
GuildMap mGuildMap
Definition: ObjectMgr.h:1216
void ObjectMgr::AddLocaleString ( std::string const &  s,
LocaleConstant  locale,
StringVector data 
)
static

Definition at line 7646 of file ObjectMgr.cpp.

Referenced by CreatureTextMgr::LoadCreatureTextLocales().

7647 {
7648  if (!s.empty())
7649  {
7650  if (data.size() <= size_t(locale))
7651  data.resize(locale + 1);
7652 
7653  data[locale] = s;
7654  }
7655 }
void ObjectMgr::AddVendorItem ( uint32  entry,
uint32  item,
uint32  maxcount,
uint32  incrtime,
uint32  ExtendedCost,
bool  savetodb = true 
)

Definition at line 7506 of file ObjectMgr.cpp.

References VendorItemData::AddItem(), Database::PExecuteLog(), and WorldDatabase.

7507 {
7508  VendorItemData& vList = m_mCacheVendorItemMap[entry];
7509  vList.AddItem(item, maxcount, incrtime, extendedcost);
7510 
7511  if (savetodb) WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')", entry, item, maxcount, incrtime, extendedcost);
7512 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
bool PExecuteLog(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:221
void AddItem(uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost)
Definition: Creature.h:383
CacheVendorItemMap m_mCacheVendorItemMap
Definition: ObjectMgr.h:1310
void ObjectMgr::BuildPlayerLevelInfo ( uint8  race,
uint8  class_,
uint8  level,
PlayerLevelInfo plinfo 
) const
private

Definition at line 2741 of file ObjectMgr.cpp.

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

2742 {
2743  // base data (last known level)
2744  *info = playerInfo[race][_class].levelInfo[sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) - 1];
2745 
2746  for (int lvl = sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) - 1; lvl < level; ++lvl)
2747  {
2748  switch (_class)
2749  {
2750  case CLASS_WARRIOR:
2751  info->stats[STAT_STRENGTH] += (lvl > 23 ? 2 : (lvl > 1 ? 1 : 0));
2752  info->stats[STAT_STAMINA] += (lvl > 23 ? 2 : (lvl > 1 ? 1 : 0));
2753  info->stats[STAT_AGILITY] += (lvl > 36 ? 1 : (lvl > 6 && (lvl % 2) ? 1 : 0));
2754  info->stats[STAT_INTELLECT] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
2755  info->stats[STAT_SPIRIT] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
2756  break;
2757  case CLASS_PALADIN:
2758  info->stats[STAT_STRENGTH] += (lvl > 3 ? 1 : 0);
2759  info->stats[STAT_STAMINA] += (lvl > 33 ? 2 : (lvl > 1 ? 1 : 0));
2760  info->stats[STAT_AGILITY] += (lvl > 38 ? 1 : (lvl > 7 && !(lvl % 2) ? 1 : 0));
2761  info->stats[STAT_INTELLECT] += (lvl > 6 && (lvl % 2) ? 1 : 0);
2762  info->stats[STAT_SPIRIT] += (lvl > 7 ? 1 : 0);
2763  break;
2764  case CLASS_HUNTER:
2765  info->stats[STAT_STRENGTH] += (lvl > 4 ? 1 : 0);
2766  info->stats[STAT_STAMINA] += (lvl > 4 ? 1 : 0);
2767  info->stats[STAT_AGILITY] += (lvl > 33 ? 2 : (lvl > 1 ? 1 : 0));
2768  info->stats[STAT_INTELLECT] += (lvl > 8 && (lvl % 2) ? 1 : 0);
2769  info->stats[STAT_SPIRIT] += (lvl > 38 ? 1 : (lvl > 9 && !(lvl % 2) ? 1 : 0));
2770  break;
2771  case CLASS_ROGUE:
2772  info->stats[STAT_STRENGTH] += (lvl > 5 ? 1 : 0);
2773  info->stats[STAT_STAMINA] += (lvl > 4 ? 1 : 0);
2774  info->stats[STAT_AGILITY] += (lvl > 16 ? 2 : (lvl > 1 ? 1 : 0));
2775  info->stats[STAT_INTELLECT] += (lvl > 8 && !(lvl % 2) ? 1 : 0);
2776  info->stats[STAT_SPIRIT] += (lvl > 38 ? 1 : (lvl > 9 && !(lvl % 2) ? 1 : 0));
2777  break;
2778  case CLASS_PRIEST:
2779  info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
2780  info->stats[STAT_STAMINA] += (lvl > 5 ? 1 : 0);
2781  info->stats[STAT_AGILITY] += (lvl > 38 ? 1 : (lvl > 8 && (lvl % 2) ? 1 : 0));
2782  info->stats[STAT_INTELLECT] += (lvl > 22 ? 2 : (lvl > 1 ? 1 : 0));
2783  info->stats[STAT_SPIRIT] += (lvl > 3 ? 1 : 0);
2784  break;
2785  case CLASS_SHAMAN:
2786  info->stats[STAT_STRENGTH] += (lvl > 34 ? 1 : (lvl > 6 && (lvl % 2) ? 1 : 0));
2787  info->stats[STAT_STAMINA] += (lvl > 4 ? 1 : 0);
2788  info->stats[STAT_AGILITY] += (lvl > 7 && !(lvl % 2) ? 1 : 0);
2789  info->stats[STAT_INTELLECT] += (lvl > 5 ? 1 : 0);
2790  info->stats[STAT_SPIRIT] += (lvl > 4 ? 1 : 0);
2791  break;
2792  case CLASS_MAGE:
2793  info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
2794  info->stats[STAT_STAMINA] += (lvl > 5 ? 1 : 0);
2795  info->stats[STAT_AGILITY] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
2796  info->stats[STAT_INTELLECT] += (lvl > 24 ? 2 : (lvl > 1 ? 1 : 0));
2797  info->stats[STAT_SPIRIT] += (lvl > 33 ? 2 : (lvl > 2 ? 1 : 0));
2798  break;
2799  case CLASS_WARLOCK:
2800  info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
2801  info->stats[STAT_STAMINA] += (lvl > 38 ? 2 : (lvl > 3 ? 1 : 0));
2802  info->stats[STAT_AGILITY] += (lvl > 9 && !(lvl % 2) ? 1 : 0);
2803  info->stats[STAT_INTELLECT] += (lvl > 33 ? 2 : (lvl > 2 ? 1 : 0));
2804  info->stats[STAT_SPIRIT] += (lvl > 38 ? 2 : (lvl > 3 ? 1 : 0));
2805  break;
2806  case CLASS_DRUID:
2807  info->stats[STAT_STRENGTH] += (lvl > 38 ? 2 : (lvl > 6 && (lvl % 2) ? 1 : 0));
2808  info->stats[STAT_STAMINA] += (lvl > 32 ? 2 : (lvl > 4 ? 1 : 0));
2809  info->stats[STAT_AGILITY] += (lvl > 38 ? 2 : (lvl > 8 && (lvl % 2) ? 1 : 0));
2810  info->stats[STAT_INTELLECT] += (lvl > 38 ? 3 : (lvl > 4 ? 1 : 0));
2811  info->stats[STAT_SPIRIT] += (lvl > 38 ? 3 : (lvl > 5 ? 1 : 0));
2812  }
2813  }
2814 }
PlayerInfo playerInfo[MAX_RACES][MAX_CLASSES]
Definition: ObjectMgr.h:1275
PlayerLevelInfo * levelInfo
Definition: Player.h:215
#define sWorld
Definition: World.h:860
bool ObjectMgr::CheckCreatureLinkedRespawn ( uint32  guid,
uint32  linkedGuid 
) const

Definition at line 1141 of file ObjectMgr.cpp.

References MapEntry::Instanceable(), CreatureData::mapid, sLog, sMapStore, and CreatureData::spawnMask.

1142 {
1143  const CreatureData* const slave = GetCreatureData(guid);
1144  const CreatureData* const master = GetCreatureData(linkedGuid);
1145 
1146  if (!slave || !master) // they must have a corresponding entry in db
1147  {
1148  sLog.outError("LinkedRespawn: Creature '%u' linking to '%u' which doesn't exist", guid, linkedGuid);
1149  return false;
1150  }
1151 
1152  const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
1153 
1154  if (master->mapid != slave->mapid // link only to same map
1155  && (!map || map->Instanceable())) // or to unistanced world
1156  {
1157  sLog.outError("LinkedRespawn: Creature '%u' linking to '%u' on an unpermitted map", guid, linkedGuid);
1158  return false;
1159  }
1160 
1161  if (!(master->spawnMask & slave->spawnMask) // they must have a possibility to meet (normal/heroic difficulty)
1162  && (!map || map->Instanceable()))
1163  {
1164  sLog.outError("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guid, linkedGuid);
1165  return false;
1166  }
1167 
1168  return true;
1169 }
CreatureData const * GetCreatureData(uint32 guid) const
Definition: ObjectMgr.h:962
uint8 spawnMask
Definition: Creature.h:289
bool Instanceable() const
Definition: DBCStructure.h:554
#define sLog
Log class singleton.
Definition: Log.h:187
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
uint16 mapid
Definition: Creature.h:275
bool ObjectMgr::CheckDeclinedNames ( std::wstring  mainpart,
DeclinedName const &  names 
)
static

Definition at line 7037 of file ObjectMgr.cpp.

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

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

7038 {
7039  for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
7040  {
7041  std::wstring wname;
7042  if (!Utf8toWStr(names.name[i], wname))
7043  return false;
7044 
7045  if (mainpart != GetMainPartOfName(wname, i + 1))
7046  return false;
7047  }
7048  return true;
7049 }
std::wstring GetMainPartOfName(std::wstring wname, uint32 declension)
Definition: Util.cpp:341
#define MAX_DECLINED_NAME_CASES
Definition: Unit.h:728
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:255
void ObjectMgr::CheckScripts ( ScriptsType  type,
std::set< int32 > &  ids 
)
private

Definition at line 7668 of file ObjectMgr.cpp.

References GetScriptsMapByType(), SCRIPT_COMMAND_TALK, and sLog.

7669 {
7670  ScriptMapMap* scripts = GetScriptsMapByType(type);
7671  if (!scripts)
7672  return;
7673  for (ScriptMapMap::const_iterator itrMM = scripts->begin(); itrMM != scripts->end(); ++itrMM)
7674  {
7675  for (ScriptMap::const_iterator itrM = itrMM->second.begin(); itrM != itrMM->second.end(); ++itrM)
7676  {
7677  switch (itrM->second.command)
7678  {
7679  case SCRIPT_COMMAND_TALK:
7680  {
7681  if (!GetOregonStringLocale (itrM->second.Talk.TextID))
7682  sLog.outErrorDb("Table `db_script_string` not has string id %u used db script (ID: %u)", itrM->second.Talk.TextID, itrMM->first);
7683 
7684  if (ids.find(itrM->second.Talk.TextID) != ids.end())
7685  ids.erase(itrM->second.Talk.TextID);
7686  }
7687  default:
7688  break;
7689  }
7690  }
7691  }
7692 }
std::map< uint32, ScriptMap > ScriptMapMap
Definition: ObjectMgr.h:328
#define sLog
Log class singleton.
Definition: Log.h:187
ScriptMapMap * GetScriptsMapByType(ScriptsType type)
Definition: ObjectMgr.cpp:88
OregonStringLocale const * GetOregonStringLocale(int32 entry) const
Definition: ObjectMgr.h:1040
void ObjectMgr::ChooseCreatureFlags ( const CreatureInfo cinfo,
uint32 npcflag,
uint32 unit_flags,
uint32 dynamicflags,
const CreatureData data = NULL 
)
static

Definition at line 1079 of file ObjectMgr.cpp.

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

Referenced by Creature::UpdateEntry().

1080 {
1081  npcflag = cinfo->npcflag;
1082  unit_flags = cinfo->unit_flags;
1083  dynamicflags = cinfo->dynamicflags;
1084 
1085  if (data)
1086  {
1087  if (data->npcflag)
1088  npcflag = data->npcflag;
1089 
1090  if (data->unit_flags)
1091  unit_flags = data->unit_flags;
1092 
1093  if (data->dynamicflags)
1094  dynamicflags = data->dynamicflags;
1095  }
1096 }
uint32 npcflag
Definition: Creature.h:151
uint32 dynamicflags
Definition: Creature.h:163
uint32 npcflag
Definition: Creature.h:290
uint32 unit_flags
Definition: Creature.h:162
uint32 dynamicflags
Definition: Creature.h:292
uint32 unit_flags
Definition: Creature.h:291
uint32 ObjectMgr::ChooseDisplayId ( uint32  team,
const CreatureInfo cinfo,
const CreatureData data = NULL 
)

Definition at line 1066 of file ObjectMgr.cpp.

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

1067 {
1068  // Load creature model (display id)
1069  uint32 display_id = 0;
1070 
1071  if (!data || data->displayid == 0)
1072  display_id = cinfo->GetRandomValidModelId();
1073  else
1074  display_id = data->displayid;
1075 
1076  return display_id;
1077 }
uint32 displayid
Definition: Creature.h:277
uint32 GetRandomValidModelId() const
Definition: Creature.cpp:96
ACE_UINT32 uint32
Definition: Define.h:71
void ObjectMgr::ConvertCreatureAddonAuras ( CreatureDataAddon addon,
char const *  table,
char const *  guidEntryStr 
)
private

Definition at line 799 of file ObjectMgr.cpp.

References CreatureDataAddon::auras, SpellEntry::Effect, CreatureDataAddonAura::effect_idx, SpellEntry::EffectApplyAuraName, CreatureDataAddon::guidOrEntry, sLog, CreatureDataAddonAura::spell_id, and sSpellStore.

800 {
801  // Now add the auras, format "spellid effectindex spellid effectindex..."
802  char* p, *s;
803  std::vector<int> val;
804  s = p = (char*)reinterpret_cast<char const*>(addon->auras);
805  if (p)
806  {
807  while (p[0] != 0)
808  {
809  ++p;
810  if (p[0] == ' ')
811  {
812  val.push_back(atoi(s));
813  s = ++p;
814  }
815  }
816  if (p != s)
817  val.push_back(atoi(s));
818 
819  // free char* loaded memory
820  delete[] (char*)reinterpret_cast<char const*>(addon->auras);
821 
822  // wrong list
823  if (val.size() % 2)
824  {
825  addon->auras = NULL;
826  sLog.outErrorDb("Creature (%s: %u) has wrong auras data in %s.", guidEntryStr, addon->guidOrEntry, table);
827  return;
828  }
829  }
830 
831  // empty list
832  if (val.empty())
833  {
834  addon->auras = NULL;
835  return;
836  }
837 
838  // replace by new structures array
839  const_cast<CreatureDataAddonAura*&>(addon->auras) = new CreatureDataAddonAura[val.size() / 2 + 1];
840 
841  uint32 i = 0;
842  for (size_t j = 0; j < val.size() / 2; ++j)
843  {
844  CreatureDataAddonAura& cAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]);
845  cAura.spell_id = (uint32)val[2 * j + 0];
846  cAura.effect_idx = (uint32)val[2 * j + 1];
847  if (cAura.effect_idx > 2)
848  {
849  sLog.outErrorDb("Creature (%s: %u) has wrong effect %u for spell %u in auras field in %s.", guidEntryStr, addon->guidOrEntry, cAura.effect_idx, cAura.spell_id, table);
850  continue;
851  }
852  SpellEntry const* AdditionalSpellInfo = sSpellStore.LookupEntry(cAura.spell_id);
853  if (!AdditionalSpellInfo)
854  {
855  sLog.outErrorDb("Creature (%s: %u) has wrong spell %u defined in auras field in %s.", guidEntryStr, addon->guidOrEntry, cAura.spell_id, table);
856  continue;
857  }
858 
859  if (!AdditionalSpellInfo->Effect[cAura.effect_idx] || !AdditionalSpellInfo->EffectApplyAuraName[cAura.effect_idx])
860  {
861  sLog.outErrorDb("Creature (%s: %u) has not aura effect %u of spell %u defined in auras field in %s.", guidEntryStr, addon->guidOrEntry, cAura.effect_idx, cAura.spell_id, table);
862  continue;
863  }
864 
865  ++i;
866  }
867 
868  // fill terminator element (after last added)
869  CreatureDataAddonAura& endAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]);
870  endAura.spell_id = 0;
871  endAura.effect_idx = 0;
872 }
#define sLog
Log class singleton.
Definition: Log.h:187
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint32 EffectApplyAuraName[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:734
uint32 guidOrEntry
Definition: Creature.h:305
const AuthHandler table[]
Definition: AuthSocket.cpp:149
CreatureDataAddonAura const * auras
Definition: Creature.h:312
ACE_UINT32 uint32
Definition: Define.h:71
uint32 ObjectMgr::CreateItemText ( std::string  text)

Definition at line 5699 of file ObjectMgr.cpp.

References CharacterDatabase, Database::escape_string(), and Database::Execute().

5700 {
5701  uint32 newItemTextId = GenerateItemTextID();
5702  //insert new itempage to container
5703  mItemTexts[ newItemTextId ] = text;
5704  //save new itempage
5706  //any Delete query needed, itemTextId is maximum of all ids
5707  std::ostringstream query;
5708  query << "INSERT INTO item_text (id,text) VALUES ('" << newItemTextId << "', '" << text << "')";
5709  CharacterDatabase.Execute(query.str().c_str()); //needs to be run this way, because mail body may be more than 1024 characters
5710  return newItemTextId;
5711 }
bool Execute(const char *sql)
Definition: Database.cpp:420
unsigned long escape_string(char *to, const char *from, unsigned long length)
Definition: Database.cpp:212
uint32 GenerateItemTextID()
Definition: ObjectMgr.cpp:5689
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
ItemTextMap mItemTexts
Definition: ObjectMgr.h:1221
ACE_UINT32 uint32
Definition: Define.h:71
void ObjectMgr::DeleteCorpseCellData ( uint32  mapid,
uint32  cellid,
uint32  player_guid 
)

Definition at line 6503 of file ObjectMgr.cpp.

References CellObjectGuids::corpses, and MAKE_PAIR32.

6504 {
6505  // corpses are always added to spawn mode 0 and they are spawned by their instance id
6506  CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(mapid, 0)][cellid];
6507  cell_guids.corpses.erase(player_guid);
6508 }
#define MAKE_PAIR32(l, h)
Definition: Common.h:171
CellCorpseSet corpses
Definition: ObjectMgr.h:357
MapObjectGuids mMapObjectGuids
Definition: ObjectMgr.h:1290
void ObjectMgr::DeleteCreatureData ( uint32  guid)

Definition at line 6442 of file ObjectMgr.cpp.

6443 {
6444  // remove mapid*cellid -> guid_set map
6445  CreatureData const* data = GetCreatureData(guid);
6446  if (data)
6447  RemoveCreatureFromGrid(guid, data);
6448 
6449  mCreatureDataMap.erase(guid);
6450 }
CreatureDataMap mCreatureDataMap
Definition: ObjectMgr.h:1291
CreatureData const * GetCreatureData(uint32 guid) const
Definition: ObjectMgr.h:962
void RemoveCreatureFromGrid(uint32 guid, CreatureData const *data)
Definition: ObjectMgr.cpp:1457
bool ObjectMgr::DeleteGameTele ( const std::string &  name)

Definition at line 7192 of file ObjectMgr.cpp.

References Database::PExecuteLog(), Utf8toWStr(), WorldDatabase, and wstrToLower().

7193 {
7194  // explicit name case
7195  std::wstring wname;
7196  if (!Utf8toWStr(name, wname))
7197  return false;
7198 
7199  // converting string that we try to find to lower case
7200  wstrToLower(wname);
7201 
7202  for (GameTeleMap::iterator itr = m_GameTeleMap.begin(); itr != m_GameTeleMap.end(); ++itr)
7203  {
7204  if (itr->second.wnameLow == wname)
7205  {
7206  WorldDatabase.PExecuteLog("DELETE FROM game_tele WHERE name = '%s'", itr->second.name.c_str());
7207  m_GameTeleMap.erase(itr);
7208  return true;
7209  }
7210  }
7211 
7212  return false;
7213 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:255
void wstrToLower(std::wstring &str)
Definition: Util.h:308
bool PExecuteLog(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:221
GameTeleMap m_GameTeleMap
Definition: ObjectMgr.h:1249
void ObjectMgr::DeleteGOData ( uint32  guid)

Definition at line 6486 of file ObjectMgr.cpp.

6487 {
6488  // remove mapid*cellid -> guid_set map
6489  GameObjectData const* data = GetGOData(guid);
6490  if (data)
6491  RemoveGameobjectFromGrid(guid, data);
6492 
6493  mGameObjectDataMap.erase(guid);
6494 }
GameObjectDataMap mGameObjectDataMap
Definition: ObjectMgr.h:1294
void RemoveGameobjectFromGrid(uint32 guid, GameObjectData const *data)
Definition: ObjectMgr.cpp:1671
GameObjectData const * GetGOData(uint32 guid) const
Definition: ObjectMgr.h:1028
void ObjectMgr::DeleteRespawnTimeForInstance ( uint32  instance)

Definition at line 6460 of file ObjectMgr.cpp.

References GUID_HIPART, Database::PExecute(), and WorldDatabase.

6461 {
6462  RespawnTimes::iterator next;
6463 
6464  for (RespawnTimes::iterator itr = mGORespawnTimes.begin(); itr != mGORespawnTimes.end(); itr = next)
6465  {
6466  next = itr;
6467  ++next;
6468 
6469  if (GUID_HIPART(itr->first) == instance)
6470  mGORespawnTimes.erase(itr);
6471  }
6472 
6473  for (RespawnTimes::iterator itr = mCreatureRespawnTimes.begin(); itr != mCreatureRespawnTimes.end(); itr = next)
6474  {
6475  next = itr;
6476  ++next;
6477 
6478  if (GUID_HIPART(itr->first) == instance)
6479  mCreatureRespawnTimes.erase(itr);
6480  }
6481 
6482  WorldDatabase.PExecute("DELETE FROM creature_respawn WHERE instance = '%u'", instance);
6483  WorldDatabase.PExecute("DELETE FROM gameobject_respawn WHERE instance = '%u'", instance);
6484 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
#define GUID_HIPART(x)
Definition: ObjectGuid.h:82
RespawnTimes mGORespawnTimes
Definition: ObjectMgr.h:1304
RespawnTimes mCreatureRespawnTimes
Definition: ObjectMgr.h:1303
bool PExecute(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:441
GraveYardData const * ObjectMgr::FindGraveYardData ( uint32  id,
uint32  zone 
)

Definition at line 5306 of file ObjectMgr.cpp.

5307 {
5308  GraveYardMap::const_iterator graveLow = mGraveYardMap.lower_bound(zoneId);
5309  GraveYardMap::const_iterator graveUp = mGraveYardMap.upper_bound(zoneId);
5310 
5311  for (GraveYardMap::const_iterator itr = graveLow; itr != graveUp; ++itr)
5312  {
5313  if (itr->second.safeLocId == id)
5314  return &itr->second;
5315  }
5316 
5317  return NULL;
5318 }
GraveYardMap mGraveYardMap
Definition: ObjectMgr.h:1247
uint32 ObjectMgr::GenerateArenaTeamId ( )

Definition at line 5649 of file ObjectMgr.cpp.

References ERROR_EXIT_CODE, sLog, and World::StopNow().

5650 {
5651  if (m_arenaTeamId >= 0xFFFFFFFE)
5652  {
5653  sLog.outError("Arena team ids overflow!! Can't continue, shutting down server. ");
5655  }
5656  return m_arenaTeamId++;
5657 }
#define sLog
Log class singleton.
Definition: Log.h:187
uint32 m_arenaTeamId
Definition: ObjectMgr.h:1193
static void StopNow(uint8 exitcode)
Definition: World.h:632
uint32 ObjectMgr::GenerateAuctionID ( )

Definition at line 5669 of file ObjectMgr.cpp.

References ERROR_EXIT_CODE, sLog, and World::StopNow().

5670 {
5671  if (m_auctionid >= 0xFFFFFFFE)
5672  {
5673  sLog.outError("Auctions ids overflow!! Can't continue, shutting down server. ");
5675  }
5676  return m_auctionid++;
5677 }
uint32 m_auctionid
Definition: ObjectMgr.h:1190
#define sLog
Log class singleton.
Definition: Log.h:187
static void StopNow(uint8 exitcode)
Definition: World.h:632
uint32 ObjectMgr::GenerateGuildId ( )

Definition at line 5659 of file ObjectMgr.cpp.

References ERROR_EXIT_CODE, sLog, and World::StopNow().

5660 {
5661  if (m_guildId >= 0xFFFFFFFE)
5662  {
5663  sLog.outError("Guild ids overflow!! Can't continue, shutting down server. ");
5665  }
5666  return m_guildId++;
5667 }
#define sLog
Log class singleton.
Definition: Log.h:187
uint32 m_guildId
Definition: ObjectMgr.h:1194
static void StopNow(uint8 exitcode)
Definition: World.h:632
uint32 ObjectMgr::GenerateItemTextID ( )

Definition at line 5689 of file ObjectMgr.cpp.

References ERROR_EXIT_CODE, sLog, and World::StopNow().

5690 {
5691  if (m_ItemTextId >= 0xFFFFFFFE)
5692  {
5693  sLog.outError("Item text ids overflow!! Can't continue, shutting down server. ");
5695  }
5696  return m_ItemTextId++;
5697 }
#define sLog
Log class singleton.
Definition: Log.h:187
static void StopNow(uint8 exitcode)
Definition: World.h:632
uint32 m_ItemTextId
Definition: ObjectMgr.h:1192
uint32 ObjectMgr::GenerateLowGuid ( HighGuid  guidhigh)

Definition at line 5713 of file ObjectMgr.cpp.

References ASSERT, ERROR_EXIT_CODE, HIGHGUID_CORPSE, HIGHGUID_DYNAMICOBJECT, HIGHGUID_GAMEOBJECT, HIGHGUID_ITEM, HIGHGUID_PET, HIGHGUID_PLAYER, HIGHGUID_UNIT, sLog, and World::StopNow().

5714 {
5715  switch (guidhigh)
5716  {
5717  case HIGHGUID_ITEM:
5718  if (m_hiItemGuid >= 0xFFFFFFFE)
5719  {
5720  sLog.outError("Item guid overflow!! Can't continue, shutting down server. ");
5722  }
5723  return m_hiItemGuid++;
5724  case HIGHGUID_UNIT:
5725  if (m_hiCreatureGuid >= 0x00FFFFFE)
5726  {
5727  sLog.outError("Creature guid overflow!! Can't continue, shutting down server. ");
5729  }
5730  return m_hiCreatureGuid++;
5731  case HIGHGUID_PET:
5732  if (m_hiPetGuid >= 0x00FFFFFE)
5733  {
5734  sLog.outError("Pet guid overflow!! Can't continue, shutting down server. ");
5736  }
5737  return m_hiPetGuid++;
5738  case HIGHGUID_PLAYER:
5739  if (m_hiCharGuid >= 0xFFFFFFFE)
5740  {
5741  sLog.outError("Players guid overflow!! Can't continue, shutting down server. ");
5743  }
5744  return m_hiCharGuid++;
5745  case HIGHGUID_GAMEOBJECT:
5746  if (m_hiGoGuid >= 0x00FFFFFE)
5747  {
5748  sLog.outError("Gameobject guid overflow!! Can't continue, shutting down server. ");
5750  }
5751  return m_hiGoGuid++;
5752  case HIGHGUID_CORPSE:
5753  if (m_hiCorpseGuid >= 0xFFFFFFFE)
5754  {
5755  sLog.outError("Corpse guid overflow!! Can't continue, shutting down server. ");
5757  }
5758  return m_hiCorpseGuid++;
5760  if (m_hiDoGuid >= 0xFFFFFFFE)
5761  {
5762  sLog.outError("DynamicObject guid overflow!! Can't continue, shutting down server. ");
5764  }
5765  return m_hiDoGuid++;
5766  default:
5767  ASSERT(0);
5768  }
5769 
5770  ASSERT(0);
5771  return 0;
5772 }
#define sLog
Log class singleton.
Definition: Log.h:187
uint32 m_hiPetGuid
Definition: ObjectMgr.h:1200
uint32 m_hiGoGuid
Definition: ObjectMgr.h:1202
uint32 m_hiItemGuid
Definition: ObjectMgr.h:1201
uint32 m_hiCharGuid
Definition: ObjectMgr.h:1198
uint32 m_hiCreatureGuid
Definition: ObjectMgr.h:1199
#define ASSERT
Definition: Errors.h:29
uint32 m_hiDoGuid
Definition: ObjectMgr.h:1203
static void StopNow(uint8 exitcode)
Definition: World.h:632
uint32 m_hiCorpseGuid
Definition: ObjectMgr.h:1204
uint32 ObjectMgr::GenerateMailID ( )

Definition at line 5679 of file ObjectMgr.cpp.

References ERROR_EXIT_CODE, sLog, and World::StopNow().

5680 {
5681  if (m_mailid >= 0xFFFFFFFE)
5682  {
5683  sLog.outError("Mail ids overflow!! Can't continue, shutting down server. ");
5685  }
5686  return m_mailid++;
5687 }
#define sLog
Log class singleton.
Definition: Log.h:187
uint32 m_mailid
Definition: ObjectMgr.h:1191
static void StopNow(uint8 exitcode)
Definition: World.h:632
std::string ObjectMgr::GeneratePetName ( uint32  entry)

Definition at line 6100 of file ObjectMgr.cpp.

References CreatureInfo::family, GetCreatureTemplate(), GetPetName(), CreatureInfo::Name, sWorld, and urand().

6101 {
6102  std::vector<std::string>& list0 = PetHalfName0[entry];
6103  std::vector<std::string>& list1 = PetHalfName1[entry];
6104 
6105  if (list0.empty() || list1.empty())
6106  {
6107  CreatureInfo const* cinfo = GetCreatureTemplate(entry);
6108  char* petname = GetPetName(cinfo->family, sWorld.GetDefaultDbcLocale());
6109  if (!petname)
6110  petname = cinfo->Name;
6111  return std::string(petname);
6112  }
6113 
6114  return *(list0.begin() + urand(0, list0.size() - 1)) + *(list1.begin() + urand(0, list1.size() - 1));
6115 }
char * Name
Definition: Creature.h:138
char * GetPetName(uint32 petfamily, uint32 dbclang)
Definition: DBCStores.cpp:579
HalfNameMap PetHalfName0
Definition: ObjectMgr.h:1284
static CreatureInfo const * GetCreatureTemplate(uint32 id)
Definition: ObjectMgr.cpp:439
#define sWorld
Definition: World.h:860
HalfNameMap PetHalfName1
Definition: ObjectMgr.h:1285
CreatureFamily family
Definition: Creature.h:164
uint32 urand(uint32 min, uint32 max)
Definition: Util.cpp:33
uint32 ObjectMgr::GeneratePetNumber ( )

Definition at line 6117 of file ObjectMgr.cpp.

6118 {
6119  return ++m_hiPetNumber;
6120 }
uint32 m_hiPetNumber
Definition: ObjectMgr.h:1195
AccessRequirement const* ObjectMgr::GetAccessRequirement ( uint32  requirement) const
inline

Definition at line 739 of file ObjectMgr.h.

740  {
741  AccessRequirementMap::const_iterator itr = mAccessRequirements.find(requirement);
742  if (itr != mAccessRequirements.end())
743  return &itr->second;
744  return NULL;
745  }
AccessRequirementMap mAccessRequirements
Definition: ObjectMgr.h:1230
AreaTrigger const* ObjectMgr::GetAreaTrigger ( uint32  trigger) const
inline

Definition at line 731 of file ObjectMgr.h.

732  {
733  AreaTriggerMap::const_iterator itr = mAreaTriggers.find(trigger);
734  if (itr != mAreaTriggers.end())
735  return &itr->second;
736  return NULL;
737  }
AreaTriggerMap mAreaTriggers
Definition: ObjectMgr.h:1228
uint32 ObjectMgr::GetAreaTriggerScriptId ( uint32  trigger_id)

Definition at line 7051 of file ObjectMgr.cpp.

7052 {
7053  AreaTriggerScriptMap::const_iterator i = mAreaTriggerScripts.find(trigger_id);
7054  if (i != mAreaTriggerScripts.end())
7055  return i->second;
7056  return 0;
7057 }
AreaTriggerScriptMap mAreaTriggerScripts
Definition: ObjectMgr.h:1229
ArenaTeam * ObjectMgr::GetArenaTeamByCaptain ( uint64 const &  guid) const

Definition at line 420 of file ObjectMgr.cpp.

421 {
422  for (ArenaTeamMap::const_iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
423  if (itr->second->GetCaptain() == guid)
424  return itr->second;
425 
426  return NULL;
427 }
ArenaTeamMap mArenaTeamMap
Definition: ObjectMgr.h:1217
ArenaTeam * ObjectMgr::GetArenaTeamById ( const uint32  arenateamid) const

Definition at line 402 of file ObjectMgr.cpp.

403 {
404  ArenaTeamMap::const_iterator itr = mArenaTeamMap.find(arenateamid);
405  if (itr != mArenaTeamMap.end())
406  return itr->second;
407 
408  return NULL;
409 }
ArenaTeamMap mArenaTeamMap
Definition: ObjectMgr.h:1217
ArenaTeam * ObjectMgr::GetArenaTeamByName ( const std::string &  arenateamname) const

Definition at line 411 of file ObjectMgr.cpp.

412 {
413  for (ArenaTeamMap::const_iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
414  if (itr->second->GetName() == arenateamname)
415  return itr->second;
416 
417  return NULL;
418 }
ArenaTeamMap mArenaTeamMap
Definition: ObjectMgr.h:1217
ArenaTeamMap::iterator ObjectMgr::GetArenaTeamMapBegin ( )
inline

Definition at line 622 of file ObjectMgr.h.

623  {
624  return mArenaTeamMap.begin();
625  }
ArenaTeamMap mArenaTeamMap
Definition: ObjectMgr.h:1217
ArenaTeamMap::iterator ObjectMgr::GetArenaTeamMapEnd ( )
inline

Definition at line 626 of file ObjectMgr.h.

References GetCreatureTemplate().

627  {
628  return mArenaTeamMap.end();
629  }
ArenaTeamMap mArenaTeamMap
Definition: ObjectMgr.h:1217
uint32 ObjectMgr::GetBaseXP ( uint32  level)

Definition at line 6050 of file ObjectMgr.cpp.

6051 {
6052  return mBaseXPTable[level] ? mBaseXPTable[level] : 0;
6053 }
BaseXPMap mBaseXPTable
Definition: ObjectMgr.h:1278
uint32 ObjectMgr::GetBattleMasterBG ( uint32  entry) const
inline

Definition at line 713 of file ObjectMgr.h.

714  {
715  BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry);
716  if (itr != mBattleMastersMap.end())
717  return itr->second;
718  return 2; //BATTLEGROUND_WS - i will not add include only for constant usage!
719  }
BattleMastersMap mBattleMastersMap
Definition: ObjectMgr.h:1224
CellObjectGuids const& ObjectMgr::GetCellObjectGuids ( uint16  mapid,
uint8  spawnMode,
uint32  cell_id 
)
inline

Definition at line 957 of file ObjectMgr.h.

References MAKE_PAIR32.

958  {
959  return mMapObjectGuids[MAKE_PAIR32(mapid, spawnMode)][cell_id];
960  }
#define MAKE_PAIR32(l, h)
Definition: Common.h:171
MapObjectGuids mMapObjectGuids
Definition: ObjectMgr.h:1290
WorldSafeLocsEntry const * ObjectMgr::GetClosestGraveYard ( float  x,
float  y,
float  z,
uint32  MapId,
uint32  team 
)

Definition at line 5185 of file ObjectMgr.cpp.

References MapEntry::entrance_map, MapEntry::entrance_x, MapEntry::entrance_y, MapManager::GetZoneId(), Oregon::Singleton< MapManager, Oregon::ClassLevelLockable< MapManager, ACE_Thread_Mutex > >::Instance(), WorldSafeLocsEntry::map_id, GraveYardData::safeLocId, sLog, sMapStore, sWorldSafeLocsStore, GraveYardData::team, WorldSafeLocsEntry::x, WorldSafeLocsEntry::y, and WorldSafeLocsEntry::z.

5186 {
5187  // search for zone associated closest graveyard
5188  uint32 zoneId = MapManager::Instance().GetZoneId(MapId, x, y, z);
5189 
5190  if (!zoneId)
5191  {
5192  if (z > -500)
5193  {
5194  sLog.outError("ZoneId not found for map %u coords (%f, %f, %f)", MapId, x, y, z);
5195  return GetDefaultGraveYard(team);
5196  }
5197  }
5198  // Simulate std. algorithm:
5199  // found some graveyard associated to (ghost_zone,ghost_map)
5200  //
5201  // if mapId == graveyard.mapId (ghost in plain zone or city or battleground) and search graveyard at same map
5202  // then check faction
5203  // if mapId != graveyard.mapId (ghost in instance) and search any graveyard associated
5204  // then check faction
5205  GraveYardMap::const_iterator graveLow = mGraveYardMap.lower_bound(zoneId);
5206  GraveYardMap::const_iterator graveUp = mGraveYardMap.upper_bound(zoneId);
5207  if (graveLow == graveUp)
5208  {
5209  sLog.outErrorDb("Table `graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team);
5210  return NULL;
5211  }
5212 
5213  // at corpse map
5214  bool foundNear = false;
5215  float distNear = 10000;
5216  WorldSafeLocsEntry const* entryNear = NULL;
5217 
5218  // at entrance map for corpse map
5219  bool foundEntr = false;
5220  float distEntr = 10000;
5221  WorldSafeLocsEntry const* entryEntr = NULL;
5222 
5223  // some where other
5224  WorldSafeLocsEntry const* entryFar = NULL;
5225 
5226  MapEntry const* mapEntry = sMapStore.LookupEntry(MapId);
5227 
5228  for (GraveYardMap::const_iterator itr = graveLow; itr != graveUp; ++itr)
5229  {
5230  GraveYardData const& data = itr->second;
5231 
5232  WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(data.safeLocId);
5233  if (!entry)
5234  {
5235  sLog.outErrorDb("Table `graveyard_zone` has record for not existing graveyard (WorldSafeLocsID %u), skipped.", data.safeLocId);
5236  continue;
5237  }
5238 
5239  // skip enemy faction graveyard
5240  // team == 0 case can be at call from .neargrave
5241  if (data.team != 0 && team != 0 && data.team != team)
5242  continue;
5243 
5244  // find now nearest graveyard at other map
5245  if (MapId != entry->map_id)
5246  {
5247  // if find graveyard at different map from where entrance placed (or no entrance data), use any first
5248  if (!mapEntry
5249  || mapEntry->entrance_map < 0
5250  || mapEntry->entrance_map != entry->map_id
5251  || mapEntry->entrance_x == 0 && mapEntry->entrance_y == 0)
5252  {
5253  // not have any corrdinates for check distance anyway
5254  entryFar = entry;
5255  continue;
5256  }
5257 
5258  // at entrance map calculate distance (2D);
5259  float dist2 = (entry->x - mapEntry->entrance_x) * (entry->x - mapEntry->entrance_x)
5260  + (entry->y - mapEntry->entrance_y) * (entry->y - mapEntry->entrance_y);
5261  if (foundEntr)
5262  {
5263  if (dist2 < distEntr)
5264  {
5265  distEntr = dist2;
5266  entryEntr = entry;
5267  }
5268  }
5269  else
5270  {
5271  foundEntr = true;
5272  distEntr = dist2;
5273  entryEntr = entry;
5274  }
5275  }
5276  // find now nearest graveyard at same map
5277  else
5278  {
5279  float dist2 = (entry->x - x) * (entry->x - x) + (entry->y - y) * (entry->y - y) + (entry->z - z) * (entry->z - z);
5280  if (foundNear)
5281  {
5282  if (dist2 < distNear)
5283  {
5284  distNear = dist2;
5285  entryNear = entry;
5286  }
5287  }
5288  else
5289  {
5290  foundNear = true;
5291  distNear = dist2;
5292  entryNear = entry;
5293  }
5294  }
5295  }
5296 
5297  if (entryNear)
5298  return entryNear;
5299 
5300  if (entryEntr)
5301  return entryEntr;
5302 
5303  return entryFar;
5304 }
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsEntryfmt)
uint32 GetZoneId(uint32 mapid, float x, float y, float z)
Definition: MapManager.h:56
uint32 team
Definition: ObjectMgr.h:488
float entrance_x
Definition: DBCStructure.h:537
#define sLog
Log class singleton.
Definition: Log.h:187
uint32 safeLocId
Definition: ObjectMgr.h:487
GraveYardMap mGraveYardMap
Definition: ObjectMgr.h:1247
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
WorldSafeLocsEntry const * GetDefaultGraveYard(uint32 team)
Definition: ObjectMgr.cpp:5170
float entrance_y
Definition: DBCStructure.h:538
int32 entrance_map
Definition: DBCStructure.h:536
ACE_UINT32 uint32
Definition: Define.h:71
static CreatureDataAddon const* ObjectMgr::GetCreatureAddon ( uint32  lowguid)
inlinestatic

Definition at line 638 of file ObjectMgr.h.

References SQLStorage::LookupEntry().

Referenced by Creature::GetCreatureAddon().

639  {
641  }
SQLStorage sCreatureDataAddonStorage
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
CreatureBaseStats const * ObjectMgr::GetCreatureClassLvlStats ( uint32  level,
uint32  unitClass,
int32  expansion 
) const

Definition at line 986 of file ObjectMgr.cpp.

References CreatureBaseStats::BaseDamage, and CreatureBaseStats::BaseHealth.

987 {
988  if (expansion < 0)
989  return NULL;
990 
991  CreatureBaseStats const* cCLS = &m_creatureClassLvlStats[level][classToIndex[unitClass]][expansion];
992 
993  if (cCLS->BaseHealth != 0 && cCLS->BaseDamage != 0.0f)
994  return cCLS;
995 
996  return NULL;
997 }
CreatureBaseStats m_creatureClassLvlStats[DEFAULT_MAX_CREATURE_LEVEL+1][MAX_CREATURE_CLASS][MAX_EXPANSION+1]
Definition: ObjectMgr.h:1288
uint32 BaseHealth
Definition: Creature.h:230
CreatureData const* ObjectMgr::GetCreatureData ( uint32  guid) const
inline

Definition at line 962 of file ObjectMgr.h.

963  {
964  CreatureDataMap::const_iterator itr = mCreatureDataMap.find(guid);
965  if (itr == mCreatureDataMap.end()) return NULL;
966  return &itr->second;
967  }
CreatureDataMap mCreatureDataMap
Definition: ObjectMgr.h:1291
CreatureLocale const* ObjectMgr::GetCreatureLocale ( uint32  entry) const
inline

Definition at line 979 of file ObjectMgr.h.

980  {
981  CreatureLocaleMap::const_iterator itr = mCreatureLocaleMap.find(entry);
982  if (itr == mCreatureLocaleMap.end()) return NULL;
983  return &itr->second;
984  }
CreatureLocaleMap mCreatureLocaleMap
Definition: ObjectMgr.h:1293
CreatureModelInfo const * ObjectMgr::GetCreatureModelInfo ( uint32  modelid)

Definition at line 1061 of file ObjectMgr.cpp.

References SQLStorage::LookupEntry(), and sCreatureModelStorage.

1062 {
1064 }
SQLStorage sCreatureModelStorage
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
CreatureModelInfo const * ObjectMgr::GetCreatureModelRandomGender ( uint32  display_id)

Definition at line 1098 of file ObjectMgr.cpp.

References CreatureModelInfo::modelid, CreatureModelInfo::modelid_other_gender, sLog, and urand().

1099 {
1100  CreatureModelInfo const* minfo = GetCreatureModelInfo(display_id);
1101  if (!minfo)
1102  return NULL;
1103 
1104  // If a model for another gender exists, 50% chance to use it
1105  if (minfo->modelid_other_gender != 0 && urand(0, 1) == 0)
1106  {
1107  CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(minfo->modelid_other_gender);
1108  if (!minfo_tmp)
1109  {
1110  sLog.outErrorDb("Model (Entry: %u) has modelid_other_gender %u not found in table creature_model_info. ", minfo->modelid, minfo->modelid_other_gender);
1111  return minfo; // not fatal, just use the previous one
1112  }
1113  else
1114  return minfo_tmp;
1115  }
1116  else
1117  return minfo;
1118 }
CreatureModelInfo const * GetCreatureModelInfo(uint32 modelid)
Definition: ObjectMgr.cpp:1061
#define sLog
Log class singleton.
Definition: Log.h:187
uint32 modelid_other_gender
Definition: Creature.h:323
uint32 urand(uint32 min, uint32 max)
Definition: Util.cpp:33
QuestRelations* ObjectMgr::GetCreatureQuestRelationMap ( )
inline

Definition at line 806 of file ObjectMgr.h.

807  {
808  return &mCreatureQuestRelations;
809  }
QuestRelations mCreatureQuestRelations
Definition: ObjectMgr.h:815
time_t ObjectMgr::GetCreatureRespawnTime ( uint32  loguid,
uint32  instance 
)
inline

Definition at line 1063 of file ObjectMgr.h.

References MAKE_PAIR64.

1064  {
1065  return mCreatureRespawnTimes[MAKE_PAIR64(loguid, instance)];
1066  }
#define MAKE_PAIR64(l, h)
Definition: Common.h:167
RespawnTimes mCreatureRespawnTimes
Definition: ObjectMgr.h:1303
CreatureInfo const * ObjectMgr::GetCreatureTemplate ( uint32  id)
static

Definition at line 439 of file ObjectMgr.cpp.

References ScriptInfo::id, SQLStorage::LookupEntry(), and sCreatureStorage.

Referenced by Creature::GetScriptId(), and Player::RewardPlayerAndGroupAtKill().

440 {
442 }
SQLStorage sCreatureStorage
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
static CreatureDataAddon const* ObjectMgr::GetCreatureTemplateAddon ( uint32  entry)
inlinestatic

Definition at line 643 of file ObjectMgr.h.

References SQLStorage::LookupEntry().

Referenced by Creature::GetCreatureAddon().

644  {
646  }
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
SQLStorage sCreatureInfoAddonStorage
int32 ObjectMgr::GetDBCLocaleIndex ( ) const
inline

Definition at line 1051 of file ObjectMgr.h.

1052  {
1053  return DBCLocaleIndex;
1054  }
int DBCLocaleIndex
Definition: ObjectMgr.h:1260
WorldSafeLocsEntry const * ObjectMgr::GetDefaultGraveYard ( uint32  team)

Definition at line 5170 of file ObjectMgr.cpp.

References ALLIANCE, HORDE, and sWorldSafeLocsStore.

5171 {
5172  enum DefaultGraveyard
5173  {
5174  HORDE_GRAVEYARD = 10, // Crossroads
5175  ALLIANCE_GRAVEYARD = 4 // Westfall
5176  };
5177 
5178  if (team == HORDE)
5179  return sWorldSafeLocsStore.LookupEntry(HORDE_GRAVEYARD);
5180  else if (team == ALLIANCE)
5181  return sWorldSafeLocsStore.LookupEntry(ALLIANCE_GRAVEYARD);
5182  else return NULL;
5183 }
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsEntryfmt)
EquipmentInfo const * ObjectMgr::GetEquipmentInfo ( uint32  entry)

Definition at line 999 of file ObjectMgr.cpp.

References SQLStorage::LookupEntry(), and sEquipmentStorage.

1000 {
1002 }
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
SQLStorage sEquipmentStorage
EquipmentInfoRaw const * ObjectMgr::GetEquipmentInfoRaw ( uint32  entry)

Definition at line 1004 of file ObjectMgr.cpp.

References SQLStorage::LookupEntry(), and sEquipmentStorageRaw.

1005 {
1007 }
SQLStorage sEquipmentStorageRaw
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
int32 ObjectMgr::GetFishingBaseSkillLevel ( uint32  entry) const
inline

Definition at line 899 of file ObjectMgr.h.

900  {
901  FishingBaseSkillMap::const_iterator itr = mFishingBaseForArea.find(entry);
902  return itr != mFishingBaseForArea.end() ? itr->second : 0;
903  }
FishingBaseSkillMap mFishingBaseForArea
Definition: ObjectMgr.h:1281
static GameObjectInfo const* ObjectMgr::GetGameObjectInfo ( uint32  id)
inlinestatic

Definition at line 592 of file ObjectMgr.h.

References SQLStorage::LookupEntry().

593  {
595  }
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
SQLStorage sGOStorage
GameObjectLocale const* ObjectMgr::GetGameObjectLocale ( uint32  entry) const
inline

Definition at line 985 of file ObjectMgr.h.

986  {
987  GameObjectLocaleMap::const_iterator itr = mGameObjectLocaleMap.find(entry);
988  if (itr == mGameObjectLocaleMap.end()) return NULL;
989  return &itr->second;
990  }
GameObjectLocaleMap mGameObjectLocaleMap
Definition: ObjectMgr.h:1295
GameTele const* ObjectMgr::GetGameTele ( uint32  id) const
inline

Definition at line 1105 of file ObjectMgr.h.

1106  {
1107  GameTeleMap::const_iterator itr = m_GameTeleMap.find(id);
1108  if (itr == m_GameTeleMap.end()) return NULL;
1109  return &itr->second;
1110  }
GameTeleMap m_GameTeleMap
Definition: ObjectMgr.h:1249
GameTele const * ObjectMgr::GetGameTele ( const std::string &  name) const

Definition at line 7147 of file ObjectMgr.cpp.

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

7148 {
7149  // explicit name case
7150  std::wstring wname;
7151  if (!Utf8toWStr(name, wname))
7152  return NULL;
7153 
7154  // converting string that we try to find to lower case
7155  wstrToLower(wname);
7156 
7157  // Alternative first GameTele what contains wnameLow as substring in case no GameTele location found
7158  const GameTele* alt = NULL;
7159  for (GameTeleMap::const_iterator itr = m_GameTeleMap.begin(); itr != m_GameTeleMap.end(); ++itr)
7160  {
7161  if (itr->second.wnameLow == wname)
7162  return &itr->second;
7163  else if (alt == NULL && itr->second.wnameLow.find(wname) != std::wstring::npos)
7164  alt = &itr->second;
7165  }
7166 
7167  return alt;
7168 }
std::wstring wnameLow
Definition: ObjectMgr.h:71
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:255
void wstrToLower(std::wstring &str)
Definition: Util.h:308
GameTeleMap m_GameTeleMap
Definition: ObjectMgr.h:1249
GameTeleMap const& ObjectMgr::GetGameTeleMap ( ) const
inline

Definition at line 1112 of file ObjectMgr.h.

1113  {
1114  return m_GameTeleMap;
1115  }
GameTeleMap m_GameTeleMap
Definition: ObjectMgr.h:1249
AreaTrigger const * ObjectMgr::GetGoBackTrigger ( uint32  Map) const

Definition at line 5550 of file ObjectMgr.cpp.

References MapEntry::entrance_map, MapEntry::IsDungeon(), AreaTriggerEntry::mapid, InstanceTemplate::parent, sAreaTriggerStore, sMapStore, and sObjectMgr.

5551 {
5552  bool useParentDbValue = false;
5553  uint32 parentId = 0;
5554  MapEntry const* mapEntry = sMapStore.LookupEntry(Map);
5555  if (!mapEntry || mapEntry->entrance_map < 0)
5556  return nullptr;
5557 
5558  if (mapEntry->IsDungeon())
5559  {
5560  InstanceTemplate const* iTemplate = sObjectMgr.GetInstanceTemplate(Map);
5561 
5562  if (!iTemplate)
5563  return nullptr;
5564 
5565  parentId = iTemplate->parent;
5566  useParentDbValue = true;
5567  }
5568 
5569  uint32 entrance_map = uint32(mapEntry->entrance_map);
5570  for (AreaTriggerMap::const_iterator itr = mAreaTriggers.begin(); itr != mAreaTriggers.end(); ++itr)
5571  if ((!useParentDbValue && itr->second.target_mapId == entrance_map) || (useParentDbValue && itr->second.target_mapId == parentId))
5572  {
5573  AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
5574  if (atEntry && atEntry->mapid == Map)
5575  return &itr->second;
5576  }
5577  return nullptr;
5578 }
AreaTriggerMap mAreaTriggers
Definition: ObjectMgr.h:1228
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerEntryfmt)
#define sObjectMgr
Definition: ObjectMgr.h:1317
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
bool IsDungeon() const
Definition: DBCStructure.h:550
Definition: Map.h:266
uint32 parent
Definition: Map.h:233
int32 entrance_map
Definition: DBCStructure.h:536
ACE_UINT32 uint32
Definition: Define.h:71
GameObjectData const* ObjectMgr::GetGOData ( uint32  guid) const
inline

Definition at line 1028 of file ObjectMgr.h.

1029  {
1030  GameObjectDataMap::const_iterator itr = mGameObjectDataMap.find(guid);
1031  if (itr == mGameObjectDataMap.end()) return NULL;
1032  return &itr->second;
1033  }
GameObjectDataMap mGameObjectDataMap
Definition: ObjectMgr.h:1294
QuestRelations* ObjectMgr::GetGOQuestRelationMap ( )
inline

Definition at line 801 of file ObjectMgr.h.

802  {
803  return &mGOQuestRelations;
804  }
QuestRelations mGOQuestRelations
Definition: ObjectMgr.h:813
time_t ObjectMgr::GetGORespawnTime ( uint32  loguid,
uint32  instance 
)
inline

Definition at line 1068 of file ObjectMgr.h.

References MAKE_PAIR64.

1069  {
1070  return mGORespawnTimes[MAKE_PAIR64(loguid, instance)];
1071  }
#define MAKE_PAIR64(l, h)
Definition: Common.h:167
RespawnTimes mGORespawnTimes
Definition: ObjectMgr.h:1304
GossipMenuItemsLocale const* ObjectMgr::GetGossipMenuItemsLocale ( uint32  entry) const
inline

Definition at line 1015 of file ObjectMgr.h.

1016  {
1017  GossipMenuItemsLocaleMap::const_iterator itr = mGossipMenuItemsLocaleMap.find(entry);
1018  if (itr == mGossipMenuItemsLocaleMap.end()) return NULL;
1019  return &itr->second;
1020  }
GossipMenuItemsLocaleMap mGossipMenuItemsLocaleMap
Definition: ObjectMgr.h:1301
GossipMenuItemsMapBounds ObjectMgr::GetGossipMenuItemsMapBounds ( uint32  uiMenuId) const
inline

Definition at line 1170 of file ObjectMgr.h.

1171  {
1172  return GossipMenuItemsMapBounds(m_mGossipMenuItemsMap.lower_bound(uiMenuId), m_mGossipMenuItemsMap.upper_bound(uiMenuId));
1173  }
GossipMenuItemsMap m_mGossipMenuItemsMap
Definition: ObjectMgr.h:1236
std::pair< GossipMenuItemsMap::const_iterator, GossipMenuItemsMap::const_iterator > GossipMenuItemsMapBounds
Definition: ObjectMgr.h:462
GossipMenuItemsMapBoundsNonConst ObjectMgr::GetGossipMenuItemsMapBoundsNonConst ( uint32  uiMenuId)
inline

Definition at line 1175 of file ObjectMgr.h.

1176  {
1177  return GossipMenuItemsMapBoundsNonConst(m_mGossipMenuItemsMap.lower_bound(uiMenuId),m_mGossipMenuItemsMap.upper_bound(uiMenuId));
1178  }
GossipMenuItemsMap m_mGossipMenuItemsMap
Definition: ObjectMgr.h:1236
std::pair< GossipMenuItemsMap::iterator, GossipMenuItemsMap::iterator > GossipMenuItemsMapBoundsNonConst
Definition: ObjectMgr.h:463
GossipMenusMapBounds ObjectMgr::GetGossipMenusMapBounds ( uint32  uiMenuId) const
inline

Definition at line 1160 of file ObjectMgr.h.

1161  {
1162  return GossipMenusMapBounds(m_mGossipMenusMap.lower_bound(uiMenuId), m_mGossipMenusMap.upper_bound(uiMenuId));
1163  }
std::pair< GossipMenusMap::const_iterator, GossipMenusMap::const_iterator > GossipMenusMapBounds
Definition: ObjectMgr.h:459
GossipMenusMap m_mGossipMenusMap
Definition: ObjectMgr.h:1235
GossipMenusMapBoundsNonConst ObjectMgr::GetGossipMenusMapBoundsNonConst ( uint32  uiMenuId)
inline

Definition at line 1165 of file ObjectMgr.h.

1166  {
1167  return GossipMenusMapBoundsNonConst(m_mGossipMenusMap.lower_bound(uiMenuId),m_mGossipMenusMap.upper_bound(uiMenuId));
1168  }
std::pair< GossipMenusMap::iterator, GossipMenusMap::iterator > GossipMenusMapBoundsNonConst
Definition: ObjectMgr.h:460
GossipMenusMap m_mGossipMenusMap
Definition: ObjectMgr.h:1235
GossipText * ObjectMgr::GetGossipText ( uint32  Text_ID)

Definition at line 4661 of file ObjectMgr.cpp.

4662 {
4663  GossipTextMap::const_iterator itr;
4664  for (itr = mGossipText.begin(); itr != mGossipText.end(); ++itr)
4665  {
4666  if (itr->second->Text_ID == Text_ID)
4667  return itr->second;
4668  }
4669  return NULL;
4670 }
GossipTextMap mGossipText
Definition: ObjectMgr.h:1227
Group * ObjectMgr::GetGroupByLeader ( const uint64 guid) const

Definition at line 347 of file ObjectMgr.cpp.

348 {
349  for (GroupSet::const_iterator itr = mGroupSet.begin(); itr != mGroupSet.end(); ++itr)
350  if ((*itr)->GetLeaderGUID() == guid)
351  return *itr;
352 
353  return NULL;
354 }
GroupSet mGroupSet
Definition: ObjectMgr.h:1215
uint32 ObjectMgr::GetGuildBankTabPrice ( uint8  Index) const
inline

Definition at line 1100 of file ObjectMgr.h.

References GUILD_BANK_MAX_TABS.

1101  {
1102  return Index < GUILD_BANK_MAX_TABS ? mGuildBankTabPrice[Index] : 0;
1103  }
GuildBankTabPriceMap mGuildBankTabPrice
Definition: ObjectMgr.h:1307
#define GUILD_BANK_MAX_TABS
Guild * ObjectMgr::GetGuildById ( const uint32  GuildId) const

Definition at line 356 of file ObjectMgr.cpp.

357 {
358  GuildMap::const_iterator itr = mGuildMap.find(GuildId);
359  if (itr != mGuildMap.end())
360  return itr->second;
361 
362  return NULL;
363 }
GuildMap mGuildMap
Definition: ObjectMgr.h:1216
Guild * ObjectMgr::GetGuildByLeader ( uint64 const &  guid) const

Definition at line 383 of file ObjectMgr.cpp.

384 {
385  for (GuildMap::const_iterator itr = mGuildMap.begin(); itr != mGuildMap.end(); ++itr)
386  if (itr->second->GetLeader() == guid)
387  return itr->second;
388 
389  return NULL;
390 }
GuildMap mGuildMap
Definition: ObjectMgr.h:1216
Guild * ObjectMgr::GetGuildByName ( const std::string &  guildname) const

Definition at line 365 of file ObjectMgr.cpp.

366 {
367  for (GuildMap::const_iterator itr = mGuildMap.begin(); itr != mGuildMap.end(); ++itr)
368  if (itr->second->GetName() == guildname)
369  return itr->second;
370 
371  return NULL;
372 }
GuildMap mGuildMap
Definition: ObjectMgr.h:1216
std::string ObjectMgr::GetGuildNameById ( const uint32  GuildId) const

Definition at line 374 of file ObjectMgr.cpp.

375 {
376  GuildMap::const_iterator itr = mGuildMap.find(GuildId);
377  if (itr != mGuildMap.end())
378  return itr->second->GetName();
379 
380  return "";
381 }
GuildMap mGuildMap
Definition: ObjectMgr.h:1216
int ObjectMgr::GetIndexForLocale ( LocaleConstant  loc)

Definition at line 6759 of file ObjectMgr.cpp.

References LOCALE_enUS.

6760 {
6761  if (loc == LOCALE_enUS)
6762  return -1;
6763 
6764  for (size_t i = 0; i < m_LocalForIndex.size(); ++i)
6765  if (m_LocalForIndex[i] == loc)
6766  return i;
6767 
6768  return -1;
6769 }
LocalForIndex m_LocalForIndex
Definition: ObjectMgr.h:1257
static InstanceTemplate const* ObjectMgr::GetInstanceTemplate ( uint32  map)
inlinestatic

Definition at line 653 of file ObjectMgr.h.

References SQLStorage::LookupEntry().

Referenced by Spell::CheckCast().

654  {
656  }
SQLStorage sInstanceTemplate
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
ItemLocale const* ObjectMgr::GetItemLocale ( uint32  entry) const
inline

Definition at line 991 of file ObjectMgr.h.

992  {
993  ItemLocaleMap::const_iterator itr = mItemLocaleMap.find(entry);
994  if (itr == mItemLocaleMap.end()) return NULL;
995  return &itr->second;
996  }
ItemLocaleMap mItemLocaleMap
Definition: ObjectMgr.h:1296
static ItemTemplate const* ObjectMgr::GetItemTemplate ( uint32  id)
inlinestatic

Definition at line 648 of file ObjectMgr.h.

References SQLStorage::LookupEntry().

Referenced by Player::DeleteFromDB(), SpellMgr::IsSpellValid(), and Creature::SetVirtualItem().

649  {
651  }
SQLStorage sItemStorage
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
std::string ObjectMgr::GetItemText ( uint32  id)
inline

Definition at line 917 of file ObjectMgr.h.

918  {
919  ItemTextMap::const_iterator itr = mItemTexts.find(id);
920  if (itr != mItemTexts.end())
921  return itr->second;
922  else
923  return "There is no info for this item";
924  }
ItemTextMap mItemTexts
Definition: ObjectMgr.h:1221
uint32 ObjectMgr::GetLinkedRespawnGuid ( uint32  guid) const
inline

Definition at line 973 of file ObjectMgr.h.

974  {
975  CreatureLinkedRespawnMap::const_iterator itr = mCreatureLinkedRespawnMap.find(guid);
976  if (itr == mCreatureLinkedRespawnMap.end()) return 0;
977  return itr->second;
978  }
CreatureLinkedRespawnMap mCreatureLinkedRespawnMap
Definition: ObjectMgr.h:1292
LocaleConstant ObjectMgr::GetLocaleForIndex ( int  i)

Definition at line 6771 of file ObjectMgr.cpp.

References LOCALE_enUS.

6772 {
6773  if (i < 0 || i >= m_LocalForIndex.size())
6774  return LOCALE_enUS;
6775 
6776  return m_LocalForIndex[i];
6777 }
LocalForIndex m_LocalForIndex
Definition: ObjectMgr.h:1257
static void ObjectMgr::GetLocaleString ( const StringVector data,
int  loc_idx,
std::string &  value 
)
inlinestatic

Definition at line 1181 of file ObjectMgr.h.

Referenced by CreatureTextMgr::GetLocalizedChatString().

1182  {
1183  if (data.size() > size_t(loc_idx) && !data[loc_idx].empty())
1184  value = data[loc_idx];
1185  }
etc mysql my cnf *Then change max_allowed_packet to a bigger value
AreaTrigger const * ObjectMgr::GetMapEntranceTrigger ( uint32  Map) const

Searches for the areatrigger which teleports players to the given map

Definition at line 5583 of file ObjectMgr.cpp.

References sAreaTriggerStore.

5584 {
5585  for (AreaTriggerMap::const_iterator itr = mAreaTriggers.begin(); itr != mAreaTriggers.end(); ++itr)
5586  {
5587  if (itr->second.target_mapId == Map)
5588  {
5589  AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
5590  if (atEntry)
5591  return &itr->second;
5592  }
5593  }
5594  return NULL;
5595 }
AreaTriggerMap mAreaTriggers
Definition: ObjectMgr.h:1228
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerEntryfmt)
Definition: Map.h:266
uint32 ObjectMgr::GetNearestTaxiNode ( float  x,
float  y,
float  z,
uint32  mapid 
)

Definition at line 5019 of file ObjectMgr.cpp.

References ScriptInfo::id, TaxiNodesEntry::map_id, sTaxiNodesStore, TaxiNodesEntry::x, TaxiNodesEntry::y, and TaxiNodesEntry::z.

5020 {
5021  bool found = false;
5022  float dist;
5023  uint32 id = 0;
5024 
5025  for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
5026  {
5027  TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
5028  if (node && node->map_id == mapid)
5029  {
5030  float dist2 = (node->x - x) * (node->x - x) + (node->y - y) * (node->y - y) + (node->z - z) * (node->z - z);
5031  if (found)
5032  {
5033  if (dist2 < dist)
5034  {
5035  dist = dist2;
5036  id = i;
5037  }
5038  }
5039  else
5040  {
5041  found = true;
5042  dist = dist2;
5043  id = i;
5044  }
5045  }
5046  }
5047 
5048  return id;
5049 }
ACE_UINT32 uint32
Definition: Define.h:71
DBCStorage< TaxiNodesEntry > sTaxiNodesStore(TaxiNodesEntryfmt)
uint32 ObjectMgr::GetNpcGossip ( uint32  entry) const
inline

Definition at line 1119 of file ObjectMgr.h.

1120  {
1121  CacheNpcTextIdMap::const_iterator iter = m_mCacheNpcTextIdMap.find(entry);
1122  if (iter == m_mCacheNpcTextIdMap.end())
1123  return 0;
1124 
1125  return iter->second;
1126  }
CacheNpcTextIdMap m_mCacheNpcTextIdMap
Definition: ObjectMgr.h:1309
NpcTextLocale const* ObjectMgr::GetNpcTextLocale ( uint32  entry) const
inline

Definition at line 1003 of file ObjectMgr.h.

1004  {
1005  NpcTextLocaleMap::const_iterator itr = mNpcTextLocaleMap.find(entry);
1006  if (itr == mNpcTextLocaleMap.end()) return NULL;
1007  return &itr->second;
1008  }
NpcTextLocaleMap mNpcTextLocaleMap
Definition: ObjectMgr.h:1298
TrainerSpellData const* ObjectMgr::GetNpcTrainerSpells ( uint32  entry) const
inline

Definition at line 1128 of file ObjectMgr.h.

1129  {
1130  CacheTrainerSpellMap::const_iterator iter = m_mCacheTrainerSpellMap.find(entry);
1131  if (iter == m_mCacheTrainerSpellMap.end())
1132  return NULL;
1133 
1134  return &iter->second;
1135  }
CacheTrainerSpellMap m_mCacheTrainerSpellMap
Definition: ObjectMgr.h:1311
VendorItemData const* ObjectMgr::GetNpcVendorItemList ( uint32  entry) const
inline

Definition at line 1137 of file ObjectMgr.h.

1138  {
1139  CacheVendorItemMap::const_iterator iter = m_mCacheVendorItemMap.find(entry);
1140  if (iter == m_mCacheVendorItemMap.end())
1141  return NULL;
1142 
1143  return &iter->second;
1144  }
CacheVendorItemMap m_mCacheVendorItemMap
Definition: ObjectMgr.h:1310
const char * ObjectMgr::GetOregonString ( int32  entry,
int  locale_idx 
) const

Definition at line 6980 of file ObjectMgr.cpp.

References sLog.

6981 {
6982  // locale_idx == -1 -> default, locale_idx >= 0 in to idx+1
6983  // Content[0] always exist if exist OregonStringLocale
6984  if (OregonStringLocale const* msl = GetOregonStringLocale(entry))
6985  {
6986  if (msl->Content.size() > locale_idx + 1 && !msl->Content[locale_idx + 1].empty())
6987  return msl->Content[locale_idx + 1].c_str();
6988  else
6989  return msl->Content[0].c_str();
6990  }
6991 
6992  if (entry > 0)
6993  sLog.outErrorDb("Entry %i not found in oregon_string table.", entry);
6994  else
6995  sLog.outErrorDb("Oregon string entry %i not found in DB.", entry);
6996  return "<error>";
6997 }
#define sLog
Log class singleton.
Definition: Log.h:187
OregonStringLocale const * GetOregonStringLocale(int32 entry) const
Definition: ObjectMgr.h:1040
const char* ObjectMgr::GetOregonStringForDBCLocale ( int32  entry) const
inline

Definition at line 1047 of file ObjectMgr.h.

1048  {
1049  return GetOregonString(entry, DBCLocaleIndex);
1050  }
int DBCLocaleIndex
Definition: ObjectMgr.h:1260
const char * GetOregonString(int32 entry, int locale_idx) const
Definition: ObjectMgr.cpp:6980
OregonStringLocale const* ObjectMgr::GetOregonStringLocale ( int32  entry) const
inline

Definition at line 1040 of file ObjectMgr.h.

1041  {
1042  OregonStringLocaleMap::const_iterator itr = mOregonStringLocaleMap.find(entry);
1043  if (itr == mOregonStringLocaleMap.end()) return NULL;
1044  return &itr->second;
1045  }
OregonStringLocaleMap mOregonStringLocaleMap
Definition: ObjectMgr.h:1300
int ObjectMgr::GetOrNewIndexForLocale ( LocaleConstant  loc)
protected

Definition at line 6779 of file ObjectMgr.cpp.

References LOCALE_enUS.

6780 {
6781  if (loc == LOCALE_enUS)
6782  return -1;
6783 
6784  for (size_t i = 0; i < m_LocalForIndex.size(); ++i)
6785  if (m_LocalForIndex[i] == loc)
6786  return i;
6787 
6788  m_LocalForIndex.push_back(loc);
6789  return m_LocalForIndex.size() - 1;
6790 }
LocalForIndex m_LocalForIndex
Definition: ObjectMgr.h:1257
PageTextLocale const* ObjectMgr::GetPageTextLocale ( uint32  entry) const
inline

Definition at line 1009 of file ObjectMgr.h.

1010  {
1011  PageTextLocaleMap::const_iterator itr = mPageTextLocaleMap.find(entry);
1012  if (itr == mPageTextLocaleMap.end()) return NULL;
1013  return &itr->second;
1014  }
PageTextLocaleMap mPageTextLocaleMap
Definition: ObjectMgr.h:1299
PetCreateSpellEntry const* ObjectMgr::GetPetCreateSpellEntry ( uint32  id) const
inline

Definition at line 769 of file ObjectMgr.h.

770  {
771  PetCreateSpellMap::const_iterator itr = mPetCreateSpell.find(id);
772  if (itr != mPetCreateSpell.end())
773  return &itr->second;
774  return NULL;
775  }
PetCreateSpellMap mPetCreateSpell
Definition: ObjectMgr.h:1241
PetLevelInfo const * ObjectMgr::GetPetLevelInfo ( uint32  creature_id,
uint32  level 
) const

Definition at line 2278 of file ObjectMgr.cpp.

References CONFIG_MAX_PLAYER_LEVEL, and sWorld.

2279 {
2280  if (level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
2281  level = sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL);
2282 
2283  PetLevelInfoMap::const_iterator itr = petInfo.find(creature_id);
2284  if (itr == petInfo.end())
2285  return NULL;
2286 
2287  return &itr->second[level - 1]; // data for level 1 stored in [0] array element, ...
2288 }
PetLevelInfoMap petInfo
Definition: ObjectMgr.h:1270
#define sWorld
Definition: World.h:860
Player* ObjectMgr::GetPlayer ( const char *  name,
bool  force = false 
) const
inline
Player* ObjectMgr::GetPlayer ( uint64  guid,
bool  force = false 
) const
inline

Definition at line 570 of file ObjectMgr.h.

References ObjectAccessor::FindPlayer().

571  {
572  return ObjectAccessor::FindPlayer(guid, force);
573  }
static Player * FindPlayer(uint64, bool force=false)
uint32 ObjectMgr::GetPlayerAccountIdByGUID ( const uint64 guid) const

Definition at line 1800 of file ObjectMgr.cpp.

References CharacterDatabase, GUID_LOPART, and Database::PQuery().

1801 {
1802  QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE guid = '%u'", GUID_LOPART(guid));
1803  if (result)
1804  {
1805  uint32 acc = (*result)[0].GetUInt32();
1806  return acc;
1807  }
1808 
1809  return 0;
1810 }
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
QueryResult_AutoPtr PQuery(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:400
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
ACE_UINT32 uint32
Definition: Define.h:71
uint32 ObjectMgr::GetPlayerAccountIdByPlayerName ( const std::string &  name) const

Definition at line 1812 of file ObjectMgr.cpp.

References CharacterDatabase, and Database::PQuery().

1813 {
1814  QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", name.c_str());
1815  if (result)
1816  {
1817  uint32 acc = (*result)[0].GetUInt32();
1818  return acc;
1819  }
1820 
1821  return 0;
1822 }
QueryResult_AutoPtr PQuery(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:400
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
ACE_UINT32 uint32
Definition: Define.h:71
PlayerClassInfo const* ObjectMgr::GetPlayerClassInfo ( uint32  class_) const
inline

Definition at line 660 of file ObjectMgr.h.

References MAX_CLASSES.

661  {
662  if (class_ >= MAX_CLASSES) return NULL;
663  return &playerClassInfo[class_];
664  }
PlayerClassInfo playerClassInfo[MAX_CLASSES]
Definition: ObjectMgr.h:1272
#define MAX_CLASSES
Definition: SharedDefines.h:91
void ObjectMgr::GetPlayerClassLevelInfo ( uint32  class_,
uint32  level,
PlayerClassLevelInfo info 
) const

Definition at line 2713 of file ObjectMgr.cpp.

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

2714 {
2715  if (level < 1 || class_ >= MAX_CLASSES)
2716  return;
2717 
2718  PlayerClassInfo const* pInfo = &playerClassInfo[class_];
2719 
2720  if (level > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
2721  level = sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL);
2722 
2723  *info = pInfo->levelInfo[level - 1];
2724 }
PlayerClassInfo playerClassInfo[MAX_CLASSES]
Definition: ObjectMgr.h:1272
#define MAX_CLASSES
Definition: SharedDefines.h:91
PlayerClassLevelInfo * levelInfo
Definition: Player.h:185
#define sWorld
Definition: World.h:860
uint64 ObjectMgr::GetPlayerGUIDByName ( std::string  name) const

Definition at line 1753 of file ObjectMgr.cpp.

References CharacterDatabase, Database::escape_string(), HIGHGUID_PLAYER, MAKE_NEW_GUID, and Database::PQuery().

1754 {
1755  uint64 guid = 0;
1756 
1758 
1759  // Player name safe to sending to DB (checked at login) and this function using
1760  QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT guid FROM characters WHERE name = '%s'", name.c_str());
1761  if (result)
1762  guid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
1763 
1764  return guid;
1765 }
QueryResult_AutoPtr PQuery(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:400
unsigned long escape_string(char *to, const char *from, unsigned long length)
Definition: Database.cpp:212
#define MAKE_NEW_GUID(l, e, h)
Definition: ObjectGuid.h:80
ACE_UINT64 uint64
Definition: Define.h:70
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
PlayerInfo const* ObjectMgr::GetPlayerInfo ( uint32  race,
uint32  class_ 
) const
inline

Definition at line 667 of file ObjectMgr.h.

References PlayerInfo::displayId_f, PlayerInfo::displayId_m, MAX_CLASSES, MAX_RACES, and GameTele::name.

668  {
669  if (race >= MAX_RACES) return NULL;
670  if (class_ >= MAX_CLASSES) return NULL;
671  PlayerInfo const* info = &playerInfo[race][class_];
672  if (info->displayId_m == 0 || info->displayId_f == 0) return NULL;
673  return info;
674  }
PlayerInfo playerInfo[MAX_RACES][MAX_CLASSES]
Definition: ObjectMgr.h:1275
uint16 displayId_m
Definition: Player.h:209
#define MAX_CLASSES
Definition: SharedDefines.h:91
#define MAX_RACES
Definition: SharedDefines.h:66
uint16 displayId_f
Definition: Player.h:210
void ObjectMgr::GetPlayerLevelInfo ( uint32  race,
uint32  class_,
uint32  level,
PlayerLevelInfo info 
) const

Definition at line 2726 of file ObjectMgr.cpp.

References CONFIG_MAX_PLAYER_LEVEL, PlayerInfo::displayId_f, PlayerInfo::displayId_m, PlayerInfo::levelInfo, MAX_CLASSES, MAX_RACES, and sWorld.

2727 {
2728  if (level < 1 || race >= MAX_RACES || class_ >= MAX_CLASSES)
2729  return;
2730 
2731  PlayerInfo const* pInfo = &playerInfo[race][class_];
2732  if (pInfo->displayId_m == 0 || pInfo->displayId_f == 0)
2733  return;
2734 
2735  if (level <= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
2736  *info = pInfo->levelInfo[level - 1];
2737  else
2738  BuildPlayerLevelInfo(race, class_, level, info);
2739 }
PlayerInfo playerInfo[MAX_RACES][MAX_CLASSES]
Definition: ObjectMgr.h:1275
PlayerLevelInfo * levelInfo
Definition: Player.h:215
uint16 displayId_m
Definition: Player.h:209
#define MAX_CLASSES
Definition: SharedDefines.h:91
void BuildPlayerLevelInfo(uint8 race, uint8 class_, uint8 level, PlayerLevelInfo *plinfo) const
Definition: ObjectMgr.cpp:2741
#define MAX_RACES
Definition: SharedDefines.h:66
#define sWorld
Definition: World.h:860
uint16 displayId_f
Definition: Player.h:210
bool ObjectMgr::GetPlayerNameByGUID ( const uint64 guid,
std::string &  name 
) const

Definition at line 1767 of file ObjectMgr.cpp.

References CharacterDatabase, GUID_LOPART, and Database::PQuery().

1768 {
1769  // prevent DB access for online player
1770  if (Player* player = GetPlayer(guid))
1771  {
1772  name = player->GetName();
1773  return true;
1774  }
1775 
1776  QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid = '%u'", GUID_LOPART(guid));
1777 
1778  if (result)
1779  {
1780  name = (*result)[0].GetCppString();
1781  return true;
1782  }
1783 
1784  return false;
1785 }
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
QueryResult_AutoPtr PQuery(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:400
Player * GetPlayer(const char *name, bool force=false) const
Definition: ObjectMgr.h:566
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
Definition: Player.h:923
uint32 ObjectMgr::GetPlayerTeamByGUID ( const uint64 guid) const

Definition at line 1787 of file ObjectMgr.cpp.

References CharacterDatabase, GUID_LOPART, Database::PQuery(), and Player::TeamForRace().

1788 {
1789  QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT race FROM characters WHERE guid = '%u'", GUID_LOPART(guid));
1790 
1791  if (result)
1792  {
1793  uint8 race = (*result)[0].GetUInt8();
1794  return Player::TeamForRace(race);
1795  }
1796 
1797  return 0;
1798 }
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
QueryResult_AutoPtr PQuery(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:400
ACE_UINT8 uint8
Definition: Define.h:73
static uint32 TeamForRace(uint8 race)
Definition: Player.cpp:5819
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
PointOfInterest const* ObjectMgr::GetPointOfInterest ( uint32  id) const
inline

Definition at line 777 of file ObjectMgr.h.

778  {
779  PointOfInterestMap::const_iterator itr = mPointsOfInterest.find(id);
780  if (itr != mPointsOfInterest.end())
781  return &itr->second;
782  return NULL;
783  }
PointOfInterestMap mPointsOfInterest
Definition: ObjectMgr.h:1237
PointOfInterestLocale const* ObjectMgr::GetPointOfInterestLocale ( uint32  poi_id) const
inline

Definition at line 1021 of file ObjectMgr.h.

1022  {
1023  PointOfInterestLocaleMap::const_iterator itr = mPointOfInterestLocaleMap.find(poi_id);
1024  if (itr == mPointOfInterestLocaleMap.end()) return NULL;
1025  return &itr->second;
1026  }
PointOfInterestLocaleMap mPointOfInterestLocaleMap
Definition: ObjectMgr.h:1302
uint32 ObjectMgr::GetQuestForAreaTrigger ( uint32  Trigger_ID) const
inline

Definition at line 697 of file ObjectMgr.h.

698  {
699  QuestAreaTriggerMap::const_iterator itr = mQuestAreaTriggerMap.find(Trigger_ID);
700  if (itr != mQuestAreaTriggerMap.end())
701  return itr->second;
702  return 0;
703  }
QuestAreaTriggerMap mQuestAreaTriggerMap
Definition: ObjectMgr.h:1223
QuestLocale const* ObjectMgr::GetQuestLocale ( uint32  entry) const
inline

Definition at line 997 of file ObjectMgr.h.

998  {
999  QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry);
1000  if (itr == mQuestLocaleMap.end()) return NULL;
1001  return &itr->second;
1002  }
QuestLocaleMap mQuestLocaleMap
Definition: ObjectMgr.h:1297
Quest const* ObjectMgr::GetQuestTemplate ( uint32  quest_id) const
inline

Definition at line 687 of file ObjectMgr.h.

688  {
689  QuestMap::const_iterator itr = mQuestTemplates.find(quest_id);
690  return itr != mQuestTemplates.end() ? itr->second : NULL;
691  }
QuestMap mQuestTemplates
Definition: ObjectMgr.h:1206
QuestMap const& ObjectMgr::GetQuestTemplates ( ) const
inline

Definition at line 692 of file ObjectMgr.h.

693  {
694  return mQuestTemplates;
695  }
QuestMap mQuestTemplates
Definition: ObjectMgr.h:1206
Player * ObjectMgr::GetRAFLinkedBuddyForPlayer ( const Player plr1) const

Definition at line 3065 of file ObjectMgr.cpp.

References ObjectAccessor::FindPlayerByAccountId(), WorldSession::GetAccountId(), Player::GetSession(), and Oregon::Singleton< ObjectAccessor, Oregon::ClassLevelLockable< ObjectAccessor, ACE_Thread_Mutex > >::Instance().

3066 {
3067  ReferFriendMap::const_iterator it = m_referrerFriends.find(plr1->GetSession()->GetAccountId());
3068  if (it == m_referrerFriends.end())
3069  {
3070  it = m_referredFriends.find(plr1->GetSession()->GetAccountId());
3071  if (it == m_referredFriends.end())
3072  return NULL;
3073  }
3074 
3075  return ObjectAccessor::Instance().FindPlayerByAccountId(it->second);
3076 }
ReferFriendMap m_referredFriends
Definition: ObjectMgr.h:1254
uint32 GetAccountId() const
Definition: WorldSession.h:100
Player * FindPlayerByAccountId(uint64 Id, bool force=false)
WorldSession * GetSession() const
Definition: Player.h:1947
ReferFriendMap m_referrerFriends
Definition: ObjectMgr.h:1253
RAFLinkStatus ObjectMgr::GetRAFLinkStatus ( uint64  account,
uint64 linked = NULL 
) const

Definition at line 2969 of file ObjectMgr.cpp.

References RAF_LINK_NONE, RAF_LINK_REFERRED, and RAF_LINK_REFERRER.

2970 {
2971  RAFLinkStatus status = RAF_LINK_NONE;
2972  ReferFriendMap::const_iterator i = m_referrerFriends.find(account);
2973 
2974  if (i != m_referrerFriends.end())
2975  status = RAF_LINK_REFERRER;
2976  else
2977  {
2978  i = m_referredFriends.find(account);
2979  if (i != m_referredFriends.end())
2980  status = RAF_LINK_REFERRED;
2981  }
2982 
2983  if (linked)
2984  *linked = (status == RAF_LINK_NONE) ? RAF_LINK_NONE : i->second;
2985 
2986  return status;
2987 }
ReferFriendMap m_referredFriends
Definition: ObjectMgr.h:1254
RAFLinkStatus
Definition: Player.h:803
ReferFriendMap m_referrerFriends
Definition: ObjectMgr.h:1253
RAFLinkStatus ObjectMgr::GetRAFLinkStatus ( const Player plr) const
inline

Definition at line 579 of file ObjectMgr.h.

References WorldSession::GetAccountId(), and Player::GetSession().

580  {
581  return GetRAFLinkStatus(plr->GetSession()->GetAccountId());
582  }
uint32 GetAccountId() const
Definition: WorldSession.h:100
RAFLinkStatus GetRAFLinkStatus(uint64 account, uint64 *linked=NULL) const
Definition: ObjectMgr.cpp:2969
WorldSession * GetSession() const
Definition: Player.h:1947
RAFLinkStatus ObjectMgr::GetRAFLinkStatus ( uint64  AccOne,
uint64  AccTwo 
) const

Definition at line 2989 of file ObjectMgr.cpp.

References RAF_LINK_NONE, RAF_LINK_REFERRED, and RAF_LINK_REFERRER.

2990 {
2991  ReferFriendMap::const_iterator i = m_referrerFriends.find(AccOne), j;
2992  if (i != m_referrerFriends.end())
2993  {
2994  j = m_referredFriends.find(AccTwo);
2995  if (j == m_referredFriends.end())
2996  return RAF_LINK_NONE;
2997 
2998  if (i->first == j->second &&
2999  i->second == j->first)
3000  return RAF_LINK_REFERRER;
3001 
3002  return RAF_LINK_NONE;
3003  }
3004 
3005  i = m_referredFriends.find(AccOne);
3006  if (i != m_referredFriends.end())
3007  {
3008  j = m_referrerFriends.find(AccTwo);
3009  if (j == m_referrerFriends.end())
3010  return RAF_LINK_NONE;
3011 
3012  if (i->first == j->second &&
3013  i->second == j->first)
3014  return RAF_LINK_REFERRED;
3015 
3016  // fall down
3017  }
3018 
3019  return RAF_LINK_NONE;
3020 }
ReferFriendMap m_referredFriends
Definition: ObjectMgr.h:1254
ReferFriendMap m_referrerFriends
Definition: ObjectMgr.h:1253
RAFLinkStatus ObjectMgr::GetRAFLinkStatus ( const Player plr1,
const Player plr2 
) const
inline

Definition at line 584 of file ObjectMgr.h.

References WorldSession::GetAccountId(), and Player::GetSession().

585  {
586  return GetRAFLinkStatus(plr1->GetSession()->GetAccountId(), plr2->GetSession()->GetAccountId());
587  }
uint32 GetAccountId() const
Definition: WorldSession.h:100
RAFLinkStatus GetRAFLinkStatus(uint64 account, uint64 *linked=NULL) const
Definition: ObjectMgr.cpp:2969
WorldSession * GetSession() const
Definition: Player.h:1947
RepSpilloverTemplate const* ObjectMgr::GetRepSpilloverTemplate ( uint32  factionId) const
inline

Definition at line 760 of file ObjectMgr.h.

761  {
762  RepSpilloverTemplateMap::const_iterator itr = m_RepSpilloverTemplateMap.find(factionId);
763  if (itr != m_RepSpilloverTemplateMap.end())
764  return &itr->second;
765 
766  return NULL;
767  }
RepSpilloverTemplateMap m_RepSpilloverTemplateMap
Definition: ObjectMgr.h:1233
ReputationOnKillEntry const* ObjectMgr::GetReputationOnKilEntry ( uint32  id) const
inline

Definition at line 752 of file ObjectMgr.h.

753  {
754  RepOnKillMap::const_iterator itr = mRepOnKill.find(id);
755  if (itr != mRepOnKill.end())
756  return &itr->second;
757  return NULL;
758  }
RepOnKillMap mRepOnKill
Definition: ObjectMgr.h:1232
uint32 ObjectMgr::GetScriptId ( const char *  name)

Definition at line 7657 of file ObjectMgr.cpp.

7658 {
7659  // use binary search to find the script name in the sorted vector
7660  // assume "" is the first element
7661  if (!name) return 0;
7662  ScriptNameMap::const_iterator itr =
7663  std::lower_bound(m_scriptNames.begin(), m_scriptNames.end(), name);
7664  if (itr == m_scriptNames.end() || *itr != name) return 0;
7665  return itr - m_scriptNames.begin();
7666 }
ScriptNameMap m_scriptNames
Definition: ObjectMgr.h:1251
const char* ObjectMgr::GetScriptName ( uint32  id)
inline

Definition at line 1154 of file ObjectMgr.h.

References GetScriptId().

1155  {
1156  return id < m_scriptNames.size() ? m_scriptNames[id].c_str() : "";
1157  }
ScriptNameMap m_scriptNames
Definition: ObjectMgr.h:1251
ScriptNameMap& ObjectMgr::GetScriptNames ( )
inline

Definition at line 1150 of file ObjectMgr.h.

1151  {
1152  return m_scriptNames;
1153  }
ScriptNameMap m_scriptNames
Definition: ObjectMgr.h:1251
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

Definition at line 939 of file ObjectMgr.h.

940  {
941  TempSummonDataContainer::const_iterator itr = _tempSummonDataStore.find(TempSummonGroupKey(summonerId, summonerType, group));
942  if (itr != _tempSummonDataStore.end())
943  return &itr->second;
944 
945  return NULL;
946  }
TempSummonDataContainer _tempSummonDataStore
Stores temp summon data grouped by summoner&#39;s entry, summoner&#39;s type and group id.
Definition: ObjectMgr.h:1314
Key for storing temp summon data in TempSummonDataContainer.
Definition: ObjectMgr.h:77
uint16 ObjectMgr::GetTaxiMount ( uint32  id,
uint32  team 
)

Definition at line 5075 of file ObjectMgr.cpp.

References ALLIANCE, TaxiNodesEntry::alliance_mount_type, GetCreatureTemplate(), CreatureInfo::GetRandomValidModelId(), TaxiNodesEntry::horde_mount_type, CreatureModelInfo::modelid_other_gender, sLog, sTaxiNodesStore, and urand().

5076 {
5077  uint16 mount_entry = 0;
5078  uint16 mount_id = 0;
5079 
5080  TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id);
5081  if (node)
5082  {
5083  if (team == ALLIANCE) mount_entry = node->alliance_mount_type;
5084  else mount_entry = node->horde_mount_type;
5085 
5086  CreatureInfo const* cinfo = GetCreatureTemplate(mount_entry);
5087  if (cinfo)
5088  {
5089  if (! (mount_id = cinfo->GetRandomValidModelId()))
5090  {
5091  sLog.outErrorDb("No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry);
5092  return false;
5093  }
5094  }
5095  }
5096 
5097  CreatureModelInfo const* minfo = GetCreatureModelInfo(mount_id);
5098  if (!minfo)
5099  {
5100  sLog.outErrorDb("Taxi mount (Entry: %u) for taxi node (Id: %u) for team %u has model %u not found in table creature_model_info, can't load. ",
5101  mount_entry, id, team, mount_id);
5102 
5103  return false;
5104  }
5105  if (minfo->modelid_other_gender != 0)
5106  mount_id = urand(0, 1) ? mount_id : minfo->modelid_other_gender;
5107 
5108  return mount_id;
5109 }
uint32 alliance_mount_type
Definition: DBCStructure.h:965
CreatureModelInfo const * GetCreatureModelInfo(uint32 modelid)
Definition: ObjectMgr.cpp:1061
#define sLog
Log class singleton.
Definition: Log.h:187
uint32 horde_mount_type
Definition: DBCStructure.h:964
static CreatureInfo const * GetCreatureTemplate(uint32 id)
Definition: ObjectMgr.cpp:439
uint32 GetRandomValidModelId() const
Definition: Creature.cpp:96
uint32 modelid_other_gender
Definition: Creature.h:323
ACE_UINT16 uint16
Definition: Define.h:72
DBCStorage< TaxiNodesEntry > sTaxiNodesStore(TaxiNodesEntryfmt)
uint32 urand(uint32 min, uint32 max)
Definition: Util.cpp:33
void ObjectMgr::GetTaxiPath ( uint32  source,
uint32  destination,
uint32 path,
uint32 cost 
)

Definition at line 5051 of file ObjectMgr.cpp.

References sTaxiPathSetBySource.

5052 {
5053  TaxiPathSetBySource::iterator src_i = sTaxiPathSetBySource.find(source);
5054  if (src_i == sTaxiPathSetBySource.end())
5055  {
5056  path = 0;
5057  cost = 0;
5058  return;
5059  }
5060 
5061  TaxiPathSetForSource& pathSet = src_i->second;
5062 
5063  TaxiPathSetForSource::iterator dest_i = pathSet.find(destination);
5064  if (dest_i == pathSet.end())
5065  {
5066  path = 0;
5067  cost = 0;
5068  return;
5069  }
5070 
5071  cost = dest_i->second.price;
5072  path = dest_i->second.ID;
5073 }
std::map< uint32, TaxiPathBySourceAndDestination > TaxiPathSetForSource
TaxiPathSetBySource sTaxiPathSetBySource
Definition: DBCStores.cpp:144
WeatherZoneChances const* ObjectMgr::GetWeatherChances ( uint32  zone_id) const
inline

Definition at line 948 of file ObjectMgr.h.

949  {
950  WeatherZoneMap::const_iterator itr = mWeatherZoneMap.find(zone_id);
951  if (itr != mWeatherZoneMap.end())
952  return &itr->second;
953  else
954  return NULL;
955  }
WeatherZoneMap mWeatherZoneMap
Definition: ObjectMgr.h:1239
bool ObjectMgr::IsGameObjectForQuests ( uint32  entry) const
inline

Definition at line 708 of file ObjectMgr.h.

709  {
710  return mGameObjectForQuestSet.count(entry) != 0;
711  }
GameObjectForQuestSet mGameObjectForQuestSet
Definition: ObjectMgr.h:1226
bool ObjectMgr::IsReservedName ( const std::string &  name) const
inline

Definition at line 1085 of file ObjectMgr.h.

1086  {
1087  return m_ReservedNames.find(name) != m_ReservedNames.end();
1088  }
ReservedNamesMap m_ReservedNames
Definition: ObjectMgr.h:1245
bool ObjectMgr::IsTavernAreaTrigger ( uint32  Trigger_ID) const
inline

Definition at line 704 of file ObjectMgr.h.

705  {
706  return mTavernAreaTriggerSet.count(Trigger_ID) != 0;
707  }
TavernAreaTriggerSet mTavernAreaTriggerSet
Definition: ObjectMgr.h:1225
bool ObjectMgr::IsValidCharterName ( const std::string &  name)
static

Definition at line 6731 of file ObjectMgr.cpp.

References CONFIG_STRICT_CHARTER_NAMES, isValidString(), sWorld, and Utf8toWStr().

Referenced by WorldSession::HandlePetitionBuyOpcode(), and WorldSession::HandlePetitionRenameOpcode().

6732 {
6733  std::wstring wname;
6734  if (!Utf8toWStr(name, wname))
6735  return false;
6736 
6737  if (wname.size() < 1)
6738  return false;
6739 
6740  uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_CHARTER_NAMES);
6741 
6742  return isValidString(wname, strictMask, true);
6743 }
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:255
bool isValidString(std::wstring wstr, uint32 strictMask, bool numericOrSpace, bool create=false)
Definition: ObjectMgr.cpp:6681
#define sWorld
Definition: World.h:860
ACE_UINT32 uint32
Definition: Define.h:71
bool ObjectMgr::IsValidName ( const std::string &  name,
bool  create = false 
)
static

Definition at line 6717 of file ObjectMgr.cpp.

References CONFIG_STRICT_PLAYER_NAMES, isValidString(), MAX_PLAYER_NAME, sWorld, and Utf8toWStr().

Referenced by WorldSession::HandleChangePlayerNameOpcode(), WorldSession::HandleCharCreateOpcode(), ChatHandler::HandleLoadPDumpCommand(), PlayerDumpReader::LoadDump(), and Player::LoadFromDB().

6718 {
6719  std::wstring wname;
6720  if (!Utf8toWStr(name, wname))
6721  return false;
6722 
6723  if (wname.size() < 1 || wname.size() > MAX_PLAYER_NAME)
6724  return false;
6725 
6726  uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_PLAYER_NAMES);
6727 
6728  return isValidString(wname, strictMask, false, create);
6729 }
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:255
bool isValidString(std::wstring wstr, uint32 strictMask, bool numericOrSpace, bool create=false)
Definition: ObjectMgr.cpp:6681
#define MAX_PLAYER_NAME
Definition: ObjectMgr.h:509
#define sWorld
Definition: World.h:860
ACE_UINT32 uint32
Definition: Define.h:71
bool ObjectMgr::IsValidPetName ( const std::string &  name)
static

Definition at line 6745 of file ObjectMgr.cpp.

References CONFIG_STRICT_PET_NAMES, isValidString(), sWorld, and Utf8toWStr().

Referenced by WorldSession::HandlePetRename().

6746 {
6747  std::wstring wname;
6748  if (!Utf8toWStr(name, wname))
6749  return false;
6750 
6751  if (wname.size() < 1)
6752  return false;
6753 
6754  uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_PET_NAMES);
6755 
6756  return isValidString(wname, strictMask, false);
6757 }
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:255
bool isValidString(std::wstring wstr, uint32 strictMask, bool numericOrSpace, bool create=false)
Definition: ObjectMgr.cpp:6681
#define sWorld
Definition: World.h:860
ACE_UINT32 uint32
Definition: Define.h:71
bool ObjectMgr::IsVendorItemValid ( uint32  vendor_entry,
uint32  item,
uint32  maxcount,
uint32  ptime,
uint32  ExtendedCost,
Player pl = NULL,
std::set< uint32 > *  skip_vendors = NULL,
uint32  ORnpcflag = 0 
) const

Definition at line 7528 of file ObjectMgr.cpp.

References VendorItemData::FindItem(), GetCreatureTemplate(), VendorItemData::GetItemCount(), LANG_COMMAND_ADDVENDORITEMITEMS, LANG_COMMAND_VENDORSELECTION, LANG_EXTENDED_COST_NOT_EXIST, LANG_ITEM_ALREADY_IN_LIST, LANG_ITEM_NOT_FOUND, MAX_VENDOR_ITEMS, CreatureInfo::npcflag, ChatHandler::PSendSysMessage(), ChatHandler::SendSysMessage(), sItemExtendedCostStore, sLog, and UNIT_NPC_FLAG_VENDOR.

7529 {
7530  CreatureInfo const* cInfo = GetCreatureTemplate(vendor_entry);
7531  if (!cInfo)
7532  {
7533  if (pl)
7535  else
7536  sLog.outErrorDb("Table (game_event_)npc_vendor has data for invalid creature template (Entry: %u), ignore", vendor_entry);
7537  return false;
7538  }
7539 
7540  if (!((cInfo->npcflag | ORnpcflag) & UNIT_NPC_FLAG_VENDOR))
7541  {
7542  if (!skip_vendors || skip_vendors->count(vendor_entry) == 0)
7543  {
7544  if (pl)
7546  else
7547  sLog.outErrorDb("Table (game_event_)npc_vendor has data for creature template (Entry: %u) without vendor flag, ignore", vendor_entry);
7548 
7549  if (skip_vendors)
7550  skip_vendors->insert(vendor_entry);
7551  }
7552  return false;
7553  }
7554 
7555  if (!GetItemTemplate(item_id))
7556  {
7557  if (pl)
7559  else
7560  sLog.outErrorDb("Table (game_event_)npc_vendor for Vendor (Entry: %u) has invalid item (%u) in item list, ignore", vendor_entry, item_id);
7561  return false;
7562  }
7563 
7564  if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
7565  {
7566  if (pl)
7568  else
7569  sLog.outErrorDb("Table (game_event_)npc_vendor has Item (Entry: %u) with invalid ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry);
7570  return false;
7571  }
7572 
7573  if (maxcount > 0 && incrtime == 0)
7574  {
7575  if (pl)
7576  ChatHandler(pl).PSendSysMessage("MaxCount != 0 (%u) but IncrTime == 0", maxcount);
7577  else
7578  sLog.outErrorDb("Table (game_event_)npc_vendor has maxcount (%u) for item %u of vendor (Entry: %u) but incrtime=0, ignore", maxcount, item_id, vendor_entry);
7579  return false;
7580  }
7581  else if (maxcount == 0 && incrtime > 0)
7582  {
7583  if (pl)
7584  ChatHandler(pl).PSendSysMessage("MaxCount == 0 but IncrTime<>=0");
7585  else
7586  sLog.outErrorDb("Table (game_event_)npc_vendor has maxcount=0 for item %u of vendor (Entry: %u) but incrtime<>0, ignore", item_id, vendor_entry);
7587  return false;
7588  }
7589 
7590  VendorItemData const* vItems = GetNpcVendorItemList(vendor_entry);
7591  if (!vItems)
7592  return true; // later checks for non-empty lists
7593 
7594  if (vItems->FindItem(item_id))
7595  {
7596  if (pl)
7598  else
7599  sLog.outErrorDb("Table (game_event_)npc_vendor has duplicate items %u for vendor (Entry: %u), ignore", item_id, vendor_entry);
7600  return false;
7601  }
7602 
7603  if (vItems->GetItemCount() >= MAX_VENDOR_ITEMS)
7604  {
7605  if (pl)
7607  else
7608  sLog.outErrorDb("Table npc_vendor has too many items (%u >= %i) for vendor (Entry: %u), ignore", vItems->GetItemCount(), MAX_VENDOR_ITEMS, vendor_entry);
7609  return false;
7610  }
7611 
7612  return true;
7613 }
uint32 npcflag
Definition: Creature.h:151
#define MAX_VENDOR_ITEMS
Definition: Creature.h:461
DBCStorage< ItemExtendedCostEntry > sItemExtendedCostStore(ItemExtendedCostEntryfmt)
#define sLog
Log class singleton.
Definition: Log.h:187
virtual void SendSysMessage(const char *str)
Definition: Chat.cpp:790
uint8 GetItemCount() const
Definition: Creature.h:379
static ItemTemplate const * GetItemTemplate(uint32 id)
Definition: ObjectMgr.h:648
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
Definition: Chat.cpp:858
static CreatureInfo const * GetCreatureTemplate(uint32 id)
Definition: ObjectMgr.cpp:439
VendorItemData const * GetNpcVendorItemList(uint32 entry) const
Definition: ObjectMgr.h:1137
VendorItem const * FindItem(uint32 item_id) const
Definition: Creature.cpp:88
void ObjectMgr::LinkIntoRAF ( uint64  AccReferrer,
uint64  AccReferred 
)

Definition at line 3030 of file ObjectMgr.cpp.

References Oregon::Singleton< ObjectAccessor, Oregon::ClassLevelLockable< ObjectAccessor, ACE_Thread_Mutex > >::Instance(), LoginDatabase, Database::PExecute(), UI64FMTD, and UPDATE_PLAYER.

3031 {
3032  m_referrerFriends[AccOne] = AccTwo;
3033  m_referredFriends[AccTwo] = AccOne;
3034  LoginDatabase.PExecute("REPLACE INTO account_referred (id1, id2) VALUES (" UI64FMTD ", " UI64FMTD ")", AccOne, AccTwo);
3035  UPDATE_PLAYER(ObjectAccessor::Instance().FindPlayerByAccountId(AccOne))
3036  UPDATE_PLAYER(ObjectAccessor::Instance().FindPlayerByAccountId(AccTwo))
3037 }
ReferFriendMap m_referredFriends
Definition: ObjectMgr.h:1254
#define UPDATE_PLAYER(plr)
Definition: ObjectMgr.cpp:3023
#define UI64FMTD
Definition: Common.h:149
DatabaseType LoginDatabase
Accessor to the realm/login database.
Definition: Main.cpp:55
bool PExecute(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:441
ReferFriendMap m_referrerFriends
Definition: ObjectMgr.h:1253
void ObjectMgr::LoadAccessRequirements ( )

Definition at line 5444 of file ObjectMgr.cpp.

References Field::GetCppString(), AccessRequirement::heroicKey, AccessRequirement::heroicKey2, AccessRequirement::heroicQuest, AccessRequirement::heroicQuestFailedText, AccessRequirement::item, AccessRequirement::item2, AccessRequirement::levelMax, AccessRequirement::levelMin, Database::Query(), AccessRequirement::quest, AccessRequirement::questFailedText, sLog, and WorldDatabase.

5445 {
5446  mAccessRequirements.clear(); // need for reload case
5447 
5448  uint32 count = 0;
5449 
5450  // 0 1 2 3 4 5 6 7 8 9 10
5451  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, level_min, level_max, item, item2, heroic_key, heroic_key2, quest_done, quest_failed_text, heroic_quest_done, heroic_quest_failed_text FROM access_requirement");
5452  if (!result)
5453  {
5454 
5455 
5456 
5457  sLog.outString(">> Loaded %u access requirement definitions", count);
5458  return;
5459  }
5460 
5461 
5462  do
5463  {
5464  Field* fields = result->Fetch();
5465 
5466 
5467  ++count;
5468 
5469  uint32 requiremt_ID = fields[0].GetUInt32();
5470 
5471  AccessRequirement ar;
5472 
5473  ar.levelMin = fields[1].GetUInt8();
5474  ar.levelMax = fields[2].GetUInt32();
5475  ar.item = fields[3].GetUInt32();
5476  ar.item2 = fields[4].GetUInt32();
5477  ar.heroicKey = fields[5].GetUInt32();
5478  ar.heroicKey2 = fields[6].GetUInt32();
5479  ar.quest = fields[7].GetUInt32();
5480  ar.questFailedText = fields[8].GetCppString();
5481  ar.heroicQuest = fields[9].GetUInt32();
5482  ar.heroicQuestFailedText = fields[10].GetCppString();
5483 
5484  if (ar.item)
5485  {
5486  ItemTemplate const* pProto = GetItemTemplate(ar.item);
5487  if (!pProto)
5488  {
5489  sLog.outError("Key item %u does not exist for requirement %u, removing key requirement.", ar.item, requiremt_ID);
5490  ar.item = 0;
5491  }
5492  }
5493 
5494  if (ar.item2)
5495  {
5496  ItemTemplate const* pProto = GetItemTemplate(ar.item2);
5497  if (!pProto)
5498  {
5499  sLog.outError("Second item %u does not exist for requirement %u, removing key requirement.", ar.item2, requiremt_ID);
5500  ar.item2 = 0;
5501  }
5502  }
5503 
5504  if (ar.heroicKey)
5505  {
5506  ItemTemplate const* pProto = GetItemTemplate(ar.heroicKey);
5507  if (!pProto)
5508  {
5509  sLog.outError("Heroic key %u not exist for trigger %u, remove key requirement.", ar.heroicKey, requiremt_ID);
5510  ar.heroicKey = 0;
5511  }
5512  }
5513 
5514  if (ar.heroicKey2)
5515  {
5516  ItemTemplate const* pProto = GetItemTemplate(ar.heroicKey2);
5517  if (!pProto)
5518  {
5519  sLog.outError("Second heroic key %u not exist for trigger %u, remove key requirement.", ar.heroicKey2, requiremt_ID);
5520  ar.heroicKey2 = 0;
5521  }
5522  }
5523 
5524  if (ar.heroicQuest)
5525  {
5526  if (!GetQuestTemplate(ar.heroicQuest))
5527  {
5528  sLog.outErrorDb("Required Heroic Quest %u does not exist for trigger %u, removed heroic quest requirement.", ar.heroicQuest, requiremt_ID);
5529  ar.heroicQuest = 0;
5530  }
5531  }
5532 
5533  if (ar.quest)
5534  {
5535  if (!GetQuestTemplate(ar.quest))
5536  {
5537  sLog.outErrorDb("Required Quest %u does not exist for trigger %u, removed quest requirement.", ar.quest, requiremt_ID);
5538  ar.quest = 0;
5539  }
5540  }
5541 
5542  mAccessRequirements[requiremt_ID] = ar;
5543 
5544  }
5545  while (result->NextRow());
5546 
5547  sLog.outString(">> Loaded %u access requirement definitions", count);
5548 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
Quest const * GetQuestTemplate(uint32 quest_id) const
Definition: ObjectMgr.h:687
Definition: Field.h:24
AccessRequirementMap mAccessRequirements
Definition: ObjectMgr.h:1230
#define sLog
Log class singleton.
Definition: Log.h:187
uint32 item2
Definition: Player.h:760
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
std::string questFailedText
Definition: Player.h:764
uint8 levelMin
Definition: Player.h:757
static ItemTemplate const * GetItemTemplate(uint32 id)
Definition: ObjectMgr.h:648
std::string heroicQuestFailedText
Definition: Player.h:766
uint8 levelMax
Definition: Player.h:758
std::string GetCppString() const
Definition: Field.h:52
uint32 quest
Definition: Player.h:763
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
uint32 heroicQuest
Definition: Player.h:765
ACE_UINT32 uint32
Definition: Define.h:71
uint32 heroicKey
Definition: Player.h:761
uint32 heroicKey2
Definition: Player.h:762
void ObjectMgr::LoadAreaTriggerScripts ( )

Definition at line 4982 of file ObjectMgr.cpp.

References GetScriptId(), Field::GetString(), Database::Query(), sAreaTriggerStore, sLog, and WorldDatabase.

4983 {
4984  mAreaTriggerScripts.clear(); // need for reload case
4985  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, ScriptName FROM areatrigger_scripts");
4986 
4987  uint32 count = 0;
4988 
4989  if (!result)
4990  {
4991 
4992  sLog.outString(">> Loaded %u areatrigger scripts", count);
4993  return;
4994  }
4995 
4996 
4997  do
4998  {
4999  ++count;
5000 
5001  Field* fields = result->Fetch();
5002 
5003  uint32 Trigger_ID = fields[0].GetUInt32();
5004  const char* scriptName = fields[1].GetString();
5005 
5006  AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
5007  if (!atEntry)
5008  {
5009  sLog.outErrorDb("Area trigger (ID:%u) does not exist in AreaTrigger.dbc.", Trigger_ID);
5010  continue;
5011  }
5012  mAreaTriggerScripts[Trigger_ID] = GetScriptId(scriptName);
5013  }
5014  while (result->NextRow());
5015 
5016  sLog.outString(">> Loaded %u areatrigger scripts", count);
5017 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
Definition: Field.h:24
uint32 GetScriptId(const char *name)
Definition: ObjectMgr.cpp:7657
#define sLog
Log class singleton.
Definition: Log.h:187
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerEntryfmt)
const char * GetString() const
Definition: Field.h:41
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
AreaTriggerScriptMap mAreaTriggerScripts
Definition: ObjectMgr.h:1229
ACE_UINT32 uint32
Definition: Define.h:71
void ObjectMgr::LoadAreaTriggerTeleports ( )

Definition at line 5387 of file ObjectMgr.cpp.

References AreaTrigger::access_id, Database::Query(), sAreaTriggerStore, sLog, sMapStore, AreaTrigger::target_mapId, AreaTrigger::target_Orientation, AreaTrigger::target_X, AreaTrigger::target_Y, AreaTrigger::target_Z, and WorldDatabase.

5388 {
5389  mAreaTriggers.clear(); // need for reload case
5390 
5391  uint32 count = 0;
5392 
5393  // 0 1 2 3 4 5 6
5394  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, access_id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
5395  if (!result)
5396  {
5397  sLog.outString(">> Loaded 0 area trigger teleport definitions.", count);
5398  return;
5399  }
5400 
5401 
5402  do
5403  {
5404  Field* fields = result->Fetch();
5405  uint32 Trigger_ID = fields[0].GetUInt32();
5406  AreaTrigger at;
5407  ++count;
5408 
5409  at.access_id = fields[1].GetUInt32();
5410  at.target_mapId = fields[2].GetUInt32();
5411  at.target_X = fields[3].GetFloat();
5412  at.target_Y = fields[4].GetFloat();
5413  at.target_Z = fields[5].GetFloat();
5414  at.target_Orientation = fields[6].GetFloat();
5415 
5416  AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
5417  if (!atEntry)
5418  {
5419  sLog.outErrorDb("Area trigger (ID:%u) does not exist in AreaTrigger.dbc.", Trigger_ID);
5420  continue;
5421  }
5422 
5423  MapEntry const* mapEntry = sMapStore.LookupEntry(at.target_mapId);
5424  if (!mapEntry)
5425  {
5426  sLog.outErrorDb("Area trigger (ID:%u) target map (ID: %u) does not exist in Map.dbc.", Trigger_ID, at.target_mapId);
5427  continue;
5428  }
5429 
5430  if (at.target_X == 0 && at.target_Y == 0 && at.target_Z == 0)
5431  {
5432  sLog.outErrorDb("Area trigger (ID:%u) target coordinates not provided.", Trigger_ID);
5433  continue;
5434  }
5435 
5436  mAreaTriggers[Trigger_ID] = at;
5437 
5438  }
5439  while (result->NextRow());
5440 
5441  sLog.outString(">> Loaded %u area trigger teleport definitions", count);
5442 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
Definition: Field.h:24
AreaTriggerMap mAreaTriggers
Definition: ObjectMgr.h:1228
#define sLog
Log class singleton.
Definition: Log.h:187
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerEntryfmt)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
uint32 target_mapId
Definition: ObjectMgr.h:344
float target_Orientation
Definition: ObjectMgr.h:348
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
float target_X
Definition: ObjectMgr.h:345
uint32 access_id
Definition: ObjectMgr.h:343
float target_Y
Definition: ObjectMgr.h:346
ACE_UINT32 uint32
Definition: Define.h:71
float target_Z
Definition: ObjectMgr.h:347
void ObjectMgr::LoadArenaTeams ( )

Definition at line 2884 of file ObjectMgr.cpp.

References CharacterDatabase, ArenaTeam::Disband(), ArenaTeam::LoadArenaTeamFromDB(), ArenaTeam::LoadMembersFromDB(), Database::Query(), and sLog.

2885 {
2886  uint32 count = 0;
2887 
2888  // 0 1 2 3 4 5
2889  QueryResult_AutoPtr result = CharacterDatabase.Query( "SELECT arena_team.arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle,"
2890  // 6 7 8 9 10 11 12 13 14
2891  "EmblemColor,BorderStyle,BorderColor, rating,games,wins,played,wins2,rank "
2892  "FROM arena_team LEFT JOIN arena_team_stats ON arena_team.arenateamid = arena_team_stats.arenateamid ORDER BY arena_team.arenateamid ASC" );
2893 
2894  if (!result)
2895  {
2896 
2897 
2898 
2899  sLog.outString(">> Loaded %u arenateam definitions", count);
2900  return;
2901  }
2902 
2903  // load arena_team members
2904  QueryResult_AutoPtr arenaTeamMembersResult = CharacterDatabase.Query(
2905  // 0 1 2 3 4 5 6 7 8
2906  "SELECT arenateamid,member.guid,played_week,wons_week,played_season,wons_season,personal_rating,name,class "
2907  "FROM arena_team_member member LEFT JOIN characters chars on member.guid = chars.guid ORDER BY member.arenateamid ASC");
2908 
2909 
2910  do
2911  {
2912  ++count;
2913 
2914  ArenaTeam* newArenaTeam = new ArenaTeam;
2915  if (!newArenaTeam->LoadArenaTeamFromDB(result) ||
2916  !newArenaTeam->LoadMembersFromDB(arenaTeamMembersResult))
2917  {
2918  newArenaTeam->Disband(NULL);
2919  delete newArenaTeam;
2920  continue;
2921  }
2922  AddArenaTeam(newArenaTeam);
2923  }
2924  while (result->NextRow());
2925 
2926  sLog.outString(">> Loaded %u arenateam definitions", count);
2927 }
void Disband(WorldSession *session)
Definition: ArenaTeam.cpp:307
#define sLog
Log class singleton.
Definition: Log.h:187
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
void AddArenaTeam(ArenaTeam *arenaTeam)
Definition: ObjectMgr.cpp:429
bool LoadArenaTeamFromDB(QueryResult_AutoPtr arenaTeamDataResult)
Definition: ArenaTeam.cpp:160
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
bool LoadMembersFromDB(QueryResult_AutoPtr arenaTeamMembersResult)
Definition: ArenaTeam.cpp:187
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
ACE_UINT32 uint32
Definition: Define.h:71
void ObjectMgr::LoadBattleMastersEntry ( )

Definition at line 6792 of file ObjectMgr.cpp.

References Database::Query(), sLog, and WorldDatabase.

6793 {
6794  mBattleMastersMap.clear(); // need for reload case
6795 
6796  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,bg_template FROM battlemaster_entry");
6797 
6798  uint32 count = 0;
6799 
6800  if (!result)
6801  {
6802 
6803  sLog.outString(">> Loaded 0 battlemaster entries - table is empty!");
6804  return;
6805  }
6806 
6807 
6808  do
6809  {
6810  ++count;
6811 
6812  Field* fields = result->Fetch();
6813 
6814  uint32 entry = fields[0].GetUInt32();
6815  uint32 bgTypeId = fields[1].GetUInt32();
6816 
6817  mBattleMastersMap[entry] = bgTypeId;
6818 
6819  }
6820  while (result->NextRow());
6821 
6822  sLog.outString(">> Loaded %u battlemaster entries", count);
6823 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
BattleMastersMap mBattleMastersMap
Definition: ObjectMgr.h:1224
Definition: Field.h:24
#define sLog
Log class singleton.
Definition: Log.h:187
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
ACE_UINT32 uint32
Definition: Define.h:71
void ObjectMgr::LoadCorpses ( )

Definition at line 6122 of file ObjectMgr.cpp.

References ObjectAccessor::AddCorpse(), CharacterDatabase, Oregon::Singleton< ObjectAccessor, Oregon::ClassLevelLockable< ObjectAccessor, ACE_Thread_Mutex > >::Instance(), Corpse::LoadCorpseFromDB(), MAX_CORPSE_TYPE, Database::Query(), sLog, and ScriptInfo::type.

6123 {
6124  uint32 count = 0;
6125  // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
6126  QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT position_x, position_y, position_z, orientation, map, displayId, itemCache, bytes1, bytes2, guild, flags, dynFlags, time, corpse_type, instance, guid, player, phaseMask FROM corpse WHERE corpse_type <> 0");
6127 
6128  if (!result)
6129  {
6130  sLog.outString(">> Loaded %u corpses", count);
6131  return;
6132  }
6133 
6134  do
6135  {
6136 
6137  Field* fields = result->Fetch();
6138  uint32 guid = fields[15].GetUInt32();
6139  CorpseType type = CorpseType(fields[13].GetUInt8());
6140  if (type >= MAX_CORPSE_TYPE)
6141  {
6142  sLog.outError("Corpse (guid: %u) have wrong corpse type (%u), not loading.", guid, type);
6143  continue;
6144  }
6145 
6146  Corpse* corpse = new Corpse(type);
6147  if (!corpse->LoadCorpseFromDB(guid, fields))
6148  {
6149  delete corpse;
6150  continue;
6151  }
6152 
6154 
6155  ++count;
6156  }
6157  while (result->NextRow());
6158 
6159  sLog.outString(">> Loaded %u corpses", count);
6160 }
Definition: Corpse.h:48
Definition: Field.h:24
#define sLog
Log class singleton.
Definition: Log.h:187
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
CorpseType
Definition: Corpse.h:26
void AddCorpse(Corpse *corpse)
#define MAX_CORPSE_TYPE
Definition: Corpse.h:32
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
ACE_UINT32 uint32
Definition: Define.h:71
bool LoadCorpseFromDB(uint32 guid, Field *fields)
Definition: Corpse.cpp:159
void ObjectMgr::LoadCreatureAddons ( )

Definition at line 874 of file ObjectMgr.cpp.

References CreatureDataAddon::emote, CreatureDataAddon::guidOrEntry, SQLStorage::Load(), SQLStorage::LookupEntry(), SQLStorage::MaxEntry, SQLStorage::RecordCount, sCreatureDataAddonStorage, sCreatureInfoAddonStorage, sCreatureStorage, sEmotesStore, sLog, VISDIST_MAX, and CreatureDataAddon::visibilityDistanceType.

875 {
877 
878  sLog.outString(">> Loaded %u creature template addons", sCreatureInfoAddonStorage.RecordCount);
879 
880  // check data correctness and convert 'auras'
881  for (uint32 i = 1; i < sCreatureInfoAddonStorage.MaxEntry; ++i)
882  {
884  if (!addon)
885  continue;
886 
887  if (!sEmotesStore.LookupEntry(addon->emote))
888  sLog.outErrorDb("Creature (Entry: %u) has invalid emote (%u) defined in creature_template_addon.",
889  addon->guidOrEntry, addon->emote);
890 
892  sLog.outErrorDb("Creature (Entry: %u) has invalid visibilityDistanceType (%u) defined in `creature_template_addon`.",
893  addon->guidOrEntry, addon->visibilityDistanceType);
894 
895  ConvertCreatureAddonAuras(const_cast<CreatureDataAddon*>(addon), "creature_template_addon", "Entry");
896 
898  sLog.outErrorDb("Creature (Entry: %u) does not exist but has a record in creature_template_addon", addon->guidOrEntry);
899  }
900 
902 
903  sLog.outString(">> Loaded %u creature addons", sCreatureDataAddonStorage.RecordCount);
904 
905  // check data correctness and convert 'auras'
906  for (uint32 i = 1; i < sCreatureDataAddonStorage.MaxEntry; ++i)
907  {
909  if (!addon)
910  continue;
911 
912  if (!sEmotesStore.LookupEntry(addon->emote))
913  sLog.outErrorDb("Creature (GUID: %u) has invalid emote (%u) defined in creature_addon.", addon->guidOrEntry, addon->emote);
914 
916  {
917  sLog.outErrorDb("Creature (GUID: %u) has invalid visibilityDistanceType (%u) defined in `creature_addon`.",
918  addon->guidOrEntry, addon->visibilityDistanceType);
919  }
920 
921  ConvertCreatureAddonAuras(const_cast<CreatureDataAddon*>(addon), "creature_addon", "GUIDLow");
922 
923  if (mCreatureDataMap.find(addon->guidOrEntry) == mCreatureDataMap.end())
924  sLog.outErrorDb("Creature (GUID: %u) does not exist but has a record in creature_addon", addon->guidOrEntry);
925  }
926 }
CreatureDataMap mCreatureDataMap
Definition: ObjectMgr.h:1291
SQLStorage sCreatureStorage
void ConvertCreatureAddonAuras(CreatureDataAddon *addon, char const *table, char const *guidEntryStr)
Definition: ObjectMgr.cpp:799
DBCStorage< EmotesEntry > sEmotesStore(EmotesEntryfmt)
Definition: