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

Add Method to Player: SetGlyph #152

Closed Tralenor closed 1 year ago

Tralenor commented 1 year ago

Adds a Method to the Lua Player Object which allows to set Glyphs for the current TalentGroup/Spec

Compiles: yes Tested: yes

Test Instructions/example Usage:

  1. Create/Use a Paladin (works with every class, but the Glyphs I use in this example are for Paladin)
  2. add the following lua example to your lua_scripts folder:
    
    local function OnPlayerCommand(event, player, command)
    if (command == "add_glyph") then
        print("reached_command: add glyph")
        player:SetGlyph(190,0)
        player:SetGlyph(702,3)
        return false
    end
    end

RegisterPlayerEvent(42, OnPlayerCommand)



3. go ingame, write command .add_glyphs - go to TalentUI, section Glyphs: 2 Glyphs have been set into slot 0 and 3
4. (optional) you can log out and login again if you wan to check if they are persisted in the database.
55Honey commented 1 year ago

wtb player:GetGlyph( $glyph, $slot ) :)

kissingers commented 3 months ago

Wtbplayer:GetGlyph( $glyph, $slot ) :)

can update? I am not know how push the pr

PlayerMethods.h int GetGlyph(lua_State L, Player player) { uint8 slot = Eluna::CHECKVAL(L, 2); Eluna::Push(L, player->GetGlyph(slot)); return 1; }

LuaFunctions.cpp player { "GetGlyph", &LuaPlayer::GetGlyph },

        for i = 1, 6 do
            PlayerGlyph[PGuid][i] = player:GetGlyph(i - 1)
        end