mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-14 22:19:25 +01:00
Scripts/Player: Add OnMapChanged to PlayerScripts (after map changed)
Core/Dungeon Finder: Use OnMapChanged script to cast/remove Luck of the draw - Also move code to force party update to LfgPlayerScript - Remove some obsolete Lfg code after recent commits
This commit is contained in:
@@ -1707,66 +1707,6 @@ class spell_gen_damage_reduction_aura : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
class spell_gen_luck_of_the_draw : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_luck_of_the_draw() : SpellScriptLoader("spell_gen_luck_of_the_draw") { }
|
||||
|
||||
class spell_gen_luck_of_the_draw_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_luck_of_the_draw_AuraScript);
|
||||
Map const* map;
|
||||
Difficulty difficulty;
|
||||
|
||||
bool Load()
|
||||
{
|
||||
Player* owner = GetUnitOwner()->ToPlayer();
|
||||
if (!owner)
|
||||
return false;
|
||||
|
||||
Group* group = owner->GetGroup();
|
||||
if (!group || !group->isLFGGroup())
|
||||
return false;
|
||||
|
||||
if (!sLFGMgr->selectedRandomLfgDungeon(owner->GetGUID()))
|
||||
return false;
|
||||
|
||||
map = owner->GetMap();
|
||||
difficulty = owner->GetMap()->GetDifficulty();
|
||||
|
||||
if (!sLFGMgr->inLfgDungeonMap(owner->GetGUID(), map->GetId(), difficulty))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// cheap hax to make it have update calls
|
||||
void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude)
|
||||
{
|
||||
isPeriodic = true;
|
||||
amplitude = 5 * IN_MILLISECONDS;
|
||||
}
|
||||
|
||||
void Update(AuraEffect* /*effect*/)
|
||||
{
|
||||
Map const* currentMap = GetUnitOwner()->ToPlayer()->GetMap();
|
||||
if (currentMap != map || currentMap->GetDifficulty() != difficulty)
|
||||
Remove(AURA_REMOVE_BY_DEFAULT);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_gen_luck_of_the_draw_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_luck_of_the_draw_AuraScript::Update, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_gen_luck_of_the_draw_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum DummyTrigger
|
||||
{
|
||||
SPELL_PERSISTANT_SHIELD_TRIGGERED = 26470,
|
||||
@@ -3608,7 +3548,6 @@ void AddSC_generic_spell_scripts()
|
||||
new spell_gen_vehicle_scaling();
|
||||
new spell_gen_oracle_wolvar_reputation();
|
||||
new spell_gen_damage_reduction_aura();
|
||||
new spell_gen_luck_of_the_draw();
|
||||
new spell_gen_dummy_trigger();
|
||||
new spell_gen_spirit_healer_res();
|
||||
new spell_gen_gadgetzan_transporter_backfire();
|
||||
|
||||
Reference in New Issue
Block a user