public PracticeReplacer(Th06Converter parent) { this.evaluator = new MatchEvaluator(match => { var level = LevelParser.Parse(match.Groups[1].Value); var chara = CharaParser.Parse(match.Groups[2].Value); var stage = StageParser.Parse(match.Groups[3].Value); if (level == Level.Extra) { return(match.ToString()); } if (stage == Stage.Extra) { return(match.ToString()); } var key = new CharaLevelPair(chara, level); if (parent.allScoreData.PracticeScores.ContainsKey(key)) { var scores = parent.allScoreData.PracticeScores[key]; return(scores.ContainsKey(stage) ? Utils.ToNumberString(scores[stage].HighScore) : "0"); } else { return("0"); } }); }
public ClearReplacer(Th06Converter parent) { this.evaluator = new MatchEvaluator(match => { var level = LevelParser.Parse(match.Groups[1].Value); var chara = CharaParser.Parse(match.Groups[2].Value); var key = new CharaLevelPair(chara, level); if (parent.allScoreData.Rankings.ContainsKey(key)) { var stageProgress = parent.allScoreData.Rankings[key].Max(rank => rank.StageProgress); if (stageProgress == StageProgress.Extra) { return("Not Clear"); } else { return(stageProgress.ToShortName()); } } else { return(StageProgress.None.ToShortName()); } }); }
public CollectRateReplacer(Th06Converter parent) { this.evaluator = new MatchEvaluator(match => { var stage = StageWithTotalParser.Parse(match.Groups[1].Value); var type = int.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture); Func <CardAttack, bool> findByStage; if (stage == StageWithTotal.Total) { findByStage = (attack => true); } else { findByStage = (attack => CardTable[attack.CardId].Stage == (Stage)stage); } Func <CardAttack, bool> findByType; if (type == 1) { findByType = (attack => attack.ClearCount > 0); } else { findByType = (attack => attack.TrialCount > 0); } return(parent.allScoreData.CardAttacks.Values .Count(Utils.MakeAndPredicate(findByStage, findByType)) .ToString(CultureInfo.CurrentCulture)); }); }
public CardReplacer(Th06Converter parent, bool hideUntriedCards) { this.evaluator = new MatchEvaluator(match => { var number = int.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture); var type = match.Groups[2].Value.ToUpperInvariant(); if (CardTable.ContainsKey(number)) { if (hideUntriedCards) { CardAttack attack; if (!parent.allScoreData.CardAttacks.TryGetValue(number, out attack) || !attack.HasTried()) { return((type == "N") ? "??????????" : "?????"); } } return((type == "N") ? CardTable[number].Name : string.Join( ", ", CardTable[number].Levels.Select(lv => lv.ToString()).ToArray())); } else { return(match.ToString()); } }); }
public ScoreReplacer(Th06Converter parent) { this.evaluator = new MatchEvaluator(match => { var level = LevelParser.Parse(match.Groups[1].Value); var chara = CharaParser.Parse(match.Groups[2].Value); var rank = Utils.ToZeroBased( int.Parse(match.Groups[3].Value, CultureInfo.InvariantCulture)); var type = int.Parse(match.Groups[4].Value, CultureInfo.InvariantCulture); var key = new CharaLevelPair(chara, level); var score = parent.allScoreData.Rankings.ContainsKey(key) ? parent.allScoreData.Rankings[key][rank] : InitialRanking[rank]; switch (type) { case 1: // name return(Encoding.Default.GetString(score.Name).Split('\0')[0]); case 2: // score return(Utils.ToNumberString(score.Score)); case 3: // stage return(score.StageProgress.ToShortName()); default: // unreachable return(match.ToString()); } }); }
public CareerReplacer(Th06Converter parent) { this.evaluator = new MatchEvaluator(match => { var number = int.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture); var type = int.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture); Func <CardAttack, int> getCount; if (type == 1) { getCount = (attack => attack.ClearCount); } else { getCount = (attack => attack.TrialCount); } if (number == 0) { return(Utils.ToNumberString(parent.allScoreData.CardAttacks.Values.Sum(getCount))); } else if (CardTable.ContainsKey(number)) { CardAttack attack; if (parent.allScoreData.CardAttacks.TryGetValue(number, out attack)) { return(Utils.ToNumberString(getCount(attack))); } else { return("0"); } } else { return(match.ToString()); } }); }