Skip to content

Commit

Permalink
[improve] support to priority
Browse files Browse the repository at this point in the history
  • Loading branch information
Garume committed Nov 30, 2024
1 parent 666bb5e commit 6d0270d
Showing 1 changed file with 119 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.ClientState.Statuses;
using Dalamud.Interface.Components;
Expand Down Expand Up @@ -190,6 +191,120 @@ public override void OnGainBuffEffect(uint sourceId, Status Status)
throw new ArgumentOutOfRangeException();
}
}
else if (C.Mode == Mode.Priority)
{
var earlyPriority = (C.PriorityList.GetPlayers(x =>
((IPlayerCharacter)x.IGameObject).StatusList.Any(y =>
y is { StatusId: (uint)Debuff.Fire, RemainingTime: < 15 })) ?? [])
.Select(x => (IPlayerCharacter)x.IGameObject);
var middlePriority = (C.PriorityList.GetPlayers(x =>
((IPlayerCharacter)x.IGameObject).StatusList.Any(y =>
y is { StatusId: (uint)Debuff.Fire, RemainingTime: >= 15 and < 25 })) ?? [])
.Select(x => (IPlayerCharacter)x.IGameObject);
var latePriority = (C.PriorityList.GetPlayers(x =>
((IPlayerCharacter)x.IGameObject).StatusList.Any(y =>
y is { StatusId: (uint)Debuff.Fire, RemainingTime: >= 25 })) ?? [])
.Select(x => (IPlayerCharacter)x.IGameObject);


var index = 0;
foreach (var player in earlyPriority)
if (player.GetRole() != CombatRole.DPS)
{
_playerDatas[player.GameObjectId] = new PlayerData
{
PlayerName = player.Name.ToString(),
KindFire = KindFire.Early,
Number = 3,
Direction = Direction.South
};
}
else
{
// West
if (index == 0)
{
_playerDatas[player.GameObjectId] = new PlayerData
{
PlayerName = player.Name.ToString(),
KindFire = KindFire.Early,
Number = 1,
Direction = Direction.NorthWest
};
index++;
}
// East
else
{
_playerDatas[player.GameObjectId] = new PlayerData
{
PlayerName = player.Name.ToString(),
KindFire = KindFire.Early,
Number = 2,
Direction = Direction.NorthEast
};
}
}

foreach (var player in middlePriority)
if (player.GetRole() != CombatRole.DPS)
_playerDatas[player.GameObjectId] = new PlayerData
{
PlayerName = player.Name.ToString(),
KindFire = KindFire.Middle,
Number = 1,
Direction = Direction.West
};
else
_playerDatas[player.GameObjectId] = new PlayerData
{
PlayerName = player.Name.ToString(),
KindFire = KindFire.Middle,
Number = 2,
Direction = Direction.East
};

index = 0;
foreach (var player in latePriority)
if (player.GetRole() != CombatRole.DPS)
{
// West
if (index == 0)
{
_playerDatas[player.GameObjectId] = new PlayerData
{
PlayerName = player.Name.ToString(),
KindFire = KindFire.Late,
Number = 1,
Direction = Direction.SouthWest
};
index++;
}
// East
else
{
_playerDatas[player.GameObjectId] = new PlayerData
{
PlayerName = player.Name.ToString(),
KindFire = KindFire.Late,
Number = 2,
Direction = Direction.SouthEast
};
}
}
else
{
_playerDatas[player.GameObjectId] = new PlayerData
{
PlayerName = player.Name.ToString(),
KindFire = KindFire.Late,
Number = 3,
Direction = Direction.South
};
}

if (_playerDatas.Count != 8) DuoLog.Warning("Error: Not all players are assigned");
}
}

if (_state == State.End) return;
Expand All @@ -199,7 +314,7 @@ public override void OnGainBuffEffect(uint sourceId, Status Status)
var clockwise = Status.Param == 348 ? Clockwise.Clockwise : Clockwise.CounterClockwise;
var position = sourceId.GetObject()?.Position ?? throw new InvalidOperationException();
var direction = GetDirection(position);
var basedDirection = (Direction)(((int)direction - (int)_baseDirection.Value - 90));
var basedDirection = (Direction)((int)direction - (int)_baseDirection.Value - 90);
if (basedDirection < 0) basedDirection += 360;

_hourglasses[basedDirection] = new Hourglass { Clockwise = clockwise, Direction = direction };
Expand Down Expand Up @@ -345,9 +460,9 @@ public override void OnSettingsDraw()
}
else if (C.Mode == Mode.Priority)
{
ImGuiEx.Text(EColor.RedBright, "No implementation yet");
ImGuiEx.Text(EColor.RedBright, "Please use Marker mode for now");
// C.PriorityList.Draw();
ImGui.Text("West");
C.PriorityList.Draw();
ImGui.Text("East");
}

ImGui.Unindent();
Expand Down

0 comments on commit 6d0270d

Please sign in to comment.