TinyTip 修改頭銜顯示格式

最近換用了TinyTip(Hughman修改版)代替之前的TipTac,
因為它能夠在滑鼠提示裡顯示該角色的雙天賦個人覺得很實用,
可惜TinyTip的頭銜顯示格式是「角色名字 + 頭銜」,
看起來就覺得很怪:
tinytip01
而自己希望是顯示成「頭銜 + 角色名字」並去掉礙眼的「,」,
所以試著修改原本的程式,
原本顯示角色頭銜的內容為:

if TTVar.PVPRank and IsPlayer then
  tmp2 = UnitPVPName(unit)
  tmp3 = nil
  if tmp2 and tmp2 ~= name then
    i = strfind(tmp2, name)
    if i and i > 1 then 
      tmp3 = strsub(tmp2, 1, i - 1 )
    elseif i == 1 then
      _, tmp3 = tmp2:match("(.+),(.+)") --strsub(tmp2, strlen(name)+1)
    end
  end
  tmp3 = tmp3 and (", " .. tmp3) or ""
  L1:SetText( tmp .. tmp3)
else
  L1:SetText( tmp )
end

改成以下這樣,主要改動在第298~299行:

if TTVar.PVPRank and IsPlayer then
  tmp2 = UnitPVPName(unit)
  tmp3 = nil
  if tmp2 and tmp2 ~= name then
    i = strfind(tmp2, name)
    if i and i > 1 then 
      tmp3 = strsub(tmp2, 1, i - 1 )
    elseif i == 1 then
      _, tmp3 = tmp2:match("(.+),(.+)") --strsub(tmp2, strlen(name)+1)
    end
  end
  tmp3 = tmp3 and tmp3 or ""
  L1:SetText( tmp3 .. tmp)
else
  L1:SetText( tmp )
end

另外也將單位W換成萬,

local percent = format("%.1f%%", (val / max * 100))
	tmp, tmp2 = 10000, "W"
	if val and val > tmp then val = format("%.1f %s", (val/tmp), tmp2 ) end
	if max and max > tmp then max = format("%.1f %s", (max/tmp), tmp2 ) end
[/cce_lua]
改成:
[cce_lua first_line="565" line_numbers="1" width="650"]
	local percent = format("%.1f%%", (val / max * 100))
	tmp, tmp2 = 10000, "萬"
	if val and val > tmp then val = format("%.1f %s", (val/tmp), tmp2 ) end
	if max and max > tmp then max = format("%.1f %s", (max/tmp), tmp2 ) end

成果如下:
tinytip02

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料