internal void SerializeWall(ServerMessage Message, Boolean Inventory) { Message.AddUInt32(itemID); Message.AddChar(char.ToUpper(itemBase.Type)); Message.AddUInt32(itemID); Message.AddInt32(GetBaseItem().SpriteId); if (GetBaseItem().Name.Contains("a2")) Message.AddInt32(3); else if (GetBaseItem().Name.Contains("wallpaper")) Message.AddInt32(2); else if (GetBaseItem().Name.Contains("landscape")) Message.AddInt32(4); else Message.AddInt32(1); Message.AddInt32(0); Message.AddString(extraData); Message.AddBoolean(false); //recycle Message.AddBoolean(GetBaseItem().AllowTrade); Message.AddBoolean(GetBaseItem().AllowInventoryStack); Message.AddBoolean(false); //marketplace Message.AddInt32(-1); Message.AddBoolean(false); Message.AddInt32(-1); }
internal void Searialize(ServerMessage reply) { reply.AddInt32((int)userID); reply.AddString(username); reply.AddString(motto); bool Online = (ButterflyEnvironment.GetGame().GetClientManager().GetClient(userID) != null); reply.AddBoolean(Online); reply.AddBoolean(false); reply.AddString(string.Empty); reply.AddInt32(0); reply.AddString(Online ? look : ""); reply.AddString(last_online); }
internal void Serialize(ref ServerMessage packet) { packet.AddInt32((int)ButterflyEnvironment.GetUnixTimestamp()); packet.AddUInt32(userID); packet.AddString(username); packet.AddString(message); packet.AddBoolean(false); // reported msg }
internal void Serialize(ServerMessage Message) { Message.AddInt32((int)this.ID); Message.AddString(this.catalogName); Message.AddBoolean(false); Message.AddInt32(this.creditCost); Message.AddInt32(diamondCost > 0 ? this.diamondCost : this.pixelCost); Message.AddInt32(diamondCost > 0 ? CURRENCY_USED : 0); // Pixel or diamonds? Message.AddBoolean(false); // Allow gift =) Message.AddInt32(baseID > 0 ? 1 : 0); // items on pack if (baseID > 0) { // and serialize it Message.AddString(GetBaseItem().Type.ToString()); Message.AddInt32(GetBaseItem().SpriteId); // extradata if (catalogName.Contains("wallpaper_single") || catalogName.Contains("floor_single") || catalogName.Contains("landscape_single")) { string[] Analyze = catalogName.Split('_'); Message.AddString(Analyze[2]); } else if (this.songID > 0 && GetBaseItem().InteractionType == InteractionType.musicdisc) { Message.AddString(songID.ToString()); } else { Message.AddString(this.specialText); } Message.AddInt32(amount); } Message.AddBoolean(isLimited); // IsLimited if (isLimited) { Message.AddInt32(this.limitedInStock); Message.AddInt32(this.limitedInStock - this.limitedSold); } Message.AddInt32(0); Message.AddBoolean(allowMassBuy); // IsOffer }
internal static void SerializeQuest(ServerMessage Message, GameClient Session, Quest Quest, string Category) { int AmountInCat = ButterflyEnvironment.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.AddString(Category); Message.AddInt32(Number); // Quest progress in this cat Message.AddInt32(AmountInCat); // Total quests in this cat Message.AddInt32((int)QuestRewardType.Pixels); // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels Message.AddUInt32(Quest == null ? 0 : Quest.Id); // Quest id Message.AddBoolean(Quest == null ? false : Session.GetHabbo().CurrentQuestId == Quest.Id); // Quest started Message.AddString(Quest == null ? string.Empty : Quest.ActionName); Message.AddString(Quest == null ? string.Empty : Quest.DataBit); Message.AddInt32(Quest == null ? 0 : Quest.Reward); Message.AddString(Quest == null ? string.Empty : Quest.Name); Message.AddInt32(UserProgress); // Current progress Message.AddUInt32(Quest == null ? 0 : Quest.GoalData); // Target progress Message.AddInt32(0); // "Next quest available countdown" in seconds Message.AddString(string.Empty); //set_kuurna Message.AddString(string.Empty); // MAIN_CHAIN Message.AddBoolean(true); // Euh? }
internal int Serialize(int Rank, ServerMessage Message) { Message.AddBoolean(Visible); Message.AddInt32(IconImage); Message.AddInt32(Id); Message.AddString(Layout); Message.AddString(Caption); Message.AddInt32(0); int k = ButterflyEnvironment.GetGame().GetCatalog().GetTreeSize(Rank, Id); Message.AddInt32(k); return k; }
private void SerializeNavigatorRooms(ServerMessage reply, ISortable<RoomData>[] rooms, int count) { reply.AddString(string.Empty); reply.AddInt32(count); for (int i = 0; i < count; i++) rooms[i].GetValue().Serialize(reply, false); reply.AddBoolean(false); }
private void SerializeNavigatorRooms(ref ServerMessage reply, List<RoomData> rooms) { reply.AddString(string.Empty); reply.AddInt32(rooms.Count); foreach (RoomData data in rooms) { data.Serialize(reply, false); } reply.AddBoolean(false); }
internal void Serialize(ServerMessage Message) { Message.AddInt32(Id); Message.AddString(this.itemType != PublicItemType.PUBLIC_FLAT ? Caption : String.Empty); Message.AddString(Description); // description Message.AddInt32(Type); // image size Message.AddString(this.itemType == PublicItemType.PUBLIC_FLAT ? Caption : String.Empty); Message.AddString(Image); Message.AddInt32(ParentId > 0 ? ParentId : 0); Message.AddInt32(RoomInfo != null ? RoomInfo.UsersNow : 0); Message.AddInt32(itemType == PublicItemType.NONE ? 0 : (itemType == PublicItemType.TAG ? 1 : (itemType == PublicItemType.FLAT ? 2 : (itemType == PublicItemType.PUBLIC_FLAT ? 2 : (itemType == PublicItemType.CATEGORY ? 4 : 0))))); if (this.itemType == PublicItemType.TAG) { Message.AddString(TagsToSearch); return; } else if (this.itemType == PublicItemType.CATEGORY) { Message.AddBoolean(false); return; } else if (this.itemType == PublicItemType.FLAT) { this.RoomInfo.Serialize(Message, false); } else if (this.itemType == PublicItemType.PUBLIC_FLAT) { this.RoomInfo.Serialize(Message, false); } if ((this.itemType == PublicItemType.FLAT || this.itemType == PublicItemType.PUBLIC_FLAT) && Message == null) { Console.WriteLine("ID: " + Id + " is pointing to a room not existing"); } }
internal void Serialize(ServerMessage reply) { reply.AddUInt32(UserId); reply.AddString(mUsername); reply.AddInt32(1); reply.AddBoolean(IsOnline); reply.AddBoolean(IsOnline ? InRoom : false); reply.AddString(IsOnline ? mLook : ""); reply.AddInt32(0); reply.AddString(mMotto); reply.AddString(string.Empty); reply.AddString(string.Empty); reply.AddBoolean(false);//allow offline reply.AddBoolean(false);//dont know reply.AddBoolean(false);//Is on phone reply.AddShort((Int16) relationship); }
internal void SerializeClub(ServerMessage Message, GameClients.GameClient Session) { try { Message.AddInt32((int)this.ID); Message.AddString(catalogName); Message.AddInt32(this.creditCost); Message.AddBoolean(true); // don't know int Days = 0; int Months = 0; if (catalogName.Contains("HABBO_CLUB_VIP_")) { if (catalogName.Contains("_DAY")) { Days = int.Parse(catalogName.Split('_')[3]); } else if (catalogName.Contains("_MONTH")) { Months = int.Parse(catalogName.Split('_')[3]); Days = 31 * Months; } } else if (catalogName.Equals("deal_vip_1_year_and_badge")) { Months = 12; Days = 31 * Months; } else if (catalogName.Equals("HABBO_CLUB_VIP_5_YEAR")) { Months = 5 * 12; Days = 31 * Months; } DateTime future = DateTime.Now; if (Session.GetHabboDataContainer().GetSubscriptionManager().HasSubscription()) { Double Expire = Session.GetHabboDataContainer().GetSubscriptionManager().GetSubscription().ExpireTime; Double TimeLeft = Expire - ButterflyEnvironment.GetUnixTimestamp(); int TotalDaysLeft = (int)Math.Ceiling(TimeLeft / 86400); future = DateTime.Now.AddDays(TotalDaysLeft); } future = future.AddDays(Days); Message.AddInt32(Months); // months Message.AddInt32(Days); // days Message.AddInt32(Days); // wtf Message.AddInt32(future.Year); // year Message.AddInt32(future.Month); // month Message.AddInt32(future.Day); // day } catch { //Console.WriteLine("Unable to load club item " + Id + ": " + Name); } }
internal void SerializeFloor(ServerMessage Message, Boolean Inventory) { if (GetBaseItem().IsGift) { if (giftData == null) LoadGift(); string message = string.Empty; int spriteCode = 0; string figure = string.Empty; if (giftData != null) { message = giftData.message; spriteCode = (giftData.decorationType * 1000) + giftData.wrappingPaper; } Message.AddInt32((-1) * (int)this.itemID); Message.AddString(this.GetBaseItem().Type.ToString().ToUpper()); Message.AddUInt32(this.itemID); Message.AddInt32(this.GetBaseItem().SpriteId); Message.AddInt32(9); Message.AddInt32(0); Message.AddString(message); Message.AddBoolean(false); // recycle Message.AddBoolean(this.GetBaseItem().AllowTrade); Message.AddBoolean(this.GetBaseItem().AllowInventoryStack); Message.AddBoolean(false); //marketplace Message.AddInt32(-1); Message.AddBoolean(false); Message.AddInt32(-1); Message.AddString(""); Message.AddInt32(spriteCode); } else { Message.AddUInt32(this.itemID); Message.AddString(GetBaseItem().Type.ToString().ToUpper()); Message.AddUInt32(this.itemID); Message.AddInt32(this.GetBaseItem().SpriteId); Message.AddInt32(1); if (GetBaseItem().InteractionType == InteractionType.badge_display) { Message.AddInt32(2); Message.AddInt32(4); if (extraData != string.Empty) { Message.AddString("0"); // extradata check for (int i = 0; i <= extraData.Split(Convert.ToChar(9)).Length - 1; i++) Message.AddString(extraData.Split(Convert.ToChar(9))[i]); } else Message.AddInt32(0); } else if (GetBaseItem().IsGroupItem && _extraData != null) { uint groupID = TextHandling.ParseUInt32(_extraData.Split(':')[0]); GroupData groupData = ButterflyEnvironment.GetGame().GetGroupManager().GetGroup(groupID); if (groupData != null) { Message.AddInt32(2); Message.AddInt32(5); Message.AddString("0"); Message.AddString(groupID.ToString()); Message.AddString(groupData.image); Message.AddString(groupData.htmlColorPrimary); Message.AddString(groupData.htmlColorSecondary); } else { Message.AddInt32(0); Message.AddString(extraData); } } else { Message.AddInt32(0); Message.AddString(extraData); } Message.AddBoolean(false); Message.AddBoolean(this.GetBaseItem().AllowTrade); Message.AddBoolean(this.GetBaseItem().AllowInventoryStack); Message.AddBoolean(false); Message.AddInt32(-1); // secondsToExpiration Message.AddBoolean(false); // hasRentPeriodStarted Message.AddInt32(-1); // Roomid Message.AddString("S"); // slotId ?? Message.AddInt32(0); } }