diff --git a/Event/LOOT_OPENED.lua b/Event/LOOT_OPENED.lua index 2cbbe54..86e9189 100644 --- a/Event/LOOT_OPENED.lua +++ b/Event/LOOT_OPENED.lua @@ -10,6 +10,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("MxW"); local numItems local iLink local value +local by = 300 local LOOT_OPENED_Frame = CreateFrame("Frame") LOOT_OPENED_Frame:RegisterEvent("LOOT_OPENED") @@ -22,59 +23,21 @@ LOOT_OPENED_Frame:SetScript("OnEvent", numItems = GetNumLootItems() -- loop each loot slot for i = 1, numItems do + -- get lootslotinfo to get item stack size + lootIcon, lootName, lootQuantity, currencyID, lootQuality, locked, isQuestItem, questID, isActive = GetLootSlotInfo(i) -- get loot slot link to get iteminfo, we can't use item name due to API limitation iLink = GetLootSlotLink(i) -- get the iteminfo and continue only if the itemlink is not empty (EXEMPLE: money in a slot = empty) if (iLink ~= nil) then - -- get the iteminfo using the slot itemlink - name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(iLink) + name, link, quality, iLevel, reqLevel, class, subclass, stack, equipSlot, texture, vendorPrice = GetItemInfo(iLink) -- get the item value using the link, return nil if the item has no value local itemId = MX:ToItemID(link); if (itemId ~= nil) then value = MX.TSM:GetItemValue(itemId, "DBMinBuyout"); end - -- MINIMUM QUALITY SETTINGS ------ - local eq = 2 -- equipable quality - local mq = 1 -- mats quality - local cq = 1 -- consumable quality - local oq = 1 -- other quality - local rq = 1 -- recipe quality - ---------------------------------- - -- if value is nil, the object is not BoE/not known by TSM & Looter is the player - -- we use locales because the item class is localized by the client - if (value ~= nil and Settings_Alert_Enabled) then - if(class == L["Alert_Class_Armor"]) then - if (value >= Farmer_Logic_MinAlert and quality >= eq) then - MX:SendAlert(link,value); - MX:ChatGuildLootMessage(link,value); - end - elseif(class == L["Alert_Class_Weapon"]) then - if (value >= Farmer_Logic_MinAlert and quality >= eq) then - MX:SendAlert(link,value); - MX:ChatGuildLootMessage(link,value); - end - elseif(class == L["Alert_Class_TradeGoods"]) then - if (value >= Farmer_Logic_MinAlert and quality >= mq) then - MX:SendAlert(link,value); - MX:ChatGuildLootMessage(link,value); - end - elseif(class == L["Alert_Class_Consumable"]) then - if (value >= Farmer_Logic_MinAlert and quality >= cq) then - MX:SendAlert(link,value); - MX:ChatGuildLootMessage(link,value); - end - elseif(class == L["Alert_Class_Misc"]) then - if (value >= Farmer_Logic_MinAlert and quality >= oq) then - MX:SendAlert(link,value); - MX:ChatGuildLootMessage(link,value); - end - elseif(class == "Recipe") then - if (value >= Farmer_Logic_MinAlert and quality >= rq) then - MX:SendAlert(link,value); - MX:ChatGuildLootMessage(link,value); - end - end + MX:SendAlert(iLink,lootQuantity,value,by) + by = by - 85 end if (value ~= nil) then Farmer_Money_LootSession = Farmer_Money_LootSession + value; @@ -82,8 +45,54 @@ LOOT_OPENED_Frame:SetScript("OnEvent", value = nil iLink = nil end - end + end + by = 300 + end + end) + +function MX:SendAlert(link,lootQuantity,value,y) + -- get the iteminfo using the slot itemlink + name, link, quality, iLevel, reqLevel, class, subclass, stack, equipSlot, texture, vendorPrice = GetItemInfo(link) + -- MINIMUM QUALITY SETTINGS ------ + local eq = 2 -- equipable quality + local mq = 1 -- mats quality + local cq = 1 -- consumable quality + local oq = 1 -- other quality + local rq = 1 -- recipe quality + ---------------------------------- + -- if value is nil, the object is not BoE/not known by TSM & Looter is the player + -- we use locales because the item class is localized by the client + if (value ~= nil and Settings_Alert_Enabled) then + if(class == L["Alert_Class_Armor"]) then + if (value >= Farmer_Logic_MinAlert and quality >= eq) then + MX:ShowAlert(link,lootQuantity,value,y); + MX:ChatGuildLootMessage(link,value); + end + elseif(class == L["Alert_Class_Weapon"]) then + if (value >= Farmer_Logic_MinAlert and quality >= eq) then + MX:ShowAlert(link,lootQuantity,value,y); + MX:ChatGuildLootMessage(link,value); + end + elseif(class == L["Alert_Class_TradeGoods"]) then + if (value >= Farmer_Logic_MinAlert and quality >= mq) then + MX:ShowAlert(link,lootQuantity,value,y); + MX:ChatGuildLootMessage(link,value); + end + elseif(class == L["Alert_Class_Consumable"]) then + if (value >= Farmer_Logic_MinAlert and quality >= cq) then + MX:ShowAlert(link,lootQuantity,value,y); + MX:ChatGuildLootMessage(link,value); + end + elseif(class == L["Alert_Class_Misc"]) then + if (value >= Farmer_Logic_MinAlert and quality >= oq) then + MX:ShowAlert(link,lootQuantity,value,y); + MX:ChatGuildLootMessage(link,value); + end + elseif(class == "Recipe") then + if (value >= Farmer_Logic_MinAlert and quality >= rq) then + MX:ShowAlert(link,lootQuantity,value,y); + MX:ChatGuildLootMessage(link,value); end end - -end) + end +end diff --git a/Frame/Frame_Alert.lua b/Frame/Frame_Alert.lua new file mode 100644 index 0000000..4b93721 --- /dev/null +++ b/Frame/Frame_Alert.lua @@ -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 diff --git a/Frame/Frame_Main.lua b/Frame/Frame_Main.lua index ed4c2b6..52f4a43 100644 --- a/Frame/Frame_Main.lua +++ b/Frame/Frame_Main.lua @@ -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 diff --git a/Frame/Load_Frames.xml b/Frame/Load_Frames.xml index 9718396..9823c7b 100644 --- a/Frame/Load_Frames.xml +++ b/Frame/Load_Frames.xml @@ -1,3 +1,4 @@