Api 哇LUA:MSP,合并GTAL?

Api 哇LUA:MSP,合并GTAL?,api,lua,world-of-warcraft,Api,Lua,World Of Warcraft,虽然我知道最好从基础开始,但我喜欢涉猎。但这让我很难受。在《魔兽世界》中,我使用了ElvUI和MyRolePlay(MRP),结果是工具提示增强了。我已经对代码做了相当多的编辑,剩下的唯一一件事就是尝试正确地设置最后一行的格式-在一行上完整地(3个变量)。我不明白什么是gtal(或“L”),但它似乎创造了一个新的路线。有没有一种方法可以组合gtal线条,同时分别保留RGB颜色?我试图保持代码风格(因为我在引入新代码时遇到困难),但由于作者如何在变量上调用颜色,我无法在不创建全新行的情况下获得最终

虽然我知道最好从基础开始,但我喜欢涉猎。但这让我很难受。在《魔兽世界》中,我使用了ElvUI和MyRolePlay(MRP),结果是工具提示增强了。我已经对代码做了相当多的编辑,剩下的唯一一件事就是尝试正确地设置最后一行的格式-在一行上完整地(3个变量)。我不明白什么是gtal(或“L”),但它似乎创造了一个新的路线。有没有一种方法可以组合gtal线条,同时分别保留RGB颜色?我试图保持代码风格(因为我在引入新代码时遇到困难),但由于作者如何在变量上调用颜色,我无法在不创建全新行的情况下获得最终%s的颜色值

local dC = GetQuestDifficultyColor(level);
local cC = RAID_CLASS_COLORS[ classunloc ];
我能想到的最好的

gtal( format( L["|r%s|cffffffff %s"], e, emptynil( mrp.DisplayTooltip.RA( f.RA ) ) or race, class), dC.r, dC.g, dC.b ) 
gtal( format( L["|r%s"], class), cC.r, cC.g, cC.b ) 
在国防部或我能找到的任何地方都没有关于gtal的信息。我听说作者是不可能接近的。但我希望这里有人知道这个想法

好极了,只要最后一个字在上面就好了

如果有帮助的话,这一切的障碍是

local dC = GetQuestDifficultyColor(level);
local cC = RAID_CLASS_COLORS[ classunloc ];
if level ~= nil and level < 0 then
    e = L["|cffffffff(Boss)"]
else 
    e = format( L["|r%d|cffffffff"], level )
end
if mspsupported then
    gtal( format( L["|r%s|cffffffff %s"], e, emptynil( mrp.DisplayTooltip.RA( f.RA ) ) or race, class), dC.r, dC.g, dC.b ) 
    gtal( format( L["|r%s"], class), cC.r, cC.g, cC.b ) 
    n = nil
    t = nil
    if f.FR and f.FR ~= "" and f.FR ~= "0" then
        n = mrp.DisplayTooltip.FR( f.FR ) .. "  "
    end
更新-这就是这里的工作原理,因为如果这对其他人有帮助:

    local dC = GetQuestDifficultyColor(level);
    local cC = RAID_CLASS_COLORS[ classunloc ];
    if level ~= nil and level < 0 then
        e = L["|cffffffff(Boss)"]
    else 
        e = format( L["|r%d|cffffffff"], level )
    end
    if mspsupported then
        local classStr = format("|cff%02x%02x%02x%s|r", cC.r * 255, cC.g * 255, cC.b * 255, class)
        local str = format( L["|r%s |cffffffff%s|r %s"], e, emptynil( mrp.DisplayTooltip.RA( f.RA ) ) or race, classStr)
        gtal(str, dC.r, dC.g, dC.b)
localdc=GetQuestDifficultyColor(级别);
本地cC=RAID_类_颜色[classunloc];
如果级别~=nil且级别<0,则
e=L[“|cffffffff(Boss)”]
其他的
e=格式(L[“| r%d | cffffffff”],级别)
结束
如果支持MSPSU,则
本地类str=格式(|cff%02x%02x%02x%s | r),cC.r*255,cC.g*255,cC.b*255,类)
本地str=格式(L[“| r%s | cffffffff%s | r%s”]),e,emptynil(mrp.DisplayTooltip.RA(f.RA))或种族,classStr)
gtal(str、dC.r、dC.g、dC.b)

gtal
UI\u工具提示中定义。lua

--[[
  EPIC KLUDGE!
  Special local functions to overwrite and add the current tooltip.
]]
-- Single string
local function gtal( n, r, g, b )
  local l = GameTooltip.mrpLines + 1
  GameTooltip.mrpLines = l

  r, g, b = (r or 1.0), (g or 1.0), (b or 1.0)

  --if GameTooltip.mrpLines <= GameTooltip.orgLines then
    -- Replace original line with ours, or add a new one if not there
    if _G["GameTooltipTextLeft"..tostring(l)] then
      if _G["GameTooltipTextLeft"..tostring(l)]:IsVisible() then
        if _G["GameTooltipTextRight"..tostring(l)] then
          _G["GameTooltipTextRight"..tostring(l)]:Hide()
        end
        _G["GameTooltipTextLeft"..tostring(l)]:SetText( n )
        _G["GameTooltipTextLeft"..tostring(l)]:SetTextColor( r, g, b )
      else
        GameTooltip:AddLine( n, r, g, b )
      end
    else
      GameTooltip:AddLine( n, r, g, b )
    end
end

多么令人难以置信的反应啊。感谢您的耐心和巨大的帮助-您最终所做的与我看到的其他人所做的非常相似,特别是编写精良的ElvUI:
GameTooltip:AddDoubleLine(format(“%s:”,TARGET),format(“| cff%02x%02x%s | r”,targetColor.r*255,targetColor.g*255,targetColor.b*255,UnitName(unitTarget))
因此,在您所做工作的基础上,我借用了他们的想法:通过这项工作,我将学习基本知识-再次感谢您的回复和全面的回答!
--[[
  EPIC KLUDGE!
  Special local functions to overwrite and add the current tooltip.
]]
-- Single string
local function gtal( n, r, g, b )
  local l = GameTooltip.mrpLines + 1
  GameTooltip.mrpLines = l

  r, g, b = (r or 1.0), (g or 1.0), (b or 1.0)

  --if GameTooltip.mrpLines <= GameTooltip.orgLines then
    -- Replace original line with ours, or add a new one if not there
    if _G["GameTooltipTextLeft"..tostring(l)] then
      if _G["GameTooltipTextLeft"..tostring(l)]:IsVisible() then
        if _G["GameTooltipTextRight"..tostring(l)] then
          _G["GameTooltipTextRight"..tostring(l)]:Hide()
        end
        _G["GameTooltipTextLeft"..tostring(l)]:SetText( n )
        _G["GameTooltipTextLeft"..tostring(l)]:SetTextColor( r, g, b )
      else
        GameTooltip:AddLine( n, r, g, b )
      end
    else
      GameTooltip:AddLine( n, r, g, b )
    end
end
-- Build a color-formatted class string
local classStr = format("|c%02x%02x%02x%s|r", cC.r, cC.g, cC.b, class)
-- Build your tooltip line, which consists of `$e $race $class`
local str = format( L["|r%s |cffffffff%s|r %s"], e, emptynil( mrp.DisplayTooltip.RA( f.RA ) ) or race, classStr)
-- Add the line to the tooltip
gtal(str, dC.r, dC.g, dC.b)