Verified Commit 07fbfd8a authored by Repooc's avatar Repooc
Browse files

Remove Farm Module from the legacy section

parent 3892ed2e
......@@ -730,9 +730,6 @@ function PI:DarthSetup()
E.db["movers"]["SLE_BG_2_Mover"] = "BOTTOMRIGHT,ElvUIParent,BOTTOM,-257,21"
E.db["movers"]["SLE_BG_3_Mover"] = "BOTTOMLEFT,ElvUIParent,BOTTOM,257,21"
E.db["movers"]["SLE_BG_4_Mover"] = "BOTTOM,ElvUIParent,BOTTOM,0,189"
E.db["movers"]["SLE_FarmPortalMover"] = "BOTTOMLEFT,SLE_ToolsToolbarsAnchor,TOPLEFT,0,1"
E.db["movers"]["SLE_FarmSeedMover"] = "LEFT,ElvUIParent,LEFT,24,-160"
E.db["movers"]["SLE_FarmToolMover"] = "BOTTOMLEFT,SLE_SeedToolbarsAnchor,TOPLEFT,0,1"
E.db["movers"]["SLE_GarrisonToolMover"] = "LEFT,ElvUIParent,LEFT,24,0"
E.db["movers"]["SLE_Location_Mover"] = "TOP,ElvUIParent,TOP,0,0"
E.db["movers"]["SLE_UIButtonsMover"] = "TOPRIGHT,ElvUIParent,TOPRIGHT,-227,-174"
......
......@@ -187,9 +187,6 @@ function SLE:Reset(group)
E:ResetMovers(L["Error Frame"])
E:ResetMovers(L["Pet Battle Status"])
E:ResetMovers(L["Pet Battle AB"])
E:ResetMovers(L["Farm Seed Bars"])
E:ResetMovers(L["Farm Tool Bar"])
E:ResetMovers(L["Farm Portal Bar"])
E:ResetMovers(L["Garrison Tools Bar"])
E:ResetMovers(L["Ghost Frame"])
E:ResetMovers(L["Raid Utility"])
......
......@@ -178,7 +178,6 @@ if G["profileCopy"] then
},
["legacy"] = {
["garrison"] = true,
["farm"] = true,
["orderhall"] = true,
["warwampaign"] = true,
},
......
......@@ -399,14 +399,6 @@ P["sle"] = {
["enable"] = false,
},
},
["farm"] = {
["active"] = true,
["buttonsize"] = 30,
["autotarget"] = false,
["seedor"] = "TOP",
["quest"] = false,
["enable"] = false,
},
["orderhall"] = {
["autoOrder"] = {
["enable"] = false,
......
......@@ -197,9 +197,6 @@ L["FAQ_sle_2"] = "|cff30ee30Q: Does Shadow & Light have the same language policy
L["FAQ_sle_3"] = "|cff30ee30Q: Why are the layout's screenshots on download page different from what I see in the game?|r\n|cff9482c9A:|r Because we just forgot to update those."
L["FAQ_sle_4"] = "|cff30ee30Q: Why do I see some weird icons near some people's names in chat?|r\n|cff9482c9A:|r Those icons are provided by S&L and are associated with people we'd like to highlight in any way.\nFor example: |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\chat\\SLE_Chat_Logo:12:28|t is the main icon for development team of Shadow & Light, and |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\chat\\SLE_Chat_Logo_Alt:14:14|t is another one that Repooc likes to use. |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\Chat_Test:16:16|t is awarded to those who help find bugs."
L["FAQ_sle_5"] = "|cff30ee30Q: How can I get in touch with you guys?|r\n|cff9482c9A:|r For obvious reasons, we are not giving out our contact details freely. So your best bet is using tukui.org forums or even in our Discord."
L["Farm Portal Bar"] = true
L["Farm Seed Bars"] = true
L["Farm Tool Bar"] = true
L["Farm"] = true
L["Filter DPS meters' Spam"] = true
L["Fish Key"] = true
......@@ -440,9 +437,6 @@ L["S&L Mail"] = true
L["S&L UI Buttons"] = true
L["S&L: All"] = true
L["S&L: Backgrounds"] = true
L["S&L: Farm Portal Bar"] = true
L["S&L: Farm Seed Bars"] = true
L["S&L: Farm Tool Bar"] = true
L["S&L: Garrison Tools Bar"] = true
L["S&L: Misc"] = true
L["Scroll"] = true
......
......@@ -197,9 +197,6 @@ L["FAQ_sle_2"] = "|cff30ee30Q: Does Shadow & Light have the same language policy
L["FAQ_sle_3"] = "|cff30ee30Q: Why are the layout's screenshots on download page different from what I see in the game?|r\n|cff9482c9A:|r Because we just forgot to update those."
L["FAQ_sle_4"] = "|cff30ee30Q: Why do I see some weird icons near some people's names in chat?|r\n|cff9482c9A:|r Those icons are provided by S&L and are associated with people we'd like to highlight in any way.\nFor example: |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\chat\\SLE_Chat_Logo:12:28|t is the main icon for development team of Shadow & Light, and |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\chat\\SLE_Chat_Logo_Alt:14:14|t is another one that Repooc likes to use. |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\Chat_Test:16:16|t is awarded to those who help find bugs."
L["FAQ_sle_5"] = "|cff30ee30Q: How can I get in touch with you guys?|r\n|cff9482c9A:|r For obvious reasons, we are not giving out our contact details freely. So your best bet is using tukui.org forums or even in our Discord."
L["Farm Portal Bar"] = true
L["Farm Seed Bars"] = true
L["Farm Tool Bar"] = true
L["Farm"] = true
L["Filter DPS meters' Spam"] = "Filtere DPS Meter Spam"
L["Fish Key"] = "Clé du poisson"
......@@ -440,9 +437,6 @@ L["S&L Mail"] = "S&L Courrier"
L["S&L UI Buttons"] = true
L["S&L: All"] = "S&L: Tout"
L["S&L: Backgrounds"] = "S&L: Arrière-plans"
L["S&L: Farm Portal Bar"] = true
L["S&L: Farm Seed Bars"] = true
L["S&L: Farm Tool Bar"] = true
L["S&L: Garrison Tools Bar"] = true
L["S&L: Misc"] = "S&L: divers"
L["Scroll"] = "Défilement"
......
......@@ -197,9 +197,6 @@ L["FAQ_sle_2"] = "|cff30ee30Q: Hat Shadow & Light die gleiche Sprachrichtlinie w
L["FAQ_sle_3"] = "|cff30ee30Q: Warum unterscheiden sich die Screenshots des Layouts auf der Download-Seite von denen, die ich im Spiel sehe?|r\n|cff9482c9A:|r Because we just forgot to update those."
L["FAQ_sle_4"] = "|cff30ee30Q: Warum sehe ich im Chat einige seltsame Symbole neben den Namen einiger Leute?|r\n|cff9482c9A:|r Those icons are provided by S&L and are associated with people we'd like to highlight in any way.\nFor example: |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\chat\\SLE_Chat_Logo:12:28|t is the main icon for development team of Shadow & Light, and |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\chat\\SLE_Chat_Logo_Alt:14:14|t is another one that Repooc likes to use. |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\Chat_Test:16:16|t is awarded to those who help find bugs."
L["FAQ_sle_5"] = "|cff30ee30Q: Wie kann ich mit euch in Kontakt treten??|r\n|cff9482c9A:|r For obvious reasons, we are not giving out our contact details freely. So your best bet is using tukui.org forums or even in our Discord."
L["Farm Portal Bar"] = "Farm Portal Leisten"
L["Farm Seed Bars"] = "Farm Samen Leisten"
L["Farm Tool Bar"] = "Farm Tool Leisten"
L["Farm"] = true
L["Filter DPS meters' Spam"] = "Filtere DPS Meter Spam"
L["Fish Key"] = "Fischen Taste"
......@@ -440,9 +437,6 @@ L["S&L Mail"] = "S&L Post"
L["S&L UI Buttons"] = "S&L UI Tasten"
L["S&L: All"] = "S&L: Alles"
L["S&L: Backgrounds"] = "S&L: Hintergründe"
L["S&L: Farm Portal Bar"] = "S&L: Farm Portal Leiste"
L["S&L: Farm Seed Bars"] = "S&L: Farm Samen Leiste"
L["S&L: Farm Tool Bar"] = "S&L: Farm Hilfsmittel Leiste"
L["S&L: Garrison Tools Bar"] = "S&L: Garnisions Hilfsmittel Leiste"
L["S&L: Misc"] = "S&L: Verschiedenes"
L["Scroll"] = "Rolle"
......
......@@ -197,9 +197,6 @@ L["FAQ_sle_2"] = "|cff30ee30Q: Does Shadow & Light have the same language policy
L["FAQ_sle_3"] = "|cff30ee30Q: Why are the layout's screenshots on download page different from what I see in the game?|r\n|cff9482c9A:|r Because we just forgot to update those."
L["FAQ_sle_4"] = "|cff30ee30Q: Why do I see some weird icons near some people's names in chat?|r\n|cff9482c9A:|r Those icons are provided by S&L and are associated with people we'd like to highlight in any way.\nFor example: |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\chat\\SLE_Chat_Logo:12:28|t is the main icon for development team of Shadow & Light, and |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\chat\\SLE_Chat_Logo_Alt:14:14|t is another one that Repooc likes to use. |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\Chat_Test:16:16|t is awarded to those who help find bugs."
L["FAQ_sle_5"] = "|cff30ee30Q: How can I get in touch with you guys?|r\n|cff9482c9A:|r For obvious reasons, we are not giving out our contact details freely. So your best bet is using tukui.org forums or even in our Discord."
L["Farm Portal Bar"] = "농장 포탈 바"
L["Farm Seed Bars"] = "농장 씨앗 바"
L["Farm Tool Bar"] = "농장 도구 바"
L["Farm"] = "농장"
L["Filter DPS meters' Spam"] = "미터기 스팸 거르기"
L["Fish Key"] = "낚시 키"
......@@ -440,9 +437,6 @@ L["S&L Mail"] = "S&L 우편"
L["S&L UI Buttons"] = "S&L UI 버튼"
L["S&L: All"] = "S&L: 전체"
L["S&L: Backgrounds"] = "S&L: 배경"
L["S&L: Farm Portal Bar"] = "S&L: 농장 포탈 바"
L["S&L: Farm Seed Bars"] = "S&L: 농장 씨앗 바"
L["S&L: Farm Tool Bar"] = "S&L: 농장 도구 바"
L["S&L: Garrison Tools Bar"] = "S&L: 주둔지 툴바"
L["S&L: Misc"] = "S&L: 기타"
L["Scroll"] = true
......
......@@ -197,9 +197,6 @@ L["FAQ_sle_2"] = "|cff30ee30В: Применима ли языковая пол
L["FAQ_sle_3"] = "|cff30ee30В: Почему шаблоны интерфейса в игре не похожи на то, что я видел на скриншотах на странице аддона?|r\n|cff9482c9О:|r Потому что мы просто забыли их обновить."
L["FAQ_sle_4"] = "|cff30ee30В: Почему я вижу странные иконки около имен некоторых людей в чате?|r\n|cff9482c9О:|r Эти ионки обозначают людей, которых мы хотели выделить по той или иной причине.\nНапример: |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\chat\\SLE_Chat_Logo:12:28|t это иконка для разработчиков, а |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\chat\\SLE_Chat_Logo_Alt:16:16|t это иконка, которую иногда использует Repooc. |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\Chat_Test:16:16|t для людей, которые в свое время помогли вычислить хитрый баг."
L["FAQ_sle_5"] = "|cff30ee30В: Как я могу связаться с авторами?|r\n|cff9482c9О:|r По очевидным причинам мы не раздаем свои контакты всем желающим. Так что лучшим методом являются форумы tukui.org."
L["Farm Portal Bar"] = "Панель порталов"
L["Farm Seed Bars"] = "Панели семян"
L["Farm Tool Bar"] = "Панель инструментов"
L["Farm"] = "Ферма"
L["Filter DPS meters' Spam"] = "Фильтровать отчеты о УВС"
L["Fish Key"] = "Модификатор рыбалки"
......@@ -440,9 +437,6 @@ L["S&L Mail"] = "S&L Почта"
L["S&L UI Buttons"] = "Меню S&L"
L["S&L: All"] = "S&L: Все"
L["S&L: Backgrounds"] = "S&L: Фоновые фреймы"
L["S&L: Farm Portal Bar"] = "S&L: Порталы фермы "
L["S&L: Farm Seed Bars"] = "S&L: Семена"
L["S&L: Farm Tool Bar"] = "S&L: Инструменты фермы"
L["S&L: Garrison Tools Bar"] = "S&L: Инструменты гарнизона"
L["S&L: Misc"] = "S&L: Прочее"
L["Scroll"] = "Свиток"
......
local SLE, T, E, L, V, P, G = unpack(select(2, ...))
local B = LibStub("LibBabble-SubZone-3.0")
local BL = B:GetLookupTable()
local Tools = SLE:GetModule("Toolbars")
local Farm = SLE:NewModule("Farm")
--GLOBALS: CreateFrame, hooksecurefunc, UIParent
local _G = _G
local format = format
local ToolAnchor, PortalAnchor
local farmzones = { BL["Sunsong Ranch"], BL["The Halfhill Market"] }
local size
local Seeds = {
[1] = { --Seeds general
79102, -- Green Cabbage
89328, -- Jade Squash
80590, -- Juicycrunch Carrot
80592, -- Mogu Pumpkin
80594, -- Pink Turnip
80593, -- Red Blossom Leek
80591, -- Scallion
89329, -- Striped Melon
80595, -- White Turnip
89326, -- Witchberry
},
[2] = { --Bags general
80809, -- Green Cabbage
89848, -- Jade Squash
84782, -- Juicycrunch Carrot
85153, -- Mogu Pumpkin
85162, -- Pink Turnip
85158, -- Red Blossom Leek
84783, -- Scallion
89849, -- Striped Melon
85163, -- White Turnip
89847, -- Witchberry
},
[3] = { --Seeds special
85216, -- Enigma
85217, -- Magebulb
85219, -- Ominous
89202, -- Raptorleaf
85215, -- Snakeroot
89233, -- Songbell
91806, -- Unstable Portal
89197, -- Windshear Cactus
},
[4] = { --Bags special
95449, -- Enigma
95451, -- Magebulb
95457, -- Raptorleaf
95447, -- Snakeroot
95445, -- Songbell
95454, -- Windshear Cactus
},
[5] = { --Trees lol
85267, -- Autumn Blossom Sapling
85268, -- Spring Blossom Sapling
85269, -- Winter Blossom Sapling
},
}
local FarmTools = {
[1] = {
79104, -- Rusy Watering Can
80513, -- Vintage Bug Sprayer
89880, -- Dented Shovel
89815, -- Master Plow
},
}
local FarmPortals = {
["Horde"] = {
91850, -- Orgrimmar Portal Shard
91861, -- Thunder Bluff Portal Shard
91862, -- Undercity Portal Shard
91863, -- Silvermoon Portal Shard
},
["Alliance"] = {
91860, -- Stormwind Portal Shard
91864, -- Ironforge Portal Shard
91865, -- Darnassus Portal Shard
91866, -- Exodar Portal Shard
},
}
local FarmQuests = {
--Tillers counsil
[31945] = {80591, 84783}, -- Gina, Scallion
[31946] = {80590, 84782}, -- Mung-Mung, Juicycrunch Carrot
[31947] = {79102, 80809}, -- Farmer Fung, Green Cabbage
[31949] = {89326, 89847}, -- Nana, Witchberry
[30527] = {89329, 89849}, -- Haohan, Striped Melon
--Farmer Yoon
[31943] = {89326, 89847}, -- Witchberry
[31942] = {89329, 89849}, -- Striped Melon
[31941] = {89328, 89848}, -- Jade Squash
[31669] = {79102, 80809}, -- Green Cabbage
[31670] = {80590, 84782}, -- Juicycrunch Carrot
[31672] = {80592, 85153}, -- Mogu Pumpkin
[31673] = {80593, 85158}, -- Red Blossom Leek
[31674] = {80594, 85162}, -- Pink Turnip
[31675] = {80595, 85163}, -- White Turnip
[31671] = {80591, 84783}, -- Scallion
--Work Orders
[32645] = {89326, 89847}, -- Witchberry (Alliance Only)
[32653] = {89329, 89849}, -- Striped Melon
--[31941] = {89328, 89848}, -- Jade Squash
[32649] = {79102, 80809}, -- Green Cabbage
--[31670] = {80590, 84782}, -- Juicycrunch Carrot
[32658] = {80592, 85153}, -- Mogu Pumpkin
[32642] = {80593, 85158}, -- Red Blossom Leek (Horde Only)
--[31674] = {80594, 85162}, -- Pink Turnip
[32647] = {80595, 85163}, -- White Turnip
--[31671] = {80591, 84783}, -- Scallion
}
-- Tools.FseedButtons = {}
Tools.FtoolButtons = {}
Tools.FportalButtons = {}
local function QuestItems(itemID)
for i = 1, GetNumQuestLogEntries() do
for qid, sid in pairs(FarmQuests) do
if qid == select(9, GetQuestLogTitle(i)) then
if itemID == sid[1] or itemID == sid[2] then
return true
end
end
end
end
return false
end
local function CanSeed()
if not E.db.sle.legacy.farm.enable then return end
local subzone = GetSubZoneText()
for _, zone in ipairs(farmzones) do
if (zone == subzone) then
return true
end
end
return false
end
local function OnFarm()
return GetSubZoneText() == farmzones[1]
end
function Farm:CreateFarmSeeds()
local SeedAnchor = CreateFrame("Frame", "SLE_SeedToolbarsAnchor", E.UIParent)
SeedAnchor:SetFrameStrata("BACKGROUND")
SeedAnchor:SetPoint("LEFT", E.UIParent, "LEFT", 24, -160)
SeedAnchor.Bars = {}
SeedAnchor.NumBars = 5
SeedAnchor.BarsName = "SLE_FarmSeedToolbar"
SeedAnchor.ReturnDB = function() return E.db.sle.legacy.farm end
SeedAnchor.ShouldShow = CanSeed
SeedAnchor.InventroyCheck = function()
local change = false
for i = 1, SeedAnchor.NumBars do
for id, button in ipairs(SeedAnchor.Bars[SeedAnchor.BarsName..i].Buttons) do
button.items = GetItemCount(button.itemId, nil, true)
if not Tools.buttoncounts[button.itemId] then
Tools.buttoncounts[button.itemId] = 0
end
if button.items ~= Tools.buttoncounts[button.itemId] then
change = true
Tools.buttoncounts[button.itemId] = button.items
end
button.text:SetText(button.items)
button.icon:SetDesaturated(button.items == 0)
button.icon:SetAlpha(button.items == 0 and .25 or 1)
end
end
return change
end
SeedAnchor.EnableMover = function() return E.db.sle.legacy.farm.enable end
SeedAnchor.UpdateBarLayout = function(Bar, anchor, buttons, category, db)
if not db.enable then return end
if not category then category = Bar.id end
local count = 0
size = db.buttonsize
local seedor = db.seedor
local id
Bar:ClearAllPoints()
if category == 1 then
if seedor == "TOP" or seedor == "BOTTOM" then
Bar:Point(seedor.."LEFT", anchor, -2*E.Spacing, seedor == "TOP" and 0 or (2 - E.Spacing*2))
elseif seedor == "LEFT" or seedor == "RIGHT" then
Bar:Point("TOP"..seedor, anchor, (seedor == "LEFT" and 0 or 2), -2)
end
else
if _G[SeedAnchor.BarsName..(category-1)]:IsShown() then
if seedor == "TOP" or seedor == "BOTTOM" then
Bar:Point("TOPLEFT", _G[SeedAnchor.BarsName..(category-1)], "TOPRIGHT", -E.Spacing, 0)
elseif seedor == "LEFT" or seedor == "RIGHT" then
Bar:Point("TOPLEFT", _G[SeedAnchor.BarsName..(category-1)], "BOTTOMLEFT", 0, E.Spacing)
end
else
SeedAnchor.UpdateBarLayout(Bar, anchor, buttons, category-1, db)
end
end
for i, button in ipairs(buttons) do
id = gsub(button:GetName(), "FarmButton", "")
id = tonumber(id)
button:ClearAllPoints()
if not db.active or button.items > 0 then
if seedor == "TOP" or seedor == "BOTTOM" then
local mult = seedor == "TOP" and -1 or 1
button:Point(seedor.."LEFT", Bar, 1 + E.Spacing, mult*(count * (size+(2 - E.Spacing))) - 1 + E.Spacing)
elseif seedor == "LEFT" or seedor == "RIGHT" then
local mult = seedor == "RIGHT" and -1 or 1
button:Point("TOPLEFT", Bar, "TOPLEFT", mult*(count * (size+(2 - E.Spacing))) - 1 + E.Spacing, 1 + E.Spacing)
end
button:Show()
button:Size(size, size)
count = count + 1
else
button:Hide()
end
if db.quest then
if not CanSeed() then
Bar:Width(size+2)
Bar:Height(size+2)
return count
end
if QuestItems(id) then
ActionButton_ShowOverlayGlow(button)
else
ActionButton_HideOverlayGlow(button)
end
else
ActionButton_HideOverlayGlow(button)
end
end
Bar:Width(size+2)
Bar:Height(size+2)
return count
end
SeedAnchor.Resize = function(self)
local seedor = E.db.sle.legacy.farm.seedor
if seedor == "TOP" or seedor == "BOTTOM" then
self:Size((E.db.sle.legacy.farm.buttonsize+(2 - E.Spacing))*SeedAnchor.NumBars - E.Spacing, (E.db.sle.legacy.farm.buttonsize+(2 - E.Spacing))*10 - E.Spacing)
elseif seedor == "LEFT" or seedor == "RIGHT" then
self:Size((E.db.sle.legacy.farm.buttonsize+(2 - E.Spacing))*10 - E.Spacing, (E.db.sle.legacy.farm.buttonsize+(2 - E.Spacing))*SeedAnchor.NumBars - E.Spacing)
end
end
for i = 1, SeedAnchor.NumBars do
local seedBar = CreateFrame("Frame", SeedAnchor.BarsName..i, SeedAnchor)
seedBar:SetFrameStrata("BACKGROUND")
if i == 1 or i == 3 then
seedBar.Autotarget = function(button)
if not E.db.sle.legacy.farm.autotarget then return end
local container, slot = SLE:BagSearch(button.itemId)
if container and slot then
button:SetAttribute("type", "macro")
button:SetAttribute("macrotext", format("/targetexact %s \n/use %s %s", L["Tilled Soil"], container, slot))
end
end
end
seedBar:SetPoint("CENTER", SeedAnchor, "CENTER", 0, 0)
seedBar.id = i
seedBar.Items = {}
seedBar.zonecheck = CanSeed
for index = 1, #Seeds[i] do
local itemID = Seeds[i][index]
seedBar.Items[itemID] = itemID
end
SeedAnchor.Bars[SeedAnchor.BarsName..i] = seedBar
end
SeedAnchor.Resize(SeedAnchor)
E:CreateMover(SeedAnchor, "SLE_FarmSeedMover", L["S&L: Farm Seed Bars"], nil, nil, nil, "ALL,S&L,S&L MISC")
E:DisableMover("SLE_FarmSeedMover")
return SeedAnchor
end
function Farm:CreateFarmTools()
ToolAnchor = CreateFrame("Frame", "SLE_ToolsToolbarsAnchor", E.UIParent)
ToolAnchor:SetFrameStrata("BACKGROUND")
ToolAnchor:SetPoint("BOTTOMLEFT", _G["SLE_SeedToolbarsAnchor"], "TOPLEFT", 0, 1 + E.Spacing*4)
ToolAnchor.Bars = {}
ToolAnchor.NumBars = 1
ToolAnchor.BarsName = "SLE_FarmToolsToolbar"
ToolAnchor.ReturnDB = function() return E.db.sle.legacy.farm end
ToolAnchor.ShouldShow = CanSeed
ToolAnchor.InventroyCheck = function()
local change = false
for _, button in ipairs(ToolAnchor.Bars["SLE_FarmToolsToolbar1"].Buttons) do
button.items = GetItemCount(button.itemId)
if not Tools.buttoncounts[button.itemId] then
Tools.buttoncounts[button.itemId] = button.items
end
if button.items ~= Tools.buttoncounts[button.itemId] then
change = true
Tools.buttoncounts[button.itemId] = button.items
end
button.icon:SetDesaturated(button.items == 0)
button.icon:SetAlpha(button.items == 0 and .25 or 1)
end
return change
end
ToolAnchor.EnableMover = function() return E.db.sle.legacy.farm.enable end
ToolAnchor.UpdateBarLayout = Tools.UpdateBarLayout
ToolAnchor.Resize = function(self)
self:Size((E.db.sle.legacy.farm.buttonsize+(2 - E.Spacing))*5 - E.Spacing, E.db.sle.legacy.farm.buttonsize+(2 - E.Spacing) - E.Spacing)
end
local toolBar = CreateFrame("Frame", "SLE_FarmToolsToolbar1", ToolAnchor)
toolBar:SetFrameStrata("BACKGROUND")
toolBar:SetPoint("CENTER", ToolAnchor, "CENTER", 0, 0)
toolBar.id = 1
toolBar.Items = {}
toolBar.zonecheck = CanSeed
for index = 1, #FarmTools[1] do
local itemID = FarmTools[1][index]
toolBar.Items[itemID] = itemID
end
ToolAnchor.Bars["SLE_FarmToolsToolbar1"] = toolBar
ToolAnchor.Resize(ToolAnchor)
E:CreateMover(ToolAnchor, "SLE_FarmToolMover", L["S&L: Farm Tool Bar"], nil, nil, nil, "ALL,S&L,S&L MISC")
E:DisableMover("SLE_FarmToolMover")
return ToolAnchor
end
function Farm:CreateFarmPortals()
PortalAnchor = CreateFrame("Frame", "SLE_PortalToolbarAnchor", E.UIParent)
PortalAnchor:SetFrameStrata("BACKGROUND")
PortalAnchor:Point("BOTTOMLEFT", "SLE_ToolsToolbarsAnchor", "TOPLEFT", 0, 1 + E.Spacing*4)
PortalAnchor.Bars = {}
PortalAnchor.NumBars = 1
PortalAnchor.BarsName = "SLE_FarmPortalToolbar"
PortalAnchor.ReturnDB = function() return E.db.sle.legacy.farm end
PortalAnchor.ShouldShow = CanSeed
PortalAnchor.InventroyCheck = function()
local change = false
for _, button in ipairs(PortalAnchor.Bars["SLE_FarmPortalToolbar1"].Buttons) do
button.items = GetItemCount(button.itemId)
if not Tools.buttoncounts[button.itemId] then
Tools.buttoncounts[button.itemId] = button.items
end
if button.items ~= Tools.buttoncounts[button.itemId] then
change = true
Tools.buttoncounts[button.itemId] = button.items
end
button.text:SetText(button.items)
button.icon:SetDesaturated(button.items == 0)
button.icon:SetAlpha(button.items == 0 and .25 or 1)
end
return change
end
PortalAnchor.EnableMover = function() return E.db.sle.legacy.farm.enable end
PortalAnchor.UpdateBarLayout = Tools.UpdateBarLayout
PortalAnchor.Resize = function(self)
self:Size((E.db.sle.legacy.farm.buttonsize+(2 - E.Spacing))*5 - E.Spacing, E.db.sle.legacy.farm.buttonsize+(2 - E.Spacing) - E.Spacing)
end
local portalBar = CreateFrame("Frame", "SLE_FarmPortalToolbar1", PortalAnchor)
portalBar:SetFrameStrata("BACKGROUND")
portalBar:SetPoint("CENTER", PortalAnchor, "CENTER", 0, 0)
portalBar.id = 1
portalBar.Items = {}
portalBar.zonecheck = CanSeed
for index = 1, #FarmPortals[E.myfaction] do
local itemID = FarmPortals[E.myfaction][index]
portalBar.Items[itemID] = itemID
end
PortalAnchor.Bars["SLE_FarmPortalToolbar1"] = portalBar
PortalAnchor.Resize(PortalAnchor)
E:CreateMover(PortalAnchor, "SLE_FarmPortalMover", L["S&L: Farm Portal Bar"], nil, nil, nil, "ALL,S&L,S&L MISC")
E:DisableMover("SLE_FarmPortalMover")
return PortalAnchor
end
function Farm:Initialize()
Tools:RegisterForBar(Farm.CreateFarmSeeds)
Tools:RegisterForBar(Farm.CreateFarmTools)
Tools:RegisterForBar(Farm.CreateFarmPortals)
end
SLE:RegisterModule(Farm:GetName())
\ No newline at end of file
......@@ -129,4 +129,4 @@ function Gar:Initialize()
self:RegisterEvent("SHIPMENT_CRAFTER_CLOSED");
end
SLE:RegisterModule(Gar:GetName())
\ No newline at end of file
SLE:RegisterModule(Gar:GetName())
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file='farm.lua'/>
<Script file='garrison.lua'/>
<Script file='orderhall.lua'/>
</Ui>
......@@ -244,7 +244,7 @@ function Tools:PopulateBar(bar)
if not bar then return end
if not bar.Buttons then bar.Buttons = {} end
for id, data in pairs(bar.Items) do
tinsert(bar.Buttons, Tools:CreateToolsButton(id, bar, "item", data.name, data.texture, true, E.db.sle.legacy.farm))
tinsert(bar.Buttons, Tools:CreateToolsButton(id, bar, "item", data.name, data.texture, true, E.db.sle.legacy.garrison.toolbar))
end
--This is my nightmare
sort(bar.Buttons, function(a, b)
......
local SLE, T, E, L, V, P, G = unpack(select(2, ...))
local Tools = SLE:GetModule("Toolbars")
local EXPANSION_NAME4 = EXPANSION_NAME4
local function configTable()
if not SLE.initialized then return end
local ACH = E.Libs.ACH
local db = E.db.sle.legacy.farm
E.Options.args.sle.args.modules.args.legacy.args.farm = {
type = 'group',
order = 1,
name = L[