Version 1.6.1 (11-03-2018)

Jarth [03-11-18 - 10:28]
Version 1.6.1 (11-03-2018)
Filename
Changelog
SummonAssistant_Constants.lua
SummonAssistant_Fragments.lua
SummonAssistant_Menu.lua
diff --git a/Changelog b/Changelog
index 0d3ddfb..0d41277 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,11 @@
 -------------------------------------------------------------------------------
 Summon Assistant
 -------------------------------------------------------------------------------
+Version 1.6.1 (11-03-2018)
+- Added fragment support for Inventory and store views.
+- Added menu items for visibilty of Inventory and store.
+- Updated menu texts for visibilty, to better describe the area and for consistency.
+
 Version 1.6.0 (24-02-2018)
 - Added checkbox to disable sound, when hovering the buttons
 - Refactored visibility and added checkboxes:
diff --git a/SummonAssistant_Constants.lua b/SummonAssistant_Constants.lua
index 7880ce0..a739563 100644
--- a/SummonAssistant_Constants.lua
+++ b/SummonAssistant_Constants.lua
@@ -29,9 +29,11 @@ SummonAssistant.Default = {
     FontColor = {r = 0.9, g = 0.9, b = 0.9, a = 0.9},
     UseAccountSettings = true,
     Horizontal = true,
-    ShowBarInMenu = false,
     ShowBarOnHud = true,
     ShowBarOnHudUI = true,
+    ShowBarInMenu = false,
+    ShowBarInStore = false,
+    ShowBarInInventory = false,
     Margin = 2,
     Height = 60,
     Width = 60,
@@ -47,7 +49,7 @@ SummonAssistant.Default = {
 }
 SummonAssistant.Global = {
     IsMoveEnabled = false,
-    ChoisesKeyBindingLocation = {"bottom","bottomleft","bottomright","center","left","right","top","topleft","topright"}
+    ChoisesKeyBindingLocation = {"bottom", "bottomleft", "bottomright", "center", "left", "right", "top", "topleft", "topright"}
 }
 SummonAssistant.Types = {
     Banker = {
diff --git a/SummonAssistant_Fragments.lua b/SummonAssistant_Fragments.lua
index b332c89..043891a 100644
--- a/SummonAssistant_Fragments.lua
+++ b/SummonAssistant_Fragments.lua
@@ -9,6 +9,23 @@ Filename: SummonAssistant_Fragments.lua
 local SummonAssistant = SummonAssistant

 -------------------------------------------------------------------------------------------------
+-- Helper FUNCTIONS --
+-------------------------------------------------------------------------------------------------
+function SummonAssistant:HelperSetFragmentBehaviour(value, scene, fragment, statement, frameIsHidden)
+    if value then
+        scene:AddFragment(fragment)
+
+        -- Case when landing on a scene, before a transition
+        if statement then
+            frameIsHidden = false
+        end
+    else
+        scene:RemoveFragment(fragment)
+    end
+    return frameIsHidden
+end
+
+-------------------------------------------------------------------------------------------------
 -- PRIVATE FUNCTIONS --
 -------------------------------------------------------------------------------------------------
 function SummonAssistant:SetFragmentBehaviour()
@@ -24,33 +41,18 @@ function SummonAssistant:SetFragmentBehaviour()
         fragment = base.Fragment
     end

-    if saved.ShowBarInMenu then
-        SCENE_MANAGER:GetScene("gameMenuInGame"):AddFragment(fragment)
-
-        -- Case where the user changes visibility in the settings
-        if currentScene ~= nil and currentScene:GetName() == "gameMenuInGame" then
-            frameIsHidden = false
-        end
-    else
-        SCENE_MANAGER:GetScene("gameMenuInGame"):RemoveFragment(fragment)
-    end
-
-    if saved.ShowBarOnHud then
-        HUD_SCENE:AddFragment(fragment)
-
-        -- Case when landing on a scene, before a transition
-        if currentScene == nil then
-            frameIsHidden = false
-        end
-    else
-        HUD_SCENE:RemoveFragment(fragment)
-    end
-
-    if saved.ShowBarOnHudUI then
-        HUD_UI_SCENE:AddFragment(fragment)
-    else
-        HUD_UI_SCENE:RemoveFragment(fragment)
-    end
+    frameIsHidden = SummonAssistant:HelperSetFragmentBehaviour(saved.ShowBarOnHud, HUD_SCENE, fragment, currentScene == nil, frameIsHidden)
+    frameIsHidden = SummonAssistant:HelperSetFragmentBehaviour(saved.ShowBarOnHudUI, HUD_UI_SCENE, fragment, false, frameIsHidden)
+    frameIsHidden =
+        SummonAssistant:HelperSetFragmentBehaviour(
+        saved.ShowBarInMenu,
+        SCENE_MANAGER:GetScene("gameMenuInGame"),
+        fragment,
+        currentScene ~= nil and currentScene:GetName() == "gameMenuInGame",
+        frameIsHidden
+    )
+    frameIsHidden = SummonAssistant:HelperSetFragmentBehaviour(saved.ShowBarInStore, SCENE_MANAGER:GetScene("store"), fragment, false, frameIsHidden)
+    frameIsHidden = SummonAssistant:HelperSetFragmentBehaviour(saved.ShowBarInInventory, SCENE_MANAGER:GetScene("inventory"), fragment, false, frameIsHidden)

     frame:SetHidden(frameIsHidden)
 end
diff --git a/SummonAssistant_Menu.lua b/SummonAssistant_Menu.lua
index 40dd189..4a7d022 100644
--- a/SummonAssistant_Menu.lua
+++ b/SummonAssistant_Menu.lua
@@ -313,8 +313,34 @@ function SummonAssistant:CreateSettingsWindow()
             controls = {
                 [1] = {
                     type = "checkbox",
-                    name = "Show bar in menu",
-                    tooltip = "When ON the bar will show when a menu is opened.",
+                    name = "Show bar " .. "on main view/hud",
+                    tooltip = "When ON the bar will show the bar " .. "on main view/hud",
+                    default = SummonAssistant.Default.ShowBarOnHud,
+                    getFunc = function()
+                        return SummonAssistant.Saved.ShowBarOnHud
+                    end,
+                    setFunc = function(newValue)
+                        SummonAssistant.Saved.ShowBarOnHud = newValue
+                        SummonAssistant:SetFragmentBehaviour()
+                    end
+                },
+                [2] = {
+                    type = "checkbox",
+                    name = "Show bar " .. "on the main view when an overlay is activated/hudui",
+                    tooltip = "When ON the bar will show the bar " .. "on the main view when an overlay is activated/hudui",
+                    default = SummonAssistant.Default.ShowBarOnHudUI,
+                    getFunc = function()
+                        return SummonAssistant.Saved.ShowBarOnHudUI
+                    end,
+                    setFunc = function(newValue)
+                        SummonAssistant.Saved.ShowBarOnHudUI = newValue
+                        SummonAssistant:SetFragmentBehaviour()
+                    end
+                },
+                [3] = {
+                    type = "checkbox",
+                    name = "Show bar " .. "in menu",
+                    tooltip = "When ON the bar will show the bar " .. "in menu",
                     default = SummonAssistant.Default.ShowBarInMenu,
                     getFunc = function()
                         return SummonAssistant.Saved.ShowBarInMenu
@@ -324,29 +350,29 @@ function SummonAssistant:CreateSettingsWindow()
                         SummonAssistant:SetFragmentBehaviour()
                     end
                 },
-                [2] = {
+                [4] = {
                     type = "checkbox",
-                    name = "Show bar on hud",
-                    tooltip = "When ON the bar will show the bar on the hud.",
-                    default = SummonAssistant.Default.ShowBarOnHud,
+                    name = "Show bar " .. "in the inventory",
+                    tooltip = "When ON the bar will show the bar " .. "in the inventory",
+                    default = SummonAssistant.Default.ShowBarInInventory,
                     getFunc = function()
-                        return SummonAssistant.Saved.ShowBarOnHud
+                        return SummonAssistant.Saved.ShowBarInInventory
                     end,
                     setFunc = function(newValue)
-                        SummonAssistant.Saved.ShowBarOnHud = newValue
+                        SummonAssistant.Saved.ShowBarInInventory = newValue
                         SummonAssistant:SetFragmentBehaviour()
                     end
                 },
-                [3] = {
+                [5] = {
                     type = "checkbox",
-                    name = "Show bar in hudui",
-                    tooltip = "When ON the bar will show the bar on the hudui.",
-                    default = SummonAssistant.Default.ShowBarOnHudUI,
+                    name = "Show bar " .. "in a store",
+                    tooltip = "When ON the bar will show the bar " .. "in a store",
+                    default = SummonAssistant.Default.ShowBarInStore,
                     getFunc = function()
-                        return SummonAssistant.Saved.ShowBarOnHudUI
+                        return SummonAssistant.Saved.ShowBarInStore
                     end,
                     setFunc = function(newValue)
-                        SummonAssistant.Saved.ShowBarOnHudUI = newValue
+                        SummonAssistant.Saved.ShowBarInStore = newValue
                         SummonAssistant:SetFragmentBehaviour()
                     end
                 }