本文整理汇总了C#中Server.CommandEventArgs.GetInt32方法的典型用法代码示例。如果您正苦于以下问题:C# CommandEventArgs.GetInt32方法的具体用法?C# CommandEventArgs.GetInt32怎么用?C# CommandEventArgs.GetInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.CommandEventArgs
的用法示例。
在下文中一共展示了CommandEventArgs.GetInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Animate_OnCommand
public static void Animate_OnCommand( CommandEventArgs e )
{
if ( e.Length == 6 )
{
e.Mobile.Animate( e.GetInt32( 0 ), e.GetInt32( 1 ), e.GetInt32( 2 ), e.GetBoolean( 3 ), e.GetBoolean( 4 ), e.GetInt32( 5 ) );
}
else
{
e.Mobile.SendMessage( "Format: Animate <action> <frameCount> <repeatCount> <forward> <repeat> <delay>" );
}
}
示例2: NudgeSelfUp_OnCommand
private static void NudgeSelfUp_OnCommand( CommandEventArgs e )
{
if(e.Arguments.Length > 0)
{
int zoffset = e.GetInt32(0);
e.Mobile.Location = new Point3D(e.Mobile.Location, e.Mobile.Location.Z + zoffset);
}
}
示例3: Light_OnCommand
private static void Light_OnCommand( CommandEventArgs e )
{
if ( e.Length >= 1 )
{
LevelOverride = e.GetInt32( 0 );
e.Mobile.SendMessage( "Global light level override has been changed to {0}.", m_LevelOverride );
}
else
{
LevelOverride = int.MinValue;
e.Mobile.SendMessage( "Global light level override has been cleared." );
}
}
示例4: PrintMessage_OnCommand
private static void PrintMessage_OnCommand(CommandEventArgs arg)
{
Mobile from = arg.Mobile;
if (arg.Length <= 0)
{
from.SendMessage("Usage: PrintMessage <msg_number>");
return;
}
// What message do we print
int message = arg.GetInt32(0);
from.SendLocalizedMessage(message);
from.SendMessage("Done.");
}
示例5: DupeMS_OnCommand
public static void DupeMS_OnCommand( CommandEventArgs e )
{
Mobile from = e.Mobile;
int count = 1;
try
{
count = e.GetInt32( 0 );
}
catch{}
if( count <= 0 )
count = 1;
from.Target = new InternalTarget( count );
}
示例6: Execute
public override void Execute( CommandEventArgs e )
{
if ( e.Length >= 2 )
{
Serial serial = e.GetInt32( 0 );
object obj = null;
if ( serial.IsItem )
obj = World.FindItem( serial );
else if ( serial.IsMobile )
obj = World.FindMobile( serial );
if ( obj == null )
{
e.Mobile.SendMessage( "That is not a valid serial." );
}
else
{
BaseCommand command = null;
Commands.TryGetValue( e.GetString( 1 ), out command );
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 - 2];
for ( int i = 0; i < args.Length; ++i )
args[i] = oldArgs[i + 2];
RunCommand( e.Mobile, obj, command, args );
}
}
}
else
{
e.Mobile.SendMessage( "You must supply an object serial and a command name." );
}
}
示例7: Props_OnCommand
private static void Props_OnCommand( CommandEventArgs e )
{
if ( e.Length == 1 )
{
IEntity ent = World.FindEntity( e.GetInt32( 0 ) );
if ( ent == null )
e.Mobile.SendMessage( "No object with that serial was found." );
else if ( !BaseCommand.IsAccessible( e.Mobile, ent ) )
e.Mobile.SendMessage( "That is not accessible." );
else
e.Mobile.SendGump( new PropertiesGump( e.Mobile, ent ) );
}
else
{
e.Mobile.Target = new PropsTarget( true );
}
}
示例8: FindSkill_OnCommand
private static void FindSkill_OnCommand(CommandEventArgs arg)
{
Mobile from = arg.Mobile;
SkillName skill;
// Init elapsed with 2nd of arguments passed to command
int elapsed = arg.GetInt32(1);
// Test the skill argument input to make sure it's valid
try
{
// Try to set var holding skill arg to enum equivalent
skill = (SkillName)Enum.Parse(typeof(SkillName), arg.GetString(0), true);
}
catch
{
// Skill not valid, return without performing mob search
from.SendMessage("You have specified an invalid skill.");
return;
}
ArrayList MobsMatched = FindSkillMobs(skill, elapsed);
if (MobsMatched.Count > 0)
{
// Found some, so loop and display
foreach (PlayerMobile pm in MobsMatched)
{
if (!pm.Hidden || from.AccessLevel > pm.AccessLevel || pm == from)
from.SendMessage("{0}, x:{1}, y:{2}, z:{3}", pm.Name, pm.Location.X, pm.Location.Y, pm.Location.Z);
}
}
else
{
// Found none, so inform.
from.SendMessage("Nobody online has used that skill recently.");
}
}
示例9: SplashGold_OnCommand
private static void SplashGold_OnCommand(CommandEventArgs e)
{
int amount = 1;
if (e.Length >= 1)
amount = e.GetInt32(0);
if (amount < 100)
{
e.Mobile.SendMessage("Splash at least 100 gold.");
}
else if (amount > 2800000)
{
e.Mobile.SendMessage("Amount exceeded. Use an amount less than 2800000.");
}
else
{
e.Mobile.Target = new SplashTarget(amount > 0 ? amount : 1);
e.Mobile.SendMessage("Where do you want the center of the gold splash to be?");
}
}
示例10: Execute
public override void Execute( CommandEventArgs e )
{
if ( e.Length >= 2 )
{
int range = e.GetInt32( 0 );
if ( range < 0 )
{
e.Mobile.SendMessage( "The range must not be negative." );
}
else
{
BaseCommand command = null;
Commands.TryGetValue( e.GetString( 1 ), out command );
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 - 2];
for ( int i = 0; i < args.Length; ++i )
args[i] = oldArgs[i + 2];
Process( range, e.Mobile, command, args );
}
}
}
else
{
e.Mobile.SendMessage( "You must supply a range and a command name." );
}
}
示例11: GrantTownSilver_OnCommand
public static void GrantTownSilver_OnCommand( CommandEventArgs e )
{
Town town = FromRegion( e.Mobile.Region );
if ( town == null )
{
e.Mobile.SendMessage( "You are not in a faction town." );
}
else if ( e.Length == 0 )
{
e.Mobile.SendMessage( "Format: GrantTownSilver <amount>" );
}
else
{
town.Silver += e.GetInt32( 0 );
e.Mobile.SendMessage( "You have granted {0:N0} silver to the town. It now has {1:N0} silver.", e.GetInt32( 0 ), town.Silver );
}
}
示例12: Execute
public override void Execute( CommandEventArgs e, object obj )
{
Mobile from = e.Mobile;
Mobile to = obj as Mobile;
if ( e.Length == 0 )
{
GoGump.DisplayTo( from, to );
return;
}
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) && !BaseCommand.IsAccessible( from, owner ) /* !from.CanSee( owner )*/ )
from.SendMessage( "You can not go to what you can not see." );
else if ( owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= from.AccessLevel )
from.SendMessage( "You can not go to what you can not see." );
else if ( !FixMap( ref map, ref loc, item ) )
from.SendMessage( "That is an internal item and you cannot go to it." );
else
to.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) && !BaseCommand.IsAccessible( from, owner ) /* !from.CanSee( owner )*/ )
from.SendMessage( "You can not go to what you can not see." );
else if ( owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= from.AccessLevel )
from.SendMessage( "You can not go to what you can not see." );
else if ( !FixMap( ref map, ref loc, m ) )
from.SendMessage( "That is an internal mobile and you cannot go to it." );
else
to.MoveToWorld( loc, map );
return;
}
else
{
string name = e.GetString( 0 );
Map map;
for ( int i = 0; i < Map.AllMaps.Count; ++i )
{
map = Map.AllMaps[i];
if ( map.MapIndex == 0x7F || map.MapIndex == 0xFF )
continue;
if ( Insensitive.Equals( name, map.Name ) )
{
to.Map = map;
return;
}
}
Dictionary<string, Region> list = to.Map.Regions;
foreach( KeyValuePair<string, Region> kvp in list )
{
Region r = kvp.Value;
if ( Insensitive.Equals( r.Name, name ) )
{
to.Location = new Point3D( r.GoLocation );
return;
}
}
for( int i = 0; i < Map.AllMaps.Count; ++i )
{
Map m = Map.AllMaps[i];
if( m.MapIndex == 0x7F || m.MapIndex == 0xFF || from.Map == m )
continue;
foreach( Region r in m.Regions.Values )
{
if( Insensitive.Equals( r.Name, name ) )
{
to.MoveToWorld( r.GoLocation, m );
//.........这里部分代码省略.........
示例13: Sound_OnCommand
public static void Sound_OnCommand(CommandEventArgs e)
{
if (e.Length == 1)
PlaySound(e.Mobile, e.GetInt32(0), true);
else if (e.Length == 2)
PlaySound(e.Mobile, e.GetInt32(0), e.GetBoolean(1));
else
e.Mobile.SendMessage("Format: Sound <index> [toAll]");
}
示例14: Light_OnCommand
public static void Light_OnCommand(CommandEventArgs e)
{
e.Mobile.LightLevel = e.GetInt32(0);
}
示例15: Go_OnCommand
private static void Go_OnCommand(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.SendMessage("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.SendMessage("You can not go to what you can not see.");
return;
}
else if (!FixMap(ref map, ref loc, item))
{
from.SendMessage("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.SendMessage("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.SendMessage("You can not go to what you can not see.");
return;
}
else if (!FixMap(ref map, ref loc, m))
{
from.SendMessage("That is an internal mobile and you cannot go to it.");
return;
}
from.MoveToWorld(loc, map);
return;
}
else
{
string name = e.GetString(0);
ArrayList list = from.Map.Regions;
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.SendMessage("No object with that serial was found.");
else
from.SendMessage("No region with that name was found.");
return;
}
}
catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
//.........这里部分代码省略.........