(beta) Full AceGui3.0 usage

This commit is contained in:
mikx 2018-01-18 09:34:24 -05:00
parent 70e0a3c2e6
commit 7f292e2a7b
9 changed files with 161 additions and 237 deletions

View File

@ -11,10 +11,11 @@ local ENCOUNTER_LOOT_RECEIVED_Frame = CreateFrame("Frame")
ENCOUNTER_LOOT_RECEIVED_Frame:RegisterEvent("ENCOUNTER_LOOT_RECEIVED") ENCOUNTER_LOOT_RECEIVED_Frame:RegisterEvent("ENCOUNTER_LOOT_RECEIVED")
ENCOUNTER_LOOT_RECEIVED_Frame:SetScript("OnEvent", ENCOUNTER_LOOT_RECEIVED_Frame:SetScript("OnEvent",
function(self, event, ...) function(self, event, ...)
local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 = ... local encounterID, itemID, itemLink, quantity, playerName, className, arg7, arg8, arg9 = ...
name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(arg2) name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(itemID)
value = MX.TSM:GetItemValue(arg2, "DBMarket"); value = MX.TSM:GetItemValue(itemID, "DBMarket");
if (value ~= nil and value >= Farmer_Logic_MinAlert and quality >= 1) then local pn = UnitName("player");
MX:SendAlert(arg2,value); if (value ~= nil and value >= Farmer_Logic_MinAlert and quality >= 1 and playerName == pn) then
MX:SendAlert(itemID,value);
end end
end) end)

View File

@ -10,35 +10,32 @@ local L = LibStub("AceLocale-3.0"):GetLocale("MxW");
local PLAYER_MONEY_Frame = CreateFrame("Frame") local PLAYER_MONEY_Frame = CreateFrame("Frame")
PLAYER_MONEY_Frame:RegisterEvent("PLAYER_MONEY") PLAYER_MONEY_Frame:RegisterEvent("PLAYER_MONEY")
PLAYER_MONEY_Frame:SetScript("OnEvent", function(self, event, ...) PLAYER_MONEY_Frame:SetScript("OnEvent", function(self, event, ...)
local tmpMoney = GetMoney()
if self.CurrentMoney then local DiffGold = 0
self.DiffMoney = tmpMoney - self.CurrentMoney local NewGold = GetMoney() -- Get the player gold after the event
else DiffGold = NewGold - CurrentGold -- Get the gold difference
self.DiffMoney = 0
end if (DiffGold > 0) then -- Gold gain
self.CurrentMoney = tmpMoney
if self.DiffMoney > 0 then local weekday, month, day, year = CalendarGetDate();
-- Money Gain -- Reset Global Daily Counter
-- Reset daily counter if this is a new day if (Farmer_Logic_Day ~= day) then
local weekday, month, day, year = CalendarGetDate(); Farmer_Money_DayGlobal = 0;
-- Reset Global Daily Counter MX:UpdateMainUI()
if (Farmer_Logic_Day ~= day) then Farmer_Logic_Day = day;
Farmer_Money_DayGlobal = 0; end
MX:UpdateText()
Farmer_Logic_Day = day; -- Write to SavedVariables
end Farmer_Money_MonthGlobal = Farmer_Money_MonthGlobal + DiffGold;
-- Reset Player Daily Counter Farmer_Money_DayGlobal = Farmer_Money_DayGlobal + DiffGold;
if (Farmer_Logic_PlayerDay ~= day) then
Farmer_Money_DayPlayer = 0; MX:UpdateMainUI()
MX:UpdateText()
Farmer_Logic_PlayerDay = day; elseif (DiffGold <= 0) then -- Gold lost
end
-- Write to SavedVariables end
Farmer_Money_DayPlayer = Farmer_Money_DayPlayer + self.DiffMoney;
Farmer_Money_MonthPlayer = Farmer_Money_MonthPlayer + self.DiffMoney; CurrentGold = GetMoney()
Farmer_Money_MonthGlobal = Farmer_Money_MonthGlobal + self.DiffMoney; DiffGold = 0
Farmer_Money_DayGlobal = Farmer_Money_DayGlobal + self.DiffMoney;
elseif self.DiffMoney < 0 then
-- Money Lost
end
end) end)

