Пример #1
0
        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
0
		public static void ValidateName_OnCommand( CommandEventArgs e )
		{
			if ( Validate( e.ArgString, 2, 16, true, true, true, 1, SpaceDashPeriodQuote ) )
				e.Mobile.SendMessage( 0x59, "That name is considered valid." );
			else
				e.Mobile.SendMessage( 0x22, "That name is considered invalid." );
		}
        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;
        }
Пример #4
0
		public static void CheckLOS_OnCommand(CommandEventArgs e)
		{
			if (e.Mobile.AccessLevel == AccessLevel.Player && TestCenter.Enabled == false)
			{	// Players can only test this on Test Center
				e.Mobile.SendMessage("Not available here.");
				return;
			}

			if (e.Mobile.AccessLevel > AccessLevel.Player)
			{	// you will not get good results if you test this with AccessLevel > Player
				e.Mobile.SendMessage("You should test this with AccessLevel.Player.");
				return;
			}

			try
			{
				e.Mobile.Target = new LOSTarget();
				e.Mobile.SendMessage("Check LOS to which object?");
			}
			catch (Exception ex)
			{
				LogHelper.LogException(ex);
			}

		}
Пример #5
0
		public static void BondInfo_OnCommand( CommandEventArgs e )
		{
			Mobile from = e.Mobile;

			e.Mobile.BeginTarget( -1, false, TargetFlags.None, new TargetCallback( BondInfo_OnTarget ) );
			e.Mobile.SendMessage("Target the pet you wish to know the bonding timer of");
		}
Пример #6
0
		public static void FindMultiByType_OnCommand(CommandEventArgs e)
		{
			try
			{
				if (e.Length == 1)
				{
					LogHelper Logger = new LogHelper("FindMultiByType.log", e.Mobile, false);

					string name = e.GetString(0);

					foreach (ArrayList list in Server.Multis.BaseHouse.Multis.Values)
					{
						for (int i = 0; i < list.Count; i++)
						{
							BaseHouse house = list[i] as BaseHouse;
							// like Server.Multis.Tower
							if (house.GetType().ToString().ToLower().IndexOf(name.ToLower()) >= 0)
							{
								Logger.Log(house);
							}
						}
					}
					Logger.Finish();
				}
				else
				{
					e.Mobile.SendMessage("Format: FindMultiByType <type>");
				}
			}
			catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
		}
Пример #7
0
		public static void Staff_OnCommand( CommandEventArgs e )
		{
			PlayerMobile from = (PlayerMobile)e.Mobile;

			AccessLevelMod mod = RawAccessLevel( from );

			if ( mod != null )
			{
				if ( e.Length == 0 )
				{
					from.AccessLevel = mod.Level;
					m_Mobiles.Remove( from );
				}
				else
				{
					AccessLevel level;
					if ( !ArgumentToAccessLevel( e.Arguments[0], out level ) )
						from.SendMessage( "Invalid AccessLevel: " + e.Arguments[0] );
					else
					{
						if ( mod.Level < level )
							from.SendMessage( "Invalid AccessLevel: " + e.Arguments[0] );
						else
						{
							if ( mod.Level == level )
							{
								m_Mobiles.Remove( from );
							}
							from.AccessLevel = level;
						}
					}
				}
			}
			else if ( from.AccessLevel == AccessLevel.Player )
				from.Say( e.ArgString );
			else
			{
				if ( e.Length == 0 )
				{
					m_Mobiles.Add( from, new AccessLevelMod( from.AccessLevel ) );
					from.AccessLevel = AccessLevel.Player;
				}
				else
				{
					AccessLevel level;
					if ( !ArgumentToAccessLevel( e.Arguments[0], out level ) )
						from.SendMessage( "Invalid AccessLevel: " + e.Arguments[0] );
					else
					{
						if ( from.AccessLevel <= level )
							from.SendMessage( "Invalid AccessLevel: " + e.Arguments[0] );
						else
						{
							m_Mobiles.Add( from, new AccessLevelMod( from.AccessLevel ) );
							from.AccessLevel = level;
						}
					}
				}
			}
		}
Пример #8
0
		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);
		}
Пример #9
0
		public static void FindItemByType_OnCommand(CommandEventArgs e)
		{
			try
			{
				if (e.Length == 1)
				{
					LogHelper Logger = new LogHelper("FindItemByType.log", e.Mobile, false);

					string name = e.GetString(0);

					foreach (Item item in World.Items.Values)
					{
						if (item != null && item.GetType().ToString().ToLower().IndexOf(name.ToLower()) >= 0)
						{
							Logger.Log(LogType.Item, item);
						}
					}
					Logger.Finish();
				}
				else
				{
					e.Mobile.SendMessage("Format: FindItemByType <type>");
				}
			}
			catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
		}
