public bool Count(QuestCount count, ItemSpec[] specs) { if (count.NowArray == null) { var num = specs.Count(spec => Types?.Contains(spec.Type) ?? (Ids?.Contains(spec.Id) ?? true)); count.Now += num; return(num > 0); } if (Types == null && Ids == null) { return(false); } var result = false; for (var i = 0; i < count.NowArray.Length; i++) { var num = specs.Count(spec => Types != null ? Types[i] == spec.Type : Ids[i] == spec.Id); count.NowArray[i] += num; if (num > 0) { result = true; } } return(result); }
public bool Count(QuestCount count, string rank, int map, bool boss) { if (Maps != null) { return(boss && CheckMaps(count, rank, map)); } return(CountNow(count, rank)); }
private bool CountNow(QuestCount count, string rank) { if (Rank != null && CompareRank(rank, Rank) > 0) { return(false); } count.Now++; return(true); }
private bool CheckMaps(QuestCount count, string rank, int map) { var idx = Array.FindIndex(Maps, m => m == map); if (idx < 0) { return(false); } return(count.NowArray != null?CountNowArray(count, rank, idx) : CountNow(count, rank)); }
private bool CountNowArray(QuestCount count, string rank, int idx) { var specRank = Ranks == null ? Rank : Ranks[idx]; if (CompareRank(rank, specRank) > 0) { return(false); } count.NowArray[idx]++; return(true); }
public bool Equals(QuestCount other) { if (Id != other.Id) { return(false); } if (NowArray == null) { return(Now == other.Now); } return(NowArray.SequenceEqual(other.NowArray)); }
public QuestCount GetCount(int id) { if (_countDict.TryGetValue(id, out var value)) { return(value); } if (_questSpecs.TryGetValue(id, out var spec)) { var nowArray = spec.MaxArray?.Select(x => 0).ToArray(); return(_countDict[id] = new QuestCount { Id = id, Now = 0, NowArray = nowArray, Spec = spec }); } return(new QuestCount { Spec = new QuestSpec { Material = new int[0], AdjustCount = false } }); }
public bool Count(QuestCount count, int id) { if (Ids == null) { count.Now++; return(true); } var idx = Array.FindIndex(Ids, n => n == id); if (idx < 0) { return(false); } if (count.NowArray == null) { count.Now++; } else { count.NowArray[idx]++; } return(true); }