本文整理汇总了C#中CommandEventArgs.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# CommandEventArgs.GetString方法的具体用法?C# CommandEventArgs.GetString怎么用?C# CommandEventArgs.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandEventArgs
的用法示例。
在下文中一共展示了CommandEventArgs.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: msg_invoke
private static void msg_invoke( CommandEventArgs args )
{
if( args.Length == 1 && args.GetString( 0 ) != null )
{
string name = args.GetString( 0 );
bool found = false;
for( int i = 0; !found && i < NetState.Instances.Count; i++ )
{
if( NetState.Instances[i].Mobile != null && NetState.Instances[i].Mobile.RawName.ToLower() == name.ToLower() )
{
if( ChatManager.CanChat( args.Mobile, NetState.Instances[i].Mobile ) )
{
args.Mobile.SendGump( new ChatMessageGump( args.Mobile, NetState.Instances[i].Mobile ) );
found = true;
}
}
}
if( !found )
args.Mobile.SendGump( new ChatListGump( ListPage.Everyone, args.Mobile ) );
}
else
{
args.Mobile.SendGump( new ChatListGump( ListPage.Everyone, args.Mobile ) );
}
}
示例2: ExecuteList
public override void ExecuteList(CommandEventArgs e, ArrayList list)
{
if (list.Count > 0)
{
List<string> columns = new List<string>();
columns.Add("Object");
if (e.Length > 0)
{
int offset = 0;
if (Insensitive.Equals(e.GetString(0), "view"))
++offset;
while (offset < e.Length)
columns.Add(e.GetString(offset++));
}
e.Mobile.SendGump(new InterfaceGump(e.Mobile, columns.ToArray(), list, 0, null));
}
else
{
this.AddResponse("No matching objects found.");
}
}
示例3: SetSkill_OnCommand
public static void SetSkill_OnCommand( CommandEventArgs arg )
{
if( arg.Length != 2 )
{
arg.Mobile.SendMessage( "SetSkill <skill name> <value>" );
}
else
{
SkillName skill;
#if Framework_4_0
if( Enum.TryParse( arg.GetString( 0 ), true, out skill ) )
{
arg.Mobile.Target = new SkillTarget( skill, arg.GetDouble( 1 ) );
}
else
{
arg.Mobile.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
}
#else
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 ) );
#endif
}
}
示例4: ValidateArgs
public override bool ValidateArgs(BaseCommandImplementor impl, 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 AddGump(e.Mobile, match, 0, Type.EmptyTypes, false));
}
else
{
e.Mobile.SendGump(new AddGump(e.Mobile, match, 0, AddGump.Match(match).ToArray(), true));
}
}
else
{
return true;
}
}
else
{
e.Mobile.SendGump(new CategorizedAddGump(e.Mobile));
}
return false;
}
示例5: RemoveAccountTag_OnCommand
public static void RemoveAccountTag_OnCommand( CommandEventArgs e )
{
Mobile from = e.Mobile;
if( from == null || from.Deleted )
return;
if( e.Length == 2 )
{
string accString = e.GetString( 0 );
string tagString = e.GetString( 1 );
if( !string.IsNullOrEmpty( accString ) )
{
Account acct = Accounts.GetAccount( accString ) as Account;
if( acct != null )
{
if( !string.IsNullOrEmpty( tagString ) )
{
if( !string.IsNullOrEmpty(acct.GetTag( tagString )) )
{
string msg = string.Format( "You are going to remove tag <em><basefont color=red>{0}</basefont></em> " +
"from accunt <em><basefont color=red>{1}</basefont></em>.<br>" +
"Are you sure you want to proceed?", tagString, accString );
from.SendGump( new WarningGump( 1060635, 30720, msg, 0xFFC000, 420, 280, new WarningGumpCallback( ConfirmRemoveCallBack ), new object[]{ acct, tagString }, true ) );
}
else
{
from.SendMessage( "Target account exist but does not have that tag." );
}
}
else
{
from.SendMessage( "Invalid tag (null or empty)." );
}
}
else
{
from.SendMessage( "Target account does not exist." );
}
}
else
{
from.SendMessage( "Invalid userName (null or empty)." );
}
}
else
{
from.SendMessage( "CommandUse: [RemoveAccountTag <account> <tag>" );
}
}
示例6: ChangeSeason_OnCommand
public static void ChangeSeason_OnCommand(CommandEventArgs e)
{
Mobile m = e.Mobile;
if (e.Length != 1)
{
m.SendMessage("Usage: [ChangeSeason [Spring|Summer|Autumn|Winter|Desolation]");
return;
}
int season;
switch (e.GetString(0).ToLower())
{
case "spring":
season = 0;
break;
case "summer":
season = 1;
break;
case "autumn":
case "fall":
season = 2;
break;
case "winter":
season = 3;
break;
case "desolation":
season = 4;
break;
default:
m.SendMessage("Usage: [ChangeSeason [Spring|Summer|Autumn|Winter|Desolation]");
return;
}
Map map = m.Map;
map.Season = season;
foreach (NetState ns in NetState.Instances)
{
if (ns.Mobile == null || ns.Mobile.Map != map)
continue;
ns.Send(SeasonChange.Instantiate(ns.Mobile.GetSeason(), true));
ns.Mobile.SendEverything();
}
m.SendMessage("{0} season changed to {1}.", map.Name, e.GetString(0));
}
示例7: Equip_OnCommand
public static void Equip_OnCommand( CommandEventArgs e )
{
Mobile from = e.Mobile;
Type type = ScriptCompiler.FindTypeByName( e.GetString( 0 ).Trim().ToLower(), true );
if ( type != null && typeof( Item ).IsAssignableFrom( type ) )
{
Item item = from.Backpack.FindItemByType( type, true );
if ( item != null && !item.Deleted )
{
from.DropHolding();
bool rejected;
LRReason reject;
from.Lift( item, item.Amount, out rejected, out reject );
if ( !rejected )
{
from.Holding = null;
if ( !from.EquipItem( item ) )
item.Bounce( from );
}
item.ClearBounce();
}
}
else
from.SendMessage( "That item type does not exist." );
}
示例8: OnCommand
public static void OnCommand(CommandEventArgs arg)
{
Mobile m = arg.Mobile;
string skillNames = string.Join(", ", Enum.GetNames(typeof(SkillName)));
if (arg.Length != 1)
{
m.SendMessage("Usage: SetSkill <skill name>. List of skill names: {0}.", skillNames);
}
else
{
SkillName skillName;
if (Enum.TryParse(arg.GetString(0), true, out skillName))
{
Skill skill = m.Skills[skillName];
if (skill != null)
{
skill.Base = 0;
m.SendMessage("You've successfully reset your {0}.", skill.Name);
}
}
else
{
m.SendMessage("You have specified an invalid skill to set. List of skill names: {0}.", skillNames);
}
}
}
示例9: Season_OnCommand
private static void Season_OnCommand( CommandEventArgs e )
{
Mobile m = e.Mobile;
if( e.Length == 1 )
{
string seasonType = e.GetString( 0 ).ToLower();
SeasonList season;
try
{
season = (SeasonList)Enum.Parse( typeof( SeasonList ), seasonType, true );
}
catch
{
m.SendMessage( "Usage: Season spring | summer | fall | winter | desolation" );
return;
}
m.SendMessage( "Setting season to: " + seasonType + "." );
SetSeason( m, season );
}
else
m.SendMessage( "Usage: Season spring | summer | fall | winter | desolation" );
}
示例10: DeleteMap_OnCommand
private static void DeleteMap_OnCommand( CommandEventArgs e )
{
try
{
BaseInstanceMap basemap = Map.Parse( e.GetString( 0 ) ) as BaseInstanceMap;
if ( basemap != null )
{
List<Item> items = new List<Item>();
List<Mobile> mobiles = new List<Mobile>();
foreach ( Item item in World.Items.Values )
if ( item.Map == basemap && item.Parent == null )
items.Add( item );
for ( int i = items.Count-1; i >= 0; i-- )
items[i].Delete();
foreach ( Mobile m in World.Mobiles.Values )
if ( !m.Player && m.Map == basemap )
mobiles.Add( m );
for ( int i = mobiles.Count-1; i >= 0; i-- )
mobiles[i].Delete();
basemap.Delete();
}
}
catch
{
}
}
示例11: HelpInfo_OnCommand
private static void HelpInfo_OnCommand( CommandEventArgs e )
{
if( e.Length > 0 )
{
string arg = e.GetString( 0 ).ToLower();
CommandInfo c;
if( m_HelpInfos.TryGetValue( arg, out c ) )
{
Mobile m = e.Mobile;
if( m.AccessLevel >= c.AccessLevel )
m.SendGump( new CommandInfoGump( c ) );
else
m.SendMessage( "You don't have access to that command." );
return;
}
else
e.Mobile.SendMessage( String.Format( "Command '{0}' not found!", arg ) );
}
e.Mobile.SendGump( new CommandListGump( 0, e.Mobile, null ) );
}
示例12: SetSeason_OnCommand
private static void SetSeason_OnCommand(CommandEventArgs e)
{
Mobile from = e.Mobile;
if (e.Length >= 1)
{
Region reg = from.Region;
if (reg == null || !(reg is ISeasons))
{
from.SendMessage("You are not in a region that supports Seasons.");
from.SendMessage("To set the Map Season, use {0}SetMapSeason", CommandSystem.Prefix);
}
else
{
try
{
ISeasons sreg = reg as ISeasons;
sreg.Season = (Season)Enum.Parse(typeof(Season), (e.GetString(0).Trim()), true);
from.SendMessage("Season has been set to {0}.", sreg.Season.ToString());
}
catch
{
from.SendMessage("Format: SetSeason < Spring | Summer | Autumn/Fall | Winter | Desolation >");
}
}
}
else
{
from.SendMessage("Format: SetSeason < Spring | Summer | Autumn/Fall | Winter | Desolation >");
}
}
示例13: Unequip_OnCommand
public static void Unequip_OnCommand( CommandEventArgs e )
{
Mobile from = e.Mobile;
Layer layer;
if ( Enum.TryParse<Layer>( e.GetString( 0 ).Trim().ToLower(), true, out layer ) )
{
if ( layer > Layer.Invalid && layer <= Layer.LastUserValid && layer != Layer.Backpack )
{
Item item = from.FindItemOnLayer( layer );
if ( item != null && !item.Deleted )
{
from.DropHolding();
bool rejected;
LRReason reject;
from.Lift( item, item.Amount, out rejected, out reject );
if ( !rejected )
{
from.Drop( from.Backpack, new Point3D( -1, -1, 0 ) );
from.Holding = null;
}
}
}
else
from.SendMessage( "That layer is not accessible." );
}
else
from.SendMessage( "That layer does not exist." );
}
示例14: Execute
public override void Execute(CommandEventArgs e, object obj)
{
Mobile from = e.Mobile;
Mobile target = obj as Mobile;
Map map = from.Map;
Point3D location = Point3D.Zero;
if (target == null || map == Map.Internal || map == null)
{
from.SendAsciiMessage("Invalid target.");
return;
}
else if (e.Length == 0)
{
from.SendAsciiMessage("Format:");
from.SendAsciiMessage("SendTo int x int y");
from.SendAsciiMessage("SendTo int x int y int z");
from.SendAsciiMessage("SendTo int yLat int yMins (N|S) ySount int xLong int xMins (E|W) xEast");
return;
}
else if (e.Length == 2)
{
int x = e.GetInt32(0);
int y = e.GetInt32(1);
location = new Point3D(x, y, map.GetAverageZ(x, y));
}
else if (e.Length == 3)
location = new Point3D(e.GetInt32(0), e.GetInt32(1), e.GetInt32(2));
else if (e.Length == 6)
{
location = Sextant.ReverseLookup(map, e.GetInt32(3), e.GetInt32(0), e.GetInt32(4), e.GetInt32(1), Insensitive.Equals(e.GetString(5), "E"), Insensitive.Equals(e.GetString(2), "S"));
if (location == Point3D.Zero)
from.SendMessage("Sextant reverse lookup failed.");
}
if (location != Point3D.Zero)
{
target.MoveToWorld(location, map);
from.SendAsciiMessage(string.Format("Sent {0} to {1}.", target.Name, location));
}
else
from.SendAsciiMessage("Invalid location.");
}
示例15: CreateMap_OnCommand
private static void CreateMap_OnCommand( CommandEventArgs e )
{
if ( e.Arguments.Length == 2 )
{
try
{
Map map = Map.Parse( e.GetString( 0 ) );
if ( map != null )
{
string name = e.GetString( 1 );
BaseInstanceMap basemap = new BaseInstanceMap( map, name, MapRules.FeluccaRules );
}
}
catch
{
}
}
}