tryscanhouse manual merge

AssemblerManiac [02-18-18 - 16:00]
tryscanhouse manual merge
Filename
IIfA/IIfA.xml
IIfA/IIfABackpack.lua
IIfA/IIfADataCollection.lua
IIfA/IIfA_xml_adapter.lua
diff --git a/IIfA/IIfA.xml b/IIfA/IIfA.xml
index af6f7dd..3bf3db0 100644
--- a/IIfA/IIfA.xml
+++ b/IIfA/IIfA.xml
@@ -148,11 +148,11 @@
 							<OnMouseEnter>	IIfA:GuiShowTooltip(self, "Select quality")</OnMouseEnter>
 							<OnMouseExit>	IIfA:GuiHideTooltip(self)</OnMouseExit>
 						</Control>
-
+<!-- Filter Group -->
 						<Control name="$(parent)_Filter" mouseEnabled="true">
 							<Dimensions x="300" y="30" />
 							<Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" offsetX="50" offsetY="80"/>
-
+							<Anchor point="BOTTOMRIGHT" relativeTo="$(parent)" relativePoint="TOPRIGHT" offsetX="50" offsetY="110"/>
 							<Controls>
 								<Button name="$(parent)_Button0">
 									<Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" offsetX="0" offsetY="0"/>
@@ -247,11 +247,12 @@
 						</Control>

 <!-- SubFilter Groups -->
-						<Control name="$(parent)_Subfilter" mouseEnabled="true">
-							<Dimensions x="300" y="0" />
+						<Control name="$(parent)_Subfilter" mouseEnabled="true" hidden="true">
 							<Anchor point="TOPLEFT" relativeTo="$(parent)_Filter" relativePoint="BOTTOMLEFT" offsetX="0" offsetY="2"/>
-<!-- SubFilter Group 1 - Weapons -->
+							<Anchor point="TOPRIGHT" relativeTo="$(parent)_Filter" relativePoint="BOTTOMRIGHT" offsetX="0"/>
+							<DimensionConstraints minY="10"/>
 							<Controls>
+<!-- SubFilter Group 1 - Weapons -->
 								<Control name="$(parent)_1" mouseEnabled="true" hidden="true">
 									<Dimensions x="300" y="0" />
 									<Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" offsetX="0" offsetY="0"/>
@@ -836,27 +837,33 @@

 						<Control name="$(parent)_SortBar" mouseEnabled="true">

-							<Anchor point="TOPLEFT" relativeTo="$(parent)_Subfilter" relativePoint="BOTTOMLEFT" offsetY="3" offsetX="-50" />
-							<Dimensions y="30" x="110"/>
+							<Anchor point="TOPLEFT" 	relativeTo="$(parent)_Subfilter" relativePoint="BOTTOMLEFT" offsetX="-45"  offsetY="10" />
+							<Anchor point="BOTTOMRIGHT" relativeTo="$(parent)_Subfilter" relativePoint="BOTTOMRIGHT" offsetX="0"  offsetY="40" />

 							<Controls>
-								<Button name="$(parent)_Sort" verticalAlignment="LEFT"  mouseEnabled="true">
+								<Control name="$(parent)_Sort" verticalAlignment="LEFT">
+									<Dimensions y="30"/>
 									<Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" offsetX="2" />
-									<Anchor point="BOTTOMRIGHT" relativeTo="$(parent)" relativePoint="BOTTOMRIGHT" offsetX="2" />
-									<OnMouseUp>IIfA:GuiOnSort()</OnMouseUp>
+									<Anchor point="BOTTOMRIGHT" relativeTo="$(parent)" relativePoint="TOPRIGHT" offsetX="2" />
 									<Controls>
-
-										<Texture name="$(parent)_Icon">
+										<Texture name="$(parent)_Icon" textureFile="/esoui/art/miscellaneous/list_sortheader_icon_sortdown.dds">
 											<Dimensions x="30" y="30"/>
 											<Anchor point="LEFT" relativeTo="$(parent)" relativePoint="LEFT" offsetX="10" />
 										</Texture>
