azerothcore / mod-eluna

Eluna Lua Engine © for WoW Emulators
https://elunaluaengine.github.io/
GNU General Public License v3.0
96 stars 126 forks source link

[Issue] Method Global:RegisterPlayerEvent apply and remove aura #144

Open Cloticc opened 1 year ago

Cloticc commented 1 year ago

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)
r-o-b-o-t-o commented 1 year ago

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.

Cloticc commented 1 year ago

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

r-o-b-o-t-o commented 1 year ago

Yep, will do as soon as I can