Skip to content

Commit

Permalink
Update format of Aptitude console logs (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
SzymonKaminski committed May 3, 2024
1 parent 57227f5 commit be10d49
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
5 changes: 5 additions & 0 deletions UdpHosts/GameServer/Entities/BaseAptitudeEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public BaseAptitudeEntity(IShard shard, ulong eid)

public List<EffectState> GetActiveEffects() => ActiveEffects.ToList<EffectState>();

public override string ToString()
{
return $"{GetType().Name} ({EntityId})";
}

public EffectState AddEffect(Effect effect, Context context)
{
byte firstFreeIndex = InvalidIndex;
Expand Down
5 changes: 5 additions & 0 deletions UdpHosts/GameServer/Entities/Character/CharacterEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ public CharacterEntity(IShard shard, ulong eid)

internal MovementStateContainer MovementStateContainer { get; set; } = new();

public override string ToString()
{
return IsPlayerControlled ? StaticInfo.DisplayName : base.ToString();
}

public void LoadMonster(uint typeId)
{
// TODO: GetMonsterVisualOptions
Expand Down
10 changes: 6 additions & 4 deletions UdpHosts/GameServer/Systems/Aptitude/Chain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public bool Execute(Context context, ExecutionMethod method = ExecutionMethod.An

if (debug)
{
Console.WriteLine($"Executing Chain {Id} ({context.ExecutionHint}), Self {context.Self}, Initiator {context.Initiator}, Target {context.Targets.FirstOrDefault()}");
Console.WriteLine($"Executing Chain {Id} ({context.ExecutionHint}), Self: {context.Self}, Initiator: {context.Initiator}, Target: {context.Targets.FirstOrDefault()?.ToString() ?? "none"}");
}

if (method == ExecutionMethod.AndChain)
Expand All @@ -38,7 +38,8 @@ public bool Execute(Context context, ExecutionMethod method = ExecutionMethod.An
{
if (debug)
{
Console.WriteLine($"Chain {Id} - Executing Command {command}");
var hasMoreInfo = command.ToString() != command.GetType().ToString();
Console.WriteLine($"Chain {Id} - Executing {(hasMoreInfo ? command : command.GetType().Name)}");
}

bool commandSuccess = command.Execute(context);
Expand All @@ -58,7 +59,8 @@ public bool Execute(Context context, ExecutionMethod method = ExecutionMethod.An
{
if (debug)
{
Console.WriteLine($"Chain {Id} - Executing Command {command}");
var hasMoreInfo = command.ToString() != command.GetType().ToString();
Console.WriteLine($"Chain {Id} - Executing {(hasMoreInfo ? command : command.GetType().Name)}");
}

bool commandSuccess = command.Execute(context);
Expand All @@ -83,4 +85,4 @@ public void DebugPrintCommands()
Console.WriteLine($"- Command {command}");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public bool Execute(Context context)

public override string ToString()
{
return $"NO-OP (Client {Label})";
return $"NO-OP (Client {Label}, ID {Id})";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public bool Execute(Context context)

public override string ToString()
{
return $"PLACEHOLDER ({Label})";
return $"PLACEHOLDER ({Label}, ID {Id})";
}
}

0 comments on commit be10d49

Please sign in to comment.