View File

@ -8,183 +8,97 @@
local MX = LibStub("AceAddon-3.0"):GetAddon("MxW"); local MX = LibStub("AceAddon-3.0"):GetAddon("MxW");
local L = LibStub("AceLocale-3.0"):GetLocale("MxW"); local L = LibStub("AceLocale-3.0"):GetLocale("MxW");
local AceGUI = LibStub("AceGUI-3.0") local AceGUI = LibStub("AceGUI-3.0")
local GUI_LOOTCOLLECTED, GUI_SCROLLCONTAINER local GUI_LOOTCOLLECTED, GUI_SCROLLCONTAINER
local lootCollectedLastEntry = nil local lootCollectedLastEntry = nil
--
-- main frame
local f = CreateFrame("Frame","FarmerMainFrame", UIParent)
local mxwVersion = GetAddOnMetadata("MxW", "Version") local mxwVersion = GetAddOnMetadata("MxW", "Version")
local mainFrameWidth = 350;
-- make it draggable with the mouse local backdrop = {
f:SetMovable(true) bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
f:EnableMouse(true) edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
f:SetScript("OnMouseDown", function(self, button) edgeSize = 2,
if button == "LeftButton" and not self.isMoving then insets = { left = 1, right = 1, top = 1, bottom = 1 }
self:StartMoving(); }
self.isMoving = true;
end
end)
f:SetScript("OnMouseUp", function(self, button)
if button == "LeftButton" and self.isMoving then
self:StopMovingOrSizing();
self.isMoving = false;
end
end)
f:SetScript("OnHide", function(self)
if ( self.isMoving ) then
self:StopMovingOrSizing();
self.isMoving = false;
end
end)
f:SetFrameStrata("BACKGROUND") --Set its strata local labTodayGold = AceGUI:Create("Label")
f:SetHeight(100) --Give it height local labMonthGold = AceGUI:Create("Label")
f:SetWidth(mainFrameWidth) --and width
f:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", --Set the background and border textures function MX:ShowMainUI()
edgeFile = "Interface/Tooltips/UI-Tooltip-Border", local MAIN_UI = AceGUI:Create("Window")
tile = true, tileSize = 16, edgeSize = 10, MAIN_UI:SetHeight(100)
insets = { left = 4, right = 4, top = 4, bottom = 4 } MAIN_UI:SetTitle("MxW " .. self.db.profile.version)
}) MAIN_UI:SetStatusTable(self.db.profile.mainUI)
f:SetBackdropColor(0, 0, 0) --Set the background colour to black MAIN_UI:SetLayout("List")
f:SetPoint("CENTER") --Put it in the centre of the parent frame (UIParent) MAIN_UI:SetWidth(300)
MAIN_UI:EnableResize(false)
f.txtLogo = f:CreateFontString(nil, "ARTWORK") --Create a FontString to display text labTodayGold:SetFont("Fonts\\FRIZQT__.TTF", 10)
f.txtLogo:SetFont("Fonts\\FRIZQT__.TTF", 14) --Set the font and size labTodayGold:SetColor(1, 1, 1)
f.txtLogo:SetTextColor(1, 1, 1) --Set the text colour labTodayGold:SetFullWidth(true)
f.txtLogo:SetPoint("TOP", 0, -5) --Put it in the centre of the frame MAIN_UI:AddChild(labTodayGold)
f.txtLogo:SetText("MxW") --Change the displayed text
f.txtVersion = f:CreateFontString(nil, "ARTWORK") --Create a FontString to display text labMonthGold:SetFont("Fonts\\FRIZQT__.TTF", 10)
f.txtVersion:SetFont("Fonts\\FRIZQT__.TTF", 9) --Set the font and size labMonthGold:SetColor(1, 1, 1)
f.txtVersion:SetTextColor(1, 1, 1) --Set the text colour labMonthGold:SetFullWidth(true)
f.txtVersion:SetPoint("TOP", -(mainFrameWidth/2) + (#mxwVersion*3.0), -5) --Put it in the centre of the frame MAIN_UI:AddChild(labMonthGold)
f.txtVersion:SetText(mxwVersion) --Change the displayed text
local button = CreateFrame("Button", nil, f) local labSpace = AceGUI:Create("Label")
button:SetPoint("TOP", f, "TOP", (mainFrameWidth/2) - #L["MainForm_Label_Close"]*6.0, -5) labSpace:SetFont("Fonts\\FRIZQT__.TTF", 10)
button:SetWidth(#L["MainForm_Label_Close"]*10.5) labSpace:SetColor(1, 1, 1)
button:SetHeight(17) labSpace:SetFullWidth(true)
labSpace:SetText(" ")
MAIN_UI:AddChild(labSpace)
button:SetText(L["MainForm_Label_Close"]) local BUTTON_LOOTLIST = AceGUI:Create("Button")
button:SetNormalFontObject("GameFontNormal") BUTTON_LOOTLIST:SetAutoWidth(true)
BUTTON_LOOTLIST:SetText(L["MainForm_Button_LootList"])
BUTTON_LOOTLIST:SetPoint("RIGHT", 5, 15)
BUTTON_LOOTLIST:SetCallback("OnClick",
function()
MX:ShowListUI()
end
)
MAIN_UI:AddChild(BUTTON_LOOTLIST)
end
local ntex = button:CreateTexture() function MX:ShowListUI()
ntex:SetTexture("Interface/Buttons/UI-Panel-Button-Up") local LOOTLIST_UI = AceGUI:Create("Window")
ntex:SetTexCoord(0, 0.625, 0, 0.6875) LOOTLIST_UI:SetHeight(100)
ntex:SetAllPoints() LOOTLIST_UI:SetTitle(L["MainForm_Button_LootList"])
button:SetNormalTexture(ntex) LOOTLIST_UI:SetStatusTable(self.db.profile.lootlistUI)
LOOTLIST_UI:SetLayout("List")
LOOTLIST_UI:SetWidth(300)
local htex = button:CreateTexture() GUI_SCROLLCONTAINER = AceGUI:Create("SimpleGroup")
htex:SetTexture("Interface/Buttons/UI-Panel-Button-Highlight") GUI_SCROLLCONTAINER:SetFullWidth(true)
htex:SetTexCoord(0, 0.625, 0, 0.6875) GUI_SCROLLCONTAINER:SetHeight(150)
htex:SetAllPoints() GUI_SCROLLCONTAINER:SetLayout("Fill")
button:SetHighlightTexture(htex) GUI_SCROLLCONTAINER.frame:SetBackdrop(backdrop)
GUI_SCROLLCONTAINER.frame:SetBackdropColor(0, 0, 0)
GUI_SCROLLCONTAINER.frame:SetBackdropBorderColor(0.4, 0.4, 0.4)
local ptex = button:CreateTexture() GUI_LOOTCOLLECTED = AceGUI:Create("ScrollFrame")
ptex:SetTexture("Interface/Buttons/UI-Panel-Button-Down") GUI_LOOTCOLLECTED:SetLayout("Flow")
ptex:SetTexCoord(0, 0.625, 0, 0.6875) LOOTLIST_UI:AddChild(GUI_SCROLLCONTAINER)
ptex:SetAllPoints() GUI_SCROLLCONTAINER:AddChild(GUI_LOOTCOLLECTED)
button:SetPushedTexture(ptex) end
button:SetScript("OnClick", function(self, arg1)
f:Hide();
end)
f.txtLabTM = f:CreateFontString(nil, "ARTWORK") --Create a FontString to display text
f.txtLabTM:SetFont("Fonts\\FRIZQT__.TTF", 10) --Set the font and size
f.txtLabTM:SetTextColor(1, 1, 1) --Set the text colour
f.txtLabTM:SetPoint("TOP", 0, -20) --Put it in the centre of the frame
f.txtLabTM:SetText(format("%s / %s",L["MainForm_Label_Money_Lab_Today"],L["MainForm_Label_Money_Lab_Month"])) --Change the displayed text
f.txtPlayer = f:CreateFontString(nil, "ARTWORK") --Create a FontString to display text
f.txtPlayer:SetFont("Fonts\\FRIZQT__.TTF", 10) --Set the font and size
f.txtPlayer:SetTextColor(1, 1, 1) --Set the text colour
f.txtPlayer:SetPoint("TOPLEFT", 10, -32) --Put it in the centre of the frame
f.txtPlayer:SetText(L["MainForm_Label_Money_Player"]) --Change the displayed text
f.txtGlobal = f:CreateFontString(nil, "ARTWORK") --Create a FontString to display text
f.txtGlobal:SetFont("Fonts\\FRIZQT__.TTF", 10) --Set the font and size
f.txtGlobal:SetTextColor(1, 1, 1) --Set the text colour
f.txtGlobal:SetPoint("TOPLEFT", 10, -42) --Put it in the centre of the frame
f.txtGlobal:SetText(L["MainForm_Label_Money_Global"]) --Change the displayed text
f.txtLootLabel = f:CreateFontString(nil, "ARTWORK") --Create a FontString to display text
f.txtLootLabel:SetFont("Fonts\\FRIZQT__.TTF", 10) --Set the font and size
f.txtLootLabel:SetTextColor(1, 1, 1) --Set the text colour
f.txtLootLabel:SetPoint("TOP", 0, -56) --Put it in the centre of the frame
f.txtLootLabel:SetText(L["MainForm_Label_Loot"]) --Put it in the centre of the frame
f.txtLootLinkQty = f:CreateFontString(nil, "ARTWORK") --Create a FontString to display text
f.txtLootLinkQty:SetFont("Fonts\\FRIZQT__.TTF", 10) --Set the font and size
f.txtLootLinkQty:SetTextColor(1, 1, 1) --Set the text colour
f.txtLootLinkQty:SetPoint("TOP", 0, -66)
f.txtLast = f:CreateFontString(nil, "ARTWORK") --Create a FontString to display text
f.txtLast:SetFont("Fonts\\FRIZQT__.TTF", 10) --Set the font and size
f.txtLast:SetTextColor(1, 1, 1) --Set the text colour
f.txtLast:SetPoint("TOPLEFT", 10, -62) --Put it in the centre of the frame
local MAIN_UI = AceGUI:Create("Window")
MAIN_UI:Hide()
MAIN_UI:SetHeight(200)
MAIN_UI:SetTitle("MxW")
MAIN_UI:SetLayout("Flow")
MAIN_UI:SetWidth(300)
MAIN_UI:EnableResize(true)
GUI_SCROLLCONTAINER = AceGUI:Create("SimpleGroup")
GUI_SCROLLCONTAINER:SetFullWidth(true)
GUI_SCROLLCONTAINER:SetHeight(150)
GUI_SCROLLCONTAINER:SetLayout("Fill")
GUI_SCROLLCONTAINER.frame:SetBackdrop(backdrop)
GUI_SCROLLCONTAINER.frame:SetBackdropColor(0, 0, 0)
GUI_SCROLLCONTAINER.frame:SetBackdropBorderColor(0.4, 0.4, 0.4)
GUI_LOOTCOLLECTED = AceGUI:Create("ScrollFrame")
GUI_LOOTCOLLECTED:SetLayout("Flow")
GUI_SCROLLCONTAINER:AddChild(GUI_LOOTCOLLECTED)
MAIN_UI:AddChild(GUI_SCROLLCONTAINER)
local MainFrame_Event_ADDON_LOADED = CreateFrame("Frame") local MainFrame_Event_ADDON_LOADED = CreateFrame("Frame")
MainFrame_Event_ADDON_LOADED:RegisterEvent("ADDON_LOADED") MainFrame_Event_ADDON_LOADED:RegisterEvent("ADDON_LOADED")
MainFrame_Event_ADDON_LOADED:SetScript("OnEvent", function(self, event, ...) MainFrame_Event_ADDON_LOADED:SetScript("OnEvent", function(self, event, ...)
MX:UpdateText()
end) end)
local MainFrame_Event_PLAYER_MONEY = CreateFrame("Frame") local MainFrame_Event_PLAYER_ENTERING_WORLD = CreateFrame("Frame")
MainFrame_Event_PLAYER_MONEY:RegisterEvent("PLAYER_MONEY") MainFrame_Event_PLAYER_ENTERING_WORLD :RegisterEvent("PLAYER_ENTERING_WORLD")
MainFrame_Event_PLAYER_MONEY:SetScript("OnEvent", function(self, event, ...) MainFrame_Event_PLAYER_ENTERING_WORLD :SetScript("OnEvent", function(self, event, ...)
MX:UpdateText() -- Init gold variable
CurrentGold = GetMoney()
MX:UpdateMainUI()
end) end)
local MainFrame_Event_ENCOUNTER_LOOT_RECEIVED = CreateFrame("Frame") function MX:UpdateMainUI()
MainFrame_Event_ENCOUNTER_LOOT_RECEIVED:RegisterEvent("ENCOUNTER_LOOT_RECEIVED") labTodayGold:SetText(format("%s (%s)", MX:FormatMoney(Farmer_Money_DayGlobal),L["MainForm_Label_Money_Lab_Today"]))
MainFrame_Event_ENCOUNTER_LOOT_RECEIVED:SetScript("OnEvent", function(self, event, ...) labMonthGold:SetText(format("%s (%s)", MX:FormatMoney(Farmer_Money_MonthGlobal),L["MainForm_Label_Money_Lab_Month"]))
local arg1, iid, ilink, iqty, arg5, arg6, arg7, arg8, arg9 = ...
--name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(iid);
value = MX.TSM:GetItemValue(iid, "DBMarket");
if (value ~= nil and value >= Farmer_Logic_MinAlert and quality >= 0) then
--f.txtLast:SetText(format("%s %s (%s) (%s %s)",L["MainForm_Label_Money_Last"],link,MX:FormatMoney(value),L["MainForm_Label_Money_Min"],MX:FormatMoney(Farmer_Logic_MinAlert)));
local fv = MX:FormatMoneyShort(value);
local tfv = MX:FormatMoneyShort(value*iqty);
if (iqty > 1) then
f.txtLootLinkQty:SetText(format("%sx %s (%s) (T. %s)", iqty, ilink, fv, tfv));
MX:addItem2LootCollectedList(format("%sx %s (%s) (T. %s)", iqty, ilink, fv, tfv),texture)
elseif (iqty == 1) then
f.txtLootLinkQty:SetText(format("%sx %s (%s)", iqty, ilink, fv));
MX:addItem2LootCollectedList(format("%sx %s (%s)", iqty, ilink, fv),texture)
end
end
end)
function MX:UpdateText()
f.txtPlayer:SetText(format("%s %s / %s",L["MainForm_Label_Money_Player"], MX:FormatMoney(Farmer_Money_DayPlayer), MX:FormatMoney(Farmer_Money_MonthPlayer))) --Change the displayed text
f.txtGlobal:SetText(format("%s %s / %s",L["MainForm_Label_Money_Global"], MX:FormatMoney(Farmer_Money_DayGlobal), MX:FormatMoney(Farmer_Money_MonthGlobal))) --Change the displayed text
end end
function MX:ShowMain() function MX:ShowMain()

View File

@ -6,7 +6,6 @@
local MX = LibStub("AceAddon-3.0"):GetAddon("MxW"); local MX = LibStub("AceAddon-3.0"):GetAddon("MxW");
local L = LibStub("AceLocale-3.0"):GetLocale("MxW"); local L = LibStub("AceLocale-3.0"):GetLocale("MxW");
print("Alert.lua has been loaded.");
-- Alert Cooking -- Alert Cooking
-- Based on [[ AchievementAlertFrame ]] from Blizzard -- Based on [[ AchievementAlertFrame ]] from Blizzard

View File

@ -3,6 +3,5 @@
<Script file="DB.lua"/> <Script file="DB.lua"/>
<Script file="Math.lua"/> <Script file="Math.lua"/>
<Script file="Money.lua"/> <Script file="Money.lua"/>
<Script file="Option.lua"/>
<Script file="TSM.lua"/> <Script file="TSM.lua"/>
</Ui> </Ui>

View File

@ -21,12 +21,15 @@ L["MainForm_Label_Close"] = "FERMER";
L["MainForm_Label_Money_Lab_Today"] = "Auj."; L["MainForm_Label_Money_Lab_Today"] = "Auj.";
L["MainForm_Label_Money_Lab_Month"] = "Mois"; L["MainForm_Label_Money_Lab_Month"] = "Mois";
L["MainForm_Label_Money_Global"] = "Or (Global) :" L["MainForm_Label_Money_Global"] = "Or (Global) :"
L["MainForm_Label_Money_Player"] = "Or (Joueur):" L["MainForm_Label_Money_Player"] = "Or (Joueur) :"
L["MainForm_Label_Money_Last"] = "Dernier Loot :"; L["MainForm_Label_Money_Last"] = "Dernier Loot :";
L["MainForm_Label_Money_Min"] = "Min."; L["MainForm_Label_Money_Min"] = "Min.";
L["MainForm_Label_LastBoE"] = "Dernier BOE :" L["MainForm_Label_LastBoE"] = "Dernier BOE :"
L["MainForm_Label_LastBoE_NONE"] = "n/d" L["MainForm_Label_LastBoE_NONE"] = "n/d"
L["MainForm_Label_Loot"] = "- BUTIN -"; L["MainForm_Label_Loot"] = "- BUTIN -";
L["MainForm_Button_LootList"] = "Liste de loot(s)";
L["MainForm_Group_Features"] = "Fonctions";
L["MainForm_Group_Gold"] = "Or";
-- Alert Classes -- Alert Classes
L["Alert_Class_Consumable"] = "Consommable"; L["Alert_Class_Consumable"] = "Consommable";

View File

@ -22,10 +22,13 @@ L["MainForm_Label_Money_Lab_Today"] = "Today";
L["MainForm_Label_Money_Lab_Month"] = "Month"; L["MainForm_Label_Money_Lab_Month"] = "Month";
L["MainForm_Label_Money_Global"] = "Gold (Global):" L["MainForm_Label_Money_Global"] = "Gold (Global):"
L["MainForm_Label_Money_Player"] = "Gold (Player):" L["MainForm_Label_Money_Player"] = "Gold (Player):"
L["MainForm_Label_Money_Last"] = "Last Loot :"; L["MainForm_Label_Money_Last"] = "Last Loot:";
L["MainForm_Label_Money_Min"] = "Min."; L["MainForm_Label_Money_Min"] = "Min.";
L["MainForm_Label_LastBoE"] = "Last BOE:" L["MainForm_Label_LastBoE"] = "Last BOE:"
L["MainForm_Label_LastBoE_NONE"] = "n/a" L["MainForm_Label_LastBoE_NONE"] = "n/a"
L["MainForm_Label_Loot"] = "- LOOT -"; L["MainForm_Label_Loot"] = "- LOOT -";
L["MainForm_Button_LootList"] = "Loot List";
L["MainForm_Group_Features"] = "Fonctions";
L["MainForm_Group_Gold"] = "Or";
L["Alert_TradeGoods"] = "Trade Goods"; L["Alert_TradeGoods"] = "Trade Goods";

View File

@ -1,12 +1,11 @@
## Interface: 70300 ## Interface: 70300
## Title: |cff1784d1MxW|r ## Title: |cff1784d1MxW|r
## Version: 1.0.0_7.3.2 ## Version: 1.1.1b_7.3.5
## Author: mikx ## Author: mikx
## Notes: MxW Addon ## Notes: MxW Addon
## RequiredDeps: TradeSkillMaster, TradeSkillMaster_AuctionDB ## RequiredDeps: TradeSkillMaster, TradeSkillMaster_AuctionDB
## OptionalDeps: TradeSkillMaster_WoWuction, TheUndermineJournal ## OptionalDeps: TradeSkillMaster_WoWuction, TheUndermineJournal
## SavedVariables: MxWDB,Farmer_Logic_Day,Farmer_Logic_MinUI,Farmer_Logic_MinAlert,Farmer_Money_MonthGlobal,Farmer_Money_DayGlobal ## SavedVariables: MxWDB,CurrentGold,Farmer_Logic_Day,Farmer_Logic_MinUI,Farmer_Logic_MinAlert,Farmer_Money_MonthGlobal,Farmer_Money_DayGlobal
## SavedVariablesPerCharacter: Farmer_Logic_PlayerDay,Farmer_Money_MonthPlayer,Farmer_Money_DayPlayer
Libraries\Load_Libraries.xml Libraries\Load_Libraries.xml
Locale\Load_Locales.xml Locale\Load_Locales.xml

View File

@ -4,9 +4,9 @@
-- Licensed under the GNU General Public License 3.0 -- Licensed under the GNU General Public License 3.0
-- See included License file for more informations. -- See included License file for more informations.
local MxW, mx = ... local MX = LibStub("AceAddon-3.0"):NewAddon("MxW", "AceConsole-3.0", "AceEvent-3.0", "AceHook-3.0");
local MX = LibStub("AceAddon-3.0"):NewAddon(mx, MxW, "AceConsole-3.0", "AceEvent-3.0", "AceHook-3.0");
local L = LibStub("AceLocale-3.0"):GetLocale("MxW"); local L = LibStub("AceLocale-3.0"):GetLocale("MxW");
local AceGUI = LibStub("AceGUI-3.0")
local MXLDB = LibStub("LibDataBroker-1.1"):NewDataObject("MxW", { local MXLDB = LibStub("LibDataBroker-1.1"):NewDataObject("MxW", {
type = "data source", type = "data source",
@ -16,43 +16,52 @@ local MXLDB = LibStub("LibDataBroker-1.1"):NewDataObject("MxW", {
}) })
local icon = LibStub("LibDBIcon-1.0") local icon = LibStub("LibDBIcon-1.0")
local defaults = {
profile = {
debug = false,
version = 0,
minimapIcon = { hide = false, minimapPos = 220, radius = 80, },
mainUI = 0
}
}
function MX:OnInitialize() function MX:OnInitialize()
self.db = LibStub("AceDB-3.0"):New("MxWDB", { self.db = LibStub:GetLibrary("AceDB-3.0"):New("MxWDB")
profile = {
minimap = { -- Init Saved Variables
hide = false, if (Farmer_Logic_Day == nil) then
}, local weekday, month, day, year = CalendarGetDate();
}, Farmer_Logic_Day = day;
}) end
icon:Register("MxW", MXLDB, self.db.profile.minimap) if (Farmer_Money_DayGlobal == nil) then
Farmer_Money_DayGlobal = 0;
end
if (Farmer_Money_MonthGlobal == nil) then
Farmer_Money_MonthGlobal = 0;
end
if (Farmer_Logic_MinUI == nil) then
Farmer_Logic_MinUI = 3000;
end
if (Farmer_Logic_MinAlert == nil) then
Farmer_Logic_MinAlert = 3000;
end
if (self.db.profile.mainUI == nil) then
self.db.profile.mainUI = { ["height"] = 100, ["top"] = 50, ["left"] = 50, ["width"] = 300, }
end
if (self.db.profile.lootlistUI == nil) then
self.db.profile.lootlistUI = { ["height"] = 100, ["top"] = 50, ["left"] = 50, ["width"] = 300, }
end
-- Meta Data
local mxwVersion = GetAddOnMetadata("MxW", "Version")
self.db.profile.version = mxwVersion
-- Message
print("MxW v." .. self.db.profile.version .. L["Message_Loaded"]);
end end
-- Meta Data function MX:OnEnable()
local mxwVersion = GetAddOnMetadata("MxW", "Version") MX:ShowMainUI()
-- Init Saved Variables
if (Farmer_Logic_Day == nil) then
local weekday, month, day, year = CalendarGetDate();
Farmer_Logic_Day = day;
end end
if (Farmer_Money_DayGlobal == nil) then
Farmer_Money_DayGlobal = 0;
end
if (Farmer_Money_MonthGlobal == nil) then
Farmer_Money_MonthGlobal = 0;
end
if (Farmer_Money_DayPlayer == nil) then
Farmer_Money_DayPlayer = 0;
end
if (Farmer_Money_MonthPlayer == nil) then
Farmer_Money_MonthPlayer = 0;
end
if (Farmer_Logic_MinUI == nil) then
Farmer_Logic_MinUI = 3000;
end
if (Farmer_Logic_MinAlert == nil) then
Farmer_Logic_MinAlert = 3000;
end
-- Message
print("MxW v." .. mxwVersion .. L["Message_Loaded"]);