/// <summary> /// Composes the specified session. /// </summary> /// <param name="Session">The session.</param> /// <param name="Quest">The quest.</param> /// <returns>ServerMessage.</returns> internal static ServerMessage Compose(GameClient Session, Quest Quest) { var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("QuestStartedMessageComposer")); QuestListComposer.SerializeQuest(serverMessage, Session, Quest, Quest.Category); return(serverMessage); }
/// <summary> /// Composes the specified session. /// </summary> /// <param name="Session">The session.</param> /// <param name="Quests">The quests.</param> /// <param name="Send">if set to <c>true</c> [send].</param> /// <returns>ServerMessage.</returns> internal static ServerMessage Compose(GameClient Session, List <Quest> Quests, bool Send) { var dictionary = new Dictionary <string, int>(); var dictionary2 = new Dictionary <string, Quest>(); foreach (Quest current in Quests) { if (!current.Category.Contains("xmas2012")) { if (!dictionary.ContainsKey(current.Category)) { dictionary.Add(current.Category, 1); dictionary2.Add(current.Category, null); } if (current.Number >= dictionary[current.Category]) { int questProgress = Session.GetHabbo().GetQuestProgress(current.Id); if (Session.GetHabbo().CurrentQuestId != current.Id && (long)questProgress >= (long)((ulong)current.GoalData)) { dictionary[current.Category] = (current.Number + 1); } } } } foreach (Quest current2 in Quests) { foreach (KeyValuePair <string, int> current3 in dictionary) { if (!current2.Category.Contains("xmas2012") && current2.Category == current3.Key && current2.Number == current3.Value) { dictionary2[current3.Key] = current2; break; } } } var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("QuestListMessageComposer")); serverMessage.AppendInteger(dictionary2.Count); foreach (KeyValuePair <string, Quest> current4 in dictionary2) { if (current4.Value != null) { QuestListComposer.SerializeQuest(serverMessage, Session, current4.Value, current4.Key); } } foreach (KeyValuePair <string, Quest> current5 in dictionary2) { if (current5.Value == null) { QuestListComposer.SerializeQuest(serverMessage, Session, current5.Value, current5.Key); } } serverMessage.AppendBool(Send); return(serverMessage); }