示例#1
0
        public VirtualRoom(DataRow Row)
        {
            Security.SecurityCounter Counter = new Security.SecurityCounter(-1);

            Id = BrickEngine.GetConvertor().ObjectToInt32(Row[Counter.Next]);
            Name = BrickEngine.GetConvertor().ObjectToString(Row[Counter.Next]);
            Description = BrickEngine.GetConvertor().ObjectToString(Row[Counter.Next]);
            OwnerId = BrickEngine.GetConvertor().ObjectToInt32(Row[Counter.Next]);
            CategoryId = BrickEngine.GetConvertor().ObjectToInt32(Row[Counter.Next]);
            LimitUsers = BrickEngine.GetConvertor().ObjectToInt32(Row[Counter.Next]);
            Password = BrickEngine.GetConvertor().ObjectToString(Row[Counter.Next]);
            ModelParam = BrickEngine.GetConvertor().ObjectToString(Row[Counter.Next]);

            string TagsParams = BrickEngine.GetConvertor().ObjectToString(Row[Counter.Next]);

            foreach (string Tag in TagsParams.Split(','))
            {
                if (Tag.Length > 0)
                {
                    Tags.Add(Tag);
                }
            }

            DoorState = BrickEngine.GetConvertor().ObjectToInt32(Row[Counter.Next]);

            int IconBg = BrickEngine.GetConvertor().ObjectToInt32(Row[Counter.Next]);
            int IconFg = BrickEngine.GetConvertor().ObjectToInt32(Row[Counter.Next]);
            string ItemsRaw = BrickEngine.GetConvertor().ObjectToString(Row[Counter.Next]);

            Icon = new RoomIcon(Id, IconBg, IconFg, ItemsRaw);

            Rating = BrickEngine.GetConvertor().ObjectToInt32(Row[Counter.Next]);

            AllowPets = BrickEngine.GetConvertor().ObjectToBoolean(Row[Counter.Next]);
            AllowPetsEat = BrickEngine.GetConvertor().ObjectToBoolean(Row[Counter.Next]);
            AllowWalkthough = BrickEngine.GetConvertor().ObjectToBoolean(Row[Counter.Next]);
            AllowHideWall = BrickEngine.GetConvertor().ObjectToBoolean(Row[Counter.Next]);

            WallThick = BrickEngine.GetConvertor().ObjectToInt32(Row[Counter.Next]);
            FloorThick = BrickEngine.GetConvertor().ObjectToInt32(Row[Counter.Next]);

            Wallpaper = BrickEngine.GetConvertor().ObjectToString(Row[Counter.Next]);
            Floor = BrickEngine.GetConvertor().ObjectToString(Row[Counter.Next]);
            Landscape = BrickEngine.GetConvertor().ObjectToString(Row[Counter.Next]);
        }
        public void Handle(GameClient session, ClientMessage message)
        {
            if (session != null && session.GetHabbo() != null && session.GetHabbo().GetRoomSession() != null)
            {
                Room room = Skylight.GetGame().GetRoomManager().TryGetRoom(session.GetHabbo().GetRoomSession().CurrentRoomID);
                if (room != null && room.HaveOwnerRights(session))
                {
                    uint roomId = message.PopWiredUInt();

                    int backgroundImage = message.PopWiredInt32();
                    int foregroundImage = message.PopWiredInt32();

                    if (backgroundImage >= 1 && backgroundImage <= 24 && (foregroundImage >= 0 && foregroundImage <= 11)) //valid images
                    {
                        Dictionary <int, int> items = new Dictionary <int, int>();
                        int itemsCount = message.PopWiredInt32();

                        for (int i = 0; i < itemsCount; i++)
                        {
                            int key   = message.PopWiredInt32();
                            int value = message.PopWiredInt32();
                            if (key < 0 || key > 10 || (value < 1 || value > 27) || items.ContainsKey(key))
                            {
                                continue;
                            }

                            items.Add(key, value);
                        }

                        RoomIcon roomIcon = new RoomIcon(backgroundImage, foregroundImage, items);
                        using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                        {
                            dbClient.AddParamWithValue("roomid", room.ID);
                            dbClient.AddParamWithValue("icon_bg", backgroundImage);
                            dbClient.AddParamWithValue("icon_fg", foregroundImage);
                            dbClient.AddParamWithValue("icon_items", roomIcon.ItemsToString());

                            dbClient.ExecuteQuery("UPDATE rooms SET icon_bg = @icon_bg, icon_fg = @icon_fg, icon_items = @icon_items WHERE id = @roomid LIMIT 1");
                        }

                        room.RoomData.RoomIcon = roomIcon;

                        ServerMessage roomThumbnailUpdated = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                        roomThumbnailUpdated.Init(r63aOutgoing.RoomThumbnailUpdated);
                        roomThumbnailUpdated.AppendUInt(room.ID);
                        roomThumbnailUpdated.AppendUInt(room.ID);
                        room.SendToAll(roomThumbnailUpdated);

                        ServerMessage roomUpdateOK = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                        roomUpdateOK.Init(r63aOutgoing.RoomUpdateOK);
                        roomUpdateOK.AppendUInt(room.ID);
                        room.SendToAll(roomUpdateOK);

                        ServerMessage roomData = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                        roomData.Init(r63aOutgoing.RoomData);
                        roomData.AppendBoolean(false);                     //entered room
                        room.RoomData.Serialize(roomData, false);
                        roomData.AppendBoolean(false);                     //forward
                        roomData.AppendBoolean(room.RoomData.IsStaffPick); //is staff pick
                        room.SendToAll(roomData);
                    }
                }
            }
        }
