DopingControl v0.6.4
This commit is contained in:
+29
-2
@@ -59,6 +59,22 @@ function R.SendDisabled(source)
|
||||
return source == "sim"
|
||||
end
|
||||
|
||||
-- The chat API rejects the WHOLE message with "Invalid escape code in chat
|
||||
-- message" when it meets a "|" that does not open a valid escape sequence
|
||||
-- (|c |r |H |h |T |t |n ||). Our header line uses " | " as a plain ASCII
|
||||
-- separator, so every report was refused. "||" is the escape for a literal
|
||||
-- pipe and still renders as a single "|", which is why this runs at the
|
||||
-- send point and NOT inside DC_Model.reportLines: the preview shows what
|
||||
-- reportLines returns and must keep showing the text as it APPEARS in chat.
|
||||
-- Report lines are pure ASCII by design (no item links, no colour codes),
|
||||
-- so doubling every pipe cannot damage a real escape sequence here.
|
||||
function R.ChatSafe(line)
|
||||
if not line then
|
||||
return line
|
||||
end
|
||||
return (string.gsub(line, "|", "||"))
|
||||
end
|
||||
|
||||
-- Create a drain queue from an array of lines. Takes an independent copy
|
||||
-- (the preview may be rebuilt while an old queue is still draining).
|
||||
function R.QueueCreate(lines)
|
||||
@@ -135,7 +151,18 @@ end
|
||||
function R.BuildLines(store, dbt, tab)
|
||||
store = store or DC.store or { players = {} }
|
||||
tab = tab or "CONSUMABLES"
|
||||
local expect = (dbt and dbt.expectations) or DC.DEFAULT_EXPECT or {}
|
||||
-- Same expectation resolver the matrix uses, or the report preview
|
||||
-- would show different columns and different gap totals than the grid
|
||||
-- it was opened from (demo mode). Safe for the SEND path too: the demo
|
||||
-- layer only applies over the "sim" store, and R.SendDisabled blocks
|
||||
-- sending on exactly that source. Guarded because ui/report.lua is
|
||||
-- loadable without ui/matrix.lua (tools/luatests/test_report_queue.lua).
|
||||
local expect
|
||||
if DC_Matrix and DC_Matrix.ExpectTable then
|
||||
expect = DC_Matrix.ExpectTable(dbt)
|
||||
else
|
||||
expect = (dbt and dbt.expectations) or DC.DEFAULT_EXPECT or {}
|
||||
end
|
||||
local function roleOf(p)
|
||||
return DC_Roles.resolve(dbt, store.source, p)
|
||||
end
|
||||
@@ -234,7 +261,7 @@ if CreateFrame then
|
||||
end
|
||||
local line = R.QueueTick(queue, GetTime(), currentSource())
|
||||
if line then
|
||||
SendChatMessage(line, R.CHAT_TYPE)
|
||||
SendChatMessage(R.ChatSafe(line), R.CHAT_TYPE)
|
||||
UpdateSendState()
|
||||
end
|
||||
if queue.done or queue.aborted then
|
||||
|
||||
Reference in New Issue
Block a user