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

Feat(LuaEngine/PlayerMethods): Add GetHomebind, GetSpells and TeleportTo #232

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

iThorgrim
Copy link

This pull request introduces 3 new methods to the Player class in mod-Eluna, enabling developers to retrieve all player learned spell, teleport player with teleport name or get player homebind.

New Methods

  1. GetSpells: Retrieve a list of all spells known by a player.
  2. GetHomebind: Access the player’s homebind location.
  3. TeleportTo: Teleport a player to a predefined location (game_tele table).

Code Highlights

Example: Get All Player Learned Spells

local spells = player:GetSpells()

for _, spell_id in pairs(spells) do
  print("Learned Spell", spell_id)
end

Example: Retrieving Player Homebind position

local player_homebind = player:GetHomebind()
print("Player Homebind", player_homebind.mapId , player_homebind.x, player_homebind.y, player_homebind.z)

Example: Teleport Player To Specific GameTele

player:TeleportTo("Stormwind")

Test performed :

local function OnPlayerLogin(event, player)
    local spells = player:GetSpells()

    for _, spell_id in pairs(spells) do
      print("Learned Spell", spell_id)
    end

    local player_homebind = player:GetHomebind()
    print("Player Homebind", player_homebind.mapId , player_homebind.x, player_homebind.y, player_homebind.z)

    player:TeleportTo("Stormwind")
end
RegisterPlayerEvent(3, OnPlayerLogin)

Results:
image

Desktop.2025-01-24.18-30-33.mp4


player->TeleportTo(game_tele->mapId, game_tele->position_x, game_tele->position_y, game_tele->position_z, game_tele->orientation);
return 0;
}
};
#endif
Copy link
Member

Choose a reason for hiding this comment

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

missing new line

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.

2 participants