Wired problems

Reikenz

Member
Apr 5, 2018
64
3
Hello, i have a problem with a condition wired MoreThanTimer

latest
You must be registered for see images attach


WIRED Condition: More Than x Secs Elapsed Since Timer Reset

My problem is that the delay does not reset each time so once I reset the time in the apartment the wired activates unlimited

C#:
using Plus.Communication.Packets.Incoming;
using Plus.HabboHotel.Rooms;
using System;
using System.Collections.Concurrent;

namespace Plus.HabboHotel.Items.Wired.Boxes.Conditions
{
    internal class MoreThanTimerBox : IWiredItem, IWiredCycle
    {
        public Room Instance { get; set; }
        public Item Item { get; set; }
        public WiredBoxType Type => WiredBoxType.ConditionMoreThanTimer;
        public ConcurrentDictionary<int, Item> SetItems { get; set; }
        public string StringData { get; set; }
        public bool BoolData { get; set; }
        public int Delay { get => _delay; set { _delay = value; TickCount = value; } }
        public string ItemsData { get; set; }
        public int TickCount { get; set; }

        private int _delay = 0;

        public MoreThanTimerBox(Room Instance, Item Item)
        {
            this.Instance = Instance;
            this.Item = Item;
            this.SetItems = new ConcurrentDictionary<int, Item>();
        }

        public void HandleSave(ClientPacket Packet)
        {
            int Unknown = Packet.PopInt();
            int Delay = Packet.PopInt();

            this.Delay = Delay;
        }


        public bool Execute(params object[] Params)
        {
            if (Instance == null || Instance.lastTimerReset == null)
            {
                return false;
            }

            TimeSpan sinceTimerReset = DateTime.Now - Instance.lastTimerReset;
            return sinceTimerReset.TotalSeconds >= Delay;
        }

        public bool OnCycle()
        {
            return false;
        }
    }
}

My wired code

Anyone can help me please ?
 
Last edited:

Users who are viewing this thread

Top