Server.Network.PacketHandlers.ContextMenuRequest C# (CSharp) Méthode

ContextMenuRequest() public static méthode

public static ContextMenuRequest ( Server.Network.NetState state, PacketReader pvSrc ) : void
state Server.Network.NetState
pvSrc PacketReader
Résultat void
        public static void ContextMenuRequest( NetState state, PacketReader pvSrc )
        {
            Mobile from = state.Mobile;
            IEntity target = World.FindEntity( pvSrc.ReadInt32() );

            if ( from != null && target != null && from.Map == target.Map && from.CanSee( target ) )
            {
                if ( target is Mobile && !Utility.InUpdateRange( from.Location, target.Location ) )
                    return;
                else if ( target is Item && !Utility.InUpdateRange( from.Location, ((Item)target).GetWorldLocation() ) )
                    return;

                if ( !from.CheckContextMenuDisplay( target ) )
                    return;

                ContextMenu c = new ContextMenu( from, target );

                if ( c.Entries.Length > 0 )
                {
                    if ( target is Item )
                    {
                        object root = ((Item)target).RootParent;

                        if ( root is Mobile && root != from && ((Mobile)root).AccessLevel >= from.AccessLevel )
                        {
                            for ( int i = 0; i < c.Entries.Length; ++i )
                            {
                                if ( !c.Entries[i].NonLocalUse )
                                    c.Entries[i].Enabled = false;
                            }
                        }
                    }

                    from.ContextMenu = c;
                }
            }
        }
PacketHandlers