internal void WriteObject(BeginNonZeroBusyStateEventArgs obj)
        {
            if (ActiveSettings.Instance.DebugLevel == DebugLevel.None)
                return;

            lock (this._writeLock)
            {
                using (StreamWriter stream = new StreamWriter(this._currentPath, true))
                {
                    this.LogRawMessage(this.FormatWithPrefix("BeginNonZeroBusyStateEventArgs"), stream);
                    this.LogRawMessage(string.Format("  BusyState = {0}", obj.BusyState), stream);
                    this.LogRawMessage(string.Format("  BusyStateId = {0}", obj.BusyStateId), stream);

                    //this.WriteCurrentStateStuff(stream, false);

                    this.LogRawMessage("", stream);
                }
            }
        }
Beispiel #2
0
        private void FireBeginNonZeroBusyState(object sender, BeginNonZeroBusyStateEventArgs eventArgs)
        {
            this._pendingBusyState = eventArgs.BusyState;
            this._pendingBusyStateId = eventArgs.BusyStateId;

            this._nonZeroActionStatePending.Set();

            REPlugin.Instance.Debug.WriteObject(eventArgs);

            if (this.BeginNonZeroBusyState != null)
            {
                this.BeginNonZeroBusyState(sender, eventArgs);
            }

            // Check for busy states that we fire events for.
            switch (this._pendingBusyState)
            {
                case BusyStateConstants.GivingItem:  // Give Object

                    // Cache the object name now, when giving to NPC's, the object will be gone by the time we handle the end event
                    // so we won't be able to get the name then.  Strangely, when giving to player, you can still get to the WorldObject
                    this._pendingGiveItemCapturedWorldObject = this._pendingBusyStateId.ToWorldObject().Capture();
                    this._giveItemPending.Set();

                    var beginGiveEventArgs = new BeginGiveItemEventArgs(this._pendingBusyStateId);

                    REPlugin.Instance.Debug.WriteObject(beginGiveEventArgs);

                    if (this.BeginGiveItem != null)
                    {
                        this.BeginGiveItem(sender, beginGiveEventArgs);
                    }
                    break;
                case BusyStateConstants.EquipingItem:
                    // TODO : Investigate how to detect failed equips.  Once found, introduce a manual reset event

                    var beginEquipEventArgs = new ObjectIdEventArgs(this._pendingBusyStateId);

                    REPlugin.Instance.Debug.WriteObject(beginEquipEventArgs);

                    if (this.BeginEquipItem != null)
                    {
                        this.BeginEquipItem(sender, beginEquipEventArgs);
                    }
                    break;

                case BusyStateConstants.UnequipingItem:
                    // TODO : Investigate how to detect failed equips.  Once found, introduce a manual reset event

                    var beginUnequipEventArgs = new ObjectIdEventArgs(this._pendingBusyStateId);

                    REPlugin.Instance.Debug.WriteObject(beginUnequipEventArgs);

                    if (this.BeginUnequipItem != null)
                    {
                        this.BeginUnequipItem(sender, beginUnequipEventArgs);
                    }
                    break;
            }
        }
 void RTEvents_BeginNonZeroBusyState(object sender, BeginNonZeroBusyStateEventArgs e)
 {
     this.TransitionToBusy(sender);
 }