diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/!SpiffUI-Inv.lua b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/!SpiffUI-Inv.lua old mode 100644 new mode 100755 index 6e1061a..a290efc --- a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/!SpiffUI-Inv.lua +++ b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/!SpiffUI-Inv.lua @@ -25,7 +25,7 @@ ------------------------------------------ -- Set the SpiffUI lib version -local SPIFFUI_VERSION = 2 --<<< DO NOT CHANGE UNLESS YOU KNOW WHAT YOU'RE DOING +local SPIFFUI_VERSION = 3 --<<< DO NOT CHANGE UNLESS YOU KNOW WHAT YOU'RE DOING if SpiffUI then if SpiffUI.Version >= SPIFFUI_VERSION then return -- Don't do anything else @@ -147,10 +147,6 @@ SpiffUI.preCheck = function() return nil end - if UIManager.getSpeedControls() and (UIManager.getSpeedControls():getCurrentGameSpeed() == 0) then - return nil - end - return player end @@ -158,6 +154,7 @@ local function keyDown(key) --print("Pressed: " .. getKeyName(key) .. " | " .. key) local player = SpiffUI.preCheck(key) if not player then return end + for _,bind in ipairs(SpiffUI.KeyBinds) do if key == getCore():getKey(bind.name) then if bind.Down then @@ -165,7 +162,9 @@ local function keyDown(key) if bind.qBlock and queue and #queue.queue > 0 then return end - bind.Down(player) + if bind.allowPause or not (UIManager.getSpeedControls() and (UIManager.getSpeedControls():getCurrentGameSpeed() == 0)) then + bind.Down(player) + end end break end @@ -183,7 +182,9 @@ local function keyHold(key) if bind.qBlock and queue and #queue.queue > 0 then return end - bind.Hold(player) + if bind.allowPause or not (UIManager.getSpeedControls() and (UIManager.getSpeedControls():getCurrentGameSpeed() == 0)) then + bind.Hold(player) + end end break end @@ -201,7 +202,9 @@ local function keyRelease(key) if bind.qBlock and queue and #queue.queue > 0 then return end - bind.Up(player) + if bind.allowPause or not (UIManager.getSpeedControls() and (UIManager.getSpeedControls():getCurrentGameSpeed() == 0)) then + bind.Up(player) + end end break end @@ -231,7 +234,7 @@ SpiffUI.onKeyDown = function(player) if SpiffUI.action.ready then -- Hide Radial Menu on Press if applicable if radialMenu:isReallyVisible() and getCore():getOptionRadialMenuKeyToggle() then - radialMenu:removeFromUIManager() + radialMenu:undisplay() setJoypadFocus(player:getPlayerNum(), nil) SpiffUI.action.wasVisible = false SpiffUI.action.ready = true @@ -266,6 +269,7 @@ end SpiffUI.equippedItem = { ["Inventory"] = true, ["Health"] = true, + ["QOLEquip"] = true, ["Craft"] = true, ["Movable"] = true, ["Search"] = true, @@ -280,6 +284,8 @@ function SpiffUI:updateEquippedItem() -- Redo the ISEquippedItem tree based on what we set local player = getPlayerData(0) local y = player.equipped.invBtn:getY() + -- Add support for the QOL Equipment mod's icon + SpiffUI.equippedItem["QOLEquip"] = (SETTINGS_QOLMT and SETTINGS_QOLMT.options and SETTINGS_QOLMT.options.useIcon) or false for i,v in pairs(SpiffUI.equippedItem) do if i == "Inventory" then player.equipped.invBtn:setVisible(v) @@ -292,6 +298,13 @@ function SpiffUI:updateEquippedItem() if v then y = player.equipped.healthBtn:getY() + player.equipped.heartIcon:getHeightOrig() + 5 end + -- Add support for the QOL Equipment mod's icon + elseif i == "QOLEquip" and player.equipped.equipButton then + player.equipped.equipButton:setVisible(v) + player.equipped.equipButton:setY(y) + if v then + y = player.equipped.equipButton:getY() + player.equipped.equipmentIconOFF:getHeightOrig() + 5 + end elseif i == "Craft" then player.equipped.craftingBtn:setVisible(v) player.equipped.craftingBtn:setY(y) @@ -374,6 +387,11 @@ function SpiffUI:ModOptions() local function apply(data) local options = data.settings.options -- Set options + if isDebugEnabled() then + SpiffUI.config.debug = options.debug + else + SpiffUI.config.debug = false + end end local SPIFFCONFIG = { @@ -393,6 +411,15 @@ function SpiffUI:ModOptions() mod_fullname = getText("UI_Name_SpiffUI") } + if isDebugEnabled() then + SPIFFCONFIG.options_data.debug = { + name = "Enable Debug", + default = false, + OnApplyMainMenu = apply, + OnApplyInGame = apply + } + end + local optionsInstance = ModOptions:getInstance(SPIFFCONFIG) ModOptions:loadFile() @@ -589,6 +616,39 @@ SpiffUI.settingsModal = function(w, h, text, key, callback) end end +-- Adapted from: https://www.rosettacode.org/wiki/Word_wrap#Lua +SpiffUI.textwrap = function(text, linewidth) + local function splittokens(s) + local res = {} + for w in s:gmatch("%S+") do + res[#res+1] = w + end + return res + end + + if not linewidth then + linewidth = 75 + end + + local spaceleft = linewidth + local res = {} + local line = {} + + for _, word in ipairs(splittokens(text)) do + if #word + 1 > spaceleft then + table.insert(res, table.concat(line, ' ')) + line = {word} + spaceleft = linewidth - #word + else + table.insert(line, word) + spaceleft = spaceleft - (#word + 1) + end + end + + table.insert(res, table.concat(line, ' ')) + return table.concat(res, '\n') +end + ------------------------------------------ Events.OnGameBoot.Add(SpiffUI.firstBoot) diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_ISInventoryPage.lua b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_ISInventoryPage.lua deleted file mode 100644 index 3d54499..0000000 --- a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_ISInventoryPage.lua +++ /dev/null @@ -1,535 +0,0 @@ ------------------------------------------- --- SpiffUI Inventory ------------------------------------------- - --- Add module -SpiffUI = SpiffUI or {} - --- Register our inventory -local spiff = SpiffUI:Register("inventory") - ------------------------------------------- --- on game start, we take over the Inventory -local function spiffInit(id) - -- We still setup our stuff, but if not enabled nothing happens - local player = getSpecificPlayer(id) - local isMouse = (id == 0) and (not JoypadState.players[1]) - - local inv = getPlayerInventory(id) - local loot = getPlayerLoot(id) - - if spiff.config.enabled then - -- Set the inventories to be closed on start - --local isVis = inv:getIsVisible() - inv:InitSUI() - loot:InitSUI() - end - - -- Make them Friends! - inv.friend = loot - loot.friend = inv - - if isMouse then - -- Start collapsed tho - inv:Collapse(true, "Start") - loot:Collapse(true, "Start") - end - - -- Sometimes we just have to re-run this, nbd - SpiffUI:updateEquippedItem() -end - --- Reset our inventory to the default location ----- This only occurs for user "0" as this is the only user that uses mouse/keys -local function spiffReset() - local isMouse = (not JoypadState.players[1]) - if isMouse then - getPlayerInventory(0):SUIReset() - getPlayerLoot(0):SUIReset() - end -end - -spiff.CreatePlayer = spiffInit -spiff.Reset = spiffReset -spiff.resetDesc = " Inventory Panel Location & Size " - ------------------------------------------- - -function ISInventoryPage:isMouseInBuffer() - if self.resizeWidget2.resizing then return true end - - -- So the inventory disappearing isn't so sensitive - local buffer = 32 - local boX = buffer * (-1) - local boY = 0 -- can't really go further up at the top - local boW = self:getWidth() + buffer - local boH = self:getHeight() + buffer - - local x = self:getMouseX() - local y = self:getMouseY() - - return (x >= boX and x <= boW) and (y >= boY and y <= boH) -end - -function ISInventoryPage:isMouseIn() - if self.resizeWidget2.resizing then return true end - - -- So the inventory disappearing isn't so sensitive - local boX = 0 - local boY = 0 -- can't really go further up at the top - local boW = self:getWidth() - local boH = self:getHeight() - - local x = self:getMouseX() - local y = self:getMouseY() - - return (x >= boX and x <= boW) and (y >= boY and y <= boH) -end - -function ISInventoryPage:isMouseInTop() - -- So the inventory disappearing isn't so sensitive - local buffer = 32 - local boX = buffer * (-1) - local boY = 0 -- can't really go further up at the top - local boW = self:getWidth() + buffer - local boH = self:titleBarHeight() + buffer - - local x = self:getMouseX() - local y = self:getMouseY() - - return (x >= boX and x <= boW) and (y >= boY and y <= boH) -end - -local _ISInventoryPage_update = ISInventoryPage.update -function ISInventoryPage:update() - if not spiff.config.enabled then - _ISInventoryPage_update(self) - return - end - - if not self.isMouse then - _ISInventoryPage_update(self) - ------------------------------------------ - self.closeButton:setVisible(false) - self.infoButton:setVisible(false) - self.pinButton:setVisible(false) - self.collapseButton:setVisible(false) - self.resizeWidget:setVisible(false) - return - end - - if not self.onCharacter then - if self.coloredInv and (self.inventory ~= self.coloredInv or self.isCollapsed) then - if self.coloredInv:getParent() then - self.coloredInv:getParent():setHighlighted(false) - end - self.coloredInv = nil; - end - - if not self.isCollapsed and self.inventory:getParent() and (instanceof(self.inventory:getParent(), "IsoObject") or instanceof(self.inventory:getParent(), "IsoDeadBody")) then - self.inventory:getParent():setHighlighted(true, false); - self.inventory:getParent():setHighlightColor(getCore():getObjectHighlitedColor()); - self.coloredInv = self.inventory; - end - end ------------------------------------------- - self.collapseCounter = 0 - - self.wasVisible = not self.isCollapsed - - if not self.onCharacter and not self.isCollapsed and self.inventoryPane.inventory:getType() == "floor" and self.inventoryPane.inventory:getItems():isEmpty() then - if self.autoHide and self.holdOpen and not self.prevMouse and not spiff.config.mouseHide then - self:Collapse(true, "No Floor Items") - end - end - - if not self.isCollapsed then - -- When we stop dragging, set panel to close after next mouseout or click, or set to tie with our friend - if not self.fVisible and (not ISMouseDrag.dragging or #ISMouseDrag.dragging == 0) and self.fromDrag then - self.fromDrag = false - self.autoHide = true - self.wasDrag = self.friend.mouseOver - self.holdOpen = not self.wasDrag - end - - -- If we're not dragging anything and we're not moused over and not from where we started, close - if not self.fVisible and (not ISMouseDrag.dragging or #ISMouseDrag.dragging == 0) and self.toDrag and not self.mouseOver then - self.toDrag = false - self.autoHide = true - end - - -- If we have dragged items, but we're not in our window - if not self.fVisible and (ISMouseDrag.dragging and #ISMouseDrag.dragging > 0) and self.toDrag and not self:isMouseInBuffer() then - self.toDrag = false - self.autoHide = true - end - - -- If we're no longer dragging items, but we're still on our window - if not self.fVisible and (not ISMouseDrag.dragging or #ISMouseDrag.dragging == 0) and self.toDrag and self:isMouseInBuffer() then - self.toDrag = false - end - - -- If we should autohide - --- prevmouse is to not have this happen immediately, we need a tick for other logic to kick in on state change - --- holdOpen should prevent the window from closing if we click on an object - --- We do this here so we can check the mouse location with our buffer - if not self.fVisible and not spiff.config.mouseHide and self.autoHide and not self.prevMouse and not self.holdOpen and not self.fromDrag and not self.toDrag and not self.wasDrag and not self:isMouseInBuffer() then - self:Collapse(true, "Autohide") - end - - else - - -- If we are dragging items from the other inventory to our window - if not self.fVisible and (ISMouseDrag.dragging and #ISMouseDrag.dragging > 0) and not self.fromDrag and self:isMouseInBuffer() then - self:Collapse(false, "From Drag!") - self.toDrag = true - self.autoHide = true - end - - -- If mouse is at the top of the screen, show - if not self.fVisible and not self.toDrag and not self.fromDrag and not isMouseButtonDown(1) then - if not self.friend.wasVisible then - if self:isMouseInTop() then - self:Collapse(false, "MouseMoveIn") - self.autoHide = true - end - else - if self:isMouseIn() then - self:Collapse(false, "MouseMoveInFriend") - self.autoHide = true - end - end - end - - if self.fVisible then - self:Collapse(false, "force visible") - end - end - ------------------------------------------- - if not self.onCharacter then - -- add "remove all" button for trash can/bins - self.removeAll:setVisible(self:isRemoveButtonVisible()) - - local playerObj = getSpecificPlayer(self.player) - if self.lastDir ~= playerObj:getDir() then - self.lastDir = playerObj:getDir() - self:refreshBackpacks() - elseif self.lastSquare ~= playerObj:getCurrentSquare() then - self.lastSquare = playerObj:getCurrentSquare() - self:refreshBackpacks() - end - - -- If the currently-selected container is locked to the player, select another container. - local object = self.inventory and self.inventory:getParent() or nil - if #self.backpacks > 1 and instanceof(object, "IsoThumpable") and object:isLockedToCharacter(playerObj) then - local currentIndex = self:getCurrentBackpackIndex() - local unlockedIndex = self:prevUnlockedContainer(currentIndex, false) - if unlockedIndex == -1 then - unlockedIndex = self:nextUnlockedContainer(currentIndex, false) - end - if unlockedIndex ~= -1 then - self:selectContainer(self.backpacks[unlockedIndex]) - if playerObj:getJoypadBind() ~= -1 then - self.backpackChoice = unlockedIndex - end - end - end - end - - self:syncToggleStove() ------------------------------------------- - self.closeButton:setVisible(false) - self.infoButton:setVisible(false) - self.pinButton:setVisible(false) - self.collapseButton:setVisible(false) - self.resizeWidget:setVisible(false) -end - ------------------------------------------- --- ISInventoryPage:setVisible -local _ISInventoryPage_setVisible = ISInventoryPage.setVisible -function ISInventoryPage:setVisible(vis) - if not spiff.config.enabled or not self.isMouse then - _ISInventoryPage_setVisible(self, vis) - return - end - - -- This gets called at the start of the game before init, so just don't do anything yet. - if not self.friend then return end - - self:Collapse(not vis, "setVisible") - - if vis then - --- This is really only called when the world interacts now - --- So let's treat it as such - self.holdOpen = true - self.autoHide = true - end -end - ------------------------------------------- --- ISInventoryPage:getIsVisible -local _ISInventoryPage_getIsVisible = ISInventoryPage.getIsVisible -function ISInventoryPage:getIsVisible() - if not spiff.config.enabled or not self.isMouse then - return _ISInventoryPage_getIsVisible(self) - end - return not self.isCollapsed -end - ------------------------------------------- --- ISInventoryPage:onMouseMove -local _ISInventoryPage_onMouseMove = ISInventoryPage.onMouseMove -function ISInventoryPage:onMouseMove(...) - if not spiff.config.enabled or not self.isMouse then - _ISInventoryPage_onMouseMove(self, ...) - return - end - -- Disable this - self.collapseCounter = 0 - - if isGamePaused() then - return - end - - -- if we're collapsed and pressing right mouse, we're probably aiming - --- this shouldn't trigger the inventory - if self.isCollapsed and isMouseButtonDown(1) then - return - end - - self.mouseOver = true - - -- Disable inventory window moving - if self.moving then - self.moving = false - end - - -- camera panning - local panCameraKey = getCore():getKey("PanCamera") - if self.isCollapsed and panCameraKey ~= 0 and isKeyDown(panCameraKey) then - return - end - - self.fromDrag = false - -- If we are dragging items from this inventory - if (ISMouseDrag.dragging and #ISMouseDrag.dragging > 0) and not self.toDrag and not self.fromDrag then - self.fromDrag = true - end - - -- First we touch the window, then close - if self.holdOpen then - self.holdOpen = false - end - - self.prevMouse = self.mouseOver -end - ------------------------------------------- --- ISInventoryPage:onMouseMoveOutside -local _ISInventoryPage_onMouseMoveOutside = ISInventoryPage.onMouseMoveOutside -function ISInventoryPage:onMouseMoveOutside(...) - if not spiff.config.enabled or not self.isMouse then - _ISInventoryPage_onMouseMoveOutside(self, ...) - return - end - - if isGamePaused() then - return - end - self.mouseOver = false; - - if self.moving then - self.moving = false - end - - if self.wasDrag then - self.wasDrag = self.friend.mouseOver - end - - self.prevMouse = self.mouseOver -end - ------------------------------------------- --- ISInventoryPage:onMouseDownOutside -local _ISInventoryPage_onMouseDownOutside = ISInventoryPage.onMouseDownOutside -function ISInventoryPage:onMouseDownOutside(...) - if not spiff.config.enabled or not self.isMouse then - _ISInventoryPage_onMouseDownOutside(self, ...) - return - end - - if not self.fVisible and not self.isCollapsed and not self:isMouseInBuffer() and not self.fromDrag and not self.toDrag and not self.wasDrag then - self:Collapse(true, "onMouseDownOutside") - end -end - ------------------------------------------- --- ISInventoryPage:onRightMouseDownOutside -local _ISInventoryPage_onRightMouseDownOutside = ISInventoryPage.onRightMouseDownOutside -function ISInventoryPage:onRightMouseDownOutside(...) - if not spiff.config.enabled or not self.isMouse then - _ISInventoryPage_onRightMouseDownOutside(self, ...) - return - end - - if not self.fVisible and not self.isCollapsed and not self:isMouseInBuffer() and not self.fromDrag and not self.toDrag and not self.wasDrag then - self:Collapse(true, "onRightMouseDownOutside") - end -end - -function ISInventoryPage:Collapse(collapse, why) - --if self.isCollapsed == collapse then return end - - -- local label - -- if self.onCharacter then - -- label = "Player" - -- else - -- label = "Loot" - -- end - - -- if collapse then - -- print("Collapsing: " .. label .. " | " .. why) - -- else - -- print("Showing: " .. label .. " | " .. why) - -- end - - -- If we get here and there's no friend, re-run the init - if not self.friend then - spiffInit(self.player) - end - - self.isCollapsed = collapse - if self.isCollapsed then - self:setMaxDrawHeight(self:titleBarHeight()) - self.holdOpen = false - if spiff.config.enabled then - if self.friend.isCollapsed then - _ISInventoryPage_setVisible(self, false) - _ISInventoryPage_setVisible(self.friend, false) - end - end - else - if isClient() and not self.onCharacter then - self.inventoryPane.inventory:requestSync() - end - self:clearMaxDrawHeight() - self.collapseCounter = 0 - if spiff.config.enabled then - _ISInventoryPage_setVisible(self, true) - _ISInventoryPage_setVisible(self.friend, true) - end - end -end - ------------------------------------------- --- ISInventoryPage:createChildren -local _ISInventoryPage_createChildren = ISInventoryPage.createChildren -function ISInventoryPage:createChildren() - _ISInventoryPage_createChildren(self) - - if spiff.config.enabled and self.isMouse then - self.closeButton:setVisible(false) - self.infoButton:setVisible(false) - self.pinButton:setVisible(false) - self.collapseButton:setVisible(false) - self.resizeWidget:setVisible(false) - - self.infoButton:setX(self.closeButton:getX()) - - self.minimumHeight = getPlayerScreenHeight(self.player) / 4 - end -end - -function ISInventoryPage:InitSUI() - -- Cache our player - self.playerObj = getSpecificPlayer(self.player) - - -- If player is on a controller - self.isMouse = (self.player == 0) and (not JoypadState.players[1]) - - -- If force visible - self.fVisible = false - -- autohide is used on mouse-over only - self.autoHide = false - -- Used to toggle Autohide until interaction with window - self.holdOpen = false - -- If being dragged to - self.toDrag = false - -- If dragged from here - self.fromDrag = false - -- If was opened from drag - self.wasDrag = false - - self.wasVisible = false - --self.mouseHide = spiff.config.mouseHide -end - -function ISInventoryPage:SUIReset() - local x = getPlayerScreenLeft(self.player) - local y = getPlayerScreenTop(self.player) - local w = getPlayerScreenWidth(self.player) - local h = getPlayerScreenHeight(self.player) - - local divhei = 0 - local divwid = 0 - divhei = h / 3; - - if w < h then - divhei = h / 4; - end - - divwid = round(w / 3) - if divwid < 256 + 32 then - -- min width of ISInventoryPage - divwid = 256 + 32 - end - - if self.onCharacter then - self:setX(x + w / 2 - divwid) - else - self:setX(x + w / 2) - end - self:setY(y) - self:setWidth(divwid) - self:setHeight(divhei) - - -- Set the column sizes too! - local column2 = 48 - local column3 = (self.width - column2) / 4 - local column3 = math.ceil(column3*self.inventoryPane.zoom) - local column3 = (column3) + 100 - - self.inventoryPane.column2 = column2 - self.inventoryPane.column3 = column3 - - self.inventoryPane.nameHeader:setX(column2) - self.inventoryPane.nameHeader:setWidth((column3 - column2)) - - self.inventoryPane.typeHeader:setX(column3-1) - self.inventoryPane.typeHeader:setWidth(self.width - column3 + 1) -end - -ISInventoryPage.SpiffOnKey = function(playerObj) - local player = getPlayerInventory(0) - local loot = getPlayerLoot(0) - local state = not player.isCollapsed - - if not spiff.config.enabled then - state = not player:getIsVisible() - player:setVisible(state) - loot:setVisible(state) - return - end - - -- if dragging and tab is pressed, don't do the toggle. it resets the state - if (not ISMouseDrag.dragging or #ISMouseDrag.dragging == 0) then - player:Collapse(state, "Toggle") - loot:Collapse(state, "Toggle") - end - - -- still set this tho - player.fVisible = not state - loot.fVisible = not state -end \ No newline at end of file diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_InventoryPage.lua b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_InventoryPage.lua new file mode 100755 index 0000000..c6a8a64 --- /dev/null +++ b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_InventoryPage.lua @@ -0,0 +1,703 @@ +------------------------------------------ +-- SpiffUI Inventory +------------------------------------------ + +-- Add module +SpiffUI = SpiffUI or {} + +-- Register our inventory +local spiff = SpiffUI:Register("inventory") + +------------------------------------------ +-- on game start, we take over the Inventory +local function spiffInit(id) + -- We still setup our stuff, but if not enabled nothing happens + local player = getSpecificPlayer(id) + local isMouse = (id == 0) and (not JoypadState.players[1]) + + local inv = getPlayerInventory(id) + local loot = getPlayerLoot(id) + + if spiff.config.enabled then + -- Set the inventories to be closed on start + --local isVis = inv:getIsVisible() + inv:InitSUI() + loot:InitSUI() + end + + -- Make them Friends! + inv.friend = loot + loot.friend = inv + + if isMouse then + -- Start collapsed tho + inv:Collapse(true, "Start") + loot:Collapse(true, "Start") + end + + -- Sometimes we just have to re-run this, nbd + SpiffUI:updateEquippedItem() +end + +-- Reset our inventory to the default location +---- This only occurs for user "0" as this is the only user that uses mouse/keys +local function spiffReset() + local isMouse = (not JoypadState.players[1]) + if isMouse then + getPlayerInventory(0):SUIReset() + getPlayerLoot(0):SUIReset() + end +end + +spiff.CreatePlayer = spiffInit +spiff.Reset = spiffReset +spiff.resetDesc = " Inventory Panel Location & Size " + +------------------------------------------ +-- Mingler +------------------------------------------ +local mingler = require("SUI/SUI_mingler") + +spiff.Start = function() + Events.OnRefreshInventoryWindowContainers.Add(mingler.OnRefreshInventoryWindowContainers) +end + +------------------------------------------ +-- ADDITIONS +------------------------------------------ +function ISInventoryPage:isMouseInBuffer() + if self.resizeWidget2.resizing then return true end + + -- So the inventory disappearing isn't so sensitive + local buffer = 32 + local boX = buffer * (-1) + local boY = 0 -- can't really go further up at the top + local boW = self:getWidth() + buffer + local boH = self:getHeight() + buffer + + local x = self:getMouseX() + local y = self:getMouseY() + + return (x >= boX and x <= boW) and (y >= boY and y <= boH) +end + +function ISInventoryPage:isMouseIn() + if self.resizeWidget2.resizing then return true end + + -- So the inventory disappearing isn't so sensitive + local boX = 0 + local boY = 0 -- can't really go further up at the top + local boW = self:getWidth() + local boH = self:getHeight() + + local x = self:getMouseX() + local y = self:getMouseY() + + return (x >= boX and x <= boW) and (y >= boY and y <= boH) +end + +function ISInventoryPage:isMouseInTop() + -- So the inventory disappearing isn't so sensitive + local buffer = 32 + local boX = buffer * (-1) + local boY = 0 -- can't really go further up at the top + local boW = self:getWidth() + buffer + local boH = self:titleBarHeight() + buffer + + local x = self:getMouseX() + local y = self:getMouseY() + + return (x >= boX and x <= boW) and (y >= boY and y <= boH) +end + +function ISInventoryPage:InitSUI() + -- Cache our player + self.playerObj = getSpecificPlayer(self.player) + + -- If player is on a controller + self.isMouse = (self.player == 0) and (not JoypadState.players[1]) + + -- If force visible + self.fVisible = false + -- autohide is used on mouse-over only + self.autoHide = false + -- Used to toggle Autohide until interaction with window + self.holdOpen = false + -- If being dragged to + self.toDrag = false + -- If dragged from here + self.fromDrag = false + -- If was opened from drag + self.wasDrag = false + + self.wasVisible = false + --self.mouseHide = spiff.config.mouseHide +end + +function ISInventoryPage:SUIReset() + local x = getPlayerScreenLeft(self.player) + local y = getPlayerScreenTop(self.player) + local w = getPlayerScreenWidth(self.player) + local h = getPlayerScreenHeight(self.player) + + local divhei = 0 + local divwid = 0 + divhei = h / 3; + + if w < h then + divhei = h / 4; + end + + divwid = round(w / 3) + if divwid < 256 + 32 then + -- min width of ISInventoryPage + divwid = 256 + 32 + end + + if self.onCharacter then + self:setX(x + w / 2 - divwid) + else + self:setX(x + w / 2) + end + self:setY(y) + self:setWidth(divwid) + self:setHeight(divhei) + + -- Set the column sizes too! + local column2 = 48 + local column3 = (self.width - column2) / 4 + local column3 = math.ceil(column3*self.inventoryPane.zoom) + local column3 = (column3) + 100 + + self.inventoryPane.column2 = column2 + self.inventoryPane.column3 = column3 + + self.inventoryPane.nameHeader:setX(column2) + self.inventoryPane.nameHeader:setWidth((column3 - column2)) + + self.inventoryPane.typeHeader:setX(column3-1) + self.inventoryPane.typeHeader:setWidth(self.width - column3 + 1) +end + +ISInventoryPage.SpiffOnKey = function(playerObj) + local player = getPlayerInventory(0) + local loot = getPlayerLoot(0) + local state = not player.isCollapsed and not loot.isCollapsed + + if not spiff.config.enabled then + state = not player:getIsVisible() + player:setVisible(state) + loot:setVisible(state) + return + end + + -- if dragging and tab is pressed, don't do the toggle. it resets the state + if (not ISMouseDrag.dragging or #ISMouseDrag.dragging == 0) then + player:Collapse(state, "Toggle") + loot:Collapse(state, "Toggle") + end + + -- still set this tho + player.fVisible = not state + loot.fVisible = not state +end + +------------------------------------------ +-- ISInventoryPage:setVisible +local _ISInventoryPage_setVisible = ISInventoryPage.setVisible +function ISInventoryPage:setVisible(vis) + if not spiff.config.enabled or not self.isMouse then + _ISInventoryPage_setVisible(self, vis) + return + end + + -- This gets called at the start of the game before init, so just don't do anything yet. + if not self.friend then return end + + self:Collapse(not vis, "setVisible") + + if vis then + --- This is really only called when the world interacts now + --- So let's treat it as such + self.holdOpen = true + self.autoHide = true + end +end + +function ISInventoryPage:setVisibleReal(vis) + _ISInventoryPage_setVisible(self, vis) +end + +------------------------------------------ +-- ISInventoryPage:getIsVisible +local _ISInventoryPage_getIsVisible = ISInventoryPage.getIsVisible +function ISInventoryPage:getIsVisible() + if not spiff.config.enabled or not self.isMouse then + return _ISInventoryPage_getIsVisible(self) + end + return not self.isCollapsed +end + +------------------------------------------ +-- ISInventoryPage:onMouseMove +local _ISInventoryPage_onMouseMove = ISInventoryPage.onMouseMove +function ISInventoryPage:onMouseMove(...) + if not spiff.config.enabled or not self.isMouse then + _ISInventoryPage_onMouseMove(self, ...) + return + end + -- Disable this + self.collapseCounter = 0 + + if isGamePaused() then + return + end + + -- if we're collapsed and pressing right mouse, we're probably aiming + --- this shouldn't trigger the inventory + if self.isCollapsed and getSpecificPlayer(self.player):isAiming() then + return + end + + self.mouseOver = true + + -- Disable inventory window moving + if self.moving then + self.moving = false + end + + -- camera panning + local panCameraKey = getCore():getKey("PanCamera") + if self.isCollapsed and panCameraKey ~= 0 and isKeyDown(panCameraKey) then + return + end + + self.fromDrag = false + -- If we are dragging items from this inventory + if (ISMouseDrag.dragging and #ISMouseDrag.dragging > 0) and not self.toDrag and not self.fromDrag then + self.fromDrag = true + end + + -- First we touch the window, then close + if self.holdOpen then + self.holdOpen = false + end + + self.prevMouse = self.mouseOver +end + +------------------------------------------ +-- ISInventoryPage:onMouseMoveOutside +local _ISInventoryPage_onMouseMoveOutside = ISInventoryPage.onMouseMoveOutside +function ISInventoryPage:onMouseMoveOutside(...) + if not spiff.config.enabled or not self.isMouse then + _ISInventoryPage_onMouseMoveOutside(self, ...) + return + end + + if isGamePaused() then + return + end + self.mouseOver = false; + + if self.moving then + self.moving = false + end + + if self.wasDrag then + self.wasDrag = self.friend.mouseOver + end + + self.prevMouse = self.mouseOver +end + +------------------------------------------ +-- ISInventoryPage:onMouseDownOutside +local _ISInventoryPage_onMouseDownOutside = ISInventoryPage.onMouseDownOutside +function ISInventoryPage:onMouseDownOutside(...) + if not spiff.config.enabled or not self.isMouse then + _ISInventoryPage_onMouseDownOutside(self, ...) + return + end + + if not self.fVisible and not self.isCollapsed and not self:isMouseInBuffer() and not self.fromDrag and not self.toDrag and not self.wasDrag then + self:Collapse(true, "onMouseDownOutside") + end +end + +------------------------------------------ +-- ISInventoryPage:onRightMouseDownOutside +local _ISInventoryPage_onRightMouseDownOutside = ISInventoryPage.onRightMouseDownOutside +function ISInventoryPage:onRightMouseDownOutside(...) + if not spiff.config.enabled or not self.isMouse then + _ISInventoryPage_onRightMouseDownOutside(self, ...) + return + end + + if not self.fVisible and not self.isCollapsed and not self:isMouseInBuffer() and not self.fromDrag and not self.toDrag and not self.wasDrag then + self:Collapse(true, "onRightMouseDownOutside") + end +end + +-- this is a hack to catch when the vanilla expand is done, we add a parameter to run it or logic to undo it +function ISInventoryPage:clearMaxDrawHeight(extra) + if not self.isMouse or extra or self.fVisible then + ISUIElement.clearMaxDrawHeight(self) + return + end + + if not self.autoHide and not self.fromDrag and not self.toDrag and not self.wasDrag and not self.holdOpen then + self.isCollapsed = true + else + ISUIElement.clearMaxDrawHeight(self) + end +end + +local equipSort = require("SUI/SUI_InventorySorter") + +------------------------------------------ +-- ISInventoryPage:createChildren +local _ISInventoryPage_createChildren = ISInventoryPage.createChildren +function ISInventoryPage:createChildren() + _ISInventoryPage_createChildren(self) + + if spiff.config.enabled and self.isMouse then + self.closeButton:setVisible(false) + self.infoButton:setVisible(false) + self.pinButton:setVisible(false) + self.collapseButton:setVisible(false) + self.resizeWidget:setVisible(false) + + self.infoButton:setX(self.closeButton:getX()) + + self.minimumHeight = getPlayerScreenHeight(self.player) / 4 + end + + -- render stuff + -- self.resizeWidget2:setHeight(self:titleBarHeight()) + -- self.resizeWidget2:setY(self:getHeight()-self:titleBarHeight()) + + -- We add our inventory containers to the loot panel itself + self.CM = {} + + if not self.onCharacter then + self.CM.container = mingler:new(self.player, getText("UI_SpiffUI_Inv_containers"), "SpiffContainer", "media/spifficons/spiffcontainers.png") -- "media/ui/Inventory2_On.png" + self.CM.bodies = mingler:new(self.player, getText("UI_SpiffUI_Inv_bodies"), "SpiffBodies", "media/spifficons/spiffbodies.png" ) -- "media/ui/Container_DeadPerson_MaleZombie.png" + self.coloredInvs = {} + self.keptButtons = nil + else + local playerObj = getSpecificPlayer(self.player) + self.CM.container = mingler:new(self.player, getText("UI_SpffUI_Inv_selfpack", playerObj:getDescriptor():getForename(), playerObj:getDescriptor():getSurname()), "SpiffPack", "media/spifficons/spiffpack.png" ) -- "media/ui/Inventory2_On.png" + self.CM.bodies = mingler:new(self.player, getText("UI_SpffUI_Inv_equippack", playerObj:getDescriptor():getForename(), playerObj:getDescriptor():getSurname()), "SpiffEquip", "media/spifficons/spiffequip.png") + self.inventoryPane.equipSort = equipSort.itemsList + end + + self.titleLoc = self.infoButton:getX() + self.infoButton:getWidth() + 4 +end + +-- Don't allow to drag items into a Mingle button +local _ISInventoryPage_canPutIn = ISInventoryPage.canPutIn +function ISInventoryPage:canPutIn() + local container = self.mouseOverButton and self.mouseOverButton.inventory or nil + if not container then + return false + end + local mnglr = self:getMingler(self.mouseOverButton.inventory:getType()) + if mnglr then + if mnglr.spiffI > 0 then + return (mnglr:canPutIn() ~= nil) + end + return false + end + return _ISInventoryPage_canPutIn(self) +end + +local _ISInventoryPage_onBackpackRightMouseDown = ISInventoryPage.onBackpackRightMouseDown +function ISInventoryPage:onBackpackRightMouseDown(x, y) + if mingler.types[self.inventory:getType()] ~= nil then return end + _ISInventoryPage_onBackpackRightMouseDown(self,x,y) +end + +function ISInventoryPage:Collapse(collapse, why) + --if self.isCollapsed == collapse then return end + + -- local label + -- if self.onCharacter then + -- label = "Player" + -- else + -- label = "Loot" + -- end + + -- if collapse then + -- print("Collapsing: " .. label .. " | " .. why) + -- else + -- print("Showing: " .. label .. " | " .. why) + -- end + + -- If we get here and there's no friend, re-run the init + if not self.friend then + spiffInit(self.player) + end + + self.isCollapsed = collapse + if self.isCollapsed then + self:setMaxDrawHeight(self:titleBarHeight()) + self.holdOpen = false + if spiff.config.enabled then + if self.friend.isCollapsed then + _ISInventoryPage_setVisible(self, spiff.config.invVisible) + _ISInventoryPage_setVisible(self.friend, spiff.config.invVisible) + end + self.autoHide = false + self.holdOpen = false + self.toDrag = false + self.fromDrag = false + self.wasDrag = false + self.collapsing = true + end + else + if isClient() and not self.onCharacter then + self.inventoryPane.inventory:requestSync() + end + self:clearMaxDrawHeight(true) + self.collapseCounter = 0 + if spiff.config.enabled then + _ISInventoryPage_setVisible(self, true) + _ISInventoryPage_setVisible(self.friend, true) + end + end +end + +local mings = { + ["SpiffContainer"] = 1, + ["SpiffPack"] = 1, + ["SpiffBodies"] = 2, + ["SpiffEquip"] = 2 +} +function ISInventoryPage:getMingler(name) + if mings[name] == 1 then + return self.CM.container + elseif mings[name] == 2 then + return self.CM.bodies + else + return nil + end +end + +------------------------------------------ +-- MISC OTHER THINGS +----- These should probably be in their own file, but eh. xD +------------------------------------------ + +------------------------------------------ +-- We don't want the inventory to change if we are transferring from a Mingle container +local _ISInventoryTransferAction_doActionAnim = ISInventoryTransferAction.doActionAnim +function ISInventoryTransferAction:doActionAnim(cont) + --if luautils.stringStarts(getPlayerLoot(self.character:getPlayerNum()).inventory:getType(), "Spiff") then + local loot = getPlayerLoot(self.character:getPlayerNum()) + local mingler = loot:getMingler(loot.inventory:getType()) + if mingler then + self.selectedContainer = loot.inventory + end + + _ISInventoryTransferAction_doActionAnim(self, cont) +end + +--local keyring = {["KeyRing"] = true} +local getNextKeyRing = function(player, key) + local inv = getPlayerInventory(player:getPlayerNum()) + for _, v in ipairs(inv.backpacks) do + if mingler.keyring[v.inventory:getType()] then --and v.inventory:canPutIn(key) then + return v.inventory + end + end + return nil +end + +Events.OnGameStart.Add(function() + -- This is actually unused, so lets just use this one! + ---- Let's do this here, because I'm sure other modders have the same idea + local _ISInventoryTransferAction_waitToStart = ISInventoryTransferAction.waitToStart + function ISInventoryTransferAction:waitToStart() + -- True if a container is on a character + local char = self.destContainer:getCharacter() + if char then + if char == self.character then + --Send keys to the keyring + if instanceof(self.item, "Key") and spiff.config.handleKeys then + -- default to the destContainer + self.destContainer = getNextKeyRing(self.character, self.item) or self.destContainer + end + return false + end + end + + + local loot = getPlayerLoot(self.character:getPlayerNum()) + local mingler = loot:getMingler(self.destContainer:getType()) + if mingler then + -- default to the floor + self.destContainer = mingler:canPutIn({self.item}) or ISInventoryPage.GetFloorContainer(self.character:getPlayerNum()) + end + return _ISInventoryTransferAction_waitToStart(self) + end +end) + +------------------------------------------ +-- Long OVERRIDES +------------------------------------------ +Events.OnGameStart.Add(function() + local _ISInventoryPage_update = ISInventoryPage.update + function ISInventoryPage:update() + _ISInventoryPage_update(self) + + ------------------------------------------ + -- Mingler + if not self.onCharacter then + -- Clear highlighted inventories + for _,v in ipairs(self.coloredInvs) do + if v:getParent() then + v:getParent():setHighlighted(false) + end + end + table.wipe(self.coloredInvs) + + local mingle = self:getMingler(self.inventory:getType()) + if mingle then + if not self.isCollapsed then + -- highlight all inventories + + for _,v in ipairs(mingle.invs) do + if v:getParent() and (instanceof(v:getParent(), "IsoObject") or instanceof(v:getParent(), "IsoDeadBody")) then + v:getParent():setHighlighted(true, false) + v:getParent():setHighlightColor(getCore():getObjectHighlitedColor()) + table.insert(self.coloredInvs, v) + end + end + end + end + local inv = getPlayerInventory(self.player) + local mnglr = inv:getMingler(inv.inventory:getType()) + if mnglr then + self.lootAll:setVisible(false) + else + self.lootAll:setVisible(true) + end + else + local mingle = self:getMingler(self.inventory:getType()) + if mingle and mingle.spiffI == -1 then + self.transferAll:setVisible(false) + else + self.transferAll:setVisible(true) + end + end + ------------------------------------------ + + if not spiff.config.enabled then + return + end + + self.closeButton:setVisible(false) + self.infoButton:setVisible(false) + self.pinButton:setVisible(false) + self.collapseButton:setVisible(false) + self.resizeWidget:setVisible(false) + + if not self.isMouse then + return + end + + ------------------------------------------ + self.collapseCounter = 0 + + self.wasVisible = not self.isCollapsed + + if not self.onCharacter and not self.isCollapsed and self.inventoryPane.inventory:getType() == "floor" and self.inventoryPane.inventory:getItems():isEmpty() then + if self.autoHide and self.holdOpen and not self.prevMouse and not spiff.config.mouseHide then + self:Collapse(true, "No Floor Items") + end + end + + if not self.isCollapsed then + + if not self.fVisible then + -- When we stop dragging, set panel to close after next mouseout or click, or set to tie with our friend + if (not ISMouseDrag.dragging or #ISMouseDrag.dragging == 0) then + if self.fromDrag then + self.fromDrag = false + self.autoHide = true + self.wasDrag = self.friend.mouseOver + self.holdOpen = not self.wasDrag + end + + + if self.toDrag then + -- If we're not dragging anything and we're not moused over and not from where we started, close + if not self.mouseOver then + self.toDrag = false + self.autoHide = true + end + + -- If we're no longer dragging items, but we're still on our window + if self:isMouseInBuffer() then + self.toDrag = false + end + end + else + -- If we have dragged items, but we're not in our window + if self.toDrag and not self:isMouseInBuffer() then + self.toDrag = false + self.autoHide = true + end + end + + end + + -- If we should autohide + --- prevmouse is to not have this happen immediately, we need a tick for other logic to kick in on state change + --- holdOpen should prevent the window from closing if we click on an object + --- We do this here so we can check the mouse location with our buffer + if not self.fVisible and not spiff.config.mouseHide and self.autoHide + and not self.prevMouse and not self.holdOpen and not self.fromDrag + and not self.toDrag and not self.wasDrag and not self:isMouseInBuffer() + and not getPlayerContextMenu(self.player):isReallyVisible() then + self:Collapse(true, "Autohide") + end + + else + + -- If we are dragging items from the other inventory to our window + if not self.fVisible then + if (ISMouseDrag.dragging and #ISMouseDrag.dragging > 0) and not self.fromDrag and self:isMouseInBuffer() then + self:Collapse(false, "From Drag!") + self.toDrag = true + self.autoHide = true + end + + -- If mouse is at the top of the screen, show. but not when esc is used, or when a context menu is visible, or right mouse button is down + if not self.toDrag and not self.fromDrag and not getSpecificPlayer(self.player):isAiming() and not self.collapsing + and not MainScreen.instance:isVisible() and not getPlayerContextMenu(self.player):isReallyVisible() then + if not self.friend.wasVisible then + if self:isMouseInTop() then + self:Collapse(false, "MouseMoveIn") + self.autoHide = true + end + else + if self:isMouseIn() then + self:Collapse(false, "MouseMoveInFriend") + self.autoHide = true + end + end + end + else + self:Collapse(false, "force visible") + end + end + + if self.collapsing then + self.collapsing = false + end + + --self:syncButtonsLoc() + end +end) \ No newline at end of file diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_InventoryPane.lua b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_InventoryPane.lua new file mode 100755 index 0000000..d06a5d5 --- /dev/null +++ b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_InventoryPane.lua @@ -0,0 +1,549 @@ +------------------------------------------ +-- SpiffUI Inventory +------------------------------------------ + +-- Add module +SpiffUI = SpiffUI or {} + +-- Register our inventory +local spiff = SpiffUI:Register("inventory") + +local _ISInventoryPane_doButtons = ISInventoryPane.doButtons +-- Override so that the character minlger has no inventory options +function ISInventoryPane:doButtons(y) + if self.parent.onCharacter then + local mnglr = self.parent:getMingler(self.inventory:getType()) + if not mnglr then + return _ISInventoryPane_doButtons(self,y) + elseif mnglr.spiffI == -1 then + --return _ISInventoryPane_doButtons(self,y) + end + else + local playerInv = getPlayerInventory(self.player) + if not playerInv:getMingler(playerInv.inventory:getType()) then + return _ISInventoryPane_doButtons(self,y) + end + end + self.contextButton1:setVisible(false) + self.contextButton2:setVisible(false) + self.contextButton3:setVisible(false) +end + +------------------------------------------ +-- Don't allow to drag items into the active Mingle container +local _ISInventoryPane_canPutIn = ISInventoryPane.canPutIn +function ISInventoryPane:canPutIn() + local mnglr = self.parent:getMingler(self.inventory:getType()) + if mnglr then + if mnglr.spiffI == 1 then + return (self.parent.CM.bodies:canPutIn() ~= nil) + elseif mnglr.spiffI == 2 then + return (self.parent.CM.container:canPutIn() ~= nil) + end + return false + end + return _ISInventoryPane_canPutIn(self) +end + +local _ISInventoryPane_transferItemsByWeight = ISInventoryPane.transferItemsByWeight +function ISInventoryPane:transferItemsByWeight(items, container) + local mnglr = self.parent:getMingler(container:getType()) + print("What up from mingler") + if mnglr then + if mnglr.spiffI > 0 then + container = mnglr:canPutIn() + if container then print("Have a container") end + if not container then return end + else + return + end + end + _ISInventoryPane_transferItemsByWeight(self, items, container) +end + +local _ISInventoryPane_onMouseDoubleClick = ISInventoryPane.onMouseDoubleClick +function ISInventoryPane:onMouseDoubleClick(x, y) + -- if this is the inventory, always do the double click action + if self.parent.onCharacter then + if self.parent:getMingler(self.inventory:getType()) then + if self.items and self.mouseOverOption and self.previousMouseUp == self.mouseOverOption then + local item = self.items[self.mouseOverOption] + if item and item.items then + for k, v in ipairs(item.items) do + if k ~= 1 then + self:doContextualDblClick(v) + end + end + return + end + end + else + return _ISInventoryPane_onMouseDoubleClick(self, x, y) + end + else + -- Otherwise, don't do the double-click if the inventory mingler is open + local playerInv = getPlayerInventory(self.player) + local mnglr = playerInv:getMingler(playerInv.inventory:getType()) + if not mnglr then + _ISInventoryPane_onMouseDoubleClick(self, x, y) + end + end +end + +-- local equipSort = require("SUI/SUI_InventorySorter") + +-- function ISInventoryPane:toggleEquipSort() +-- if self.equipSort then +-- self.equipSort = nil +-- else +-- self.equipSort = equipSort.itemsList +-- end +-- self:refreshContainer() +-- end + +-- -- local _ISInventoryPane_onFilterMenu = ISInventoryPane.onFilterMenu +-- -- function ISInventoryPane:onFilterMenu(button) +-- -- _ISInventoryPane_onFilterMenu(self, button) +-- -- if not self.parent.onCharacter and getSpecificPlayer(self.player):isAsleep() then +-- -- return +-- -- end +-- -- local mnglr = self.parent:getMingler(self.parent.inventory:getType()) +-- -- if mnglr and mnglr.spiffI == -1 then +-- -- getPlayerContextMenu(self.player):addOption("What Up", self, ISInventoryPane.toggleEquipSort) +-- -- end +-- -- end + +local _ISInventoryPane_refreshContainer = ISInventoryPane.refreshContainer +function ISInventoryPane:refreshContainer() + _ISInventoryPane_refreshContainer(self) + + local newlist = {} + self.equiplist = {} + self.hotlist = {} + local i,j,h = 1,1,1 + for k, v in ipairs(self.itemslist) do + if v then + if v.equipped or v.inHotbar then + self.equiplist[j] = self.itemslist[k] + j = j+1 + + else + newlist[i] = self.itemslist[k] + i = i+1 + end + end + end + if spiff.config.hideEquipped then + self.itemslist = newlist + end + + if self.equipSort then + table.sort(self.equiplist, self.equipSort) + end +end + +------------------------------------------ +-- Visually show no dragging +local allowed = { + ["SpiffBodies"] = true, + ["SpiffContainer"] = true, + ["SpiffPack"] = false, + ["SpiffEquip"] = false +} +local _DraggedItems_update = ISInventoryPaneDraggedItems.update +function ISInventoryPaneDraggedItems:update() + self.playerNum = self.inventoryPane.player + local playerInv = getPlayerInventory(self.playerNum) + if self.mouseOverContainer then + if allowed[self.mouseOverContainer:getType()] then + if getPlayerLoot(self.playerNum):getMingler(self.mouseOverContainer:getType()):canPutIn() == nil then + self.itemNotOK = {} + self.validItems = {} + for _,v in pairs(self.items) do + self.itemNotOK[v] = true + end + end + elseif allowed[self.mouseOverContainer:getType()] == false then + self.itemNotOK = {} + self.validItems = {} + for _,v in pairs(self.items) do + self.itemNotOK[v] = true + end + end + -- end + end + _DraggedItems_update(self) +end + +ISInventoryPaneContextMenu.onGrabItems = function(items, player) + local playerInv = getPlayerInventory(player) + local mnglr = playerInv:getMingler(playerInv.inventory:getType()) + if not mnglr then + ISInventoryPaneContextMenu.transferItems(items, playerInv.inventory, player) + end +end + +local _ISInventoryPaneContextMenu_onGrabOneItems = ISInventoryPaneContextMenu.onGrabOneItems +ISInventoryPaneContextMenu.onGrabOneItems = function(items, player) + local playerInv = getPlayerInventory(player) + local mnglr = playerInv:getMingler(playerInv.inventory:getType()) + if not mnglr then + _ISInventoryPaneContextMenu_onGrabOneItems(items, player) + end +end + +local _ISInventoryPaneContextMenu_doGrabMenu = ISInventoryPaneContextMenu.doGrabMenu +function ISInventoryPaneContextMenu.doGrabMenu(context, items, player) + local playerInv = getPlayerInventory(player) + local mnglr = playerInv:getMingler(playerInv.inventory:getType()) + if not mnglr then + _ISInventoryPaneContextMenu_doGrabMenu(context, items, player) + end +end + +local _ISInventoryPaneContextMenu_isAnyAllowed = ISInventoryPaneContextMenu.isAnyAllowed +function ISInventoryPaneContextMenu.isAnyAllowed(container, items) + if allowed[container:getType()] or allowed[container:getType()] == nil then + return _ISInventoryPaneContextMenu_isAnyAllowed(container, items) + end + return false +end + + +Events.OnGameStart.Add(function() + if not spiff.config.spiffequip then return end + local _ISInventoryPane_renderdetails = ISInventoryPane.renderdetails + function ISInventoryPane:renderdetails(doDragged) + if self.inventory:getType() == "SpiffEquip" then + self:updateScrollbars(); + + if doDragged == false then + table.wipe(self.items) + + if self.inventory:isDrawDirty() then + self:refreshContainer() + end + end + + local player = getSpecificPlayer(self.player) + + local checkDraggedItems = false + if doDragged and self.dragging ~= nil and self.dragStarted then + self.draggedItems:update() + checkDraggedItems = true + end + + if not doDragged then + -- background of item icon + self:drawRectStatic(0, 0, self.column2, self.height, 0.6, 0, 0, 0); + end + local y = 0; + local alt = false; + if self.equiplist == nil then + self:refreshContainer(); + end + local MOUSEX = self:getMouseX() + local MOUSEY = self:getMouseY() + local YSCROLL = self:getYScroll() + local HEIGHT = self:getHeight() + local equippedLine = false + for k, v in ipairs(self.equiplist) do + local count = 1; + -- Go through each item in stack.. + for k2, v2 in ipairs(v.items) do + local item = v2; + local doIt = true; + local xoff = 0; + local yoff = 0; + if doDragged == false then + -- if it's the first item, then store the category, otherwise the item + if count == 1 then + table.insert(self.items, v); + else + table.insert(self.items, item); + end + if instanceof(item, 'InventoryItem') then + item:updateAge() + end + if instanceof(item, 'Clothing') then + item:updateWetness() + end + end + -- print("trace:b"); + local isDragging = false + if self.dragging ~= nil and self.selected[y+1] ~= nil and self.dragStarted then + xoff = MOUSEX - self.draggingX; + yoff = MOUSEY - self.draggingY; + if not doDragged then + doIt = false; + else + self:suspendStencil(); + isDragging = true + end + else + if doDragged then + doIt = false; + end + end + local topOfItem = y * self.itemHgt + YSCROLL + if not isDragging and ((topOfItem + self.itemHgt < 0) or (topOfItem > HEIGHT)) then + doIt = false + end + -- print("trace:c"); + if doIt == true then + -- print("trace:cc"); + -- print(count); + if count == 1 then + -- rect over the whole item line + -- self:drawRect(1+xoff, (y*self.itemHgt)+self.headerHgt+yoff, self:getWidth(), 1, 0.3, 0.0, 0.0, 0.0); + end + -- print("trace:d"); + + -- do controller selection. + if self.joyselection ~= nil and self.doController then + -- if self.joyselection < 0 then self.joyselection = (#self.itemslist) - 1; end + -- if self.joyselection >= #self.itemslist then self.joyselection = 0; end + if self.joyselection == y then + self:drawRect(1+xoff, (y*self.itemHgt)+self.headerHgt+yoff, self:getWidth()-1, self.itemHgt, 0.2, 0.2, 1.0, 1.0); + end + end + -- print("trace:e"); + + -- only do icon if header or dragging sub items without header. + local tex = item:getTex(); + if tex ~= nil then + local texDY = 1 + local texWH = math.min(self.itemHgt-2,32) + local auxDXY = math.ceil(20 * self.texScale) + if count == 1 then + self:drawTextureScaledAspect(tex, 10+xoff, (y*self.itemHgt)+self.headerHgt+texDY+yoff, texWH, texWH, 1, item:getR(), item:getG(), item:getB()); + if player:isEquipped(item) then + self:drawTexture(self.equippedItemIcon, (10+auxDXY+xoff), (y*self.itemHgt)+self.headerHgt+auxDXY+yoff, 1, 1, 1, 1); + end + if not self.hotbar then + self.hotbar = getPlayerHotbar(self.player); + end + if not player:isEquipped(item) and self.hotbar and self.hotbar:isInHotbar(item) then + self:drawTexture(self.equippedInHotbar, (10+auxDXY+xoff), (y*self.itemHgt)+self.headerHgt+auxDXY+yoff, 1, 1, 1, 1); + end + if item:isBroken() then + self:drawTexture(self.brokenItemIcon, (10+auxDXY+xoff), (y*self.itemHgt)+self.headerHgt+auxDXY-1+yoff, 1, 1, 1, 1); + end + if instanceof(item, "Food") and item:isFrozen() then + self:drawTexture(self.frozenItemIcon, (10+auxDXY+xoff), (y*self.itemHgt)+self.headerHgt+auxDXY-1+yoff, 1, 1, 1, 1); + end + if (item:isTaintedWater() and getSandboxOptions():getOptionByName("EnableTaintedWaterText"):getValue()) or player:isKnownPoison(item) then + self:drawTexture(self.poisonIcon, (10+auxDXY+xoff), (y*self.itemHgt)+self.headerHgt+auxDXY-1+yoff, 1, 1, 1, 1); + end + if item:isFavorite() then + self:drawTexture(self.favoriteStar, (13+auxDXY+xoff), (y*self.itemHgt)+self.headerHgt-1+yoff, 1, 1, 1, 1); + end + elseif v.count > 2 or (doDragged and count > 1 and self.selected[(y+1) - (count-1)] == nil) then + self:drawTextureScaledAspect(tex, 10+16+xoff, (y*self.itemHgt)+self.headerHgt+texDY+yoff, texWH, texWH, 0.3, item:getR(), item:getG(), item:getB()); + if player:isEquipped(item) then + self:drawTexture(self.equippedItemIcon, (10+auxDXY+16+xoff), (y*self.itemHgt)+self.headerHgt+auxDXY+yoff, 1, 1, 1, 1); + end + if item:isBroken() then + self:drawTexture(self.brokenItemIcon, (10+auxDXY+16+xoff), (y*self.itemHgt)+self.headerHgt+auxDXY-1+yoff, 1, 1, 1, 1); + end + if instanceof(item, "Food") and item:isFrozen() then + self:drawTexture(self.frozenItemIcon, (10+auxDXY+16+xoff), (y*self.itemHgt)+self.headerHgt+auxDXY-1+yoff, 1, 1, 1, 1); + end + if item:isFavorite() then + self:drawTexture(self.favoriteStar, (13+auxDXY+16+xoff), (y*self.itemHgt)+self.headerHgt-1+yoff, 1, 1, 1, 1); + end + end + end + -- print("trace:f"); + if count == 1 then + if not doDragged then + if not self.collapsed[v.name] then + self:drawTexture( self.treeexpicon, 2, (y*self.itemHgt)+self.headerHgt+5+yoff, 1, 1, 1, 0.8); + -- self:drawText("+", 2, (y*18)+16+1+yoff, 0.7, 0.7, 0.7, 0.5); + else + self:drawTexture( self.treecolicon, 2, (y*self.itemHgt)+self.headerHgt+5+yoff, 1, 1, 1, 0.8); + end + end + end + -- print("trace:g"); + + if self.selected[y+1] ~= nil and not self.highlightItem then -- clicked/dragged item + if checkDraggedItems and self.draggedItems:cannotDropItem(item) then + self:drawRect(1+xoff, (y*self.itemHgt)+self.headerHgt+yoff, self:getWidth()-1, self.itemHgt, 0.20, 1.0, 0.0, 0.0); + elseif false and (((instanceof(item,"Food") or instanceof(item,"DrainableComboItem")) and item:getHeat() ~= 1) or item:getItemHeat() ~= 1) then + if (((instanceof(item,"Food") or instanceof(item,"DrainableComboItem")) and item:getHeat() > 1) or item:getItemHeat() > 1) then + self:drawRect(1+xoff, (y*self.itemHgt)+self.headerHgt+yoff, self.column4, self.itemHgt, 0.5, math.abs(item:getInvHeat()), 0.0, 0.0); + else + self:drawRect(1+xoff, (y*self.itemHgt)+self.headerHgt+yoff, self.column4, self.itemHgt, 0.5, 0.0, 0.0, math.abs(item:getInvHeat())); + end + else + self:drawRect(1+xoff, (y*self.itemHgt)+self.headerHgt+yoff, self:getWidth()-1, self.itemHgt, 0.20, 1.0, 1.0, 1.0); + end + elseif self.mouseOverOption == y+1 and not self.highlightItem then -- called when you mose over an element + if(((instanceof(item,"Food") or instanceof(item,"DrainableComboItem")) and item:getHeat() ~= 1) or item:getItemHeat() ~= 1) then + if (((instanceof(item,"Food") or instanceof(item,"DrainableComboItem")) and item:getHeat() > 1) or item:getItemHeat() > 1) then + self:drawRect(1+xoff, (y*self.itemHgt)+self.headerHgt+yoff, self.column4, self.itemHgt, 0.3, math.abs(item:getInvHeat()), 0.0, 0.0); + else + self:drawRect(1+xoff, (y*self.itemHgt)+self.headerHgt+yoff, self.column4, self.itemHgt, 0.3, 0.0, 0.0, math.abs(item:getInvHeat())); + end + else + self:drawRect(1+xoff, (y*self.itemHgt)+self.headerHgt+yoff, self:getWidth()-1, self.itemHgt, 0.05, 1.0, 1.0, 1.0); + end + else + if count == 1 then -- normal background (no selected, no dragging..) + -- background of item line + if self.highlightItem and self.highlightItem == item:getType() then + if not self.blinkAlpha then self.blinkAlpha = 0.5; end + self:drawRect(1+xoff, (y*self.itemHgt)+self.headerHgt+yoff, self.column4, self.itemHgt, self.blinkAlpha, 1, 1, 1); + if not self.blinkAlphaIncrease then + self.blinkAlpha = self.blinkAlpha - 0.05 * (UIManager.getMillisSinceLastRender() / 33.3); + if self.blinkAlpha < 0 then + self.blinkAlpha = 0; + self.blinkAlphaIncrease = true; + end + else + self.blinkAlpha = self.blinkAlpha + 0.05 * (UIManager.getMillisSinceLastRender() / 33.3); + if self.blinkAlpha > 0.5 then + self.blinkAlpha = 0.5; + self.blinkAlphaIncrease = false; + end + end + else + self:drawRect(self.column2+xoff, (y*self.itemHgt)+self.headerHgt+yoff, self.column4, self.itemHgt, 0.2, 0.0, 0.0, 0.0); + end + else + self:drawRect(1+xoff, (y*self.itemHgt)+self.headerHgt+yoff, self.column4, self.itemHgt, 0.4, 0.0, 0.0, 0.0); + end + end + -- print("trace:h"); + + -- divider between equipped and unequipped items + if v.equipped then + if not doDragged and not equippedLine and y > 0 then + self:drawRect(1, ((y+1)*self.itemHgt)+self.headerHgt-1-self.itemHgt, self.column4, 1, 0.2, 1, 1, 1); + end + equippedLine = true + end + + if item:getJobDelta() > 0 and (count > 1 or self.collapsed[v.name]) then + local scrollBarWid = self:isVScrollBarVisible() and 13 or 0 + local displayWid = self.column4 - scrollBarWid + self:drawRect(1+xoff, (y*self.itemHgt)+self.headerHgt+yoff, displayWid * item:getJobDelta(), self.itemHgt, 0.2, 0.4, 1.0, 0.3); + end + -- print("trace:i"); + + local textDY = (self.itemHgt - self.fontHgt) / 2 + + --~ local redDetail = false; + local itemName = item:getName(); + if count == 1 then + + -- if we're dragging something and want to put it in a container wich is full + if doDragged and ISMouseDrag.dragging and #ISMouseDrag.dragging > 0 then + local red = false; + if red then + if v.count > 2 then + self:drawText(itemName.." ("..(v.count-1)..")", self.column2+8+xoff, (y*self.itemHgt)+self.headerHgt+textDY+yoff, 0.7, 0.0, 0.0, 1.0, self.font); + else + self:drawText(itemName, self.column2+8+xoff, (y*self.itemHgt)+self.headerHgt+textDY+yoff, 0.7, 0.0, 0.0, 1.0, self.font); + end + else + if v.count > 2 then + self:drawText(itemName.." ("..(v.count-1)..")", self.column2+8+xoff, (y*self.itemHgt)+self.headerHgt+textDY+yoff, 0.7, 0.7, 0.7, 1.0, self.font); + else + self:drawText(itemName, self.column2+8+xoff, (y*self.itemHgt)+self.headerHgt+textDY+yoff, 0.7, 0.7, 0.7, 1.0, self.font); + end + end + else + local clipX = math.max(0, self.column2+xoff) + local clipY = math.max(0, (y*self.itemHgt)+self.headerHgt+yoff+self:getYScroll()) + local clipX2 = math.min(clipX + self.column3-self.column2, self.width) + local clipY2 = math.min(clipY + self.itemHgt, self.height) + if clipX < clipX2 and clipY < clipY2 then + self:setStencilRect(clipX, clipY, clipX2 - clipX, clipY2 - clipY) + if v.count > 2 then + self:drawText(itemName.." ("..(v.count-1)..")", self.column2+8+xoff, (y*self.itemHgt)+self.headerHgt+textDY+yoff, 0.7, 0.7, 0.7, 1.0, self.font); + else + self:drawText(itemName, self.column2+8+xoff, (y*self.itemHgt)+self.headerHgt+textDY+yoff, 0.7, 0.7, 0.7, 1.0, self.font); + end + self:clearStencilRect() + self:repaintStencilRect(clipX, clipY, clipX2 - clipX, clipY2 - clipY) + end + end + end + -- print("trace:j"); + + --~ if self.mouseOverOption == y+1 and self.dragging and not self.parent:canPutIn(item) then + --~ self:drawText(item:getName(), self.column2+8+xoff, (y*18)+16+1+yoff, 0.7, 0.0, 0.0, 1.0); + --~ else + + if item:getJobDelta() > 0 then + if (count > 1 or self.collapsed[v.name]) then + if self.dragging == count then + self:drawText(item:getJobType(), self.column3+8+xoff, (y*self.itemHgt)+self.headerHgt+textDY+yoff, 0.7, 0.0, 0.0, 1.0, self.font); + else + self:drawText(item:getJobType(), self.column3+8+xoff, (y*self.itemHgt)+self.headerHgt+textDY+yoff, 0.7, 0.7, 0.7, 1.0, self.font); + end + end + + else + if count == 1 then + if doDragged then + -- Don't draw the category when dragging + elseif item:getDisplayCategory() then -- display the custom category set in items.txt + self:drawText(getText("IGUI_ItemCat_" .. item:getDisplayCategory()), self.column3+8+xoff, (y*self.itemHgt)+self.headerHgt+textDY+yoff, 0.6, 0.6, 0.8, 1.0, self.font); + else + self:drawText(getText("IGUI_ItemCat_" .. item:getCategory()), self.column3+8+xoff, (y*self.itemHgt)+self.headerHgt+textDY+yoff, 0.6, 0.6, 0.8, 1.0, self.font); + end + else + local redDetail = false; + self:drawItemDetails(item, y, xoff, yoff, redDetail); + end + + end + if self.selected ~= nil and self.selected[y+1] ~= nil then + self:resumeStencil(); + end + + end + if count == 1 then + if alt == nil then alt = false; end + alt = not alt; + end + + y = y + 1; + + if count == 1 and self.collapsed ~= nil and v.name ~= nil and self.collapsed[v.name] then + if instanceof(item, "Food") then + -- Update all food items in a collapsed stack so they separate when freshness changes. + for k3,v3 in ipairs(v.items) do + v3:updateAge() + end + end + break + end + if count == ISInventoryPane.MAX_ITEMS_IN_STACK_TO_RENDER + 1 then + break + end + count = count + 1; + -- print("trace:zz"); + end + end + self:setScrollHeight((y+1)*self.itemHgt); + self:setScrollWidth(0); + + if self.draggingMarquis then + local w = self:getMouseX() - self.draggingMarquisX; + local h = self:getMouseY() - self.draggingMarquisY; + self:drawRectBorder(self.draggingMarquisX, self.draggingMarquisY, w, h, 0.4, 0.9, 0.9, 1); + end + + + if not doDragged then + self:drawRectStatic(1, 0, self.width-2, self.headerHgt, 1, 0, 0, 0); + end + else + _ISInventoryPane_renderdetails(self,doDragged) + end + end +end) \ No newline at end of file diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_InventorySorter.lua b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_InventorySorter.lua new file mode 100755 index 0000000..13ce257 --- /dev/null +++ b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_InventorySorter.lua @@ -0,0 +1,146 @@ +----- +-- Project Zomboid Clothes Sort +-- Includes categories from mods +----- + +local clothesSort = { + ["Equip"] = 0, + ["Hat"] = 1, + ["Head"] = 2, + ["FullHat"] = 3, + ["FullHelmet"] = 4, + ["Wig"] = 5, + ["FullSuit"] = 6, + ["FullSuitHead"] = 7, + ["FullTop"] = 8, + ["JacketHat"] = 9, + ["JacketHat_Bulky"] = 10, + ["SweaterHat"] = 11, + ["Ears"] = 512, + ["EarTop"] = 513, + ["Eyes"] = 14, + ["Pupils"] = 515, + ["MakeUp_Eyes"] = 516, + ["MakeUp_EyesShadow"] = 517, + ["MaskEyes"] = 518, + ["RightEye"] = 519, + ["LeftEye"] = 520, + ["Nose"] = 521, + ["SMUICosmeticOne"] = 522, + ["SMUICosmeticTwo"] = 523, + ["MakeUp_Lips"] = 524, + ["MakeUp_FullFace"] = 525, + ["Mask"] = 26, + ["MaskFull"] = 27, + ["SpecialMask"] = 28, + ["Neck"] = 529, + ["Necklace"] = 530, + ["Necklace_Long"] = 531, + ["Scarf"] = 32, + ["BellyButton"] = 533, + ["TankTop"] = 34, + ["Shirt"] = 35, + ["Tshirt"] = 36, + ["ShortSleeveShirt"] = 37, + ["Sweater"] = 38, + ["Dress"] = 39, + ["BathRobe"] = 40, + ["Torso1Legs1"] = 41, + ["Jacket"] = 42, + ["JacketSuit"] = 43, + ["Jacket_Bulky"] = 44, + ["Jacket_Down"] = 45, + ["TorsoExtra"] = 46, + ["TorsoExtraPlus1"] = 47, + ["TorsoExtraVest"] = 48, + ["SMUIJumpsuitPlus"] = 49, + ["SMUITorsoRigPlus"] = 50, + ["SMUIWebbingPlus"] = 51, + ["Boilersuit"] = 52, + ["EHEPilotVest"] = 53, + ["TorsoRig"] = 54, + ["TorsoRig2"] = 55, + ["TorsoRigPlus2"] = 56, + ["Back"] = 57, + ["RifleSling"] = 58, + ["AmmoStrap"] = 59, + ["Pauldrons"] = 60, + ["UpperArmRight"] = 61, + ["UpperArmLeft"] = 62, + ["RightArmArmor"] = 63, + ["LeftArmArmor"] = 64, + ["HandPlateRight"] = 65, + ["HandPlateLeft"] = 66, + ["SMUIRightArmPlus"] = 67, + ["SMUILeftArmPlus"] = 68, + ["Hands"] = 69, + ["SMUIGlovesPlus"] = 70, + ["RightWrist"] = 571, + ["LeftWrist"] = 572, + ["Right_MiddleFinger"] = 573, + ["Right_RingFinger"] = 574, + ["Left_MiddleFinger"] = 575, + ["Left_RingFinger"] = 576, + ["Belt"] = 77, + ["Belt419"] = 78, + ["Belt420"] = 79, + ["BeltExtra"] = 80, + ["BeltExtraHL"] = 81, + ["SpecialBelt"] = 82, + ["FannyPackBack"] = 83, + ["FannyPackFront"] = 84, + ["waistbags"] = 85, + ["waistbagsComplete"] = 86, + ["waistbagsf"] = 87, + ["Tail"] = 588, + ["Underwear"] = 89, + ["UnderwearBottom"] = 90, + ["UnderwearExtra1"] = 91, + ["UnderwearExtra2"] = 92, + ["UnderwearInner"] = 93, + ["UnderwearTop"] = 94, + ["LowerBody"] = 95, + ["Legs1"] = 96, + ["Pants"] = 97, + ["Skirt"] = 98, + ["ThighRight"] = 99, + ["ThighLeft"] = 100, + ["Kneepads"] = 101, + ["ShinPlateRight"] = 102, + ["ShinPlateLeft"] = 103, + ["Socks"] = 104, + ["Shoes"] = 105, + ["SMUIBootsPlus"] = 106, + [""] = 200 +} + +-- special lets us define an action for certain items +local special = function(item) + + if instanceof(item, "AlarmClock") or instanceof(item, "AlarmClockClothing") then + -- We don't want the Watch to be grouped with Jewelry + return "Hands" + elseif instanceof(item, "InventoryContainer") and item:getBodyLocation() == "" then + return (item.canBeEquipped and item:canBeEquipped()) or "Back" + elseif instanceof(item, "HandWeapon") and item:getBodyLocation() == "" then + return "Equip" + elseif item:getCategory() == "Light Source" and item:getBodyLocation() == "" then + return "Equip" + else + return nil + end +end + +local Sorter = {} + +Sorter.itemsList = function(a,b) + if a.inHotbar and not b.inHotbar then return true end + if b.inHotbar and not a.inHotbar then return false end + --if a.inHotbar and b.inHotbar then end + local j = a.items[1] + local k = b.items[1] + if not clothesSort[special(j) or j:getBodyLocation()] or not clothesSort[special(k) or k:getBodyLocation()] then return false end + return clothesSort[special(j) or j:getBodyLocation()] < clothesSort[special(k) or k:getBodyLocation()] +end + +return Sorter \ No newline at end of file diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_mingler.lua b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_mingler.lua new file mode 100755 index 0000000..27f32dd --- /dev/null +++ b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SUI/SUI_mingler.lua @@ -0,0 +1,368 @@ +------------------------------------------ +-- Mingler +------------------------------------------ +-- Add module +SpiffUI = SpiffUI or {} + +-- Register our inventory +local spiff = SpiffUI:Register("inventory") + +local mingler = { + zeds = { + ["inventorymale"] = true, + ["inventoryfemale"] = true + }, + types = { + ["SpiffBodies"] = true, + ["SpiffContainer"] = true, + ["SpiffPack"] = false, + ["SpiffEquip"] = false + }, + keyring = { + ["KeyRing"] = true + } +} + +function mingler:new(player, name, ctype, tex) + local o = {} + setmetatable(o, self) + self.__index = self + + o.player = player + + -- Looks like Reorder the Hotbar uses the InventoryContainer to track this, so just make a dummy one + ---- I HAVE to create the item, because just making an InventoryContainer object doesn't give compat with Reorder + o.invContainer = InventoryItemFactory.CreateItem("SpiffUI.Bag") + o.invContainer:setName(name) + o.container = o.invContainer:getInventory() + o.button = nil + o.name = name + o.tex = getTexture(tex) + o.invs = {} + o.ctype = ctype + o.container:setType(ctype) + + o.spiffI = 0 + + if ctype == "SpiffBodies" then + o.spiffI = 1 + elseif ctype == "SpiffContainer" then + o.spiffI = 2 + elseif ctype == "SpiffEquip" then + o.spiffI = -1 + end + + o.tWeight = 0 + + return o +end + +-- Check/make button if needed +function mingler:ckButton(inv) + if not self.button and self.container:getItems():size() > 0 then + --self.index = #inv.backpacks + self.button = inv:addContainerButton(self.container, self.tex, self.name, nil) + end +end + +-- Check/make button if needed +function mingler:forceButton(inv) + if not self.button then + self.button = inv:addContainerButton(self.container, self.tex, self.name, nil) + end +end + +function mingler:hasInv(inv) +end + +function mingler:syncItems(inv) + if mingler.zeds[inv:getType()] then + self.tWeight = self.tWeight + round(ISInventoryPage.loadWeight(inv), 2) + inv:getMaxWeight() -- We have to calculate this for zeds, some go over + else + self.tWeight = self.tWeight + inv:getMaxWeight() + end + self.invContainer:setCapacity(self.tWeight) + + local items = inv:getItems() + if not items or items:size() < 1 then return end -- If the inventory is empty, skip it + if #self.invs == 0 and inv:getType() == "floor" then -- there is only the floor, ignore + return + end + table.insert(self.invs, inv) + + -- Thanks Mx! :D + self.container:getItems():addAll(items) + -- for i=0,items:size() - 1 do + -- local item = items:get(i) + -- if not self.container:contains(item) then + -- self.container:AddItemBlind(item) + -- end + -- end + +end + +function mingler:syncItemsPlayer(inv) + if mingler.keyring[inv:getType()] then return end + local playerObj = getSpecificPlayer(self.player) + if inv == playerObj:getInventory() then + self.tWeight = self.tWeight + round(ISInventoryPage.loadWeight(playerObj:getInventory()), 2) + playerObj:getInventory():getMaxWeight() + else + self.tWeight = self.tWeight + inv:getMaxWeight() + end + self.invContainer:setCapacity(self.tWeight) + local items = inv:getItems() + if not items or items:size() < 1 then return end -- If the inventory is empty, skip it + + table.insert(self.invs, inv) + local hotbar = getPlayerHotbar(self.player) + + for i=0,items:size() - 1 do + local item = items:get(i) + -- Can't really optimize this as we want to only get items that are not equipped, in a hotbar, or a key/keyring + if not playerObj:isEquipped(item) and not self.container:contains(item) and not mingler.keyring[item:getType()] then + -- if instanceof(item, "InventoryContainer") then + -- self:syncItemsPlayer(item:getInventory()) + -- end + if not hotbar:isInHotbar(item) then + self.container:AddItemBlind(item) + end + end + end + +end + +function mingler:syncItemsEquip() + local playerObj = getSpecificPlayer(self.player) + self.tWeight = round(ISInventoryPage.loadWeight(playerObj:getInventory()), 2) + playerObj:getInventory():getMaxWeight() + self.invContainer:setCapacity(self.tWeight) + + local wornItems = getPlayerHotbar(self.player).attachedItems + for k,v in pairs(wornItems) do + if not self.container:contains(v) then + self.container:AddItemBlind(v) + end + end + + local hand = playerObj:getPrimaryHandItem() + if hand and not self.container:contains(hand) then + self.container:AddItemBlind(hand) + end + hand = playerObj:getSecondaryHandItem() + if hand and not self.container:contains(hand) then + self.container:AddItemBlind(hand) + end + + wornItems = playerObj:getWornItems() + for i=0,wornItems:size()-1 do + local item = wornItems:get(i):getItem() + if item and not self.container:contains(item) then + self.container:AddItemBlind(item) + end + end +end + +function mingler:canPutIn(its) + local playerObj = getSpecificPlayer(self.player) + its = its or ISMouseDrag.dragging + for _,inv in ipairs(self.invs) do + if inv == nil then + return nil; + end + if inv:getType() == "floor" then + return inv; + end + + if inv:getParent() == playerObj then + return inv; + end + + local items = {} + -- If the lightest item fits, allow the transfer. + local minWeight = 100000 + local dragging = ISInventoryPane.getActualItems(its) + for i,v in ipairs(dragging) do + local itemOK = true + if v:isFavorite() and not inv:isInCharacterInventory(playerObj) then + itemOK = false + end + -- you can't put the container in itself + if (inv:isInside(v)) then + itemOK = false; + end + if inv:getType() == "floor" and v:getWorldItem() then + itemOK = false + end + if v:getContainer() == inv then + itemOK = false + end + + if not inv:isItemAllowed(v) then + itemOK = false; + end + if itemOK then + table.insert(items, v) + end + if v:getUnequippedWeight() < minWeight then + minWeight = v:getUnequippedWeight() + end + end + if #items == 1 then + if inv:hasRoomFor(playerObj, items[1]) then + return inv + end + end + if inv:hasRoomFor(playerObj, minWeight) then + return inv + end + end + return nil +end + +function mingler:reset() + self.button = nil + + self.tWeight = 0 + + self.container:clear() + table.wipe(self.invs) +end + +local reorder = getActivatedMods():contains('REORDER_CONTAINERS') + +mingler.OnButtonsAddedLoot = function(inv) + if inv.keptButtons then + table.wipe(inv.keptButtons) + end + for i,pButton in ipairs(inv.backpacks) do + -- Ok, so the base game has buttons 1 pixel too high + pButton:setY(pButton:getY() + 1) + + if spiff.config.buttonShow then + if spiff.config.lootinv then + inv.CM.container:forceButton(inv) + end + if spiff.config.sepzeds then + inv.CM.bodies:forceButton(inv) + end + end + + if pButton.onclick then -- if this is false, then it is an inventory we can't interact with (ie locked) + if spiff.config.sepzeds and luautils.stringStarts(pButton.inventory:getType(), "inventory") then + inv.CM.bodies:syncItems(pButton.inventory) + inv.CM.bodies:ckButton(inv) + inv:removeChild(pButton) + elseif not inv:getMingler(pButton.inventory:getType()) then + if spiff.config.lootinv then + inv.CM.container:syncItems(pButton.inventory) + inv.CM.container:ckButton(inv) + end + if spiff.config.sepzeds then + if not inv.keptButtons then inv.keptButtons = {} end + table.insert(inv.keptButtons, pButton) + end + end + end + end + + local prev = inv:getMingler(inv.inventoryPane.lastinventory:getType()) + if prev then + -- do this manually as 1 second is too long + inv.forceSelectedContainer = prev.container + inv.forceSelectedContainerTime = getTimestampMs() + 100 + prev:forceButton(inv) + elseif spiff.config.sepzeds and luautils.stringStarts(inv.inventoryPane.inventory:getType(), "inventory") then + inv.forceSelectedContainer = inv.CM.bodies.container + inv.forceSelectedContainerTime = getTimestampMs() + 100 + inv.CM.bodies:forceButton(inv) + end + + if spiff.config.sepzeds then + if not reorder then + --local floor + local cur = 0 + -- Have to move all of the buttons to their correct locations + for _,v in ipairs(inv.keptButtons) do + v:setY((inv.buttonSize*cur) + (inv:titleBarHeight())) + cur = cur + 1 + --floor = v + end + + if inv.CM.container.button then + --inv.CM.container.button:setY(floor:getY() + inv.buttonSize) + inv.CM.container.button:setY((inv.buttonSize*cur) + (inv:titleBarHeight())) + cur = cur+1 + end + + if inv.CM.bodies.button then + inv.CM.bodies.button:setY((inv.buttonSize*cur) + (inv:titleBarHeight())) + end + end + + else + if inv.keptButtons then + table.wipe(inv.keptButtons) + inv.keptButtons = nil + end + end +end + +mingler.OnButtonsAddedInv = function(inv) + + for _,pButton in ipairs(inv.backpacks) do + -- Ok, so the base game has buttons 1 pixel too high + pButton:setY(pButton:getY() + 1) + + if spiff.config.buttonShow then + if spiff.config.spiffpack then + inv.CM.container:forceButton(inv) + end + end + if spiff.config.spiffpack then + --if not luautils.stringStarts(pButton.inventory:getType(), "Spiff") then + if not inv:getMingler(pButton.inventory:getType()) then + inv.CM.container:syncItemsPlayer(pButton.inventory) + inv.CM.container:ckButton(inv) + end + end + end + + local prev = inv:getMingler(inv.inventoryPane.lastinventory:getType()) + if prev then + -- do this manually as 1 second is too long + inv.forceSelectedContainer = prev.container + inv.forceSelectedContainerTime = getTimestampMs() + 100 + prev:forceButton(inv) + end + + table.sort(inv.CM.container.invs, function(a,b) + return a:getCapacity() > b:getCapacity() + end) +end + +mingler.OnRefreshInventoryWindowContainers = function(inv, state) + if not inv.CM then return end + if not inv.onCharacter then + if state == "begin" then + inv.CM.bodies:reset() + inv.CM.container:reset() + --elseif state == "beforeFloor" then + elseif state == "buttonsAdded" then + mingler.OnButtonsAddedLoot(inv) + end + else + if state == "begin" then + inv.CM.container:reset() + inv.CM.bodies:reset() + if spiff.config.spiffequip then + inv.CM.bodies:forceButton(inv) + inv.CM.bodies:syncItemsEquip() + --inv.CM.bodies:ckButton(inv) + end + --elseif state == "beforeFloor" then + elseif state == "buttonsAdded" then + mingler.OnButtonsAddedInv(inv) + end + end +end + +return mingler \ No newline at end of file diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SpiffUI-Inventory.lua b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SpiffUI-Inventory.lua old mode 100644 new mode 100755 index 238a306..71a7ab5 --- a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SpiffUI-Inventory.lua +++ b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/client/SpiffUI-Inventory.lua @@ -8,7 +8,15 @@ local spiff = SpiffUI:Register("inventory") spiff.config = { enabled = true, - mouseHide = false + mouseHide = false, + invVisible = false, + lootinv = true, + sepzeds = true, + spiffpack = true, + buttonShow = false, + spiffequip = true, + hideEquipped = false, + handleKeys = false } local function SpiffUIBoot() @@ -18,6 +26,15 @@ local function SpiffUIBoot() -- Set options spiff.config.enabled = options.enableInv spiff.config.mouseHide = options.mouseHide + spiff.config.invVisible = options.invVisible + spiff.config.lootinv = options.lootinv + spiff.config.sepzeds = options.sepzeds + spiff.config.spiffpack = options.selfinv + spiff.config.buttonShow = options.buttonShow + spiff.config.spiffequip = options.spiffequip + spiff.config.hideEquipped = options.hideEquipped + spiff.config.handleKeys = options.handleKeys + SpiffUI.equippedItem["Inventory"] = not options.hideInv end @@ -25,6 +42,11 @@ local function SpiffUIBoot() apply(data) local options = data.settings.options SpiffUI:updateEquippedItem() + + if spiff.config.invVisible then + getPlayerInventory(0):setVisibleReal(true) + getPlayerLoot(0):setVisibleReal(true) + end end local INVCONFIG = { @@ -48,6 +70,62 @@ local function SpiffUIBoot() OnApplyMainMenu = apply, OnApplyInGame = apply, }, + invVisible = { + name = "UI_ModOptions_SpiffUI_Inv_invVisible", + default = false, + tooltip = "UI_ModOptions_SpiffUI_Inv_invVisibleTT", + OnApplyMainMenu = apply, + OnApplyInGame = applyGame, + }, + lootinv = { + name = "UI_ModOptions_SpiffUI_Inv_lootinv", + default = true, + tooltip = "UI_ModOptions_SpiffUI_Inv_lootinv_tt", + OnApplyMainMenu = apply, + OnApplyInGame = apply, + }, + sepzeds = { + name = "UI_ModOptions_SpiffUI_Inv_sepzeds", + default = true, + tooltip = "UI_ModOptions_SpiffUI_Inv_sepzeds_tt", + OnApplyMainMenu = apply, + OnApplyInGame = apply, + }, + selfinv = { + name = "UI_ModOptions_SpiffUI_Inv_selfinv", + default = true, + tooltip = "UI_ModOptions_SpiffUI_Inv_selfinv_tt", + OnApplyMainMenu = apply, + OnApplyInGame = apply, + }, + buttonShow = { + name = "UI_ModOptions_SpiffUI_Inv_buttonShow", + default = false, + tooltip = "UI_ModOptions_SpiffUI_Inv_buttonShow_tt", + OnApplyMainMenu = apply, + OnApplyInGame = apply, + }, + spiffequip = { + name = "UI_ModOptions_SpiffUI_EquipButton", + default = true, + tooltip = "UI_ModOptions_SpiffUI_EquipButton_tt", + OnApplyMainMenu = apply, + OnApplyInGame = apply, + }, + hideEquipped = { + name = "UI_ModOptions_SpiffUI_HideEquip", + default = false, + tooltip = "UI_ModOptions_SpiffUI_HideEquip_tt", + OnApplyMainMenu = apply, + OnApplyInGame = apply, + }, + handleKeys = { + name = "UI_ModOptions_SpiffUI_KeyRing", + default = false, + tooltip = "UI_ModOptions_SpiffUI_KeyRing_tt", + OnApplyMainMenu = apply, + OnApplyInGame = apply, + }, }, mod_id = "SpiffUI - Inventory", mod_shortname = "SpiffUI-Inv", @@ -83,4 +161,32 @@ local function SpiffUIBoot() print(getText("UI_Hello_SpiffUI_Inv")) end +spiff.SpiffUIConfig = function() + return { + options = { + enableInv = { + name = "UI_ModOptions_SpiffUI_Inv_enable", + default = true, + tooltip = "UI_ModOptions_SpiffUI_Inv_tooltip_enable", + OnApplyMainMenu = apply, + OnApplyInGame = apply, + }, + hideInv = { + name = "UI_ModOptions_SpiffUI_Inv_hideInv", + default = true, + OnApplyMainMenu = apply, + OnApplyInGame = applyGame, + }, + mouseHide = { + name = "UI_ModOptions_SpiffUI_Inv_mouseHide", + default = false, + OnApplyMainMenu = apply, + OnApplyInGame = apply, + }, + }, + name = "SpiffUI - Inventory", + columns = 4 + } +end + spiff.Boot = SpiffUIBoot \ No newline at end of file diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/shared/Translate/EN/UI_EN.txt b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/shared/Translate/EN/UI_EN.txt old mode 100644 new mode 100755 index ef2594d..4f72698 --- a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/shared/Translate/EN/UI_EN.txt +++ b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/shared/Translate/EN/UI_EN.txt @@ -18,12 +18,39 @@ UI_EN = { UI_Name_SpiffUI_Inv = "SpiffUI - Inventory", - UI_ModOptions_SpiffUI_Inv_enable = "Enable SpiffUI Inventory", - UI_ModOptions_SpiffUI_Inv_tooltip_enable = "Note: A Restart is Required if In-Game!", + UI_ModOptions_SpiffUI_Inv_enable = "Enable SpiffUI Inventory Rules", + UI_ModOptions_SpiffUI_Inv_tooltip_enable = "Locks the inventory in a fixed location and width at the top of the screen, can be resized vertically.Enables better automatic hiding for the Loot Panel when using a mouse. Press the "Inventory" Button to lock open the inventory, and press again to close. Note: A Restart is Required if toggled In-Game!", - UI_ModOptions_SpiffUI_Inv_hideInv = "Hide Inventory Button", + UI_ModOptions_SpiffUI_Inv_hideInv = "Hide Inventory Button in left side menu", - UI_ModOptions_SpiffUI_Inv_mouseHide = "Only hide on Mouse Click", + UI_ModOptions_SpiffUI_Inv_mouseHide = "Only hide Inventory on external Mouse Click", - UI_optionscreen_binding_SpiffUI_Inv = "Toggle Inventory" + UI_optionscreen_binding_SpiffUI_Inv = "Toggle Inventory", + + UI_ModOptions_SpiffUI_Inv_invVisible = "Display Collapsed Inventory and Loot Panels", + UI_ModOptions_SpiffUI_Inv_invVisibleTT = "On collapse of the windows the Headers will continue to be present", + + UI_ModOptions_SpiffUI_Inv_lootinv = "Display available items in loot containers in one pack", + UI_ModOptions_SpiffUI_Inv_lootinv_tt = "Button is shown below the Floor in the Loot Panel, and contains all items from all inventories above it. Items can be transferred from, but not to this inventory.", + UI_ModOptions_SpiffUI_Inv_sepzeds = "Merge Corpses into one icon", + UI_ModOptions_SpiffUI_Inv_sepzeds_tt = "Available Corpses will be merged into a single container that has all items and placed at the bottom. Included items here are excluded from the loot container. Items transferred TO this inventory go to the first available corpse.", + + UI_ModOptions_SpiffUI_Inv_selfinv = "Display all items in player's inventories in one pack", + UI_ModOptions_SpiffUI_Inv_selfinv_tt = "Button is shown at the bottom of the player's Inventory Window, and contains all inventory items EXCEPT equipped and items on the hotbar.", + + UI_ModOptions_SpiffUI_Inv_buttonShow = "Always Show SpiffUI Inventory Buttons", + UI_ModOptions_SpiffUI_Inv_buttonShow_tt = "When disabled, the Corpse and SpiffUI Container Buttons hide when no items are available unless the container is already open", + + UI_ModOptions_SpiffUI_EquipButton = "Enable Equipment Button", + UI_ModOptions_SpiffUI_EquipButton_tt = "Adds button to manage your player's equipment to the Inventory. NOTE: Requires Restart to enable if in game. Recommended to Restart to disable if in game.", + UI_ModOptions_SpiffUI_HideEquip = "Hide Equipment and Hotbar Items in General Inventory", + UI_ModOptions_SpiffUI_HideEquip_tt = "Hides equipment from the inventory. NOTE: You must have the Equipment Button enabled, or another Equipment Manager to manage equipment.", + + UI_ModOptions_SpiffUI_KeyRing = "Auto add Keys to available KeyRing", + UI_ModOptions_SpiffUI_KeyRing_tt = "Merges keys to the first available keyring when transferring to the player.", + + UI_SpiffUI_Inv_bodies = "All Zombie Corpses", + UI_SpiffUI_Inv_containers = "All Containers", + UI_SpffUI_Inv_selfpack = "%1 %2's Megapack", + UI_SpffUI_Inv_equippack = "%1 %2's Equipment" } \ No newline at end of file diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/shared/Translate/ES/UI_ES.txt b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/shared/Translate/ES/UI_ES.txt old mode 100644 new mode 100755 diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/shared/Translate/RU/UI_RU.txt b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/shared/Translate/RU/UI_RU.txt old mode 100644 new mode 100755 index 4e1480a..dcc1a77 --- a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/shared/Translate/RU/UI_RU.txt +++ b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/shared/Translate/RU/UI_RU.txt @@ -1,31 +1,30 @@ UI_RU = { - - -- SpiffUI + -- SpiffUI UI_Hello_SpiffUI = "Hello SpiffUI!", UI_Name_SpiffUI = "SpiffUI", UI_optionscreen_binding_SpiffUI = "SpiffUI" - UI_ModOptions_SpiffUI_applyNewKeybinds = "Установите рекомендуемые сочетания клавиш SpiffUI", - UI_ModOptions_SpiffUI_Modal_applyNewKeybinds = " Установить привязки клавиш SpiffUI Устанавливает следующие сочетания клавиш: ", - UI_ModOptions_SpiffUI_Modal_aNKChild = " %1 для: [%2] ", + UI_ModOptions_SpiffUI_applyNewKeybinds = " SpiffUI", + UI_ModOptions_SpiffUI_Modal_applyNewKeybinds = " SpiffUI : ", + UI_ModOptions_SpiffUI_Modal_aNKChild = " %1 : [%2] ", - UI_ModOptions_SpiffUI_runAllResets = "Запустить полный сброс SpiffUI", - UI_ModOptions_SpiffUI_tooltip_runResets = "Работает только в игре!", - UI_ModOptions_SpiffUI_Modal_runResets = " Сброс SpiffUI Будут сброшены: ", + UI_ModOptions_SpiffUI_runAllResets = " SpiffUI", + UI_ModOptions_SpiffUI_tooltip_runResets = " !", + UI_ModOptions_SpiffUI_Modal_runResets = " SpiffUI : ", -- SpiffUI -- Inventory - UI_Hello_SpiffUI_Inv = "Hello SpiffUI - Инвентарь!", + UI_Hello_SpiffUI_Inv = "Hello SpiffUI - !", - UI_Name_SpiffUI_Inv = "SpiffUI - Инвентарь", + UI_Name_SpiffUI_Inv = "SpiffUI - ", - UI_ModOptions_SpiffUI_Inv_enable = "Включить инвентарь SpiffUI", - UI_ModOptions_SpiffUI_Inv_tooltip_enable = "Примечание. В игре требуется перезагрузка!", + UI_ModOptions_SpiffUI_Inv_enable = " SpiffUI", + UI_ModOptions_SpiffUI_Inv_tooltip_enable = ". !", - UI_ModOptions_SpiffUI_Inv_hideInv = "Скрыть кнопку инвентаря", + UI_ModOptions_SpiffUI_Inv_hideInv = " ", - UI_ModOptions_SpiffUI_Inv_mouseHide = "Только автоматическое скрытие по щелчку мыши", + UI_ModOptions_SpiffUI_Inv_mouseHide = " ", - UI_optionscreen_binding_SpiffUI_Inv = "Переключить инвентарь", + UI_optionscreen_binding_SpiffUI_Inv = " " -} \ No newline at end of file +} diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/shared/Translate/TH/UI_TH.txt b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/lua/shared/Translate/TH/UI_TH.txt old mode 100644 new mode 100755 diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/scripts/spiffbag.txt b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/scripts/spiffbag.txt new file mode 100755 index 0000000..16c18de --- /dev/null +++ b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/scripts/spiffbag.txt @@ -0,0 +1,10 @@ +module SpiffUI { + item Bag { + WeightReduction = 0, + Weight = 0, + Type = Container, + Capacity = 0, + DisplayName = SpiffUI Bag, + Icon = DoctorBag + } +} \ No newline at end of file diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/spifficons/spiffbodies.png b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/spifficons/spiffbodies.png new file mode 100755 index 0000000..27c98cf Binary files /dev/null and b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/spifficons/spiffbodies.png differ diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/spifficons/spiffcontainers.png b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/spifficons/spiffcontainers.png new file mode 100755 index 0000000..2745207 Binary files /dev/null and b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/spifficons/spiffcontainers.png differ diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/spifficons/spiffequip.png b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/spifficons/spiffequip.png new file mode 100755 index 0000000..82af15d Binary files /dev/null and b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/spifficons/spiffequip.png differ diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/spifficons/spiffpack.png b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/spifficons/spiffpack.png new file mode 100755 index 0000000..0051efa Binary files /dev/null and b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/media/spifficons/spiffpack.png differ diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/mod.info b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/mod.info old mode 100644 new mode 100755 diff --git a/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/poster.png b/SpiffUI-Inventory/Contents/mods/SpiffUI-Inventory/poster.png old mode 100644 new mode 100755 diff --git a/SpiffUI-Inventory/README.md b/SpiffUI-Inventory/README.md old mode 100644 new mode 100755 index 6645352..7a6373a --- a/SpiffUI-Inventory/README.md +++ b/SpiffUI-Inventory/README.md @@ -65,6 +65,8 @@ If ModOptions is installed (Recommended) SpiffUI will appear as a category. Thi English +Russian - fourteensix + Spanish - [ElDoktor](https://github.com/fcastro97) Thai - [radiusgreenhill](https://github.com/radiusgreenhill) diff --git a/SpiffUI-Inventory/preview.png b/SpiffUI-Inventory/preview.png old mode 100644 new mode 100755 diff --git a/SpiffUI-Inventory/workshop.txt b/SpiffUI-Inventory/workshop.txt old mode 100644 new mode 100755 index 9711d2d..d9d4a54 --- a/SpiffUI-Inventory/workshop.txt +++ b/SpiffUI-Inventory/workshop.txt @@ -1,97 +1,97 @@ -version=1 -id=2799848602 -title=SpiffUI - Inventory -description=[h1]Supports B41+. Works in Multiplayer[/h1] -description=[h3]A new save is not required[/h3] -description= -description=[h2]About SpiffUI[/h2] -description= -description=SpiffUI (pronounced "Spiffy") is an attempt to make the Project Zomboid in-game UI more player-friendly. The UI currently acts like a windowing system overtop a video game; similar in behavior to the Openbox/Fluxbox windowing system for a Linux Desktop. This works as the complexity of the game warrants this, but with little tweaks it can be so much better. -description= -description=There will be several independent modules released under the SpiffUI name that each change/add their own features. This allows me to make modifications to these independently, and allow you, the user, to choose which are active. -description= -description=[h2]About SpiffUI - Inventory[/h2] -description= -description=The goal of this mod is to change the default behavior of the Loot and Player Inventories in how they are displayed. The Inventory/Loot Panel rules should make sense in normal usage, but may take a small adjustment to your playstyle. Try it for yourself and let me know what you think! -description= -description=[b]Features[/b] -description=[list] -description=[*]The Inventory and Loot panels are hidden until the player triggers an interaction. -description=[*]The Inventory is now bound to the "Tab" key by default. Pressing Tab will open/close both the inventory and loot panels for the player. The panels cannot be closed when open in this way until you press the key again. -description=[*]Bringing the mouse to the top of the screen will show the inventory or loot panel allowing easy access; you can freely switch between which panel is open by moving the mouse. The panel is automatically hidden after losing mouse focus. -description=[*]Panels are no longer able to be resized horizontally or moved around. They are instead locked to the top of the screen in the default location, and can only be resized vertically. The "Close", "Info", "Collapse", and "Pin" buttons are also hidden. -description=[*]Clicking on a world container will show the loot panel and lock it open until the window is interacted with, an external mouse click, or if you walk away changing the loot panel to a blank floor. -description=[*]Option to Hide the "Inventory" button in the left panel. (I know the keybind, I don't need it) -description=[/list] -description= -description=[b]Update v2[/b] -description=[list] -description=[*]Added option to only autohide on External Mouse Click from windows -description=[/list] -description= -description=[h3] Controllers [/h3] -description=If playing with a controller the new behavior will not apply and the inventory will behave like Vanilla. -description= -description=[b]NOTE:[/b] I HIGHLY recommend that you run both the "Set SpiffUI Recommended Keybinds" and "Run All SpiffUI Resets" after you first install and start the game! -description= -description=[h2]SpiffUI Configuration[/h2] -description= -description=[url=https://steamcommunity.com/workshop/filedetails/?id=2169435993]ModOptions[/url] is required for futher configuration, but the mod will function without. -description=If ModOptions is installed (Recommended) SpiffUI will appear as a category. This is intended to have common configuration across all of SpiffUI, as well as tools to help configure the game to SpiffUI recommendations. -description= -description=[table] -description=[tr] -description=[th]Name[/th] -description=[th]Default[/th] -description=[th]Description[/th] -description=[/tr] -description=[tr] -description=[td]Set SpiffUI Recommended Keybinds[/td] -description=[td](None) It's a Button![/td] -description=[td]Sets keybinds for built-in keys to recommended defaults. A dialog will ask confirming this change, and will display the changes it will make.[/td] -description=[/tr] -description=[tr] -description=[td]Run All SpiffUI Resets[/td] -description=[td](None) It's a Button![/td] -description=[td]Runs all "Reset" functions for SpiffUI modules. A user is able to change where the UI is, its size, etc. This will set this to default. A dialog will ask confirming this change, and will display the changes it will make. PLEASE NOTE: This will only be usable in-game.[/td] -description=[/tr] -description=[/table] -description= -description=[h2]SpiffUI - Inventory Configuration[/h2] -description= -description=[table] -description=[tr] -description=[th]Name[/th] -description=[th]Default[/th] -description=[th]Description[/th] -description=[/tr] -description=[tr] -description=[td]Enable SpiffUI Inventory[/td] -description=[td]True[/td] -description=[td]Enables all SpiffUI Inventory changes. Disable to return to all vanilla behavior. NOTE: A restart will be required if in-game[/td] -description=[/tr] -description=[tr] -description=[td]Hide Inventory Button[/td] -description=[td]True[/td] -description=[td]Hides the Inventory button in the left sidemenu[/td] -description=[/tr] -description=[/table] -description= -description=[h2] Known Issues [/h2] -description=[list] -description=[*] The Dialog Box shown for the SpiffUI options will trigger the game to be unpaused if in-game. -description=[*] Controllers do not gain focus to the Settings Dialog; please use a mouse for now. -description=[*] Initiating a splitscreen game does not move Player 1's Inventory/Loot panels. This is vanilla behavior, but complicates things as you cannot move these panels with this mod. -description=[/list] -description= -description= -description=[h2]Translations[/h2] -description=[list] -description=[*]English -description=[*]Russian - [url=https://steamcommunity.com/profiles/76561198433229952]fourteensix[/url] -description=[*]Spanish - [url=https://steamcommunity.com/id/deadinside11]ElDoktor[/url] -description=[*]Thai - radiusgreenhill -description=[/list] -description= If you would like to contribute a translation, please submit a pull request on [url=https://github.com/hlfstr/pz-mods]GitHub![/url] I will happily give credit! -tags=Build 41;Framework;Interface;Misc -visibility=public +version=1 +id=2799848602 +title=SpiffUI - Inventory +description=[h1]Supports B41+. Works in Multiplayer[/h1] +description=[h3]A new save is not required[/h3] +description= +description=[h2]About SpiffUI[/h2] +description= +description=SpiffUI (pronounced "Spiffy") is an attempt to make the Project Zomboid in-game UI more player-friendly. The UI currently acts like a windowing system overtop a video game; similar in behavior to the Openbox/Fluxbox windowing system for a Linux Desktop. This works as the complexity of the game warrants this, but with little tweaks it can be so much better. +description= +description=There will be several independent modules released under the SpiffUI name that each change/add their own features. This allows me to make modifications to these independently, and allow you, the user, to choose which are active. +description= +description=[h2]About SpiffUI - Inventory[/h2] +description= +description=The goal of this mod is to change the default behavior of the Loot and Player Inventories in how they are displayed. The Inventory/Loot Panel rules should make sense in normal usage, but may take a small adjustment to your playstyle. Try it for yourself and let me know what you think! +description= +description=[b]Features[/b] +description=[list] +description=[*]The Inventory and Loot panels are hidden until the player triggers an interaction. +description=[*]The Inventory is now bound to the "Tab" key by default. Pressing Tab will open/close both the inventory and loot panels for the player. The panels cannot be closed when open in this way until you press the key again. +description=[*]Bringing the mouse to the top of the screen will show the inventory or loot panel allowing easy access; you can freely switch between which panel is open by moving the mouse. The panel is automatically hidden after losing mouse focus. +description=[*]Panels are no longer able to be resized horizontally or moved around. They are instead locked to the top of the screen in the default location, and can only be resized vertically. The "Close", "Info", "Collapse", and "Pin" buttons are also hidden. +description=[*]Clicking on a world container will show the loot panel and lock it open until the window is interacted with, an external mouse click, or if you walk away changing the loot panel to a blank floor. +description=[*]Option to Hide the "Inventory" button in the left panel. (I know the keybind, I don't need it) +description=[/list] +description= +description=[b]Update v2[/b] +description=[list] +description=[*]Added option to only autohide on External Mouse Click from windows +description=[/list] +description= +description=[h3] Controllers [/h3] +description=If playing with a controller the new behavior will not apply and the inventory will behave like Vanilla. +description= +description=[b]NOTE:[/b] I HIGHLY recommend that you run both the "Set SpiffUI Recommended Keybinds" and "Run All SpiffUI Resets" after you first install and start the game! +description= +description=[h2]SpiffUI Configuration[/h2] +description= +description=[url=https://steamcommunity.com/workshop/filedetails/?id=2169435993]ModOptions[/url] is required for futher configuration, but the mod will function without. +description=If ModOptions is installed (Recommended) SpiffUI will appear as a category. This is intended to have common configuration across all of SpiffUI, as well as tools to help configure the game to SpiffUI recommendations. +description= +description=[table] +description=[tr] +description=[th]Name[/th] +description=[th]Default[/th] +description=[th]Description[/th] +description=[/tr] +description=[tr] +description=[td]Set SpiffUI Recommended Keybinds[/td] +description=[td](None) It's a Button![/td] +description=[td]Sets keybinds for built-in keys to recommended defaults. A dialog will ask confirming this change, and will display the changes it will make.[/td] +description=[/tr] +description=[tr] +description=[td]Run All SpiffUI Resets[/td] +description=[td](None) It's a Button![/td] +description=[td]Runs all "Reset" functions for SpiffUI modules. A user is able to change where the UI is, its size, etc. This will set this to default. A dialog will ask confirming this change, and will display the changes it will make. PLEASE NOTE: This will only be usable in-game.[/td] +description=[/tr] +description=[/table] +description= +description=[h2]SpiffUI - Inventory Configuration[/h2] +description= +description=[table] +description=[tr] +description=[th]Name[/th] +description=[th]Default[/th] +description=[th]Description[/th] +description=[/tr] +description=[tr] +description=[td]Enable SpiffUI Inventory[/td] +description=[td]True[/td] +description=[td]Enables all SpiffUI Inventory changes. Disable to return to all vanilla behavior. NOTE: A restart will be required if in-game[/td] +description=[/tr] +description=[tr] +description=[td]Hide Inventory Button[/td] +description=[td]True[/td] +description=[td]Hides the Inventory button in the left sidemenu[/td] +description=[/tr] +description=[/table] +description= +description=[h2] Known Issues [/h2] +description=[list] +description=[*] The Dialog Box shown for the SpiffUI options will trigger the game to be unpaused if in-game. +description=[*] Controllers do not gain focus to the Settings Dialog; please use a mouse for now. +description=[*] Initiating a splitscreen game does not move Player 1's Inventory/Loot panels. This is vanilla behavior, but complicates things as you cannot move these panels with this mod. +description=[/list] +description= +description= +description=[h2]Translations[/h2] +description=[list] +description=[*]English +description=[*]Russian - [url=https://steamcommunity.com/profiles/76561198433229952]fourteensix[/url] +description=[*]Spanish - [url=https://steamcommunity.com/id/deadinside11]ElDoktor[/url] +description=[*]Thai - radiusgreenhill +description=[/list] +description= If you would like to contribute a translation, please submit a pull request on [url=https://github.com/hlfstr/pz-mods]GitHub![/url] I will happily give credit! +tags=Build 41;Framework;Interface;Misc +visibility=public