Exemple #1
0
        public bool Execute(params object[] Stuff)
        {
            RoomUser roomUser = (RoomUser)Stuff[0];
            RoomItem roomItem = (RoomItem)Stuff[1];

            if (roomUser == null || roomItem == null)
            {
                return(false);
            }
            if (!this.mItems.Contains(roomItem))
            {
                return(false);
            }
            this.mUsers.Add(roomUser);
            if (this.mDelay == 0)
            {
                this.Room.GetWiredHandler().OnEvent(this);
                this.OnCycle();
            }
            else
            {
                if (this.mNext == 0L || this.mNext < CyberEnvironment.Now())
                {
                    this.mNext = checked (CyberEnvironment.Now() + unchecked ((long)this.mDelay));
                }
                this.mRoom.GetWiredHandler().EnqueueCycle(this);
            }
            return(true);
        }
Exemple #2
0
        public bool Execute(params object[] Stuff)
        {
            RoomUser      roomUser = (RoomUser)Stuff[0];
            WiredItemType item     = (WiredItemType)Stuff[1];

            if (this.mBanned.Contains(item))
            {
                return(false);
            }
            if (roomUser == null || this.mItems.Count == 0 || this.mRoom.GetWiredHandler().IsCycleQueued(this))
            {
                return(false);
            }
            if (this.mDelay < 500)
            {
                this.mDelay = 500;
            }
            if (this.mNext == 0L || this.mNext < CyberEnvironment.Now())
            {
                this.mNext = checked (CyberEnvironment.Now() + unchecked ((long)this.mDelay));
            }
            lock (this.mUsers.SyncRoot)
            {
                if (!this.mUsers.Contains(roomUser))
                {
                    this.mUsers.Enqueue(roomUser);
                }
            }
            this.mRoom.GetWiredHandler().EnqueueCycle(this);
            return(true);
        }
Exemple #3
0
        public bool Execute(params object[] Stuff)
        {
            RoomUser roomUser = (RoomUser)Stuff[0];
            RoomItem roomItem = (RoomItem)Stuff[1];

            if (!this.mItems.Contains(roomItem) || roomUser.LastItem != roomItem.Id)
            {
                return(false);
            }
            foreach (ThreeDCoord current in roomItem.GetAffectedTiles.Values)
            {
                if ((current.X == roomUser.X && current.Y == roomUser.Y) || (roomUser.X == roomItem.GetX && roomUser.Y == roomItem.GetY))
                {
                    return(false);
                }
            }
            this.mUsers.Enqueue(roomUser);
            if (this.mDelay == 0)
            {
                this.OnCycle();
            }
            else
            {
                this.mNext = checked (CyberEnvironment.Now() + unchecked ((long)this.mDelay));
                this.mRoom.GetWiredHandler().EnqueueCycle(this);
            }
            return(true);
        }
Exemple #4
0
 public bool Execute(params object[] Stuff)
 {
     if (this.mItems.Count == 0)
     {
         return(false);
     }
     checked
     {
         if (this.mDelay > 0)
         {
             if (this.mNext == 0L || this.mNext < CyberEnvironment.Now())
             {
                 this.mNext = CyberEnvironment.Now() + unchecked ((long)this.mDelay);
             }
             this.Room.GetWiredHandler().EnqueueCycle(this);
         }
         else
         {
             this.mNext = 0L;
             if (!this.OnCycle())
             {
                 if (this.mNext == 0L || this.mNext < CyberEnvironment.Now())
                 {
                     this.mNext = CyberEnvironment.Now() + unchecked ((long)this.mDelay);
                 }
                 this.Room.GetWiredHandler().EnqueueCycle(this);
             }
         }
         return(true);
     }
 }
Exemple #5
0
        public bool OnCycle()
        {
            if (this.mItems.Count == 0)
            {
                return(true);
            }
            long num = CyberEnvironment.Now();

            if (this.mNext < num)
            {
                foreach (RoomItem current in this.mItems)
                {
                    if (current != null && this.Room.GetRoomItemHandler().mFloorItems.ContainsKey(current.Id))
                    {
                        current.Interactor.OnWiredTrigger(current);
                    }
                }
            }
            if (this.mNext < num)
            {
                this.mNext = 0L;
                return(true);
            }
            return(false);
        }
Exemple #6
0
 public LongRepeater(RoomItem Item, Room Room)
 {
     this.mItem  = Item;
     this.mRoom  = Room;
     this.mDelay = 10000;
     this.mRoom.GetWiredHandler().EnqueueCycle(this);
     if (this.mNext == 0L || this.mNext < CyberEnvironment.Now())
     {
         this.mNext = checked (CyberEnvironment.Now() + unchecked ((long)this.mDelay));
     }
 }