Пример #10
0
        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 ) ); }
        }
Пример #11
0
      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);
				}
			}
         }
      }
		private static void ShrinkRelease_OnCommand( CommandEventArgs e )
		{
			PlayerMobile from = e.Mobile as PlayerMobile;

			if ( null != from )
				SetLockDown( from, false );
		}
		public static void FactionsManage_OnCommand( CommandEventArgs arg )
		{
			Mobile from = arg.Mobile;

			from.CloseGump( typeof( FactionsManageGump ) );
			from.SendGump( new FactionsManageGump( from ) );
		}
		private static void Shrink_OnCommand( CommandEventArgs e )
		{
			PlayerMobile from = e.Mobile as PlayerMobile;

			if ( null != from )
				from.Target = new Xanthos.Evo.ShrinkTarget( from, null );
		}
Пример #15
0
		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;
		}
		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);
		}
Пример #17
0
		public static void On_FDStats(CommandEventArgs e)
		{
			e.Mobile.SendMessage("Display FreezeDry status for all eligible containers...");

			DateTime start = DateTime.Now;
			int containers = 0;
			int eligible = 0;
			int freezeDried = 0;
			int scheduled = 0;
			int orphans = 0;
			foreach (Item i in World.Items.Values)
			{
				if (i as Container != null)
				{
					Container cx = i as Container;
					containers++;
					if (cx.CanFreezeDry == true)
					{
						eligible++;
						if (cx.IsFreezeDried == true)
							freezeDried++;
					}

					if (cx.IsFreezeScheduled == true)
						scheduled++;

					if (cx.CanFreezeDry == true && cx.IsFreezeDried == false && cx.IsFreezeScheduled == false)
						orphans++;
				}
			}

			e.Mobile.SendMessage("Out of {0} eligible containers, {1} are freeze dried, {2} scheduled, and {3} orphans.", eligible, freezeDried, scheduled, orphans);
			DateTime end = DateTime.Now;
			e.Mobile.SendMessage("Finished in {0}ms.", (end - start).TotalMilliseconds);
		}
        private static void SetGuarded_OnCommand(CommandEventArgs e)
        {
            Mobile from = e.Mobile;

            if (e.Length == 1)
            {
                GuardedRegion reg = from.Region as GuardedRegion;

                if (reg == null)
                {
                    from.SendMessage("You are not in a guardable region.");
                }
                else
                {
                    reg.Disabled = !e.GetBoolean(0);

                    if (reg.Disabled)
                        from.SendMessage("The guards in this region have been disabled.");
                    else
                        from.SendMessage("The guards in this region have been enabled.");
                }
            }
            else
            {
                from.SendMessage("Format: SetGuarded <true|false>");
            }
        }
Пример #19
0
        public static void GetFlag_OnCommand( CommandEventArgs e )
        {
            int flag=0;
            bool error = false;
            if( e.Arguments.Length > 0 )
            {
                if(e.Arguments[0].StartsWith( "0x" ))
                {
                    try{flag = Convert.ToInt32( e.Arguments[0].Substring( 2 ), 16 ); } catch { error = true;}
                } else
                {
                    try{flag = int.Parse(e.Arguments[0]); } catch { error = true;}
                }

            }
            if(!error)
            {
                e.Mobile.Target = new GetFlagTarget(e,flag);
            } else
            {
                try{
                e.Mobile.SendMessage(33,"Flag: Bad flagfield argument");
                } catch {}
            }
        }
		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.");
			}
		}
Пример #21
0
		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();
					}
				}
			}
		}
Пример #22
0
		/// <summary>
		/// Handler for the GenSpawnData command
		/// </summary>
		private static void OnGenSpawnData( CommandEventArgs e )
		{
			World.Broadcast( BoxConfig.MessageHue, false, "Generating spawn data for Pandora's Box" );

			DateTime start = DateTime.Now;

			SpawnData data = new SpawnData();

			ArrayList Items = new ArrayList( World.Items.Values );

			foreach ( Item item in Items )
			{
				if ( item.GetType() == SpawnerHelper.SpawnerType )
				{
					SpawnEntry entry = SpawnerHelper.SpawnerToData( item );

					if ( entry != null )
						data.m_Spawns.Add( entry );
				}
			}

			data.Save();

			TimeSpan duration = DateTime.Now - start;

			World.Broadcast( BoxConfig.MessageHue, false, string.Format( "Generation complete. The process took {0} seconds", duration.TotalSeconds ) );
		}
