Esempio n. 1
0
        public bool Execute(params object[] stuff)
        {
            var roomUser = (RoomUser)stuff[0];
            var roomItem = (RoomItem)stuff[1];

            if (roomUser == null || roomItem == null)
            {
                return(false);
            }
            if (!this.Items.Contains(roomItem))
            {
                return(false);
            }
            this._mUsers.Add(roomUser);
            if (this.Delay == 0)
            {
                WiredHandler.OnEvent(this);
                this.OnCycle();
            }
            else
            {
                if (this._mNext == 0L || this._mNext < Plus.Now())
                {
                    this._mNext = (Plus.Now() + (this.Delay));
                }
                Room.GetWiredHandler().EnqueueCycle(this);
            }
            return(true);
        }
Esempio n. 2
0
        public bool OnCycle()
        {
            if (!Items.Any())
            {
                return(true);
            }

            var num = Plus.Now();

            if (_mNext < num)
            {
                foreach (
                    var current in
                    Items.Where(
                        current => current != null && Room.GetRoomItemHandler().FloorItems.ContainsKey(current.Id))
                    )
                {
                    current.Interactor.OnWiredTrigger(current);
                }
            }
            if (_mNext >= num)
            {
                return(false);
            }
            _mNext = 0L;
            return(true);
        }
Esempio n. 3
0
        public bool Execute(params object[] stuff)
        {
            var roomUser = (RoomUser)stuff[0];
            var roomItem = (RoomItem)stuff[1];

            if (!this.Items.Contains(roomItem) || roomUser.LastItem != roomItem.Id)
            {
                return(false);
            }
            if (
                roomItem.AffectedTiles.Values.Any(
                    current => (current.X == roomUser.X && current.Y == roomUser.Y) || (roomUser.X == roomItem.X && roomUser.Y == roomItem.Y)))
            {
                return(false);
            }
            this.ToWork.Enqueue(roomUser);
            if (this.Delay == 0)
            {
                this.OnCycle();
            }
            else
            {
                this._mNext = (Plus.Now() + (this.Delay));

                this.Room.GetWiredHandler().EnqueueCycle(this);
            }
            return(true);
        }
Esempio n. 4
0
        public bool OnCycle()
        {
            var num = Plus.Now();

            if (_mNext >= num)
            {
                return(false);
            }
            var conditions = Room.GetWiredHandler().GetConditions(this);
            var effects    = Room.GetWiredHandler().GetEffects(this);

            if (conditions.Any())
            {
                foreach (var current in conditions)
                {
                    if (!current.Execute(null))
                    {
                        return(false);
                    }
                    WiredHandler.OnEvent(current);
                }
            }
            if (effects.Any())
            {
                foreach (var current2 in effects)
                {
                    current2.Execute(null, Type);
                    WiredHandler.OnEvent(current2);
                }
            }
            _mNext = (Plus.Now() + (Delay));

            return(false);
        }
Esempio n. 5
0
 public LongRepeater(RoomItem item, Room room)
 {
     Item  = item;
     Room  = room;
     Delay = 10000;
     Room.GetWiredHandler().EnqueueCycle(this);
     if (_mNext == 0L || _mNext < Plus.Now())
     {
         _mNext = (Plus.Now() + (Delay));
     }
 }
Esempio n. 6
0
 public bool Execute(params object[] stuff)
 {
     if (_mNext == 0L || _mNext < Plus.Now())
     {
         _mNext = (Plus.Now() + (Delay));
     }
     if (!Room.GetWiredHandler().IsCycleQueued(this))
     {
         Room.GetWiredHandler().EnqueueCycle(this);
     }
     return(true);
 }
Esempio n. 7
0
        public bool OnCycle()
        {
            if (!ToWorkConcurrentQueue.Any())
            {
                return(true);
            }
            if (Room == null || Room.GetRoomItemHandler() == null || Room.GetRoomItemHandler().FloorItems == null)
            {
                return(false);
            }

            var      num   = Plus.Now();
            var      toAdd = new List <RoomUser>();
            RoomUser roomUser;

            while (ToWorkConcurrentQueue.TryDequeue(out roomUser))
            {
                if (roomUser == null || roomUser.GetClient() == null)
                {
                    continue;
                }
                if (_mNext <= num)
                {
                    if (Teleport(roomUser))
                    {
                        continue;
                    }
                    return(false);
                }
                if (_mNext - num < 500L && roomUser.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent() != null)
                {
                    roomUser.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(4);
                }

                toAdd.Add(roomUser);
            }

            foreach (var roomUserToAdd in toAdd.Where(roomUserToAdd => !ToWorkConcurrentQueue.Contains(roomUserToAdd)))
            {
                ToWorkConcurrentQueue.Enqueue(roomUserToAdd);
            }

            toAdd.Clear();
            toAdd = null;

            if (_mNext >= num)
            {
                return(false);
            }
            _mNext = 0L;
            return(true);
        }
