Quantcast

27: Garrison Commander UI has a Glitch

Alar of Runetotem [08-04-19 - 18:09]
27: Garrison Commander UI has a Glitch

Task-Url: http://github.com/alarofrunetotem/GarrisonCommander/issues/27

panel can no longer moved, sorry
Filename
GarrisonCommander-Broker/GarrisonCommander-Broker.toc
GarrisonCommander-Broker/RelNotes.lua
GarrisonCommander-Broker/ldb.lua
GarrisonCommander.lua
GarrisonCommander.toc
RelNotes.lua
ShipYard.lua
minimap.lua
diff --git a/GarrisonCommander-Broker/GarrisonCommander-Broker.toc b/GarrisonCommander-Broker/GarrisonCommander-Broker.toc
index c3636e3..75383ca 100644
--- a/GarrisonCommander-Broker/GarrisonCommander-Broker.toc
+++ b/GarrisonCommander-Broker/GarrisonCommander-Broker.toc
@@ -22,4 +22,5 @@ embeds.xml
 localization.lua
 ldb.lua
 RelNotes.lua
+../GarrisonCommander/minimap.lua

diff --git a/GarrisonCommander-Broker/RelNotes.lua b/GarrisonCommander-Broker/RelNotes.lua
index b309a1d..db06eff 100644
--- a/GarrisonCommander-Broker/RelNotes.lua
+++ b/GarrisonCommander-Broker/RelNotes.lua
@@ -14,7 +14,7 @@ self:RelNotes(3,1,1,[[
 Fix: Harvesting node should now be detected again
 ]])
 self:RelNotes(3,0,0,[[
-Fix: Harvesting detection works again, thanks to twitchdefresaemoved lua error GetAbsoluteMonth
+Fix: Harvesting detection works again, thanks to twitchdefresa
 ]])
 self:RelNotes(2,18,8,[[
 Fix: Removed lua error GetAbsoluteMonth
diff --git a/GarrisonCommander-Broker/ldb.lua b/GarrisonCommander-Broker/ldb.lua
index 7319a34..702658e 100644
--- a/GarrisonCommander-Broker/ldb.lua
+++ b/GarrisonCommander-Broker/ldb.lua
@@ -380,37 +380,7 @@ function addon:OnInitialized()
 	frequency=self:GetNumber("FREQUENCY",5)
 	self:ScheduleTimer("DelayedInit",1)
 	-- Avoid double adding
-	if not IsAddOnLoaded("GarrisonCommander") then
-     self:SecureHookScript(GarrisonLandingPageMinimapButton,"OnEnter",function(this)
-        if this.description==MINIMAP_ORDER_HALL_LANDING_PAGE_TOOLTIP or
-           this.description == GARRISON_TYPE_8_0_LANDING_PAGE_TOOLTIP then
-          GameTooltip:AddLine(CTRL_KEY_TEXT .. " " .. MINIMAP_GARRISON_LANDING_PAGE_TOOLTIP)
-          GameTooltip:AddLine(SHIFT_KEY_TEXT  .. " " .. MINIMAP_ORDER_HALL_LANDING_PAGE_TOOLTIP)
-        end
-        GameTooltip:Show()
-    end
-    )
-    --GarrisonLandingPageMinimapButton:RegisterForClicks("LEFTBUTTONUP","RIGHTBUTTONUP")
-    self:SecureHookScript(GarrisonLandingPageMinimapButton,"OnClick",
-      function (this,button)
-     --@debug@
-     self:Print("minimap click")
-     --@end-debug@
-         local shown=GarrisonLandingPage:IsShown()
-         local actual=GarrisonLandingPage.garrTypeID
-         local requested=C_Garrison.GetLandingPageGarrisonType()
-         if IsShiftKeyDown() then
-            requested=LE_GARRISON_TYPE_7_0
-         elseif IsControlKeyDown() then
-            requested=LE_GARRISON_TYPE_6_0
-         end
-         if InCombatLockdown() then return end
-         if shown and actual ~= requested then
-           ShowGarrisonLandingPage(requested);
-         end
-      end
-    )
-	end
+
 	self:loadHelp()
 end
 function addon:ApplyFREQUENCY(value)
@@ -789,12 +759,12 @@ function dataobj:OldUpdate()
 	end
 	self.text=format("%s: %s (Tot: |cff00ff00%d|r) %s: %s",READY,ready,completed,NEXT,prox)
 end-- Resources rate: 144 a day
+--[[ Satchel was removed, keeping code as reference in case Bliz reintriduce simething similar
 local satchel_id=120146
 local satchel_name
 local satchel_link
 local satchel_index
 local button
---@do-not-package@
 function addon:ResBuyer()
 	button=CreateFrame("Button",nil,UIParent,"SecureActionButtonTemplate")
 	button:SetAttribute("type1","item")
@@ -807,7 +777,7 @@ function addon:Buygold(args,...)
 	print(args,...)
 	if not args  or args=="" then
 		self:Print("Use /buygold <resource to use>")
-		self:Print("Example: /buygold 1000 will consume 1000 resourcesm i.e. acquire 20 " .. satchel_link)
+		self:Print("Example: /buygold 1000 will consume 1000 resources i.e. acquire 20 " .. satchel_link)
 		return
 	end
 	local resources=math.floor((tonumber(strsplit(" ",args)) or 50)/50)
@@ -853,7 +823,7 @@ function addon:Buygold(args,...)
 	end
 	self:coroutineExecute(0.2,buyer)
 end
---@end-do-not-package@
+--]]
 local function convert(perc,numeric)
 	perc=max(0,min(10,perc))
 	if numeric then
@@ -872,17 +842,3 @@ function addon:moreIsGood(n,t,numeric)
 	-- n = counted
 	return convert(math.floor(10/t*n),numeric)
 end
---@debug@
-local function highdebug(tb)
-	for k,v in pairs(tb) do
-		if type(v) == "function" then
-			tb[k]=function(...) print(date(),k) return v(...) end
-		end
-	end
-end
---highdebug(addon)
---highdebug(dataobj)
---highdebug(farmobj)
---highdebug(workobj)
-_G.GACB=addon
---@end-debug@
diff --git a/GarrisonCommander.lua b/GarrisonCommander.lua
index 03e608f..802fb43 100644
--- a/GarrisonCommander.lua
+++ b/GarrisonCommander.lua
@@ -416,7 +416,7 @@ function addon:OnInitialized()
 		dbGAC.namespaces=nil
 	end
 	self:AddLabel(L["Garrison Appearance"])
-	self:AddToggle("MOVEPANEL",true,L["Unlock Panel"],L["Makes main mission panel movable"])
+	--self:AddToggle("MOVEPANEL",true,L["Unlock Panel"],L["Makes main mission panel movable"])
 	self:AddToggle("BIGSCREEN",true,L["Big screen"],L["Disabling this will give you the interface from 1.1.8, given or taken. Need to reload interface"])
 	self:AddToggle("PIN",true,L["Show Garrison Commander menu"],L["Disable if you dont want the full Garrison Commander Header."])
 	self:AddLabel(L["Mission Panel"])
@@ -1215,7 +1215,7 @@ function addon:CreateHeader(module,MOVEPANEL,PIN)
 	end
 	GCF:EnableMouse(true)
 	GCF:SetMovable(true)
-	GCF:RegisterForDrag("LeftButton")
+	--GCF:RegisterForDrag("LeftButton")
 --[===[@non-debug@
 	GCF:SetScript("OnDragStart",function(frame) print(MOVEPANEL,self:GetBoolean(MOVEPANEL)) if self:GetBoolean(MOVEPANEL) then frame:StartMoving() end end)
 --@end-non-debug@]===]
diff --git a/GarrisonCommander.toc b/GarrisonCommander.toc
index 721f79d..c54d29c 100644
--- a/GarrisonCommander.toc
+++ b/GarrisonCommander.toc
@@ -49,6 +49,7 @@ ShipYard.lua
 ShipControl.lua
 quick.lua
 RelNotes.lua
+minimap.lua
 #@do-not-package@
 Debug.lua
 #@end-do-not-package@
diff --git a/RelNotes.lua b/RelNotes.lua
index e1c5adb..2e60b49 100644
--- a/RelNotes.lua
+++ b/RelNotes.lua
@@ -22,6 +22,9 @@ self:Wiki([[
 == Silent mode ==
 typing /gac silent in chat will eliminate every chat message from GarrisonCommander
 ]])
+self:RelNotes(3,2,2,[[
+Fix: Due to Blizzartd UI changes, unlock panel is no longer available. Sorry mates
+]])
 self:RelNotes(3,2,1,[[
 Fix: Minimap report enhancement removed, You need Garrison Broker for it
 ]])
diff --git a/ShipYard.lua b/ShipYard.lua
index ff93390..161e146 100644
--- a/ShipYard.lua
+++ b/ShipYard.lua
@@ -52,12 +52,12 @@ function module:OnInitialize()
 	self:SafeSecureHook(GSF,"OnClickMission","HookedGSF_OnClickMission")
 	self:SafeSecureHook("GarrisonShipyardMapMission_OnEnter")
 	self:SafeSecureHook("GarrisonShipyardMapMission_OnLeave")
-	self:SafeSecureHook(GSF,"SelectTab","AddMenu")
+	self:SafeSecureHook(GSF,"SelectTab","AddMenu")
 	self:SafeSecureHookScript(GSF,"OnShow","Setup",true)
 	self:SafeRegisterEvent("GARRISON_SHIPYARD_NPC_CLOSED")
 	self:SafeRegisterEvent("GARRISON_MISSION_STARTED")
 	self:SafeSecureHookScript(GSF.FollowerTab,"OnShow","FollowerOnShow")
-
+
 end
 function module:OpenLastTab()
 --@debug@
@@ -93,7 +93,7 @@ function module:OpenProgressTab()
 	lastTab=3
 	return self:OpenLastTab()
 end
-function module:CloseMissionControlTab()
+function module:CloseMissionControlTab()
 	GSF.MissionControlTab:Hide()
 	GSF.tabMC:SetChecked(false)
 end
@@ -136,24 +136,24 @@ local function dump(tip,data,indent)
 	indent=indent or ''
 	for k,v in kpairs(data) do
 		local color="Silver"
-		if type(v)=="number" then color="Cyan"
+		if type(v)=="number" then color="Cyan"
 		elseif type(v)=="string" then color="Yellow" v=v:sub(1,30)
-		elseif type(v)=="boolean" then v=v and 'True' or 'False' color="White"
-		elseif type(v)=="table" then color="Green"
+		elseif type(v)=="boolean" then v=v and 'True' or 'False' color="White"
+		elseif type(v)=="table" then color="Green"
 		else v=type(v) color="Blue"
 		end
 		if k=="description" then v =v:sub(1,10) end
-		if type(v)=="table" then
-			if v.GetObjectType then
-				v=v:GetObjectType()
+		if type(v)=="table" then
+			if v.GetObjectType then
+				v=v:GetObjectType()
 				tip:AddDoubleLine(indent..k,v,colors("Purple",color))
-			else
+			else
 				tip:AddDoubleLine(indent..k,v,colors("Yellow",color))
 				dump(tip,v,indent .. '  ')
 			end
 		else
 			tip:AddDoubleLine(indent..k,v,colors("Orange",color))
-		end
+		end
 	end
 end
 function module:TTDump(frame,data)
@@ -201,7 +201,7 @@ function module:HookedGarrisonShipyardMap_SetupBonus(missionList,frame,mission)
 		addendum.icon:SetTexture(reward.icon)
 	elseif reward.itemID then
 		addendum.icon:SetTexture(GetItemIcon(reward.itemID))
-	end
+	end
 	local cost=mission.cost
 	local currency=mission.costCurrencyTypesID
 	if not mission.canStart then
@@ -277,7 +277,7 @@ print("Doing one time initialization for",this:GetName(),...)
 	--GarrisonShipyardFrameFollowersListScrollFrameButton1
 	--GarrisonShipyardMapMission1
 	addon:AddLabel(L["Shipyard Appearance"])
-	addon:AddToggle("SHIPMOVEPANEL",true,L["Unlock Panel"],L["Makes shipyard panel movable"])
+	--addon:AddToggle("SHIPMOVEPANEL",true,L["Unlock Panel"],L["Makes shipyard panel movable"])
 	--addon:AddToggle("BIGSCREEN",true,L["Use big screen"],L["Disabling this will give you the interface from 1.1.8, given or taken. Need to reload interface"])
 	addon:AddToggle("SHIPPIN",true,L["Show Garrison Commander menu"],L["Disable if you dont want the full Garrison Commander Header."])
  	addon:AddToggle("SHIPENHA",true,L["Show Enhancement buttons"],L["Disable if you dont want the equipment buttons in ship view."])
@@ -288,7 +288,7 @@ print("Doing one time initialization for",this:GetName(),...)
 	tabHP:SetPushedTexture("Interface\\ICONS\\INV_Misc_QuestionMark.blp")
 	tabHP:Show()
 	tabHP:SetPoint('TOPLEFT',GCS,'TOPRIGHT',0,-10)
-	tabHP:SetScript("OnClick",function(this,button) addon:ShowHelpWindow(this,button) end)
+	tabHP:SetScript("OnClick",function(this,button) addon:ShowHelpWindow(this,button) end)
 	local tabMC=CreateFrame("CheckButton",nil,GSF,"SpellBookSkillLineTabTemplate")
 	GSF.tabMC=tabMC
 	tabMC.tooltip=L["Open Garrison Commander Mission Control"]
@@ -299,14 +299,14 @@ print("Doing one time initialization for",this:GetName(),...)
 	local tabQ=CreateFrame("Button",nil,GSF,"SpellBookSkillLineTabTemplate")
 	GSF.tabQ=tabQ
 	tabQ.tooltip=L["Automatically process completed missions and schedules new ones."].."\n"..
-		format(L["Check %s in mission control in order to be also logged out"],L["Auto Logout"]) .. "\n" ..
-		C(format(L["Keep pressed %s while opening table to automate processing"],CTRL_KEY),"green")
+		format(L["Check %s in mission control in order to be also logged out"],L["Auto Logout"]) .. "\n" ..
+		C(format(L["Keep pressed %s while opening table to automate processing"],CTRL_KEY),"green")
 	tabQ:SetNormalTexture("Interface\\ICONS\\Ability_Rogue_Sprint.blp")
 	tabQ:SetPushedTexture("Interface\\ICONS\\Ability_Rogue_Sprint.blp")
 	tabQ:Show()
 	tabQ:SetScript("OnClick",function(this,button) addon:RunQuick() end)
 	tabQ:SetPoint('TOPLEFT',GCS,'TOPRIGHT',0,-210)
-
+
 	GSF.FollowerStatusInfo=GSF.BorderFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
 	GSF.ResourceInfo=GSF.BorderFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
 	GSF.ResourceFormat="|TInterface\\Icons\\garrison_oil:0|t %s " .. GetCurrencyInfo(GARRISON_SHIP_OIL_CURRENCY)
@@ -325,7 +325,7 @@ print("Doing one time initialization for",this:GetName(),...)
 		if (_G[hook]) then
 			self:SafeHookScript(hook,"OnClick","HookedClickOnTabs")
 		end
-	end
+	end
 	self:SafeSecureHookScript(GSF,"OnShow")
 	self:SafeHookScript(GSF,"OnHide","EventGARRISON_SHIPYARD_NPC_CLOSED")
 end
@@ -458,13 +458,13 @@ end
 local upgrades
 function addon:ApplySHIPENHA(value)
   if value then
-    if GSF.FollowerTab:IsVisible() then
+    if GSF.FollowerTab:IsVisible() then
       module:ShowEnhancements()
     end
   else
     if upgrades then upgrades:Hide() end
   end
-
+
 end
 function module:ShowEnhancements()
 	if not upgrades then
diff --git a/minimap.lua b/minimap.lua
new file mode 100644
index 0000000..50c5215
--- /dev/null
+++ b/minimap.lua
@@ -0,0 +1,34 @@
+local me, ns = ...
+local print,hooksecurefunc,IsAddOnLoaded=print,hooksecurefunc,IsAddOnLoaded
+local gc,gb="GarrisonCommander","GarrisonCommander-Broker"
+
+if (me ==  gc and  not IsAddOnLoaded(gb) or
+    me ==  gb and  not IsAddOnLoaded(gc)
+) then
+     GarrisonLandingPageMinimapButton:HookScript("OnEnter",
+     function(this)
+        if this.description==MINIMAP_ORDER_HALL_LANDING_PAGE_TOOLTIP or
+           this.description == GARRISON_TYPE_8_0_LANDING_PAGE_TOOLTIP then
+          GameTooltip:AddLine(CTRL_KEY_TEXT .. " " .. MINIMAP_GARRISON_LANDING_PAGE_TOOLTIP)
+          GameTooltip:AddLine(SHIFT_KEY_TEXT  .. " " .. MINIMAP_ORDER_HALL_LANDING_PAGE_TOOLTIP)
+        end
+        GameTooltip:Show()
+    end
+    )
+    GarrisonLandingPageMinimapButton:HookScript("OnClick",
+      function (this,button)
+         local shown=GarrisonLandingPage:IsShown()
+         local actual=GarrisonLandingPage.garrTypeID
+         local requested=C_Garrison.GetLandingPageGarrisonType()
+         if IsShiftKeyDown() then
+            requested=LE_GARRISON_TYPE_7_0
+         elseif IsControlKeyDown() then
+            requested=LE_GARRISON_TYPE_6_0
+         end
+         if InCombatLockdown() then return end
+         if shown and actual ~= requested then
+           ShowGarrisonLandingPage(requested);
+         end
+      end
+    )
+end