Core/Dungeon Finder: Implemented Luck of the Draw buff
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_gen_luck_of_the_draw';
|
||||||
|
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
|
||||||
|
(72221,'spell_gen_luck_of_the_draw');
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "MapManager.h"
|
#include "MapManager.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
|
#include "LFGMgr.h"
|
||||||
|
|
||||||
union u_map_magic
|
union u_map_magic
|
||||||
{
|
{
|
||||||
@@ -2318,6 +2319,13 @@ bool InstanceMap::AddPlayerToMap(Player* player)
|
|||||||
ASSERT(playerBind->save == mapSave);
|
ASSERT(playerBind->save == mapSave);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (group && group->isLFGGroup())
|
||||||
|
if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true))
|
||||||
|
if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
|
||||||
|
if (LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin())))
|
||||||
|
if (dungeon->map == GetId() && dungeon->difficulty == GetDifficulty() && randomDungeon->type == LFG_TYPE_RANDOM)
|
||||||
|
player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// for normal instances cancel the reset schedule when the
|
// for normal instances cancel the reset schedule when the
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
#include "SpellAuraEffects.h"
|
#include "SpellAuraEffects.h"
|
||||||
#include "SkillDiscovery.h"
|
#include "SkillDiscovery.h"
|
||||||
#include "GridNotifiers.h"
|
#include "GridNotifiers.h"
|
||||||
|
#include "Group.h"
|
||||||
|
#include "LFGMgr.h"
|
||||||
|
|
||||||
class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader
|
class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader
|
||||||
{
|
{
|
||||||
@@ -1419,6 +1421,53 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
// 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*/)
|
||||||
|
{
|
||||||
|
if (GetUnitOwner()->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
return;
|
||||||
|
|
||||||
|
LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*(sLFGMgr->GetSelectedDungeons(GetUnitOwner()->GetGUID()).begin()));
|
||||||
|
Group* group = GetUnitOwner()->ToPlayer()->GetGroup();
|
||||||
|
Map const* map = GetUnitOwner()->GetMap();
|
||||||
|
if (group && group->isLFGGroup())
|
||||||
|
if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true))
|
||||||
|
if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
|
||||||
|
if (dungeon->map == map->GetId() && dungeon->difficulty == map->GetDifficulty())
|
||||||
|
if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM)
|
||||||
|
return; // in correct dungeon
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void AddSC_generic_spell_scripts()
|
void AddSC_generic_spell_scripts()
|
||||||
{
|
{
|
||||||
new spell_gen_absorb0_hitlimit1();
|
new spell_gen_absorb0_hitlimit1();
|
||||||
@@ -1451,4 +1500,5 @@ void AddSC_generic_spell_scripts()
|
|||||||
new spell_gen_vehicle_scaling();
|
new spell_gen_vehicle_scaling();
|
||||||
new spell_gen_oracle_wolvar_reputation();
|
new spell_gen_oracle_wolvar_reputation();
|
||||||
new spell_gen_damage_reduction_aura();
|
new spell_gen_damage_reduction_aura();
|
||||||
|
new spell_gen_luck_of_the_draw();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user