Example #1
0
        public HealingOverTimeNPC(NPCBase nPC, float initialHeal, float totalHoT, int durationSeconds, ushort indicator)
        {
            HealPerTic      = totalHoT / durationSeconds;
            DurationSeconds = durationSeconds;
            InitialHeal     = initialHeal;
            Target          = nPC;
            TotalHoTTime    = totalHoT;
            TicksLeft       = durationSeconds;
            Indicator       = indicator;

            NewInstance?.Invoke(this, null);

            _instances.Add(this);
            Target.Heal(InitialHeal);
            Target.SetIndicatorState(new IndicatorState(1, Indicator));
            Tick += HealingOverTimeNPC_Tick;
        }
Example #2
0
        private void Listen(IAsyncResult ar)
        {
            var server = _server;

            if (server == null)
            {
                return;
            }

            try
            {
                try
                {
                    server.EndWaitForConnection(ar);
                }
                catch (ObjectDisposedException)
                {
                    return;
                }

                StartNamedPipeServer();

                using var binaryReader = new BinaryReader(server);
                if (binaryReader.ReadByte() == NotifyInstanceMessageType)
                {
                    var processId = binaryReader.ReadInt32();
                    var argCount  = binaryReader.ReadInt32();
                    if (argCount >= 0)
                    {
                        var args = new string[argCount];
                        for (var i = 0; i < argCount; i++)
                        {
                            args[i] = binaryReader.ReadString();
                        }

                        NewInstance?.Invoke(this, new SingleInstanceEventArgs(processId, args));
                    }
                }
            }
            finally
            {
                server.Dispose();
            }
        }
Example #3
0
 private static void NewInstanceHandler(object sender, EventArgs e)
 {
     NewInstance?.Invoke(sender, e);
 }
 protected EventTriggerException([NotNull] SerializationInfo info, StreamingContext context) : base(info, context)
 {
     NewInstance?.Invoke(null, this);
 }
 public EventTriggerException(string message, Exception innerException) : base(message, innerException)
 {
     NewInstance?.Invoke(null, this);
 }
 public EventTriggerException()
 {
     NewInstance?.Invoke(null, this);
 }