date (day) temp fix
This commit is contained in:
parent
7c83d6f8dc
commit
55d2c154b5
|
@ -17,11 +17,8 @@ PLAYER_MONEY_Frame:SetScript("OnEvent", function(self, event, ...)
|
||||||
|
|
||||||
if (DiffGold > 0) then -- Gold gain
|
if (DiffGold > 0) then -- Gold gain
|
||||||
|
|
||||||
local date = C_Calendar.GetDate()
|
local date = C_Calendar.GetDate();
|
||||||
local weekday = date.weekday
|
local weekday, month, day, year = date.weekday, date.month, date.monthDay, date.year;
|
||||||
local month = date.month
|
|
||||||
local day = date.monthDay
|
|
||||||
local year = date.year
|
|
||||||
|
|
||||||
-- Write to SavedVariables
|
-- Write to SavedVariables
|
||||||
Farmer_Money_MonthGlobal = Farmer_Money_MonthGlobal + DiffGold;
|
Farmer_Money_MonthGlobal = Farmer_Money_MonthGlobal + DiffGold;
|
||||||
|
|
|
@ -12,6 +12,9 @@ local GUI_LOOTCOLLECTED, GUI_SCROLLCONTAINER
|
||||||
local lootCollectedLastEntry = nil
|
local lootCollectedLastEntry = nil
|
||||||
local mxwVersion = GetAddOnMetadata("MxW", "Version")
|
local mxwVersion = GetAddOnMetadata("MxW", "Version")
|
||||||
|
|
||||||
|
local date = C_Calendar.GetDate();
|
||||||
|
local weekday, month, day, year = date.weekday, date.month, date.monthDay, date.year;
|
||||||
|
|
||||||
local backdrop = {
|
local backdrop = {
|
||||||
bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
|
bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
|
||||||
edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
|
edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
|
||||||
|
@ -28,25 +31,13 @@ local EditBoxMinAlert = AceGUI:Create("EditBox")
|
||||||
|
|
||||||
function MX:ShowMainUI()
|
function MX:ShowMainUI()
|
||||||
local MAIN_UI = AceGUI:Create("Window")
|
local MAIN_UI = AceGUI:Create("Window")
|
||||||
MAIN_UI:SetHeight(80)
|
MAIN_UI:SetHeight(30)
|
||||||
MAIN_UI:SetTitle("MxW " .. self.db.profile.version)
|
MAIN_UI:SetTitle("MxW " .. self.db.profile.version)
|
||||||
MAIN_UI:SetStatusTable(self.db.profile.mainUI)
|
MAIN_UI:SetStatusTable(self.db.profile.mainUI)
|
||||||
MAIN_UI:SetLayout("List")
|
MAIN_UI:SetLayout("List")
|
||||||
MAIN_UI:SetWidth(200)
|
MAIN_UI:SetWidth(200)
|
||||||
MAIN_UI:EnableResize(false)
|
MAIN_UI:EnableResize(false)
|
||||||
|
|
||||||
labDayCounter:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Homespun.ttf", 10)
|
|
||||||
labDayCounter:SetColor(1, 1, 1)
|
|
||||||
labDayCounter:SetFullWidth(true)
|
|
||||||
MAIN_UI:AddChild(labDayCounter)
|
|
||||||
|
|
||||||
local labSpaceA = AceGUI:Create("Label")
|
|
||||||
labSpaceA:SetFont("Fonts\\FRIZQT__.TTF", 10)
|
|
||||||
labSpaceA:SetColor(1, 1, 1)
|
|
||||||
labSpaceA:SetFullWidth(true)
|
|
||||||
labSpaceA:SetText(" ")
|
|
||||||
MAIN_UI:AddChild(labSpaceA)
|
|
||||||
|
|
||||||
labTodayGold:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Homespun.ttf", 10)
|
labTodayGold:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Homespun.ttf", 10)
|
||||||
labTodayGold:SetColor(1, 1, 1)
|
labTodayGold:SetColor(1, 1, 1)
|
||||||
labTodayGold:SetFullWidth(true)
|
labTodayGold:SetFullWidth(true)
|
||||||
|
@ -162,19 +153,14 @@ end)
|
||||||
local MainFrame_Event_PLAYER_ENTERING_WORLD = CreateFrame("Frame")
|
local MainFrame_Event_PLAYER_ENTERING_WORLD = CreateFrame("Frame")
|
||||||
MainFrame_Event_PLAYER_ENTERING_WORLD :RegisterEvent("PLAYER_ENTERING_WORLD")
|
MainFrame_Event_PLAYER_ENTERING_WORLD :RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
MainFrame_Event_PLAYER_ENTERING_WORLD :SetScript("OnEvent", function(self, event, ...)
|
MainFrame_Event_PLAYER_ENTERING_WORLD :SetScript("OnEvent", function(self, event, ...)
|
||||||
local date = C_Calendar.GetDate()
|
-- Init gold variable
|
||||||
local weekday = date.weekday
|
|
||||||
local month = date.month
|
|
||||||
local day = date.monthDay
|
|
||||||
local year = date.year
|
|
||||||
-- Init gold variable
|
|
||||||
CurrentGold = GetMoney()
|
CurrentGold = GetMoney()
|
||||||
-- Reset Global Daily Counter
|
-- Reset Global Daily Counter
|
||||||
if(DailyRecord == nil) then
|
if(DailyRecord == nil) then
|
||||||
DailyRecord = Farmer_Money_DayGlobal;
|
DailyRecord = Farmer_Money_DayGlobal;
|
||||||
DailyRecordFlag = false;
|
DailyRecordFlag = false;
|
||||||
end
|
end
|
||||||
if (Farmer_Logic_Day ~= day) then
|
if (day ~= 0 and Farmer_Logic_Day ~= day) then
|
||||||
if(DailyRecordFlag) then
|
if(DailyRecordFlag) then
|
||||||
DailyRecordFlag = false;
|
DailyRecordFlag = false;
|
||||||
end
|
end
|
||||||
|
@ -190,36 +176,22 @@ MainFrame_Event_PLAYER_ENTERING_WORLD :SetScript("OnEvent", function(self, event
|
||||||
DailyEighty = false;
|
DailyEighty = false;
|
||||||
DailyNinety = false;
|
DailyNinety = false;
|
||||||
DailyHundred = false;
|
DailyHundred = false;
|
||||||
DayCounter = DayCounter + 1;
|
|
||||||
end
|
|
||||||
if (DayCounter >= 31) then
|
|
||||||
Farmer_Money_MonthBack = Farmer_Money_MonthGlobal;
|
|
||||||
Farmer_Money_MonthGlobal = 0;
|
|
||||||
Farmer_Money_DayGlobal = 0;
|
|
||||||
DayCounter = 1;
|
|
||||||
DailyRecord = 1;
|
|
||||||
DailyRecordFlag = false;
|
|
||||||
DailyTen = false;
|
|
||||||
DailyTwenty = false;
|
|
||||||
DailyThirty = false;
|
|
||||||
DailyForty = false;
|
|
||||||
DailyFifty = false;
|
|
||||||
DailySixty = false;
|
|
||||||
DailySeventy = false;
|
|
||||||
DailyEighty = false;
|
|
||||||
DailyNinety = false;
|
|
||||||
DailyHundred = false;
|
|
||||||
end
|
end
|
||||||
MX:UpdateMainUI()
|
MX:UpdateMainUI()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
local MainFrame_Event_PLAYER_LEAVING_WORLD = CreateFrame("Frame")
|
||||||
|
MainFrame_Event_PLAYER_LEAVING_WORLD:RegisterEvent("PLAYER_LEAVING_WORLD")
|
||||||
|
MainFrame_Event_PLAYER_LEAVING_WORLD:SetScript("OnEvent", function(self, event, ...)
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
||||||
function MX:UpdateMainUI()
|
function MX:UpdateMainUI()
|
||||||
local DayColor = "|cff1ead01";
|
local DayColor = "|cff1ead01";
|
||||||
local GoldMedian = floor(Farmer_Money_MonthGlobal / DayCounter);
|
local GoldMedian = floor(Farmer_Money_MonthGlobal / DayCounter);
|
||||||
labTodayGold:SetText(format("%s (%s)", MX:FormatMoney(Farmer_Money_DayGlobal),L["MainForm_Label_Money_Lab_Today"]))
|
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"]))
|
labMonthGold:SetText(format("%s (%s)", MX:FormatMoney(Farmer_Money_MonthGlobal),L["MainForm_Label_Money_Lab_Month"]))
|
||||||
labDailyRecord:SetText(format("%s %s", MX:FormatMoneyGoldOnly(DailyRecord), L["Chat_ChatGuildDailyRecordUI"]))
|
labDailyRecord:SetText(format("%s %s", MX:FormatMoneyGoldOnly(DailyRecord), L["Chat_ChatGuildDailyRecordUI"]))
|
||||||
labDayCounter:SetText(format("%s %s%i/30|r (~%s/%s)", L["MainForm_Label_DayCounter"], DayColor, DayCounter, MX:FormatMoneyGoldOnly(GoldMedian),L["MainForm_Label_Money_Lab_Today"]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function MX:ShowMain()
|
function MX:ShowMain()
|
||||||
|
|
2
MxW.toc
2
MxW.toc
|
@ -1,6 +1,6 @@
|
||||||
## Interface: 80100
|
## Interface: 80100
|
||||||
## Title: |cff1784d1MxW|r
|
## Title: |cff1784d1MxW|r
|
||||||
## Version: 1.6.1_8.1.0
|
## Version: 1.7.0_8.1.5
|
||||||
## Author: mikx
|
## Author: mikx
|
||||||
## Notes: MxW Addon
|
## Notes: MxW Addon
|
||||||
## RequiredDeps: TradeSkillMaster
|
## RequiredDeps: TradeSkillMaster
|
||||||
|
|
7
init.lua
7
init.lua
|
@ -8,6 +8,9 @@ local MX = LibStub("AceAddon-3.0"):NewAddon("MxW", "AceConsole-3.0", "AceEvent-3
|
||||||
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 date = C_Calendar.GetDate();
|
||||||
|
local weekday, month, day, year = date.weekday, date.month, date.monthDay, date.year;
|
||||||
|
|
||||||
local MXLDB = LibStub("LibDataBroker-1.1"):NewDataObject("MxW", {
|
local MXLDB = LibStub("LibDataBroker-1.1"):NewDataObject("MxW", {
|
||||||
type = "data source",
|
type = "data source",
|
||||||
text = "MxW",
|
text = "MxW",
|
||||||
|
@ -27,7 +30,6 @@ local defaults = {
|
||||||
|
|
||||||
function MX:OnInitialize()
|
function MX:OnInitialize()
|
||||||
self.db = LibStub:GetLibrary("AceDB-3.0"):New("MxWDB")
|
self.db = LibStub:GetLibrary("AceDB-3.0"):New("MxWDB")
|
||||||
|
|
||||||
-- Init Saved Variables
|
-- Init Saved Variables
|
||||||
if (Farmer_Logic_Day == nil) then
|
if (Farmer_Logic_Day == nil) then
|
||||||
Farmer_Logic_Day = day;
|
Farmer_Logic_Day = day;
|
||||||
|
@ -136,6 +138,9 @@ local function MyAddonCommands(msg, editbox)
|
||||||
DailyRecordFlag = false;
|
DailyRecordFlag = false;
|
||||||
ReloadUI();
|
ReloadUI();
|
||||||
end
|
end
|
||||||
|
elseif (msg == 'resetd') then
|
||||||
|
Farmer_Money_DayGlobal = 0;
|
||||||
|
ReloadUI();
|
||||||
elseif (msg == 'alert') then
|
elseif (msg == 'alert') then
|
||||||
if (Settings_Alert_Enabled) then
|
if (Settings_Alert_Enabled) then
|
||||||
Settings_Alert_Enabled = false;
|
Settings_Alert_Enabled = false;
|
||||||
|
|
Loading…
Reference in New Issue