Core: Rename GetCreatureInfo to GetCreatureTemplate and minor cleanup here and there
This commit is contained in:
1 parent
3e622ee7ac
commit
d38bc3a178
47 files changed
+317
-317
No files matched your search
@@ -2014,7 +2014,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
|
||||
else
|
||||
parry_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25;
|
||||
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY))
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY))
|
||||
{
|
||||
int32 tmp2 = int32(parry_chance);
|
||||
if (tmp2 > 0 // check if unit _can_ parry
|
||||
@@ -2026,7 +2026,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
|
||||
}
|
||||
}
|
||||
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK))
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK))
|
||||
{
|
||||
tmp = block_chance;
|
||||
if (tmp > 0 // check if unit _can_ block
|
||||
@@ -2045,7 +2045,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
|
||||
if (tmp > 0 && roll < (sum += tmp))
|
||||
{
|
||||
sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum);
|
||||
if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT))
|
||||
if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT))
|
||||
sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT DISABLED)");
|
||||
else
|
||||
return MELEE_HIT_CRIT;
|
||||
@@ -2075,7 +2075,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
|
||||
if (getLevelForTarget(victim) >= victim->getLevelForTarget(this) + 4 &&
|
||||
// can be from by creature (if can) or from controlled player that considered as creature
|
||||
!IsControlledByPlayer() &&
|
||||
!(GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH))
|
||||
!(GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH))
|
||||
{
|
||||
// when their weapon skill is 15 or more above victim's defense skill
|
||||
tmp = victimDefenseSkill;
|
||||
@@ -2189,7 +2189,7 @@ bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttac
|
||||
{
|
||||
// Check creatures flags_extra for disable block
|
||||
if (victim->GetTypeId() == TYPEID_UNIT &&
|
||||
victim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)
|
||||
victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)
|
||||
return false;
|
||||
|
||||
float blockChance = victim->GetUnitBlockChance();
|
||||
@@ -2327,7 +2327,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell)
|
||||
// Check creatures flags_extra for disable parry
|
||||
if (victim->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
uint32 flagEx = victim->ToCreature()->GetCreatureInfo()->flags_extra;
|
||||
uint32 flagEx = victim->ToCreature()->GetCreatureTemplate()->flags_extra;
|
||||
if (flagEx & CREATURE_FLAG_EXTRA_NO_PARRY)
|
||||
canParry = false;
|
||||
// Check creatures flags_extra for disable block
|
||||
@@ -9178,7 +9178,7 @@ FactionTemplateEntry const* Unit::getFactionTemplateEntry() const
|
||||
if (Player const* player = ToPlayer())
|
||||
sLog->outError("Player %s has invalid faction (faction template id) #%u", player->GetName(), getFaction());
|
||||
else if (Creature const* creature = ToCreature())
|
||||
sLog->outError("Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureInfo()->Entry, getFaction());
|
||||
sLog->outError("Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction());
|
||||
else
|
||||
sLog->outError("Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName(), uint32(GetTypeId()), getFaction());
|
||||
|
||||
@@ -10235,7 +10235,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
|
||||
// ..done
|
||||
// Pet damage?
|
||||
if (GetTypeId() == TYPEID_UNIT && !ToCreature()->isPet())
|
||||
DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureInfo()->rank);
|
||||
DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
|
||||
|
||||
AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
||||
@@ -12032,7 +12032,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
|
||||
UpdateSpeed(MOVE_FLIGHT, true);
|
||||
}
|
||||
|
||||
if (!(creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_MOUNTED_COMBAT))
|
||||
if (!(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_MOUNTED_COMBAT))
|
||||
Dismount();
|
||||
}
|
||||
|
||||
@@ -12051,12 +12051,12 @@ void Unit::ClearInCombat()
|
||||
// Player's state will be cleared in Player::UpdateContestedPvP
|
||||
if (Creature* creature = ToCreature())
|
||||
{
|
||||
if (creature->GetCreatureInfo() && creature->GetCreatureInfo()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC)
|
||||
if (creature->GetCreatureTemplate() && creature->GetCreatureTemplate()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC)
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); // set immunity state to the one from db on evade
|
||||
|
||||
ClearUnitState(UNIT_STATE_ATTACK_PLAYER);
|
||||
if (HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED))
|
||||
SetUInt32Value(UNIT_DYNAMIC_FLAGS, creature->GetCreatureInfo()->dynamicflags);
|
||||
SetUInt32Value(UNIT_DYNAMIC_FLAGS, creature->GetCreatureTemplate()->dynamicflags);
|
||||
|
||||
if (creature->isPet())
|
||||
{
|
||||
@@ -12171,7 +12171,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co
|
||||
}
|
||||
|
||||
Creature const* creatureAttacker = ToCreature();
|
||||
if (creatureAttacker && creatureAttacker->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26)
|
||||
if (creatureAttacker && creatureAttacker->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_UNK26)
|
||||
return false;
|
||||
|
||||
Player const* playerAffectingAttacker = HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? GetAffectingPlayer() : NULL;
|
||||
@@ -12258,7 +12258,7 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co
|
||||
// can't assist non-friendly targets
|
||||
if (GetReactionTo(target) <= REP_NEUTRAL
|
||||
&& target->GetReactionTo(this) <= REP_NEUTRAL
|
||||
&& (!ToCreature() || !(ToCreature()->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26)))
|
||||
&& (!ToCreature() || !(ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_UNK26)))
|
||||
return false;
|
||||
|
||||
// PvP case
|
||||
@@ -12292,7 +12292,7 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co
|
||||
&& !((target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_PVP)))
|
||||
{
|
||||
if (Creature const* creatureTarget = target->ToCreature())
|
||||
return creatureTarget->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26 || creatureTarget->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS;
|
||||
return creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_UNK26 || creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -12514,7 +12514,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
|
||||
{
|
||||
// Set creature speed rate from CreatureInfo
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
speed *= ToCreature()->GetCreatureInfo()->speed_walk;
|
||||
speed *= ToCreature()->GetCreatureTemplate()->speed_walk;
|
||||
|
||||
// Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need
|
||||
// TODO: possible affect only on MOVE_RUN
|
||||
@@ -13200,7 +13200,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,
|
||||
Unit const* source = casterOwner ? casterOwner : caster;
|
||||
|
||||
if ((target->GetTypeId() == TYPEID_PLAYER
|
||||
|| ((Creature*)target)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)
|
||||
|| ((Creature*)target)->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)
|
||||
&& source->GetTypeId() == TYPEID_PLAYER)
|
||||
duration = limitduration;
|
||||
}
|
||||
@@ -13209,7 +13209,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,
|
||||
|
||||
if (group == DIMINISHING_TAUNT)
|
||||
{
|
||||
if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TAUNT_DIMINISH))
|
||||
if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TAUNT_DIMINISH))
|
||||
{
|
||||
DiminishingLevels diminish = Level;
|
||||
switch (diminish)
|
||||
@@ -13226,7 +13226,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,
|
||||
// Some diminishings applies to mobs too (for example, Stun)
|
||||
else if ((GetDiminishingReturnsGroupType(group) == DRTYPE_PLAYER
|
||||
&& ((targetOwner ? (targetOwner->GetTypeId() == TYPEID_PLAYER) : (GetTypeId() == TYPEID_PLAYER))
|
||||
|| (GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)))
|
||||
|| (GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)))
|
||||
|| GetDiminishingReturnsGroupType(group) == DRTYPE_ALL)
|
||||
{
|
||||
DiminishingLevels diminish = Level;
|
||||
@@ -13310,7 +13310,7 @@ uint32 Unit::GetCreatureType() const
|
||||
return CREATURE_TYPE_HUMANOID;
|
||||
}
|
||||
else
|
||||
return ToCreature()->GetCreatureInfo()->type;
|
||||
return ToCreature()->GetCreatureTemplate()->type;
|
||||
}
|
||||
|
||||
/*#######################################
|
||||
@@ -15393,10 +15393,10 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
creature->lootForPickPocketed = false;
|
||||
|
||||
loot->clear();
|
||||
if (uint32 lootid = creature->GetCreatureInfo()->lootid)
|
||||
if (uint32 lootid = creature->GetCreatureTemplate()->lootid)
|
||||
loot->FillLoot(lootid, LootTemplates_Creature, looter, false, false, creature->GetLootMode());
|
||||
|
||||
loot->generateMoneyLoot(creature->GetCreatureInfo()->mingold, creature->GetCreatureInfo()->maxgold);
|
||||
loot->generateMoneyLoot(creature->GetCreatureTemplate()->mingold, creature->GetCreatureTemplate()->maxgold);
|
||||
}
|
||||
|
||||
player->RewardPlayerAndGroupAtKill(victim, false);
|
||||
@@ -15497,7 +15497,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
if (!creature->isPet())
|
||||
{
|
||||
creature->DeleteThreatList();
|
||||
CreatureTemplate const* cInfo = creature->GetCreatureInfo();
|
||||
CreatureTemplate const* cInfo = creature->GetCreatureTemplate();
|
||||
if (cInfo && (cInfo->lootid || cInfo->maxgold > 0))
|
||||
creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
||||
}
|
||||
@@ -15526,7 +15526,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
{
|
||||
if (instanceMap->IsRaidOrHeroicDungeon())
|
||||
{
|
||||
if (creature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
|
||||
if (creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
|
||||
((InstanceMap*)instanceMap)->PermBindAllPlayers(creditedPlayer);
|
||||
}
|
||||
else
|
||||
@@ -15935,7 +15935,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
|
||||
case CHARM_TYPE_CHARM:
|
||||
if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
|
||||
{
|
||||
CreatureTemplate const* cinfo = ToCreature()->GetCreatureInfo();
|
||||
CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate();
|
||||
if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
|
||||
{
|
||||
// to prevent client crash
|
||||
@@ -16039,7 +16039,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
|
||||
case CHARM_TYPE_CHARM:
|
||||
if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
|
||||
{
|
||||
CreatureTemplate const* cinfo = ToCreature()->GetCreatureInfo();
|
||||
CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate();
|
||||
if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
|
||||
{
|
||||
SetByteValue(UNIT_FIELD_BYTES_0, 1, uint8(cinfo->unit_class));
|
||||
@@ -16078,7 +16078,7 @@ void Unit::RestoreFaction()
|
||||
}
|
||||
}
|
||||
|
||||
if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureInfo()) // normal creature
|
||||
if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate()) // normal creature
|
||||
{
|
||||
FactionTemplateEntry const* faction = getFactionTemplateEntry();
|
||||
setFaction((faction && faction->friendlyMask & 0x004) ? cinfo->faction_H : cinfo->faction_A);
|
||||
|
||||
Reference in new issue
Block a user