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: add chat handler methods #23

Merged
merged 1 commit into from
Feb 20, 2022
Merged

Conversation

r-o-b-o-t-o
Copy link
Member

@r-o-b-o-t-o r-o-b-o-t-o commented Feb 9, 2022

  • Adds class ChatHandler
    • GetPlayer()
    • GetSelectedCreature()
    • GetSelectedObject()
    • GetSelectedPlayer()
    • GetSelectedPlayerOrSelf()
    • GetSelectedUnit()
    • HasLowerSecurity()
    • HasLowerSecurityAccount()
    • HasSentErrorMessage()
    • IsAvailable()
    • IsConsole()
    • SendGlobalGMSysMessage()
    • SendGlobalSysMessage()
    • SendSysMessage()
  • Adds ChatHandler argument passed to PLAYER_EVENT_ON_COMMAND hook
    • The arguments are now (event, player, command, chatHandler)
    • Example usage:
local PLAYER_EVENT_ON_COMMAND = 42

RegisterPlayerEvent(PLAYER_EVENT_ON_COMMAND, function(event, player, text, chatHandler)
	if text ~= "testcmd" then
		return true
	end

	if not chatHandler:IsAvailable(3) then
		-- Restrict usage to sec level 3 and higher
		return true
	end

	chatHandler:SendSysMessage("Test command!") -- Gets printed to the chat if ran from a player, and printed to console otherwise
	return false
end)

This PR needs azerothcore/mod-eluna-lua-engine#89

55Honey added a commit to 55Honey/Acore_CarbonCopy that referenced this pull request Feb 10, 2022
55Honey added a commit to 55Honey/Acore_ElunaTest that referenced this pull request Feb 10, 2022
55Honey added a commit to 55Honey/Acore_eventScripts that referenced this pull request Feb 10, 2022
55Honey added a commit to 55Honey/Acore_RecruitAFriend that referenced this pull request Feb 10, 2022
55Honey added a commit to 55Honey/Acore_SendAndBind that referenced this pull request Feb 10, 2022
@r-o-b-o-t-o
Copy link
Member Author

Must be merged at the same time as azerothcore/mod-eluna-lua-engine#89

@55Honey
Copy link
Member

55Honey commented Feb 19, 2022

Tested with 55Honey/Acore_SendAndBind#6 and 55Honey/Acore_ElunaTest#3
Works like a charm.

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.

3 participants