mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 01:15:35 +01:00
Scripts/Guilds: fixed Cauldron of Battle, Big Cauldron of Battle and their Flask effect
This commit is contained in:
10
sql/updates/world/4.3.4/2020_04_23_01_world.sql
Normal file
10
sql/updates/world/4.3.4/2020_04_23_01_world.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName` IN
|
||||
('spell_gen_cauldron_of_battle',
|
||||
'spell_gen_flask_of_battle');
|
||||
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(92649, 'spell_gen_cauldron_of_battle'),
|
||||
(92712, 'spell_gen_cauldron_of_battle'),
|
||||
(92679, 'spell_gen_flask_of_battle');
|
||||
|
||||
UPDATE `gameobject_template` SET `ScriptName`= 'go_cauldron_of_battle' WHERE `entry` IN (207354, 207357, 207356, 207358);
|
||||
@@ -5267,6 +5267,7 @@ enum MobileBanking
|
||||
SPELL_GUILD_CHEST_ALLIANCE = 88304
|
||||
};
|
||||
|
||||
// 83958 - Mobile Banking
|
||||
class spell_gen_mobile_banking : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_mobile_banking);
|
||||
@@ -5307,6 +5308,143 @@ class spell_gen_mobile_banking : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
// 92649 - Cauldron of Battle
|
||||
// 92712 - Big Cauldron of Battle
|
||||
class spell_gen_cauldron_of_battle : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_cauldron_of_battle);
|
||||
|
||||
bool Load() override
|
||||
{
|
||||
return GetCaster()->IsPlayer();
|
||||
}
|
||||
|
||||
void HandleDummyEffect(SpellEffIndex effIndex)
|
||||
{
|
||||
Player* target = GetHitPlayer();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
bool handleEffect = false;
|
||||
|
||||
// EFFECT_0 = Alliance Cauldron, EFFECT_1 = Horde Cauldron
|
||||
if ((effIndex == EFFECT_0 && target->GetTeamId() == TEAM_ALLIANCE) ||
|
||||
(effIndex == EFFECT_1 && target->GetTeamId() == TEAM_HORDE))
|
||||
handleEffect = true;
|
||||
|
||||
if (handleEffect)
|
||||
{
|
||||
Position dest = target->GetPosition();
|
||||
uint32 spellId = GetEffectValue();
|
||||
|
||||
if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellId))
|
||||
{
|
||||
float radius = spell->Effects[EFFECT_0].CalcRadius(target) - target->GetCombatReach();
|
||||
target->GetNearPoint(target, dest.m_positionX, dest.m_positionY, dest.m_positionZ, radius, target->GetOrientation());
|
||||
target->CastSpell(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), spellId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_cauldron_of_battle::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_cauldron_of_battle::HandleDummyEffect, EFFECT_1, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
enum FlaskOfBattle
|
||||
{
|
||||
// According to WoWHead comments the Flask of Flowing Waters effect is not being used for healers
|
||||
SPELL_FLASK_OF_STEELSKIN = 79469,
|
||||
SPELL_FLASK_OF_TITANIC_STRENGTH = 79472,
|
||||
SPELL_FLASK_OF_THE_WINDS = 79471,
|
||||
SPELL_FLASK_OF_DRACONIC_MIND = 79470,
|
||||
};
|
||||
|
||||
// 92679 - Flask of Battle
|
||||
class spell_gen_flask_of_battle : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_flask_of_battle);
|
||||
|
||||
bool Load() override
|
||||
{
|
||||
return GetCaster()->IsPlayer();
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo(
|
||||
{
|
||||
SPELL_FLASK_OF_STEELSKIN,
|
||||
SPELL_FLASK_OF_TITANIC_STRENGTH,
|
||||
SPELL_FLASK_OF_THE_WINDS,
|
||||
SPELL_FLASK_OF_DRACONIC_MIND
|
||||
});
|
||||
}
|
||||
|
||||
void HandleBuffEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* player = GetHitPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
uint32 spellId = 0;
|
||||
|
||||
uint32 primaryTalentTree = player->GetPrimaryTalentTree(player->GetActiveSpec());
|
||||
switch (player->getClass())
|
||||
{
|
||||
case CLASS_WARLOCK:
|
||||
case CLASS_MAGE:
|
||||
case CLASS_PRIEST:
|
||||
spellId = SPELL_FLASK_OF_DRACONIC_MIND;
|
||||
break;
|
||||
case CLASS_ROGUE:
|
||||
case CLASS_HUNTER:
|
||||
spellId = SPELL_FLASK_OF_THE_WINDS;
|
||||
break;
|
||||
case CLASS_DRUID:
|
||||
if (primaryTalentTree == TALENT_TREE_DRUID_FERAL_COMBAT)
|
||||
{
|
||||
if (player->GetShapeshiftForm() == FORM_BEAR)
|
||||
spellId = SPELL_FLASK_OF_STEELSKIN;
|
||||
else
|
||||
spellId = SPELL_FLASK_OF_THE_WINDS;
|
||||
}
|
||||
else
|
||||
spellId = SPELL_FLASK_OF_DRACONIC_MIND;
|
||||
break;
|
||||
case CLASS_SHAMAN:
|
||||
spellId = primaryTalentTree == TALENT_TREE_SHAMAN_ENHANCEMENT ? SPELL_FLASK_OF_THE_WINDS : SPELL_FLASK_OF_DRACONIC_MIND;
|
||||
break;
|
||||
case CLASS_WARRIOR:
|
||||
spellId = primaryTalentTree == TALENT_TREE_WARRIOR_PROTECTION ? SPELL_FLASK_OF_STEELSKIN : SPELL_FLASK_OF_TITANIC_STRENGTH;
|
||||
break;
|
||||
case CLASS_DEATH_KNIGHT:
|
||||
spellId = primaryTalentTree == TALENT_TREE_DEATH_KNIGHT_BLOOD ? SPELL_FLASK_OF_STEELSKIN : SPELL_FLASK_OF_TITANIC_STRENGTH;
|
||||
break;
|
||||
case CLASS_PALADIN:
|
||||
if (primaryTalentTree == TALENT_TREE_PALADIN_HOLY)
|
||||
spellId = SPELL_FLASK_OF_DRACONIC_MIND;
|
||||
else if (primaryTalentTree == TALENT_TREE_PALADIN_PROTECTION)
|
||||
spellId = SPELL_FLASK_OF_STEELSKIN;
|
||||
else
|
||||
spellId = SPELL_FLASK_OF_TITANIC_STRENGTH;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (spellId)
|
||||
player->CastSpell(player, spellId);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_flask_of_battle::HandleBuffEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_generic_spell_scripts()
|
||||
{
|
||||
new spell_gen_absorb0_hitlimit1();
|
||||
@@ -5433,4 +5571,6 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterAuraScript(spell_gen_guild_battle_standard);
|
||||
RegisterSpellScript(spell_gen_guild_battle_standard_buff);
|
||||
RegisterSpellScript(spell_gen_mobile_banking);
|
||||
RegisterSpellScript(spell_gen_cauldron_of_battle);
|
||||
RegisterSpellScript(spell_gen_flask_of_battle);
|
||||
}
|
||||
|
||||
@@ -1914,6 +1914,34 @@ struct go_generic_firework : public GameObjectAI
|
||||
}
|
||||
};
|
||||
|
||||
enum CauldronOfBattle
|
||||
{
|
||||
SPELL_HAPPY_HOUR = 83963
|
||||
};
|
||||
|
||||
struct go_cauldron_of_battle : public GameObjectAI
|
||||
{
|
||||
go_cauldron_of_battle(GameObject* go) : GameObjectAI(go) { }
|
||||
|
||||
void JustAppeared() override
|
||||
{
|
||||
Unit* owner = me->GetOwner();
|
||||
if (!owner)
|
||||
return;
|
||||
|
||||
if (!owner->GetAuraEffect(SPELL_HAPPY_HOUR, EFFECT_0))
|
||||
{
|
||||
/*
|
||||
Happy Hour increases the amount of charges by 50% but we have to invert the logic
|
||||
because the gameobject data uses the increased charge amount as base value. Just Blizzard things.
|
||||
*/
|
||||
uint32 charges = me->GetGOInfo()->GetCharges();
|
||||
charges -= CalculatePct(charges, 34);
|
||||
me->SetCharges(charges);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_go_scripts()
|
||||
{
|
||||
new go_cat_figurine();
|
||||
@@ -1956,4 +1984,5 @@ void AddSC_go_scripts()
|
||||
new go_pirate_day_music();
|
||||
new go_bells();
|
||||
RegisterGameObjectAI(go_generic_firework);
|
||||
RegisterGameObjectAI(go_cauldron_of_battle);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user