本文整理汇总了C#中Server.Server.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# Server.GetString方法的具体用法?C# Server.GetString怎么用?C# Server.GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Server
的用法示例。
在下文中一共展示了Server.GetString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateArgs
public override bool ValidateArgs( BaseCommandImplementor impl, Server.Commands.CommandEventArgs e )
{
if ( e.Length >= 1 )
{
Type t = ScriptCompiler.FindTypeByName( e.GetString( 0 ) );
if ( t == null )
{
e.Mobile.SendMessage( "No type with that name was found." );
string match = e.GetString( 0 ).Trim();
if ( match.Length < 3 )
{
e.Mobile.SendMessage( "Invalid search string." );
e.Mobile.SendGump( new Server.Gumps.AddGump( e.Mobile, match, 0, Type.EmptyTypes, false ) );
}
else
{
e.Mobile.SendGump( new Server.Gumps.AddGump( e.Mobile, match, 0, (Type[])Server.Gumps.AddGump.Match( match ).ToArray( typeof( Type ) ), true ) );
}
}
else
{
return true;
}
}
else
{
e.Mobile.SendGump( new Server.Gumps.CategorizedAddGump( e.Mobile ) );
}
return false;
}
示例2: SetSkill_OnCommand
public static void SetSkill_OnCommand( Server.Commands.CommandEventArgs arg )
{
if ( arg.Length != 2 )
{
arg.Mobile.SendMessage( "SetSkill <skill name> <value>" );
}
else
{
SkillName skill;
try
{
skill = (SkillName)Enum.Parse( typeof( SkillName ), arg.GetString( 0 ), true );
}
catch
{
arg.Mobile.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
return;
}
arg.Mobile.Target = new SkillTarget( skill, arg.GetDouble( 1 ) );
}
}
示例3: FindByName_OnCommand
public static void FindByName_OnCommand( Server.Commands.CommandEventArgs e )
{
if ( e.Length == 1 )
{
string name = e.GetString( 0 ).ToLower();
foreach ( Item item in World.Items.Values )
{
if ( item.Name != null && item.Name.ToLower().IndexOf( name ) >= 0 )
{
object root = item.RootParent;
if ( root is Mobile )
e.Mobile.SendAsciiMessage( "{0} [{1}]: {2} ({3})", item.GetWorldLocation(), item.Map, root.GetType().Name, ((Mobile)root).Name );
else
e.Mobile.SendAsciiMessage( "{0} [{1}]: {2}", item.GetWorldLocation(), item.Map, root==null ? "(null)" : root.GetType().Name );
}
}
}
else
{
e.Mobile.SendAsciiMessage( "Format: FindByName <name>" );
}
}
示例4: Cmd_SkillUsage
private static void Cmd_SkillUsage( Server.Commands.CommandEventArgs args )
{
Mobile from = args.Mobile;
SkillName skill;
try
{
skill = (SkillName)Enum.Parse( typeof( SkillName ), args.GetString( 0 ), true );
from.SendAsciiMessage( "Global Usage for {0} : ", skill );
if ( m_TotalUses > 0 )
from.SendAsciiMessage( "{0:F2}% ({1}/{2})", (((double)m_SkillUsage[(int)skill])/((double)m_TotalUses)) * 100.0, m_SkillUsage[(int)skill], m_TotalUses );
}
catch
{
from.SendAsciiMessage( "That is not a valid skill name." );
return;
}
}
示例5: Execute
public virtual void Execute( Server.Commands.CommandEventArgs e )
{
if ( e.Length >= 1 )
{
BaseCommand command = (BaseCommand)m_Commands[e.GetString( 0 )];
if ( command == null )
{
e.Mobile.SendMessage( "That is either an invalid command name or one that does not support this modifier." );
}
else if ( e.Mobile.AccessLevel < command.AccessLevel )
{
e.Mobile.SendMessage( "You do not have access to that command." );
}
else
{
string[] oldArgs = e.Arguments;
string[] args = new string[oldArgs.Length - 1];
for ( int i = 0; i < args.Length; ++i )
args[i] = oldArgs[i + 1];
Process( e.Mobile, command, args );
}
}
else
{
e.Mobile.SendMessage( "You must supply a command name." );
}
}
示例6: Execute
public override void Execute( Server.Commands.CommandEventArgs e, object obj )
{
if ( e.Length == 1 )
{
Mobile mob = (Mobile)obj;
Mobile from = e.Mobile;
if ( mob.Player )
{
NetState ns = mob.NetState;
if ( ns == null )
{
LogFailure( "That player is not online." );
}
else
{
string url = e.GetString( 0 );
CommandLogging.WriteLine( from, "{0} {1} requesting to open web browser of {2} to {3}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( mob ), url );
AddResponse( "Awaiting user confirmation..." );
mob.SendGump( new WarningGump( 1060637, 30720, String.Format( "A game master is requesting to open your web browser to the following URL:<br>{0}", url ), 0xFFC000, 320, 240, new WarningGumpCallback( OpenBrowser_Callback ), new object[]{ from, url } ) );
}
}
else
{
LogFailure( "That is not a player." );
}
}
else
{
LogFailure( "Format: OpenBrowser <url>" );
}
}
示例7: Go_OnCommand
private static void Go_OnCommand( Server.Commands.CommandEventArgs e )
{
Mobile from = e.Mobile;
if ( e.Length == 0 )
{
GoGump.DisplayTo( from );
}
else if ( e.Length == 1 )
{
try
{
int ser = e.GetInt32( 0 );
IEntity ent = World.FindEntity( ser );
if ( ent is Item )
{
Item item = (Item)ent;
Map map = item.Map;
Point3D loc = item.GetWorldLocation();
Mobile owner = item.RootParent as Mobile;
if ( owner != null && (owner.Map != null && owner.Map != Map.Internal) && !from.CanSee( owner ) )
{
from.SendAsciiMessage( "You can not go to what you can not see." );
return;
}
else if ( owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= from.AccessLevel )
{
from.SendAsciiMessage( "You can not go to what you can not see." );
return;
}
else if ( !FixMap( ref map, ref loc, item ) )
{
from.SendAsciiMessage( "That is an internal item and you cannot go to it." );
return;
}
from.MoveToWorld( loc, map );
return;
}
else if ( ent is Mobile )
{
Mobile m = (Mobile)ent;
Map map = m.Map;
Point3D loc = m.Location;
Mobile owner = m;
if ( owner != null && (owner.Map != null && owner.Map != Map.Internal) && !from.CanSee( owner ) )
{
from.SendAsciiMessage( "You can not go to what you can not see." );
return;
}
else if ( owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= from.AccessLevel )
{
from.SendAsciiMessage( "You can not go to what you can not see." );
return;
}
else if ( !FixMap( ref map, ref loc, m ) )
{
from.SendAsciiMessage( "That is an internal mobile and you cannot go to it." );
return;
}
from.MoveToWorld( loc, map );
return;
}
else
{
string name = e.GetString( 0 );
List<Region> list = new List<Region>(from.Map.Regions.Values);
for ( int i = 0; i < list.Count; ++i )
{
Region r = (Region)list[i];
if ( Insensitive.Equals( r.Name, name ) )
{
from.Location = new Point3D( r.GoLocation );
return;
}
}
if ( ser != 0 )
from.SendAsciiMessage( "No object with that serial was found." );
else
from.SendAsciiMessage( "No region with that name was found." );
return;
}
}
catch
//.........这里部分代码省略.........
示例8: Cast_OnCommand
public static void Cast_OnCommand( Server.Commands.CommandEventArgs e )
{
if ( e.Length == 1 )
{
Spell spell = SpellRegistry.NewSpell( e.GetString( 0 ), e.Mobile, null );
if ( spell != null )
spell.Cast();
else
e.Mobile.SendAsciiMessage( "That spell was not found." );
}
else
{
e.Mobile.SendAsciiMessage( "Format: Cast <name>" );
}
}
示例9: Password_OnCommand
public static void Password_OnCommand( Server.Commands.CommandEventArgs e )
{
Mobile from = e.Mobile;
Account acct = from.Account as Account;
if ( acct == null )
return;
IPAddress[] accessList = acct.LoginIPs;
if ( accessList.Length == 0 )
return;
NetState ns = from.NetState;
if ( ns == null )
return;
if ( e.Length == 0 )
{
from.SendMessage( "You must specify the new password." );
return;
}
else if ( e.Length == 1 )
{
from.SendMessage( "To prevent potential typing mistakes, you must type the password twice. Use the format:" );
from.SendMessage( "Password \"(newPassword)\" \"(repeated)\"" );
return;
}
string pass = e.GetString( 0 );
string pass2 = e.GetString( 1 );
if ( pass != pass2 )
{
from.SendMessage( "The passwords do not match." );
return;
}
bool isSafe = true;
for ( int i = 0; isSafe && i < pass.Length; ++i )
isSafe = ( pass[i] >= 0x20 && pass[i] < 0x80 );
if ( !isSafe )
{
from.SendMessage( "That is not a valid password." );
return;
}
try
{
IPAddress ipAddress = ((IPEndPoint)ns.Socket.RemoteEndPoint).Address;
if ( Utility.IPMatchClassC( accessList[0], ipAddress ) )
{
acct.SetPassword( pass );
from.SendMessage( "The password to your account has changed." );
}
else
{
PageEntry entry = PageQueue.GetEntry( from );
if ( entry != null )
{
if ( entry.Message.StartsWith( "[Automated: Change Password]" ) )
from.SendMessage( "You already have a password change request in the help system queue." );
else
from.SendMessage( "Your IP address does not match that which created this account." );
}
else if ( PageQueue.CheckAllowedToPage( from ) )
{
from.SendMessage( "Your IP address does not match that which created this account. A page has been entered into the help system on your behalf." );
from.SendLocalizedMessage( 501234, "", 0x35 ); /* The next available Counselor/Game Master will respond as soon as possible.
* Please check your Journal for messages every few minutes.
*/
PageQueue.Enqueue( new PageEntry( from, String.Format( "[Automated: Change Password]<br>Desired password: {0}<br>Current IP address: {1}<br>Account IP address: {2}", pass, ipAddress, accessList[0] ), PageType.Account ) );
}
}
}
catch
{
}
}