-
-										<Label name="$(parent)_SortName" hidden="false" text="Name" mouseEnabled="false" font="ZoFontGameLargeBold">
-											<Anchor point="LEFT" relativeTo="$(parent)_Icon" relativePoint="RIGHT" offsetX="20" />
-										</Label>
+										<Button name="$(parent)_SortName" text="Name" font="ZoFontGameLargeBold" verticalAlignment="CENTER" horizontalAlignment="CENTER">
+											<Anchor point="TOPLEFT" relativeTo="$(parent)_Icon" relativePoint="TOPRIGHT" offsetX="20"/>
+											<Anchor point="BOTTOMRIGHT" relativeTo="$(parent)_Icon" relativePoint="BOTTOMLEFT" offsetX="260"/>
+											<OnMouseUp>IIfA:GuiOnSort(false)</OnMouseUp>
+										</Button>
+										<Button name="$(parent)_SortQuality" text="Quality" font="ZoFontGameLargeBold" verticalAlignment="CENTER" horizontalAlignment="CENTER">
+											<Anchor point="TOPLEFT" relativeTo="$(parent)_SortName" relativePoint="TOPRIGHT"/>
+											<Anchor point="BOTTOMRIGHT" relativeTo="$(parent)" relativePoint="BOTTOMRIGHT"/>
+											<Dimensions y="45"/>
+											<OnMouseUp>IIfA:GuiOnSort(true)</OnMouseUp>
+										</Button>

 									</Controls>
-								</Button>
+								</Control>

 								<Control name="$(parent)_Subfilter_Dropdown" inherits="ZO_ComboBox" mouseEnabled="true" hidden="true">
 									<Dimensions x="150" y="30" />
@@ -872,7 +879,7 @@

 				<Control name="$(parent)_ListHolder" mouseEnabled="true" resizeToFitDescendents="false">
 					<DimensionConstraints  minY="52"/>
-					<Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" offsetX="15" offsetY="150"/>
+					<Anchor point="TOPLEFT" relativeTo="$(parent)_Header_SortBar" relativePoint="BOTTOMLEFT" offsetX="10"/>
 					<Anchor point="BOTTOMRIGHT" relativeTo="$(parent)" relativePoint="BOTTOMRIGHT" offsetX="-27" offsetY="-55"/>
 					<OnMouseWheel>IIfA:GuiOnScroll(self, delta)</OnMouseWheel>

diff --git a/IIfA/IIfABackpack.lua b/IIfA/IIfABackpack.lua
index bc4c57c..04b07cc 100644
--- a/IIfA/IIfABackpack.lua
+++ b/IIfA/IIfABackpack.lua
@@ -323,11 +323,10 @@ end

 --sort datalines
 local function IIfA_FilterCompareUp(a, b)
-	--local _, _, name1 = a.itemLink:match("|H(.-):(.-)|h(.-)|h")
-	--local _, _, name2 = b.itemLink:match("|H(.-):(.-)|h(.-)|h")
-	local name1 = a.name
-	local name2 = b.name
-	return (name1 or "") < (name2 or "")
+
+	local sort1 = (IIfA.bSortQuality and a.quality) or a.name
+	local sort2 = (IIfA.bSortQuality and b.quality) or b.name
+	return (sort1 or "") < (sort2 or "")
 end
 local function IIfA_FilterCompareDown(a, b)
 	return IIfA_FilterCompareUp(b, a)
@@ -760,7 +759,7 @@ function IIfA:SetupBackpack()
 	IIfA:CreateInventoryScroll()
 	createInventoryDropdown()
 	createInventoryDropdownQuality()
-	IIfA:GuiOnSort(true)
+	-- IIfA:GuiOnSort()
 end

 function IIfA:ProcessRightClick(control)
