コード例 #1
0
        internal static ServerMessage Compose(GameClient Session, Quest Quest)
        {
            ServerMessage serverMessage = new ServerMessage(Outgoing.QuestStartedMessageComposer);

            QuestListComposer.SerializeQuest(serverMessage, Session, Quest, Quest.Category);
            return(serverMessage);
        }
コード例 #2
0
        internal static ServerMessage Compose(GameClient Session, List <Quest> Quests, bool Send)
        {
            Dictionary <string, int>   dictionary  = new Dictionary <string, int>();
            Dictionary <string, Quest> 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] = checked (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;
                    }
                }
            }
            ServerMessage serverMessage = new ServerMessage(Outgoing.QuestListMessageComposer);

            serverMessage.AppendInt32(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.AppendBoolean(Send);
            return(serverMessage);
        }