Пример #23
0
        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 ) ); }
        }
Пример #24
0
		public static void FreezeMap_OnCommand(CommandEventArgs e)
		{
			Map map = e.Mobile.Map;

			if (map != null && map != Map.Internal)
				SendWarning(e.Mobile, "You are about to freeze <u>all items in {0}</u>.", BaseFreezeWarning, map, NullP3D, NullP3D, new WarningGumpCallback(FreezeWarning_Callback));
		}
Пример #25
0
		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.");
				}

			}

		}
Пример #26
0
 private static void OnErrors( CommandEventArgs e )
 {
     if ( e.ArgString == null || e.ArgString == "" )
         ErrorsGump.SendTo( e.Mobile );
     else
         Report( e.ArgString + " - " + e.Mobile.Name );
 }
Пример #27
0
		public override void ExecuteList(CommandEventArgs e, ArrayList list)
		{
			if (list.Count > 0)
				e.Mobile.SendGump(new InterfaceGump(e.Mobile, list, 0));
			else
				AddResponse("No matching objects found.");
		}
Пример #28
0
		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.");
			}
		}
Пример #29
0
        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." );
            }
        }
Пример #30
0
		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);
		}
Пример #31
0
        public static bool Handle(Mobile from, string text, MessageType type = MessageType.Regular)
        {
            if (!text.StartsWith(Prefix) && type != MessageType.Command)
            {
                return(false);
            }

            if (type != MessageType.Command)
            {
                text = text.Substring(Prefix.Length);
            }

            var indexOf = text.IndexOf(' ');

            string command;

            string[] args;
            string   argString;

            if (indexOf >= 0)
            {
                argString = text.Substring(indexOf + 1);

                command = text.Substring(0, indexOf);
                args    = Split(argString);
            }
            else
            {
                argString = "";
                command   = text.ToLower();
                args      = Array.Empty <string>();
            }

            Entries.TryGetValue(command, out var entry);

            if (entry != null)
            {
                if (from.AccessLevel >= entry.AccessLevel)
                {
                    if (entry.Handler != null)
                    {
                        var e = new CommandEventArgs(from, command, argString, args);
                        entry.Handler(e);
                        EventSink.InvokeCommand(e);
                    }
                }
                else
                {
                    if (from.AccessLevel <= BadCommandIgnoreLevel)
                    {
                        return(false);
                    }

                    from.SendMessage("You do not have access to that command.");
                }
            }
            else
            {
                if (from.AccessLevel <= BadCommandIgnoreLevel)
                {
                    return(false);
                }

                from.SendMessage("That is not a valid command.");
            }

            return(true);
        }
Пример #32
0
 public static void DoorGenDelete_OnCommand(CommandEventArgs e)
 {
     Delete();
 }
Пример #33
0
 public static void InvokeCommand(CommandEventArgs e) => Command?.Invoke(e);
Пример #34
0
 public static void DoorGenDelete_OnCommand(CommandEventArgs e)
 {
     WeakEntityCollection.Delete("door");
     // Retained for backward compatibility
     Delete();
 }
