diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index e5f5a4b..2f0a65d 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -759,6 +759,15 @@ Private.load_prototype = { optional = true, events = {"PLAYER_DEAD", "PLAYER_ALIVE", "PLAYER_UNGHOST"} }, + { + name = "pvpmode", + display = L["PvP Mode Active"], + type = "tristate", + init = "arg", + width = WeakAuras.normalWidth, + optional = true, + events = {"PLAYER_FLAGS_CHANGED", "UNIT_FACTION", "ZONE_CHANGED"} + }, { name = "never", display = L["Never"], diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 8c1e142..33eba8e 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -1202,6 +1202,7 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) local inCombat = UnitAffectingCombat("player") -- or UnitAffectingCombat("pet"); local alive = not UnitIsDeadOrGhost('player') + local pvp = UnitIsPVPFreeForAll("player") or UnitIsPVP("player") local vehicle = UnitInVehicle("player") or UnitOnTaxi("player") local vehicleUi = UnitHasVehicleUI("player") @@ -1218,8 +1219,8 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) if (data and not data.controlledChildren) then local loadFunc = loadFuncs[id]; local loadOpt = loadFuncsForOptions[id]; - shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, alive, vehicle, vehicleUi, group, player, realm, class, faction, playerLevel, zone, zoneId, size, difficulty); - couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, alive, vehicle, vehicleUi, group, player, realm, class, faction, playerLevel, zone, zoneId, size, difficulty); + shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, alive, pvp, vehicle, vehicleUi, group, player, realm, class, faction, playerLevel, zone, zoneId, size, difficulty); + couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, alive, pvp, vehicle, vehicleUi, group, player, realm, class, faction, playerLevel, zone, zoneId, size, difficulty); if(shouldBeLoaded and not loaded[id]) then changed = changed + 1; @@ -1299,6 +1300,7 @@ loadFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") loadFrame:RegisterEvent("PLAYER_DEAD") loadFrame:RegisterEvent("PLAYER_ALIVE") loadFrame:RegisterEvent("PLAYER_UNGHOST") +loadFrame:RegisterEvent("PLAYER_FLAGS_CHANGED") local unitLoadFrame = CreateFrame("FRAME"); WeakAuras.unitLoadFrame = unitLoadFrame; @@ -1307,6 +1309,7 @@ WeakAuras.frames["Display Load Handling 2"] = unitLoadFrame; unitLoadFrame:RegisterEvent("UNIT_FLAGS"); unitLoadFrame:RegisterEvent("UNIT_ENTERED_VEHICLE"); unitLoadFrame:RegisterEvent("UNIT_EXITED_VEHICLE"); +unitLoadFrame:RegisterEvent("UNIT_FACTION"); function Private.RegisterLoadEvents() loadFrame:SetScript("OnEvent", function(frame, ...)