diff --git a/Event/ENCOUNTER_LOOT_RECEIVED.lua b/Event/ENCOUNTER_LOOT_RECEIVED.lua
index 834b3e6..dfd4e01 100644
--- a/Event/ENCOUNTER_LOOT_RECEIVED.lua
+++ b/Event/ENCOUNTER_LOOT_RECEIVED.lua
@@ -11,10 +11,11 @@ local ENCOUNTER_LOOT_RECEIVED_Frame = CreateFrame("Frame")
ENCOUNTER_LOOT_RECEIVED_Frame:RegisterEvent("ENCOUNTER_LOOT_RECEIVED")
ENCOUNTER_LOOT_RECEIVED_Frame:SetScript("OnEvent",
function(self, event, ...)
- local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 = ...
- name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(arg2)
- value = MX.TSM:GetItemValue(arg2, "DBMarket");
- if (value ~= nil and value >= Farmer_Logic_MinAlert and quality >= 1) then
- MX:SendAlert(arg2,value);
+ local encounterID, itemID, itemLink, quantity, playerName, className, arg7, arg8, arg9 = ...
+ name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(itemID)
+ value = MX.TSM:GetItemValue(itemID, "DBMarket");
+ local pn = UnitName("player");
+ if (value ~= nil and value >= Farmer_Logic_MinAlert and quality >= 1 and playerName == pn) then
+ MX:SendAlert(itemID,value);
end
end)
diff --git a/Event/PLAYER_MONEY.lua b/Event/PLAYER_MONEY.lua
index 682248b..78c0558 100644
--- a/Event/PLAYER_MONEY.lua
+++ b/Event/PLAYER_MONEY.lua
@@ -10,35 +10,32 @@ local L = LibStub("AceLocale-3.0"):GetLocale("MxW");
local PLAYER_MONEY_Frame = CreateFrame("Frame")
PLAYER_MONEY_Frame:RegisterEvent("PLAYER_MONEY")
PLAYER_MONEY_Frame:SetScript("OnEvent", function(self, event, ...)
- local tmpMoney = GetMoney()
- if self.CurrentMoney then
- self.DiffMoney = tmpMoney - self.CurrentMoney
- else
- self.DiffMoney = 0
- end
- self.CurrentMoney = tmpMoney
- if self.DiffMoney > 0 then
- -- Money Gain
- -- Reset daily counter if this is a new day
- local weekday, month, day, year = CalendarGetDate();
- -- Reset Global Daily Counter
- if (Farmer_Logic_Day ~= day) then
- Farmer_Money_DayGlobal = 0;
- MX:UpdateText()
- Farmer_Logic_Day = day;
- end
- -- Reset Player Daily Counter
- if (Farmer_Logic_PlayerDay ~= day) then
- Farmer_Money_DayPlayer = 0;
- MX:UpdateText()
- Farmer_Logic_PlayerDay = day;
- end
- -- Write to SavedVariables
- Farmer_Money_DayPlayer = Farmer_Money_DayPlayer + self.DiffMoney;
- Farmer_Money_MonthPlayer = Farmer_Money_MonthPlayer + self.DiffMoney;
- Farmer_Money_MonthGlobal = Farmer_Money_MonthGlobal + self.DiffMoney;
- Farmer_Money_DayGlobal = Farmer_Money_DayGlobal + self.DiffMoney;
- elseif self.DiffMoney < 0 then
- -- Money Lost
- end
+
+ local DiffGold = 0
+ local NewGold = GetMoney() -- Get the player gold after the event
+ DiffGold = NewGold - CurrentGold -- Get the gold difference
+
+ if (DiffGold > 0) then -- Gold gain
+
+ local weekday, month, day, year = CalendarGetDate();
+ -- Reset Global Daily Counter
+ if (Farmer_Logic_Day ~= day) then
+ Farmer_Money_DayGlobal = 0;
+ MX:UpdateMainUI()
+ Farmer_Logic_Day = day;
+ end
+
+ -- Write to SavedVariables
+ Farmer_Money_MonthGlobal = Farmer_Money_MonthGlobal + DiffGold;
+ Farmer_Money_DayGlobal = Farmer_Money_DayGlobal + DiffGold;
+
+ MX:UpdateMainUI()
+
+ elseif (DiffGold <= 0) then -- Gold lost
+
+ end
+
+ CurrentGold = GetMoney()
+ DiffGold = 0
+
end)
diff --git a/Frame/MainFrame.lua b/Frame/MainFrame.lua
index 0a9f26d..b690a2f 100644
--- a/Frame/MainFrame.lua
+++ b/Frame/MainFrame.lua
@@ -8,183 +8,97 @@
local MX = LibStub("AceAddon-3.0"):GetAddon("MxW");
local L = LibStub("AceLocale-3.0"):GetLocale("MxW");
local AceGUI = LibStub("AceGUI-3.0")
-
local GUI_LOOTCOLLECTED, GUI_SCROLLCONTAINER
local lootCollectedLastEntry = nil
---
-
--- main frame
-local f = CreateFrame("Frame","FarmerMainFrame", UIParent)
-
local mxwVersion = GetAddOnMetadata("MxW", "Version")
-local mainFrameWidth = 350;
- -- make it draggable with the mouse
-f:SetMovable(true)
-f:EnableMouse(true)
-f:SetScript("OnMouseDown", function(self, button)
- if button == "LeftButton" and not self.isMoving then
- 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)
+local backdrop = {
+ bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
+ edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
+ edgeSize = 2,
+ insets = { left = 1, right = 1, top = 1, bottom = 1 }
+ }
-f:SetFrameStrata("BACKGROUND") --Set its strata
-f:SetHeight(100) --Give it height
-f:SetWidth(mainFrameWidth) --and width
+local labTodayGold = AceGUI:Create("Label")
+local labMonthGold = AceGUI:Create("Label")
-f:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", --Set the background and border textures
- edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
- tile = true, tileSize = 16, edgeSize = 10,
- insets = { left = 4, right = 4, top = 4, bottom = 4 }
-})
-f:SetBackdropColor(0, 0, 0) --Set the background colour to black
-f:SetPoint("CENTER") --Put it in the centre of the parent frame (UIParent)
+function MX:ShowMainUI()
+ local MAIN_UI = AceGUI:Create("Window")
+ MAIN_UI:SetHeight(100)
+ MAIN_UI:SetTitle("MxW " .. self.db.profile.version)
+ MAIN_UI:SetStatusTable(self.db.profile.mainUI)
+ MAIN_UI:SetLayout("List")
+ MAIN_UI:SetWidth(300)
+ MAIN_UI:EnableResize(false)
-f.txtLogo = f:CreateFontString(nil, "ARTWORK") --Create a FontString to display text
-f.txtLogo:SetFont("Fonts\\FRIZQT__.TTF", 14) --Set the font and size
-f.txtLogo:SetTextColor(1, 1, 1) --Set the text colour
-f.txtLogo:SetPoint("TOP", 0, -5) --Put it in the centre of the frame
-f.txtLogo:SetText("MxW") --Change the displayed text
+ labTodayGold:SetFont("Fonts\\FRIZQT__.TTF", 10)
+ labTodayGold:SetColor(1, 1, 1)
+ labTodayGold:SetFullWidth(true)
+ MAIN_UI:AddChild(labTodayGold)
-f.txtVersion = f:CreateFontString(nil, "ARTWORK") --Create a FontString to display text
-f.txtVersion:SetFont("Fonts\\FRIZQT__.TTF", 9) --Set the font and size
-f.txtVersion:SetTextColor(1, 1, 1) --Set the text colour
-f.txtVersion:SetPoint("TOP", -(mainFrameWidth/2) + (#mxwVersion*3.0), -5) --Put it in the centre of the frame
-f.txtVersion:SetText(mxwVersion) --Change the displayed text
+ labMonthGold:SetFont("Fonts\\FRIZQT__.TTF", 10)
+ labMonthGold:SetColor(1, 1, 1)
+ labMonthGold:SetFullWidth(true)
+ MAIN_UI:AddChild(labMonthGold)
- local button = CreateFrame("Button", nil, f)
- button:SetPoint("TOP", f, "TOP", (mainFrameWidth/2) - #L["MainForm_Label_Close"]*6.0, -5)
- button:SetWidth(#L["MainForm_Label_Close"]*10.5)
- button:SetHeight(17)
+ local labSpace = AceGUI:Create("Label")
+ labSpace:SetFont("Fonts\\FRIZQT__.TTF", 10)
+ labSpace:SetColor(1, 1, 1)
+ labSpace:SetFullWidth(true)
+ labSpace:SetText(" ")
+ MAIN_UI:AddChild(labSpace)
- button:SetText(L["MainForm_Label_Close"])
- button:SetNormalFontObject("GameFontNormal")
+ local BUTTON_LOOTLIST = AceGUI:Create("Button")
+ 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()
- ntex:SetTexture("Interface/Buttons/UI-Panel-Button-Up")
- ntex:SetTexCoord(0, 0.625, 0, 0.6875)
- ntex:SetAllPoints()
- button:SetNormalTexture(ntex)
+function MX:ShowListUI()
+ local LOOTLIST_UI = AceGUI:Create("Window")
+ LOOTLIST_UI:SetHeight(100)
+ LOOTLIST_UI:SetTitle(L["MainForm_Button_LootList"])
+ LOOTLIST_UI:SetStatusTable(self.db.profile.lootlistUI)
+ LOOTLIST_UI:SetLayout("List")
+ LOOTLIST_UI:SetWidth(300)
- local htex = button:CreateTexture()
- htex:SetTexture("Interface/Buttons/UI-Panel-Button-Highlight")
- htex:SetTexCoord(0, 0.625, 0, 0.6875)
- htex:SetAllPoints()
- button:SetHighlightTexture(htex)
+ 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)
- local ptex = button:CreateTexture()
- ptex:SetTexture("Interface/Buttons/UI-Panel-Button-Down")
- ptex:SetTexCoord(0, 0.625, 0, 0.6875)
- ptex:SetAllPoints()
- button:SetPushedTexture(ptex)
-
- 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)
+ GUI_LOOTCOLLECTED = AceGUI:Create("ScrollFrame")
+ GUI_LOOTCOLLECTED:SetLayout("Flow")
+ LOOTLIST_UI:AddChild(GUI_SCROLLCONTAINER)
+ GUI_SCROLLCONTAINER:AddChild(GUI_LOOTCOLLECTED)
+end
local MainFrame_Event_ADDON_LOADED = CreateFrame("Frame")
MainFrame_Event_ADDON_LOADED:RegisterEvent("ADDON_LOADED")
MainFrame_Event_ADDON_LOADED:SetScript("OnEvent", function(self, event, ...)
- MX:UpdateText()
+
end)
-local MainFrame_Event_PLAYER_MONEY = CreateFrame("Frame")
-MainFrame_Event_PLAYER_MONEY:RegisterEvent("PLAYER_MONEY")
-MainFrame_Event_PLAYER_MONEY:SetScript("OnEvent", function(self, event, ...)
- MX:UpdateText()
+local MainFrame_Event_PLAYER_ENTERING_WORLD = CreateFrame("Frame")
+MainFrame_Event_PLAYER_ENTERING_WORLD :RegisterEvent("PLAYER_ENTERING_WORLD")
+MainFrame_Event_PLAYER_ENTERING_WORLD :SetScript("OnEvent", function(self, event, ...)
+ -- Init gold variable
+ CurrentGold = GetMoney()
+ MX:UpdateMainUI()
end)
-local MainFrame_Event_ENCOUNTER_LOOT_RECEIVED = CreateFrame("Frame")
-MainFrame_Event_ENCOUNTER_LOOT_RECEIVED:RegisterEvent("ENCOUNTER_LOOT_RECEIVED")
-MainFrame_Event_ENCOUNTER_LOOT_RECEIVED:SetScript("OnEvent", function(self, event, ...)
- 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
+function MX:UpdateMainUI()
+ labTodayGold:SetText(format("%s (%s)", MX:FormatMoney(Farmer_Money_DayGlobal),L["MainForm_Label_Money_Lab_Today"]))
+ labMonthGold:SetText(format("%s (%s)", MX:FormatMoney(Farmer_Money_MonthGlobal),L["MainForm_Label_Money_Lab_Month"]))
end
function MX:ShowMain()
diff --git a/Function/Alert.lua b/Function/Alert.lua
index f457fc7..a1cbf8b 100644
--- a/Function/Alert.lua
+++ b/Function/Alert.lua
@@ -6,7 +6,6 @@
local MX = LibStub("AceAddon-3.0"):GetAddon("MxW");
local L = LibStub("AceLocale-3.0"):GetLocale("MxW");
-print("Alert.lua has been loaded.");
-- Alert Cooking
-- Based on [[ AchievementAlertFrame ]] from Blizzard
diff --git a/Function/Load_Functions.xml b/Function/Load_Functions.xml
index d41a6c7..a1cafe8 100644
--- a/Function/Load_Functions.xml
+++ b/Function/Load_Functions.xml
@@ -3,6 +3,5 @@
-
diff --git a/Locale/frFR.lua b/Locale/frFR.lua
index bd6e466..caf5447 100644
--- a/Locale/frFR.lua
+++ b/Locale/frFR.lua
@@ -21,12 +21,15 @@ L["MainForm_Label_Close"] = "FERMER";
L["MainForm_Label_Money_Lab_Today"] = "Auj.";
L["MainForm_Label_Money_Lab_Month"] = "Mois";
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_Min"] = "Min.";
L["MainForm_Label_LastBoE"] = "Dernier BOE :"
L["MainForm_Label_LastBoE_NONE"] = "n/d"
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
L["Alert_Class_Consumable"] = "Consommable";
diff --git a/Locale/usEN.lua b/Locale/usEN.lua
index 415b6d4..794cb75 100644
--- a/Locale/usEN.lua
+++ b/Locale/usEN.lua
@@ -22,10 +22,13 @@ L["MainForm_Label_Money_Lab_Today"] = "Today";
L["MainForm_Label_Money_Lab_Month"] = "Month";
L["MainForm_Label_Money_Global"] = "Gold (Global):"
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_LastBoE"] = "Last BOE:"
L["MainForm_Label_LastBoE_NONE"] = "n/a"
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";
diff --git a/MxW.toc b/MxW.toc
index 5b9cb12..54e3beb 100644
--- a/MxW.toc
+++ b/MxW.toc
@@ -1,12 +1,11 @@
## Interface: 70300
## Title: |cff1784d1MxW|r
-## Version: 1.0.0_7.3.2
+## Version: 1.1.1b_7.3.5
## Author: mikx
## Notes: MxW Addon
## RequiredDeps: TradeSkillMaster, TradeSkillMaster_AuctionDB
## OptionalDeps: TradeSkillMaster_WoWuction, TheUndermineJournal
-## SavedVariables: MxWDB,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
+## SavedVariables: MxWDB,CurrentGold,Farmer_Logic_Day,Farmer_Logic_MinUI,Farmer_Logic_MinAlert,Farmer_Money_MonthGlobal,Farmer_Money_DayGlobal
Libraries\Load_Libraries.xml
Locale\Load_Locales.xml
diff --git a/init.lua b/init.lua
index fbf1b2d..a115f83 100644
--- a/init.lua
+++ b/init.lua
@@ -4,9 +4,9 @@
-- Licensed under the GNU General Public License 3.0
-- See included License file for more informations.
-local MxW, mx = ...
-local MX = LibStub("AceAddon-3.0"):NewAddon(mx, MxW, "AceConsole-3.0", "AceEvent-3.0", "AceHook-3.0");
+local MX = LibStub("AceAddon-3.0"):NewAddon("MxW", "AceConsole-3.0", "AceEvent-3.0", "AceHook-3.0");
local L = LibStub("AceLocale-3.0"):GetLocale("MxW");
+local AceGUI = LibStub("AceGUI-3.0")
local MXLDB = LibStub("LibDataBroker-1.1"):NewDataObject("MxW", {
type = "data source",
@@ -16,43 +16,52 @@ local MXLDB = LibStub("LibDataBroker-1.1"):NewDataObject("MxW", {
})
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()
- self.db = LibStub("AceDB-3.0"):New("MxWDB", {
- profile = {
- minimap = {
- hide = false,
- },
- },
- })
- icon:Register("MxW", MXLDB, self.db.profile.minimap)
+ self.db = LibStub:GetLibrary("AceDB-3.0"):New("MxWDB")
+
+ -- Init Saved Variables
+ if (Farmer_Logic_Day == nil) then
+ local weekday, month, day, year = CalendarGetDate();
+ Farmer_Logic_Day = day;
+ 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_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
--- Meta Data
-local mxwVersion = GetAddOnMetadata("MxW", "Version")
-
--- Init Saved Variables
-if (Farmer_Logic_Day == nil) then
- local weekday, month, day, year = CalendarGetDate();
- Farmer_Logic_Day = day;
+function MX:OnEnable()
+ MX:ShowMainUI()
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"]);