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

Commit

Permalink
fix: add a RawPlayer is zero ptr check.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Mar 22, 2023
1 parent 7def3af commit 49a5938
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
8 changes: 5 additions & 3 deletions RotationSolver.Basic/Actions/BaseAction/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,11 @@ public unsafe bool CanUseTo(BattleChara tar)

if (!ActionManager.CanUseActionOnTarget(AdjustedID, tarAddress)) return false;

var id = ActionManager.GetActionInRangeOrLoS(AdjustedID,
(FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)Service.RawPlayer,
tarAddress);
if((IntPtr)Service.RawPlayer == IntPtr.Zero) return false;

var id = ActionManager.GetActionInRangeOrLoS(AdjustedID,
(FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)Service.RawPlayer,
tarAddress);

return id is 0 or 565;
}
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ public static void SetSpecialType(SpecialCommandType specialType)

public static bool HasPet { get; set; }

public static unsafe bool HasCompanion => (IntPtr)CharacterManager.Instance()->LookupBuddyByOwnerObject(Service.RawPlayer) != IntPtr.Zero;
public static unsafe bool HasCompanion => (IntPtr)Service.RawPlayer == IntPtr.Zero ? false :
(IntPtr)CharacterManager.Instance()->LookupBuddyByOwnerObject(Service.RawPlayer) != IntPtr.Zero;

#region HP
public static IEnumerable<float> PartyMembersHP { get; set; }
Expand Down
14 changes: 11 additions & 3 deletions RotationSolver/Updaters/RotationUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,24 +92,32 @@ public static IEnumerable<IGrouping<string, IAction>> AllGroupedActions
{
string result;

if (act.IsGeneralGCD)
{
result = "GCD";
}
else
{
result = LocalizationManager.RightLang.Timeline_Ability;
}

if (act.IsFriendly)
{
result = LocalizationManager.RightLang.Action_Friendly;
result += "-" + LocalizationManager.RightLang.Action_Friendly;
if (act.IsEot)
{
result += "Hot";
}
}
else
{
result = LocalizationManager.RightLang.Action_Attack;
result += "-" + LocalizationManager.RightLang.Action_Attack;

if (act.IsEot)
{
result += "Dot";
}
}
result += "-" + (act.IsRealGCD ? "GCD" : LocalizationManager.RightLang.Timeline_Ability);
return result;
}
else if (a is IBaseItem)
Expand Down

0 comments on commit 49a5938

Please sign in to comment.