diff --git a/IIfA/IIfADataCollection.lua b/IIfA/IIfADataCollection.lua
index 2172097..4ce346a 100644
--- a/IIfA/IIfADataCollection.lua
+++ b/IIfA/IIfADataCollection.lua
@@ -131,7 +131,7 @@ local function tryScanHouseBank()
 			IIfA:DebugOut(zo_strformat("tryScanHouseBank(<<1>>)", collectibleId))
 			-- call with libAsync to avoid lag
 			task:Call(function()
-				local collectibleId = GetCollectibleForHouseBankBag(bagId)		-- this MUST stay here, or collectibleId is 0
+				local collectibleId = GetCollectibleForHouseBankBag(bagId)		-- required code - MUST stay here, or collectibleId is 0
 				IIfA:ClearLocationData(collectibleId)
 			end):Then(function()
 				grabBagContent(bagId, true)
@@ -141,8 +141,7 @@ local function tryScanHouseBank()
 end

 function IIfA:ScanBank()
-
-	-- call with libAsync to avoid lags
+	-- call with libAsync to avoid lag
 	task:Call(function()
 		IIfA:ClearLocationData(GetString(IIFA_BAG_BANK))
 	end):Then(function()
diff --git a/IIfA/IIfA_xml_adapter.lua b/IIfA/IIfA_xml_adapter.lua
index 2ce7f32..bb53224 100644
--- a/IIfA/IIfA_xml_adapter.lua
+++ b/IIfA/IIfA_xml_adapter.lua
@@ -216,7 +216,7 @@ function IIfA:GuiOnFilterButton(control, mouseButton, filterGroup, filterTypes,

 	if IIfA.LastSubFilterControl == nil then
 		IIFA_GUI_Header_Subfilter:SetHidden(true)
-		IIFA_GUI_Header_Subfilter:SetHeight(0)
+		IIFA_GUI_Header_Subfilter:SetHeight(10)
 	else
 		IIFA_GUI_Header_Subfilter:SetHidden(false)
 		IIFA_GUI_Header_Subfilter:SetHeight(38)
@@ -265,20 +265,7 @@ function IIfA:GuiOnFilterButton(control, mouseButton, filterGroup, filterTypes,
 		IIFA_GUI_Header_SortBar_Subfilter_Dropdown:SetHidden(true)
 	end

-
-	local X_OFFSET_INDEX = 4
-	local Y_OFFSET_INDEX = 5
-	IIFA_GUI_ListHolder:ClearAnchors()
-
-	local newAnchor = ZO_Anchor:New(unpack(IIFA_GUI_ListHolder.savedAnchor1))
-	newAnchor:SetOffsets(IIFA_GUI_ListHolder.savedAnchor1[X_OFFSET_INDEX], IIFA_GUI_ListHolder.savedAnchor1[Y_OFFSET_INDEX] + IIFA_GUI_Header_Subfilter:GetHeight())
-	newAnchor:AddToControl(IIFA_GUI_ListHolder)
-
-	IIFA_GUI_ListHolder:SetAnchor(BOTTOMRIGHT, IIFA_GUI, BOTTOMRIGHT, -27, -55)
-	-- newAnchor = ZO_Anchor:New(unpack(IIFA_GUI_ListHolder.savedAnchor2))
-	-- newAnchor:SetOffsets(IIFA_GUI_ListHolder.savedAnchor2[X_OFFSET_INDEX], IIFA_GUI_ListHolder.savedAnchor2[Y_OFFSET_INDEX])
-	-- newAnchor:AddToControl(IIFA_GUI_ListHolder)
-
+
 	IIfA:GuiResizeScroll()

 	IIfA:RefreshInventoryScroll()
@@ -301,15 +288,20 @@ function IIfA:GuiOnSearchBoxClear(control)
 end


+
+	-- We're inverting search order if same header is clicked twice.
+IIfA.bSortQuality = false
 -- IIFA_GUI_ListHolder sort
-function IIfA:GuiOnSort(initialised)
-	if (initialised ~= true) then
+function IIfA:GuiOnSort(sortQuality)
+
+	if (IIfA.bSortQuality == sortQuality) then
 		IIfA.ScrollSortUp = not IIfA.ScrollSortUp
 	end
-
+	IIfA.bSortQuality = sortQuality
+
 	local icon = IIFA_GUI_Header_SortBar.Icon

-	if(IIfA.ScrollSortUp)then
+	if (IIfA.ScrollSortUp) then
 		icon:SetTexture("/esoui/art/miscellaneous/list_sortheader_icon_sortup.dds")
 		icon:SetAlpha(1)
 	else