Adding equipped gear list

Leandro Silva [09-19-18 - 00:49]
Adding equipped gear list
Filename
LeoAltholic.lua
LeoAltholic.txt
LeoAltholic.xml
LeoAltholicUI.lua
diff --git a/LeoAltholic.lua b/LeoAltholic.lua
index 02be497..c61f635 100644
--- a/LeoAltholic.lua
+++ b/LeoAltholic.lua
@@ -2,7 +2,7 @@
 LeoAltholic = {}
 LeoAltholic.name = "LeoAltholic"
 LeoAltholic.displayName = "Leo's Altholic"
-LeoAltholic.version = "0.9.7"
+LeoAltholic.version = "0.9.8"
 LeoAltholic.chatPrefix = "|c39B027" .. LeoAltholic.name .. "|r: "
 LeoAltholic.timerQueue = {}

@@ -371,10 +371,10 @@ function LeoAltholic.GetCharacters()
     return playerLines
 end

-function LeoAltholic.GetItems(char)
+function LeoAltholic.GetItems(char, bagId)
     local itemLines =  {}
     local i = 1
-    for k, v in pairs(char.inventory[BAG_BACKPACK]) do
+    for k, v in pairs(char.inventory[bagId]) do
         if k == nil then return end
         itemLines[i] = copy(v)
         i = i + 1
diff --git a/LeoAltholic.txt b/LeoAltholic.txt
index e6e6998..25ad965 100644
--- a/LeoAltholic.txt
+++ b/LeoAltholic.txt
@@ -1,6 +1,6 @@
 ## Title: Leo's Altholic
 ## APIVersion: 100024
-## Version: 0.9.7
+## Version: 0.9.8
 ## Author: |c39B027@LeandroSilva|r
 ## SavedVariables: LeoAltholicSavedVariables
 ## DependsOn: LibStub LibFeedback
diff --git a/LeoAltholic.xml b/LeoAltholic.xml
index c1bdfbf..4dae19e 100644
--- a/LeoAltholic.xml
+++ b/LeoAltholic.xml
@@ -852,6 +852,36 @@
                        verticalAlignment="CENTER" mouseEnabled="true">
                     <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" offsetX="16" offsetY="10"/>
                 </Label>
+                <Button name="$(parent)FilterInvButton" clickSound="Click">
+                    <Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$(parent)BG" offsetX="-90" offsetY="4"/>
+                    <Dimensions x="40" y="40"/>
+                    <OnClicked> LeoAltholic.ChangeInventoryUI(1) </OnClicked>
+                    <Controls>
+                        <Backdrop name="$(parent)BG" centerColor="101010" edgeColor="202020">
+                            <AnchorFill/>
+                            <Edge edgeSize="1"/>
+                        </Backdrop>
+                        <Texture name="$(parent)Texture" textureFile="esoui/art/mainmenu/menubar_inventory_up.dds">
+                            <Dimensions y="25" x="25"/>
+                            <Anchor point="128"/>
+                        </Texture>
+                    </Controls>
+                </Button>
+                <Button name="$(parent)FilterEquipedButton" clickSound="Click">
+                    <Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$(parent)BG" offsetX="-135" offsetY="4"/>
+                    <Dimensions x="40" y="40"/>
+                    <OnClicked> LeoAltholic.ChangeInventoryUI(0) </OnClicked>
+                    <Controls>
+                        <Backdrop name="$(parent)BG" centerColor="101010" edgeColor="202020">
+                            <AnchorFill/>
+                            <Edge edgeSize="1"/>
+                        </Backdrop>
+                        <Texture name="$(parent)Texture" textureFile="esoui/art/mainmenu/menubar_character_up.dds">
+                            <Dimensions y="25" x="25"/>
+                            <Anchor point="128"/>
+                        </Texture>
+                    </Controls>
+                </Button>
                 <Button name="$(parent)Close" clickSound="Click">
                     <Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$(parent)BG" offsetX="-45" offsetY="4"/>
                     <Dimensions x="40" y="40"/>
diff --git a/LeoAltholicUI.lua b/LeoAltholicUI.lua
index cb686de..811fa94 100644
--- a/LeoAltholicUI.lua
+++ b/LeoAltholicUI.lua
@@ -1,5 +1,6 @@

 LeoAltholic.hidden = true
+LeoAltholic.listingInventoryFor = 0

 function LeoAltholic:OnWindowMoveStop()
     LeoAltholic.savedVariables.position = {
@@ -21,7 +22,12 @@ function LeoAltholic.RestorePosition()
     LeoAltholicWindow:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, left, top)
 end

-function LeoAltholic.ShowInventoryUI(charId)
+function LeoAltholic.ChangeInventoryUI(bagId)
+    LeoAltholic.ShowInventoryUI(LeoAltholic.listingInventoryFor, bagId)
+end
+
+function LeoAltholic.ShowInventoryUI(charId, bagId)
+    LeoAltholic.listingInventoryFor = charId
     SCENE_MANAGER:ShowTopLevel(LeoAltholicInventoryWindow)
     LeoAltholicInventoryWindow:SetHidden(false)
     local char = LeoAltholic.GetCharacters()[charId]
@@ -32,7 +38,7 @@ function LeoAltholic.ShowInventoryUI(charId)
     for x = 1, sc:GetNumChildren() do
         sc:GetChild(x):SetHidden(true)
     end
-    for _, item in pairs(LeoAltholic.GetItems(char)) do
+    for _, item in pairs(LeoAltholic.GetItems(char, bagId)) do
         local row = WINDOW_MANAGER:GetControlByName("LeoAltholicInventoryWindowRow" .. i)
         if not row then
             row = CreateControlFromVirtual("LeoAltholicInventoryWindowRow" .. i, sc, "LeoAltholicInventoryTemplate")
@@ -131,7 +137,7 @@ function LeoAltholic.InitializeCharacterFrames()
                 end
             elseif panel == "Inventory" then
                 control = row:GetNamedChild("ListButton")
-                control:SetHandler('OnClicked', function() LeoAltholic.ShowInventoryUI(x) end)
+                control:SetHandler('OnClicked', function() LeoAltholic.ShowInventoryUI(x, BAG_BACKPACK) end)
             elseif panel == "Research" then
                 for _,craft in pairs(LeoAltholic.craftResearch) do
                     local label = row:GetNamedChild("Craft"..craft.."Label")