from retail
This commit is contained in:
@@ -178,24 +178,22 @@ local function modify(parent, region, parentData, data, first)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if type(parentData.conditions) == "table" then
|
||||
for _, condition in ipairs(parentData.conditions) do
|
||||
if type(condition.changes) == "table" then
|
||||
for _, change in ipairs(condition.changes) do
|
||||
if type(change.property) == "string"
|
||||
and change.property:match("sub%.%d+%.text_text")
|
||||
and type(change.value) == "string"
|
||||
and Private.ContainsCustomPlaceHolder(change.value)
|
||||
then
|
||||
containsCustomText = true
|
||||
break
|
||||
if not containsCustomText then
|
||||
if type(parentData.conditions) == "table" then
|
||||
for _, condition in ipairs(parentData.conditions) do
|
||||
if type(condition.changes) == "table" then
|
||||
for _, change in ipairs(condition.changes) do
|
||||
if type(change.property) == "string"
|
||||
and change.property:match("sub%.%d+%.text_text")
|
||||
then
|
||||
containsCustomText = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if containsCustomText and parentData.customText and parentData.customText ~= "" then
|
||||
parent.customTextFunc = WeakAuras.LoadFunction("return "..parentData.customText)
|
||||
else
|
||||
@@ -205,20 +203,49 @@ local function modify(parent, region, parentData, data, first)
|
||||
parent.values.lastCustomTextUpdate = nil
|
||||
end
|
||||
|
||||
local texts = {}
|
||||
local textStr = data.text_text or ""
|
||||
if textStr ~= "" then
|
||||
tinsert(texts, textStr)
|
||||
end
|
||||
|
||||
local subRegionIndex = 1
|
||||
for index, subRegion in ipairs(parentData.subRegions) do
|
||||
if subRegion == data then
|
||||
subRegionIndex = index
|
||||
break;
|
||||
end
|
||||
end
|
||||
if type(parentData.conditions) == "table" then
|
||||
local conditionName = "sub."..subRegionIndex..".text_text"
|
||||
for _, condition in ipairs(parentData.conditions) do
|
||||
if type(condition.changes) == "table" then
|
||||
for _, change in ipairs(condition.changes) do
|
||||
if type(change.property) == "string" and change.property == conditionName then
|
||||
if type(change.value ) == "string" and change.value ~= "" then
|
||||
tinsert(texts, change.value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local getter = function(key, default)
|
||||
local fullKey = "text_text_format_" .. key
|
||||
if (data[fullKey] == nil) then
|
||||
data[fullKey] = default
|
||||
end
|
||||
return data[fullKey]
|
||||
end
|
||||
region.subTextFormatters = Private.CreateFormatters(texts, getter)
|
||||
|
||||
function region:ConfigureTextUpdate()
|
||||
local UpdateText
|
||||
if region.text_text and Private.ContainsAnyPlaceHolders(region.text_text) then
|
||||
local getter = function(key, default)
|
||||
local fullKey = "text_text_format_" .. key
|
||||
if data[fullKey] == nil then
|
||||
data[fullKey] = default
|
||||
end
|
||||
return data[fullKey]
|
||||
end
|
||||
local formatters = Private.CreateFormatters(region.text_text, getter)
|
||||
UpdateText = function()
|
||||
local textStr = region.text_text or ""
|
||||
textStr = Private.ReplacePlaceHolders(textStr, parent, nil, false, formatters)
|
||||
textStr = Private.ReplacePlaceHolders(textStr, parent, nil, false, self.subTextFormatters)
|
||||
|
||||
if text:GetFont() then
|
||||
text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(textStr))
|
||||
|
||||
Reference in New Issue
Block a user