Server.Commands.CommandLogging.Format C# (CSharp) Méthode

Format() public static méthode

public static Format ( object o ) : object
o object
Résultat object
		public static object Format( object o )
		{
			if ( o is Mobile )
			{
				Mobile m = (Mobile)o;

				if ( m.Account == null )
					return String.Format( "{0} (no account)", m );
				else
					return String.Format( "{0} ('{1}')", m, m.Account.Username );
			}
			else if ( o is Item )
			{
				Item item = (Item)o;

				return String.Format( "0x{0:X} ({1})", item.Serial.Value, item.GetType().Name );
			}

			return o;
		}

Usage Example

Exemple #1
0
        public static void LastLoc_Command(CommandEventArgs e)
        {
            PlayerMobile pm = e.Mobile as PlayerMobile;

            if (pm != null && pm.Companion)
            {
                if (pm.CompanionLastLocation != Point3D.Zero)
                {
                    if (pm.Criminal)
                    {
                        pm.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
                    }
                    else if (SpellHelper.CheckCombat(pm, true))
                    {
                        pm.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
                    }
                    else if (!SpellHelper.CheckTravel(pm, TravelCheckType.RecallFrom))
                    {
                        pm.SendMessage("Companions may not teleport away from this location");
                    }
                    else
                    {
                        CommandLogging.WriteLine(pm, "{0} {1} teleporting from {2} to {3}", pm.AccessLevel, CommandLogging.Format(pm), new Point3D(pm.Location), pm.CompanionLastLocation);
                        pm.Location = pm.CompanionLastLocation;
                        pm.CompanionLastLocation = Point3D.Zero;
                    }
                }
                else
                {
                    pm.SendAsciiMessage("You must first teleport to a new player before returning to your last location.");
                }
            }
        }
All Usage Examples Of Server.Commands.CommandLogging::Format