Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for dragonflight - still need to update options #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/proofofconcept.lua
.*
/_build/
/libs/
13 changes: 9 additions & 4 deletions OrderHallCommander.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ dprint=function() end
ddump=function() end
local print=function() end
--@end-non-debug@]===]

local function GetRGB(r, g, b, whatever)
return r, g, b
end

local GARRISON_FOLLOWER_COMBAT_ALLY=GARRISON_FOLLOWER_COMBAT_ALLY
local GARRISON_FOLLOWER_ON_MISSION=GARRISON_FOLLOWER_ON_MISSION
local GARRISON_FOLLOWER_INACTIVE=GARRISON_FOLLOWER_INACTIVE
Expand Down Expand Up @@ -342,9 +347,9 @@ function MixinThreats:AddIcons(mechanics,biases)
th.Description=mechanic.description
th.Ability=mechanic.ability and mechanic.ability.name or mechanic.name
if mechanic.color then
th.Border:SetVertexColor(C[mechanic.color]())
th.Border:SetVertexColor(GetRGB(C[mechanic.color]()))
else
th.Border:SetVertexColor(addon:ColorFromBias(biases[mechanic] or mechanic.bias))
th.Border:SetVertexColor(GetRGB(addon:ColorFromBias(biases[mechanic] or mechanic.bias)))
end
th:Show()
else
Expand Down Expand Up @@ -501,7 +506,7 @@ function MixinFollowerIcon:ShowTooltip()
local status=G.GetFollowerStatus(self.followerID)
if status then
gft.Status:SetText(TOKEN_MARKET_PRICE_NOT_AVAILABLE.. ': ' .. status)
gft.Status:SetTextColor(C:Orange())
gft.Status:SetTextColor(GetRGB(C:Orange()))
gft.Status:Show()
gft:SetHeight(gft:GetHeight()+10)
else
Expand Down Expand Up @@ -631,7 +636,7 @@ function MixinMembers:OnLoad()
end
self:SetWidth(self.Champions[1]:GetWidth()*3+30)
self.NotReady.Text:SetFormattedText(RAID_MEMBER_NOT_READY,STATUS_TEXT_PARTY)
self.NotReady.Text:SetTextColor(C.Red())
self.NotReady.Text:SetTextColor(GetRGB(C.Red()))
end
function MixinMembers:OnShow()
self:SetNotReady()
Expand Down
4 changes: 2 additions & 2 deletions OrderHallCommander.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<Frame name="OHCMembers" mixin="OrderHallCommanderMixin,OrderHallCommanderMixinMembers" virtual="true" enableMouse="false">
<Size x="1" y="70"/>
<Frames>
<Frame parentKey="NotReady" strata="HIGH">
<Frame parentKey="NotReady" frameStrata="HIGH">
<Anchors>
<Anchor point="TOPLEFT" x="-5" y="0"/>
<Anchor point="BOTTOMRIGHT" x="5" y="0"/>
Expand Down Expand Up @@ -321,7 +321,7 @@
<OnLoad method="OnLoad"/>
</Scripts>
</Frame>
<CheckButton name="OHCTab" mouseEnable="true" virtual="true" inherits="SpellBookSkillLineTabTemplate">
<CheckButton name="OHCTab" virtual="true" inherits="SpellBookSkillLineTabTemplate">
<Size x="100" y="50" />
<KeyValues>
<KeyValue key="flag" value="" type="string"/>
Expand Down
136 changes: 71 additions & 65 deletions autopilot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ local OHFFollowers=OrderHallMissionFrameFollowers -- Contains scroll list
local OHFMissionPage=OrderHallMissionFrame.MissionTab.MissionPage -- Contains mission description and party setup
local OHFMapTab=OrderHallMissionFrame.MapTab -- Contains quest map
local OHFCompleteDialog=OrderHallMissionFrameMissions.CompleteDialog
local OHFMissionScroll=OrderHallMissionFrameMissionsListScrollFrame
local OHFMissionScrollChild=OrderHallMissionFrameMissionsListScrollFrameScrollChild
-- local OHFMissionScroll=OrderHallMissionFrameMissionsListScrollFrame
-- local OHFMissionScrollChild=OrderHallMissionFrameMissionsListScrollFrameScrollChild
local LE_FOLLOWER_TYPE_GARRISON_6_0=Enum.GarrisonFollowerType.FollowerType_6_0
local LE_FOLLOWER_TYPE_SHIPYARD_6_2=Enum.GarrisonFollowerType.FollowerType_6_2
local LE_FOLLOWER_TYPE_GARRISON_7_0=Enum.GarrisonFollowerType.FollowerType_7_0
Expand Down Expand Up @@ -103,7 +103,6 @@ end
--*BEGIN
local wipe,pcall,pairs,IsShiftKeyDown,IsControlKeyDown=wipe,pcall,pairs,IsShiftKeyDown,IsControlKeyDown
local PlaySound,SOUNDKIT=PlaySound,SOUNDKIT
local OHFButtons=OHFMissions.listScroll.buttons

