/// <summary> /// Forces the comilation of a new Item based ObjectPropertyList and sends it to the specified Mobile /// </summary> /// <param name="to">Mobile viewer, the Mobile viewing the OPL</param> /// <param name="item"></param> public static void SendPropertiesTo(Mobile to, Item item) { if (to == null || item == null) { return; } var opl = new ObjectPropertyList(item); item.GetProperties(opl); item.AppendChildProperties(opl); var eopl = new ExtendedOPL(opl); InvokeOPLRequest(item, to, eopl); eopl.Apply(); opl = eopl.Opl; opl.Terminate(); opl.SetStatic(); to.Send(opl); Cache.Remove(opl); }
private static void OnEncode0xD6(NetState state, PacketReader reader, ref byte[] buffer, ref int length) { if (state == null || reader == null || buffer == null || length < 0) { return; } int pos = reader.Seek(0, SeekOrigin.Current); reader.Seek(5, SeekOrigin.Begin); Serial serial = reader.ReadInt32(); reader.Seek(pos, SeekOrigin.Begin); var e = World.FindEntity(serial); if (e == null || e.Deleted) { return; } var opl = new ObjectPropertyList(e); if (e is Item) { var item = (Item)e; item.GetProperties(opl); item.AppendChildProperties(opl); } else if (e is Mobile) { var mob = (Mobile)e; mob.GetProperties(opl); } var eopl = new ExtendedOPL(opl); InvokeOPLRequest(e, state.Mobile, eopl); eopl.Apply(); opl.Terminate(); opl.SetStatic(); buffer = opl.Compile(state.CompressionEnabled, out length); Cache.Remove(opl); }
private static void InvokeItemOPLRequest(Item item, Mobile viewer, ObjectPropertyList list) { if (item == null || list == null) { return; } if (OnItemOPLRequest == null) { return; } var eList = new ExtendedOPL(list); OnItemOPLRequest(item, viewer, eList); eList.Apply(); }
private static void InvokeMobileOPLRequest(Mobile mobile, Mobile viewer, ObjectPropertyList list) { if (mobile == null || list == null) { return; } if (OnMobileOPLRequest == null) { return; } var eList = new ExtendedOPL(list); OnMobileOPLRequest(mobile, viewer, eList); eList.Apply(); }
public static ObjectPropertyList ResolveOPL(IEntity e, Mobile v) { if (e == null || e.Deleted) { return(null); } var opl = new ObjectPropertyList(e); if (e is Item) { var item = (Item)e; item.GetProperties(opl); item.AppendChildProperties(opl); } else if (e is Mobile) { var mob = (Mobile)e; mob.GetProperties(opl); } var eopl = new ExtendedOPL(opl); InvokeOPLRequest(e, v, eopl); eopl.Apply(); //opl = eopl.Opl ?? opl; opl.Terminate(); opl.SetStatic(); Cache.Remove(opl); return(opl); }