mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
load Loot and LootRoll modules
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
||||
<Include file="NamePlates\Load_NamePlates.xml"/>
|
||||
<Include file="Auras\Load_Auras.xml"/>
|
||||
<Include file="Blizzard\Load_Blizzard.xml"/>
|
||||
<Include file="Tooltip\Load_Tooltip.xml"/>
|
||||
<Include file="DataTexts\Load_DataTexts.xml"/>
|
||||
<Include file="ActionBars\Load_ActionBars.xml"/>
|
||||
|
||||
@@ -2,4 +2,6 @@
|
||||
<Script file="Misc.lua"/>
|
||||
<Script file="AFK.lua"/>
|
||||
<Script file="ChatBubbles.lua"/>
|
||||
<Script file="Loot.lua"/>
|
||||
<Script file="LootRoll.lua"/>
|
||||
</Ui>
|
||||
@@ -0,0 +1,327 @@
|
||||
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local M = E:GetModule("Misc");
|
||||
|
||||
--Cache global variables
|
||||
--Lua functions
|
||||
local max = math.max
|
||||
local tinsert = table.insert
|
||||
local unpack, pairs = unpack, pairs
|
||||
--WoW API / Variables
|
||||
local CloseLoot = CloseLoot
|
||||
local CursorOnUpdate = CursorOnUpdate
|
||||
local CursorUpdate = CursorUpdate
|
||||
local GetCVar = GetCVar
|
||||
local GetCursorPosition = GetCursorPosition
|
||||
local GetLootSlotInfo = GetLootSlotInfo
|
||||
local GetLootSlotLink = GetLootSlotLink
|
||||
local GetNumLootItems = GetNumLootItems
|
||||
local GiveMasterLoot = GiveMasterLoot
|
||||
local IsFishingLoot = IsFishingLoot
|
||||
local LootSlot = LootSlot
|
||||
local LootSlotIsCoin = LootSlotIsCoin
|
||||
local LootSlotIsItem = LootSlotIsItem
|
||||
local ResetCursor = ResetCursor
|
||||
local UnitIsDead = UnitIsDead
|
||||
local UnitIsFriend = UnitIsFriend
|
||||
local UnitName = UnitName
|
||||
local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS
|
||||
local LOOT = LOOT
|
||||
|
||||
-- Credit Haste
|
||||
local lootFrame, lootFrameHolder
|
||||
local iconSize = 30
|
||||
|
||||
local sq, ss, sn
|
||||
local OnEnter = function()
|
||||
local slot = this:GetID()
|
||||
if(LootSlotIsItem(slot)) then
|
||||
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
|
||||
GameTooltip:SetLootItem(slot)
|
||||
CursorUpdate(this)
|
||||
end
|
||||
|
||||
this.drop:Show()
|
||||
this.drop:SetVertexColor(1, 1, 0)
|
||||
end
|
||||
|
||||
local OnLeave = function()
|
||||
if this.quality and (this.quality > 1) then
|
||||
local color = ITEM_QUALITY_COLORS[this.quality]
|
||||
this.drop:SetVertexColor(color.r, color.g, color.b)
|
||||
else
|
||||
this.drop:Hide()
|
||||
end
|
||||
|
||||
GameTooltip:Hide()
|
||||
ResetCursor()
|
||||
end
|
||||
|
||||
local OnClick = function()
|
||||
LootFrame.selectedQuality = this.quality
|
||||
LootFrame.selectedItemName = this.name:GetText()
|
||||
LootFrame.selectedSlot = this:GetID()
|
||||
LootFrame.selectedLootButton = this:GetName()
|
||||
|
||||
StaticPopup_Hide("CONFIRM_LOOT_DISTRIBUTION")
|
||||
ss = this:GetID()
|
||||
sq = this.quality
|
||||
sn = this.name:GetText()
|
||||
LootSlot(ss)
|
||||
end
|
||||
|
||||
local OnShow = function()
|
||||
if(GameTooltip:IsOwned(this)) then
|
||||
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
|
||||
GameTooltip:SetLootItem(this:GetID())
|
||||
CursorOnUpdate(this)
|
||||
end
|
||||
end
|
||||
|
||||
local function anchorSlots(self)
|
||||
local shownSlots = 0
|
||||
for i = 1, getn(self.slots) do
|
||||
local frame = self.slots[i]
|
||||
if(frame:IsShown()) then
|
||||
shownSlots = shownSlots + 1
|
||||
|
||||
frame:SetPoint("TOP", lootFrame, 4, (-8 + iconSize) - (shownSlots * iconSize))
|
||||
end
|
||||
end
|
||||
|
||||
self:SetHeight(max(shownSlots * iconSize + 16, 20))
|
||||
end
|
||||
|
||||
local function createSlot(id)
|
||||
local frame = CreateFrame("Button", "ElvLootSlot"..id, lootFrame)
|
||||
frame:SetPoint("LEFT", 8, 0)
|
||||
frame:SetPoint("RIGHT", -8, 0)
|
||||
frame:SetHeight(iconSize - 2)
|
||||
frame:SetID(id)
|
||||
|
||||
frame:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
||||
|
||||
frame:SetScript("OnEnter", OnEnter)
|
||||
frame:SetScript("OnLeave", OnLeave)
|
||||
frame:SetScript("OnClick", OnClick)
|
||||
frame:SetScript("OnShow", OnShow)
|
||||
|
||||
local iconFrame = CreateFrame("Frame", nil, frame)
|
||||
iconFrame:SetWidth(iconSize - 2)
|
||||
iconFrame:SetHeight(iconSize - 2)
|
||||
iconFrame:SetPoint("RIGHT", frame)
|
||||
E:SetTemplate(iconFrame, "Default")
|
||||
frame.iconFrame = iconFrame
|
||||
E["frames"][iconFrame] = nil
|
||||
|
||||
local icon = iconFrame:CreateTexture(nil, "ARTWORK")
|
||||
icon:SetTexCoord(unpack(E.TexCoords))
|
||||
E:SetInside(icon)
|
||||
frame.icon = icon
|
||||
|
||||
local count = iconFrame:CreateFontString(nil, "OVERLAY")
|
||||
count:SetJustifyH("RIGHT")
|
||||
count:SetPoint("BOTTOMRIGHT", iconFrame, -2, 2)
|
||||
E:FontTemplate(count, nil, nil, "OUTLINE")
|
||||
count:SetText(1)
|
||||
frame.count = count
|
||||
|
||||
local name = frame:CreateFontString(nil, "OVERLAY")
|
||||
name:SetJustifyH("LEFT")
|
||||
name:SetPoint("LEFT", frame)
|
||||
name:SetPoint("RIGHT", icon, "LEFT")
|
||||
name:SetNonSpaceWrap(true)
|
||||
E:FontTemplate(name, nil, nil, "OUTLINE")
|
||||
frame.name = name
|
||||
|
||||
local drop = frame:CreateTexture(nil, "ARTWORK")
|
||||
drop:SetTexture("Interface\\QuestFrame\\UI-QuestLogTitleHighlight")
|
||||
drop:SetPoint("LEFT", icon, "RIGHT", 0, 0)
|
||||
drop:SetPoint("RIGHT", frame)
|
||||
drop:SetAllPoints(frame)
|
||||
drop:SetAlpha(.3)
|
||||
frame.drop = drop
|
||||
|
||||
lootFrame.slots[id] = frame
|
||||
return frame
|
||||
end
|
||||
|
||||
function M:LOOT_SLOT_CLEARED(_, slot)
|
||||
if(not lootFrame:IsShown()) then return end
|
||||
|
||||
lootFrame.slots[slot]:Hide()
|
||||
anchorSlots(lootFrame)
|
||||
end
|
||||
|
||||
function M:LOOT_CLOSED()
|
||||
StaticPopup_Hide("LOOT_BIND")
|
||||
lootFrame:Hide()
|
||||
|
||||
for _, v in pairs(lootFrame.slots) do
|
||||
v:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
function M:OPEN_MASTER_LOOT_LIST()
|
||||
ToggleDropDownMenu(1, nil, GroupLootDropDown, lootFrame.slots[ss], 0, 0)
|
||||
end
|
||||
|
||||
function M:UPDATE_MASTER_LOOT_LIST()
|
||||
UIDropDownMenu_Refresh(GroupLootDropDown)
|
||||
end
|
||||
|
||||
function M:LOOT_OPENED(_, autoLoot)
|
||||
lootFrame:Show()
|
||||
|
||||
if(not lootFrame:IsShown()) then
|
||||
CloseLoot(autoLoot == 0)
|
||||
end
|
||||
|
||||
local items = GetNumLootItems()
|
||||
|
||||
if(IsFishingLoot()) then
|
||||
lootFrame.title:SetText(L["Fishy Loot"])
|
||||
elseif(not UnitIsFriend("player", "target") and UnitIsDead("target")) then
|
||||
lootFrame.title:SetText(UnitName("target"))
|
||||
else
|
||||
lootFrame.title:SetText(LOOT)
|
||||
end
|
||||
|
||||
-- Blizzard uses strings here
|
||||
if E.private.general.lootUnderMouse then
|
||||
local x, y = GetCursorPosition()
|
||||
x = x / lootFrame:GetEffectiveScale()
|
||||
y = y / lootFrame:GetEffectiveScale()
|
||||
|
||||
lootFrame:ClearAllPoints()
|
||||
lootFrame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", x - 40, y + 20)
|
||||
lootFrame:GetCenter()
|
||||
lootFrame:Raise()
|
||||
else
|
||||
lootFrame:ClearAllPoints()
|
||||
lootFrame:SetPoint("TOPLEFT", lootFrameHolder, "TOPLEFT")
|
||||
end
|
||||
|
||||
local m, w, t = 0, 0, lootFrame.title:GetStringWidth()
|
||||
if(items > 0) then
|
||||
for i = 1, items do
|
||||
local slot = lootFrame.slots[i] or createSlot(i)
|
||||
local texture, item, quantity, quality = GetLootSlotInfo(i)
|
||||
local color = ITEM_QUALITY_COLORS[quality]
|
||||
|
||||
if(LootSlotIsCoin(i)) then
|
||||
item = item:gsub("\n", ", ")
|
||||
end
|
||||
|
||||
if quantity and (quantity > 1) then
|
||||
slot.count:SetText(quantity)
|
||||
slot.count:Show()
|
||||
else
|
||||
slot.count:Hide()
|
||||
end
|
||||
|
||||
if quality and (quality > 1) then
|
||||
slot.drop:SetVertexColor(color.r, color.g, color.b)
|
||||
slot.drop:Show()
|
||||
else
|
||||
slot.drop:Hide()
|
||||
end
|
||||
|
||||
slot.quality = quality
|
||||
slot.name:SetText(item)
|
||||
if color then
|
||||
slot.name:SetTextColor(color.r, color.g, color.b)
|
||||
end
|
||||
slot.icon:SetTexture(texture)
|
||||
|
||||
if quality then
|
||||
m = max(m, quality)
|
||||
end
|
||||
w = max(w, slot.name:GetStringWidth())
|
||||
|
||||
slot:Enable()
|
||||
slot:Show()
|
||||
end
|
||||
else
|
||||
local slot = lootFrame.slots[1] or createSlot(1)
|
||||
local color = ITEM_QUALITY_COLORS[0]
|
||||
|
||||
slot.name:SetText(L["Empty Slot"])
|
||||
if color then
|
||||
slot.name:SetTextColor(color.r, color.g, color.b)
|
||||
end
|
||||
slot.icon:SetTexture[[Interface\Icons\INV_Misc_Herb_AncientLichen]]
|
||||
|
||||
items = 1
|
||||
w = max(w, slot.name:GetStringWidth())
|
||||
|
||||
slot.count:Hide()
|
||||
slot.drop:Hide()
|
||||
slot:Disable()
|
||||
slot:Show()
|
||||
end
|
||||
anchorSlots(lootFrame)
|
||||
|
||||
w = w + 60
|
||||
t = t + 5
|
||||
|
||||
local color = ITEM_QUALITY_COLORS[m]
|
||||
lootFrame:SetBackdropBorderColor(color.r, color.g, color.b, .8)
|
||||
lootFrame:SetWidth(max(w, t))
|
||||
end
|
||||
|
||||
function M:LoadLoot()
|
||||
if not E.private.general.loot then return end
|
||||
|
||||
lootFrameHolder = CreateFrame("Frame", "ElvLootFrameHolder", E.UIParent)
|
||||
lootFrameHolder:SetPoint("TOPLEFT", 36, -195)
|
||||
lootFrameHolder:SetWidth(150)
|
||||
lootFrameHolder:SetHeight(22)
|
||||
|
||||
lootFrame = CreateFrame("Button", "ElvLootFrame", lootFrameHolder)
|
||||
lootFrame:SetClampedToScreen(true)
|
||||
lootFrame:SetPoint("TOPLEFT", 0, 0)
|
||||
lootFrame:SetWidth(256)
|
||||
lootFrame:SetHeight(64)
|
||||
E:SetTemplate(lootFrame, "Transparent")
|
||||
lootFrame:SetFrameStrata("FULLSCREEN")
|
||||
lootFrame:SetToplevel(true)
|
||||
lootFrame.title = lootFrame:CreateFontString(nil, "OVERLAY")
|
||||
E:FontTemplate(lootFrame.title, nil, nil, "OUTLINE")
|
||||
lootFrame.title:SetPoint("BOTTOMLEFT", lootFrame, "TOPLEFT", 0, 1)
|
||||
lootFrame.slots = {}
|
||||
lootFrame:SetScript("OnHide", function()
|
||||
StaticPopup_Hide("CONFIRM_LOOT_DISTRIBUTION")
|
||||
CloseLoot()
|
||||
end)
|
||||
E["frames"][lootFrame] = nil
|
||||
|
||||
self:RegisterEvent("LOOT_OPENED")
|
||||
self:RegisterEvent("LOOT_SLOT_CLEARED")
|
||||
self:RegisterEvent("LOOT_CLOSED")
|
||||
self:RegisterEvent("OPEN_MASTER_LOOT_LIST")
|
||||
self:RegisterEvent("UPDATE_MASTER_LOOT_LIST")
|
||||
|
||||
E:CreateMover(lootFrameHolder, "LootFrameMover", L["Loot Frame"])
|
||||
|
||||
-- Fuzz
|
||||
LootFrame:UnregisterAllEvents()
|
||||
ElvLootFrame:Hide() -- May need another fix. Frame shows without.
|
||||
tinsert(UISpecialFrames, "ElvLootFrame")
|
||||
|
||||
function _G.GroupLootDropDown_GiveLoot()
|
||||
if(sq >= MASTER_LOOT_THREHOLD) then
|
||||
local dialog = StaticPopup_Show("CONFIRM_LOOT_DISTRIBUTION", ITEM_QUALITY_COLORS[sq].hex..sn..FONT_COLOR_CODE_CLOSE, this:GetText())
|
||||
if (dialog) then
|
||||
dialog.data = this.value
|
||||
end
|
||||
else
|
||||
GiveMasterLoot(ss, this.value)
|
||||
end
|
||||
CloseDropDownMenus()
|
||||
end
|
||||
|
||||
E.PopupDialogs["CONFIRM_LOOT_DISTRIBUTION"].OnAccept = function(data)
|
||||
GiveMasterLoot(ss, data)
|
||||
end
|
||||
StaticPopupDialogs["CONFIRM_LOOT_DISTRIBUTION"].preferredIndex = 3
|
||||
end
|
||||
@@ -0,0 +1,323 @@
|
||||
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local M = E:GetModule("Misc");
|
||||
|
||||
--Cache global variables
|
||||
--Lua functions
|
||||
local find = string.find
|
||||
local pairs, unpack, ipairs, next, tonumber = pairs, unpack, ipairs, next, tonumber
|
||||
local tinsert = table.insert
|
||||
--WoW API / Variables
|
||||
local CursorOnUpdate = CursorOnUpdate
|
||||
local DressUpItemLink = DressUpItemLink
|
||||
local GetLootRollItemInfo = GetLootRollItemInfo
|
||||
local GetLootRollItemLink = GetLootRollItemLink
|
||||
local GetLootRollTimeLeft = GetLootRollTimeLeft
|
||||
local IsModifiedClick = IsModifiedClick
|
||||
local IsShiftKeyDown = IsShiftKeyDown
|
||||
local ResetCursor = ResetCursor
|
||||
local RollOnLoot = RollOnLoot
|
||||
local ShowInspectCursor = ShowInspectCursor
|
||||
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS
|
||||
local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS
|
||||
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
|
||||
|
||||
local pos = "TOP"
|
||||
local cancelled_rolls = {}
|
||||
local FRAME_WIDTH, FRAME_HEIGHT = 328, 28
|
||||
M.RollBars = {}
|
||||
|
||||
local locale = GetLocale()
|
||||
local rollpairs = locale == "deDE" and {
|
||||
["(.*) würfelt nicht für: (.+|r)$"] = "pass",
|
||||
["(.*) hat für (.+) 'Gier' ausgewählt"] = "greed",
|
||||
["(.*) hat für (.+) 'Bedarf' ausgewählt"] = "need",
|
||||
} or locale == "frFR" and {
|
||||
["(.*) a passé pour : (.+)"] = "pass",
|
||||
["(.*) a choisi Cupidité pour : (.+)"] = "greed",
|
||||
["(.*) a choisi Besoin pour : (.+)"] = "need",
|
||||
} or locale == "zhTW" and {
|
||||
["(.*)放棄了:(.+)"] = "pass",
|
||||
["(.*)選擇了貪婪:(.+)"] = "greed",
|
||||
["(.*)選擇了需求:(.+)"] = "need",
|
||||
} or locale == "ruRU" and {
|
||||
["(.*) отказывается от предмета (.+)%."] = "pass",
|
||||
["Разыгрывается: (.+)%. (.*): \"Не откажусь\""] = "greed",
|
||||
["Разыгрывается: (.+)%. (.*): \"Мне это нужно\""] = "need",
|
||||
} or locale == "koKR" and {
|
||||
["(.*)님이 주사위 굴리기를 포기했습니다: (.+)"] = "pass",
|
||||
["(.*)님이 차비를 선택했습니다: (.+)"] = "greed",
|
||||
["(.*)님이 입찰을 선택했습니다: (.+)"] = "need",
|
||||
} or locale == "esES" and {
|
||||
["^(.*) pasó de: (.+|r)$"] = "pass",
|
||||
["(.*) eligió Codicia para: (.+)"] = "greed",
|
||||
["(.*) eligió Necesidad para: (.+)"] = "need",
|
||||
} or locale == "esMX" and {
|
||||
["^(.*) pasó de: (.+|r)$"] = "pass",
|
||||
["(.*) eligió Codicia para: (.+)"] = "greed",
|
||||
["(.*) eligió Necesidad para: (.+)"] = "need",
|
||||
} or {
|
||||
["^(.*) passed on: (.+|r)$"] = "pass",
|
||||
["(.*) has selected Greed for: (.+)"] = "greed",
|
||||
["(.*) has selected Need for: (.+)"] = "need",
|
||||
}
|
||||
|
||||
local function ClickRoll(frame)
|
||||
RollOnLoot(frame.parent.rollID, frame.rolltype)
|
||||
end
|
||||
|
||||
local function HideTip() GameTooltip:Hide() end
|
||||
local function HideTip2() GameTooltip:Hide() ResetCursor() end
|
||||
|
||||
local rolltypes = {"need", "greed", [0] = "pass"}
|
||||
local function SetTip(frame)
|
||||
GameTooltip:SetOwner(frame, "ANCHOR_RIGHT")
|
||||
GameTooltip:SetText(frame.tiptext)
|
||||
if(frame:IsEnabled() == 0) then
|
||||
GameTooltip:AddLine("|cffff3333"..L["Can't Roll"])
|
||||
end
|
||||
|
||||
for name, tbl in pairs(frame.parent.rolls) do
|
||||
if(tbl[1] == rolltypes[frame.rolltype] and tbl[2]) then
|
||||
local classColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[tbl[2]] or RAID_CLASS_COLORS[tbl[2]]
|
||||
GameTooltip:AddLine(name, classColor.r, classColor.g, classColor.b)
|
||||
end
|
||||
end
|
||||
GameTooltip:Show()
|
||||
end
|
||||
|
||||
local function SetItemTip(frame)
|
||||
if(not frame.link) then return end
|
||||
GameTooltip:SetOwner(frame, "ANCHOR_TOPLEFT")
|
||||
GameTooltip:SetHyperlink(frame.link)
|
||||
if(IsShiftKeyDown()) then
|
||||
GameTooltip_ShowCompareItem()
|
||||
end
|
||||
if(IsModifiedClick("DRESSUP")) then
|
||||
ShowInspectCursor()
|
||||
else
|
||||
ResetCursor()
|
||||
end
|
||||
end
|
||||
|
||||
local function ItemOnUpdate(self)
|
||||
if(IsShiftKeyDown()) then
|
||||
GameTooltip_ShowCompareItem()
|
||||
end
|
||||
CursorOnUpdate(self)
|
||||
end
|
||||
|
||||
local function LootClick(frame)
|
||||
if(IsControlKeyDown()) then
|
||||
DressUpItemLink(frame.link)
|
||||
elseif(IsShiftKeyDown()) then
|
||||
ChatEdit_InsertLink(frame.link)
|
||||
end
|
||||
end
|
||||
|
||||
local function OnEvent(frame, _, rollID)
|
||||
cancelled_rolls[rollID] = true
|
||||
if(frame.rollID ~= rollID) then return end
|
||||
|
||||
frame.rollID = nil
|
||||
frame.time = nil
|
||||
frame:Hide()
|
||||
end
|
||||
|
||||
local function StatusUpdate(frame)
|
||||
if(not frame.parent.rollID) then return end
|
||||
local t = GetLootRollTimeLeft(frame.parent.rollID)
|
||||
local perc = t / frame.parent.time
|
||||
frame.spark:Point("CENTER", frame, "LEFT", perc * frame:GetWidth(), 0)
|
||||
frame:SetValue(t)
|
||||
|
||||
if(t > 1000000000) then
|
||||
frame:GetParent():Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local function CreateRollButton(parent, ntex, ptex, htex, rolltype, tiptext)
|
||||
local f = CreateFrame("Button", nil, parent)
|
||||
E:Point(f, unpack(args))
|
||||
f:Size(FRAME_HEIGHT - 4)
|
||||
f:SetNormalTexture(ntex)
|
||||
if(ptex) then f:SetPushedTexture(ptex) end
|
||||
f:SetHighlightTexture(htex)
|
||||
f.rolltype = rolltype
|
||||
f.parent = parent
|
||||
f.tiptext = tiptext
|
||||
f:SetScript("OnEnter", SetTip)
|
||||
f:SetScript("OnLeave", HideTip)
|
||||
f:SetScript("OnClick", ClickRoll)
|
||||
local txt = f:CreateFontString(nil, nil)
|
||||
txt:FontTemplate(nil, nil, "OUTLINE")
|
||||
txt:Point("CENTER", 0, rolltype == 2 and 1 or rolltype == 0 and -1.2 or 0)
|
||||
return f, txt
|
||||
end
|
||||
|
||||
function M:CreateRollFrame()
|
||||
local frame = CreateFrame("Frame", nil, E.UIParent)
|
||||
frame:Size(FRAME_WIDTH, FRAME_HEIGHT)
|
||||
frame:SetTemplate("Default")
|
||||
frame:SetScript("OnEvent", OnEvent)
|
||||
frame:RegisterEvent("CANCEL_LOOT_ROLL")
|
||||
frame:Hide()
|
||||
|
||||
local button = CreateFrame("Button", nil, frame)
|
||||
button:Point("RIGHT", frame, "LEFT", -(E.Spacing*3), 0)
|
||||
button:Size(FRAME_HEIGHT - (E.Border * 2))
|
||||
button:CreateBackdrop("Default")
|
||||
button:SetScript("OnEnter", SetItemTip)
|
||||
button:SetScript("OnLeave", HideTip2)
|
||||
button:SetScript("OnUpdate", ItemOnUpdate)
|
||||
button:SetScript("OnClick", LootClick)
|
||||
frame.button = button
|
||||
|
||||
button.icon = button:CreateTexture(nil, "OVERLAY")
|
||||
button.icon:SetAllPoints()
|
||||
button.icon:SetTexCoord(unpack(E.TexCoords))
|
||||
|
||||
local tfade = frame:CreateTexture(nil, "BORDER")
|
||||
tfade:Point("TOPLEFT", frame, "TOPLEFT", 4, 0)
|
||||
tfade:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -4, 0)
|
||||
tfade:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
|
||||
tfade:SetBlendMode("ADD")
|
||||
tfade:SetGradientAlpha("VERTICAL", .1, .1, .1, 0, .1, .1, .1, 0)
|
||||
|
||||
local status = CreateFrame("StatusBar", nil, frame)
|
||||
status:SetInside()
|
||||
status:SetScript("OnUpdate", StatusUpdate)
|
||||
status:SetFrameLevel(status:GetFrameLevel() - 1)
|
||||
status:SetStatusBarTexture(E["media"].normTex)
|
||||
E:RegisterStatusBar(status)
|
||||
status:SetStatusBarColor(.8, .8, .8, .9)
|
||||
status.parent = frame
|
||||
frame.status = status
|
||||
|
||||
status.bg = status:CreateTexture(nil, "BACKGROUND")
|
||||
status.bg:SetAlpha(0.1)
|
||||
status.bg:SetAllPoints()
|
||||
local spark = frame:CreateTexture(nil, "OVERLAY")
|
||||
spark:Size(14, FRAME_HEIGHT)
|
||||
spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
|
||||
spark:SetBlendMode("ADD")
|
||||
status.spark = spark
|
||||
|
||||
local need, needtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Dice-Up", "Interface\\Buttons\\UI-GroupLoot-Dice-Highlight", "Interface\\Buttons\\UI-GroupLoot-Dice-Down", 1, NEED, "LEFT", frame.button, "RIGHT", 5, -1)
|
||||
local greed, greedtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Coin-Up", "Interface\\Buttons\\UI-GroupLoot-Coin-Highlight", "Interface\\Buttons\\UI-GroupLoot-Coin-Down", 2, GREED, "LEFT", need, "RIGHT", 0, -1)
|
||||
local pass, passtext = CreateRollButton(frame, "Interface\\AddOns\\ElvUI\\media\\textures\\UI-GroupLoot-Pass-Up", nil, "Interface\\AddOns\\ElvUI\\media\\textures\\UI-GroupLoot-Pass-Down", 0, PASS, "LEFT", greed, "RIGHT", 0, 2)
|
||||
frame.needbutt, frame.greedbutt = need, greed
|
||||
frame.need, frame.greed, frame.pass = needtext, greedtext, passtext
|
||||
|
||||
local bind = frame:CreateFontString()
|
||||
bind:Point("LEFT", pass, "RIGHT", 3, 1)
|
||||
bind:FontTemplate(nil, nil, "OUTLINE")
|
||||
frame.fsbind = bind
|
||||
|
||||
local loot = frame:CreateFontString(nil, "ARTWORK")
|
||||
loot:FontTemplate(nil, nil, "OUTLINE")
|
||||
loot:Point("LEFT", bind, "RIGHT", 0, 0)
|
||||
loot:Point("RIGHT", frame, "RIGHT", -5, 0)
|
||||
loot:Size(200, 10)
|
||||
loot:SetJustifyH("LEFT")
|
||||
frame.fsloot = loot
|
||||
|
||||
frame.rolls = {}
|
||||
|
||||
return frame
|
||||
end
|
||||
|
||||
local function GetFrame()
|
||||
for _, f in ipairs(M.RollBars) do
|
||||
if(not f.rollID) then
|
||||
return f
|
||||
end
|
||||
end
|
||||
|
||||
local f = M:CreateRollFrame()
|
||||
if(pos == "TOP") then
|
||||
f:Point("TOP", next(M.RollBars) and M.RollBars[getn(M.RollBars)] or AlertFrameHolder, "BOTTOM", 0, -4)
|
||||
else
|
||||
f:Point("BOTTOM", next(M.RollBars) and M.RollBars[getn(M.RollBars)] or AlertFrameHolder, "TOP", 0, 4)
|
||||
end
|
||||
|
||||
tinsert(M.RollBars, f)
|
||||
|
||||
return f
|
||||
end
|
||||
|
||||
function M:START_LOOT_ROLL(_, rollID, time)
|
||||
if(cancelled_rolls[rollID]) then return end
|
||||
|
||||
local f = GetFrame()
|
||||
f.rollID = rollID
|
||||
f.time = time
|
||||
for i in pairs(f.rolls) do f.rolls[i] = nil end
|
||||
f.need:SetText(0)
|
||||
f.greed:SetText(0)
|
||||
f.pass:SetText(0)
|
||||
|
||||
local texture, name, count, quality, bindOnPickUp = GetLootRollItemInfo(rollID)
|
||||
f.button.icon:SetTexture(texture)
|
||||
f.button.link = GetLootRollItemLink(rollID)
|
||||
|
||||
f.needbutt:Enable()
|
||||
f.greedbutt:Enable()
|
||||
SetDesaturation(f.needbutt:GetNormalTexture())
|
||||
SetDesaturation(f.greedbutt:GetNormalTexture())
|
||||
f.needbutt:SetAlpha(1)
|
||||
f.greedbutt:SetAlpha(1)
|
||||
|
||||
f.fsbind:SetText(bindOnPickUp and "BoP" or "BoE")
|
||||
f.fsbind:SetVertexColor(bindOnPickUp and 1 or .3, bindOnPickUp and .3 or 1, bindOnPickUp and .1 or .3)
|
||||
|
||||
local color = ITEM_QUALITY_COLORS[quality]
|
||||
f.fsloot:SetText(name)
|
||||
f.status:SetStatusBarColor(color.r, color.g, color.b, .7)
|
||||
f.status.bg:SetTexture(color.r, color.g, color.b)
|
||||
|
||||
f.status:SetMinMaxValues(0, time)
|
||||
f.status:SetValue(time)
|
||||
|
||||
f:SetPoint("CENTER", WorldFrame, "CENTER")
|
||||
f:Show()
|
||||
|
||||
if(E.db.general.autoRoll and UnitLevel("player") == MAX_PLAYER_LEVEL and quality == 2 and not bindOnPickUp) then
|
||||
RollOnLoot(rollID, 2)
|
||||
end
|
||||
end
|
||||
|
||||
function M:ParseRollChoice(msg)
|
||||
if not msg then return end
|
||||
for i, v in pairs(rollpairs) do
|
||||
local _, _, playername, itemname = find(msg, i)
|
||||
if(locale == "ruRU" and (v == "greed" or v == "need")) then
|
||||
local temp = playername
|
||||
playername = itemname
|
||||
itemname = temp
|
||||
end
|
||||
if(playername and itemname and playername ~= "Everyone") then return playername, itemname, v end
|
||||
end
|
||||
end
|
||||
|
||||
function M:CHAT_MSG_LOOT(_, msg)
|
||||
local playername, itemname, rolltype = self:ParseRollChoice(msg)
|
||||
if(playername and itemname and rolltype) then
|
||||
local class = select(2, UnitClass(playername))
|
||||
for _, f in ipairs(M.RollBars) do
|
||||
if(f.rollID and f.button.link == itemname and not f.rolls[playername]) then
|
||||
f.rolls[playername] = { rolltype, class }
|
||||
f[rolltype]:SetText(tonumber(f[rolltype]:GetText()) + 1)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M:LoadLootRoll()
|
||||
if(not E.private.general.lootRoll) then return end
|
||||
|
||||
self:RegisterEvent("CHAT_MSG_LOOT")
|
||||
self:RegisterEvent("START_LOOT_ROLL")
|
||||
UIParent:UnregisterEvent("START_LOOT_ROLL")
|
||||
UIParent:UnregisterEvent("CANCEL_LOOT_ROLL")
|
||||
end
|
||||
@@ -176,7 +176,7 @@ end
|
||||
|
||||
function M:ForceCVars()
|
||||
if E.private.general.loot then
|
||||
if GetCVar("lootUnderMouse") == "1" then
|
||||
if E.private.general.lootUnderMouse then
|
||||
E:DisableMover("LootFrameMover")
|
||||
else
|
||||
E:EnableMover("LootFrameMover")
|
||||
@@ -186,8 +186,8 @@ end
|
||||
|
||||
function M:Initialize()
|
||||
-- self:LoadRaidMarker()
|
||||
-- self:LoadLoot()
|
||||
-- self:LoadLootRoll()
|
||||
self:LoadLoot()
|
||||
self:LoadLootRoll()
|
||||
self:LoadChatBubbles()
|
||||
self:RegisterEvent("MERCHANT_SHOW")
|
||||
self:RegisterEvent("PLAYER_REGEN_DISABLED", "ErrorFrameToggle")
|
||||
|
||||
@@ -3,6 +3,9 @@ local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, Profi
|
||||
--Locked Settings, These settings are stored for your character only regardless of profile options.
|
||||
|
||||
V["general"] = {
|
||||
["loot"] = true,
|
||||
["lootRoll"] = true,
|
||||
["lootUnderMouse"] = false,
|
||||
["normTex"] = "ElvUI Norm",
|
||||
["glossTex"] = "ElvUI Norm",
|
||||
["dmgfont"] = "PT Sans Narrow",
|
||||
|
||||
@@ -104,8 +104,17 @@ E.Options.args.general = {
|
||||
get = function(info) return E.private.general.lootRoll; end,
|
||||
set = function(info, value) E.private.general.lootRoll = value; E:StaticPopup_Show("PRIVATE_RL"); end
|
||||
},
|
||||
eyefinity = {
|
||||
lootUnderMouse = {
|
||||
order = 10,
|
||||
type = "toggle",
|
||||
name = L["Loot Under Mouse"],
|
||||
desc = L["Enable/Disable loot frame under the mouse cursor."],
|
||||
get = function(info) return E.private.general.lootUnderMouse; end,
|
||||
set = function(info, value) E.private.general.lootUnderMouse = value; end,
|
||||
disabled = function() return not E.private.general.loot; end
|
||||
},
|
||||
eyefinity = {
|
||||
order = 11,
|
||||
name = L["Multi-Monitor Support"],
|
||||
desc = L["Attempt to support eyefinity/nvidia surround."],
|
||||
type = "toggle",
|
||||
@@ -113,19 +122,19 @@ E.Options.args.general = {
|
||||
set = function(info, value) E.global.general[ info[getn(info)] ] = value; E:StaticPopup_Show("GLOBAL_RL"); end
|
||||
},
|
||||
hideErrorFrame = {
|
||||
order = 11,
|
||||
order = 12,
|
||||
type = "toggle",
|
||||
name = L["Hide Error Text"],
|
||||
desc = L["Hides the red error text at the top of the screen while in combat."]
|
||||
},
|
||||
taintLog = {
|
||||
order = 12,
|
||||
order = 13,
|
||||
type = "toggle",
|
||||
name = L["Log Taints"],
|
||||
desc = L["Send ADDON_ACTION_BLOCKED errors to the Lua Error frame. These errors are less important in most cases and will not effect your game performance. Also a lot of these errors cannot be fixed. Please only report these errors if you notice a Defect in gameplay."]
|
||||
},
|
||||
bottomPanel = {
|
||||
order = 13,
|
||||
order = 14,
|
||||
type = "toggle",
|
||||
name = L["Bottom Panel"],
|
||||
desc = L["Display a panel across the bottom of the screen. This is for cosmetic only."],
|
||||
@@ -133,7 +142,7 @@ E.Options.args.general = {
|
||||
set = function(info, value) E.db.general.bottomPanel = value; E:GetModule("Layout"):BottomPanelVisibility(); end
|
||||
},
|
||||
topPanel = {
|
||||
order = 14,
|
||||
order = 15,
|
||||
type = "toggle",
|
||||
name = L["Top Panel"],
|
||||
desc = L["Display a panel across the top of the screen. This is for cosmetic only."],
|
||||
@@ -141,7 +150,7 @@ E.Options.args.general = {
|
||||
set = function(info, value) E.db.general.topPanel = value; E:GetModule("Layout"):TopPanelVisibility(); end
|
||||
},
|
||||
afk = {
|
||||
order = 15,
|
||||
order = 16,
|
||||
type = "toggle",
|
||||
name = L["AFK Mode"],
|
||||
desc = L["When you go AFK display the AFK screen."],
|
||||
@@ -149,13 +158,13 @@ E.Options.args.general = {
|
||||
set = function(info, value) E.db.general.afk = value; E:GetModule("AFK"):Toggle(); end
|
||||
},
|
||||
enhancedPvpMessages = {
|
||||
order = 16,
|
||||
order = 17,
|
||||
type = "toggle",
|
||||
name = L["Enhanced PVP Messages"],
|
||||
desc = L["Display battleground messages in the middle of the screen."],
|
||||
},
|
||||
raidUtility = {
|
||||
order = 17,
|
||||
order = 18,
|
||||
type = "toggle",
|
||||
name = RAID_CONTROL,
|
||||
desc = L["Enables the ElvUI Raid Control panel."],
|
||||
@@ -163,7 +172,7 @@ E.Options.args.general = {
|
||||
set = function(info, value) E.private.general.raidUtility = value; E:StaticPopup_Show("PRIVATE_RL") end
|
||||
},
|
||||
autoScale = {
|
||||
order = 18,
|
||||
order = 19,
|
||||
name = L["Auto Scale"],
|
||||
desc = L["Automatically scale the User Interface based on your screen resolution"],
|
||||
type = "toggle",
|
||||
@@ -171,7 +180,7 @@ E.Options.args.general = {
|
||||
set = function(info, value) E.global.general[ info[getn(info)] ] = value; E:StaticPopup_Show("GLOBAL_RL") end
|
||||
},
|
||||
minUiScale = {
|
||||
order = 19,
|
||||
order = 20,
|
||||
type = "range",
|
||||
name = L["Lowest Allowed UI Scale"],
|
||||
min = 0.32, max = 0.64, step = 0.01,
|
||||
@@ -179,7 +188,7 @@ E.Options.args.general = {
|
||||
set = function(info, value) E.global.general.minUiScale = value; E:StaticPopup_Show("GLOBAL_RL"); end
|
||||
},
|
||||
numberPrefixStyle = {
|
||||
order = 20,
|
||||
order = 21,
|
||||
type = "select",
|
||||
name = L["Number Prefix"],
|
||||
get = function(info) return E.db.general.numberPrefixStyle; end,
|
||||
|
||||
Reference in New Issue
Block a user