Skip to content

Commit

Permalink
Disable AutoOpen if not allowed in PvP
Browse files Browse the repository at this point in the history
  • Loading branch information
MidoriKami committed Jun 28, 2024
1 parent 60645ea commit 01c1f4d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Window/WindowManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@ public void AddWindow(Window window, WindowFlags? windowFlags = null) {
if (window.WindowFlags.HasFlag(WindowFlags.OpenImmediately)) {
var isLoggedIn = ClientState.IsLoggedIn;
var requiresLoggedIn = window.WindowFlags.HasFlag(WindowFlags.RequireLoggedIn);
var disallowInPvP = !window.WindowFlags.HasFlag(WindowFlags.AllowInPvP);
var isInPvP = ClientState.IsPvP;

if (!requiresLoggedIn || (requiresLoggedIn && isLoggedIn)) {
var loginCheckPass = !requiresLoggedIn || (requiresLoggedIn && isLoggedIn);
var pvpCheckPass = !disallowInPvP || (disallowInPvP && isInPvP);

if (loginCheckPass && pvpCheckPass) {
window.UnCollapseOrShow();
}
}
Expand Down

0 comments on commit 01c1f4d

Please sign in to comment.