leonardopsantos / LunarSphere

Modular sphere addon for all classes.
1 stars 4 forks source link

Fix for speech #5

Closed speedwaystar closed 2 years ago

speedwaystar commented 3 years ago

`function Lunar.Speech.OnEvent(self, event, unit, target, castGUID, spellID)

-- Ignore all spells that are not from the player

if (unit ~= "player") then
    return;
end

-- If the player starts to cast a spell, notate that a spell is being cast
-- and grab the currently active spell of the player. This is needed in 
-- order to catch spells that have a cast time.

if (event == "UNIT_SPELLCAST_SENT") then
    self.spellName, self.spellRank = GetSpellInfo(spellID);
    self.spellTarget = target;

    -- If the target data doesn't exist, grab it from the player target if possible
    if ((not target or (target == "")) and UnitName("target")) then
        self.spellTarget = UnitName("target") or ("");
    end
end

if (event == "UNIT_SPELLCAST_START") then

    self.spellStart = true;
    Lunar.Speech.CheckCurrentAction(self);

-- If the player stops casting a spell, clear the spellStart flag

elseif (event == "UNIT_SPELLCAST_STOP") then

    self.spellStart = nil;

-- If the player successfully casts a spell and they didn't have a spell
-- start event (due to it being an instant spell), check the current
-- spell for speeches

elseif (event == "UNIT_SPELLCAST_SUCCEEDED") and not (self.spellStart) then

    Lunar.Speech.CheckCurrentAction(self);

end`
speedwaystar commented 3 years ago

if you're wondering what this fixes: output from the speech tab failed because it relied on OnEvent values to detect spell/item use which were several API revisions out of date.

leonardopsantos commented 2 years ago

Closing this as the patch was applied in 1.54.