Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: no attacking on authors and contributors in PvP!
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Nov 5, 2023
1 parent 561718d commit 5abab09
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
15 changes: 15 additions & 0 deletions RotationSolver/Commands/RSCommands_Actions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Objects.SubKinds;
using ECommons.DalamudServices;
using ECommons.GameHelpers;
using RotationSolver.Basic.Configuration;
using RotationSolver.Helpers;
using RotationSolver.Localization;
using RotationSolver.UI;
using RotationSolver.Updaters;
Expand Down Expand Up @@ -48,6 +50,19 @@ public static void DoAction()
ControlWindow.DidTime = DateTime.Now;
}

if (nextAction is BaseAction act1 && act1.Target is PlayerCharacter p)
{
var hash = SocialUpdater.EncryptString(p);

//Don't attack authors and contributors!!
if (RotationUpdater.AuthorHashes.ContainsKey(hash)
|| DownloadHelper.ContributorsHash.Contains(hash))
{
Svc.Chat.PrintError("Please don't attack RS developers with RS!");
return;
}
}

#if DEBUG
//if (nextAction is BaseAction acti)
// Svc.Log.Debug($"Will Do {acti}");
Expand Down
12 changes: 12 additions & 0 deletions RotationSolver/Updaters/TargetUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using FFXIVClientStructs.FFXIV.Client.UI;
using Lumina.Excel.GeneratedSheets;
using RotationSolver.Basic.Configuration;
using RotationSolver.Helpers;
using System.Text.RegularExpressions;
using Action = Lumina.Excel.GeneratedSheets.Action;

Expand Down Expand Up @@ -103,6 +104,17 @@ private unsafe static void UpdateHostileTargets(IEnumerable<BattleChara> allTarg
DataCenter.AllHostileTargets = allTargets.Where(b =>
{
if (b.StatusList.Any(StatusHelper.IsInvincible)) return false;

if (b is PlayerCharacter p)
{
var hash = SocialUpdater.EncryptString(p);

//Don't attack authors!!
if (RotationUpdater.AuthorHashes.ContainsKey(hash)) return false;

//Don't attack contributors!!
if (DownloadHelper.ContributorsHash.Contains(hash)) return false;
}
return true;
});

Expand Down

0 comments on commit 5abab09

Please sign in to comment.