public DynamicRoomModel(RoomModel pModel)
        {
            staticModel = pModel;
            DoorX       = staticModel.DoorX;
            DoorY       = staticModel.DoorY;
            DoorZ       = staticModel.DoorZ;

            DoorOrientation = staticModel.DoorOrientation;
            Heightmap       = staticModel.Heightmap;

            MapSizeX = staticModel.MapSizeX;
            MapSizeY = staticModel.MapSizeY;
            ClubOnly = staticModel.ClubOnly;

            this.RelativeHeightmap = string.Empty;

            Generate();
        }
Exemple #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 = RavenEnvironment.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"]);
            RollerSpeed         = Convert.ToInt32(Row["roller_speed"]);

            Group G = null;

            if (RavenEnvironment.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 = RavenEnvironment.GetGame().GetRoomManager().GetModel(ModelName);

            this.PushEnabled    = RavenEnvironment.EnumToBool(Row["push_enabled"].ToString());
            this.PullEnabled    = RavenEnvironment.EnumToBool(Row["pull_enabled"].ToString());
            this.SPushEnabled   = RavenEnvironment.EnumToBool(Row["spush_enabled"].ToString());
            this.SPullEnabled   = RavenEnvironment.EnumToBool(Row["spull_enabled"].ToString());
            this.EnablesEnabled = RavenEnvironment.EnumToBool(Row["enables_enabled"].ToString());
            this.RespectNotificationsEnabled = RavenEnvironment.EnumToBool(Row["respect_notifications_enabled"].ToString());
            this.PetMorphsAllowed            = RavenEnvironment.EnumToBool(Row["pet_morphs_allowed"].ToString());
            this.Shoot     = Convert.ToInt32(Row["shoot"]);
            this.HideWired = RavenEnvironment.EnumToBool(Row["hide_wired"].ToString());

            WiredScoreBordDay   = new Dictionary <int, KeyValuePair <int, string> >();
            WiredScoreBordWeek  = new Dictionary <int, KeyValuePair <int, string> >();
            WiredScoreBordMonth = new Dictionary <int, KeyValuePair <int, string> >();

            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                List <bool> SuperCheck = new List <bool>()
                {
                    false,
                    false,
                    false
                };

                DateTime now           = DateTime.Now;
                int      getdaytoday   = Convert.ToInt32(now.ToString("MMddyyyy"));
                int      getmonthtoday = Convert.ToInt32(now.ToString("MM"));
                int      getweektoday  = CultureInfo.GetCultureInfo("Nl-nl").Calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);

                this.WiredScoreFirstBordInformation = new List <int>()
                {
                    getdaytoday,
                    getmonthtoday,
                    getweektoday
                };

                dbClient.SetQuery("SELECT * FROM wired_scorebord WHERE roomid = @id ORDER BY `punten` DESC ");
                dbClient.AddParameter("id", this.Id);
                foreach (DataRow row in dbClient.getTable().Rows)
                {
                    int    userid    = Convert.ToInt32(row["userid"]);
                    string username  = Convert.ToString(row["username"]);
                    int    Punten    = Convert.ToInt32(row["punten"]);
                    string soort     = Convert.ToString(row["soort"]);
                    int    timestamp = Convert.ToInt32(row["timestamp"]);
                    if ((!(soort == "day") || this.WiredScoreBordDay.ContainsKey(userid) ? false : !SuperCheck[0]))
                    {
                        if (timestamp != getdaytoday)
                        {
                            SuperCheck[0] = false;
                        }
                        if (!SuperCheck[0])
                        {
                            this.WiredScoreBordDay.Add(userid, new KeyValuePair <int, string>(Punten, username));
                        }
                    }
                    if ((!(soort == "month") || this.WiredScoreBordMonth.ContainsKey(userid) ? false : !SuperCheck[1]))
                    {
                        if (timestamp != getmonthtoday)
                        {
                            SuperCheck[1] = false;
                        }
                        this.WiredScoreBordMonth.Add(userid, new KeyValuePair <int, string>(Punten, username));
                    }
                    if ((!(soort == "week") || this.WiredScoreBordWeek.ContainsKey(userid) ? false : !SuperCheck[2]))
                    {
                        if (timestamp != getweektoday)
                        {
                            SuperCheck[2] = false;
                        }
                        this.WiredScoreBordWeek.Add(userid, new KeyValuePair <int, string>(Punten, username));
                    }
                }
                if (SuperCheck[0])
                {
                    dbClient.RunQuery(string.Concat("DELETE FROM `wired_scorebord` WHERE `roomid`='", this.Id, "' AND `soort`='day'"));
                    this.WiredScoreBordDay.Clear();
                }
                if (SuperCheck[1])
                {
                    dbClient.RunQuery(string.Concat("DELETE FROM `wired_scorebord` WHERE `roomid`='", this.Id, "' AND `soort`='month'"));
                    this.WiredScoreBordMonth.Clear();
                }
                if (SuperCheck[2])
                {
                    dbClient.RunQuery(string.Concat("DELETE FROM `wired_scorebord` WHERE `roomid`='", this.Id, "' AND `soort`='week'"));
                    this.WiredScoreBordDay.Clear();
                }
            }
        }
Exemple #3
0
 public bool TryGetModel(string Id, out RoomModel Model)
 {
     return(this._roomModels.TryGetValue(Id, out Model));
 }