Esempio n. 8
0
 public bool Execute(params object[] stuff)
 {
     if (!Items.Any())
     {
         return(false);
     }
     if (_mNext == 0L || _mNext < Plus.Now())
     {
         _mNext = (Plus.Now() + (Delay));
     }
     Room.GetWiredHandler().EnqueueCycle(this);
     return(true);
 }
Esempio n. 9
0
        public bool OnCycle()
        {
            long num = Plus.Now();

            if (num <= this._mNext)
            {
                return(false);
            }
            lock (this.ToWork.SyncRoot)
            {
                while (this.ToWork.Count > 0)
                {
                    var roomUser = (RoomUser)this.ToWork.Dequeue();
                    List <IWiredItem> conditions = this.Room.GetWiredHandler().GetConditions(this);
                    List <IWiredItem> effects    = this.Room.GetWiredHandler().GetEffects(this);
                    if (conditions.Any())
                    {
                        foreach (IWiredItem current in conditions)
                        {
                            if (!current.Execute(new object[]
                            {
                                roomUser
                            }))
                            {
                                return(false);
                            }
                            WiredHandler.OnEvent(current);
                        }
                    }
                    if (!effects.Any())
                    {
                        continue;
                    }
                    foreach (IWiredItem current2 in effects.Where(current2 => current2.Execute(new object[]
                    {
                        roomUser,
                        Type
                    })))
                    {
                        WiredHandler.OnEvent(current2);
                    }
                }
            }
            this._mNext = 0L;
            WiredHandler.OnEvent(this);
            return(true);
        }
Esempio n. 10
0
        public bool OnCycle()
        {
            long num = Plus.Now();

            if (this._mNext >= num)
            {
                return(false);
            }
            List <IWiredItem> conditions = Room.GetWiredHandler().GetConditions(this);
            List <IWiredItem> effects    = Room.GetWiredHandler().GetEffects(this);

            foreach (RoomUser current in this._mUsers)
            {
                if (conditions.Any())
                {
                    RoomUser current3 = current;
                    foreach (IWiredItem current2 in conditions.Where(current2 => current2.Execute(new object[]
                    {
                        current3
                    })))
                    {
                        WiredHandler.OnEvent(current2);
                    }
                }
                if (!effects.Any())
                {
                    continue;
                }
                RoomUser current1 = current;
                foreach (IWiredItem current3 in effects.Where(current3 => current3.Execute(new object[]
                {
                    current1,
                    this.Type
                })))
                {
                    WiredHandler.OnEvent(current3);
                }
            }
            WiredHandler.OnEvent(this);
            this._mNext = 0L;
            return(true);
        }
Esempio n. 11
0
        public bool OnCycle()
        {
            var num = Plus.Now();

            if (num <= _mNext)
            {
                return(false);
            }
            lock (ToWork.SyncRoot)
            {
                while (ToWork.Count > 0)
                {
                    var roomUser   = (RoomUser)ToWork.Dequeue();
                    var conditions = Room.GetWiredHandler().GetConditions(this);
                    var effects    = Room.GetWiredHandler().GetEffects(this);
                    if (conditions.Any())
                    {
                        foreach (var current in conditions)
                        {
                            if (!current.Execute(roomUser))
                            {
                                return(false);
                            }
                            WiredHandler.OnEvent(current);
                        }
                    }
                    if (!effects.Any())
                    {
                        continue;
                    }
                    foreach (var current2 in effects.Where(current2 => current2.Execute(roomUser, Type)))
                    {
                        WiredHandler.OnEvent(current2);
                    }
                }
            }
            _mNext = 0L;
            WiredHandler.OnEvent(this);
            return(true);
        }
Esempio n. 12
0
        public bool Execute(params object[] stuff)
        {
            if (stuff[0] == null)
            {
                return(false);
            }
            var roomUser = (RoomUser)stuff[0];
            var item     = (Interaction)stuff[1];

            if (_mBanned.Contains(item))
            {
                return(false);
            }
            if (!Items.Any())
            {
                return(false);
            }

            if (!ToWorkConcurrentQueue.Contains(roomUser))
            {
                ToWorkConcurrentQueue.Enqueue(roomUser);
            }
            if (Delay < 500)
            {
                Delay = 500;
            }

            if (Room.GetWiredHandler().IsCycleQueued(this))
            {
                return(false);
            }

            if (_mNext == 0L || _mNext < Plus.Now())
            {
                _mNext = (Plus.Now() + (Delay));
            }

            Room.GetWiredHandler().EnqueueCycle(this);
            return(true);
        }
Esempio n. 13
0
        public bool Execute(params object[] stuff)
        {
            var roomUser = (RoomUser)stuff[0];
            var roomItem = (RoomItem)stuff[1];

            if (!Items.Contains(roomItem) || (roomUser.LastItem != 0 && roomUser.LastItem == roomItem.Id))
            {
                return(false);
            }
            ToWork.Enqueue(roomUser);
            if (Delay == 0)
            {
                OnCycle();
            }
            else
            {
                _mNext = (Plus.Now() + (Delay));

                Room.GetWiredHandler().EnqueueCycle(this);
            }
            return(true);
        }