示例#1
0
        public static void WriteRoom(ServerPacket Packet, RoomData Data, RoomPromotion Promotion, bool NewNavigator = false)
        {
            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 (string tag in Data.Tags)
            {
                Packet.WriteString(tag);
            }

            int 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;
            }

            FeaturedRoom Item = null;

            if (PlusEnvironment.GetGame().GetNavigator().TryGetFeaturedRoom(Data.Id, out 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);
            }
        }
示例#2
0
        public void Fill(DataRow Row)
        {
            Id          = Convert.ToInt32(Row["id"]);
            Name        = Convert.ToString(Row["caption"]);
            Description = Convert.ToString(Row["description"]);
            Type        = Convert.ToString(Row["roomtype"]);
            OwnerId     = Convert.ToInt32(Row["owner"]);

            OwnerName = "";
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `username` FROM `users` WHERE `id` = @owner LIMIT 1");
                dbClient.AddParameter("owner", OwnerId);
                string result = dbClient.GetString();
                if (!String.IsNullOrEmpty(result))
                {
                    OwnerName = result;
                }
            }

            this.Access = RoomAccessUtility.ToRoomAccess(Row["state"].ToString().ToLower());

            Category = Convert.ToInt32(Row["category"]);
            if (!string.IsNullOrEmpty(Row["users_now"].ToString()))
            {
                UsersNow = Convert.ToInt32(Row["users_now"]);
            }
            else
            {
                UsersNow = 0;
            }
            UsersMax            = Convert.ToInt32(Row["users_max"]);
            ModelName           = Convert.ToString(Row["model_name"]);
            Score               = Convert.ToInt32(Row["score"]);
            Tags                = new List <string>();
            AllowPets           = Convert.ToInt32(Row["allow_pets"].ToString());
            AllowPetsEating     = Convert.ToInt32(Row["allow_pets_eat"].ToString());
            RoomBlockingEnabled = Convert.ToInt32(Row["room_blocking_disabled"].ToString());
            Hidewall            = Convert.ToInt32(Row["allow_hidewall"].ToString());
            Password            = Convert.ToString(Row["password"]);
            Wallpaper           = Convert.ToString(Row["wallpaper"]);
            Floor               = Convert.ToString(Row["floor"]);
            Landscape           = Convert.ToString(Row["landscape"]);
            FloorThickness      = Convert.ToInt32(Row["floorthick"]);
            WallThickness       = Convert.ToInt32(Row["wallthick"]);
            WhoCanMute          = Convert.ToInt32(Row["mute_settings"]);
            WhoCanKick          = Convert.ToInt32(Row["kick_settings"]);
            WhoCanBan           = Convert.ToInt32(Row["ban_settings"]);
            chatMode            = Convert.ToInt32(Row["chat_mode"]);
            chatSpeed           = Convert.ToInt32(Row["chat_speed"]);
            chatSize            = Convert.ToInt32(Row["chat_size"]);
            TradeSettings       = Convert.ToInt32(Row["trade_settings"]);

            Group G = null;

            if (PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(Convert.ToInt32(Row["group_id"]), out G))
            {
                Group = G;
            }
            else
            {
                Group = null;
            }

            foreach (string Tag in Row["tags"].ToString().Split(','))
            {
                Tags.Add(Tag);
            }

            mModel = PlusEnvironment.GetGame().GetRoomManager().GetModel(ModelName);

            this.PushEnabled    = PlusEnvironment.EnumToBool(Row["push_enabled"].ToString());
            this.PullEnabled    = PlusEnvironment.EnumToBool(Row["pull_enabled"].ToString());
            this.SPushEnabled   = PlusEnvironment.EnumToBool(Row["spush_enabled"].ToString());
            this.SPullEnabled   = PlusEnvironment.EnumToBool(Row["spull_enabled"].ToString());
            this.EnablesEnabled = PlusEnvironment.EnumToBool(Row["enables_enabled"].ToString());
            this.RespectNotificationsEnabled = PlusEnvironment.EnumToBool(Row["respect_notifications_enabled"].ToString());
            this.PetMorphsAllowed            = PlusEnvironment.EnumToBool(Row["pet_morphs_allowed"].ToString());
        }
示例#3
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)
        {
            this.Id          = id;
            this.Name        = caption;
            this.ModelName   = modelName;
            this.OwnerName   = ownerName;
            this.OwnerId     = ownerId;
            this.Password    = password;
            this.Score       = score;
            this.Type        = type;
            this.Access      = RoomAccessUtility.ToRoomAccess(access);
            this.UsersNow    = usersNow;
            this.UsersMax    = usersMax;
            this.Category    = category;
            this.Description = description;

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

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

            if (groupId > 0)
            {
                PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(groupId, out this._group);
            }

            LoadPromotions();

            this._model = model;
        }