예제 #1
0
        internal void WriteObject(ObjectIdEventArgs obj)
        {
            if (ActiveSettings.Instance.DebugLevel == DebugLevel.None)
                return;

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

                    //this.WriteCurrentStateStuff(stream, false);

                    this.LogRawMessage("", stream);
                }
            }
        }
예제 #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;
            }
        }
예제 #3
0
        void RT_EndEquipItem(object sender, ObjectIdEventArgs e)
        {
            var worldObj = e.ObjectId.ToWorldObject();

            if (worldObj == null)
            {
                return;
            }

            // Code to support caching of casting items so that we can equip a wand/staff/orb
            if (this._knownCastingItems.Count < MaxCachedCastingItems && worldObj.IsWandStaffOrb())
            {
                worldObj.WriteToDebug("Caching Known Casting Item");
                this._knownCastingItems.Add(worldObj.Id);
            }
        }