Пример #1
0
        internal static ServerMessage Compose(GameClient Session, Quest Quest)
        {
            //  518:S,I,I,I,I,B,S,S,I,S,I,I,I,S,S,B,B

            int AmountInCat = SilverwaveEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Quest.Category);
            int Number = Quest == null ? AmountInCat : Quest.Number;
            int UserProgress = Quest == null ? 0 : Session.GetHabbo().GetQuestProgress(Quest.Id);
            ServerMessage Message = new ServerMessage(Outgoing.QuestCompletedCompser);
            Message.AppendString(Quest.Category);
            Message.AppendInt32(Number); // Quest progress in this cat
            Message.AppendInt32((Quest.Name.Contains("xmas2012")) ? 1 : AmountInCat); // Total quests in this cat
            Message.AppendInt32(Quest == null ? 3 : Quest.RewardType); // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels
            Message.AppendInt32(Quest == null ? 0 : Quest.Id); // Quest id
            Message.AppendBoolean(Quest == null ? false : Session.GetHabbo().CurrentQuestId == Quest.Id); // Quest started
            Message.AppendString(Quest == null ? string.Empty : Quest.ActionName);
            Message.AppendString(Quest == null ? string.Empty : Quest.DataBit);
            Message.AppendInt32(Quest == null ? 0 : Quest.Reward);
            Message.AppendString(Quest == null ? string.Empty : Quest.Name);
            Message.AppendInt32(UserProgress); // Current progress
            Message.AppendInt32(Quest == null ? 0 : Quest.GoalData); // Target progress
            Message.AppendInt32(Quest == null ? 0 : Quest.TimeUnlock); // "Next quest available countdown" in seconds
            Message.AppendString("");
            Message.AppendString("");
            Message.AppendBoolean(true); // ?
            Message.AppendBoolean(true); // Activate next quest..
            return Message;
        }
Пример #2
0
        public void ReloadQuests(IQueryAdapter dbClient)
        {
            quests.Clear();

            dbClient.setQuery("SELECT * FROM quests");
            DataTable dTable = dbClient.getTable();

            uint id;
            string category;
            int num;
            int type;
            uint goalData;
            string name;
            int reward;
            string dataBit;
            int rewardtype;
            int time;
            int locked;
            foreach (DataRow dRow in dTable.Rows)
            {
                id = Convert.ToUInt32(dRow["id"]);
                category = (string)dRow["type"];
                num = (int)dRow["level_num"];
                type = (int)dRow["goal_type"];
                goalData = Convert.ToUInt32(dRow["goal_data"]);
                name = (string)dRow["action"];
                reward = (int)dRow["pixel_reward"];
                dataBit = (string)dRow["data_bit"];
                rewardtype = Convert.ToInt32(dRow["reward_type"].ToString());
                time = (int)dRow["timestamp_unlock"];
                locked = (int)dRow["timestamp_lock"];
                Quest quest = new Quest(id, category, num, (QuestType)type, goalData, name, reward, dataBit, rewardtype, time, locked);
                quests.Add(id, quest);
                AddToCounter(category);
            }
        }
Пример #3
0
        internal static void SerializeQuest(ServerMessage Message, GameClient Session, Quest Quest, string Category)
        {
            if (Message == null || Session == null)
                return;
            int AmountInCat = SilverwaveEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Category);
            int Number = Quest == null ? AmountInCat : Quest.Number - 1;
            int UserProgress = Quest == null ? 0 : Session.GetHabbo().GetQuestProgress(Quest.Id);

            if (Quest != null && Quest.IsCompleted(UserProgress))
            {
                Number++;
            }
            Message.AppendString(Category);
            Message.AppendInt32(Quest == null ? 0 : ((Quest.Category.Contains("xmas2012")) ? 0 : Number)); // Quest progress in this cat
            Message.AppendInt32(Quest == null ? 0 : (Quest.Category.Contains("xmas2012")) ? 0 : AmountInCat); // Total quests in this cat
            Message.AppendInt32(Quest == null ? 3 : Quest.RewardType); // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels
            Message.AppendInt32(Quest == null ? 0 : Quest.Id); // Quest id
            Message.AppendBoolean(Quest == null ? false : Session.GetHabbo().CurrentQuestId == Quest.Id); // Quest started
            Message.AppendString(Quest == null ? string.Empty : Quest.ActionName);
            Message.AppendString(Quest == null ? string.Empty : Quest.DataBit);
            Message.AppendInt32(Quest == null ? 0 : Quest.Reward);
            Message.AppendString(Quest == null ? string.Empty : Quest.Name);
            Message.AppendInt32(UserProgress); // Current progress
            Message.AppendInt32(Quest == null ? 0 : Quest.GoalData); // Target progress
            Message.AppendInt32(Quest == null ? 0 : Quest.TimeUnlock); // "Next quest available countdown" in seconds
            Message.AppendString("");
            Message.AppendString("");
            Message.AppendBoolean(true);
        }
Пример #4
0
 internal static ServerMessage Compose(GameClient Session, Quest Quest)
 {
     ServerMessage Message = new ServerMessage(Outgoing.QuestStartedComposer);
     QuestListComposer.SerializeQuest(Message, Session, Quest, Quest.Category);
     return Message;
 }