コード例 #1
0
ファイル: QuestManager.cs プロジェクト: habb0/PiciEmulator
        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;
            foreach (DataRow dRow in dTable.Rows)
            {
                id = Convert.ToUInt32(dRow["id"]);
                category = (string)dRow["category"];
                num = (int)dRow["series_number"];
                type = (int)dRow["goal_type"];
                goalData = Convert.ToUInt32(dRow["goal_data"]);
                name = (string)dRow["name"];
                reward = (int)dRow["reward"];
                dataBit = (string)dRow["data_bit"];

                Quest quest = new Quest(id, category, num, (QuestType)type, goalData, name, reward, dataBit);
                quests.Add(id, quest);
                AddToCounter(category);
            }
        }
コード例 #2
0
 internal static ServerMessage Compose(GameClient Session, Quest Quest)
 {
     ServerMessage Message = new ServerMessage(802);
     QuestListComposer.SerializeQuest(Message, Session, Quest, Quest.Category);
     return Message;
 }
コード例 #3
0
        internal static void SerializeQuest(ServerMessage Message, GameClient Session, Quest Quest, string Category)
        {
            int AmountInCat = PiciEnvironment.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.AppendStringWithBreak(Category);
            Message.AppendInt32(Number); // Quest progress in this cat
            Message.AppendInt32(AmountInCat); // Total quests in this cat
            Message.AppendInt32((int)QuestRewardType.Pixels); // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels
            Message.AppendUInt(Quest == null ? 0 : Quest.Id); // Quest id
            Message.AppendBoolean(Quest == null ? false : Session.GetHabbo().CurrentQuestId == Quest.Id); // Quest started
            Message.AppendStringWithBreak(Quest == null ? string.Empty : Quest.ActionName);
            Message.AppendStringWithBreak(Quest == null ? string.Empty : Quest.DataBit);
            Message.AppendInt32(Quest == null ? 0 : Quest.Reward);
            Message.AppendStringWithBreak(Quest == null ? string.Empty : Quest.Name);
            Message.AppendInt32(UserProgress); // Current progress
            Message.AppendUInt(Quest == null ? 0 : Quest.GoalData); // Target progress
            Message.AppendInt32(0); // "Next quest available countdown" in seconds
        }