From 9157d96ea46f48fd584d78adc6921dd201c93a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com> Date: Mon, 30 Jan 2023 23:48:14 +0800 Subject: [PATCH] fix: friends targeting changed. --- RotationSolver/Updaters/TargetUpdater_Friends.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/RotationSolver/Updaters/TargetUpdater_Friends.cs b/RotationSolver/Updaters/TargetUpdater_Friends.cs index 06ac7ed64..4f069eb05 100644 --- a/RotationSolver/Updaters/TargetUpdater_Friends.cs +++ b/RotationSolver/Updaters/TargetUpdater_Friends.cs @@ -112,15 +112,13 @@ internal unsafe static void UpdateFriends() : party.Where(obj => obj != null && obj.GameObject is BattleChara).Select(obj => obj.GameObject as BattleChara); //添加亲信 - PartyMembers = PartyMembers.Union(Service.ObjectTable.Where(obj => obj.SubKind == 9 && obj is BattleChara).Cast()); + PartyMembers = PartyMembers.Union(Service.ObjectTable.OfType().Where(obj => obj.SubKind == 9)); - HavePet = Service.ObjectTable.Where(obj => obj != null && obj is BattleNpc npc - && npc.BattleNpcKind == BattleNpcSubKind.Pet - && npc.OwnerId == Service.ClientState.LocalPlayer.ObjectId).Count() > 0; + var mayPet = Service.ObjectTable.OfType().Where(npc => npc.OwnerId == Service.ClientState.LocalPlayer.ObjectId); - HaveChocobo = Service.ObjectTable.Where(obj => obj != null && obj is BattleNpc npc - && npc.BattleNpcKind == BattleNpcSubKind.Chocobo - && npc.OwnerId == Service.ClientState.LocalPlayer.ObjectId).Count() > 0; + HavePet = mayPet.Any(npc => npc.BattleNpcKind == BattleNpcSubKind.Pet); + + HaveChocobo = mayPet.Any(npc => npc.BattleNpcKind == BattleNpcSubKind.Chocobo); AllianceMembers = Service.ObjectTable.OfType();