Fixed /keystone command; Fixed issues with nicknames

This commit is contained in:
Tercio Jose
2022-05-19 14:42:57 -03:00
parent 026aa2223a
commit c006675d94
10 changed files with 249 additions and 63 deletions
+16 -8
View File
@@ -2480,16 +2480,24 @@ end
for lineId = 1, self:GetNumLinesShown() do
local thisLine = self:GetLine(lineId)
local playerName = thisLine.lineText1
local text2 = thisLine.lineText2
local text3 = thisLine.lineText3
local text4 = thisLine.lineText4
--check if there's something showing in this line
if (thisLine.minha_tabela) then
local playerNameFontString = thisLine.lineText1
local text2 = thisLine.lineText2
local text3 = thisLine.lineText3
local text4 = thisLine.lineText4
local totalWidth = text2:GetStringWidth() + text3:GetStringWidth() + text4:GetStringWidth()
totalWidth = totalWidth + 50
local totalWidth = text2:GetStringWidth() + text3:GetStringWidth() + text4:GetStringWidth()
totalWidth = totalWidth + 40 - self.fontstrings_text_limit_offset
DetailsFramework:TruncateText(playerName, self.cached_bar_width - totalWidth) --this avoid truncated strings with ...
--playerName:SetWidth(self.cached_bar_width - totalWidth)
DetailsFramework:TruncateTextSafe(playerNameFontString, self.cached_bar_width - totalWidth) --this avoid truncated strings with ...
--these commented lines are for to create a cache and store the name already truncated there to safe performance
--local truncatedName = playerNameFontString:GetText()
--local actorObject = thisLine.minha_tabela
--actorObject.name_cached = truncatedName
--actorObject.name_cached_time = GetTime()
end
end
end
end
+24 -10
View File
@@ -213,6 +213,27 @@
end
end
--check if the nickname fit some minimal rules to be presented to other players
local checkValidNickname = function(nickname, playerName)
if (nickname and type(nickname) == "string") then
if (nickname == "") then
return playerName
elseif (nickname:find(" ")) then
return playerName
--elseif(#nickname > 14) then --cannot check for size as other alphabets uses 2 or 4 bytes to represent letters
-- return playerName
end
else
return playerName
end
--remove scapes
nickname = nickname:gsub("|","")
return nickname
end
--> read the actor flag
local read_actor_flag = function(actorObject, dono_do_pet, serial, flag, nome, container_type)
@@ -220,16 +241,9 @@
--> this is player actor
if (_bit_band (flag, OBJECT_TYPE_PLAYER) ~= 0) then
if (not _detalhes.ignore_nicktag) then
actorObject.displayName = _detalhes:GetNickname (nome, false, true) --> serial, default, silent
if (actorObject.displayName and actorObject.displayName ~= "") then
--don't display empty nicknames
if (actorObject.displayName:find(" ")) then
if (_detalhes.remove_realm_from_name) then
actorObject.displayName = nome:gsub (("%-.*"), "")
else
actorObject.displayName = nome
end
end
actorObject.displayName = checkValidNickname(Details:GetNickname(nome, false, true), nome) --defaults to player name
if (_detalhes.remove_realm_from_name) then
actorObject.displayName = actorObject.displayName:gsub(("%-.*"), "")
end
end
+1
View File
@@ -188,6 +188,7 @@ _detalhes.instance_defaults = {
--use one fontstring for each value in the lines, e.g. one fontstring to damage done, another fontstring to dps and another to percent amount
use_multi_fontstrings = true,
use_auto_align_multi_fontstrings = true,
fontstrings_text_limit_offset = -10,
fontstrings_text4_anchor = 0,
fontstrings_text3_anchor = 38,
fontstrings_text2_anchor = 73,