示例#3
0
 private void method_66(bool bool_13)
 {
     if (!this.bool_12)
     {
         this.bool_12 = true;
         if (bool_13)
         {
             this.bool_11 = false;
             if (this.timer_0 != null)
             {
                 this.bool_6 = true;
                 this.timer_0.Change(-1, -1);
             }
             this.method_64();
             using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
             {
                 @class.ExecuteQuery(string.Concat(new object[]
                 {
                     "UPDATE user_pets SET room_id = 0 WHERE room_id = ",
                     this.uint_0,
                     " AND NOT user_id = ",
                     GoldTree.GetGame().GetClientManager().method_27(this.Owner)
                 }));
             }
             this.timer_0.Dispose();
             this.timer_0 = null;
             this.bool_9 = false;
             if (this.Tags != null)
             {
                 this.Tags.Clear();
             }
             this.Tags = null;
             if (this.RoomUser_0 != null)
             {
                 Array.Clear(this.RoomUser_0, 0, this.RoomUser_0.Length);
             }
             this.RoomUser_0 = null;
             this.class29_0 = null;
             if (this.UsersWithRights != null)
             {
                 this.UsersWithRights.Clear();
             }
             this.class29_0 = null;
             if (this.dictionary_0 != null)
             {
                 this.dictionary_0.Clear();
             }
             this.dictionary_0 = null;
             this.Wallpaper = null;
             this.Floor = null;
             this.Landscape = null;
             if (this.hashtable_0 != null)
             {
                 this.hashtable_0.Clear();
             }
             this.hashtable_0 = null;
             if (this.hashtable_4 != null)
             {
                 this.hashtable_4.Clear();
             }
             this.hashtable_4 = null;
             this.class67_0 = null;
             if (this.list_2 != null)
             {
                 this.list_2.Clear();
             }
             this.list_2 = null;
         }
     }
 }
