@@ -2,6 +2,18 @@ local addonName, ns = ...
22
33local freeSlotAlertCooldown = 0
44
5+ -- Keybind support
6+ BINDING_HEADER_AUTOSELLPLUS = " AutoSellPlus"
7+ BINDING_NAME_ASP_TOGGLE_POPUP = " Toggle Sell Popup"
8+
9+ ns .isMerchantOpen = false
10+
11+ function AutoSellPlus_KeybindSell ()
12+ if ns .isMerchantOpen then
13+ ns :ShowPopup ()
14+ end
15+ end
16+
517-- ============================================================
618-- Auto-Repair
719-- ============================================================
@@ -469,6 +481,7 @@ eventFrame:RegisterEvent("MERCHANT_CLOSED")
469481eventFrame :RegisterEvent (" EQUIPMENT_SETS_CHANGED" )
470482eventFrame :RegisterEvent (" UI_ERROR_MESSAGE" )
471483eventFrame :RegisterEvent (" BAG_UPDATE_DELAYED" )
484+ eventFrame :RegisterEvent (" PLAYER_ENTERING_WORLD" )
472485
473486eventFrame :SetScript (" OnEvent" , function (self , event , ...)
474487 if event == " PLAYER_LOGIN" then
@@ -512,6 +525,7 @@ eventFrame:SetScript("OnEvent", function(self, event, ...)
512525 if ns ._FireEvent then ns ._FireEvent (" LOADED" ) end
513526
514527 elseif event == " MERCHANT_SHOW" then
528+ ns .isMerchantOpen = true
515529 if ns .db .enabled then
516530 -- Auto-repair first
517531 ns :SafeCall (DoAutoRepair )
@@ -526,13 +540,15 @@ eventFrame:SetScript("OnEvent", function(self, event, ...)
526540 end
527541
528542 elseif event == " MERCHANT_CLOSED" then
543+ ns .isMerchantOpen = false
529544 ns :HidePopup ()
530545 ns :HideConfirmList ()
531546 ns :StopSelling ()
532547 ns :CancelAutoSell ()
533548 StaticPopup_Hide (" ASP_AUTOSELL_EPIC_CONFIRM" )
534549 StaticPopup_Hide (" ASP_AUTOSELL_HIGHVALUE_CONFIRM" )
535550 StaticPopup_Hide (" ASP_EVICT_CONFIRM" )
551+ StaticPopup_Hide (" ASP_SELL_ALL_CONFIRM" )
536552
537553 elseif event == " EQUIPMENT_SETS_CHANGED" then
538554 ns :RebuildEquipmentSetCache ()
@@ -545,5 +561,16 @@ eventFrame:SetScript("OnEvent", function(self, event, ...)
545561 elseif event == " BAG_UPDATE_DELAYED" then
546562 ns :SafeCall (CheckBagSpace )
547563 ns :SafeCall (function () ns :UpdateCharJunkValue () end )
564+
565+ elseif event == " PLAYER_ENTERING_WORLD" then
566+ local _ , instanceType = GetInstanceInfo ()
567+ local profileName = AutoSellPlusCharDB .instanceProfiles
568+ and AutoSellPlusCharDB .instanceProfiles [instanceType ]
569+ if profileName and profileName ~= " " then
570+ if AutoSellPlusDB .profiles [profileName ] then
571+ ns :LoadProfile (profileName )
572+ ns :Print (format (" Auto-loaded instance profile: |cFF00FF00%s|r (instance type: %s)" , profileName , instanceType ))
573+ end
574+ end
548575 end
549576end )
0 commit comments