diff --git a/Character Reader/configuration.lua b/Character Reader/configuration.lua index 3bde7ce..492904e 100644 --- a/Character Reader/configuration.lua +++ b/Character Reader/configuration.lua @@ -14,6 +14,8 @@ local magShowPBs = true local magShortPBs = true -- Shows the feed timer mags local magShowFeedTimer = true +-- Show mags only +local magFilter = false -- Shows an [E] besides equipped items in the inventory local itemsShowEquipped = true -- new floor items are added by default on the top of the list, use this setting to add new items at the bottom @@ -166,6 +168,7 @@ return magShowPBs = magShowPBs, magShortPBs = magShortPBs, magShowFeedTimer = magShowFeedTimer, + magFilter = magFilter, itemsShowEquipped = itemsShowEquipped, invertFloorItemsFlow = invertFloorItemsFlow, mainWindow = mainWindow, diff --git a/Character Reader/init.lua b/Character Reader/init.lua index c4c3110..9e60457 100644 --- a/Character Reader/init.lua +++ b/Character Reader/init.lua @@ -591,7 +591,7 @@ local readItemFromPool = function (index, iAddr, floor) -- Where the magic happens - if magOnly then + if floor == false and cfg.magFilter == true then if item[1] == 2 then item[4] = pso.read_u8(iAddr + _ItemMagPB) item[5] = pso.read_u8(iAddr + _ItemMagStats + 0) @@ -904,16 +904,9 @@ local readBank = function(save) end end -local getDefaultSelection = function() - local default = cfg.defaultSelection or 1 - if default < 1 or default > 3 then - default = 1 - end - return default -end - -local selection = getDefaultSelection() local status = true +local selection = cfg.defaultSelection +local magFilter = cfg.magFilter local present = function() if cfg.mainWindow then @@ -921,11 +914,21 @@ local present = function() imgui.Begin("Character Reader") imgui.SetWindowFontScale(cfg.fontSize) - local list = { "Inventory", "Bank", "Floor" } + local list = { "Inventory", "Bank", "Floor", } + imgui.PushItemWidth(150) status, selection = imgui.Combo(" ", selection, list, table.getn(list)) + imgui.PopItemWidth() - if cfg.showSaveToFile then + if selection == 1 then + magFilter = cfg.magFilter imgui.SameLine(0, 5) + if imgui.Checkbox("Mags only", magFilter) then + cfg.magFilter = not cfg.magFilter + end + end + + if cfg.showSaveToFile then + imgui.SameLine(0, 20) if imgui.Button("Save to file") then save = true -- Write nothing to it so its cleared works for appending @@ -963,7 +966,7 @@ local init = function() return { name = "Character Reader", - version = "1.4.9", + version = "1.4.10", author = "Solybum", description = "Read inventory and bank items", present = present, diff --git a/Mags/configuration.lua b/Mags/configuration.lua deleted file mode 100644 index 173d3dd..0000000 --- a/Mags/configuration.lua +++ /dev/null @@ -1,25 +0,0 @@ --- Enable addon -local enable = true --- Default font color -local fontColor = 0xFFFFFFFF --- Default font size -local fontSize = 1.0 --- Color for the mag feed timer -local magFeedTimerColors = -{ - 1, 0xFF28CC66, - 16, 0xFFF1C40F, - 30, 0xFFFF8C00, - 9001, 0xFFFF0000, -- over 9000, really just needs 210 at most -} --- Mag ready to be fed string -local readyToBeFedString = "Feed Me!!!" - -return -{ - enable = enable, - fontColor = fontColor, - fontSize = fontSize, - magFeedTimerColors = magFeedTimerColors, - readyToBeFedString = readyToBeFedString, -} diff --git a/Mags/init.lua b/Mags/init.lua deleted file mode 100644 index f7cb040..0000000 --- a/Mags/init.lua +++ /dev/null @@ -1,91 +0,0 @@ -local helpers = require("solylib.helpers") -local unitxt = require("solylib.unitxt") -local libitems = require("solylib.items.items") -local cfg = require("Mags.configuration") - -local _PlayerMyIndex = 0x00A9C4F4 - -local function DisplayMags() - local playerIndex = pso.read_u32(_PlayerMyIndex) - local itemList = libitems.GetItemList(playerIndex, false) - - for index, item in ipairs(itemList) do - if item.type == 2 then - -- Index - local text = string.format("%2i", index) - helpers.imguiText(text, cfg.fontColor, false) - - -- Name - text = string.format(" %s", item.name) - helpers.imguiText(text, cfg.fontColor, false) - - -- Stats - text = string.format(" [%.2f/%.2f/%.2f/%.2f]", - item.mag.DFP, - item.mag.ATP, - item.mag.ATA, - item.mag.MST) - helpers.imguiText(text, cfg.fontColor, false) - - -- PBs - text = string.format(" [%s|%s|%s]", - unitxt.GetPhotonBlastName(item.mag.pbLeft, true), - unitxt.GetPhotonBlastName(item.mag.pbCenter, true), - unitxt.GetPhotonBlastName(item.mag.pbRight, true)) - helpers.imguiText(text, cfg.fontColor, false) - - -- Feed timer - helpers.imguiText(" [", cfg.fontColor) - local feedtimerStr = string.format("%is", item.mag.timer) - - local ftColor = 0 - for i=1,table.getn(cfg.magFeedTimerColors),2 do - if ftColor == 0 then - if item.mag.timer < cfg.magFeedTimerColors[i] then - ftColor = i + 1 - end - end - end - - if item.mag.timer <= 0 then - helpers.imguiText(cfg.readyToBeFedString, cfg.magFeedTimerColors[ftColor]) - else - helpers.imguiText(feedtimerStr, cfg.magFeedTimerColors[ftColor]) - end - helpers.imguiText("]", cfg.fontColor, false) - - helpers.imguiText("", cfg.fontColor, true) - end - end - -end - -local function present() - if cfg.enable == false then - return - end - - imgui.Begin("Mags") - imgui.SetWindowFontScale(cfg.fontSize) - DisplayMags() - imgui.End() -end - -local function init() - return - { - name = "Mags", - version = "1.0.0", - author = "Solybum", - description = "Mag list to know when to feed them", - present = present, - } -end - -return -{ - __addon = - { - init = init - } -}