Exemple #7
0
 public bool Execute(params object[] Stuff)
 {
     if (this.mNext == 0L || this.mNext < CyberEnvironment.Now())
     {
         this.mNext = checked (CyberEnvironment.Now() + unchecked ((long)this.mDelay));
     }
     if (!this.mRoom.GetWiredHandler().IsCycleQueued(this))
     {
         this.mRoom.GetWiredHandler().EnqueueCycle(this);
     }
     return(true);
 }
Exemple #8
0
        public bool OnCycle()
        {
            if (this.mUsers.Count == 0)
            {
                return(true);
            }
            if (this.Room == null || this.Room.GetRoomItemHandler() == null || this.Room.GetRoomItemHandler().mFloorItems == null)
            {
                return(false);
            }
            Queue queue = new Queue();
            long  num   = CyberEnvironment.Now();

            lock (this.mUsers.SyncRoot)
            {
                while (this.mUsers.Count > 0)
                {
                    RoomUser roomUser = (RoomUser)this.mUsers.Dequeue();
                    if (roomUser != null && roomUser.GetClient() != null)
                    {
                        if (this.mNext < num)
                        {
                            bool flag2 = this.Teleport(roomUser);
                            if (flag2)
                            {
                                bool result = false;
                                return(result);
                            }
                        }
                        else
                        {
                            if (checked (this.mNext - num) < 500L)
                            {
                                roomUser.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(4);
                                queue.Enqueue(roomUser);
                            }
                            else
                            {
                                queue.Enqueue(roomUser);
                            }
                        }
                    }
                }
            }
            if (this.mNext < num)
            {
                this.mNext = 0L;
                return(true);
            }
            this.mUsers = queue;
            return(false);
        }
Exemple #9
0
        public bool OnCycle()
        {
            long num = CyberEnvironment.Now();

            if (num > this.mNext)
            {
                lock (this.mUsers.SyncRoot)
                {
                    while (this.mUsers.Count > 0)
                    {
                        RoomUser         roomUser   = (RoomUser)this.mUsers.Dequeue();
                        List <WiredItem> conditions = this.mRoom.GetWiredHandler().GetConditions(this);
                        List <WiredItem> effects    = this.mRoom.GetWiredHandler().GetEffects(this);
                        if (conditions.Count > 0)
                        {
                            foreach (WiredItem current in conditions)
                            {
                                if (!current.Execute(new object[]
                                {
                                    roomUser
                                }))
                                {
                                    return(false);
                                }
                                this.mRoom.GetWiredHandler().OnEvent(current);
                            }
                        }
                        if (effects.Count > 0)
                        {
                            foreach (WiredItem current2 in effects)
                            {
                                if (current2.Execute(new object[]
                                {
                                    roomUser,
                                    this.mType
                                }))
                                {
                                    this.mRoom.GetWiredHandler().OnEvent(current2);
                                }
                            }
                        }
                    }
                }
                this.mNext = 0L;
                this.Room.GetWiredHandler().OnEvent(this);
                return(true);
            }
            return(false);
        }
Exemple #10
0
        public bool Execute(params object[] Stuff)
        {
            RoomUser roomUser = (RoomUser)Stuff[0];

            if (roomUser == null || this.mItems.Count == 0)
            {
                return(false);
            }
            if (this.mNext == 0L || this.mNext < CyberEnvironment.Now())
            {
                this.mNext = checked (CyberEnvironment.Now() + unchecked ((long)this.mDelay));
            }
            this.mRoom.GetWiredHandler().EnqueueCycle(this);
            return(true);
        }
Exemple #11
0
        public bool OnCycle()
        {
            long num = CyberEnvironment.Now();

            if (this.mNext < num)
            {
                List <WiredItem> conditions = this.mRoom.GetWiredHandler().GetConditions(this);
                List <WiredItem> effects    = this.mRoom.GetWiredHandler().GetEffects(this);
                foreach (RoomUser current in this.mUsers)
                {
                    if (conditions.Count > 0)
                    {
                        foreach (WiredItem current2 in conditions)
                        {
                            if (current2.Execute(new object[]
                            {
                                current
                            }))
                            {
                                this.mRoom.GetWiredHandler().OnEvent(current2);
                            }
                        }
                    }
                    if (effects.Count > 0)
                    {
                        foreach (WiredItem current3 in effects)
                        {
                            if (current3.Execute(new object[]
                            {
                                current,
                                this.Type
                            }))
                            {
                                this.mRoom.GetWiredHandler().OnEvent(current3);
                            }
                        }
                    }
                }
                this.Room.GetWiredHandler().OnEvent(this);
                this.mNext = 0L;
                return(true);
            }
            return(false);
        }
Exemple #12
0
        public bool Execute(params object[] Stuff)
        {
            RoomUser roomUser = (RoomUser)Stuff[0];
            RoomItem roomItem = (RoomItem)Stuff[1];

            if (!this.mItems.Contains(roomItem) || (roomUser.LastItem != 0 && roomUser.LastItem == roomItem.Id))
            {
                return(false);
            }
            this.mUsers.Enqueue(roomUser);
            if (this.mDelay == 0)
            {
                this.OnCycle();
            }
            else
            {
                this.mNext = checked (CyberEnvironment.Now() + unchecked ((long)this.mDelay));
                this.mRoom.GetWiredHandler().EnqueueCycle(this);
            }
            return(true);
        }
Exemple #13
0
        public bool OnCycle()
        {
            long num = CyberEnvironment.Now();

            if (this.mNext < num)
            {
                List <WiredItem> conditions = this.mRoom.GetWiredHandler().GetConditions(this);
                List <WiredItem> effects    = this.mRoom.GetWiredHandler().GetEffects(this);
                if (conditions.Count > 0)
                {
                    foreach (WiredItem current in conditions)
                    {
                        if (!current.Execute(null))
                        {
                            return(false);
                        }
                        this.mRoom.GetWiredHandler().OnEvent(current);
                    }
                }
                if (effects.Count > 0)
                {
                    foreach (WiredItem current2 in effects)
                    {
                        foreach (RoomUser current3 in this.Room.GetRoomUserManager().UserList.Values)
                        {
                            current2.Execute(new object[]
                            {
                                current3,
                                this.mType
                            });
                        }
                        this.mRoom.GetWiredHandler().OnEvent(current2);
                    }
                }
                this.mNext = checked (CyberEnvironment.Now() + unchecked ((long)this.mDelay));
                return(false);
            }
            return(false);
        }
Exemple #14
0
        public bool OnCycle()
        {
            long num = CyberEnvironment.Now();

            if (this.Room == null || this.Room.GetRoomItemHandler() == null || this.Room.GetRoomItemHandler().mFloorItems == null)
            {
                return(false);
            }
            if (this.mNext < num)
            {
                foreach (RoomItem current in this.mItems)
                {
                    if (current != null && this.Room.GetRoomItemHandler().mFloorItems.ContainsKey(current.Id))
                    {
                        Point left = this.HandleMovement(this.mDir, new Point(current.GetX, current.GetY));
                        int   num2 = this.HandleRotation(this.mRot, current.Rot);
                        if (this.mRoom.GetGameMap().CanRollItemHere(left.X, left.Y) && !this.mRoom.GetGameMap().SquareHasUsers(left.X, left.Y))
                        {
                            double          num3 = 0.0;
                            bool            flag = true;
                            List <RoomItem> roomItemForSquare = this.mRoom.GetGameMap().GetRoomItemForSquare(left.X, left.Y);
                            foreach (RoomItem current2 in roomItemForSquare)
                            {
                                if (current2 != null)
                                {
                                    if (current2.TotalHeight > num3)
                                    {
                                        num3 = current.TotalHeight;
                                    }
                                    if (flag && !current2.GetBaseItem().Stackable)
                                    {
                                        flag = false;
                                    }
                                }
                            }
                            if (num2 != current.Rot)
                            {
                                current.Rot = num2;
                                ServerMessage message = new ServerMessage(Outgoing.UpdateRoomItemMessageComposer);
                                current.Serialize(message);
                                this.mRoom.SendMessage(message);
                            }
                            if (flag && left != current.Coordinate)
                            {
                                ServerMessage serverMessage = new ServerMessage();
                                serverMessage.Init(Outgoing.ItemAnimationMessageComposer);
                                serverMessage.AppendInt32(current.GetX);
                                serverMessage.AppendInt32(current.GetY);
                                serverMessage.AppendInt32(left.X);
                                serverMessage.AppendInt32(left.Y);
                                serverMessage.AppendInt32(1);
                                serverMessage.AppendUInt(current.Id);
                                serverMessage.AppendString(TextHandling.GetString(current.GetZ));
                                serverMessage.AppendString(TextHandling.GetString(num3));
                                serverMessage.AppendInt32(0);
                                this.mRoom.SendMessage(serverMessage);
                                this.mRoom.GetRoomItemHandler().SetFloorItem(current, left.X, left.Y, num3);
                            }
                        }
                    }
                }
                this.mNext = 0L;
                return(true);
            }
            return(false);
        }