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 } }
public static void RepeatSoundCommand_OnCommand( CommandEventArgs args ) { if( args.Length == 2 ) { Timer timer = null; bool foundValue = false; int soundID = args.GetInt32( 0 ); double interval = args.GetDouble( 1 ); if( m_Table.ContainsKey( soundID ) ) foundValue = m_Table.TryGetValue( soundID, out timer ); if( foundValue || timer != null ) { if( timer != null ) timer.Stop(); if( m_Table.Remove( soundID ) ) args.Mobile.SendMessage( "RepeatSound process with sound index {0} halted.", soundID ); } else { timer = new InternalTimer( args.Mobile, soundID, interval ); timer.Start(); m_Table.Add( soundID, timer ); } } else { args.Mobile.SendMessage( "Usage: RepeatSound <int soundID> <double intervalDelay>" ); } }
public static void SetSkillP_OnCommand(CommandEventArgs arg) { if (arg.Length != 2) { arg.Mobile.SendMessage("SetSkillP <skill name> <value>"); } else { string skill; int which = 0; try { skill = arg.GetString(0); for (int i = 0; i < SkillInfo.Table.Length; i++) { if (skill == SkillInfo.Table[i].Name) { which = i; } } } catch { arg.Mobile.SendLocalizedMessage(1005631); // You have specified an invalid skill to set. return; } arg.Mobile.Target = new SkillTargetP(which, arg.GetDouble(1)); } }
private static void BenchmarkHooks_OnCommand(CommandEventArgs e) { if (e.Arguments.Length != 1) { return; } var iterations = e.GetUInt32(0); var tableId = e.GetString(1); var itemLevel = e.GetInt32(2); var itemChance = e.GetDouble(3); var backpack = new BackpackOfHolding(); e.Mobile.AddToBackpack(backpack); ZhConfig.Loot.Tables.TryGetValue(tableId, out var table); var watch = new Stopwatch(); watch.Start(); var items = 0; for (var i = 0; i < iterations; i++) { items += LootGenerator.MakeLoot(e.Mobile, backpack, table, itemLevel, itemChance); } watch.Stop(); Console.WriteLine($"Ran {iterations} iterations generating {items} which took {watch.Elapsed.TotalSeconds:F2} seconds."); }
public static void SetAllSkills_OnCommand( CommandEventArgs arg ) { if( arg.Length != 1 ) { arg.Mobile.SendMessage( "SetAllSkills <value>" ); } else { arg.Mobile.Target = new AllSkillsTarget( arg.GetDouble( 0 ) ); } }
public static void SetAllSkillsP_OnCommand(CommandEventArgs arg) { if (arg.Length != 1) { arg.Mobile.SendMessage("SetAllSkillsP <value>"); } else { arg.Mobile.Target = new AllSkillsTargetP(arg.GetDouble(0)); } }
public static void InstantTame_OnCommand(CommandEventArgs e) { e.Mobile.SendMessage("Target the animal or beast you wish to instantly tame."); if (e.Length != 1) { e.Mobile.Target = new InstaTameTarget(false); } else { e.Mobile.Target = new InstaTameTarget(true, e.GetDouble(0)); } }
public void ChallengeNow2(CommandEventArgs e) { double length = 1.0; if (e.Length > 0) { length = e.GetDouble(0); } length = Math.Max(length, 0.5); e.Mobile.Target = new AFKTarget(this, TimeSpan.FromMinutes(length)); e.Mobile.SendMessage(String.Format("{0:F2} minute(s) AFK test.", length)); }
private static void LootGen_OnCommand(CommandEventArgs e) { if (e.Arguments.Length != 3) { return; } var table = e.GetString(0); var itemLevel = e.GetInt32(1); var itemChance = e.GetDouble(2); e.Mobile.SendMessage("Target a container."); e.Mobile.Target = new InternalTarget(table, itemLevel, itemChance); }
public static void SetSkill_OnCommand( CommandEventArgs arg ) { if ( arg.Length != 2 ) { arg.Mobile.SendMessage( "SetSkill <skill name> <value>" ); } else { SkillName skill; 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. } } }
public static void SetSkill_OnCommand( 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 ); return; } arg.Mobile.Target = new SkillTarget( skill, arg.GetDouble( 1 ) ); } }
public static void SetSkillP_OnCommand( CommandEventArgs arg ) { if ( arg.Length != 2 ) { arg.Mobile.SendMessage( "SetSkillP <skill name> <value>" ); } else { string skill; int which = 0; try { skill = arg.GetString( 0 ); for( int i = 0; i < SkillInfo.Table.Length; i++ ) { if( skill == SkillInfo.Table[i].Name ) { which = i; } } } catch { arg.Mobile.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set. return; } arg.Mobile.Target = new SkillTargetP( which, arg.GetDouble( 1 ) ); } }