Exemple #1
0
        public static void WriteRoom(ServerPacket packet, RoomData data, RoomPromotion promotion)
        {
            packet.WriteInteger(data.Id);
            packet.WriteString(data.Name);
            packet.WriteInteger(data.OwnerId);
            packet.WriteString(data.OwnerName);
            packet.WriteInteger(RoomAccessUtility.GetRoomAccessPacketNum(data.Access));
            packet.WriteInteger(data.UsersNow);
            packet.WriteInteger(data.UsersMax);
            packet.WriteString(data.Description);
            packet.WriteInteger(data.TradeSettings);
            packet.WriteInteger(data.Score);
            packet.WriteInteger(0);//Top rated room rank.
            packet.WriteInteger(data.Category);

            packet.WriteInteger(data.Tags.Count);
            foreach (var tag in data.Tags)
            {
                packet.WriteString(tag);
            }

            var RoomType = 0;

            if (data.Group != null)
            {
                RoomType += 2;
            }

            if (data.Promotion != null)
            {
                RoomType += 4;
            }

            if (data.Type == "private")
            {
                RoomType += 8;
            }

            if (data.AllowPets == 1)
            {
                RoomType += 16;
            }

            if (Program.GameContext.GetNavigator().TryGetFeaturedRoom(data.Id, out var item))
            {
                RoomType += 1;
            }

            packet.WriteInteger(RoomType);

            if (item != null)
            {
                packet.WriteString(item.Image);
            }

            if (data.Group != null)
            {
                packet.WriteInteger(data.Group == null ? 0 : data.Group.Id);
                packet.WriteString(data.Group == null ? "" : data.Group.Name);
                packet.WriteString(data.Group == null ? "" : data.Group.Badge);
            }

            if (data.Promotion != null)
            {
                packet.WriteString(promotion != null ? promotion.Name : "");
                packet.WriteString(promotion != null ? promotion.Description : "");
                packet.WriteInteger(promotion != null ? promotion.MinutesLeft : 0);
            }
        }
Exemple #2
0
        public RoomData(int id, string caption, string modelName, string ownerName, int ownerId, string password, int score, string type, string access, int usersNow, int usersMax, int category, string description,
            string tags, string floor, string landscape, int allowPets, int allowPetsEating, int roomBlockingEnabled, int hidewall, int wallThickness, int floorThickness, string wallpaper, int muteSettings,
            int banSettings, int kickSettings, int chatMode, int chatSize, int chatSpeed, int extraFlood, int chatDistance, int tradeSettings, bool pushEnabled, bool pullEnabled, bool superPushEnabled,
            bool superPullEnabled, bool enablesEnabled, bool respectedNotificationsEnabled, bool petMorphsAllowed, int groupId, int salePrice, bool layEnabled, RoomModel model)
        {
            Id = id;
            Name = caption;
            ModelName = modelName;
            OwnerName = ownerName;
            OwnerId = ownerId;
            Password = password;
            Score = score;
            Type = type;
            Access = RoomAccessUtility.ToRoomAccess(access);
            UsersNow = usersNow;
            UsersMax = usersMax;
            Category = category;
            Description = description;

            Tags = new List<string>();
            foreach (var Tag in tags.Split(','))
            {
                Tags.Add(Tag);
            }

            Floor = floor;
            Landscape = landscape;
            AllowPets = allowPets;
            AllowPetsEating = allowPetsEating;
            RoomBlockingEnabled = roomBlockingEnabled;
            Hidewall = hidewall;
            WallThickness = wallThickness;
            FloorThickness = floorThickness;
            Wallpaper = wallpaper;
            WhoCanMute = muteSettings;
            WhoCanBan = banSettings;
            WhoCanKick = kickSettings;
            ChatMode = chatMode;
            ChatSize = chatSize;
            ChatSpeed = chatSpeed;
            ExtraFlood = extraFlood;
            ChatDistance = chatDistance;
            TradeSettings = tradeSettings;
            PushEnabled = pushEnabled;
            PullEnabled = pullEnabled;
            SuperPushEnabled = superPushEnabled;
            SuperPullEnabled = superPullEnabled;
            EnablesEnabled = enablesEnabled;
            RespectNotificationsEnabled = respectedNotificationsEnabled;
            PetMorphsAllowed = petMorphsAllowed;
            SalePrice = salePrice;
            ReverseRollers = false;
            LayEnabled = layEnabled;

            if (groupId > 0)
            {
                Program.GameContext.GetGroupManager().TryGetGroup(groupId, out _group);
            }

            LoadPromotions();

            Model = model;
        }