muffin v7.38.8
This commit is contained in:
parent
5e2d8f648b
commit
3e10cbbbf2
51 changed files with 2585 additions and 1972 deletions
|
|
@ -6,7 +6,6 @@ using System.Runtime.InteropServices;
|
|||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Game.ClientState.Objects.Enums;
|
||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
|
|
@ -323,12 +322,13 @@ internal sealed class CombatController : IDisposable
|
|||
}
|
||||
}
|
||||
}
|
||||
IGameObject localPlayer = _objectTable[0];
|
||||
IGameObject gameObject = (from x in _objectTable
|
||||
select new
|
||||
{
|
||||
GameObject = x,
|
||||
Priority = GetKillPriority(x).Priority,
|
||||
Distance = Vector3.Distance(x.Position, _clientState.LocalPlayer.Position)
|
||||
Distance = Vector3.Distance(x.Position, localPlayer?.Position ?? Vector3.Zero)
|
||||
} into x
|
||||
where x.Priority > 0
|
||||
orderby x.Priority descending, x.Distance
|
||||
|
|
@ -355,7 +355,8 @@ internal sealed class CombatController : IDisposable
|
|||
}
|
||||
if (gameObject is IBattleNpc battleNpc && battleNpc.StatusFlags.HasFlag(StatusFlags.InCombat))
|
||||
{
|
||||
if (gameObject.TargetObjectId == _clientState.LocalPlayer?.GameObjectId)
|
||||
IGameObject? gameObject2 = _objectTable[0];
|
||||
if (gameObject.TargetObjectId == gameObject2?.GameObjectId)
|
||||
{
|
||||
return (Priority: num.Value + 150, Reason: text + "/Targeted");
|
||||
}
|
||||
|
|
@ -393,11 +394,12 @@ internal sealed class CombatController : IDisposable
|
|||
}
|
||||
List<ComplexCombatData> complexCombatDatas = _currentFight.Data.ComplexCombatDatas;
|
||||
GameObject* address = (GameObject*)gameObject.Address;
|
||||
if (address->FateId != 0 && _currentFight.Data.SpawnType != EEnemySpawnType.FateEnemies && gameObject.TargetObjectId != _clientState.LocalPlayer?.GameObjectId)
|
||||
IGameObject gameObject2 = _objectTable[0];
|
||||
if (address->FateId != 0 && _currentFight.Data.SpawnType != EEnemySpawnType.FateEnemies && gameObject.TargetObjectId != gameObject2?.GameObjectId)
|
||||
{
|
||||
return (Priority: null, Reason: "FATE mob");
|
||||
}
|
||||
Vector3 value = _clientState.LocalPlayer?.Position ?? Vector3.Zero;
|
||||
Vector3 value = gameObject2?.Position ?? Vector3.Zero;
|
||||
bool flag = _currentFight.Data.SpawnType != EEnemySpawnType.FinishCombatIfAny && (_currentFight.Data.SpawnType != EEnemySpawnType.OverworldEnemies || !(Vector3.Distance(value, battleNpc.Position) >= 50f)) && _currentFight.Data.SpawnType != EEnemySpawnType.FateEnemies;
|
||||
if (complexCombatDatas.Count > 0)
|
||||
{
|
||||
|
|
@ -430,6 +432,7 @@ internal sealed class CombatController : IDisposable
|
|||
|
||||
private void SetTarget(IGameObject? target)
|
||||
{
|
||||
IGameObject gameObject = _objectTable[0];
|
||||
if (target == null)
|
||||
{
|
||||
if (_targetManager.Target != null)
|
||||
|
|
@ -438,9 +441,9 @@ internal sealed class CombatController : IDisposable
|
|||
_targetManager.Target = null;
|
||||
}
|
||||
}
|
||||
else if (Vector3.Distance(_clientState.LocalPlayer.Position, target.Position) > 55f)
|
||||
else if (gameObject != null && Vector3.Distance(gameObject.Position, target.Position) > 55f)
|
||||
{
|
||||
_logger.LogInformation("Moving to target, distance: {Distance:N2}", Vector3.Distance(_clientState.LocalPlayer.Position, target.Position));
|
||||
_logger.LogInformation("Moving to target, distance: {Distance:N2}", Vector3.Distance(gameObject.Position, target.Position));
|
||||
MoveToTarget(target);
|
||||
}
|
||||
else
|
||||
|
|
@ -468,39 +471,45 @@ internal sealed class CombatController : IDisposable
|
|||
|
||||
private void MoveToTarget(IGameObject gameObject)
|
||||
{
|
||||
IPlayerCharacter localPlayer = _clientState.LocalPlayer;
|
||||
if (localPlayer == null)
|
||||
IGameObject gameObject2 = _objectTable[0];
|
||||
if (gameObject2 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
float num = localPlayer.HitboxRadius + gameObject.HitboxRadius;
|
||||
float num2 = Vector3.Distance(localPlayer.Position, gameObject.Position);
|
||||
byte? b = localPlayer.ClassJob.ValueNullable?.Role;
|
||||
bool flag;
|
||||
if (b.HasValue)
|
||||
float num = gameObject2.HitboxRadius + gameObject.HitboxRadius;
|
||||
float num2 = Vector3.Distance(gameObject2.Position, gameObject.Position);
|
||||
ICharacter character = gameObject2 as ICharacter;
|
||||
bool flag = character != null;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
byte valueOrDefault = b.GetValueOrDefault();
|
||||
if ((uint)(valueOrDefault - 3) <= 1u)
|
||||
byte? b = character.ClassJob.ValueNullable?.Role;
|
||||
if (b.HasValue)
|
||||
{
|
||||
flag = true;
|
||||
goto IL_008e;
|
||||
byte valueOrDefault = b.GetValueOrDefault();
|
||||
if ((uint)(valueOrDefault - 3) <= 1u)
|
||||
{
|
||||
flag2 = true;
|
||||
goto IL_00a3;
|
||||
}
|
||||
}
|
||||
flag2 = false;
|
||||
goto IL_00a3;
|
||||
}
|
||||
flag = false;
|
||||
goto IL_008e;
|
||||
IL_008e:
|
||||
goto IL_00a7;
|
||||
IL_00a7:
|
||||
float num3 = (flag ? 20f : 2.9f);
|
||||
bool flag2 = num2 - num >= num3;
|
||||
bool flag3 = IsInLineOfSight(gameObject);
|
||||
if (flag2 || !flag3)
|
||||
bool flag3 = num2 - num >= num3;
|
||||
bool flag4 = IsInLineOfSight(gameObject);
|
||||
if (flag3 || !flag4)
|
||||
{
|
||||
bool flag4 = num2 - num > 5f;
|
||||
if (!flag2 && !flag3)
|
||||
bool flag5 = num2 - num > 5f;
|
||||
if (!flag3 && !flag4)
|
||||
{
|
||||
num3 = Math.Min(num3, num2) / 2f;
|
||||
flag4 = true;
|
||||
flag5 = true;
|
||||
}
|
||||
if (!flag4)
|
||||
if (!flag5)
|
||||
{
|
||||
_logger.LogInformation("Moving to {TargetName} ({BaseId}) to attack", gameObject.Name, gameObject.BaseId);
|
||||
MovementController movementController = _movementController;
|
||||
|
|
@ -518,11 +527,20 @@ internal sealed class CombatController : IDisposable
|
|||
_movementController.NavigateTo(EMovementType.Combat, null, gameObject.Position, fly: false, sprint: false, num3 + num - 0.25f, float.MaxValue);
|
||||
}
|
||||
}
|
||||
return;
|
||||
IL_00a3:
|
||||
flag = flag2;
|
||||
goto IL_00a7;
|
||||
}
|
||||
|
||||
internal unsafe bool IsInLineOfSight(IGameObject target)
|
||||
{
|
||||
Vector3 position = _clientState.LocalPlayer.Position;
|
||||
IGameObject gameObject = _objectTable[0];
|
||||
if (gameObject == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Vector3 position = gameObject.Position;
|
||||
position.Y += 2f;
|
||||
Vector3 position2 = target.Position;
|
||||
position2.Y += 2f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue