示例#1
0
        public RoomAdapter(Room Information)
        {
            this.Information = Information;
            this.Units = new Dictionary<int, RoomUnit>();
            this.UnitLocker = new ReaderWriterLockSlim();
            this.UnitCounter = new SafeInteger(0, true);

            this.BlockNodes = new List<BlockNode>();

            foreach (TileNode Node in Information.Model.Nodes)
            {
                var Point = new Point(Node.IX, Node.IY);

                var State = Node.DeadTile ? BlockState.BLOCKED : BlockState.OPEN;

                if (Point == new Point(Information.Model.LocationDoorX, Information.Model.LocationDoorY))
                {
                    State = BlockState.OPEN_LAST_STEP;
                }

                var Block = new BlockNode(Point, Node.Height, State);

                this.BlockNodes.Add(Block);
            }
        }
示例#2
0
        public TazqonRoomInformationComposer(Room Room, bool Events)
        {
            base.Write(Room.Id);
            base.Write(Events);
            base.Write(Room.Caption);
            base.Write(System.HabboSystem.CharacterManager.GetUsername(Room.CharacterId));
            base.Write((int)Room.DoorState);
            base.Write(Room.HasAdapter ? Room.Adapter.PlayersAmount : 0);
            base.Write(Room.Model.MaximalUnits);
            base.Write(Room.Description);
            base.Write(0); // ??
            base.Write(true); // enable trade
            base.Write(0); // rating
            base.Write(0);// catid
            base.Write(string.Empty);
            base.Write(0); // tag count

            //Array.ForEach(Item.Tags.ToArray(), Message.Append);

            base.Write(0); // Bg icon
            base.Write(0); // fg icon
            base.Write(0); // icon amount (int, int)

            base.Write(false); // allopets
            base.Write(false); // allopetseat
        }
示例#3
0
文件: Rooms.cs 项目: devMextur/Tazqon
 public GetGuestRoomResultComposer(Room Room, bool LoadingState, bool Following)
 {
     base.WriteHeader(MessageComposerIds.GetGuestRoomResultComposer);
     base.Write(LoadingState);
     base.Write(new TazqonRoomInformationComposer(Room, false));
     base.Write(Following);
     base.Write(LoadingState);
 }
示例#4
0
        public bool GetRoom(int RoomId, out Room Room)
        {
            Room = GetRoom(RoomId);

            return Room != null;
        }
示例#5
0
        public Room GetRoom(int RoomId)
        {
            RoomAdapter Adapter;
            Room Room;

            if (!Adapters.TryGetValue(RoomId, out Adapter))
            {
                if (!WeakSQLCache.TryGetValue(RoomId, out Room))
                {
                    Room = new Room(System.MySQLManager.GetObject(new RoomInfoQuery(RoomId)).GetOutput<DataRow>());
                    WeakSQLCache.Add(RoomId, Room);
                }
            }
            else Room = Adapter.Information;

            return Room;
        }
示例#6
0
        public bool EnterRoom(Session Session,int RoomId, string Password, out Room Room)
        {
            Room = System.HabboSystem.RoomManager.GetRoom(RoomId);

            if (Room == null)
            {
                return false;
            }

            if (Room.GetRoomRight(Session.Character.Id) != RoomRight.Owner)
            {
                if (Room.DoorState == DoorState.Password)
                {
                    if (Room.Password != Password)
                    {
                        Session.WriteComposer(new GenericErrorComposer(-100002));
                        Session.WriteComposer(new CloseConnectionMessageComposer());
                        return false;
                    }
                }
            }

            RoomAdapter Adapter = System.HabboSystem.RoomManager.CastAdapter(RoomId);

            if (System.HabboSystem.RoomManager.HasAdapter(RoomId))
            {
                if (Room.GetRoomRight(Session.Character.Id) != RoomRight.Owner)
                {
                    if (Adapter.PlayersAmount >= Adapter.Information.Model.MaximalUnits)
                    {
                        Session.WriteComposer(new CantConnectMessageComposer(1));
                        Session.WriteComposer(new CloseConnectionMessageComposer());
                        return false;
                    }
                }
            }

            Session.WriteComposer(new OpenConnectionMessageComposer());

            return true;
        }