mod-eluna icon indicating copy to clipboard operation
mod-eluna copied to clipboard

[Issue] Method Global:RegisterPlayerEvent apply and remove aura

Open Cloticc opened this issue 1 year ago • 3 comments

azerothcore Two of the events not working. I don't think I am doing anything wrong even tried using the aura in different ways https://www.azerothcore.org/pages/eluna/Global/RegisterPlayerEvent.html PLAYER_EVENT_ON_APPLY_AURA = 57, // (event, player, aura, isNewAura) PLAYER_EVENT_ON_REMOVE_AURA = 58, // (event, player, aura, isExpired)

local voidSpell                   = 168

local PLAYER_EVENT_ON_APPLY_AURA  = 57 --,       // (event, player, aura, isNewAura)
local PLAYER_EVENT_ON_REMOVE_AURA = 58 --,       // (event, player, aura, isExpired)



local function OnApplyAura(event, player, aura, isNewAura)
    print("FUNCTION START")
    if aura:GetAuraId() == voidSpell then
        print("is this on?")
        player:SetFaction(14)
        player:SetPvP(true) -- Enable PvP
    end
    print("FUNCTION END")
end

local function OnRemoveAura(event, player, aura, isExpired)
    print("FUNCTION START")
    if aura:GetAuraId() == voidSpell then
        player:SetFaction(player:GetTeam()) -- Set faction back to original faction
        player:SetPvP(false)                -- Disable PvP
    end
    print("FUNCTION END")
end


RegisterPlayerEvent(PLAYER_EVENT_ON_APPLY_AURA, OnApplyAura)
RegisterPlayerEvent(PLAYER_EVENT_ON_REMOVE_AURA, OnRemoveAura)

Cloticc avatar May 31 '23 13:05 Cloticc

See https://github.com/azerothcore/mod-eluna/pull/137#issuecomment-1570618252, the events weren't implemented properly, probably imported from a fork of AC that has aura hooks in the PlayerScript.

r-o-b-o-t-o avatar May 31 '23 17:05 r-o-b-o-t-o

ah, that makes sense now then u probably should remove them from Eluna API Documentation so more people don't ask why it's not working :D

Cloticc avatar Jun 01 '23 09:06 Cloticc

Yep, will do as soon as I can

r-o-b-o-t-o avatar Jun 01 '23 09:06 r-o-b-o-t-o