mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 13:46:24 +00:00
fix(Core/Commands): .cheat god lowering hp to 1 and .cheat power not refilling power (#3299)
This commit is contained in:
@@ -2726,6 +2726,23 @@ void Player::Regenerate(Powers power)
|
||||
if (!maxValue)
|
||||
return;
|
||||
|
||||
//If .cheat power is on always have the max power
|
||||
if (GetCommandStatus(CHEAT_POWER))
|
||||
{
|
||||
if (m_regenTimerCount >= 2000)
|
||||
{
|
||||
//Set the value to 0 first then set it to max to force resend of packet as for range clients keeps removing rage
|
||||
if (power == POWER_RAGE || power == POWER_RUNIC_POWER)
|
||||
{
|
||||
UpdateUInt32Value(UNIT_FIELD_POWER1 + power, 0);
|
||||
}
|
||||
|
||||
SetPower(power, maxValue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint32 curValue = GetPower(power);
|
||||
|
||||
// TODO: possible use of miscvalueb instead of amount
|
||||
@@ -25705,7 +25722,7 @@ void Player::HandleFall(MovementInfo const& movementInfo)
|
||||
|
||||
//Players with low fall distance, Feather Fall or physical immunity (charges used) are ignored
|
||||
// 14.57 can be calculated by resolving damageperc formula below to 0
|
||||
if (z_diff >= 14.57f && !isDead() && !IsGameMaster() &&
|
||||
if (z_diff >= 14.57f && !isDead() && !IsGameMaster() && !GetCommandStatus(CHEAT_GOD) &&
|
||||
!HasAuraType(SPELL_AURA_HOVER) && !HasAuraType(SPELL_AURA_FEATHER_FALL) &&
|
||||
!HasAuraType(SPELL_AURA_FLY))
|
||||
{
|
||||
|
||||
@@ -733,14 +733,19 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage
|
||||
// Signal to pets that their owner was attacked
|
||||
Pet* pet = victim->ToPlayer()->GetPet();
|
||||
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||
if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
|
||||
return 0;
|
||||
|
||||
if (pet && pet->IsAlive())
|
||||
pet->AI()->OwnerAttackedBy(attacker);
|
||||
}
|
||||
|
||||
//Dont deal damage to unit if .cheat god is enable.
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Signal the pet it was attacked so the AI can respond if needed
|
||||
if (victim->GetTypeId() == TYPEID_UNIT && attacker != victim && victim->IsPet() && victim->IsAlive())
|
||||
victim->ToPet()->AI()->AttackedBy(attacker);
|
||||
@@ -5749,14 +5754,22 @@ void Unit::SendSpellNonMeleeReflectLog(SpellNonMeleeDamage* log, Unit* attacker)
|
||||
return;
|
||||
|
||||
WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16 + 4 + 4 + 4 + 1 + 4 + 4 + 1 + 1 + 4 + 4 + 1)); // we guess size
|
||||
//IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
|
||||
uint32 damage = log->damage;
|
||||
uint32 absorb = log->absorb;
|
||||
if (log->target->GetTypeId() == TYPEID_PLAYER && log->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
|
||||
{
|
||||
absorb = damage;
|
||||
damage = 0;
|
||||
}
|
||||
data.append(log->target->GetPackGUID());
|
||||
data.append(attacker->GetPackGUID());
|
||||
data << uint32(log->SpellID);
|
||||
data << uint32(log->damage); // damage amount
|
||||
int32 overkill = log->damage - log->target->GetHealth();
|
||||
data << uint32(damage); // damage amount
|
||||
int32 overkill = damage - log->target->GetHealth();
|
||||
data << uint32(overkill > 0 ? overkill : 0); // overkill
|
||||
data << uint8 (log->schoolMask); // damage school
|
||||
data << uint32(log->absorb); // AbsorbedDamage
|
||||
data << uint32(absorb); // AbsorbedDamage
|
||||
data << uint32(log->resist); // resist
|
||||
data << uint8 (log->physicalLog); // if 1, then client show spell name (example: %s's ranged shot hit %s for %u school or %s suffers %u school damage from %s's spell_name
|
||||
data << uint8 (log->unused); // unused
|
||||
@@ -5769,14 +5782,22 @@ void Unit::SendSpellNonMeleeReflectLog(SpellNonMeleeDamage* log, Unit* attacker)
|
||||
void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage* log)
|
||||
{
|
||||
WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16 + 4 + 4 + 4 + 1 + 4 + 4 + 1 + 1 + 4 + 4 + 1)); // we guess size
|
||||
//IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
|
||||
uint32 damage = log->damage;
|
||||
uint32 absorb = log->absorb;
|
||||
if (log->target->GetTypeId() == TYPEID_PLAYER && log->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
|
||||
{
|
||||
absorb = damage;
|
||||
damage = 0;
|
||||
}
|
||||
data.append(log->target->GetPackGUID());
|
||||
data.append(log->attacker->GetPackGUID());
|
||||
data << uint32(log->SpellID);
|
||||
data << uint32(log->damage); // damage amount
|
||||
int32 overkill = log->damage - log->target->GetHealth();
|
||||
data << uint32(damage); // damage amount
|
||||
int32 overkill = damage - log->target->GetHealth();
|
||||
data << uint32(overkill > 0 ? overkill : 0); // overkill
|
||||
data << uint8 (log->schoolMask); // damage school
|
||||
data << uint32(log->absorb); // AbsorbedDamage
|
||||
data << uint32(absorb); // AbsorbedDamage
|
||||
data << uint32(log->resist); // resist
|
||||
data << uint8 (log->physicalLog); // if 1, then client show spell name (example: %s's ranged shot hit %s for %u school or %s suffers %u school damage from %s's spell_name
|
||||
data << uint8 (log->unused); // unused
|
||||
@@ -5814,7 +5835,6 @@ void Unit::ProcDamageAndSpell(Unit* victim, uint32 procAttacker, uint32 procVict
|
||||
void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo)
|
||||
{
|
||||
AuraEffect const* aura = pInfo->auraEff;
|
||||
|
||||
WorldPacket data(SMSG_PERIODICAURALOG, 30);
|
||||
data.append(GetPackGUID());
|
||||
data.appendPackGUID(aura->GetCasterGUID());
|
||||
@@ -5825,12 +5845,24 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo)
|
||||
{
|
||||
case SPELL_AURA_PERIODIC_DAMAGE:
|
||||
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
|
||||
data << uint32(pInfo->damage); // damage
|
||||
data << uint32(pInfo->overDamage); // overkill?
|
||||
data << uint32(aura->GetSpellInfo()->GetSchoolMask());
|
||||
data << uint32(pInfo->absorb); // absorb
|
||||
data << uint32(pInfo->resist); // resist
|
||||
data << uint8(pInfo->critical); // new 3.1.2 critical tick
|
||||
{
|
||||
//IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
|
||||
uint32 damage = pInfo->damage;
|
||||
uint32 absorb = pInfo->absorb;
|
||||
if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetCommandStatus(CHEAT_GOD))
|
||||
{
|
||||
absorb = damage;
|
||||
damage = 0;
|
||||
}
|
||||
|
||||
|
||||
data << uint32(damage); // damage
|
||||
data << uint32(pInfo->overDamage); // overkill?
|
||||
data << uint32(aura->GetSpellInfo()->GetSchoolMask());
|
||||
data << uint32(absorb); // absorb
|
||||
data << uint32(pInfo->resist); // resist
|
||||
data << uint8(pInfo->critical); // new 3.1.2 critical tick
|
||||
}
|
||||
break;
|
||||
case SPELL_AURA_PERIODIC_HEAL:
|
||||
case SPELL_AURA_OBS_MOD_HEALTH:
|
||||
@@ -5897,28 +5929,37 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo)
|
||||
sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Sending SMSG_ATTACKERSTATEUPDATE");
|
||||
#endif
|
||||
|
||||
//IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
|
||||
uint32 damage = damageInfo->damage;
|
||||
uint32 absorb = damageInfo->absorb;
|
||||
if (damageInfo->target->GetTypeId() == TYPEID_PLAYER && damageInfo->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
|
||||
{
|
||||
absorb = damage;
|
||||
damage = 0;
|
||||
}
|
||||
|
||||
uint32 count = 1;
|
||||
size_t maxsize = 4 + 5 + 5 + 4 + 4 + 1 + 4 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4 + 4 + 4 * 12;
|
||||
WorldPacket data(SMSG_ATTACKERSTATEUPDATE, maxsize); // we guess size
|
||||
data << uint32(damageInfo->HitInfo);
|
||||
data.append(damageInfo->attacker->GetPackGUID());
|
||||
data.append(damageInfo->target->GetPackGUID());
|
||||
data << uint32(damageInfo->damage); // Full damage
|
||||
int32 overkill = damageInfo->damage - damageInfo->target->GetHealth();
|
||||
data << uint32(damage); // Full damage
|
||||
int32 overkill = damage - damageInfo->target->GetHealth();
|
||||
data << uint32(overkill < 0 ? 0 : overkill); // Overkill
|
||||
data << uint8(count); // Sub damage count
|
||||
|
||||
for (uint32 i = 0; i < count; ++i)
|
||||
{
|
||||
data << uint32(damageInfo->damageSchoolMask); // School of sub damage
|
||||
data << float(damageInfo->damage); // sub damage
|
||||
data << uint32(damageInfo->damage); // Sub Damage
|
||||
data << float(damage); // sub damage
|
||||
data << uint32(damage); // Sub Damage
|
||||
}
|
||||
|
||||
if (damageInfo->HitInfo & (HITINFO_FULL_ABSORB | HITINFO_PARTIAL_ABSORB))
|
||||
{
|
||||
for (uint32 i = 0; i < count; ++i)
|
||||
data << uint32(damageInfo->absorb); // Absorb
|
||||
data << uint32(absorb); // Absorb
|
||||
}
|
||||
|
||||
if (damageInfo->HitInfo & (HITINFO_FULL_RESIST | HITINFO_PARTIAL_RESIST))
|
||||
|
||||
@@ -4892,6 +4892,11 @@ SpellCastResult Spell::CheckRuneCost(uint32 RuneCostID)
|
||||
return SPELL_CAST_OK;
|
||||
|
||||
Player* player = m_caster->ToPlayer();
|
||||
//If we are in .cheat power mode we dont need to check the cost as we are expected to be able to use it anyways (infinite power)
|
||||
if (player->GetCommandStatus(CHEAT_POWER))
|
||||
{
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
if (player->getClass() != CLASS_DEATH_KNIGHT)
|
||||
return SPELL_CAST_OK;
|
||||
@@ -6471,6 +6476,16 @@ SpellCastResult Spell::CheckPower()
|
||||
if (m_CastItem)
|
||||
return SPELL_CAST_OK;
|
||||
|
||||
//While .cheat power is enabled dont check if we need power to cast the spell
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_POWER))
|
||||
{
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// health as power used - need check health amount
|
||||
if (m_spellInfo->PowerType == POWER_HEALTH)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user