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

Commit

Permalink
fix: changed the receiveEffects.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 14, 2023
1 parent 1631507 commit 92e20db
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
9 changes: 6 additions & 3 deletions RotationSolver.Basic/Data/ActionEffectSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ public unsafe struct ActionEffectSet
public Action Action { get; }
public ActionType Type { get; }
public GameObject Target { get; }
public GameObject Source { get; }
public TargetEffect[] TargetEffects { get; }
public ActionEffectSet(ActionEffectHeader* effectHeader, ActionEffect* effectArray, ulong* effectTargets)
public ActionEffectSet(uint sourceId, ActionEffectHeader* effectHeader, ActionEffect* effectArray, ulong* effectTargets)
{
Type = effectHeader->actionType;
Action = Service.GetSheet<Action>().GetRow(effectHeader->actionId);
Target = Service.ObjectTable.SearchById(effectHeader->animationTargetId);
Source = Service.ObjectTable.SearchById(sourceId);

TargetEffects = new TargetEffect[effectHeader->NumTargets];
for (int i = 0; i < effectHeader->NumTargets; i++)
Expand All @@ -24,8 +26,9 @@ public ActionEffectSet(ActionEffectHeader* effectHeader, ActionEffect* effectArr

public override string ToString()
{
var str = $"Type: {Type}, Name: {Action?.Name}, Target:{Target?.Name}";
if(TargetEffects != null)
var str = $"S:{Source?.Name}, T:{Target?.Name}";
str += $"\nType: {Type}, Name: {Action?.Name}({Action?.RowId})";
if (TargetEffects != null)
{
foreach (var effect in TargetEffects)
{
Expand Down
6 changes: 5 additions & 1 deletion RotationSolver/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ internal Assembly LoadFromFile(string filePath)
{
using var file = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
var pdbPath = Path.ChangeExtension(filePath, ".pdb");
if (!File.Exists(pdbPath)) return LoadFromStream(file);
if (!File.Exists(pdbPath))
{
PluginLog.Information($"Failed to load{pdbPath}");
return LoadFromStream(file);
}
using var pdbFile = File.Open(pdbPath, FileMode.Open, FileAccess.Read, FileShare.Read);
var assembly = LoadFromStream(file, pdbFile);
return assembly;
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/Watcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private static unsafe void ReceiveAbilityEffect(uint sourceId, IntPtr sourceChar

try
{
var set = new ActionEffectSet(effectHeader, effectArray, effectTargets);
var set = new ActionEffectSet(sourceId, effectHeader, effectArray, effectTargets);

ActionFromSelf(sourceId, set);
ActionFromEnemy(sourceId, set);
Expand All @@ -56,6 +56,7 @@ private static void ActionFromEnemy(uint sourceId, ActionEffectSet set)
if (source is not BattleChara battle) return;
if (battle is PlayerCharacter) return;
if (battle.SubKind == 9) return; //Friend!
if (Service.ObjectTable.SearchById(battle.ObjectId) is PlayerCharacter) return;

ShowStrEnemy = set.ToString();
}
Expand Down

0 comments on commit 92e20db

Please sign in to comment.