Alert Rework (2.1.0)

This commit is contained in:
mikx
2020-11-30 11:41:27 -05:00
parent c67d374828
commit 6111ec4c2d
11 changed files with 192 additions and 64 deletions

88
Frame/Frame_Alert.lua Normal file
View File

@@ -0,0 +1,88 @@
-- MxW (MxW Addon)
-- By mikx
-- https://git.mikx.xyz/mikx/MxW_Addon
-- Licensed under the GNU General Public License 3.0
-- See included License file for more informations.
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
local mxwVersion = GetAddOnMetadata("MxW", "Version")
local date = C_DateAndTime.GetCurrentCalendarTime();
local weekday, month, day, year = date.weekday, date.month, date.monthDay, date.year;
function MX:ShowAlert(item,stackqty,value,y)
local AlertUI = CreateFrame("Frame", string.format("%sAlert%d", "mxw", y), nil, "BackdropTemplate")
local AlertIcon = AlertUI:CreateTexture(nil,"ARTWORK")
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(item)
AlertUI:SetFrameStrata("BACKGROUND")
AlertUI:SetWidth(300)
AlertUI:SetHeight(80)
AlertUI:SetPoint("CENTER", 0, y)
AlertUI:SetBackdrop(
{
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Buttons/WHITE8x8",
tile = true, tileSize = 16, edgeSize = 1,
insets = { left = 2, right = 2, top = 2, bottom = 2 }
});
AlertUI:SetBackdropColor(0.20,0.20,0.20,1);
-- Label - Title
AlertUI.title = AlertUI:CreateFontString(nil, "ARTWORK");
AlertUI.title:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 12);
AlertUI.title:SetPoint("CENTER",35,30);
AlertUI.title:SetTextColor(1.00,0.49,0.04);
AlertUI.title:SetText(L["Alert_Frame_Title"]);
-- Label - Thresold
AlertUI.thresold = AlertUI:CreateFontString(nil, "ARTWORK");
AlertUI.thresold:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 10);
AlertUI.thresold:SetPoint("CENTER",35,17);
AlertUI.thresold:SetTextColor(1,1,1);
AlertUI.thresold:SetText(L["Alert_Frame_Thresold"]..MX:FormatMoneyGoldOnly(Farmer_Logic_MinAlert));
-- Label - ItemLink
AlertUI.itemlink = AlertUI:CreateFontString(nil, "ARTWORK");
AlertUI.itemlink:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 10);
AlertUI.itemlink:SetPoint("CENTER",35,0);
AlertUI.itemlink:SetTextColor(1,1,1);
AlertUI.itemlink:SetText(itemLink);
-- Label - Item Value
AlertUI.itemlink = AlertUI:CreateFontString(nil, "ARTWORK");
AlertUI.itemlink:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 10);
AlertUI.itemlink:SetPoint("CENTER",35,-11);
AlertUI.itemlink:SetTextColor(1,1,1);
AlertUI.itemlink:SetText(MX:FormatMoney(value));
-- Label - Item Stack
AlertUI.itemlink = AlertUI:CreateFontString(nil, "ARTWORK");
AlertUI.itemlink:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 10);
AlertUI.itemlink:SetPoint("CENTER",35,-22);
AlertUI.itemlink:SetTextColor(1,1,1);
AlertUI.itemlink:SetText(L["Alert_Frame_Stack"]..stackqty);
-- Label - Item Quantity
AlertUI.itemlink = AlertUI:CreateFontString(nil, "ARTWORK");
AlertUI.itemlink:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 10);
AlertUI.itemlink:SetPoint("CENTER",35,-32);
AlertUI.itemlink:SetTextColor(1,1,1);
local itemId = MX:ToItemID(itemLink);
local qty = MX.TSM:GetItemQuantity(itemId);
local fqty = qty + stackqty;
AlertUI.itemlink:SetText(L["Alert_Frame_Quantity"]..fqty);
AlertIcon:SetPoint("LEFT", 10, 0);
PlaySoundFile("Interface\\Addons\\MxW\\Media\\Sound\\register.mp3", "Master")
AlertIcon:SetTexture(itemTexture);
UIFrameFlash(AlertUI, 1, 10, 10, false, 12, 0);
end

View File

@@ -38,31 +38,38 @@ MainUI:SetBackdrop(
});
MainUI:SetBackdropColor(0.20,0.20,0.20,1);
-- Label - Title + version
-- Label - Titleersion
MainUI.title = MainUI:CreateFontString(nil, "ARTWORK");
MainUI.title:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 10);
MainUI.title:SetPoint("CENTER",0,27);
MainUI.title:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 14);
MainUI.title:SetPoint("CENTER",0,30);
MainUI.title:SetTextColor(1.00,0.49,0.04);
MainUI.title:SetText("MxW " .. mxwVersion);
MainUI.title:SetText("MxW");
-- Label - Version
MainUI.version = MainUI:CreateFontString(nil, "ARTWORK");
MainUI.version:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 8);
MainUI.version:SetPoint("CENTER",0,23);
MainUI.version:SetTextColor(1.00,0.49,0.04);
MainUI.version:SetText(mxwVersion);
-- Label - Daily
MainUI.daily = MainUI:CreateFontString(nil, "ARTWORK");
MainUI.daily:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 8);
MainUI.daily:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 11);
MainUI.daily:SetPoint("LEFT",4,10);
-- Label - Monthly
MainUI.monthly = MainUI:CreateFontString(nil, "ARTWORK");
MainUI.monthly:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 8);
MainUI.monthly:SetPoint("LEFT",4,2);
MainUI.monthly:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 11);
MainUI.monthly:SetPoint("LEFT",4,0);
-- Label - Record
MainUI.record = MainUI:CreateFontString(nil, "ARTWORK");
MainUI.record:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 8);
MainUI.record:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 11);
MainUI.record:SetPoint("LEFT",4,-13);
-- Label - Session Loot
MainUI.loot = MainUI:CreateFontString(nil, "ARTWORK");
MainUI.loot:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 8);
MainUI.loot:SetFont("Interface\\Addons\\MxW\\Media\\Font\\Consola.ttf", 11);
MainUI.loot:SetPoint("LEFT",4,-23);
-- Button - Config
@@ -137,8 +144,8 @@ MainUI:Show()
function MX:MainUIUpdate()
local DayColor = "|cff1ead01";
local GoldMedian = floor(Farmer_Money_MonthGlobal / DayCounter);
MainUI.daily:SetText(format("%s (%s)", MX:FormatMoney(Farmer_Money_DayGlobal),L["MainForm_Label_Money_Lab_Today"]))
MainUI.monthly:SetText(format("%s (%s)", MX:FormatMoney(Farmer_Money_MonthGlobal),L["MainForm_Label_Money_Lab_Month"]))
MainUI.daily:SetText(format("%s (%s)", MX:FormatMoneyGoldOnly(Farmer_Money_DayGlobal),L["MainForm_Label_Money_Lab_Today"]))
MainUI.monthly:SetText(format("%s (%s)", MX:FormatMoneyGoldOnly(Farmer_Money_MonthGlobal),L["MainForm_Label_Money_Lab_Month"]))
MainUI.record:SetText(format("%s %s", MX:FormatMoneyGoldOnly(DailyRecord), L["Chat_ChatGuildDailyRecordUI"]))
MainUI.loot:SetText(format("%s (Loot)", MX:FormatMoneyGoldOnly(Farmer_Money_LootSession)))
end

View File

@@ -1,3 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Frame_Main.lua"/>
<Script file="Frame_Alert.lua"/>
</Ui>