本文整理汇总了C#中Server.CommandEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# CommandEventArgs类的具体用法?C# CommandEventArgs怎么用?C# CommandEventArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CommandEventArgs类属于Server命名空间,在下文中一共展示了CommandEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RTT_OnCommand
public static void RTT_OnCommand(CommandEventArgs e)
{
int mode = 0;
try
{
if (e.Arguments.Length > 0)
{
try
{
mode = int.Parse(e.Arguments[0]);
}
catch //(Exception e1)
{
e.Mobile.SendMessage("Error with argument - using default test.");
}
}
if (e.Mobile.AccessLevel > AccessLevel.Player)
{
e.Mobile.SendMessage("Target a player to RTT");
e.Mobile.Target = new RTTTarget(mode);
}
else
{
if (e.Mobile is PlayerMobile)
{
((PlayerMobile)e.Mobile).RTT("Forced AFK check!", true, mode, "Command");
}
}
}
catch (Exception ex)
{
Scripts.Commands.LogHelper.LogException(ex);
}
}
示例2: On_Reserve
public static void On_Reserve(CommandEventArgs e)
{
uint start, end;
try
{
start = uint.Parse(e.Arguments[0].Replace("0x", ""), System.Globalization.NumberStyles.HexNumber);
end = uint.Parse(e.Arguments[1].Replace("0x", ""), System.Globalization.NumberStyles.HexNumber);
if (start < 0x60000000 || end >= 0x70000000 || start > end)
throw new Exception();
}
catch
{
e.Mobile.SendMessage("Usage: [ReserveSerials <start> <end>");
e.Mobile.SendMessage("This command will reserve serials from <start> to <end> (inclusive). <start> and <end> must be in hex format. <start> must be equal to or above 0x60000000 and <end> must be below 0x70000000.");
return;
}
for (int i = (int)start; i <= end; i++)
{
if (World.IsReserved(i) || World.FindItem(i) != null)
{
e.Mobile.SendMessage("Failure: Serial # {0:X} is in use.", i);
return;
}
}
for (int i = (int)start; i <= end; i++)
World.ReserveSerial(i);
e.Mobile.SendMessage("Serial range 0x{0:X} - 0x{1:X} successfully reserved.", start, end);
}
示例3: TotalRespawn_OnCommand
public static void TotalRespawn_OnCommand( CommandEventArgs e )
{
DateTime begin = DateTime.Now;
World.Broadcast(0x35, true, "The world is respawning, please wait.");
ArrayList spawners = new ArrayList();
foreach( Item item in World.Items.Values )
{
if( item is Server.Mobiles.Spawner )
{
spawners.Add(item);
}
}
foreach( Server.Mobiles.Spawner sp in spawners )
{
if( sp.Running )
{
sp.Respawn();
}
}
DateTime end = DateTime.Now;
TimeSpan timeTaken = end-begin;
World.Broadcast(0x35, true, "World spawn complete. The entire process took {0:00.00} seconds.", timeTaken.TotalSeconds);
e.Mobile.SendMessage("Total Respawn of {0} spawners took {1:00.00} seconds", spawners.Count, timeTaken.TotalSeconds);
}
示例4: Endduel_OnCommand
private static void Endduel_OnCommand(CommandEventArgs e)
{
DuelObject d = Ladder.GetDuel(e.Mobile);
if (d != null)
{
Mobile opponent = d.Player1 == e.Mobile ? d.Player2 : d.Player1;
if (opponent != null)
{
if (opponent.NetState == null)
{
d.Timer.Stop();
d.Finished(-1, DateTime.Now);
}
else
{
e.Mobile.SendGump(new EndDuelGump(d));
e.Mobile.SendMessage("Your opponent is still online.");
}
}
else
{
e.Mobile.SendMessage("You are not duelling.");
}
}
else
{
e.Mobile.SendMessage("You are not duelling.");
}
}
示例5: 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
{
AddResponse( "No matching objects found." );
}
}
示例6: OnChat
private static void OnChat( CommandEventArgs e, bool spammsg )
{
try{
ChatInfo info = ChatInfo.GetInfo( e.Mobile );
if ( !CanChat( info, true ) )
return;
if ( e.ArgString == null || e.ArgString == "" )
ListGump.SendTo( e.Mobile, Listing.Guild );
else if ( !TrackSpam.LogSpam( e.Mobile, "chat", ChatInfo.SpamLimiter ) )
{
Timer.DelayCall( TrackSpam.NextAllowedIn( e.Mobile, "chat", ChatInfo.SpamLimiter ), new TimerStateCallback( Queued ), e );
if ( spammsg )
e.Mobile.SendMessage( info.SystemColor, "Message queued. Please wait {0} seconds between messages.", ChatInfo.SpamLimiter );
}
else
{
foreach( ChatInfo ci in ChatInfo.ChatInfos.Values )
{
if ( ci.Mobile.NetState == null )
continue;
if ( CanChat( ci ) && info.Mobile.Guild == ci.Mobile.Guild && !ci.Ignoring( info.Mobile ) )
ci.Mobile.SendMessage( ci.GuildColor, "<{0}> {1}: {2}", e.Mobile.Guild.Abbreviation, e.Mobile.Name, e.ArgString );
else if ( ChatInfo.AllianceChat && CanChat( ci ) && ((Guild)info.Mobile.Guild).Allies.Contains( ci.Mobile.Guild ) && !ci.Ignoring( info.Mobile ) )
ci.Mobile.SendMessage( ci.GuildColor, "<{0}> {1}: {2}", e.Mobile.Guild.Abbreviation, e.Mobile.Name, e.ArgString );
else if ( ci.GlobalGuild )
ci.Mobile.SendMessage( ci.GuildColor, "<{0}> {1}: {2}", e.Mobile.Guild.Abbreviation, e.Mobile.Name, e.ArgString );
}
}
}catch{ Errors.Report( String.Format( "GuildChat-> OnChat-> |{0}|", e.Mobile ) ); }
}
示例7: ClearContainer_OnCommand
public static void ClearContainer_OnCommand( CommandEventArgs e )
{
foreach ( Mobile m in World.Mobiles.Values )
{
if ( m is BaseVendor )
{
BaseVendor vendor = m as BaseVendor;
Container buypack = vendor.BuyPack;
if ( buypack != null && buypack.Items != Item.EmptyItems )
{
ArrayList newitemslist = new ArrayList( buypack.Items );
buypack.Items.Clear();
for ( int i = newitemslist.Count - 1;i >= 0; i-- )
{
Item item = newitemslist[i] as Item;
if ( item != null )
item.Delete();
}
buypack.UpdateTotals();
}
}
}
}
示例8: Shrink_OnCommand
private static void Shrink_OnCommand( CommandEventArgs e )
{
PlayerMobile from = e.Mobile as PlayerMobile;
if ( null != from )
from.Target = new Xanthos.Evo.ShrinkTarget( from, null );
}
示例9: ShrinkRelease_OnCommand
private static void ShrinkRelease_OnCommand( CommandEventArgs e )
{
PlayerMobile from = e.Mobile as PlayerMobile;
if ( null != from )
SetLockDown( from, false );
}
示例10: CountShardPlatinum_OnCommand
private static void CountShardPlatinum_OnCommand( CommandEventArgs args )
{
float tokencount = WorkHorse();
string formatworld="";
int decimalworld=0;
if ( TokenSettings.Currency_Format.ToLower().StartsWith("y"))
{
//World
if ( tokencount < 1000 )
{
formatworld="";
}
if ( tokencount >= 1000 && tokencount < 1000000 )
{
tokencount=tokencount/1000;
formatworld=" Thousand";
decimalworld=TokenSettings.Places_Thousand;
}
if ( tokencount > 999999 )
{
tokencount=tokencount/1000000;
formatworld=" Million";
decimalworld=TokenSettings.Places_Million;
}
}
else
{
}
args.Mobile.SendMessage("Tokens in the World : "+String.Format("{0:f"+decimalworld+"}",tokencount)+formatworld);
}
示例11: Email_OnCommand
public static void Email_OnCommand(CommandEventArgs e)
{
Mobile from = e.Mobile;
// check arguments
if (e.Length != 3)
{
Usage(from);
return;
}
try
{
string To = e.GetString(0);
string Subject = e.GetString(1);
string Body = e.GetString(2);
if (SmtpDirect.CheckEmailAddy(To, true) == false)
{
from.SendMessage("Error: The 'to' address is ill formed.");
return;
}
// okay, now hand the list of users off to our mailer daemon
new Emailer().SendEmail(To, Subject, Body, false);
}
catch (Exception ex)
{
LogHelper.LogException(ex);
System.Console.WriteLine("Exception Caught in generic emailer: " + ex.Message);
System.Console.WriteLine(ex.StackTrace);
}
return;
}
示例12: Execute
public override void Execute(CommandEventArgs e, object obj)
{
Mobile m = obj as Mobile;
Mobile from = e.Mobile;
if (m != null)
{
ArrayList aggressors = m.Aggressors;
if (aggressors.Count > 0)
{
for (int i = 0; i < aggressors.Count; ++i)
{
AggressorInfo info = (AggressorInfo)aggressors[i];
Mobile temp = info.Attacker;
from.SendMessage("Aggressor:{0} '{1}' Ser:{2}, Time:{3}, Expired:{4}",
(temp is PlayerMobile ? ((PlayerMobile)temp).Account.ToString() : ((Mobile)temp).Name),
temp.GetType().Name,
temp.Serial,
info.LastCombatTime.TimeOfDay,
info.Expired);
}
}
}
else
{
AddResponse("Please target a mobile.");
}
}
示例13: OnChat
private static void OnChat( CommandEventArgs e, bool spammsg )
{
try{
ChatInfo info = ChatInfo.GetInfo( e.Mobile );
if ( !CanChat( info, true ) )
return;
if ( e.ArgString == null || e.ArgString == "" )
ListGump.SendTo( e.Mobile, Listing.Faction );
else if ( !TrackSpam.LogSpam( e.Mobile, "chat", ChatInfo.SpamLimiter ) )
{
Timer.DelayCall( TrackSpam.NextAllowedIn( e.Mobile, "chat", ChatInfo.SpamLimiter ), new TimerStateCallback( Queued ), e );
if ( spammsg )
e.Mobile.SendMessage( info.SystemColor, "Message queued. Please wait {0} seconds between messages.", ChatInfo.SpamLimiter );
}
else
{
foreach( ChatInfo ci in ChatInfo.ChatInfos.Values )
{
if ( ci.Mobile.NetState == null )
continue;
if ( CanChat( ci ) && SameFaction( info.Mobile, ci.Mobile ) && !ci.Ignoring( info.Mobile ) )
ci.Mobile.SendMessage( ci.FactionColor, "<{0}> {1}: {2}", ((PlayerMobile)e.Mobile).FactionPlayerState.Faction.Definition.FriendlyName, e.Mobile.Name, e.ArgString );
else if ( ci.GlobalFaction )
ci.Mobile.SendMessage( ci.FactionColor, "<{0}> {1}: {2}", ((PlayerMobile)e.Mobile).FactionPlayerState.Faction.Definition.FriendlyName, e.Mobile.Name, e.ArgString );
}
}
}catch{ Errors.Report( String.Format( "FactionChat-> OnChat-> |{0}|", e.Mobile ) ); }
}
示例14: Msg
private static void Msg( CommandEventArgs e )
{
Mobile from = e.Mobile;
Guild GuildC = from.Guild as Guild;
if ( GuildC == null )
{
from.SendMessage( "You are not in a guild!" );
}
else
{
foreach ( NetState state in NetState.Instances )
{
Mobile m = state.Mobile;
if ( m != null && GuildC.IsMember( m ) )
{
m.SendMessage( 0x2C, String.Format( "Guild[{0}]: {1}", from.Name, e.ArgString ) );
}
}
Packet p = null;
foreach (NetState ns in from.GetClientsInRange(8))
{
Mobile mob = ns.Mobile;
if (mob != null && mob.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > from.AccessLevel)
{
if (p == null)
p = new UnicodeMessage(from.Serial, from.Body, MessageType.Regular, from.SpeechHue, 3, from.Language, from.Name, String.Format("[Guild]: {0}", e.ArgString));
ns.Send(p);
}
}
}
}
示例15: LagReport_OnCommand
private static void LagReport_OnCommand(CommandEventArgs arg)
{
Mobile from = arg.Mobile;
if (from is PlayerMobile)
{
PlayerMobile pm = (PlayerMobile)from;
// Limit to 5 minutes between lag reports
if ((pm.LastLagTime + TimeSpan.FromMinutes(5.0)) < DateTime.Now)
{
// Let them log again
LogHelper lh = new LogHelper("lagreports.log", false, true);
lh.Log(LogType.Mobile, from, Server.Engines.CronScheduler.Cron.GetRecentTasks()); //adam: added schduled tasks!
//Requested by Adam:
Console.WriteLine("Lag at: {0}", DateTime.Now.ToShortTimeString());
// Update LastLagTime on PlayerMobile
pm.LastLagTime = DateTime.Now;
lh.Finish();
from.SendMessage("The fact that you are experiencing lag has been logged. We will review this with other data to try and determine the cause of this lag. Thank you for your help.");
}
else
{
from.SendMessage("It has been less than five minutes since you last reported lag. Please wait five minutes between submitting lag reports.");
}
}
}