local safeguard={}
function module:Cleanup()
Expand Down Expand Up @@ -136,74 +135,81 @@ function module:DoRunMissions()
local baseChance=addon:GetNumber('BASECHANCE')
wipe(safeguard)
local nothing=true
for i=1,#OHFButtons do
local frame=OHFButtons[i]
local mission=frame.info
local missionID=mission and mission.missionID
if missionID then
if not addon:IsBlacklisted(missionID) and addon:HasReservedFollowers(missionID) then
nothing=false
local key=addon:GetMissionKey(missionID)
local party=addon:GetMissionParties(missionID):GetSelectedParty(key)
local members = addon:GetMembersFrame(frame)
addon:Print(safeformat(L["Attempting %s"],C(mission.name,'orange')))

local info=""
for i=1,#members.Champions do
local followerID=members.Champions[i]:GetFollower()
if followerID then
safeguard[followerID]=missionID
local rc,res = pcall(G.AddFollowerToMission,missionID,followerID)
if rc then
info=info .. G.GetFollowerLink(followerID)
else
addon:Print(C(L["Unable to start mission, aborting"],"red"))
self:Cleanup()
break

local scrollBox = OHFMissions.ScrollBox
local shouldContinue = true

scrollBox:ForEachFrame(function(frame, elementData)
if shouldContinue then
local mission=frame.info
local missionID=mission and mission.missionID
if missionID then
if not addon:IsBlacklisted(missionID) and addon:HasReservedFollowers(missionID) then
nothing=false
local key=addon:GetMissionKey(missionID)
local party=addon:GetMissionParties(missionID):GetSelectedParty(key)
local members = addon:GetMembersFrame(frame)
addon:Print(safeformat(L["Attempting %s"],C(mission.name,'orange')))

local info=""
for i=1,#members.Champions do
local followerID=members.Champions[i]:GetFollower()
if followerID then
safeguard[followerID]=missionID
local rc,res = pcall(G.AddFollowerToMission,missionID,followerID)
if rc then
info=info .. G.GetFollowerLink(followerID)
else
addon:Print(C(L["Unable to start mission, aborting"],"red"))
self:Cleanup()
break
end
end
end
end
local timestring,timeseconds,timeImproved,chance,buffs,missionEffects,xpBonus,materials,gold=G.GetPartyMissionInfo(missionID)

if party.perc < chance then
addon:Print(C(L["Could not fulfill mission, aborting"],"red"))
self:Cleanup()
break
end
local r,n,i=addon:GetResources(true)
if select(2,G.GetMissionCost(missionID)) > r then
addon:Print(C(GARRISON_NOT_ENOUGH_MATERIALS_TOOLTIP,"red"))
self:Cleanup()
break
end

nothing=false
if truerun then
self:RegisterEvent("GARRISON_MISSION_STARTED")
G.StartMission(missionID)
addon:Print(C(L["Started with "],"green") ..info)
PlaySound(SOUNDKIT.UI_GARRISON_COMMAND_TABLE_MISSION_START)
--@debug@
dprint("Calling OHF:UpdateMissions")
--@end-debug@
OHFFollowerList.dirtyList=true
OHFFollowerList:UpdateFollowers();
OHFMissions:UpdateMissions()
--@debug@
if multiple then
addon:Print("Multiple is running")
self:ScheduleTimer("DoRunMissions",1)
local timestring,timeseconds,timeImproved,chance,buffs,missionEffects,xpBonus,materials,gold=G.GetPartyMissionInfo(missionID)

if party.perc < chance then
addon:Print(C(L["Could not fulfill mission, aborting"],"red"))
self:Cleanup()
shouldContinue = false
else
local r,n,i=addon:GetResources(true)
if select(2,G.GetMissionCost(missionID)) > r then
addon:Print(C(GARRISON_NOT_ENOUGH_MATERIALS_TOOLTIP,"red"))
self:Cleanup()
shouldContinue = false
else
nothing=false
if truerun then
self:RegisterEvent("GARRISON_MISSION_STARTED")
G.StartMission(missionID)
addon:Print(C(L["Started with "],"green") ..info)
PlaySound(SOUNDKIT.UI_GARRISON_COMMAND_TABLE_MISSION_START)
--@debug@
dprint("Calling OHF:UpdateMissions")
--@end-debug@
OHFFollowerList.dirtyList=true
OHFFollowerList:UpdateFollowers();
OHFMissions:UpdateMissions()
--@debug@
if multiple then
addon:Print("Multiple is running")
self:ScheduleTimer("DoRunMissions",1)
end
--@end-debug@
shouldContinue = false
else
addon:Print(C(L["Would start with "],"green") ..info)
addon:Print(C(safeformat(L["%s to actually start mission"],SHIFT_KEY_TEXT .. KEY_BUTTON1),"green"))
self:Cleanup()
end
end
end
--@end-debug@
break
else
addon:Print(C(L["Would start with "],"green") ..info)
addon:Print(C(safeformat(L["%s to actually start mission"],SHIFT_KEY_TEXT .. KEY_BUTTON1),"green"))
self:Cleanup()
end
end
end
end
end)

