public void ProcessDelta() { ItemDelta flags = m_DeltaFlags; SetFlag( ImplFlag.InQueue, false ); m_DeltaFlags = ItemDelta.None; Map map = m_Map; if ( map != null && !Deleted ) { bool sendOPLUpdate = ObjectPropertyList.Enabled && (flags & ItemDelta.Properties) != 0; Container contParent = m_Parent as Container; if ( contParent != null && !contParent.IsPublicContainer ) { if ( (flags & ItemDelta.Update) != 0 ) { Point3D worldLoc = GetWorldLocation(); Mobile rootParent = contParent.RootParent as Mobile; Mobile tradeRecip = null; if ( rootParent != null ) { NetState ns = rootParent.NetState; if ( ns != null ) { if ( rootParent.CanSee( this ) && rootParent.InRange( worldLoc, GetUpdateRange( rootParent ) ) ) { if ( ns.IsPost6017 ) ns.Send( new ContainerContentUpdate6017( this ) ); else ns.Send( new ContainerContentUpdate( this ) ); if ( ObjectPropertyList.Enabled ) ns.Send( OPLPacket ); } } } SecureTradeContainer stc = this.GetSecureTradeCont(); if ( stc != null ) { SecureTrade st = stc.Trade; if ( st != null ) { Mobile test = st.From.Mobile; if ( test != null && test != rootParent ) tradeRecip = test; test = st.To.Mobile; if ( test != null && test != rootParent ) tradeRecip = test; if ( tradeRecip != null ) { NetState ns = tradeRecip.NetState; if ( ns != null ) { if ( tradeRecip.CanSee( this ) && tradeRecip.InRange( worldLoc, GetUpdateRange( tradeRecip ) ) ) { if ( ns.IsPost6017 ) ns.Send( new ContainerContentUpdate6017( this ) ); else ns.Send( new ContainerContentUpdate( this ) ); if ( ObjectPropertyList.Enabled ) ns.Send( OPLPacket ); } } } } } ArrayList openers = contParent.Openers; if ( openers != null ) { for ( int i = 0; i < openers.Count; ++i ) { Mobile mob = (Mobile)openers[i]; int range = GetUpdateRange( mob ); if ( mob.Map != map || !mob.InRange( worldLoc, range ) ) { openers.RemoveAt( i-- ); } else { if ( mob == rootParent || mob == tradeRecip ) continue; NetState ns = mob.NetState; if ( ns != null ) { if ( mob.CanSee( this ) ) { if ( ns.IsPost6017 ) ns.Send( new ContainerContentUpdate6017( this ) ); else ns.Send( new ContainerContentUpdate( this ) ); if ( ObjectPropertyList.Enabled ) ns.Send( OPLPacket ); } } } } if ( openers.Count == 0 ) contParent.Openers = null; } return; } } if ( (flags & ItemDelta.Update) != 0 ) { Packet p = null; Point3D worldLoc = GetWorldLocation(); IPooledEnumerable eable = map.GetClientsInRange( worldLoc, GetMaxUpdateRange() ); foreach ( NetState state in eable ) { Mobile m = state.Mobile; if ( m.CanSee( this ) && m.InRange( worldLoc, GetUpdateRange( m ) ) ) { //if ( sendOPLUpdate ) // state.Send( RemovePacket ); if ( m_Parent == null ) { SendInfoTo( state ); } else { if ( p == null ) { if ( m_Parent is Item ) { if ( state.IsPost6017 ) state.Send( new ContainerContentUpdate6017( this ) ); else state.Send( new ContainerContentUpdate( this ) ); } else if ( m_Parent is Mobile ) { state.Send( new EquipUpdate( this ) ); } } if ( ObjectPropertyList.Enabled ) state.Send( OPLPacket ); } } } eable.Free(); sendOPLUpdate = false; } else if ( (flags & ItemDelta.EquipOnly ) != 0 ) { if ( m_Parent is Mobile ) { Packet p = null; Point3D worldLoc = GetWorldLocation(); IPooledEnumerable eable = map.GetClientsInRange( worldLoc, GetMaxUpdateRange() ); foreach ( NetState state in eable ) { Mobile m = state.Mobile; if ( m.CanSee( this ) && m.InRange( worldLoc, GetUpdateRange( m ) ) ) { //if ( sendOPLUpdate ) // state.Send( RemovePacket ); if ( p == null ) p = new EquipUpdate( this ); state.Send( p ); if ( ObjectPropertyList.Enabled ) state.Send( OPLPacket ); } } eable.Free(); sendOPLUpdate = false; } } if ( sendOPLUpdate ) { Point3D worldLoc = GetWorldLocation(); IPooledEnumerable eable = map.GetClientsInRange( worldLoc, GetMaxUpdateRange() ); foreach ( NetState state in eable ) { Mobile m = state.Mobile; if ( m.CanSee( this ) && m.InRange( worldLoc, GetUpdateRange( m ) ) ) state.Send( OPLPacket ); } eable.Free(); } } }
public void RemDelta( ItemDelta flags ) { m_DeltaFlags &= ~flags; if ( GetFlag( ImplFlag.InQueue ) && m_DeltaFlags == ItemDelta.None ) { SetFlag( ImplFlag.InQueue, false ); m_DeltaQueue.Remove( this ); } }
public void Delta( ItemDelta flags ) { if ( m_Map == null || m_Map == Map.Internal ) return; m_DeltaFlags |= flags; if ( !GetFlag( ImplFlag.InQueue ) ) { SetFlag( ImplFlag.InQueue, true ); m_DeltaQueue.Add( this ); } Core.WakeUp(); }