/// <summary>
        /// The on item subscribed.
        /// </summary>
        /// <param name="snapshot">
        /// The item snapshot.
        /// </param>
        protected override void OnItemSubscribed(ItemSnapshot snapshot)
        {
            base.OnItemSubscribed(snapshot);

            Item item = snapshot.Source;
            log.InfoFormat("Npc {2}: I see item {0}({1})", item.Id, (ItemType)item.Type, this.npcId);
        }
Esempio n. 2
0
        /// <summary>
        /// Notifies peer about Item entered area.
        /// </summary>
        public override void OnItemEnter(ItemSnapshot snapshot)
        {
            base.OnItemEnter(snapshot);
            var item = snapshot.Source;

            GlobalVars.log.InfoFormat("OnItemEnter: " + item.Id + "disposed" + item.Disposed);

            // temp fix for projectiles that get destroyed but are still tied to on RequestItemEnterChannel
            // of certain regions
            // an alternative to this hack would be to never subsribe projectiles to RequestItemEnterChannel, which
            // would be faster but would mean a projectile created in a foreign interest area could not hit you...

            if (item.Disposed)
            {
                return;
            }
            var subscribeEvent = new ItemSubscribed
            {
                ItemId             = item.Id,
                ItemType           = item.Type,
                Position           = snapshot.Position,
                PropertiesRevision = snapshot.PropertiesRevision,
                InterestAreaId     = this.Id,
                Rotation           = snapshot.Rotation
            };

            var eventData = new EventData((byte)EventCode.ItemSubscribed, subscribeEvent);

            this.peer.SendEvent(eventData, new SendParameters {
                ChannelId = Settings.ItemEventChannel
            });
        }
Esempio n. 3
0
        /// <summary>
        /// The on item subscribed.
        /// </summary>
        /// <param name="snapshot">
        /// The item snapshot.
        /// </param>
        protected override void OnItemSubscribed(ItemSnapshot snapshot)
        {
            base.OnItemSubscribed(snapshot);

            Item item = snapshot.Source;

            log.InfoFormat("Npc {2}: I see item {0}({1})", item.Id, (ItemType)item.Type, this.npcId);
        }
        /// <summary>
        /// Notifies peer about Item entered area.
        /// </summary>
        public override void OnItemEnter(ItemSnapshot snapshot)
        {
            base.OnItemEnter(snapshot);
            var item = snapshot.Source;
            var subscribeEvent = new ItemSubscribed
            {
                ItemId = item.Id,
                ItemType = item.Type,
                Position = snapshot.Position,
                PropertiesRevision = snapshot.PropertiesRevision,
                InterestAreaId = this.Id,
                Rotation = snapshot.Rotation
            };

            var eventData = new EventData((byte)EventCode.ItemSubscribed, subscribeEvent);
            this.peer.SendEvent(eventData, new SendParameters { ChannelId = Settings.ItemEventChannel });
        }
Esempio n. 5
0
        /// <summary>
        /// Notifies peer about Item entered area.
        /// </summary>
        public override void OnItemEnter(ItemSnapshot snapshot)
        {
            base.OnItemEnter(snapshot);
            var item           = snapshot.Source;
            var subscribeEvent = new ItemSubscribed
            {
                ItemId             = item.Id,
                ItemType           = item.Type,
                Position           = snapshot.Position,
                PropertiesRevision = snapshot.PropertiesRevision,
                InterestAreaId     = this.Id,
                Rotation           = snapshot.Rotation
            };

            var eventData = new EventData((byte)EventCode.ItemSubscribed, subscribeEvent);

            this.peer.SendEvent(eventData, new SendParameters {
                ChannelId = Settings.ItemEventChannel
            });
        }
Esempio n. 6
0
 /// <summary>
 /// Item enters area
 /// </summary>
 public virtual void OnItemEnter(ItemSnapshot snapshot)
 {
 }
Esempio n. 7
0
 public ItemRegionChangedMessage(Region r0, Region r1, ItemSnapshot snaphot)
 {
     this.Region0 = r0;
     this.Region1 = r1;
     this.ItemSnapshot = snaphot;
 }
Esempio n. 8
0
 public ItemRegionChangedMessage(Region r0, Region r1, ItemSnapshot snaphot)
 {
     this.Region0      = r0;
     this.Region1      = r1;
     this.ItemSnapshot = snaphot;
 }