mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-17 21:50:50 -04:00
Better way to fix some of the warnings of the previous commit
This commit is contained in:
@@ -253,7 +253,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
else
|
||||
{
|
||||
SetHealth(savedhealth > GetMaxHealth() ? GetMaxHealth() : savedhealth);
|
||||
SetPower(POWER_MANA, savedmana > GetMaxPower(POWER_MANA) ? GetMaxPower(POWER_MANA) : savedmana);
|
||||
SetPower(POWER_MANA, savedmana > uint32(GetMaxPower(POWER_MANA)) ? GetMaxPower(POWER_MANA) : savedmana);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2384,7 +2384,7 @@ void Player::ProcessDelayedOperations()
|
||||
else
|
||||
SetFullHealth();
|
||||
|
||||
if (GetMaxPower(POWER_MANA) > m_resurrectMana)
|
||||
if (uint32(GetMaxPower(POWER_MANA)) > m_resurrectMana)
|
||||
SetPower(POWER_MANA, m_resurrectMana);
|
||||
else
|
||||
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
|
||||
@@ -23174,7 +23174,7 @@ void Player::ResurectUsingRequestData()
|
||||
else
|
||||
SetFullHealth();
|
||||
|
||||
if (GetMaxPower(POWER_MANA) > m_resurrectMana)
|
||||
if (uint32(GetMaxPower(POWER_MANA)) > m_resurrectMana)
|
||||
SetPower(POWER_MANA, m_resurrectMana);
|
||||
else
|
||||
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
|
||||
|
||||
@@ -5701,7 +5701,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
return false;
|
||||
|
||||
// mana reward
|
||||
basepoints0 = CalculatePctN(int32(GetMaxPower(POWER_MANA)), triggerAmount);
|
||||
basepoints0 = CalculatePctN(GetMaxPower(POWER_MANA), triggerAmount);
|
||||
target = this;
|
||||
triggered_spell_id = 29442;
|
||||
break;
|
||||
@@ -11440,7 +11440,7 @@ int32 Unit::ModifyPower(Powers power, int32 dVal)
|
||||
if (dVal == 0)
|
||||
return 0;
|
||||
|
||||
int32 curPower = (int32)GetPower(power);
|
||||
int32 curPower = GetPower(power);
|
||||
|
||||
int32 val = dVal + curPower;
|
||||
if (val <= GetMinPower(power))
|
||||
@@ -11449,7 +11449,7 @@ int32 Unit::ModifyPower(Powers power, int32 dVal)
|
||||
return -curPower;
|
||||
}
|
||||
|
||||
int32 maxPower = (int32)GetMaxPower(power);
|
||||
int32 maxPower = GetMaxPower(power);
|
||||
|
||||
if (val < maxPower)
|
||||
{
|
||||
@@ -11471,7 +11471,7 @@ int32 Unit::ModifyPowerPct(Powers power, float pct, bool apply)
|
||||
float amount = (float)GetMaxPower(power);
|
||||
ApplyPercentModFloatVar(amount, pct, apply);
|
||||
|
||||
return ModifyPower(power, (int32)amount - (int32)GetMaxPower(power));
|
||||
return ModifyPower(power, (int32)amount - GetMaxPower(power));
|
||||
}
|
||||
|
||||
bool Unit::IsAlwaysVisibleFor(WorldObject const* seer) const
|
||||
@@ -13007,13 +13007,13 @@ int32 Unit::GetPower(Powers power) const
|
||||
return GetUInt32Value(UNIT_FIELD_POWER1 + powerIndex);
|
||||
}
|
||||
|
||||
uint32 Unit::GetMaxPower(Powers power) const
|
||||
int32 Unit::GetMaxPower(Powers power) const
|
||||
{
|
||||
uint32 powerIndex = GetPowerIndexByClass(power, getClass());
|
||||
if (powerIndex == MAX_POWERS)
|
||||
return 0;
|
||||
|
||||
return GetUInt32Value(UNIT_FIELD_MAXPOWER1 + powerIndex);
|
||||
return GetInt32Value(UNIT_FIELD_MAXPOWER1 + powerIndex);
|
||||
}
|
||||
|
||||
void Unit::SetPower(Powers power, int32 val)
|
||||
|
||||
@@ -1345,7 +1345,7 @@ class Unit : public WorldObject
|
||||
void setPowerType(Powers power);
|
||||
int32 GetPower(Powers power) const;
|
||||
int32 GetMinPower(Powers power) const { return power == POWER_ECLIPSE ? -100 : 0; }
|
||||
uint32 GetMaxPower(Powers power) const;
|
||||
int32 GetMaxPower(Powers power) const;
|
||||
void SetPower(Powers power, int32 val);
|
||||
void SetMaxPower(Powers power, int32 val);
|
||||
// returns the change in power
|
||||
|
||||
@@ -6613,7 +6613,7 @@ void AuraEffect::HandleObsModPowerAuraTick(Unit* target, Unit* caster) const
|
||||
}
|
||||
|
||||
// don't regen when permanent aura target has full power
|
||||
if (GetBase()->IsPermanent() && uint32(target->GetPower(powerType)) == target->GetMaxPower(powerType))
|
||||
if (GetBase()->IsPermanent() && target->GetPower(powerType) == target->GetMaxPower(powerType))
|
||||
return;
|
||||
|
||||
// ignore negative values (can be result apply spellmods to aura damage
|
||||
@@ -6644,7 +6644,7 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons
|
||||
}
|
||||
|
||||
// don't regen when permanent aura target has full power
|
||||
if (GetBase()->IsPermanent() && uint32(target->GetPower(powerType)) == target->GetMaxPower(powerType))
|
||||
if (GetBase()->IsPermanent() && target->GetPower(powerType) == target->GetMaxPower(powerType))
|
||||
return;
|
||||
|
||||
// ignore negative values (can be result apply spellmods to aura damage
|
||||
|
||||
@@ -5874,7 +5874,7 @@ SpellCastResult Spell::CheckItems()
|
||||
}
|
||||
|
||||
Powers power = Powers(m_spellInfo->Effects[i].MiscValue);
|
||||
if (uint32(m_targets.GetUnitTarget()->GetPower(power)) == m_targets.GetUnitTarget()->GetMaxPower(power))
|
||||
if (m_targets.GetUnitTarget()->GetPower(power) == m_targets.GetUnitTarget()->GetMaxPower(power))
|
||||
{
|
||||
failReason = SPELL_FAILED_ALREADY_AT_FULL_POWER;
|
||||
continue;
|
||||
|
||||
@@ -770,7 +770,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
if (int32(m_int_configs[CONFIG_START_PLAYER_MONEY]) < 0)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0.." UI64FMTD ". Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0);
|
||||
m_int_configs[CONFIG_START_PLAYER_MONEY] = 0;
|
||||
m_int_configs[CONFIG_START_PLAYER_MONEY] = 0;
|
||||
}
|
||||
else if (m_int_configs[CONFIG_START_PLAYER_MONEY] > 0x7FFFFFFF-1) // TODO: (See MAX_MONEY_AMOUNT)
|
||||
{
|
||||
|
||||
@@ -112,7 +112,7 @@ class boss_moam : public CreatureScript
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (uint32(me->GetPower(POWER_MANA)) == me->GetMaxPower(POWER_MANA))
|
||||
if (me->GetPower(POWER_MANA) == me->GetMaxPower(POWER_MANA))
|
||||
{
|
||||
if (_isStonePhase)
|
||||
DoAction(ACTION_STONE_PHASE_END);
|
||||
|
||||
@@ -406,7 +406,7 @@ class boss_deathbringer_saurfang : public CreatureScript
|
||||
case 72444:
|
||||
case 72445:
|
||||
case 72446:
|
||||
if (uint32(me->GetPower(POWER_ENERGY)) != me->GetMaxPower(POWER_ENERGY))
|
||||
if (me->GetPower(POWER_ENERGY) != me->GetMaxPower(POWER_ENERGY))
|
||||
target->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, 1, me, true);
|
||||
break;
|
||||
default:
|
||||
@@ -1039,7 +1039,7 @@ class spell_deathbringer_blood_link_aura : public SpellScriptLoader
|
||||
void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
if (GetUnitOwner()->getPowerType() == POWER_ENERGY && uint32(GetUnitOwner()->GetPower(POWER_ENERGY)) == GetUnitOwner()->GetMaxPower(POWER_ENERGY))
|
||||
if (GetUnitOwner()->getPowerType() == POWER_ENERGY && GetUnitOwner()->GetPower(POWER_ENERGY) == GetUnitOwner()->GetMaxPower(POWER_ENERGY))
|
||||
if (Creature* saurfang = GetUnitOwner()->ToCreature())
|
||||
saurfang->AI()->DoAction(ACTION_MARK_OF_THE_FALLEN_CHAMPION);
|
||||
}
|
||||
@@ -1131,7 +1131,7 @@ class spell_deathbringer_rune_of_blood : public SpellScriptLoader
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex); // make this the default handler
|
||||
if (uint32(GetCaster()->GetPower(POWER_ENERGY)) != GetCaster()->GetMaxPower(POWER_ENERGY))
|
||||
if (GetCaster()->GetPower(POWER_ENERGY) != GetCaster()->GetMaxPower(POWER_ENERGY))
|
||||
GetHitUnit()->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, 1, GetCaster(), true);
|
||||
}
|
||||
|
||||
@@ -1166,7 +1166,7 @@ class spell_deathbringer_blood_nova : public SpellScriptLoader
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex); // make this the default handler
|
||||
if (uint32(GetCaster()->GetPower(POWER_ENERGY)) != GetCaster()->GetMaxPower(POWER_ENERGY))
|
||||
if (GetCaster()->GetPower(POWER_ENERGY) != GetCaster()->GetMaxPower(POWER_ENERGY))
|
||||
GetHitUnit()->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, 2, GetCaster(), true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user