Add role message on login. (#7)

This commit is contained in:
salt-die
2022-10-31 20:27:19 -05:00
committed by GitHub
parent c1146d473d
commit 8f4463b46a
3 changed files with 6 additions and 15 deletions
+3 -8
View File
@@ -13,7 +13,7 @@ local UnitGroupRolesAssigned = UnitGroupRolesAssigned
local UnitHasVehicleUI = UnitHasVehicleUI
local IsInInstance = IsInInstance
E.Role = "Melee" -- TODO: Load locally, or save per specialization.
E.Role = "Melee" -- TODO: Save per specialization?
do -- other non-english locales require this
E.UnlocalizedClasses = {}
@@ -45,13 +45,8 @@ function E:ScanTooltipTextures(clean, grabTextures)
end
function E:GetPlayerRole()
local isTank, isHealer, isDamage = UnitGroupRolesAssigned("player")
if isTank or isHealer or isDamage then
return isTank and "TANK" or isHealer and "HEALER" or isDamage and "DAMAGER"
else
return "DAMAGER" -- Assume dps role; Nothing better for ascension.
end
local isTank, isHealer, _ = UnitGroupRolesAssigned("player")
return isTank and "TANK" or isHealer and "HEALER" or "DAMAGER"
end
do
+2 -7
View File
@@ -237,7 +237,7 @@ function E:ChangeRole(role)
["tank"]="Tank",
}
E.Role = roles[lower(role)] or "Melee"
print("Role was changed to:", E.Role)
E:Print("Role was changed to "..E.Role)
end
function E:LoadCommands()
@@ -267,12 +267,7 @@ function E:LoadCommands()
self:RegisterChatCommand("farmmode", "FarmMode")
self:RegisterChatCommand("cleanguild", "MassGuildKick")
self:RegisterChatCommand("estatus", "ShowStatusReport")
self:RegisterChatCommand("role", "ChangeRole")
-- This command is added for Ascension. Role checks will be unreliable, but
-- this will allow one to set Role manually.
-- /role expects one of "melee", "caster", "ranged", "tank"
-- and defaults to "melee" if no role is provided.
self:RegisterChatCommand("elvrole", "ChangeRole")
if E.private.actionbar.enable then
self:RegisterChatCommand("kb", AB.ActivateBindMode)
+1
View File
@@ -1197,6 +1197,7 @@ function E:Initialize()
local msg = format(L["LOGIN_MSG"], self.media.hexvaluecolor, self.media.hexvaluecolor, self.version)
if Chat.Initialized then msg = select(2, Chat:FindURL("CHAT_MSG_DUMMY", msg)) end
print(msg)
E:Print("Use /elvrole [melee, caster, ranged, tank] to optimize the UI for your role. Your current role is "..E.Role)
end
if GetCVar("scriptProfile") ~= "1" then