public static ScriptTextEvent Parse(string[] parts) { var textId = ushort.Parse(parts[1]); var location = parts.Length > 2 ? (TextLocation)Enum.Parse(typeof(TextLocation), parts[2]) : TextLocation.NoPortrait; if (parts.Length <= 3) { return(new ScriptTextEvent(textId, location, CharacterId.None)); } if (int.TryParse(parts[3], out var id)) { if (id <= 0) { return(new ScriptTextEvent(textId, location, CharacterId.None)); } var type = MapTextEvent.AssetTypeForTextLocation(location); return(new ScriptTextEvent(textId, location, new CharacterId(type, id))); } var charId = CharacterId.Parse(parts[3]); return(new ScriptTextEvent(textId, location, charId)); }