Skip to content

Getting trailing '\r' on some but not all ability_names in game_events #205

@manuelseeger

Description

@manuelseeger

Examples include:

ability_name = 'TrainQueen\r'
ability_name = 'ChronoBoostEnergyCost\r'
ability_name = 'CausticSpray\r'

Where others look fine:
ability_name = 'TrainProbe'

This is with a fresh copy of sc2reader from GitHub and

import sc2reader

replay = sc2reader.load_replay('Radhuset Station LE (85) ZvP chrono.SC2Replay')

a = [e for e in replay.game_events if hasattr(e, 'ability_name') and '\r' in e.ability_name]

print(a) # 137 results

I could work around it with my own engine plugin but would be nice if this is fixed since it also breaks downstream apps like SpawningTool.

class EventAbilityNameCorrector(BasePlugin):
    name = "EventAbilityCorrector"

    def handleEvent(self, e: Event, replay: RawReplay):
        if hasattr(e, "ability_name") and "\r" in e.ability_name:
            e.ability_name = e.ability_name.replace("\r", "")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions