Skip to content

Commit

Permalink
update quest item fix position
Browse files Browse the repository at this point in the history
  • Loading branch information
eltreum0 committed Aug 16, 2022
1 parent 1bf3bfa commit dd4739d
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions ElvUI_EltreumUI/Modules/Misc/QuestItem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,34 +144,38 @@ function ElvUI_EltreumUI:QuestItem()
local bindingText11 = GetBindingKey("CLICK EltruismQuestItem11:LeftButton")
local bindingText12 = GetBindingKey("CLICK EltruismQuestItem12:LeftButton")

--------------------------------------------------------------------------------------------------------
-- Main --
--------------------------------------------------------------------------------------------------------
local function OnUpdate(self,elapsed)
--print("quest item spam "..math.random(1,99))
self.updateTime = (self.updateTime + elapsed)
if (self.updateTime > UPDATE_DELAY) then
self:SetScript("OnUpdate",nil)
self:UpdateButtons()

-- update mover position
-- update mover position
function EltruismQuestItemFrame:FixPosition()
E:Delay(0, function()
if not InCombatLockdown() and _G["EltruismQuestItem1"] then
local point, relativeTo, relativePoint, xOfs, yOfs = EltruismQuestItemFrame:GetPoint()
_G["EltruismQuestItem1"]:ClearAllPoints()
if (#EltruismQuestItemFrame.items % 2) == 0 then
if (self.shownItems % 2) == 0 then
if xOfs >= 0 then
_G["EltruismQuestItem1"]:SetPoint(point, relativeTo, relativePoint, xOfs-(((#EltruismQuestItemFrame.items-1)*cfg.btnSize)/2), yOfs)
_G["EltruismQuestItem1"]:SetPoint(point, relativeTo, relativePoint, xOfs-(((self.shownItems-1)*cfg.btnSize)/2), yOfs)
elseif xOfs < 0 then
_G["EltruismQuestItem1"]:SetPoint(point, relativeTo, relativePoint, xOfs+(((#EltruismQuestItemFrame.items-1)*cfg.btnSize)/2), yOfs)
_G["EltruismQuestItem1"]:SetPoint(point, relativeTo, relativePoint, xOfs+(((self.shownItems-1)*cfg.btnSize)/2), yOfs)
end
else
if xOfs >= 0 then
_G["EltruismQuestItem1"]:SetPoint(point, relativeTo, relativePoint, xOfs-(((#EltruismQuestItemFrame.items-(#EltruismQuestItemFrame.items % 2))*(cfg.btnSize+1))/2), yOfs)
_G["EltruismQuestItem1"]:SetPoint(point, relativeTo, relativePoint, xOfs-(((self.shownItems-(self.shownItems % 2))*(cfg.btnSize+1))/2), yOfs)
elseif xOfs < 0 then
_G["EltruismQuestItem1"]:SetPoint(point, relativeTo, relativePoint, xOfs+(((#EltruismQuestItemFrame.items-(#EltruismQuestItemFrame.items % 2))*(cfg.btnSize-1))/2), yOfs)
_G["EltruismQuestItem1"]:SetPoint(point, relativeTo, relativePoint, xOfs+(((self.shownItems-(self.shownItems % 2))*(cfg.btnSize-1))/2), yOfs)
end
end
end
end)
end

--------------------------------------------------------------------------------------------------------
-- Main --
--------------------------------------------------------------------------------------------------------
local function OnUpdate(self,elapsed)
--print("quest item spam "..math.random(1,99))
self.updateTime = (self.updateTime + elapsed)
if (self.updateTime > UPDATE_DELAY) then
self:SetScript("OnUpdate",nil)
self:UpdateButtons()
end
end

Expand Down Expand Up @@ -312,6 +316,9 @@ function ElvUI_EltreumUI:QuestItem()
btn:SetPoint("LEFT",EltruismQuestItemFrame.items[index - 1],"RIGHT",1,0)
end
btn:Show()

-- update mover position
EltruismQuestItemFrame:FixPosition()
end

-- Check Item -- Az: Some items which starts a quest, are not marked as "Quest" in itemType or itemSubType. Ex: item:17008
Expand Down Expand Up @@ -486,6 +493,8 @@ function ElvUI_EltreumUI:QuestItem()
function EltruismQuestItemFrame:UNIT_INVENTORY_CHANGED(event,unit)
if (unit == "player") then
self:RequestUpdate()
-- update mover position
EltruismQuestItemFrame:FixPosition()
end
end
end
Expand Down

0 comments on commit dd4739d

Please sign in to comment.