Over 100 camangos Cata commits applied (to c12950)

Over 100 camangos Cata commits applied. up to and inclusing c12950.
This commit is contained in:
Charles A Edwards 2016-08-20 17:10:24 +01:00 committed by Antz
parent b4ec0440aa
commit eef77eadb9
117 changed files with 4314 additions and 3547 deletions

View file

@ -227,7 +227,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
m_charmInfo->SetReactState(ReactStates(fields[6].GetUInt8()));
uint32 savedhealth = fields[10].GetUInt32();
uint32 savedmana = fields[11].GetUInt32();
uint32 savedpower = fields[11].GetUInt32();
// set current pet as current
// 0=current
@ -274,17 +274,20 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
{
LearnPetPassives();
CastPetAuras(current);
CastOwnerTalentAuras();
}
Powers powerType = GetPowerType();
if (getPetType() == SUMMON_PET && !current) // all (?) summon pets come with full health when called, but not when they are current
{
SetHealth(GetMaxHealth());
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
SetPower(powerType, GetMaxPower(powerType));
}
else
{
SetHealth(savedhealth > GetMaxHealth() ? GetMaxHealth() : savedhealth);
SetPower(POWER_MANA, savedmana > GetMaxPower(POWER_MANA) ? GetMaxPower(POWER_MANA) : savedmana);
SetPower(powerType, savedpower > GetMaxPower(powerType) ? GetMaxPower(powerType) : savedpower);
}
AIM_Initialize();
@ -369,7 +372,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
}
uint32 curhealth = GetHealth();
uint32 curmana = GetPower(POWER_MANA);
uint32 curpower = GetPower(GetPowerType());
// stable and not in slot saves
if (mode != PET_SAVE_AS_CURRENT)
@ -423,7 +426,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
savePet.addString(m_name);
savePet.addUInt32(uint32(HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ? 0 : 1));
savePet.addUInt32((curhealth < 1 ? 1 : curhealth));
savePet.addUInt32(curmana);
savePet.addUInt32(curpower);
std::ostringstream ss;
for (uint32 i = ACTION_BAR_INDEX_START; i < ACTION_BAR_INDEX_END; ++i)
@ -565,20 +568,10 @@ void Pet::RegenerateAll(uint32 update_diff)
// regenerate focus for hunter pets or energy for deathknight's ghoul
if (m_regenTimer <= update_diff)
{
switch (GetPowerType())
{
case POWER_FOCUS:
case POWER_ENERGY:
Regenerate(GetPowerType());
break;
default:
break;
}
if (!IsInCombat() || IsPolymorphed())
RegenerateHealth();
RegenerateMana();
RegeneratePower();
m_regenTimer = 4000;
}
@ -586,43 +579,6 @@ void Pet::RegenerateAll(uint32 update_diff)
m_regenTimer -= update_diff;
}
void Pet::Regenerate(Powers power)
{
uint32 curValue = GetPower(power);
uint32 maxValue = GetMaxPower(power);
if (curValue >= maxValue)
return;
float addvalue = 0.0f;
switch (power)
{
case POWER_FOCUS:
{
// For hunter pets.
addvalue = 24 * sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_FOCUS);
break;
}
case POWER_ENERGY:
{
// For deathknight's ghoul.
addvalue = 20;
break;
}
default:
return;
}
// Apply modifiers (if any).
AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for (AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
if ((*i)->GetModifier()->m_miscvalue == int32(power))
addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f;
ModifyPower(power, (int32)addvalue);
}
bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
{
uint8 activecount = 1;
@ -1060,7 +1016,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner)
UpdateAllStats();
SetHealth(GetMaxHealth());
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
SetPower(GetPowerType(), GetMaxPower(GetPowerType()));
return true;
}
@ -1912,6 +1868,7 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
return;
PetSpellMap::iterator itr = m_spells.find(spellid);
PetSpell& petSpell = itr->second;
uint32 i;
@ -1924,11 +1881,11 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
{
m_autospells.push_back(spellid);
if (itr->second.active != ACT_ENABLED)
if (petSpell.active != ACT_ENABLED)
{
itr->second.active = ACT_ENABLED;
if (itr->second.state != PETSPELL_NEW)
itr->second.state = PETSPELL_CHANGED;
petSpell.active = ACT_ENABLED;
if (petSpell.state != PETSPELL_NEW)
petSpell.state = PETSPELL_CHANGED;
}
}
}
@ -1941,11 +1898,11 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
if (i < m_autospells.size())
{
m_autospells.erase(itr2);
if (itr->second.active != ACT_DISABLED)
if (petSpell.active != ACT_DISABLED)
{
itr->second.active = ACT_DISABLED;
if (itr->second.state != PETSPELL_NEW)
itr->second.state = PETSPELL_CHANGED;
petSpell.active = ACT_DISABLED;
if (petSpell.state != PETSPELL_NEW)
petSpell.state = PETSPELL_CHANGED;
}
}
}
@ -2042,6 +1999,44 @@ void Pet::CastPetAuras(bool current)
}
}
void Pet::CastOwnerTalentAuras()
{
if (!GetOwner() || GetOwner()->GetTypeId() != TYPEID_PLAYER)
return;
Player* pOwner = static_cast<Player*>(GetOwner());
// Handle Ferocious Inspiration Talent
if (pOwner && pOwner->getClass() == CLASS_HUNTER)
{
// clear any existing Ferocious Inspiration auras
RemoveAurasDueToSpell(75593);
RemoveAurasDueToSpell(75446);
RemoveAurasDueToSpell(75447);
if (IsAlive())
{
const SpellEntry* seTalent = pOwner->GetKnownTalentRankById(1800); // Ferocious Inspiration
if (seTalent)
{
switch (seTalent->Id)
{
case 34455: // Ferocious Inspiration Rank 1
CastSpell(this, 75593, true); // Ferocious Inspiration 1%
break;
case 34459: // Ferocious Inspiration Rank 2
CastSpell(this, 75446, true); // Ferocious Inspiration 2%
break;
case 34460: // Ferocious Inspiration Rank 3
CastSpell(this, 75447, true); // Ferocious Inspiration 3%
break;
}
}
}
} // End Ferocious Inspiration Talent
}
void Pet::CastPetAura(PetAura const* aura)
{
uint32 auraId = aura->GetAura(GetEntry());