sc2replay-csharp
sc2replay-csharp copied to clipboard
AbilityType.CancelTrain isnt parsed correctly. Returns Unknown
Linked below is a simple example that contains a replay with just a few events. Event 5 is a TrainSCV event, and Event 6 should be a CancelTrain or Cancel event (the SCV was cancelled in the replay. However, the EventType is Unknown.
string filename = @"test.SC2Replay";
Replay replay = Replay.Parse(filename);
List<IGameEvent> events = replay.PlayerEvents;
foreach (var e in events)
{
if (e.Player.Name == "mesh") {
if (e.EventType == GameEventType.Macro) {
if (((AbilityEvent)e).AbilityType == AbilityType.Unknown)
{
System.Diagnostics.Debug.WriteLine(@"unknown");
}
if (((AbilityEvent)e).AbilityType == AbilityType.TrainSCV)
{
System.Diagnostics.Debug.WriteLine(@"trainscv");
}
}
}
}
You can download the replay from: http://dl.dropbox.com/u/361009/test.zip
Debugging into AbilityData.cs, the Unknown is coming from the final return, and not the check for index being greater than Data.Length.
Just adding some more info. GameEventType is also Unknown
Here is the Locals panel output for the Event should should be TrainCancel or Cancel.
- [Starcraft2.ReplayParser.AbilityEvent] {Starcraft2.ReplayParser.AbilityEvent} Starcraft2.ReplayParser.AbilityEvent
- base {Starcraft2.ReplayParser.AbilityEvent} Starcraft2.ReplayParser.GameEventBase {Starcraft2.ReplayParser.AbilityEvent}
EventType Unknown Starcraft2.ReplayParser.GameEventType
+ Player {mesh} Starcraft2.ReplayParser.Player
+ Time {Starcraft2.ReplayParser.Timestamp} Starcraft2.ReplayParser.Timestamp
AbilityFailed false bool
AbilityType Unknown Starcraft2.ReplayParser.AbilityType
AbilityUsed true bool
+ Actors Count = 1 System.Collections.Generic.List<Starcraft2.ReplayParser.Unit>
DefaultAbility false bool
DefaultActor true bool
DefaultTarget false bool
EnableAutoCast false bool
MinimapClick false bool
Queued false bool
RightClick false bool
TargetFlags 0 int
TargetId 0 uint
TargetLocation null Starcraft2.ReplayParser.Location
TargetPlayer 0 int
TargetTeam 0 int
TargetUnit null Starcraft2.ReplayParser.Unit
ToggleAbility false bool
WireframeCancel false bool
WireframeClick false bool
WireframeIndex 0 int
WireframeUnload false bool
EventType Unknown Starcraft2.ReplayParser.GameEventType
+ Player {mesh} Starcraft2.ReplayParser.Player
+ Time {Starcraft2.ReplayParser.Timestamp} Starcraft2.ReplayParser.Timestamp