Don't use singleton to access static functions.

* This affects especially ObjectMgr functions:
   - GetCreatureInfo
   - GetGameObjectInfo
   - GetInstanceTemplate
   These are in fact static functions.
This commit is contained in:
XTZGZoReX 2009-11-08 03:33:06 +01:00
parent 34dab079c4
commit 1f23884757
40 changed files with 104 additions and 104 deletions

View file

@ -104,7 +104,7 @@ bool AchievementCriteriaRequirement::IsValid(AchievementCriteriaEntry const* cri
case ACHIEVEMENT_CRITERIA_REQUIRE_DISABLED: case ACHIEVEMENT_CRITERIA_REQUIRE_DISABLED:
return true; return true;
case ACHIEVEMENT_CRITERIA_REQUIRE_T_CREATURE: case ACHIEVEMENT_CRITERIA_REQUIRE_T_CREATURE:
if (!creature.id || !objmgr.GetCreatureTemplate(creature.id)) if (!creature.id || !ObjectMgr::GetCreatureTemplate(creature.id))
{ {
sLog.outErrorDb( "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_CREATURE (%u) have not existed creature id in value1 (%u), ignore.", sLog.outErrorDb( "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_CREATURE (%u) have not existed creature id in value1 (%u), ignore.",
criteria->ID, criteria->requiredType,requirementType,creature.id); criteria->ID, criteria->requiredType,requirementType,creature.id);
@ -1170,7 +1170,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
continue; continue;
if(miscvalue2 != achievementCriteria->roll_greed_on_loot.rollValue) if(miscvalue2 != achievementCriteria->roll_greed_on_loot.rollValue)
continue; continue;
ItemPrototype const *pProto = objmgr.GetItemPrototype( miscvalue1 ); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( miscvalue1 );
uint32 requiredItemLevel = 0; uint32 requiredItemLevel = 0;
if (achievementCriteria->ID == 2412 || achievementCriteria->ID == 2358) if (achievementCriteria->ID == 2412 || achievementCriteria->ID == 2358)
@ -2087,7 +2087,7 @@ void AchievementGlobalMgr::LoadRewards()
//check mail data before item for report including wrong item case //check mail data before item for report including wrong item case
if (reward.sender) if (reward.sender)
{ {
if (!objmgr.GetCreatureTemplate(reward.sender)) if (!ObjectMgr::GetCreatureTemplate(reward.sender))
{ {
sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender); sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender);
reward.sender = 0; reward.sender = 0;
@ -2107,7 +2107,7 @@ void AchievementGlobalMgr::LoadRewards()
if (reward.itemId) if (reward.itemId)
{ {
if (!objmgr.GetItemPrototype(reward.itemId)) if (!ObjectMgr::GetItemPrototype(reward.itemId))
{ {
sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will be without item.", entry, reward.itemId); sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will be without item.", entry, reward.itemId);
reward.itemId = 0; reward.itemId = 0;

View file

@ -88,7 +88,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data)
if(!normalizePlayerName(Invitedname)) if(!normalizePlayerName(Invitedname))
return; return;
player = ObjectAccessor::Instance().FindPlayerByName(Invitedname.c_str()); player = ObjectAccessor::FindPlayerByName(Invitedname.c_str());
} }
if(!player) if(!player)

View file

@ -230,7 +230,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() ); AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() );
//we have to take deposit : //we have to take deposit :
uint32 deposit = auctionmgr.GetAuctionDeposit( auctionHouseEntry, etime, it ); uint32 deposit = AuctionHouseMgr::GetAuctionDeposit( auctionHouseEntry, etime, it );
if ( pl->GetMoney() < deposit ) if ( pl->GetMoney() < deposit )
{ {
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_NOT_ENOUGHT_MONEY); SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_NOT_ENOUGHT_MONEY);

View file

@ -304,7 +304,7 @@ void AuctionHouseMgr::LoadAuctionItems()
uint32 item_guid = fields[1].GetUInt32(); uint32 item_guid = fields[1].GetUInt32();
uint32 item_template = fields[2].GetUInt32(); uint32 item_template = fields[2].GetUInt32();
ItemPrototype const *proto = objmgr.GetItemPrototype(item_template); ItemPrototype const *proto = ObjectMgr::GetItemPrototype(item_template);
if(!proto) if(!proto)
{ {
@ -397,7 +397,7 @@ void AuctionHouseMgr::LoadAuctions()
continue; continue;
} }
CreatureInfo const* auctioneerInfo = objmgr.GetCreatureTemplate(auctioneerData->id); CreatureInfo const* auctioneerInfo = ObjectMgr::GetCreatureTemplate(auctioneerData->id);
if(!auctioneerInfo) if(!auctioneerInfo)
{ {
aItem->DeleteFromDB(); aItem->DeleteFromDB();

View file

@ -60,7 +60,7 @@ void Bag::RemoveFromWorld()
bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner) bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
{ {
ItemPrototype const * itemProto = objmgr.GetItemPrototype(itemid); ItemPrototype const * itemProto = ObjectMgr::GetItemPrototype(itemid);
if(!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE) if(!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE)
return false; return false;

View file

@ -924,7 +924,7 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
if (!bmEntry) if (!bmEntry)
return; return;
ItemPrototype const* markProto = objmgr.GetItemPrototype(mark); ItemPrototype const* markProto = ObjectMgr::GetItemPrototype(mark);
if (!markProto) if (!markProto)
return; return;

View file

@ -1164,7 +1164,7 @@ valid examples:
// read item entry // read item entry
reader.getline(buffer, 256, ':'); reader.getline(buffer, 256, ':');
linkedItem= objmgr.GetItemPrototype(atoi(buffer)); linkedItem = ObjectMgr::GetItemPrototype(atoi(buffer));
if(!linkedItem) if(!linkedItem)
{ {
#ifdef MANGOS_DEBUG #ifdef MANGOS_DEBUG

View file

@ -181,7 +181,7 @@ void Creature::RemoveCorpse()
*/ */
bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
{ {
CreatureInfo const *normalInfo = objmgr.GetCreatureTemplate(Entry); CreatureInfo const *normalInfo = ObjectMgr::GetCreatureTemplate(Entry);
if(!normalInfo) if(!normalInfo)
{ {
sLog.outErrorDb("Creature::UpdateEntry creature entry %u does not exist.", Entry); sLog.outErrorDb("Creature::UpdateEntry creature entry %u does not exist.", Entry);
@ -199,7 +199,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
// we already have valid Map pointer for current creature! // we already have valid Map pointer for current creature!
if (GetMap()->GetSpawnMode() > diff) if (GetMap()->GetSpawnMode() > diff)
{ {
cinfo = objmgr.GetCreatureTemplate(normalInfo->DifficultyEntry[diff]); cinfo = ObjectMgr::GetCreatureTemplate(normalInfo->DifficultyEntry[diff]);
if (!cinfo) if (!cinfo)
{ {
// maybe check such things already at startup // maybe check such things already at startup
@ -1327,7 +1327,7 @@ float Creature::GetSpellDamageMod(int32 Rank)
bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 team, const CreatureData *data) bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 team, const CreatureData *data)
{ {
CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(Entry); CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(Entry);
if(!cinfo) if(!cinfo)
{ {
sLog.outErrorDb("Creature entry %u does not exist.", Entry); sLog.outErrorDb("Creature entry %u does not exist.", Entry);
@ -2235,7 +2235,7 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem)
if( vCount->lastIncrementTime + vItem->incrtime <= ptime ) if( vCount->lastIncrementTime + vItem->incrtime <= ptime )
{ {
ItemPrototype const* pProto = objmgr.GetItemPrototype(vItem->item); ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(vItem->item);
uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime); uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
if((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount ) if((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount )
@ -2274,7 +2274,7 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us
if( vCount->lastIncrementTime + vItem->incrtime <= ptime ) if( vCount->lastIncrementTime + vItem->incrtime <= ptime )
{ {
ItemPrototype const* pProto = objmgr.GetItemPrototype(vItem->item); ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(vItem->item);
uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime); uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
if((vCount->count + diff * pProto->BuyCount) < vItem->maxcount ) if((vCount->count + diff * pProto->BuyCount) < vItem->maxcount )

View file

@ -621,7 +621,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
{ {
objmgr.RemoveGameobjectFromGrid(*itr, data); objmgr.RemoveGameobjectFromGrid(*itr, data);
if( GameObject* pGameobject = ObjectAccessor::Instance().GetGameObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT)) ) if( GameObject* pGameobject = ObjectAccessor::GetGameObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT)) )
pGameobject->AddObjectToRemoveList(); pGameobject->AddObjectToRemoveList();
} }
} }
@ -688,7 +688,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate)
CreatureData const* data2 = objmgr.GetCreatureData(itr->first); CreatureData const* data2 = objmgr.GetCreatureData(itr->first);
if (data2 && activate) if (data2 && activate)
{ {
CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(data2->id); CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(data2->id);
uint32 display_id = objmgr.ChooseDisplayId(0,cinfo,data2); uint32 display_id = objmgr.ChooseDisplayId(0,cinfo,data2);
CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id);
if (minfo) if (minfo)

View file

@ -113,7 +113,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
return false; return false;
} }
GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(name_id); GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(name_id);
if (!goinfo) if (!goinfo)
{ {
sLog.outErrorDb("Gameobject (GUID: %u Entry: %u) not created: it have not exist entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f) ang: %f rotation0: %f rotation1: %f rotation2: %f rotation3: %f",guidlow, name_id, map->GetId(), x, y, z, ang, rotation0, rotation1, rotation2, rotation3); sLog.outErrorDb("Gameobject (GUID: %u Entry: %u) not created: it have not exist entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f) ang: %f rotation0: %f rotation1: %f rotation2: %f rotation3: %f",guidlow, name_id, map->GetId(), x, y, z, ang, rotation0, rotation1, rotation2, rotation3);

View file

@ -470,7 +470,7 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID
if ( !pQuest->RewChoiceItemId[i] ) continue; if ( !pQuest->RewChoiceItemId[i] ) continue;
data << uint32(pQuest->RewChoiceItemId[i]); data << uint32(pQuest->RewChoiceItemId[i]);
data << uint32(pQuest->RewChoiceItemCount[i]); data << uint32(pQuest->RewChoiceItemCount[i]);
IProto = objmgr.GetItemPrototype(pQuest->RewChoiceItemId[i]); IProto = ObjectMgr::GetItemPrototype(pQuest->RewChoiceItemId[i]);
if ( IProto ) if ( IProto )
data << uint32(IProto->DisplayInfoID); data << uint32(IProto->DisplayInfoID);
else else
@ -483,7 +483,7 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID
if ( !pQuest->RewItemId[i] ) continue; if ( !pQuest->RewItemId[i] ) continue;
data << uint32(pQuest->RewItemId[i]); data << uint32(pQuest->RewItemId[i]);
data << uint32(pQuest->RewItemCount[i]); data << uint32(pQuest->RewItemCount[i]);
IProto = objmgr.GetItemPrototype(pQuest->RewItemId[i]); IProto = ObjectMgr::GetItemPrototype(pQuest->RewItemId[i]);
if ( IProto ) if ( IProto )
data << uint32(IProto->DisplayInfoID); data << uint32(IProto->DisplayInfoID);
else else
@ -687,7 +687,7 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID,
data << uint32(pQuest->GetRewChoiceItemsCount()); data << uint32(pQuest->GetRewChoiceItemsCount());
for (uint32 i=0; i < pQuest->GetRewChoiceItemsCount(); ++i) for (uint32 i=0; i < pQuest->GetRewChoiceItemsCount(); ++i)
{ {
pItem = objmgr.GetItemPrototype( pQuest->RewChoiceItemId[i] ); pItem = ObjectMgr::GetItemPrototype( pQuest->RewChoiceItemId[i] );
data << uint32(pQuest->RewChoiceItemId[i]); data << uint32(pQuest->RewChoiceItemId[i]);
data << uint32(pQuest->RewChoiceItemCount[i]); data << uint32(pQuest->RewChoiceItemCount[i]);
@ -701,7 +701,7 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID,
data << uint32(pQuest->GetRewItemsCount()); data << uint32(pQuest->GetRewItemsCount());
for (uint16 i=0; i < pQuest->GetRewItemsCount(); ++i) for (uint16 i=0; i < pQuest->GetRewItemsCount(); ++i)
{ {
pItem = objmgr.GetItemPrototype(pQuest->RewItemId[i]); pItem = ObjectMgr::GetItemPrototype(pQuest->RewItemId[i]);
data << uint32(pQuest->RewItemId[i]); data << uint32(pQuest->RewItemId[i]);
data << uint32(pQuest->RewItemCount[i]); data << uint32(pQuest->RewItemCount[i]);
@ -781,7 +781,7 @@ void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID
{ {
if ( !pQuest->ReqItemId[i] ) if ( !pQuest->ReqItemId[i] )
continue; continue;
pItem = objmgr.GetItemPrototype(pQuest->ReqItemId[i]); pItem = ObjectMgr::GetItemPrototype(pQuest->ReqItemId[i]);
data << uint32(pQuest->ReqItemId[i]); data << uint32(pQuest->ReqItemId[i]);
data << uint32(pQuest->ReqItemCount[i]); data << uint32(pQuest->ReqItemCount[i]);

View file

@ -576,7 +576,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
for (i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot) for (i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot)
{ {
item = objmgr.GetItemPrototype(i->itemid); item = ObjectMgr::GetItemPrototype(i->itemid);
if (!item) if (!item)
{ {
//sLog.outDebug("Group::GroupLoot: missing item prototype for item with id: %d", i->itemid); //sLog.outDebug("Group::GroupLoot: missing item prototype for item with id: %d", i->itemid);
@ -630,7 +630,7 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea
uint8 itemSlot = 0; uint8 itemSlot = 0;
for(std::vector<LootItem>::iterator i=loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot) for(std::vector<LootItem>::iterator i=loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot)
{ {
item = objmgr.GetItemPrototype(i->itemid); item = ObjectMgr::GetItemPrototype(i->itemid);
//only roll for one-player items, not for ones everyone can get //only roll for one-player items, not for ones everyone can get
if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall) if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall)

View file

@ -1211,7 +1211,7 @@ void Guild::LoadGuildBankFromDB()
continue; continue;
} }
ItemPrototype const *proto = objmgr.GetItemPrototype(ItemEntry); ItemPrototype const *proto = ObjectMgr::GetItemPrototype(ItemEntry);
if (!proto) if (!proto)
{ {

View file

@ -73,7 +73,7 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
recvPacket >> Invitedname; recvPacket >> Invitedname;
if(normalizePlayerName(Invitedname)) if(normalizePlayerName(Invitedname))
player = ObjectAccessor::Instance().FindPlayerByName(Invitedname.c_str()); player = ObjectAccessor::FindPlayerByName(Invitedname.c_str());
if(!player) if(!player)
{ {

View file

@ -196,7 +196,7 @@ time_t InstanceSave::GetResetTimeForDB()
// to cache or not to cache, that is the question // to cache or not to cache, that is the question
InstanceTemplate const* InstanceSave::GetTemplate() InstanceTemplate const* InstanceSave::GetTemplate()
{ {
return objmgr.GetInstanceTemplate(m_mapid); return ObjectMgr::GetInstanceTemplate(m_mapid);
} }
MapEntry const* InstanceSave::GetMapEntry() MapEntry const* InstanceSave::GetMapEntry()
@ -431,7 +431,7 @@ void InstanceSaveManager::LoadResetTimes()
{ {
Field *fields = result->Fetch(); Field *fields = result->Fetch();
uint32 mapid = fields[0].GetUInt32(); uint32 mapid = fields[0].GetUInt32();
if(!objmgr.GetInstanceTemplate(mapid)) if(!ObjectMgr::GetInstanceTemplate(mapid))
{ {
sLog.outError("InstanceSaveManager::LoadResetTimes: invalid mapid %u in instance_reset!", mapid); sLog.outError("InstanceSaveManager::LoadResetTimes: invalid mapid %u in instance_reset!", mapid);
CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u'", mapid); CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u'", mapid);
@ -457,7 +457,7 @@ void InstanceSaveManager::LoadResetTimes()
// add the global reset times to the priority queue // add the global reset times to the priority queue
for(uint32 i = 0; i < sInstanceTemplate.MaxEntry; i++) for(uint32 i = 0; i < sInstanceTemplate.MaxEntry; i++)
{ {
InstanceTemplate const* temp = objmgr.GetInstanceTemplate(i); InstanceTemplate const* temp = ObjectMgr::GetInstanceTemplate(i);
if(!temp || temp->reset_delay == 0) if(!temp || temp->reset_delay == 0)
continue; continue;
@ -592,7 +592,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe
if(!warn) if(!warn)
{ {
// this is called one minute before the reset time // this is called one minute before the reset time
InstanceTemplate const* temp = objmgr.GetInstanceTemplate(mapid); InstanceTemplate const* temp = ObjectMgr::GetInstanceTemplate(mapid);
if(!temp || !temp->reset_delay) if(!temp || !temp->reset_delay)
{ {
sLog.outError("InstanceSaveManager::ResetOrWarnAll: no instance template or reset delay for map %d", mapid); sLog.outError("InstanceSaveManager::ResetOrWarnAll: no instance template or reset delay for map %d", mapid);

View file

@ -255,7 +255,7 @@ bool Item::Create( uint32 guidlow, uint32 itemid, Player const* owner)
SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0); SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0); SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
ItemPrototype const *itemProto = objmgr.GetItemPrototype(itemid); ItemPrototype const *itemProto = ObjectMgr::GetItemPrototype(itemid);
if(!itemProto) if(!itemProto)
return false; return false;
@ -441,7 +441,7 @@ void Item::DeleteFromInventoryDB()
ItemPrototype const *Item::GetProto() const ItemPrototype const *Item::GetProto() const
{ {
return objmgr.GetItemPrototype(GetEntry()); return ObjectMgr::GetItemPrototype(GetEntry());
} }
Player* Item::GetOwner()const Player* Item::GetOwner()const
@ -936,7 +936,7 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player )
if ( count < 1 ) if ( count < 1 )
return NULL; //don't create item at zero count return NULL; //don't create item at zero count
ItemPrototype const *pProto = objmgr.GetItemPrototype( item ); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( item );
if( pProto ) if( pProto )
{ {
if ( count > pProto->GetMaxStackSize()) if ( count > pProto->GetMaxStackSize())

View file

@ -124,7 +124,7 @@ uint32 GetItemEnchantMod(uint32 entry)
uint32 GenerateEnchSuffixFactor(uint32 item_id) uint32 GenerateEnchSuffixFactor(uint32 item_id)
{ {
ItemPrototype const *itemProto = objmgr.GetItemPrototype(item_id); ItemPrototype const *itemProto = ObjectMgr::GetItemPrototype(item_id);
if(!itemProto) if(!itemProto)
return 0; return 0;

View file

@ -285,7 +285,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
sLog.outDetail("STORAGE: Item Query = %u", item); sLog.outDetail("STORAGE: Item Query = %u", item);
ItemPrototype const *pProto = objmgr.GetItemPrototype( item ); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( item );
if( pProto ) if( pProto )
{ {
std::string Name = pProto->Name1; std::string Name = pProto->Name1;
@ -739,7 +739,7 @@ void WorldSession::SendListInventory( uint64 vendorguid )
{ {
if(VendorItem const* crItem = vItems->GetItem(i)) if(VendorItem const* crItem = vItems->GetItem(i))
{ {
if(ItemPrototype const *pProto = objmgr.GetItemPrototype(crItem->item)) if(ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(crItem->item))
{ {
if((pProto->AllowableClass & _player->getClassMask()) == 0 && pProto->Bonding == BIND_WHEN_PICKED_UP && !_player->isGameMaster()) if((pProto->AllowableClass & _player->getClassMask()) == 0 && pProto->Bonding == BIND_WHEN_PICKED_UP && !_player->isGameMaster())
continue; continue;
@ -971,7 +971,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
recv_data.read_skip<uint64>(); // guid recv_data.read_skip<uint64>(); // guid
sLog.outDebug("WORLD: CMSG_ITEM_NAME_QUERY %u", itemid); sLog.outDebug("WORLD: CMSG_ITEM_NAME_QUERY %u", itemid);
ItemPrototype const *pProto = objmgr.GetItemPrototype( itemid ); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( itemid );
if( pProto ) if( pProto )
{ {
std::string Name; std::string Name;

View file

@ -483,7 +483,7 @@ bool ChatHandler::HandleGameObjectTargetCommand(const char* args)
return false; return false;
} }
GameObjectInfo const* goI = objmgr.GetGameObjectInfo(id); GameObjectInfo const* goI = ObjectMgr::GetGameObjectInfo(id);
if (!goI) if (!goI)
{ {
@ -700,7 +700,7 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args)
char* spawntimeSecs = strtok(NULL, " "); char* spawntimeSecs = strtok(NULL, " ");
const GameObjectInfo *gInfo = objmgr.GetGameObjectInfo(id); const GameObjectInfo *gInfo = ObjectMgr::GetGameObjectInfo(id);
if (!gInfo) if (!gInfo)
{ {
@ -825,7 +825,7 @@ bool ChatHandler::HandleGameObjectNearCommand(const char* args)
float z = fields[4].GetFloat(); float z = fields[4].GetFloat();
int mapid = fields[5].GetUInt16(); int mapid = fields[5].GetUInt16();
GameObjectInfo const * gInfo = objmgr.GetGameObjectInfo(entry); GameObjectInfo const * gInfo = ObjectMgr::GetGameObjectInfo(entry);
if(!gInfo) if(!gInfo)
continue; continue;
@ -1142,7 +1142,7 @@ bool ChatHandler::HandleNpcAddVendorItemCommand(const char* args)
objmgr.AddVendorItem(vendor_entry,itemId,maxcount,incrtime,extendedcost); objmgr.AddVendorItem(vendor_entry,itemId,maxcount,incrtime,extendedcost);
ItemPrototype const* pProto = objmgr.GetItemPrototype(itemId); ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemId);
PSendSysMessage(LANG_ITEM_ADDED_TO_LIST,itemId,pProto->Name1,maxcount,incrtime,extendedcost); PSendSysMessage(LANG_ITEM_ADDED_TO_LIST,itemId,pProto->Name1,maxcount,incrtime,extendedcost);
return true; return true;
@ -1178,7 +1178,7 @@ bool ChatHandler::HandleNpcDelVendorItemCommand(const char* args)
return false; return false;
} }
ItemPrototype const* pProto = objmgr.GetItemPrototype(itemId); ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemId);
PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST,itemId,pProto->Name1); PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST,itemId,pProto->Name1);
return true; return true;

View file

@ -2098,7 +2098,7 @@ bool ChatHandler::HandleAddItemCommand(const char* args)
sLog.outDetail(GetMangosString(LANG_ADDITEM), itemId, count); sLog.outDetail(GetMangosString(LANG_ADDITEM), itemId, count);
ItemPrototype const *pProto = objmgr.GetItemPrototype(itemId); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemId);
if(!pProto) if(!pProto)
{ {
PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
@ -2237,7 +2237,7 @@ bool ChatHandler::HandleListItemCommand(const char* args)
return false; return false;
} }
ItemPrototype const* itemProto = objmgr.GetItemPrototype(item_id); ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_id);
if(!itemProto) if(!itemProto)
{ {
PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id); PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id);
@ -2462,7 +2462,7 @@ bool ChatHandler::HandleListObjectCommand(const char* args)
return false; return false;
} }
GameObjectInfo const * gInfo = objmgr.GetGameObjectInfo(go_id); GameObjectInfo const * gInfo = ObjectMgr::GetGameObjectInfo(go_id);
if(!gInfo) if(!gInfo)
{ {
PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id); PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id);
@ -2538,7 +2538,7 @@ bool ChatHandler::HandleListCreatureCommand(const char* args)
return false; return false;
} }
CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(cr_id); CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(cr_id);
if(!cInfo) if(!cInfo)
{ {
PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id); PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id);
@ -3836,7 +3836,7 @@ bool ChatHandler::HandleNpcAddWeaponCommand(const char* /*args*/)
uint32 ItemID = atoi(pItemID); uint32 ItemID = atoi(pItemID);
uint32 SlotID = atoi(pSlotID); uint32 SlotID = atoi(pSlotID);
ItemPrototype* tmpItem = objmgr.GetItemPrototype(ItemID); ItemPrototype* tmpItem = ObjectMgr::GetItemPrototype(ItemID);
bool added = false; bool added = false;
if(tmpItem) if(tmpItem)
@ -4834,7 +4834,7 @@ bool ChatHandler::HandleQuestComplete(const char* args)
} }
else if(creature > 0) else if(creature > 0)
{ {
if(CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(creature)) if(CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(creature))
for(uint16 z = 0; z < creaturecount; ++z) for(uint16 z = 0; z < creaturecount; ++z)
player->KilledMonster(cInfo,0); player->KilledMonster(cInfo,0);
} }
@ -6192,7 +6192,7 @@ bool ChatHandler::HandleSendItemsCommand(const char* args)
if(!item_id) if(!item_id)
return false; return false;
ItemPrototype const* item_proto = objmgr.GetItemPrototype(item_id); ItemPrototype const* item_proto = ObjectMgr::GetItemPrototype(item_id);
if(!item_proto) if(!item_proto)
{ {
PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id); PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id);

View file

@ -245,7 +245,7 @@ bool LootStoreItem::Roll(bool rate) const
if(mincountOrRef < 0) // reference case if(mincountOrRef < 0) // reference case
return roll_chance_f(chance* (rate ? sWorld.getRate(RATE_DROP_ITEM_REFERENCED) : 1.0f)); return roll_chance_f(chance* (rate ? sWorld.getRate(RATE_DROP_ITEM_REFERENCED) : 1.0f));
ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemid);
float qualityModifier = pProto && rate ? sWorld.getRate(qualityToRate[pProto->Quality]) : 1.0f; float qualityModifier = pProto && rate ? sWorld.getRate(qualityToRate[pProto->Quality]) : 1.0f;
@ -269,7 +269,7 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
if( mincountOrRef > 0 ) // item (quest or non-quest) entry, maybe grouped if( mincountOrRef > 0 ) // item (quest or non-quest) entry, maybe grouped
{ {
ItemPrototype const *proto = objmgr.GetItemPrototype(itemid); ItemPrototype const *proto = ObjectMgr::GetItemPrototype(itemid);
if(!proto) if(!proto)
{ {
sLog.outErrorDb("Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid); sLog.outErrorDb("Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid);
@ -319,7 +319,7 @@ LootItem::LootItem(LootStoreItem const& li)
itemid = li.itemid; itemid = li.itemid;
conditionId = li.conditionId; conditionId = li.conditionId;
ItemPrototype const* proto = objmgr.GetItemPrototype(itemid); ItemPrototype const* proto = ObjectMgr::GetItemPrototype(itemid);
freeforall = proto && (proto->Flags & ITEM_FLAGS_PARTY_LOOT); freeforall = proto && (proto->Flags & ITEM_FLAGS_PARTY_LOOT);
needs_quest = li.needs_quest; needs_quest = li.needs_quest;
@ -349,7 +349,7 @@ bool LootItem::AllowedForPlayer(Player const * player) const
else else
{ {
// Not quest only drop (check quest starting items for already accepted non-repeatable quests) // Not quest only drop (check quest starting items for already accepted non-repeatable quests)
ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemid);
if (pProto && pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE && !player->HasQuestForItem(itemid)) if (pProto && pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE && !player->HasQuestForItem(itemid))
return false; return false;
} }
@ -378,7 +378,7 @@ void Loot::AddItem(LootStoreItem const & item)
// non-ffa conditionals are counted in FillNonQuestNonFFAConditionalLoot() // non-ffa conditionals are counted in FillNonQuestNonFFAConditionalLoot()
if( !item.conditionId ) if( !item.conditionId )
{ {
ItemPrototype const* proto = objmgr.GetItemPrototype(item.itemid); ItemPrototype const* proto = ObjectMgr::GetItemPrototype(item.itemid);
if( !proto || (proto->Flags & ITEM_FLAGS_PARTY_LOOT)==0 ) if( !proto || (proto->Flags & ITEM_FLAGS_PARTY_LOOT)==0 )
++unlootedCount; ++unlootedCount;
} }
@ -676,7 +676,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootItem const& li)
{ {
b << uint32(li.itemid); b << uint32(li.itemid);
b << uint32(li.count); // nr of items of this type b << uint32(li.count); // nr of items of this type
b << uint32(objmgr.GetItemPrototype(li.itemid)->DisplayInfoID); b << uint32(ObjectMgr::GetItemPrototype(li.itemid)->DisplayInfoID);
b << uint32(li.randomSuffix); b << uint32(li.randomSuffix);
b << uint32(li.randomPropertyId); b << uint32(li.randomPropertyId);
//b << uint8(0); // slot type - will send after this function call //b << uint8(0); // slot type - will send after this function call

View file

@ -223,7 +223,7 @@ Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _par
void Map::InitVisibilityDistance() void Map::InitVisibilityDistance()
{ {
//init visibility for continents //init visibility for continents
m_VisibleDistance = sWorld.GetMaxVisibleDistanceOnContinents(); m_VisibleDistance = World::GetMaxVisibleDistanceOnContinents();
} }
// Template specialization of utility methods // Template specialization of utility methods
@ -2306,7 +2306,7 @@ InstanceMap::~InstanceMap()
void InstanceMap::InitVisibilityDistance() void InstanceMap::InitVisibilityDistance()
{ {
//init visibility distance for instances //init visibility distance for instances
m_VisibleDistance = sWorld.GetMaxVisibleDistanceInInstances(); m_VisibleDistance = World::GetMaxVisibleDistanceInInstances();
} }
/* /*
@ -2473,7 +2473,7 @@ void InstanceMap::CreateInstanceData(bool load)
if(i_data != NULL) if(i_data != NULL)
return; return;
InstanceTemplate const* mInstance = objmgr.GetInstanceTemplate(GetId()); InstanceTemplate const* mInstance = ObjectMgr::GetInstanceTemplate(GetId());
if (mInstance) if (mInstance)
{ {
i_script_id = mInstance->script_id; i_script_id = mInstance->script_id;
@ -2620,7 +2620,7 @@ void InstanceMap::SetResetSchedule(bool on)
uint32 InstanceMap::GetMaxPlayers() const uint32 InstanceMap::GetMaxPlayers() const
{ {
InstanceTemplate const* iTemplate = objmgr.GetInstanceTemplate(GetId()); InstanceTemplate const* iTemplate = ObjectMgr::GetInstanceTemplate(GetId());
if(!iTemplate) if(!iTemplate)
return 0; return 0;
return IsHeroic() ? iTemplate->maxPlayersHeroic : iTemplate->maxPlayers; return IsHeroic() ? iTemplate->maxPlayersHeroic : iTemplate->maxPlayers;
@ -2642,7 +2642,7 @@ BattleGroundMap::~BattleGroundMap()
void BattleGroundMap::InitVisibilityDistance() void BattleGroundMap::InitVisibilityDistance()
{ {
//init visibility distance for BG/Arenas //init visibility distance for BG/Arenas
m_VisibleDistance = sWorld.GetMaxVisibleDistanceInBGArenas(); m_VisibleDistance = World::GetMaxVisibleDistanceInBGArenas();
} }
bool BattleGroundMap::CanEnter(Player * player) bool BattleGroundMap::CanEnter(Player * player)

View file

@ -187,7 +187,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save,
sLog.outError("CreateInstance: no entry for map %d", GetId()); sLog.outError("CreateInstance: no entry for map %d", GetId());
assert(false); assert(false);
} }
if (!objmgr.GetInstanceTemplate(GetId())) if (!ObjectMgr::GetInstanceTemplate(GetId()))
{ {
sLog.outError("CreateInstance: no instance template for map %d", GetId()); sLog.outError("CreateInstance: no instance template for map %d", GetId());
assert(false); assert(false);

View file

@ -205,7 +205,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
if(instance_map==mapid) if(instance_map==mapid)
break; break;
InstanceTemplate const* instance = objmgr.GetInstanceTemplate(instance_map); InstanceTemplate const* instance = ObjectMgr::GetInstanceTemplate(instance_map);
instance_map = instance ? instance->parent : 0; instance_map = instance ? instance->parent : 0;
} }
while (instance_map); while (instance_map);
@ -292,7 +292,7 @@ bool MapManager::ExistMapAndVMap(uint32 mapid, float x,float y)
bool MapManager::IsValidMAP(uint32 mapid) bool MapManager::IsValidMAP(uint32 mapid)
{ {
MapEntry const* mEntry = sMapStore.LookupEntry(mapid); MapEntry const* mEntry = sMapStore.LookupEntry(mapid);
return mEntry && (!mEntry->IsDungeon() || objmgr.GetInstanceTemplate(mapid)); return mEntry && (!mEntry->IsDungeon() || ObjectMgr::GetInstanceTemplate(mapid));
// TODO: add check for battleground template // TODO: add check for battleground template
} }

View file

@ -845,7 +845,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
{ {
// TODO: all this is probably wrong // TODO: all this is probably wrong
if(missingItem) if(missingItem)
SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, objmgr.GetItemPrototype(missingItem)->Name1); SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, ObjectMgr::GetItemPrototype(missingItem)->Name1);
else if(missingKey) else if(missingKey)
GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, isNormalTargetMap ? DUNGEON_DIFFICULTY_NORMAL : DUNGEON_DIFFICULTY_HEROIC); GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, isNormalTargetMap ? DUNGEON_DIFFICULTY_NORMAL : DUNGEON_DIFFICULTY_HEROIC);
else if(missingQuest) else if(missingQuest)

View file

@ -56,7 +56,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
// get the destination map entry, not the current one, this will fix homebind and reset greeting // get the destination map entry, not the current one, this will fix homebind and reset greeting
MapEntry const* mEntry = sMapStore.LookupEntry(loc.mapid); MapEntry const* mEntry = sMapStore.LookupEntry(loc.mapid);
InstanceTemplate const* mInstance = objmgr.GetInstanceTemplate(loc.mapid); InstanceTemplate const* mInstance = ObjectMgr::GetInstanceTemplate(loc.mapid);
// reset instance validity, except if going to an instance inside an instance // reset instance validity, except if going to an instance inside an instance
if(GetPlayer()->m_InstanceValid == false && !mInstance) if(GetPlayer()->m_InstanceValid == false && !mInstance)

View file

@ -633,7 +633,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
return; return;
} }
CreatureInfo const* creatureInfo = objmgr.GetCreatureTemplate(creature_id); CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(creature_id);
if(!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets())) if(!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
{ {
WorldPacket data(SMSG_STABLE_RESULT, 1); WorldPacket data(SMSG_STABLE_RESULT, 1);
@ -760,7 +760,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
return; return;
} }
CreatureInfo const* creatureInfo = objmgr.GetCreatureTemplate(creature_id); CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(creature_id);
if(!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets())) if(!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
{ {
WorldPacket data(SMSG_STABLE_RESULT, 1); WorldPacket data(SMSG_STABLE_RESULT, 1);

View file

@ -7279,7 +7279,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
} }
case CONDITION_ITEM: case CONDITION_ITEM:
{ {
ItemPrototype const *proto = objmgr.GetItemPrototype(value1); ItemPrototype const *proto = ObjectMgr::GetItemPrototype(value1);
if(!proto) if(!proto)
{ {
sLog.outErrorDb("Item condition requires to have non existing item (%u), skipped", value1); sLog.outErrorDb("Item condition requires to have non existing item (%u), skipped", value1);
@ -7289,7 +7289,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
} }
case CONDITION_ITEM_EQUIPPED: case CONDITION_ITEM_EQUIPPED:
{ {
ItemPrototype const *proto = objmgr.GetItemPrototype(value1); ItemPrototype const *proto = ObjectMgr::GetItemPrototype(value1);
if(!proto) if(!proto)
{ {
sLog.outErrorDb("ItemEquipped condition requires to have non existing item (%u) equipped, skipped", value1); sLog.outErrorDb("ItemEquipped condition requires to have non existing item (%u) equipped, skipped", value1);

View file

@ -339,7 +339,7 @@ class ObjectMgr
typedef std::vector<std::string> ScriptNameMap; typedef std::vector<std::string> ScriptNameMap;
Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);} Player* GetPlayer(const char* name) const { return ObjectAccessor::FindPlayerByName(name);}
Player* GetPlayer(uint64 guid) const { return ObjectAccessor::FindPlayer(guid); } Player* GetPlayer(uint64 guid) const { return ObjectAccessor::FindPlayer(guid); }
static GameObjectInfo const *GetGameObjectInfo(uint32 id) { return sGOStorage.LookupEntry<GameObjectInfo>(id); } static GameObjectInfo const *GetGameObjectInfo(uint32 id) { return sGOStorage.LookupEntry<GameObjectInfo>(id); }

View file

@ -138,7 +138,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
PetType pet_type = PetType(fields[18].GetUInt8()); PetType pet_type = PetType(fields[18].GetUInt8());
if(pet_type==HUNTER_PET) if(pet_type==HUNTER_PET)
{ {
CreatureInfo const* creatureInfo = objmgr.GetCreatureTemplate(petentry); CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(petentry);
if(!creatureInfo || !creatureInfo->isTameable(owner->CanTameExoticPets())) if(!creatureInfo || !creatureInfo->isTameable(owner->CanTameExoticPets()))
{ {
delete result; delete result;

View file

@ -170,7 +170,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
} }
} }
ItemPrototype const *pProto = objmgr.GetItemPrototype(charterid); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(charterid);
if(!pProto) if(!pProto)
{ {
_player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, charterid, 0); _player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, charterid, 0);

View file

@ -678,7 +678,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
if(item_id==40582) if(item_id==40582)
continue; continue;
ItemPrototype const* iProto = objmgr.GetItemPrototype(item_id); ItemPrototype const* iProto = ObjectMgr::GetItemPrototype(item_id);
if(!iProto) if(!iProto)
{ {
sLog.outErrorDb("Initial item id %u (race %u class %u) from CharStartOutfit.dbc not listed in `item_template`, ignoring.",item_id,getRace(),getClass()); sLog.outErrorDb("Initial item id %u (race %u class %u) from CharStartOutfit.dbc not listed in `item_template`, ignoring.",item_id,getRace(),getClass());
@ -1498,7 +1498,7 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
{ {
uint32 visualbase = PLAYER_VISIBLE_ITEM_1_ENTRYID + (slot * 2); uint32 visualbase = PLAYER_VISIBLE_ITEM_1_ENTRYID + (slot * 2);
uint32 item_id = GetUInt32ValueFromArray(data, visualbase); uint32 item_id = GetUInt32ValueFromArray(data, visualbase);
const ItemPrototype * proto = objmgr.GetItemPrototype(item_id); const ItemPrototype * proto = ObjectMgr::GetItemPrototype(item_id);
if(!proto) if(!proto)
{ {
*p_data << uint32(0); *p_data << uint32(0);
@ -3963,7 +3963,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
uint32 item_guidlow = fields2[1].GetUInt32(); uint32 item_guidlow = fields2[1].GetUInt32();
uint32 item_template = fields2[2].GetUInt32(); uint32 item_template = fields2[2].GetUInt32();
ItemPrototype const* itemProto = objmgr.GetItemPrototype(item_template); ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_template);
if(!itemProto) if(!itemProto)
{ {
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", item_guidlow); CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", item_guidlow);
@ -5575,7 +5575,7 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type)
} }
break; break;
case ACTION_BUTTON_ITEM: case ACTION_BUTTON_ITEM:
if(!objmgr.GetItemPrototype(action)) if(!ObjectMgr::GetItemPrototype(action))
{ {
sLog.outError( "Action %u not added into button %u for player %s: item not exist", action, button, GetName() ); sLog.outError( "Action %u not added into button %u for player %s: item not exist", action, button, GetName() );
return NULL; return NULL;
@ -7278,7 +7278,7 @@ void Player::_ApplyAmmoBonuses()
float currentAmmoDPS; float currentAmmoDPS;
ItemPrototype const *ammo_proto = objmgr.GetItemPrototype( ammo_id ); ItemPrototype const *ammo_proto = ObjectMgr::GetItemPrototype( ammo_id );
if( !ammo_proto || ammo_proto->Class!=ITEM_CLASS_PROJECTILE || !CheckAmmoCompatibility(ammo_proto)) if( !ammo_proto || ammo_proto->Class!=ITEM_CLASS_PROJECTILE || !CheckAmmoCompatibility(ammo_proto))
currentAmmoDPS = 0.0f; currentAmmoDPS = 0.0f;
else else
@ -8751,7 +8751,7 @@ bool Player::HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except
} }
} }
ItemPrototype const *pProto = objmgr.GetItemPrototype(item); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(item);
if (pProto && pProto->GemProperties) if (pProto && pProto->GemProperties)
{ {
for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
@ -8808,7 +8808,7 @@ bool Player::HasItemOrGemWithLimitCategoryEquipped( uint32 limitCategory, uint32
uint8 Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count ) const uint8 Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count ) const
{ {
ItemPrototype const *pProto = objmgr.GetItemPrototype(entry); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(entry);
if( !pProto ) if( !pProto )
{ {
if(no_space_count) if(no_space_count)
@ -9072,7 +9072,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
{ {
sLog.outDebug( "STORAGE: CanStoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, entry, count); sLog.outDebug( "STORAGE: CanStoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, entry, count);
ItemPrototype const *pProto = objmgr.GetItemPrototype(entry); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(entry);
if (!pProto) if (!pProto)
{ {
if (no_space_count) if (no_space_count)
@ -10218,7 +10218,7 @@ uint8 Player::CanUseAmmo( uint32 item ) const
return EQUIP_ERR_YOU_ARE_DEAD; return EQUIP_ERR_YOU_ARE_DEAD;
//if( isStunned() ) //if( isStunned() )
// return EQUIP_ERR_YOU_ARE_STUNNED; // return EQUIP_ERR_YOU_ARE_STUNNED;
ItemPrototype const *pProto = objmgr.GetItemPrototype( item ); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( item );
if( pProto ) if( pProto )
{ {
if( pProto->InventoryType!= INVTYPE_AMMO ) if( pProto->InventoryType!= INVTYPE_AMMO )
@ -13728,7 +13728,7 @@ bool Player::HasQuestForItem( uint32 itemid ) const
// examined item is a source item // examined item is a source item
if (qinfo->ReqSourceId[j] == itemid) if (qinfo->ReqSourceId[j] == itemid)
{ {
ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemid);
// 'unique' item // 'unique' item
if (pProto->MaxCount && GetItemCount(itemid,true) < pProto->MaxCount) if (pProto->MaxCount && GetItemCount(itemid,true) < pProto->MaxCount)
@ -14227,7 +14227,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
if(currentBg && currentBg->IsPlayerInBattleGround(GetGUID())) if(currentBg && currentBg->IsPlayerInBattleGround(GetGUID()))
{ {
BattleGroundQueueTypeId bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType()); BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType());
AddBattleGroundQueueId(bgQueueTypeId); AddBattleGroundQueueId(bgQueueTypeId);
m_bgData.bgTypeID = currentBg->GetTypeID(); m_bgData.bgTypeID = currentBg->GetTypeID();
@ -14849,7 +14849,7 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff)
uint32 item_guid = fields[3].GetUInt32(); uint32 item_guid = fields[3].GetUInt32();
uint32 item_id = fields[4].GetUInt32(); uint32 item_id = fields[4].GetUInt32();
ItemPrototype const * proto = objmgr.GetItemPrototype(item_id); ItemPrototype const * proto = ObjectMgr::GetItemPrototype(item_id);
if(!proto) if(!proto)
{ {
@ -14992,7 +14992,7 @@ void Player::_LoadMailedItems(Mail *mail)
mail->AddItem(item_guid_low, item_template); mail->AddItem(item_guid_low, item_template);
ItemPrototype const *proto = objmgr.GetItemPrototype(item_template); ItemPrototype const *proto = ObjectMgr::GetItemPrototype(item_template);
if(!proto) if(!proto)
{ {
@ -17283,7 +17283,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint
if (!isAlive()) if (!isAlive())
return false; return false;
ItemPrototype const *pProto = objmgr.GetItemPrototype( item ); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( item );
if (!pProto) if (!pProto)
{ {
SendBuyError( BUY_ERR_CANT_FIND_ITEM, NULL, item, 0); SendBuyError( BUY_ERR_CANT_FIND_ITEM, NULL, item, 0);
@ -19916,7 +19916,7 @@ uint8 Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limit_count) c
if(!enchantEntry) if(!enchantEntry)
continue; continue;
ItemPrototype const* pGem = objmgr.GetItemPrototype(enchantEntry->GemID); ItemPrototype const* pGem = ObjectMgr::GetItemPrototype(enchantEntry->GemID);
if(!pGem) if(!pGem)
continue; continue;

View file

@ -495,7 +495,7 @@ void PoolHandler::LoadFromDB()
sLog.outErrorDb("`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id ); sLog.outErrorDb("`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id );
continue; continue;
} }
GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(data->id); GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(data->id);
if (goinfo->type != GAMEOBJECT_TYPE_CHEST && if (goinfo->type != GAMEOBJECT_TYPE_CHEST &&
goinfo->type != GAMEOBJECT_TYPE_GOOBER && goinfo->type != GAMEOBJECT_TYPE_GOOBER &&
goinfo->type != GAMEOBJECT_TYPE_FISHINGHOLE) goinfo->type != GAMEOBJECT_TYPE_FISHINGHOLE)

View file

@ -153,7 +153,7 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data )
uint64 guid; uint64 guid;
recv_data >> guid; recv_data >> guid;
CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry); CreatureInfo const *ci = ObjectMgr::GetCreatureTemplate(entry);
if (ci) if (ci)
{ {
@ -219,7 +219,7 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data )
uint64 guid; uint64 guid;
recv_data >> guid; recv_data >> guid;
const GameObjectInfo *info = objmgr.GetGameObjectInfo(entryID); const GameObjectInfo *info = ObjectMgr::GetGameObjectInfo(entryID);
if(info) if(info)
{ {
std::string Name; std::string Name;

View file

@ -3192,7 +3192,7 @@ void Spell::WriteAmmoToPacket( WorldPacket * data )
uint32 ammoID = ((Player*)m_caster)->GetUInt32Value(PLAYER_AMMO_ID); uint32 ammoID = ((Player*)m_caster)->GetUInt32Value(PLAYER_AMMO_ID);
if(ammoID) if(ammoID)
{ {
ItemPrototype const *pProto = objmgr.GetItemPrototype( ammoID ); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( ammoID );
if(pProto) if(pProto)
{ {
ammoDisplayID = pProto->DisplayInfoID; ammoDisplayID = pProto->DisplayInfoID;
@ -5539,7 +5539,7 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_NO_AMMO; return SPELL_FAILED_NO_AMMO;
} }
ItemPrototype const *ammoProto = objmgr.GetItemPrototype( ammo ); ItemPrototype const *ammoProto = ObjectMgr::GetItemPrototype( ammo );
if(!ammoProto) if(!ammoProto)
return SPELL_FAILED_NO_AMMO; return SPELL_FAILED_NO_AMMO;

View file

@ -2723,7 +2723,7 @@ void Aura::HandleAuraMounted(bool apply, bool Real)
if(apply) if(apply)
{ {
CreatureInfo const* ci = objmgr.GetCreatureTemplate(m_modifier.m_miscvalue); CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(m_modifier.m_miscvalue);
if(!ci) if(!ci)
{ {
sLog.outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need it modelid)", m_modifier.m_miscvalue); sLog.outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need it modelid)", m_modifier.m_miscvalue);
@ -3131,7 +3131,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real)
{ {
uint32 model_id; uint32 model_id;
CreatureInfo const * ci = objmgr.GetCreatureTemplate(m_modifier.m_miscvalue); CreatureInfo const * ci = ObjectMgr::GetCreatureTemplate(m_modifier.m_miscvalue);
if (!ci) if (!ci)
{ {
model_id = 16358; // pig pink ^_^ model_id = 16358; // pig pink ^_^
@ -3200,7 +3200,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real)
if (!m_target->GetAurasByType(SPELL_AURA_MOUNTED).empty()) if (!m_target->GetAurasByType(SPELL_AURA_MOUNTED).empty())
{ {
uint32 cr_id = m_target->GetAurasByType(SPELL_AURA_MOUNTED).front()->GetModifier()->m_miscvalue; uint32 cr_id = m_target->GetAurasByType(SPELL_AURA_MOUNTED).front()->GetModifier()->m_miscvalue;
if (CreatureInfo const* ci = objmgr.GetCreatureTemplate(cr_id)) if (CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(cr_id))
{ {
uint32 team = 0; uint32 team = 0;
if (m_target->GetTypeId() == TYPEID_PLAYER) if (m_target->GetTypeId() == TYPEID_PLAYER)
@ -5905,7 +5905,7 @@ void Aura::HandleAuraEmpathy(bool apply, bool /*Real*/)
if(m_target->GetTypeId() != TYPEID_UNIT) if(m_target->GetTypeId() != TYPEID_UNIT)
return; return;
CreatureInfo const * ci = objmgr.GetCreatureTemplate(m_target->GetEntry()); CreatureInfo const * ci = ObjectMgr::GetCreatureTemplate(m_target->GetEntry());
if(ci && ci->type == CREATURE_TYPE_BEAST) if(ci && ci->type == CREATURE_TYPE_BEAST)
m_target->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply); m_target->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply);
} }

View file

@ -2713,7 +2713,7 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype)
Player* player = (Player*)unitTarget; Player* player = (Player*)unitTarget;
uint32 newitemid = itemtype; uint32 newitemid = itemtype;
ItemPrototype const *pProto = objmgr.GetItemPrototype( newitemid ); ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( newitemid );
if(!pProto) if(!pProto)
{ {
player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
@ -6516,7 +6516,7 @@ void Spell::EffectTransmitted(uint32 effIndex)
{ {
uint32 name_id = m_spellInfo->EffectMiscValue[effIndex]; uint32 name_id = m_spellInfo->EffectMiscValue[effIndex];
GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(name_id); GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(name_id);
if (!goinfo) if (!goinfo)
{ {

View file

@ -57,7 +57,7 @@ void MapManager::LoadTransports()
std::string name = fields[1].GetCppString(); std::string name = fields[1].GetCppString();
t->m_period = fields[2].GetUInt32(); t->m_period = fields[2].GetUInt32();
const GameObjectInfo *goinfo = objmgr.GetGameObjectInfo(entry); const GameObjectInfo *goinfo = ObjectMgr::GetGameObjectInfo(entry);
if(!goinfo) if(!goinfo)
{ {
@ -150,7 +150,7 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z,
Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT); Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);
GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(guidlow); GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(guidlow);
if (!goinfo) if (!goinfo)
{ {

View file

@ -464,7 +464,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
// some critters required for quests (need normal entry instead possible heroic in any cases) // some critters required for quests (need normal entry instead possible heroic in any cases)
if(GetTypeId() == TYPEID_PLAYER) if(GetTypeId() == TYPEID_PLAYER)
if(CreatureInfo const* normalInfo = objmgr.GetCreatureTemplate(pVictim->GetEntry())) if(CreatureInfo const* normalInfo = ObjectMgr::GetCreatureTemplate(pVictim->GetEntry()))
((Player*)this)->KilledMonster(normalInfo,pVictim->GetGUID()); ((Player*)this)->KilledMonster(normalInfo,pVictim->GetGUID());
return damage; return damage;

View file

@ -614,7 +614,7 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
uint32 entry = (uint32)atoi(e); uint32 entry = (uint32)atoi(e);
uint32 id = (uint32)atoi(i); uint32 id = (uint32)atoi(i);
CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry); CreatureInfo const *ci = ObjectMgr::GetCreatureTemplate(entry);
if (!ci) if (!ci)
return false; return false;