Пример #35
0
        private static void DecorateML_OnCommand(CommandEventArgs e)
        {
            e.Mobile.SendMessage("Generating Mondain's Legacy world decoration, please wait.");

            Decorate.Generate("ml", "Data/Mondain's Legacy/Trammel", Map.Trammel);
            Decorate.Generate("ml", "Data/Mondain's Legacy/Felucca", Map.Felucca);
            Decorate.Generate("ml", "Data/Mondain's Legacy/Ilshenar", Map.Ilshenar);
            Decorate.Generate("ml", "Data/Mondain's Legacy/Malas", Map.Malas);
            Decorate.Generate("ml", "Data/Mondain's Legacy/Tokuno", Map.Tokuno);
            Decorate.Generate("ml", "Data/Mondain's Legacy/TerMur", Map.TerMur);

            PeerlessAltar      altar;
            PeerlessTeleporter tele;
            PrismOfLightPillar pillar;

            // Bedlam - Malas
            altar = new BedlamAltar();

            if (!FindItem(86, 1627, 0, Map.Malas, altar))
            {
                WeakEntityCollection.Add("ml", altar);
                altar.MoveToWorld(new Point3D(86, 1627, 0), Map.Malas);
                tele = new PeerlessTeleporter(altar);
                WeakEntityCollection.Add("ml", tele);
                tele.PointDest = altar.ExitDest;
                tele.MoveToWorld(new Point3D(99, 1617, 50), Map.Malas);
            }

            // Blighted Grove - Trammel
            altar = new BlightedGroveAltar();

            if (!FindItem(6502, 875, 0, Map.Trammel, altar))
            {
                WeakEntityCollection.Add("ml", altar);
                altar.MoveToWorld(new Point3D(6502, 875, 0), Map.Trammel);
                tele = new PeerlessTeleporter(altar);
                WeakEntityCollection.Add("ml", tele);
                tele.PointDest = altar.ExitDest;
                tele.MoveToWorld(new Point3D(6511, 949, 26), Map.Trammel);
            }

            // Blighted Grove - Felucca
            altar = new BlightedGroveAltar();

            if (!FindItem(6502, 875, 0, Map.Felucca, altar))
            {
                WeakEntityCollection.Add("ml", altar);
                altar.MoveToWorld(new Point3D(6502, 875, 0), Map.Felucca);
                tele = new PeerlessTeleporter(altar);
                WeakEntityCollection.Add("ml", tele);
                tele.PointDest = altar.ExitDest;
                tele.MoveToWorld(new Point3D(6511, 949, 26), Map.Felucca);
            }

            // Palace of Paroxysmus - Trammel
            altar = new ParoxysmusAltar();

            if (!FindItem(6511, 506, -34, Map.Trammel, altar))
            {
                WeakEntityCollection.Add("ml", altar);
                altar.MoveToWorld(new Point3D(6511, 506, -34), Map.Trammel);
                tele = new PeerlessTeleporter(altar);
                WeakEntityCollection.Add("ml", tele);
                tele.PointDest = altar.ExitDest;
                tele.MoveToWorld(new Point3D(6518, 365, 46), Map.Trammel);
            }

            // Palace of Paroxysmus - Felucca
            altar = new ParoxysmusAltar();

            if (!FindItem(6511, 506, -34, Map.Felucca, altar))
            {
                WeakEntityCollection.Add("ml", altar);
                altar.MoveToWorld(new Point3D(6511, 506, -34), Map.Felucca);
                tele = new PeerlessTeleporter(altar);
                WeakEntityCollection.Add("ml", tele);
                tele.PointDest = altar.ExitDest;
                tele.MoveToWorld(new Point3D(6518, 365, 46), Map.Felucca);
            }

            // Prism of Light - Trammel
            altar = new PrismOfLightAltar();

            if (!FindItem(6509, 167, 6, Map.Trammel, altar))
            {
                WeakEntityCollection.Add("ml", altar);
                altar.MoveToWorld(new Point3D(6509, 167, 6), Map.Trammel);
                tele = new PeerlessTeleporter(altar);
                WeakEntityCollection.Add("ml", tele);
                tele.PointDest = altar.ExitDest;
                tele.Visible   = true;
                tele.ItemID    = 0xDDA;
                tele.MoveToWorld(new Point3D(6501, 137, -20), Map.Trammel);

                pillar = new PrismOfLightPillar((PrismOfLightAltar)altar, 0x581);
                WeakEntityCollection.Add("ml", pillar);
                pillar.MoveToWorld(new Point3D(6506, 167, 0), Map.Trammel);

                pillar = new PrismOfLightPillar((PrismOfLightAltar)altar, 0x581);
                WeakEntityCollection.Add("ml", pillar);
                pillar.MoveToWorld(new Point3D(6509, 164, 0), Map.Trammel);

                pillar = new PrismOfLightPillar((PrismOfLightAltar)altar, 0x581);
                WeakEntityCollection.Add("ml", pillar);
                pillar.MoveToWorld(new Point3D(6506, 164, 0), Map.Trammel);

                pillar = new PrismOfLightPillar((PrismOfLightAltar)altar, 0x481);
                WeakEntityCollection.Add("ml", pillar);
                pillar.MoveToWorld(new Point3D(6512, 167, 0), Map.Trammel);

                pillar = new PrismOfLightPillar((PrismOfLightAltar)altar, 0x481);
                WeakEntityCollection.Add("ml", pillar);
                pillar.MoveToWorld(new Point3D(6509, 170, 0), Map.Trammel);

                pillar = new PrismOfLightPillar((PrismOfLightAltar)altar, 0x481);
                WeakEntityCollection.Add("ml", pillar);
                pillar.MoveToWorld(new Point3D(6512, 170, 0), Map.Trammel);
            }

            // Prism of Light - Felucca
            altar = new PrismOfLightAltar();

            if (!FindItem(6509, 167, 6, Map.Felucca, altar))
            {
                WeakEntityCollection.Add("ml", altar);
                altar.MoveToWorld(new Point3D(6509, 167, 6), Map.Felucca);
                tele = new PeerlessTeleporter(altar);
                WeakEntityCollection.Add("ml", tele);
                tele.PointDest = altar.ExitDest;
                tele.Visible   = true;
                tele.ItemID    = 0xDDA;
                tele.MoveToWorld(new Point3D(6501, 137, -20), Map.Felucca);

                pillar = new PrismOfLightPillar((PrismOfLightAltar)altar, 0x581);
                WeakEntityCollection.Add("ml", pillar);
                pillar.MoveToWorld(new Point3D(6506, 167, 0), Map.Felucca);

                pillar = new PrismOfLightPillar((PrismOfLightAltar)altar, 0x581);
                WeakEntityCollection.Add("ml", pillar);
                pillar.MoveToWorld(new Point3D(6509, 164, 0), Map.Felucca);

                pillar = new PrismOfLightPillar((PrismOfLightAltar)altar, 0x581);
                WeakEntityCollection.Add("ml", pillar);
                pillar.MoveToWorld(new Point3D(6506, 164, 0), Map.Felucca);

                pillar = new PrismOfLightPillar((PrismOfLightAltar)altar, 0x481);
                WeakEntityCollection.Add("ml", pillar);
                pillar.MoveToWorld(new Point3D(6512, 167, 0), Map.Felucca);

                pillar = new PrismOfLightPillar((PrismOfLightAltar)altar, 0x481);
                WeakEntityCollection.Add("ml", pillar);
                pillar.MoveToWorld(new Point3D(6509, 170, 0), Map.Felucca);

                pillar = new PrismOfLightPillar((PrismOfLightAltar)altar, 0x481);
                WeakEntityCollection.Add("ml", pillar);
                pillar.MoveToWorld(new Point3D(6512, 170, 0), Map.Felucca);
            }

            // The Citadel - Malas
            altar = new CitadelAltar();

            if (!FindItem(89, 1885, 0, Map.Malas, altar))
            {
                WeakEntityCollection.Add("ml", altar);
                altar.MoveToWorld(new Point3D(89, 1885, 0), Map.Malas);
                tele = new PeerlessTeleporter(altar);
                WeakEntityCollection.Add("ml", tele);
                tele.PointDest = altar.ExitDest;
                tele.MoveToWorld(new Point3D(111, 1955, 0), Map.Malas);
            }

            // Twisted Weald - Ilshenar
            altar = new TwistedWealdAltar();

            if (!FindItem(2170, 1255, -60, Map.Ilshenar, altar))
            {
                WeakEntityCollection.Add("ml", altar);
                altar.MoveToWorld(new Point3D(2170, 1255, -60), Map.Ilshenar);
                tele = new PeerlessTeleporter(altar);
                WeakEntityCollection.Add("ml", tele);
                tele.PointDest = altar.ExitDest;
                tele.MoveToWorld(new Point3D(2139, 1271, -57), Map.Ilshenar);
            }

            // Stygian Dragon Lair - Abyss
            StygianDragonPlatform sAltar = new StygianDragonPlatform();

            if (!FindItem(363, 157, 5, Map.TerMur, sAltar))
            {
                WeakEntityCollection.Add("ml", sAltar);
                sAltar.MoveToWorld(new Point3D(363, 157, 0), Map.TerMur);
            }

            //Medusa Lair - Abyss
            MedusaPlatform mAltar = new MedusaPlatform();

            if (!FindItem(822, 756, 56, Map.TerMur, mAltar))
            {
                WeakEntityCollection.Add("ml", sAltar);
                mAltar.MoveToWorld(new Point3D(822, 756, 56), Map.TerMur);
            }

            e.Mobile.SendMessage("Mondain's Legacy world generating complete.");
        }
Пример #36
0
 public static void GetLocation_OnCommand(CommandEventArgs e)
 {
     e.Mobile.SendMessage(GetLocationString(e.Mobile.Location, e.Mobile.Map));
 }
Пример #37
0
 private static void DecorateMLDelete_OnCommand(CommandEventArgs e)
 {
     WeakEntityCollection.Delete("ml");
 }
Пример #38
0
 private static void SettingsML_OnCommand(CommandEventArgs e)
 {
     e.Mobile.SendGump(new MondainsLegacyGump());
 }