示例#4
0
 public Room(uint uint_2, string string_10, string string_11, string string_12, string string_13, int int_17, int int_18, int int_19, string string_14, string string_15, int int_20, List<string> list_18, bool bool_13, bool bool_14, bool bool_15, bool bool_16, RoomIcon class29_1, string string_16, string string_17, string string_18, string string_19, RoomData class27_1, bool bool_17, int int_21, int int_22, uint uint_3)
 {
     if (!(LicenseTools.String_0 == ""))
     {
         this.bool_12 = false;
         this.uint_0 = uint_2;
         this.Name = string_10;
         this.Description = string_11;
         this.Owner = string_13;
         this.Category = int_17;
         this.Type = string_12;
         this.State = int_18;
         this.UsersNow = 0;
         this.UsersMax = int_19;
         this.ModelName = string_14;
         this.CCTs = string_15;
         this.Score = int_20;
         this.Tags = list_18;
         this.AllowPet = bool_13;
         this.AllowPetsEating = bool_14;
         this.AllowWalkthrough = bool_15;
         this.Hidewall = bool_16;
         this.Wallthick = int_21;
         this.Floorthick = int_22;
         this.int_7 = 0;
         this.RoomUser_0 = new RoomUser[500];
         this.class29_0 = class29_1;
         this.Password = string_16;
         this.dictionary_0 = new Dictionary<uint, double>();
         this.Event = null;
         this.Wallpaper = string_17;
         this.Floor = string_18;
         this.Landscape = string_19;
         this.hashtable_4 = new Hashtable();
         this.hashtable_0 = new Hashtable();
         this.list_2 = new List<Trade>();
         this.class28_0 = GoldTree.GetGame().GetRoomManager().GetModel(this.ModelName, this.uint_0);
         this.bool_6 = false;
         this.bool_7 = false;
         this.bool_5 = true;
         this.class27_0 = class27_1;
         this.bool_8 = bool_17;
         this.list_17 = new List<GroupsManager>();
         this.list_4 = new List<uint>();
         this.list_5 = new List<RoomItem>();
         this.list_9 = new List<RoomItem>();
         this.list_7 = new List<RoomItem>();
         this.list_6 = new List<RoomItem>();
         this.list_8 = new List<RoomItem>();
         this.list_10 = new List<RoomItem>();
         this.list_11 = new List<RoomItem>();
         this.list_12 = new List<RoomItem>();
         this.list_13 = new List<RoomItem>();
         this.int_10 = 0;
         this.int_11 = 0;
         this.int_9 = 0;
         this.int_12 = 0;
         this.int_13 = 0;
         this.list_3 = new List<RoomItem>();
         this.list_14 = new List<RoomItem>();
         this.list_15 = new List<RoomItem>();
         this.list_16 = new List<RoomItem>();
         this.byte_0 = new byte[this.Class28_0.int_4, this.Class28_0.int_5];
         this.double_1 = new double[this.Class28_0.int_4, this.Class28_0.int_5];
         this.double_2 = new double[this.Class28_0.int_4, this.Class28_0.int_5];
         this.timer_0 = new Timer(new TimerCallback(this.method_32), null, 480, 480);
         this.int_8 = 0;
         this.bool_4 = false;
         this.bool_9 = true;
         this.bool_11 = false;
         this.int_16 = 0;
         this.int_15 = 4;
         this.Achievement = uint_3;
         this.bool_10 = false;
         this.hashtable_1 = new Hashtable();
         this.hashtable_2 = new Hashtable();
         this.hashtable_3 = new Hashtable();
         this.method_23();
         this.method_25();
         this.method_22();
         this.LoadMusic();
     }
 }
