mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 16:34:45 +00:00
wip
This commit is contained in:
@@ -72,12 +72,12 @@ local rolltypes = {"need", "greed", [0] = "pass"}
|
|||||||
local function SetTip(frame)
|
local function SetTip(frame)
|
||||||
GameTooltip:SetOwner(frame, "ANCHOR_RIGHT")
|
GameTooltip:SetOwner(frame, "ANCHOR_RIGHT")
|
||||||
GameTooltip:SetText(frame.tiptext)
|
GameTooltip:SetText(frame.tiptext)
|
||||||
if(frame:IsEnabled() == 0) then
|
if frame:IsEnabled() == 0 then
|
||||||
GameTooltip:AddLine("|cffff3333"..L["Can't Roll"])
|
GameTooltip:AddLine("|cffff3333"..L["Can't Roll"])
|
||||||
end
|
end
|
||||||
|
|
||||||
for name, tbl in pairs(frame.parent.rolls) do
|
for name, tbl in pairs(frame.parent.rolls) do
|
||||||
if(tbl[1] == rolltypes[frame.rolltype] and tbl[2]) then
|
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]]
|
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)
|
GameTooltip:AddLine(name, classColor.r, classColor.g, classColor.b)
|
||||||
end
|
end
|
||||||
@@ -86,13 +86,13 @@ local function SetTip(frame)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function SetItemTip(frame)
|
local function SetItemTip(frame)
|
||||||
if(not frame.link) then return end
|
if not frame.link then return end
|
||||||
GameTooltip:SetOwner(frame, "ANCHOR_TOPLEFT")
|
GameTooltip:SetOwner(frame, "ANCHOR_TOPLEFT")
|
||||||
GameTooltip:SetHyperlink(frame.link)
|
GameTooltip:SetHyperlink(frame.link)
|
||||||
if(IsShiftKeyDown()) then
|
-- if IsShiftKeyDown() then
|
||||||
GameTooltip_ShowCompareItem()
|
-- GameTooltip_ShowCompareItem()
|
||||||
end
|
-- end
|
||||||
if(IsModifiedClick("DRESSUP")) then
|
if IsModifiedClick("DRESSUP") then
|
||||||
ShowInspectCursor()
|
ShowInspectCursor()
|
||||||
else
|
else
|
||||||
ResetCursor()
|
ResetCursor()
|
||||||
@@ -100,23 +100,23 @@ local function SetItemTip(frame)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function ItemOnUpdate(self)
|
local function ItemOnUpdate(self)
|
||||||
if(IsShiftKeyDown()) then
|
-- if IsShiftKeyDown() then
|
||||||
GameTooltip_ShowCompareItem()
|
-- GameTooltip_ShowCompareItem()
|
||||||
end
|
-- end
|
||||||
CursorOnUpdate(self)
|
CursorOnUpdate(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function LootClick(frame)
|
local function LootClick(frame)
|
||||||
if(IsControlKeyDown()) then
|
if IsControlKeyDown() then
|
||||||
DressUpItemLink(frame.link)
|
DressUpItemLink(frame.link)
|
||||||
elseif(IsShiftKeyDown()) then
|
elseif IsShiftKeyDown() then
|
||||||
ChatEdit_InsertLink(frame.link)
|
ChatEdit_InsertLink(frame.link)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function OnEvent(frame, _, rollID)
|
local function OnEvent(frame, _, rollID)
|
||||||
cancelled_rolls[rollID] = true
|
cancelled_rolls[rollID] = true
|
||||||
if(frame.rollID ~= rollID) then return end
|
if frame.rollID ~= rollID then return end
|
||||||
|
|
||||||
frame.rollID = nil
|
frame.rollID = nil
|
||||||
frame.time = nil
|
frame.time = nil
|
||||||
@@ -124,13 +124,13 @@ local function OnEvent(frame, _, rollID)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function StatusUpdate(frame)
|
local function StatusUpdate(frame)
|
||||||
if(not frame.parent.rollID) then return end
|
if not frame.parent.rollID then return end
|
||||||
local t = GetLootRollTimeLeft(frame.parent.rollID)
|
local t = GetLootRollTimeLeft(frame.parent.rollID)
|
||||||
local perc = t / frame.parent.time
|
local perc = t / frame.parent.time
|
||||||
frame.spark:Point("CENTER", frame, "LEFT", perc * frame:GetWidth(), 0)
|
frame.spark:Point("CENTER", frame, "LEFT", perc * frame:GetWidth(), 0)
|
||||||
frame:SetValue(t)
|
frame:SetValue(t)
|
||||||
|
|
||||||
if(t > 1000000000) then
|
if t > 1000000000 then
|
||||||
frame:GetParent():Hide()
|
frame:GetParent():Hide()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -166,7 +166,7 @@ function M:CreateRollFrame()
|
|||||||
E:Point(button, "RIGHT", frame, "LEFT", -(E.Spacing*3), 0)
|
E:Point(button, "RIGHT", frame, "LEFT", -(E.Spacing*3), 0)
|
||||||
E:Size(button, FRAME_HEIGHT - (E.Border * 2))
|
E:Size(button, FRAME_HEIGHT - (E.Border * 2))
|
||||||
E:CreateBackdrop(button, "Default")
|
E:CreateBackdrop(button, "Default")
|
||||||
button:SetScript("OnEnter", SetItemTip)
|
-- button:SetScript("OnEnter", SetItemTip)
|
||||||
button:SetScript("OnLeave", HideTip2)
|
button:SetScript("OnLeave", HideTip2)
|
||||||
button:SetScript("OnUpdate", ItemOnUpdate)
|
button:SetScript("OnUpdate", ItemOnUpdate)
|
||||||
button:SetScript("OnClick", LootClick)
|
button:SetScript("OnClick", LootClick)
|
||||||
@@ -185,7 +185,7 @@ function M:CreateRollFrame()
|
|||||||
|
|
||||||
local status = CreateFrame("StatusBar", nil, frame)
|
local status = CreateFrame("StatusBar", nil, frame)
|
||||||
E:SetInside(status)
|
E:SetInside(status)
|
||||||
status:SetScript("OnUpdate", StatusUpdate)
|
-- status:SetScript("OnUpdate", StatusUpdate)
|
||||||
status:SetFrameLevel(status:GetFrameLevel() - 1)
|
status:SetFrameLevel(status:GetFrameLevel() - 1)
|
||||||
status:SetStatusBarTexture(E["media"].normTex)
|
status:SetStatusBarTexture(E["media"].normTex)
|
||||||
E:RegisterStatusBar(status)
|
E:RegisterStatusBar(status)
|
||||||
@@ -234,7 +234,7 @@ local function GetFrame()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local f = M:CreateRollFrame()
|
local f = M:CreateRollFrame()
|
||||||
if(pos == "TOP") then
|
if pos == "TOP" then
|
||||||
E:Point(f, "TOP", next(M.RollBars) and M.RollBars[getn(M.RollBars)] or AlertFrameHolder, "BOTTOM", 0, -4)
|
E:Point(f, "TOP", next(M.RollBars) and M.RollBars[getn(M.RollBars)] or AlertFrameHolder, "BOTTOM", 0, -4)
|
||||||
else
|
else
|
||||||
E:Point(f, "BOTTOM", next(M.RollBars) and M.RollBars[getn(M.RollBars)] or AlertFrameHolder, "TOP", 0, 4)
|
E:Point(f, "BOTTOM", next(M.RollBars) and M.RollBars[getn(M.RollBars)] or AlertFrameHolder, "TOP", 0, 4)
|
||||||
@@ -246,7 +246,7 @@ local function GetFrame()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M:START_LOOT_ROLL(_, rollID, time)
|
function M:START_LOOT_ROLL(_, rollID, time)
|
||||||
if(cancelled_rolls[rollID]) then return end
|
if cancelled_rolls[rollID] then return end
|
||||||
|
|
||||||
local f = GetFrame()
|
local f = GetFrame()
|
||||||
f.rollID = rollID
|
f.rollID = rollID
|
||||||
@@ -255,7 +255,7 @@ function M:START_LOOT_ROLL(_, rollID, time)
|
|||||||
f.need:SetText(0)
|
f.need:SetText(0)
|
||||||
f.greed:SetText(0)
|
f.greed:SetText(0)
|
||||||
f.pass:SetText(0)
|
f.pass:SetText(0)
|
||||||
|
|
||||||
local texture, name, count, quality, bindOnPickUp = GetLootRollItemInfo(rollID)
|
local texture, name, count, quality, bindOnPickUp = GetLootRollItemInfo(rollID)
|
||||||
f.button.icon:SetTexture(texture)
|
f.button.icon:SetTexture(texture)
|
||||||
f.button.link = GetLootRollItemLink(rollID)
|
f.button.link = GetLootRollItemLink(rollID)
|
||||||
@@ -281,7 +281,7 @@ function M:START_LOOT_ROLL(_, rollID, time)
|
|||||||
f:SetPoint("CENTER", WorldFrame, "CENTER")
|
f:SetPoint("CENTER", WorldFrame, "CENTER")
|
||||||
f:Show()
|
f:Show()
|
||||||
|
|
||||||
if(E.db.general.autoRoll and UnitLevel("player") == MAX_PLAYER_LEVEL and quality == 2 and not bindOnPickUp) then
|
if E.db.general.autoRoll and UnitLevel("player") == MAX_PLAYER_LEVEL and quality == 2 and not bindOnPickUp then
|
||||||
RollOnLoot(rollID, 2)
|
RollOnLoot(rollID, 2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -290,21 +290,21 @@ function M:ParseRollChoice(msg)
|
|||||||
if not msg then return end
|
if not msg then return end
|
||||||
for i, v in pairs(rollpairs) do
|
for i, v in pairs(rollpairs) do
|
||||||
local _, _, playername, itemname = find(msg, i)
|
local _, _, playername, itemname = find(msg, i)
|
||||||
if(locale == "ruRU" and (v == "greed" or v == "need")) then
|
if locale == "ruRU" and (v == "greed" or v == "need") then
|
||||||
local temp = playername
|
local temp = playername
|
||||||
playername = itemname
|
playername = itemname
|
||||||
itemname = temp
|
itemname = temp
|
||||||
end
|
end
|
||||||
if(playername and itemname and playername ~= "Everyone") then return playername, itemname, v end
|
if playername and itemname and playername ~= "Everyone" then return playername, itemname, v end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CHAT_MSG_LOOT(_, msg)
|
function M:CHAT_MSG_LOOT(_, msg)
|
||||||
local playername, itemname, rolltype = self:ParseRollChoice(msg)
|
local playername, itemname, rolltype = self:ParseRollChoice(msg)
|
||||||
if(playername and itemname and rolltype) then
|
if playername and itemname and rolltype then
|
||||||
local class = select(2, UnitClass(playername))
|
local class = select(2, UnitClass(playername))
|
||||||
for _, f in ipairs(M.RollBars) do
|
for _, f in ipairs(M.RollBars) do
|
||||||
if(f.rollID and f.button.link == itemname and not f.rolls[playername]) then
|
if f.rollID and f.button.link == itemname and not f.rolls[playername] then
|
||||||
f.rolls[playername] = { rolltype, class }
|
f.rolls[playername] = { rolltype, class }
|
||||||
f[rolltype]:SetText(tonumber(f[rolltype]:GetText()) + 1)
|
f[rolltype]:SetText(tonumber(f[rolltype]:GetText()) + 1)
|
||||||
return
|
return
|
||||||
@@ -314,7 +314,7 @@ function M:CHAT_MSG_LOOT(_, msg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M:LoadLootRoll()
|
function M:LoadLootRoll()
|
||||||
if(not E.private.general.lootRoll) then return end
|
if not E.private.general.lootRoll then return end
|
||||||
|
|
||||||
self:RegisterEvent("CHAT_MSG_LOOT")
|
self:RegisterEvent("CHAT_MSG_LOOT")
|
||||||
self:RegisterEvent("START_LOOT_ROLL")
|
self:RegisterEvent("START_LOOT_ROLL")
|
||||||
|
|||||||
Reference in New Issue
Block a user