From ffac1e400071f4fd197801c33782e1c8af33447c Mon Sep 17 00:00:00 2001 From: andrew6180 <16847730+andrew6180@users.noreply.github.com> Date: Wed, 21 Jun 2023 00:26:27 -0700 Subject: [PATCH] Add leave vehicle button. Change ilvl calc --- ElvUI/Modules/ActionBars/ActionBars.lua | 31 +++++++++++++++++-- .../Modules/Blizzard/CharacterFrame.lua | 5 ++- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/ElvUI/Modules/ActionBars/ActionBars.lua b/ElvUI/Modules/ActionBars/ActionBars.lua index f7c337c..8e05dcf 100644 --- a/ElvUI/Modules/ActionBars/ActionBars.lua +++ b/ElvUI/Modules/ActionBars/ActionBars.lua @@ -324,9 +324,26 @@ function AB:PLAYER_REGEN_ENABLED() self:UnregisterEvent("PLAYER_REGEN_ENABLED") end +local function Vehicle_ExitVehicle(self) + if UnitOnTaxi("player") and TaxiRequestEarlyLanding then + TaxiRequestEarlyLanding(); + -- Show that the request for landing has been received. + self:Disable(); + self:LockHighlight(); + else + VehicleExit(); + end +end + +local function Vehicle_CanExit() + return CanExitVehicle() or TaxiUtil and TaxiUtil.CanStopTaxi() +end + local function Vehicle_OnEvent(self, event) - if CanExitVehicle() and not E.db.general.minimap.icons.vehicleLeave.hide then + if Vehicle_CanExit() and not E.db.general.minimap.icons.vehicleLeave.hide then self:Show() + self:Enable() + self:UnlockHighlight() else self:Hide() end @@ -350,19 +367,27 @@ function AB:CreateVehicleLeave() vehicle:SetFrameStrata("HIGH") vehicle:SetNormalTexture(E.Media.Textures.ExitVehicle) vehicle:SetPushedTexture(E.Media.Textures.ExitVehicle) - vehicle:SetHighlightTexture(E.Media.Textures.ExitVehicle) + vehicle:GetPushedTexture():SetVertexColor(0.6, 0.6, 0.6) + vehicle:SetHighlightTexture(E.Media.Textures.ExitVehicle, "ADD") vehicle:SetTemplate() vehicle:EnableMouse(true) vehicle:RegisterForClicks("AnyUp") + vehicle:SetMotionScriptsWhileDisabled(true) - vehicle:SetScript("OnClick", VehicleExit) + vehicle:SetScript("OnClick", Vehicle_ExitVehicle) vehicle:SetScript("OnEvent", Vehicle_OnEvent) + vehicle:SetScript("OnEnter", MainMenuBarVehicleLeaveButtonMixin.OnEnter) + vehicle:SetScript("OnLeave", GameTooltip_Hide) vehicle:RegisterEvent("PLAYER_ENTERING_WORLD") vehicle:RegisterEvent("UPDATE_BONUS_ACTIONBAR") vehicle:RegisterEvent("UPDATE_MULTI_CAST_ACTIONBAR") vehicle:RegisterEvent("UNIT_ENTERED_VEHICLE") vehicle:RegisterEvent("UNIT_EXITED_VEHICLE") vehicle:RegisterEvent("VEHICLE_UPDATE") + if TaxiUtil then + TaxiUtil:RegisterCallback("TAXI_STARTED", Vehicle_OnEvent, vehicle) + TaxiUtil:RegisterCallback("TAXI_FINISHED", Vehicle_OnEvent, vehicle) + end self.vehicle = vehicle self:UpdateVehicleLeave() diff --git a/ElvUI_Enhanced/Modules/Blizzard/CharacterFrame.lua b/ElvUI_Enhanced/Modules/Blizzard/CharacterFrame.lua index 99f3b50..a9a1d30 100644 --- a/ElvUI_Enhanced/Modules/Blizzard/CharacterFrame.lua +++ b/ElvUI_Enhanced/Modules/Blizzard/CharacterFrame.lua @@ -816,13 +816,16 @@ local function GetAverageItemLevel() -- same ilvl calculation as C_Player:GetAverageItemLevel() for slot = INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED do - if slot ~= INVSLOT_BODY and slot ~= INVSLOT_TABARD and slot ~= INVSLOT_RANGED and slot ~= INVSLOT_OFFHAND then + if slot ~= INVSLOT_BODY and slot ~= INVSLOT_TABARD then local itemLink = GetInventoryItemLink("player", slot) if itemLink then local _, _, quality, itemLevel, _, _, _, _, itemEquipLoc = GetItemInfo(itemLink) if itemLevel then + if slot == INVSLOT_RANGED or slot == INVSLOT_OFFHAND then + items = items + 1 + end ilvl = ilvl + itemLevel colorCount = colorCount + 1