private OperationResponse ItemOperationSubscribeItem(Item item, SubscribeItem operation, InterestArea interestArea, MmoActor actor) { if (item.Disposed) { return(operation.GetOperationResponse((int)ReturnCode.ItemNotFound, "ItemNotFound")); } lock (interestArea.SyncRoot) { interestArea.SubscribeItem(item); } if (operation.PropertiesRevision.HasValue == false || operation.PropertiesRevision.Value != item.properties.propertiesRevision) { var properties = new ItemPropertiesSet { ItemId = item.Id, ItemType = item.Type, PropertiesRevision = item.properties.propertiesRevision, PropertiesSet = item.properties.raw }; var eventData = new EventData((byte)EventCode.ItemPropertiesSet, properties); actor.Peer.SendEvent(eventData, new SendParameters { ChannelId = Settings.ItemEventChannel }); } // don't send response operation.OnComplete(); return(null); }
private OperationResponse ItemOperationSubscribeItem(Item item, SubscribeItem operation) { if (item.Disposed) { return(operation.GetOperationResponse((int)ReturnCode.ItemNotFound, "ItemNotFound")); } this.interestItems.SubscribeItem(item); var subscribeEvent = new ItemSubscribed { ItemId = item.Id, ItemType = item.Type, Position = item.Position, PropertiesRevision = item.PropertiesRevision, Rotation = item.Rotation }; var eventData = new EventData((byte)EventCode.ItemSubscribed, subscribeEvent); this.Peer.SendEvent(eventData, new SendParameters { ChannelId = Settings.ItemEventChannel }); if (operation.PropertiesRevision.HasValue == false || operation.PropertiesRevision.Value != item.PropertiesRevision) { var properties = new ItemPropertiesSet { ItemId = item.Id, PropertiesRevision = item.PropertiesRevision, PropertiesSet = new Hashtable(item.Properties) }; var propEventData = new EventData((byte)EventCode.ItemPropertiesSet, properties); this.Peer.SendEvent(propEventData, new SendParameters { ChannelId = Settings.ItemEventChannel }); } // don't send response operation.OnComplete(); return(null); }