From a15bfeb7193f394250d3682c43c8d6ccc07899f8 Mon Sep 17 00:00:00 2001 From: Logan Payton Date: Sun, 15 Apr 2018 13:22:29 -0400 Subject: [PATCH 1/8] Use tooklit functions, fixed --- ElvUI/Core/toolkit.lua | 3 ++- ElvUI/Modules/Misc/LootRoll.lua | 42 ++++++++++++++++----------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/ElvUI/Core/toolkit.lua b/ElvUI/Core/toolkit.lua index 5723447..2ec849c 100644 --- a/ElvUI/Core/toolkit.lua +++ b/ElvUI/Core/toolkit.lua @@ -47,7 +47,8 @@ end function E:Size(frame, width, height) assert(width) - frame:SetSize(E:Scale(width), E:Scale(height or width)) + frame:SetWidth(E:Scale(width)) + frame:SetHeight(E:Scale(height or width)) end function E:Width(frame, width) diff --git a/ElvUI/Modules/Misc/LootRoll.lua b/ElvUI/Modules/Misc/LootRoll.lua index 3f4954c..c028a43 100644 --- a/ElvUI/Modules/Misc/LootRoll.lua +++ b/ElvUI/Modules/Misc/LootRoll.lua @@ -137,8 +137,8 @@ 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) + -- E:Point(f, unpack(args)) + E:Size(f, FRAME_HEIGHT - 4) f:SetNormalTexture(ntex) if(ptex) then f:SetPushedTexture(ptex) end f:SetHighlightTexture(htex) @@ -149,23 +149,23 @@ local function CreateRollButton(parent, ntex, ptex, htex, rolltype, tiptext) 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) + E:FontTemplate(txt, nil, nil, "OUTLINE") + E:Point(txt, "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") + E:Size(frame, FRAME_WIDTH, FRAME_HEIGHT) + E:SetTemplate(frame, "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") + E:Point(button, "RIGHT", frame, "LEFT", -(E.Spacing*3), 0) + E:Size(button, FRAME_HEIGHT - (E.Border * 2)) + E:CreateBackdrop(button, "Default") button:SetScript("OnEnter", SetItemTip) button:SetScript("OnLeave", HideTip2) button:SetScript("OnUpdate", ItemOnUpdate) @@ -177,14 +177,14 @@ function M:CreateRollFrame() 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) + E:Point(tfade, "TOPLEFT", frame, "TOPLEFT", 4, 0) + E:Point(tfade, "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() + E:SetInside(status) status:SetScript("OnUpdate", StatusUpdate) status:SetFrameLevel(status:GetFrameLevel() - 1) status:SetStatusBarTexture(E["media"].normTex) @@ -197,7 +197,7 @@ function M:CreateRollFrame() status.bg:SetAlpha(0.1) status.bg:SetAllPoints() local spark = frame:CreateTexture(nil, "OVERLAY") - spark:Size(14, FRAME_HEIGHT) + E:Size(spark, 14, FRAME_HEIGHT) spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark") spark:SetBlendMode("ADD") status.spark = spark @@ -209,15 +209,15 @@ function M:CreateRollFrame() 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") + E:Point(bind, "LEFT", pass, "RIGHT", 3, 1) + E:FontTemplate(bind, 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) + E:FontTemplate(loot, nil, nil, "OUTLINE") + E:Point(loot, "LEFT", bind, "RIGHT", 0, 0) + E:Point(loot, "RIGHT", frame, "RIGHT", -5, 0) + E:Size(loot, 200, 10) loot:SetJustifyH("LEFT") frame.fsloot = loot @@ -235,9 +235,9 @@ local function GetFrame() 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) + E:Point(f, "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) + E:Point(f, "BOTTOM", next(M.RollBars) and M.RollBars[getn(M.RollBars)] or AlertFrameHolder, "TOP", 0, 4) end tinsert(M.RollBars, f) From 8816d3652285233b84ad8ab730dd219dd29f78ad Mon Sep 17 00:00:00 2001 From: Logan Payton Date: Wed, 9 May 2018 15:21:05 -0400 Subject: [PATCH 2/8] wip --- ElvUI/Modules/Misc/LootRoll.lua | 52 ++++++++++++++++----------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/ElvUI/Modules/Misc/LootRoll.lua b/ElvUI/Modules/Misc/LootRoll.lua index c028a43..7e86016 100644 --- a/ElvUI/Modules/Misc/LootRoll.lua +++ b/ElvUI/Modules/Misc/LootRoll.lua @@ -72,12 +72,12 @@ local rolltypes = {"need", "greed", [0] = "pass"} local function SetTip(frame) GameTooltip:SetOwner(frame, "ANCHOR_RIGHT") GameTooltip:SetText(frame.tiptext) - if(frame:IsEnabled() == 0) then + 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 + 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 @@ -86,13 +86,13 @@ local function SetTip(frame) end local function SetItemTip(frame) - if(not frame.link) then return end + 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 + -- if IsShiftKeyDown() then + -- GameTooltip_ShowCompareItem() + -- end + if IsModifiedClick("DRESSUP") then ShowInspectCursor() else ResetCursor() @@ -100,23 +100,23 @@ local function SetItemTip(frame) end local function ItemOnUpdate(self) - if(IsShiftKeyDown()) then - GameTooltip_ShowCompareItem() - end + -- if IsShiftKeyDown() then + -- GameTooltip_ShowCompareItem() + -- end CursorOnUpdate(self) end local function LootClick(frame) - if(IsControlKeyDown()) then + if IsControlKeyDown() then DressUpItemLink(frame.link) - elseif(IsShiftKeyDown()) then + 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 + if frame.rollID ~= rollID then return end frame.rollID = nil frame.time = nil @@ -124,13 +124,13 @@ local function OnEvent(frame, _, rollID) end 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 perc = t / frame.parent.time frame.spark:Point("CENTER", frame, "LEFT", perc * frame:GetWidth(), 0) frame:SetValue(t) - if(t > 1000000000) then + if t > 1000000000 then frame:GetParent():Hide() end end @@ -166,7 +166,7 @@ function M:CreateRollFrame() E:Point(button, "RIGHT", frame, "LEFT", -(E.Spacing*3), 0) E:Size(button, FRAME_HEIGHT - (E.Border * 2)) E:CreateBackdrop(button, "Default") - button:SetScript("OnEnter", SetItemTip) + -- button:SetScript("OnEnter", SetItemTip) button:SetScript("OnLeave", HideTip2) button:SetScript("OnUpdate", ItemOnUpdate) button:SetScript("OnClick", LootClick) @@ -185,7 +185,7 @@ function M:CreateRollFrame() local status = CreateFrame("StatusBar", nil, frame) E:SetInside(status) - status:SetScript("OnUpdate", StatusUpdate) + -- status:SetScript("OnUpdate", StatusUpdate) status:SetFrameLevel(status:GetFrameLevel() - 1) status:SetStatusBarTexture(E["media"].normTex) E:RegisterStatusBar(status) @@ -234,7 +234,7 @@ local function GetFrame() end 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) else 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 function M:START_LOOT_ROLL(_, rollID, time) - if(cancelled_rolls[rollID]) then return end + if cancelled_rolls[rollID] then return end local f = GetFrame() f.rollID = rollID @@ -255,7 +255,7 @@ function M:START_LOOT_ROLL(_, rollID, time) 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) @@ -281,7 +281,7 @@ function M:START_LOOT_ROLL(_, rollID, 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 + if E.db.general.autoRoll and UnitLevel("player") == MAX_PLAYER_LEVEL and quality == 2 and not bindOnPickUp then RollOnLoot(rollID, 2) end end @@ -290,21 +290,21 @@ 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 + 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 + 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 + 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 + 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 @@ -314,7 +314,7 @@ function M:CHAT_MSG_LOOT(_, msg) end 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("START_LOOT_ROLL") From ce432eb94a8c0ba7a17a1deb7f0a772b0d5b9bb5 Mon Sep 17 00:00:00 2001 From: Logan Payton Date: Sun, 15 Apr 2018 13:22:29 -0400 Subject: [PATCH 3/8] Use tooklit functions, fixed --- ElvUI/Core/toolkit.lua | 3 ++- ElvUI/Modules/Misc/LootRoll.lua | 42 ++++++++++++++++----------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/ElvUI/Core/toolkit.lua b/ElvUI/Core/toolkit.lua index 5723447..2ec849c 100644 --- a/ElvUI/Core/toolkit.lua +++ b/ElvUI/Core/toolkit.lua @@ -47,7 +47,8 @@ end function E:Size(frame, width, height) assert(width) - frame:SetSize(E:Scale(width), E:Scale(height or width)) + frame:SetWidth(E:Scale(width)) + frame:SetHeight(E:Scale(height or width)) end function E:Width(frame, width) diff --git a/ElvUI/Modules/Misc/LootRoll.lua b/ElvUI/Modules/Misc/LootRoll.lua index 3f4954c..c028a43 100644 --- a/ElvUI/Modules/Misc/LootRoll.lua +++ b/ElvUI/Modules/Misc/LootRoll.lua @@ -137,8 +137,8 @@ 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) + -- E:Point(f, unpack(args)) + E:Size(f, FRAME_HEIGHT - 4) f:SetNormalTexture(ntex) if(ptex) then f:SetPushedTexture(ptex) end f:SetHighlightTexture(htex) @@ -149,23 +149,23 @@ local function CreateRollButton(parent, ntex, ptex, htex, rolltype, tiptext) 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) + E:FontTemplate(txt, nil, nil, "OUTLINE") + E:Point(txt, "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") + E:Size(frame, FRAME_WIDTH, FRAME_HEIGHT) + E:SetTemplate(frame, "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") + E:Point(button, "RIGHT", frame, "LEFT", -(E.Spacing*3), 0) + E:Size(button, FRAME_HEIGHT - (E.Border * 2)) + E:CreateBackdrop(button, "Default") button:SetScript("OnEnter", SetItemTip) button:SetScript("OnLeave", HideTip2) button:SetScript("OnUpdate", ItemOnUpdate) @@ -177,14 +177,14 @@ function M:CreateRollFrame() 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) + E:Point(tfade, "TOPLEFT", frame, "TOPLEFT", 4, 0) + E:Point(tfade, "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() + E:SetInside(status) status:SetScript("OnUpdate", StatusUpdate) status:SetFrameLevel(status:GetFrameLevel() - 1) status:SetStatusBarTexture(E["media"].normTex) @@ -197,7 +197,7 @@ function M:CreateRollFrame() status.bg:SetAlpha(0.1) status.bg:SetAllPoints() local spark = frame:CreateTexture(nil, "OVERLAY") - spark:Size(14, FRAME_HEIGHT) + E:Size(spark, 14, FRAME_HEIGHT) spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark") spark:SetBlendMode("ADD") status.spark = spark @@ -209,15 +209,15 @@ function M:CreateRollFrame() 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") + E:Point(bind, "LEFT", pass, "RIGHT", 3, 1) + E:FontTemplate(bind, 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) + E:FontTemplate(loot, nil, nil, "OUTLINE") + E:Point(loot, "LEFT", bind, "RIGHT", 0, 0) + E:Point(loot, "RIGHT", frame, "RIGHT", -5, 0) + E:Size(loot, 200, 10) loot:SetJustifyH("LEFT") frame.fsloot = loot @@ -235,9 +235,9 @@ local function GetFrame() 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) + E:Point(f, "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) + E:Point(f, "BOTTOM", next(M.RollBars) and M.RollBars[getn(M.RollBars)] or AlertFrameHolder, "TOP", 0, 4) end tinsert(M.RollBars, f) From 3e1018ecf4ee93540e7bcd9686f299602701af71 Mon Sep 17 00:00:00 2001 From: Logan Payton Date: Wed, 9 May 2018 15:21:05 -0400 Subject: [PATCH 4/8] wip --- ElvUI/Modules/Misc/LootRoll.lua | 52 ++++++++++++++++----------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/ElvUI/Modules/Misc/LootRoll.lua b/ElvUI/Modules/Misc/LootRoll.lua index c028a43..7e86016 100644 --- a/ElvUI/Modules/Misc/LootRoll.lua +++ b/ElvUI/Modules/Misc/LootRoll.lua @@ -72,12 +72,12 @@ local rolltypes = {"need", "greed", [0] = "pass"} local function SetTip(frame) GameTooltip:SetOwner(frame, "ANCHOR_RIGHT") GameTooltip:SetText(frame.tiptext) - if(frame:IsEnabled() == 0) then + 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 + 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 @@ -86,13 +86,13 @@ local function SetTip(frame) end local function SetItemTip(frame) - if(not frame.link) then return end + 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 + -- if IsShiftKeyDown() then + -- GameTooltip_ShowCompareItem() + -- end + if IsModifiedClick("DRESSUP") then ShowInspectCursor() else ResetCursor() @@ -100,23 +100,23 @@ local function SetItemTip(frame) end local function ItemOnUpdate(self) - if(IsShiftKeyDown()) then - GameTooltip_ShowCompareItem() - end + -- if IsShiftKeyDown() then + -- GameTooltip_ShowCompareItem() + -- end CursorOnUpdate(self) end local function LootClick(frame) - if(IsControlKeyDown()) then + if IsControlKeyDown() then DressUpItemLink(frame.link) - elseif(IsShiftKeyDown()) then + 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 + if frame.rollID ~= rollID then return end frame.rollID = nil frame.time = nil @@ -124,13 +124,13 @@ local function OnEvent(frame, _, rollID) end 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 perc = t / frame.parent.time frame.spark:Point("CENTER", frame, "LEFT", perc * frame:GetWidth(), 0) frame:SetValue(t) - if(t > 1000000000) then + if t > 1000000000 then frame:GetParent():Hide() end end @@ -166,7 +166,7 @@ function M:CreateRollFrame() E:Point(button, "RIGHT", frame, "LEFT", -(E.Spacing*3), 0) E:Size(button, FRAME_HEIGHT - (E.Border * 2)) E:CreateBackdrop(button, "Default") - button:SetScript("OnEnter", SetItemTip) + -- button:SetScript("OnEnter", SetItemTip) button:SetScript("OnLeave", HideTip2) button:SetScript("OnUpdate", ItemOnUpdate) button:SetScript("OnClick", LootClick) @@ -185,7 +185,7 @@ function M:CreateRollFrame() local status = CreateFrame("StatusBar", nil, frame) E:SetInside(status) - status:SetScript("OnUpdate", StatusUpdate) + -- status:SetScript("OnUpdate", StatusUpdate) status:SetFrameLevel(status:GetFrameLevel() - 1) status:SetStatusBarTexture(E["media"].normTex) E:RegisterStatusBar(status) @@ -234,7 +234,7 @@ local function GetFrame() end 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) else 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 function M:START_LOOT_ROLL(_, rollID, time) - if(cancelled_rolls[rollID]) then return end + if cancelled_rolls[rollID] then return end local f = GetFrame() f.rollID = rollID @@ -255,7 +255,7 @@ function M:START_LOOT_ROLL(_, rollID, time) 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) @@ -281,7 +281,7 @@ function M:START_LOOT_ROLL(_, rollID, 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 + if E.db.general.autoRoll and UnitLevel("player") == MAX_PLAYER_LEVEL and quality == 2 and not bindOnPickUp then RollOnLoot(rollID, 2) end end @@ -290,21 +290,21 @@ 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 + 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 + 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 + 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 + 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 @@ -314,7 +314,7 @@ function M:CHAT_MSG_LOOT(_, msg) end 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("START_LOOT_ROLL") From 508c4dbcfddbbf7be533ac86059ceab41a472fe4 Mon Sep 17 00:00:00 2001 From: Logan Payton Date: Thu, 10 May 2018 20:38:09 -0400 Subject: [PATCH 5/8] Spacing --- ElvUI/Modules/Misc/LootRoll.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ElvUI/Modules/Misc/LootRoll.lua b/ElvUI/Modules/Misc/LootRoll.lua index 7e86016..68a3862 100644 --- a/ElvUI/Modules/Misc/LootRoll.lua +++ b/ElvUI/Modules/Misc/LootRoll.lua @@ -255,7 +255,7 @@ function M:START_LOOT_ROLL(_, rollID, time) 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) From 34b97d9dc089f7501b9f4dea189910ae74de2548 Mon Sep 17 00:00:00 2001 From: Logan Payton Date: Thu, 10 May 2018 23:25:24 -0400 Subject: [PATCH 6/8] String replace suffixes --- !Compatibility/api/wowAPI.lua | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/!Compatibility/api/wowAPI.lua b/!Compatibility/api/wowAPI.lua index aa984ac..d1f3661 100644 --- a/!Compatibility/api/wowAPI.lua +++ b/!Compatibility/api/wowAPI.lua @@ -393,6 +393,46 @@ function GetItemInfoByName(itemName) error("Usage: GetItemInfoByName(itemName)", 2) end + if find(itemName, ' of ') then + itemName = gsub(itemName, ' of Spirit', '') + itemName = gsub(itemName, ' of Intellect', '') + itemName = gsub(itemName, ' of Strength', '') + itemName = gsub(itemName, ' of Stamina', '') + itemName = gsub(itemName, ' of Agility', '') + itemName = gsub(itemName, ' of Defense', '') + itemName = gsub(itemName, ' of Nimbleness', '') + itemName = gsub(itemName, ' of Power', '') + itemName = gsub(itemName, ' of Speed', '') + itemName = gsub(itemName, ' of Frozen Wrath', '') + itemName = gsub(itemName, ' of Arcane Wrath', '') + itemName = gsub(itemName, ' of Fiery Wrath', '') + itemName = gsub(itemName, ' of Nature\'s Wrath', '') + itemName = gsub(itemName, ' of Shadow Wrath', '') + itemName = gsub(itemName, ' of Holy Wrath', '') + itemName = gsub(itemName, ' of Healing', '') + itemName = gsub(itemName, ' of Magic', '') + itemName = gsub(itemName, ' of Concentration', '') + itemName = gsub(itemName, ' of Regeneration', '') + itemName = gsub(itemName, ' of Fire Resistance', '') + itemName = gsub(itemName, ' of Nature Resistance', '') + itemName = gsub(itemName, ' of Arcane Resistance', '') + itemName = gsub(itemName, ' of Frost Resistance', '') + itemName = gsub(itemName, ' of Shadow Resistance', '') + itemName = gsub(itemName, ' of the Tiger', '') + itemName = gsub(itemName, ' of the Bear', '') + itemName = gsub(itemName, ' of the Gorilla', '') + itemName = gsub(itemName, ' of the Boar', '') + itemName = gsub(itemName, ' of the Monkey', '') + itemName = gsub(itemName, ' of the Falcon', '') + itemName = gsub(itemName, ' of the Wolf', '') + itemName = gsub(itemName, ' of the Eagle', '') + itemName = gsub(itemName, ' of the Whale', '') + itemName = gsub(itemName, ' of the Owl', '') + itemName = gsub(itemName, ' of Blocking', '') + itemName = gsub(itemName, ' of Eluding', '') + itemName = gsub(itemName, ' of the Invoker', '') + end + if not itemInfoDB[itemName] then local name for itemID = 1, LAST_ITEM_ID do From 7e5f8dc34210faa13463bb46b2b411930a9fde34 Mon Sep 17 00:00:00 2001 From: Logan Payton Date: Fri, 11 May 2018 00:13:44 -0400 Subject: [PATCH 7/8] Double quotes --- !Compatibility/api/wowAPI.lua | 76 +++++++++++++++++------------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/!Compatibility/api/wowAPI.lua b/!Compatibility/api/wowAPI.lua index d1f3661..bdf0ad4 100644 --- a/!Compatibility/api/wowAPI.lua +++ b/!Compatibility/api/wowAPI.lua @@ -393,44 +393,44 @@ function GetItemInfoByName(itemName) error("Usage: GetItemInfoByName(itemName)", 2) end - if find(itemName, ' of ') then - itemName = gsub(itemName, ' of Spirit', '') - itemName = gsub(itemName, ' of Intellect', '') - itemName = gsub(itemName, ' of Strength', '') - itemName = gsub(itemName, ' of Stamina', '') - itemName = gsub(itemName, ' of Agility', '') - itemName = gsub(itemName, ' of Defense', '') - itemName = gsub(itemName, ' of Nimbleness', '') - itemName = gsub(itemName, ' of Power', '') - itemName = gsub(itemName, ' of Speed', '') - itemName = gsub(itemName, ' of Frozen Wrath', '') - itemName = gsub(itemName, ' of Arcane Wrath', '') - itemName = gsub(itemName, ' of Fiery Wrath', '') - itemName = gsub(itemName, ' of Nature\'s Wrath', '') - itemName = gsub(itemName, ' of Shadow Wrath', '') - itemName = gsub(itemName, ' of Holy Wrath', '') - itemName = gsub(itemName, ' of Healing', '') - itemName = gsub(itemName, ' of Magic', '') - itemName = gsub(itemName, ' of Concentration', '') - itemName = gsub(itemName, ' of Regeneration', '') - itemName = gsub(itemName, ' of Fire Resistance', '') - itemName = gsub(itemName, ' of Nature Resistance', '') - itemName = gsub(itemName, ' of Arcane Resistance', '') - itemName = gsub(itemName, ' of Frost Resistance', '') - itemName = gsub(itemName, ' of Shadow Resistance', '') - itemName = gsub(itemName, ' of the Tiger', '') - itemName = gsub(itemName, ' of the Bear', '') - itemName = gsub(itemName, ' of the Gorilla', '') - itemName = gsub(itemName, ' of the Boar', '') - itemName = gsub(itemName, ' of the Monkey', '') - itemName = gsub(itemName, ' of the Falcon', '') - itemName = gsub(itemName, ' of the Wolf', '') - itemName = gsub(itemName, ' of the Eagle', '') - itemName = gsub(itemName, ' of the Whale', '') - itemName = gsub(itemName, ' of the Owl', '') - itemName = gsub(itemName, ' of Blocking', '') - itemName = gsub(itemName, ' of Eluding', '') - itemName = gsub(itemName, ' of the Invoker', '') + if find(itemName, " of ") then + itemName = gsub(itemName, " of Spirit", "") + itemName = gsub(itemName, " of Intellect", "") + itemName = gsub(itemName, " of Strength", "") + itemName = gsub(itemName, " of Stamina", "") + itemName = gsub(itemName, " of Agility", "") + itemName = gsub(itemName, " of Defense", "") + itemName = gsub(itemName, " of Nimbleness", "") + itemName = gsub(itemName, " of Power", "") + itemName = gsub(itemName, " of Speed", "") + itemName = gsub(itemName, " of Frozen Wrath", "") + itemName = gsub(itemName, " of Arcane Wrath", "") + itemName = gsub(itemName, " of Fiery Wrath", "") + itemName = gsub(itemName, " of Nature's Wrath", "") + itemName = gsub(itemName, " of Shadow Wrath", "") + itemName = gsub(itemName, " of Holy Wrath", "") + itemName = gsub(itemName, " of Healing", "") + itemName = gsub(itemName, " of Magic", "") + itemName = gsub(itemName, " of Concentration", "") + itemName = gsub(itemName, " of Regeneration", "") + itemName = gsub(itemName, " of Fire Resistance", "") + itemName = gsub(itemName, " of Nature Resistance", "") + itemName = gsub(itemName, " of Arcane Resistance", "") + itemName = gsub(itemName, " of Frost Resistance", "") + itemName = gsub(itemName, " of Shadow Resistance", "") + itemName = gsub(itemName, " of the Tiger", "") + itemName = gsub(itemName, " of the Bear", "") + itemName = gsub(itemName, " of the Gorilla", "") + itemName = gsub(itemName, " of the Boar", "") + itemName = gsub(itemName, " of the Monkey", "") + itemName = gsub(itemName, " of the Falcon", "") + itemName = gsub(itemName, " of the Wolf", "") + itemName = gsub(itemName, " of the Eagle", "") + itemName = gsub(itemName, " of the Whale", "") + itemName = gsub(itemName, " of the Owl", "") + itemName = gsub(itemName, " of Blocking", "") + itemName = gsub(itemName, " of Eluding", "") + itemName = gsub(itemName, " of the Invoker", "") end if not itemInfoDB[itemName] then From 722de59f80fcb853f67bb76e80713a81a66dd543 Mon Sep 17 00:00:00 2001 From: Logan Payton Date: Tue, 15 May 2018 22:55:08 -0400 Subject: [PATCH 8/8] Might throw a random error but you can actually roll --- ElvUI/Modules/Misc/LootRoll.lua | 44 +++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/ElvUI/Modules/Misc/LootRoll.lua b/ElvUI/Modules/Misc/LootRoll.lua index 7e86016..32592e2 100644 --- a/ElvUI/Modules/Misc/LootRoll.lua +++ b/ElvUI/Modules/Misc/LootRoll.lua @@ -24,6 +24,7 @@ local RAID_CLASS_COLORS = RAID_CLASS_COLORS local pos = "TOP" local cancelled_rolls = {} local FRAME_WIDTH, FRAME_HEIGHT = 328, 28 +local dummy = CreateFrame("FRAME", nil, E.UIParent) M.RollBars = {} local locale = GetLocale() @@ -114,7 +115,8 @@ local function LootClick(frame) end end -local function OnEvent(frame, _, rollID) +local function OnEvent(frame) + local rollID = arg1 cancelled_rolls[rollID] = true if frame.rollID ~= rollID then return end @@ -127,7 +129,7 @@ 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) + E:Point(frame.spark, "CENTER", frame, "LEFT", perc * frame:GetWidth(), 0) frame:SetValue(t) if t > 1000000000 then @@ -135,9 +137,9 @@ local function StatusUpdate(frame) end end -local function CreateRollButton(parent, ntex, ptex, htex, rolltype, tiptext) +local function CreateRollButton(parent, ntex, ptex, htex, rolltype, tiptext, point, relativeFrame, relativePoint, ofsx, ofsy) local f = CreateFrame("Button", nil, parent) - -- E:Point(f, unpack(args)) + E:Point(f, point, relativeFrame, relativePoint, ofsx, ofsy) E:Size(f, FRAME_HEIGHT - 4) f:SetNormalTexture(ntex) if(ptex) then f:SetPushedTexture(ptex) end @@ -145,9 +147,9 @@ local function CreateRollButton(parent, ntex, ptex, htex, rolltype, tiptext) f.rolltype = rolltype f.parent = parent f.tiptext = tiptext - f:SetScript("OnEnter", SetTip) + f:SetScript("OnEnter", function() SetTip(f) end) f:SetScript("OnLeave", HideTip) - f:SetScript("OnClick", ClickRoll) + f:SetScript("OnClick", function() ClickRoll(f) end) local txt = f:CreateFontString(nil, nil) E:FontTemplate(txt, nil, nil, "OUTLINE") E:Point(txt, "CENTER", 0, rolltype == 2 and 1 or rolltype == 0 and -1.2 or 0) @@ -158,7 +160,7 @@ function M:CreateRollFrame() local frame = CreateFrame("Frame", nil, E.UIParent) E:Size(frame, FRAME_WIDTH, FRAME_HEIGHT) E:SetTemplate(frame, "Default") - frame:SetScript("OnEvent", OnEvent) + frame:SetScript("OnEvent", function() OnEvent(frame) end) frame:RegisterEvent("CANCEL_LOOT_ROLL") frame:Hide() @@ -166,10 +168,10 @@ function M:CreateRollFrame() E:Point(button, "RIGHT", frame, "LEFT", -(E.Spacing*3), 0) E:Size(button, FRAME_HEIGHT - (E.Border * 2)) E:CreateBackdrop(button, "Default") - -- button:SetScript("OnEnter", SetItemTip) + button:SetScript("OnEnter", function() SetItemTip(button) end) button:SetScript("OnLeave", HideTip2) - button:SetScript("OnUpdate", ItemOnUpdate) - button:SetScript("OnClick", LootClick) + button:SetScript("OnUpdate", function() ItemOnUpdate(button) end) + button:SetScript("OnClick", function() LootClick(button) end) frame.button = button button.icon = button:CreateTexture(nil, "OVERLAY") @@ -185,7 +187,7 @@ function M:CreateRollFrame() local status = CreateFrame("StatusBar", nil, frame) E:SetInside(status) - -- status:SetScript("OnUpdate", StatusUpdate) + status:SetScript("OnUpdate", function() StatusUpdate(status) end) status:SetFrameLevel(status:GetFrameLevel() - 1) status:SetStatusBarTexture(E["media"].normTex) E:RegisterStatusBar(status) @@ -228,7 +230,7 @@ end local function GetFrame() for _, f in ipairs(M.RollBars) do - if(not f.rollID) then + if not f.rollID then return f end end @@ -255,7 +257,7 @@ function M:START_LOOT_ROLL(_, rollID, time) 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) @@ -282,7 +284,7 @@ function M:START_LOOT_ROLL(_, rollID, time) f:Show() 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 @@ -316,8 +318,18 @@ end function M:LoadLootRoll() if not E.private.general.lootRoll then return end - self:RegisterEvent("CHAT_MSG_LOOT") - self:RegisterEvent("START_LOOT_ROLL") + dummy:RegisterEvent("START_LOOT_ROLL") + -- dummy:RegisterEvent("CHAT_MSG_LOOT") + dummy:SetScript("OnEvent", function() + if event == "START_LOOT_ROLL" then + M:START_LOOT_ROLL("START_LOOT_ROLL", arg1, arg2) + elseif event == "CHAT_MSG_LOOT" then + M:CHAT_MSG_LOOT("CHAT_MSG_LOOT", arg1) + end + end) + + -- self:RegisterEvent("CHAT_MSG_LOOT") + -- self:RegisterEvent("START_LOOT_ROLL") UIParent:UnregisterEvent("START_LOOT_ROLL") UIParent:UnregisterEvent("CANCEL_LOOT_ROLL") end \ No newline at end of file