if nothing and not multiple then
addon:Print(C(L["No suitable missions. Have you reserved at least one follower?"],"red"))
end
Expand Down
13 changes: 10 additions & 3 deletions cache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ dprint=function() end
ddump=function() end
local print=function() end
--@end-non-debug@]===]

local function GetRGB(r, g, b, whatever)
return r, g, b
end

local GARRISON_FOLLOWER_COMBAT_ALLY=GARRISON_FOLLOWER_COMBAT_ALLY
local GARRISON_FOLLOWER_ON_MISSION=GARRISON_FOLLOWER_ON_MISSION
local GARRISON_FOLLOWER_INACTIVE=GARRISON_FOLLOWER_INACTIVE
Expand Down Expand Up @@ -538,7 +543,9 @@ local TroopsHeader
function module:GetTroopsFrame()
if not TroopsHeader then
local frame=CreateFrame("Frame",nil,OrderHallMissionFrame,"TooltipBorderedFrameTemplate")
frame.Background:Hide()
if frame.Background then
frame.Background:Hide()
end
frame.Top=frame:CreateTexture(nil,"BACKGROUND",nil,-1)
frame.Top:SetPoint("TOPLEFT")
frame.Top:SetPoint("BOTTOMRIGHT")
Expand All @@ -564,10 +571,10 @@ function module:ParseFollowers()
end
local function paintCat(frame)
if addon:GetBoolean(frame.key) then
frame.Count:SetTextColor(C.red())
frame.Count:SetTextColor(GetRGB(C.red()))
frame.Icon:SetDesaturated(true)
else
frame.Count:SetTextColor(C.green())
frame.Count:SetTextColor(GetRGB(C.green()))
frame.Icon:SetDesaturated(false)
end
end
Expand Down
9 changes: 7 additions & 2 deletions followerpage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ dprint=function() end
ddump=function() end
local print=function() end
--@end-non-debug@]===]

local function GetRGB(r, g, b, whatever)
return r, g, b
end

local GARRISON_FOLLOWER_COMBAT_ALLY=GARRISON_FOLLOWER_COMBAT_ALLY
local GARRISON_FOLLOWER_ON_MISSION=GARRISON_FOLLOWER_ON_MISSION
local GARRISON_FOLLOWER_INACTIVE=GARRISON_FOLLOWER_INACTIVE
Expand Down Expand Up @@ -213,7 +218,7 @@ function module:CheckEquipment(this,followerInfo)
local quality=addon:GetItemQuality(itemid)
if type(quality)=="number" then
colored=true
f.Border:SetVertexColor(GetItemQualityColor(quality))
f.Border:SetVertexColor(GetRGB(GetItemQualityColor(quality)))
end
end
end
Expand Down Expand Up @@ -416,7 +421,7 @@ do local pool={}
b.Quantity:SetTextColor(b.IconBorder:GetVertexColor())
else
b.Icon:SetDesaturated(true)
b.Quantity:SetTextColor(C.Grey())
b.Quantity:SetTextColor(GetRGB(C.Grey()))
end
b:Show()
end
Expand Down
Loading