Core/ObjectMgr: Refactor sCreatureStorage
This commit is contained in:
@@ -82,7 +82,7 @@ VendorItem const* VendorItemData::FindItemCostPair(uint32 item_id, uint32 extend
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint32 CreatureInfo::GetRandomValidModelId() const
|
||||
uint32 CreatureTemplate::GetRandomValidModelId() const
|
||||
{
|
||||
uint8 c = 0;
|
||||
uint32 modelIDs[4];
|
||||
@@ -95,7 +95,7 @@ uint32 CreatureInfo::GetRandomValidModelId() const
|
||||
return ((c>0) ? modelIDs[urand(0,c-1)] : 0);
|
||||
}
|
||||
|
||||
uint32 CreatureInfo::GetFirstValidModelId() const
|
||||
uint32 CreatureTemplate::GetFirstValidModelId() const
|
||||
{
|
||||
if (Modelid1) return Modelid1;
|
||||
if (Modelid2) return Modelid2;
|
||||
@@ -254,7 +254,7 @@ void Creature::RemoveCorpse(bool setSpawnTime)
|
||||
*/
|
||||
bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData *data)
|
||||
{
|
||||
CreatureInfo const *normalInfo = ObjectMgr::GetCreatureTemplate(Entry);
|
||||
CreatureTemplate const *normalInfo = sObjectMgr->GetCreatureTemplate(Entry);
|
||||
if (!normalInfo)
|
||||
{
|
||||
sLog->outErrorDb("Creature::InitEntry creature entry %u does not exist.", Entry);
|
||||
@@ -262,13 +262,13 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData *data
|
||||
}
|
||||
|
||||
// get difficulty 1 mode entry
|
||||
CreatureInfo const *cinfo = normalInfo;
|
||||
CreatureTemplate const *cinfo = normalInfo;
|
||||
for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0;)
|
||||
{
|
||||
// we already have valid Map pointer for current creature!
|
||||
if (normalInfo->DifficultyEntry[diff - 1])
|
||||
{
|
||||
cinfo = ObjectMgr::GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
|
||||
cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
|
||||
if (cinfo)
|
||||
break; // template found
|
||||
|
||||
@@ -347,7 +347,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data)
|
||||
if (!InitEntry(Entry,team,data))
|
||||
return false;
|
||||
|
||||
CreatureInfo const* cInfo = GetCreatureInfo();
|
||||
CreatureTemplate const* cInfo = GetCreatureInfo();
|
||||
|
||||
m_regenHealth = cInfo->RegenHealth;
|
||||
|
||||
@@ -382,12 +382,12 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data)
|
||||
CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(getLevel(), cInfo->unit_class);
|
||||
float armor = (float)stats->GenerateArmor(cInfo); // TODO: Why is this treated as uint32 when it's a float?
|
||||
SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, armor);
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(cInfo->resistance1));
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_FIRE, BASE_VALUE, float(cInfo->resistance2));
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_NATURE, BASE_VALUE, float(cInfo->resistance3));
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, float(cInfo->resistance4));
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_SHADOW, BASE_VALUE, float(cInfo->resistance5));
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_ARCANE, BASE_VALUE, float(cInfo->resistance6));
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_HOLY]));
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_FIRE, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_FIRE]));
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_NATURE, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_NATURE]));
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_FROST]));
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_SHADOW, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_SHADOW]));
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_ARCANE, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_ARCANE]));
|
||||
|
||||
SetCanModifyStats(true);
|
||||
UpdateAllStats();
|
||||
@@ -739,7 +739,7 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry,
|
||||
SetMap(map);
|
||||
SetPhaseMask(phaseMask,false);
|
||||
|
||||
CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(Entry);
|
||||
CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(Entry);
|
||||
if (!cinfo)
|
||||
{
|
||||
sLog->outErrorDb("Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
|
||||
@@ -1048,7 +1048,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||
uint32 dynamicflags = GetUInt32Value(UNIT_DYNAMIC_FLAGS);
|
||||
|
||||
// check if it's a custom model and if not, use 0 for displayId
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
CreatureTemplate const *cinfo = GetCreatureInfo();
|
||||
if (cinfo)
|
||||
{
|
||||
if (displayId == cinfo->Modelid1 || displayId == cinfo->Modelid2 ||
|
||||
@@ -1124,7 +1124,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||
WorldDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
void Creature::SelectLevel(const CreatureInfo *cinfo)
|
||||
void Creature::SelectLevel(const CreatureTemplate *cinfo)
|
||||
{
|
||||
uint32 rank = isPet()? 0 : cinfo->rank;
|
||||
|
||||
@@ -1239,7 +1239,7 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint3
|
||||
return false;
|
||||
}
|
||||
|
||||
CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(Entry);
|
||||
CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(Entry);
|
||||
if (!cinfo)
|
||||
{
|
||||
sLog->outErrorDb("Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
|
||||
@@ -1542,7 +1542,7 @@ void Creature::setDeathState(DeathState s)
|
||||
SetFullHealth();
|
||||
SetLootRecipient(NULL);
|
||||
ResetPlayerDamageReq();
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
CreatureTemplate const *cinfo = GetCreatureInfo();
|
||||
AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
||||
if (GetCreatureInfo()->InhabitType & INHABIT_AIR)
|
||||
AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_FLYING);
|
||||
@@ -1604,7 +1604,7 @@ void Creature::Respawn(bool force)
|
||||
if (m_originalEntry != GetEntry())
|
||||
UpdateEntry(m_originalEntry);
|
||||
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
CreatureTemplate const *cinfo = GetCreatureInfo();
|
||||
SelectLevel(cinfo);
|
||||
|
||||
if (m_isDeadByDefault)
|
||||
@@ -2255,7 +2255,7 @@ void Creature::AllLootRemovedFromCorpse()
|
||||
return;
|
||||
|
||||
float decayRate;
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
CreatureTemplate const *cinfo = GetCreatureInfo();
|
||||
|
||||
decayRate = sWorld->getRate(RATE_CORPSE_DECAY_LOOTED);
|
||||
uint32 diff = uint32((m_corpseRemoveTime - now) * decayRate);
|
||||
@@ -2285,7 +2285,7 @@ uint8 Creature::getLevelForTarget(WorldObject const* target) const
|
||||
|
||||
std::string Creature::GetAIName() const
|
||||
{
|
||||
return ObjectMgr::GetCreatureTemplate(GetEntry())->AIName;
|
||||
return sObjectMgr->GetCreatureTemplate(GetEntry())->AIName;
|
||||
}
|
||||
|
||||
std::string Creature::GetScriptName() const
|
||||
@@ -2295,7 +2295,7 @@ std::string Creature::GetScriptName() const
|
||||
|
||||
uint32 Creature::GetScriptId() const
|
||||
{
|
||||
return ObjectMgr::GetCreatureTemplate(GetEntry())->ScriptID;
|
||||
return sObjectMgr->GetCreatureTemplate(GetEntry())->ScriptID;
|
||||
}
|
||||
|
||||
VendorItemData const* Creature::GetVendorItems() const
|
||||
@@ -2416,6 +2416,6 @@ void Creature::FarTeleportTo(Map* map, float X, float Y, float Z, float O)
|
||||
|
||||
bool Creature::IsDungeonBoss() const
|
||||
{
|
||||
CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(GetEntry());
|
||||
CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(GetEntry());
|
||||
return cinfo && (cinfo->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ enum CreatureFlagsExtra
|
||||
#define MAX_CREATURE_QUEST_ITEMS 6
|
||||
|
||||
// from `creature_template` table
|
||||
struct CreatureInfo
|
||||
struct CreatureTemplate
|
||||
{
|
||||
uint32 Entry;
|
||||
uint32 DifficultyEntry[MAX_DIFFICULTY - 1];
|
||||
@@ -86,9 +86,9 @@ struct CreatureInfo
|
||||
uint32 Modelid2;
|
||||
uint32 Modelid3;
|
||||
uint32 Modelid4;
|
||||
char* Name;
|
||||
char* SubName;
|
||||
char* IconName;
|
||||
std::string Name;
|
||||
std::string SubName;
|
||||
std::string IconName;
|
||||
uint32 GossipMenuId;
|
||||
uint8 minlevel;
|
||||
uint8 maxlevel;
|
||||
@@ -123,18 +123,13 @@ struct CreatureInfo
|
||||
uint32 lootid;
|
||||
uint32 pickpocketLootId;
|
||||
uint32 SkinLootId;
|
||||
int32 resistance1;
|
||||
int32 resistance2;
|
||||
int32 resistance3;
|
||||
int32 resistance4;
|
||||
int32 resistance5;
|
||||
int32 resistance6;
|
||||
int32 resistance[MAX_SPELL_SCHOOL];
|
||||
uint32 spells[CREATURE_MAX_SPELLS];
|
||||
uint32 PetSpellDataId;
|
||||
uint32 VehicleId;
|
||||
uint32 mingold;
|
||||
uint32 maxgold;
|
||||
char const* AIName;
|
||||
std::string AIName;
|
||||
uint32 MovementType;
|
||||
uint32 InhabitType;
|
||||
float ModHealth;
|
||||
@@ -174,6 +169,9 @@ struct CreatureInfo
|
||||
}
|
||||
};
|
||||
|
||||
// Benchmarked: Faster than std::map (insert/find)
|
||||
typedef UNORDERED_MAP<uint32, CreatureTemplate> CreatureTemplateContainer;
|
||||
|
||||
// Represents max amount of expansions.
|
||||
// TODO: Add MAX_EXPANSION constant.
|
||||
#define MAX_CREATURE_BASE_HP 3
|
||||
@@ -187,12 +185,12 @@ struct CreatureBaseStats
|
||||
|
||||
// Helpers
|
||||
|
||||
uint32 GenerateHealth(CreatureInfo const* info) const
|
||||
uint32 GenerateHealth(CreatureTemplate const* info) const
|
||||
{
|
||||
return uint32((BaseHealth[info->expansion] * info->ModHealth) + 0.5f);
|
||||
}
|
||||
|
||||
uint32 GenerateMana(CreatureInfo const* info) const
|
||||
uint32 GenerateMana(CreatureTemplate const* info) const
|
||||
{
|
||||
// Mana can be 0.
|
||||
if (!BaseMana)
|
||||
@@ -201,7 +199,7 @@ struct CreatureBaseStats
|
||||
return uint32((BaseMana * info->ModMana) + 0.5f);
|
||||
}
|
||||
|
||||
uint32 GenerateArmor(CreatureInfo const* info) const
|
||||
uint32 GenerateArmor(CreatureTemplate const* info) const
|
||||
{
|
||||
return uint32((BaseArmor * info->ModArmor) + 0.5f);
|
||||
}
|
||||
@@ -422,11 +420,10 @@ class Creature : public Unit, public GridObject<Creature>
|
||||
|
||||
bool Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehId, uint32 team, float x, float y, float z, float ang, const CreatureData *data = NULL);
|
||||
bool LoadCreaturesAddon(bool reload = false);
|
||||
void SelectLevel(const CreatureInfo *cinfo);
|
||||
void SelectLevel(const CreatureTemplate *cinfo);
|
||||
void LoadEquipment(uint32 equip_entry, bool force=false);
|
||||
|
||||
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
|
||||
char const* GetSubName() const { return GetCreatureInfo()->SubName; }
|
||||
|
||||
void Update(uint32 time); // overwrited Unit::Update
|
||||
void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const;
|
||||
@@ -527,7 +524,7 @@ class Creature : public Unit, public GridObject<Creature>
|
||||
|
||||
TrainerSpellData const* GetTrainerSpells() const;
|
||||
|
||||
CreatureInfo const *GetCreatureInfo() const { return m_creatureInfo; }
|
||||
CreatureTemplate const *GetCreatureInfo() const { return m_creatureInfo; }
|
||||
CreatureData const *GetCreatureData() const { return m_creatureData; }
|
||||
CreatureAddon const* GetCreatureAddon() const;
|
||||
|
||||
@@ -721,7 +718,7 @@ class Creature : public Unit, public GridObject<Creature>
|
||||
|
||||
bool DisableReputationGain;
|
||||
|
||||
CreatureInfo const* m_creatureInfo; // in difficulty mode > 0 can different from ObjectMgr::GetCreatureTemplate(GetEntry())
|
||||
CreatureTemplate const* m_creatureInfo; // in difficulty mode > 0 can different from sObjectMgr->GetCreatureTemplate(GetEntry())
|
||||
CreatureData const* m_creatureData;
|
||||
|
||||
uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
|
||||
|
||||
@@ -585,7 +585,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
|
||||
{
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
const CreatureInfo* cinfo = this->ToCreature()->GetCreatureInfo();
|
||||
const CreatureTemplate* cinfo = this->ToCreature()->GetCreatureInfo();
|
||||
if (cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
|
||||
{
|
||||
if (target->isGameMaster())
|
||||
|
||||
@@ -154,7 +154,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
PetType pet_type = PetType(fields[18].GetUInt8());
|
||||
if (pet_type == HUNTER_PET)
|
||||
{
|
||||
CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(petentry);
|
||||
CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(petentry);
|
||||
if (!creatureInfo || !creatureInfo->isTameable(owner->CanTameExoticPets()))
|
||||
return false;
|
||||
}
|
||||
@@ -187,7 +187,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
setFaction(owner->getFaction());
|
||||
SetUInt32Value(UNIT_CREATED_BY_SPELL, summon_spell_id);
|
||||
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
CreatureTemplate const *cinfo = GetCreatureInfo();
|
||||
if (cinfo->type == CREATURE_TYPE_CRITTER)
|
||||
{
|
||||
map->Add(this->ToCreature());
|
||||
@@ -754,7 +754,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
|
||||
return false;
|
||||
}
|
||||
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
CreatureTemplate const *cinfo = GetCreatureInfo();
|
||||
if (!cinfo)
|
||||
{
|
||||
sLog->outError("CreateBaseAtCreature() failed, creatureInfo is missing!");
|
||||
@@ -771,7 +771,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pet::CreateBaseAtCreatureInfo(CreatureInfo const* cinfo, Unit * owner)
|
||||
bool Pet::CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit * owner)
|
||||
{
|
||||
if (!CreateBaseAtTamed(cinfo, owner->GetMap(), owner->GetPhaseMask()))
|
||||
return false;
|
||||
@@ -784,7 +784,7 @@ bool Pet::CreateBaseAtCreatureInfo(CreatureInfo const* cinfo, Unit * owner)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pet::CreateBaseAtTamed(CreatureInfo const * cinfo, Map * map, uint32 phaseMask)
|
||||
bool Pet::CreateBaseAtTamed(CreatureTemplate const * cinfo, Map * map, uint32 phaseMask)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_PETS, "Pet::CreateBaseForTamed");
|
||||
uint32 guid=sObjectMgr->GenerateLowGuid(HIGHGUID_PET);
|
||||
@@ -813,7 +813,7 @@ bool Pet::CreateBaseAtTamed(CreatureInfo const * cinfo, Map * map, uint32 phaseM
|
||||
// TODO: Move stat mods code to pet passive auras
|
||||
bool Guardian::InitStatsForLevel(uint8 petlevel)
|
||||
{
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
CreatureTemplate const *cinfo = GetCreatureInfo();
|
||||
ASSERT(cinfo);
|
||||
|
||||
SetLevel(petlevel);
|
||||
@@ -862,19 +862,9 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
|
||||
SetFloatValue(OBJECT_FIELD_SCALE_X, scale);
|
||||
}
|
||||
|
||||
//resistance
|
||||
int32 createResistance[MAX_SPELL_SCHOOL] = {0,0,0,0,0,0,0};
|
||||
if (cinfo && petType != HUNTER_PET)
|
||||
{
|
||||
createResistance[SPELL_SCHOOL_HOLY] = cinfo->resistance1;
|
||||
createResistance[SPELL_SCHOOL_FIRE] = cinfo->resistance2;
|
||||
createResistance[SPELL_SCHOOL_NATURE] = cinfo->resistance3;
|
||||
createResistance[SPELL_SCHOOL_FROST] = cinfo->resistance4;
|
||||
createResistance[SPELL_SCHOOL_SHADOW] = cinfo->resistance5;
|
||||
createResistance[SPELL_SCHOOL_ARCANE] = cinfo->resistance6;
|
||||
}
|
||||
// Resistance
|
||||
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||
SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(createResistance[i]));
|
||||
SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(cinfo->resistance[i]));
|
||||
|
||||
//health, mana, armor and resistance
|
||||
PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(creature_ID, petlevel);
|
||||
@@ -1056,7 +1046,7 @@ bool Pet::HaveInDiet(ItemTemplate const* item) const
|
||||
if (!item->FoodType)
|
||||
return false;
|
||||
|
||||
CreatureInfo const* cInfo = GetCreatureInfo();
|
||||
CreatureTemplate const* cInfo = GetCreatureInfo();
|
||||
if (!cInfo)
|
||||
return false;
|
||||
|
||||
@@ -1583,7 +1573,7 @@ bool Pet::resetTalents(bool no_cost)
|
||||
if (owner->ToPlayer()->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||
owner->ToPlayer()->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS,true);
|
||||
|
||||
CreatureInfo const * ci = GetCreatureInfo();
|
||||
CreatureTemplate const * ci = GetCreatureInfo();
|
||||
if (!ci)
|
||||
return false;
|
||||
// Check pet talent type
|
||||
@@ -1888,7 +1878,7 @@ bool Pet::HasSpell(uint32 spell) const
|
||||
// Get all passive spells in our skill line
|
||||
void Pet::LearnPetPassives()
|
||||
{
|
||||
CreatureInfo const* cInfo = GetCreatureInfo();
|
||||
CreatureTemplate const* cInfo = GetCreatureInfo();
|
||||
if (!cInfo)
|
||||
return;
|
||||
|
||||
|
||||
@@ -138,8 +138,8 @@ class Pet : public Guardian
|
||||
|
||||
bool Create (uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 pet_number);
|
||||
bool CreateBaseAtCreature(Creature* creature);
|
||||
bool CreateBaseAtCreatureInfo(CreatureInfo const* cinfo,Unit * owner);
|
||||
bool CreateBaseAtTamed(CreatureInfo const * cinfo, Map * map, uint32 phaseMask);
|
||||
bool CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo,Unit * owner);
|
||||
bool CreateBaseAtTamed(CreatureTemplate const * cinfo, Map * map, uint32 phaseMask);
|
||||
bool LoadPetFromDB(Player* owner,uint32 petentry = 0,uint32 petnumber = 0, bool current = false);
|
||||
bool isBeingLoaded() const { return m_loading;}
|
||||
void SavePetToDB(PetSaveMode mode);
|
||||
|
||||
@@ -1942,7 +1942,7 @@ bool Player::BuildEnumData(QueryResult result, WorldPacket* data)
|
||||
if (result && !(playerFlags & PLAYER_FLAGS_GHOST) && (plrClass == CLASS_WARLOCK || plrClass == CLASS_HUNTER || plrClass == CLASS_DEATH_KNIGHT))
|
||||
{
|
||||
uint32 entry = fields[16].GetUInt32();
|
||||
CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(entry);
|
||||
CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(entry);
|
||||
if (creatureInfo)
|
||||
{
|
||||
petDisplayId = fields[17].GetUInt32();
|
||||
@@ -15701,7 +15701,7 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count)
|
||||
UpdateForQuestWorldObjects();
|
||||
}
|
||||
|
||||
void Player::KilledMonster(CreatureInfo const* cInfo, uint64 guid)
|
||||
void Player::KilledMonster(CreatureTemplate const* cInfo, uint64 guid)
|
||||
{
|
||||
if (cInfo->Entry)
|
||||
KilledMonsterCredit(cInfo->Entry, guid);
|
||||
@@ -15814,7 +15814,7 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id)
|
||||
reqTarget = qInfo->ReqCreatureOrGOId[j];
|
||||
if (reqTarget != entry) // if entry doesn't match, check for killcredits referenced in template
|
||||
{
|
||||
CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(entry);
|
||||
CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(entry);
|
||||
for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)
|
||||
if (cinfo->KillCredit[i] == reqTarget)
|
||||
entry = cinfo->KillCredit[i];
|
||||
@@ -23533,7 +23533,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
|
||||
if (!talentTabInfo)
|
||||
return;
|
||||
|
||||
CreatureInfo const *ci = pet->GetCreatureInfo();
|
||||
CreatureTemplate const *ci = pet->GetCreatureInfo();
|
||||
|
||||
if (!ci)
|
||||
return;
|
||||
@@ -23787,7 +23787,7 @@ void Player::BuildPetTalentsInfoData(WorldPacket *data)
|
||||
|
||||
data->put<uint32>(pointsPos, unspentTalentPoints); // put real points
|
||||
|
||||
CreatureInfo const *ci = pet->GetCreatureInfo();
|
||||
CreatureTemplate const *ci = pet->GetCreatureInfo();
|
||||
if (!ci)
|
||||
return;
|
||||
|
||||
|
||||
@@ -1428,7 +1428,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
void GroupEventHappens(uint32 questId, WorldObject const* pEventObject);
|
||||
void ItemAddedQuestCheck(uint32 entry, uint32 count);
|
||||
void ItemRemovedQuestCheck(uint32 entry, uint32 count);
|
||||
void KilledMonster(CreatureInfo const* cInfo, uint64 guid);
|
||||
void KilledMonster(CreatureTemplate const* cInfo, uint64 guid);
|
||||
void KilledMonsterCredit(uint32 entry, uint64 guid);
|
||||
void CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id);
|
||||
void TalkedToCreature(uint32 entry, uint64 guid);
|
||||
|
||||
@@ -54,7 +54,7 @@ void Totem::InitStats(uint32 duration)
|
||||
{
|
||||
Minion::InitStats(duration);
|
||||
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
CreatureTemplate const *cinfo = GetCreatureInfo();
|
||||
if (m_owner->GetTypeId() == TYPEID_PLAYER && cinfo)
|
||||
{
|
||||
uint32 displayID = sObjectMgr->ChooseDisplayId(m_owner->ToPlayer()->GetTeam(), cinfo);
|
||||
|
||||
@@ -14744,7 +14744,7 @@ Pet* Unit::CreateTamedPetFrom(uint32 creatureEntry, uint32 spell_id)
|
||||
if (GetTypeId() != TYPEID_PLAYER)
|
||||
return NULL;
|
||||
|
||||
CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(creatureEntry);
|
||||
CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry);
|
||||
if (!creatureInfo)
|
||||
return NULL;
|
||||
|
||||
@@ -15165,7 +15165,7 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
|
||||
if (!creature->isPet())
|
||||
{
|
||||
creature->DeleteThreatList();
|
||||
CreatureInfo const* cInfo = creature->GetCreatureInfo();
|
||||
CreatureTemplate const* cInfo = creature->GetCreatureInfo();
|
||||
if (cInfo && (cInfo->lootid || cInfo->maxgold > 0))
|
||||
creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
||||
}
|
||||
@@ -15603,7 +15603,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const * a
|
||||
case CHARM_TYPE_CHARM:
|
||||
if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
|
||||
{
|
||||
CreatureInfo const *cinfo = this->ToCreature()->GetCreatureInfo();
|
||||
CreatureTemplate const *cinfo = this->ToCreature()->GetCreatureInfo();
|
||||
if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
|
||||
{
|
||||
//to prevent client crash
|
||||
@@ -15707,7 +15707,7 @@ void Unit::RemoveCharmedBy(Unit *charmer)
|
||||
case CHARM_TYPE_CHARM:
|
||||
if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
|
||||
{
|
||||
CreatureInfo const *cinfo = this->ToCreature()->GetCreatureInfo();
|
||||
CreatureTemplate const *cinfo = this->ToCreature()->GetCreatureInfo();
|
||||
if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
|
||||
{
|
||||
SetByteValue(UNIT_FIELD_BYTES_0, 1, uint8(cinfo->unit_class));
|
||||
@@ -15746,7 +15746,7 @@ void Unit::RestoreFaction()
|
||||
}
|
||||
}
|
||||
|
||||
if (CreatureInfo const *cinfo = this->ToCreature()->GetCreatureInfo()) // normal creature
|
||||
if (CreatureTemplate const *cinfo = this->ToCreature()->GetCreatureInfo()) // normal creature
|
||||
{
|
||||
FactionTemplateEntry const *faction = getFactionTemplateEntry();
|
||||
setFaction((faction && faction->friendlyMask & 0x004) ? cinfo->faction_H : cinfo->faction_A);
|
||||
|
||||
Reference in New Issue
Block a user