1
0
Fork 0
forked from aly/qstbak

muffin v7.5.12

This commit is contained in:
alydev 2026-08-19 13:19:57 +10:00
parent 3102923ce2
commit 911ed68baa
65 changed files with 2356 additions and 1539 deletions

View file

@ -32,6 +32,7 @@ internal static class AethernetRide
private enum EAethernetPhase
{
None,
WaitingForPlayer,
Mounting,
Moving,
Unmounting,
@ -72,6 +73,12 @@ internal static class AethernetRide
return Environment.TickCount64 - _phaseStartedAt > (long)(timeoutSeconds * 1000f);
}
public override void ResetTimeout()
{
base.ResetTimeout();
_phaseStartedAt = Environment.TickCount64;
}
protected override bool Start()
{
SetPhase(EAethernetPhase.None);
@ -79,56 +86,60 @@ internal static class AethernetRide
aethernetTeleportService.Reset();
if (aetheryteFunctions.IsAetheryteUnlocked(base.Task.From) && aetheryteFunctions.IsAetheryteUnlocked(base.Task.To))
{
uint territoryType = clientState.TerritoryType;
IPlayerCharacter localPlayer = objectTable.LocalPlayer;
if (localPlayer == null)
{
return false;
}
Vector3 playerPosition = localPlayer.Position;
if (aetheryteData.CalculateDistance(playerPosition, territoryType, base.Task.From) < aetheryteData.CalculateDistance(playerPosition, territoryType, base.Task.To))
{
float num = (base.Task.From.IsFirmamentAetheryte() ? 11f : (AetheryteConverter.IsLargeAetheryte(base.Task.From) ? 11f : 4f));
if (aetheryteData.CalculateDistance(playerPosition, territoryType, base.Task.From) < num)
{
BeginTeleport();
return true;
}
if (base.Task.From == EAetheryteLocation.SolutionNine)
{
logger.LogDebug("Moving to S9 aetheryte");
int num2 = 4;
List<Vector3> list = new List<Vector3>(num2);
CollectionsMarshal.SetCount(list, num2);
Span<Vector3> span = CollectionsMarshal.AsSpan(list);
span[0] = new Vector3(0f, 8.442986f, 9f);
span[1] = new Vector3(9f, 8.442986f, 0f);
span[2] = new Vector3(-9f, 8.442986f, 0f);
span[3] = new Vector3(0f, 8.442986f, -9f);
Vector3 to = list.MinBy((Vector3 x) => Vector3.Distance(playerPosition, x));
SetPhase(EAethernetPhase.Moving);
movementController.NavigateTo(EMovementType.Quest, (uint)base.Task.From, to, fly: false, sprint: true, 0.25f);
return true;
}
if (territoryData.CanUseMount(territoryType) && aetheryteData.CalculateDistance(playerPosition, territoryType, base.Task.From) > 30f && !gameFunctions.HasStatusPreventingMount() && gameFunctions.Mount())
{
SetPhase(EAethernetPhase.Mounting);
_continueAt = Environment.TickCount64 + 500;
return true;
}
StartMoving();
SetPhase(EAethernetPhase.WaitingForPlayer);
return true;
}
Vector3 position = localPlayer.Position;
if (HasArrived(position))
{
return false;
}
StartFromCurrentPosition(position);
return true;
}
if (clientState.TerritoryType == aetheryteData.TerritoryIds[base.Task.To])
{
logger.LogWarning("Aethernet ride not unlocked (from: {FromAetheryte}, to: {ToAetheryte}), skipping as we are already in the destination territory", base.Task.From, base.Task.To);
return false;
}
throw new TaskException($"Aethernet ride not unlocked (from: {base.Task.From}, to: {base.Task.To})");
}
private void StartFromCurrentPosition(Vector3 playerPosition)
{
uint territoryType = clientState.TerritoryType;
float num = (base.Task.From.IsFirmamentAetheryte() ? 11f : (AetheryteConverter.IsLargeAetheryte(base.Task.From) ? 11f : 4f));
if (aetheryteData.CalculateDistance(playerPosition, territoryType, base.Task.From) < num)
{
BeginTeleport();
}
else if (base.Task.From == EAetheryteLocation.SolutionNine)
{
logger.LogDebug("Moving to S9 aetheryte");
int num2 = 4;
List<Vector3> list = new List<Vector3>(num2);
CollectionsMarshal.SetCount(list, num2);
Span<Vector3> span = CollectionsMarshal.AsSpan(list);
span[0] = new Vector3(0f, 8.442986f, 9f);
span[1] = new Vector3(9f, 8.442986f, 0f);
span[2] = new Vector3(-9f, 8.442986f, 0f);
span[3] = new Vector3(0f, 8.442986f, -9f);
Vector3 to = list.MinBy((Vector3 x) => Vector3.Distance(playerPosition, x));
SetPhase(EAethernetPhase.Moving);
movementController.NavigateTo(EMovementType.Quest, (uint)base.Task.From, to, fly: false, sprint: true, 0.25f);
}
else if (territoryData.CanUseMount(territoryType) && aetheryteData.CalculateDistance(playerPosition, territoryType, base.Task.From) > 30f && !gameFunctions.HasStatusPreventingMount() && gameFunctions.Mount())
{
SetPhase(EAethernetPhase.Mounting);
_continueAt = Environment.TickCount64 + 500;
}
else
{
if (clientState.TerritoryType != aetheryteData.TerritoryIds[base.Task.To])
{
throw new TaskException($"Aethernet ride not unlocked (from: {base.Task.From}, to: {base.Task.To})");
}
logger.LogWarning("Aethernet ride not unlocked (from: {FromAetheryte}, to: {ToAetheryte}), skipping as we are already in the destination territory", base.Task.From, base.Task.To);
StartMoving();
}
return false;
}
private void StartMoving()
@ -178,6 +189,20 @@ internal static class AethernetRide
}
switch (_phase)
{
case EAethernetPhase.WaitingForPlayer:
{
Vector3? vector2 = objectTable.LocalPlayer?.Position;
if (!vector2.HasValue)
{
return ETaskResult.StillRunning;
}
if (HasArrived(vector2.Value))
{
return ETaskResult.TaskComplete;
}
StartFromCurrentPosition(vector2.Value);
return ETaskResult.StillRunning;
}
case EAethernetPhase.Mounting:
if (condition[ConditionFlag.Mounted])
{
@ -228,21 +253,7 @@ internal static class AethernetRide
{
return ETaskResult.StillRunning;
}
if (aetheryteData.IsAirshipLanding(base.Task.To))
{
if (aetheryteData.CalculateAirshipLandingDistance(vector.Value, clientState.TerritoryType, base.Task.To) > 5f)
{
return ETaskResult.StillRunning;
}
}
else if (aetheryteData.IsCityAetheryte(base.Task.To) || aetheryteData.IsGoldSaucerAetheryte(base.Task.To))
{
if (aetheryteData.CalculateDistance(vector.Value, clientState.TerritoryType, base.Task.To) > 20f)
{
return ETaskResult.StillRunning;
}
}
else if (clientState.TerritoryType != aetheryteData.TerritoryIds[base.Task.To])
if (!HasArrived(vector.Value))
{
return ETaskResult.StillRunning;
}
@ -254,6 +265,15 @@ internal static class AethernetRide
}
}
private bool HasArrived(Vector3 position)
{
if (!aetheryteData.IsAirshipLanding(base.Task.To))
{
return aetheryteData.CalculateDistance(position, clientState.TerritoryType, base.Task.To) <= 20f;
}
return aetheryteData.CalculateAirshipLandingDistance(position, clientState.TerritoryType, base.Task.To) <= 5f;
}
public override bool ShouldInterruptOnDamage()
{
return true;