diff --git a/MiscTools/FlightHandler2.lua b/MiscTools/FlightHandler2.lua new file mode 100644 index 0000000..62b6dd7 --- /dev/null +++ b/MiscTools/FlightHandler2.lua @@ -0,0 +1,36 @@ +local AURA_ID = 100225 +local TRIGGER_SPELLS = {100211, 100213, 100214} +local CAST_SPELLS = {100210, 100218, 100219, 100220} +local CAST_SPELL_ID = 69669 + +local function tableContains(table, element) + for _, value in pairs(table) do + if value == element then + return true + end + end + return false +end + +local function CheckAuraStacksAndCast(player, auraId, triggerSpells, castSpellId) + if player:HasAura(auraId) then + local aura = player:GetAura(auraId) + local stacks = aura:GetStackAmount() + if stacks >= 3 then + player:CastSpell(player, castSpellId, true) + end + end +end + +local function OnSpellCast(event, player, spell, skipCheck) + local spellId = spell:GetEntry() + if tableContains(TRIGGER_SPELLS, spellId) then + CheckAuraStacksAndCast(player, AURA_ID, TRIGGER_SPELLS, CAST_SPELL_ID) + elseif tableContains(CAST_SPELLS, spellId) then + if player:HasAura(AURA_ID) then + player:RemoveAura(AURA_ID) + end + end +end + +RegisterPlayerEvent(5, OnSpellCast) diff --git a/MiscTools/Murky.lua b/MiscTools/Murky.lua index 8a33dc9..02a22bb 100644 --- a/MiscTools/Murky.lua +++ b/MiscTools/Murky.lua @@ -1,5 +1,10 @@ function MurkyOnSpawn(event, creature) - local playerName = creature:GetOwner():GetName() +local owner = creature:GetOwner() +if not owner then + return +end +local playerName = owner:GetName() + local dialogue = { "Mrglglglgl! Murky here, reporting for duty!", "Mrrrrrrrglglglgl! Murky happy to serve you, " .. playerName .. "!",