Skip to content

Commit

Permalink
style: color coding messages
Browse files Browse the repository at this point in the history
Color Coded the messages coming in from Actors
Looted = Green
Destroyed = Red
Ignored = Orange
  • Loading branch information
grimmier378 committed May 12, 2024
1 parent b3db477 commit b5e1868
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ local defaults = {
bottomPosition = 0,
lastScrollPos = 0,
}

local guiLoot = {
SHOW = false,
openGUI = false,
Expand All @@ -105,7 +106,9 @@ local guiLoot = {
UseActors = true,
winFlags = bit32.bor(ImGuiWindowFlags.MenuBar)
}

local lootTable = {}

---@param names boolean
---@param links boolean
---@param record boolean
Expand All @@ -116,6 +119,7 @@ function guiLoot.GetSettings(names,links,record)
guiLoot.recordData = record
end
end

function guiLoot.loadLDB()
if guiLoot.linkdb or guiLoot.UseActors then return end
local sWarn = "MQ2LinkDB not loaded, Can't lookup links.\n Attempting to Load MQ2LinkDB"
Expand All @@ -126,7 +130,7 @@ function guiLoot.loadLDB()
end

-- draw any imported exported menus from outside this script.
function drawImportedMenu()
local function drawImportedMenu()
for _, menuElement in ipairs(guiLoot.importGUIElements) do
menuElement()
end
Expand Down Expand Up @@ -564,8 +568,13 @@ function guiLoot.RegisterActor()
end

local text = string.format('\ao[%s] \at%s \ax%s %s (%s)', lootEntry.LootedAt, who, item.Action, link, lootEntry.ID)
if item.Action == 'Destroyed' then
text = string.format('\ao[%s] \at%s \ar%s \ax%s \ax(%s)', lootEntry.LootedAt, who, string.upper(item.Action), link, lootEntry.ID)
elseif item.Action == 'Looted' then
text = string.format('\ao[%s] \at%s \ag%s \ax%s \ax(%s)', lootEntry.LootedAt, who, item.Action, link, lootEntry.ID)
end
guiLoot.console:AppendText(text)
local line = string.format('[%s] %s %s %s CorpseID(%s)', lootEntry.LootedAt, who, item.Action, what, lootEntry.ID)
local line = string.format('[%s] %s %s %s CorpseID (%s)', lootEntry.LootedAt, who, item.Action, what, lootEntry.ID)
local i = getNextID(txtBuffer)
-- ZOOM Console hack
if i > 1 then
Expand Down Expand Up @@ -612,15 +621,15 @@ function guiLoot.EventLoot(line, who, what)
end
local text = string.format('\ao[%s] \at%s \axLooted %s', mq.TLO.Time(), who, link)
guiLoot.console:AppendText(text)
local line = string.format('[%s] %s Looted %s', mq.TLO.Time(), who, what)
local zLine = string.format('[%s] %s Looted %s', mq.TLO.Time(), who, what)
local i = getNextID(txtBuffer)
-- ZOOM Console hack
if i > 1 then
if txtBuffer[i-1].Text == '' then i = i-1 end
end
-- Add the new line to the buffer
txtBuffer[i] = {
Text = line
Text = zLine
}
-- cleanup zoom buffer
-- Check if the buffer exceeds 1000 lines
Expand Down Expand Up @@ -738,4 +747,4 @@ end
checkArgs(args)
loop()

return guiLoot
return guiLoot

0 comments on commit b5e1868

Please sign in to comment.