Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Method to Player: SetGlyph #152

Merged
merged 9 commits into from
Aug 7, 2023
Merged

Conversation

Tralenor
Copy link

@Tralenor Tralenor commented Aug 5, 2023

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)
  1. go ingame, write command .add_glyphs - go to TalentUI, section Glyphs: 2 Glyphs have been set into slot 0 and 3
  2. (optional) you can log out and login again if you wan to check if they are persisted in the database.

Copy link
Member

@55Honey 55Honey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR! Please have a look at my comment.

src/LuaEngine/LuaFunctions.cpp Outdated Show resolved Hide resolved
src/LuaEngine/LuaFunctions.cpp Outdated Show resolved Hide resolved
src/LuaEngine/PlayerMethods.h Outdated Show resolved Hide resolved
src/LuaEngine/PlayerMethods.h Outdated Show resolved Hide resolved
src/LuaEngine/PlayerMethods.h Outdated Show resolved Hide resolved
src/LuaEngine/PlayerMethods.h Outdated Show resolved Hide resolved
src/LuaEngine/PlayerMethods.h Outdated Show resolved Hide resolved
Tralenor and others added 6 commits August 7, 2023 08:13
Co-authored-by: Axel Cocat <ax.cocat@gmail.com>
Co-authored-by: Axel Cocat <ax.cocat@gmail.com>
Co-authored-by: Axel Cocat <ax.cocat@gmail.com>
Co-authored-by: Axel Cocat <ax.cocat@gmail.com>
Co-authored-by: Axel Cocat <ax.cocat@gmail.com>
Co-authored-by: Axel Cocat <ax.cocat@gmail.com>
uint32 slotIndex = Eluna::CHECKVAL<uint32>(L, 3);

player->SetGlyph(slotIndex, glyphId, !player->GetSession()->PlayerLoading());
#if (!defined(TBC) && !defined(CLASSIC))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The #if isn't required, since mod-eluna is only for wotlk as inAC 3.3.5.
I'm sure Eluna master would appreciate the expansion dependencies, but we haven't added any to our customisations, so I don't think we should start now.

@r-o-b-o-t-o r-o-b-o-t-o merged commit 510eb1d into azerothcore:master Aug 7, 2023
1 check passed
r-o-b-o-t-o added a commit that referenced this pull request Aug 7, 2023
@55Honey
Copy link
Member

55Honey commented Aug 8, 2023

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

@kissingers
Copy link

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

@Tralenor Tralenor mentioned this pull request Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants