public void GetResponse(OutMessage Message, Character Character) { var Achievements = StorageHandler.GetCharacterAchievements(Character.Id); var Details = StorageHandler.GetAchievementDetailsSorted(Id); int MaxLevel = Details.Count() > 0 ? Details.Count() : 1; var MyProgress = new CharacterAchievement(-1, Character.Id, Id, 0); foreach (var Item in Achievements) { if (Item.AchievementId == Id) { MyProgress = Item; } } var CurrentLevel = MyProgress.CurrentLevel; var NextLevel = (CurrentLevel + 1); int NextRequired = 1; foreach (var Item in Details) { if (Item.Level == NextLevel) { NextRequired = Item.RequiredAmmount; } } if (NextLevel > MaxLevel) { NextLevel = MaxLevel; } if (CurrentLevel >= MaxLevel) { CurrentLevel = MaxLevel; } Message.Append(Id); Message.Append(NextLevel); Message.Append(GetBadge(NextLevel)); Message.Append(NextRequired); Message.Append(GetPixelReward(NextLevel)); Message.Append(0); // TODO <> BadgeId Message.Append(0); // TODO <> GotAlready Message.Append(CurrentLevel == MaxLevel); Message.Append(AchievementHandler.GetCategory(ParentId).Caption.ToLower()); Message.Append(MaxLevel); }
public static IEnumerable<Achievement> GetAchievements(Character Character) { var Result = new List<Achievement>(); foreach (var Item in Achievements.Values) { if (!AchievementCategorys.ContainsKey(Item.ParentId)) { continue; } if (Character.Rank >= Item.RankRequired) { Result.Add(Item); } } return Result; }