示例#5
0
文件: Room.cs 项目: habb0/Bfly
        private void Initialize(UInt32 Id, string Name, string Description, string Type, string Owner, int Category,
            int State, int UsersMax, string ModelName, string CCTs, int Score, List<string> pTags, bool AllowPets,
            bool AllowPetsEating, bool AllowWalkthrough, bool Hidewall, RoomIcon Icon, string Password, string Wallpaper, string Floor,
            string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness)
        {
            this.mDisposed = false;
            this.Id = Id;
            this.Name = Name;
            this.Description = Description;
            this.Owner = Owner;
            this.Category = Category;
            this.Type = Type;
            this.State = State;
            this.UsersNow = 0;
            this.UsersMax = UsersMax;
            this.ModelName = ModelName;
            this.CCTs = CCTs;
            this.Score = Score;

            tagCount = 0;
            this.Tags = new ArrayList();
            foreach (string tag in pTags)
            {
                tagCount++;
                Tags.Add(tag);
            }

            this.AllowPets = AllowPets;
            this.AllowPetsEating = AllowPetsEating;
            this.AllowWalkthrough = AllowWalkthrough;
            this.Hidewall = Hidewall;

            this.myIcon = Icon;
            this.Password = Password;
            this.Bans = new Dictionary<UInt32, double>();
            this.Wallpaper = Wallpaper;
            this.Floor = Floor;
            this.Landscape = Landscape;
            this.chatMessageManager = new ChatMessageManager();
            this.groups = new QueuedDictionary<int, Group>();
            this.ActiveTrades = new ArrayList();

            this.mCycleEnded = false;

            this.mRoomData = RoomData;
            this.EveryoneGotRights = RightOverride;

            this.roomMessages = new Queue();
            this.chatMessageQueue = new Queue();
            this.rnd = new Random();

            this.roomMessages = new Queue();
            this.roomAlerts = new Queue();
            this.roomBadge = new Queue();
            this.roomKick = new Queue();
            this.roomServerMessages = new Queue();
            this.IdleTime = 0;
            this.RoomMuted = false;
            this.WallThickness = walltickness;
            this.FloorThickness = floorthickness;

            this.gamemap = new Gamemap(this);
            this.roomItemHandling = new RoomItemHandling(this);
            this.roomUserManager = new RoomUserManager(this);
            this.wiredHandler = new WiredHandler(this);

            LoadRights();
            GetRoomItemHandler().LoadFurniture();
            wiredHandler.LoadWired();
            GetGameMap().GenerateMaps();
            LoadMusic();
            //LoadBots();
            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                if (dbClient.dbType == Database_Manager.Database.DatabaseType.MySQL)
                {
                    dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + Id + ",1)");
                }
                else
                {
                    dbClient.runFastQuery("IF EXISTS (SELECT roomid FROM room_active WHERE roomid = " + Id + ") " +
                                            "UPDATE room_active SET active_users = 1 WHERE roomid = " + Id + " " +
                                            "ELSE " +
                                            "INSERT INTO room_active VALUES (" + Id + ",1)");
                }
            }

            ButterflyEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData);
        }
示例#6
0
        public Brush GetRoomIconBrush(RoomIcon roomIcon)
        {
            if (_fetchedRoomIcons.ContainsKey(roomIcon))
            {
                return(_fetchedRoomIcons[roomIcon]);
            }

            Brush result;

            switch (roomIcon)
            {
            case RoomIcon.None:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_None");
                break;

            case RoomIcon.FoodShop:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_FoodShop");
                break;

            case RoomIcon.WeaponShop:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_WeaponShop");
                break;

            case RoomIcon.MagicShop:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_MagicShop");
                break;

            case RoomIcon.LeatherShop:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_LeatherShop");
                break;

            case RoomIcon.Bank:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Bank");
                break;

            case RoomIcon.Route:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Route");
                break;

            case RoomIcon.Quester:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Quester");
                break;

            case RoomIcon.Archer:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Archer");
                break;

            case RoomIcon.Barbarian:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Barbarian");
                break;

            case RoomIcon.Cleric:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Cleric");
                break;

            case RoomIcon.DarkKnight:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_DarkKnight");
                break;

            case RoomIcon.Druid:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Druid");
                break;

            case RoomIcon.Mage:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Mage");
                break;

            case RoomIcon.Paladin:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Paladin");
                break;

            case RoomIcon.Pathfinder:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_PathFinder");
                break;

            case RoomIcon.Thief:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Thief");
                break;

            case RoomIcon.Warrior:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Warrior");
                break;

            case RoomIcon.Question:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Question");
                break;

            case RoomIcon.Horse:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Horse");
                break;

            case RoomIcon.Doska:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Doska");
                break;

            case RoomIcon.Sklad:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Sklad");
                break;

            case RoomIcon.Post:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_Post");
                break;

            case RoomIcon.MiscShop:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_MiscShop");
                break;

            default:
                result = (Brush)_zoneVisual.FindResource("Brush_MapIcon_None");
                break;
            }

            _fetchedRoomIcons[roomIcon] = result;
            return(result);
        }