private void SerializeQuest(ServerPacket Message, GameClient Session, Quest Quest, string Category) { if (Message == null || Session == null) return; int AmountInCat = PlusEnvironment.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.WriteString(Category); Message.WriteInteger(Quest == null ? 0 : ((Quest.Category.Contains("xmas2012")) ? 0 : Number)); // Quest progress in this cat Message.WriteInteger(Quest == null ? 0 : (Quest.Category.Contains("xmas2012")) ? 0 : AmountInCat); // Total quests in this cat Message.WriteInteger(Quest == null ? 3 : Quest.RewardType);// Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels Message.WriteInteger(Quest == null ? 0 : Quest.Id); // Quest id Message.WriteBoolean(Quest == null ? false : Session.GetHabbo().GetStats().QuestID == Quest.Id); // Quest started Message.WriteString(Quest == null ? string.Empty : Quest.ActionName); Message.WriteString(Quest == null ? string.Empty : Quest.DataBit); Message.WriteInteger(Quest == null ? 0 : Quest.Reward); Message.WriteString(Quest == null ? string.Empty : Quest.Name); Message.WriteInteger(UserProgress); // Current progress Message.WriteInteger(Quest == null ? 0 : Quest.GoalData); // Target progress Message.WriteInteger(Quest == null ? 0 : Quest.TimeUnlock); // "Next quest available countdown" in seconds Message.WriteString(""); Message.WriteString(""); Message.WriteBoolean(true); }
public QuestCompletedComposer(GameClient Session, Quest Quest) : base(ServerPacketHeader.QuestCompletedMessageComposer) { int AmountInCat = PlusEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Quest.Category); int Number = Quest == null ? AmountInCat : Quest.Number; int UserProgress = Quest == null ? 0 : Session.GetHabbo().GetQuestProgress(Quest.Id); base.WriteString(Quest.Category); base.WriteInteger(Number); // Quest progress in this cat base.WriteInteger((Quest.Name.Contains("xmas2012")) ? 1 : AmountInCat); // Total quests in this cat base.WriteInteger(Quest == null ? 3 : Quest.RewardType); // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels base.WriteInteger(Quest == null ? 0 : Quest.Id); // Quest id base.WriteBoolean(Quest == null ? false : Session.GetHabbo().GetStats().QuestID == Quest.Id); // Quest started base.WriteString(Quest == null ? string.Empty : Quest.ActionName); base.WriteString(Quest == null ? string.Empty : Quest.DataBit); base.WriteInteger(Quest == null ? 0 : Quest.Reward); base.WriteString(Quest == null ? string.Empty : Quest.Name); base.WriteInteger(UserProgress); // Current progress base.WriteInteger(Quest == null ? 0 : Quest.GoalData); // Target progress base.WriteInteger(Quest == null ? 0 : Quest.TimeUnlock); // "Next quest available countdown" in seconds base.WriteString(""); base.WriteString(""); base.WriteBoolean(true); // ? base.WriteBoolean(true); // Activate next quest.. }
internal static void SerializeQuest(ServerMessage Message, GameClient Session, Quest Quest, string Category) { int AmountInCat = PlusEnvironment.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.AppendInt32(Quest == null ? 3 : Quest.RewardType); 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(Quest == null ? 0 : Quest.TimeUnlock); // "Next quest available countdown" in seconds }
internal static ServerMessage Compose(GameClient Session, Quest Quest) { ServerMessage Message = new ServerMessage(802); QuestListComposer.SerializeQuest(Message, Session, Quest, Quest.Category); return Message; }
public QuestStartedComposer(GameClient Session, Quest Quest) : base(ServerPacketHeader.QuestStartedMessageComposer) { this.SerializeQuest(this, Session, Quest, Quest.Category); }