- extensive framework for dueling, tournaments, and events

- IP address command implementor
- miscellaneous minor fixes
This commit is contained in:
mark 2012-04-22 05:37:16 +00:00
parent c52504151b
commit 599b2af6d5
82 changed files with 11920 additions and 63 deletions

View file

@ -17,14 +17,15 @@ namespace Server.Commands.Generic
Self = 0x0020,
Region = 0x0040,
Contained = 0x0080,
IPAddress = 0x0100,
All = Single | Global | Online | Multi | Area | Self | Region | Contained,
All = Single | Global | Online | Multi | Area | Self | Region | Contained | IPAddress,
AllMobiles = All & ~Contained,
AllNPCs = All & ~(Online | Self | Contained),
AllItems = All & ~(Online | Self | Region),
AllNPCs = All & ~(IPAddress | Online | Self | Contained),
AllItems = All & ~(IPAddress | Online | Self | Region),
Simple = Single | Multi,
Complex = Global | Online | Area | Region | Contained
Complex = Global | Online | Area | Region | Contained | IPAddress
}
public abstract class BaseCommandImplementor
@ -40,6 +41,8 @@ namespace Server.Commands.Generic
Register( new AreaCommandImplementor() );
Register( new SelfCommandImplementor() );
Register( new ContainedCommandImplementor() );
Register( new IPAddressCommandImplementor() );
Register( new RangeCommandImplementor() );
Register( new ScreenCommandImplementor() );
Register( new FacetCommandImplementor() );

View file

@ -0,0 +1,64 @@
using System;
using System.Collections;
using Server;
using Server.Network;
namespace Server.Commands.Generic
{
public class IPAddressCommandImplementor : BaseCommandImplementor
{
public IPAddressCommandImplementor()
{
Accessors = new string[]{ "IPAddress" };
SupportRequirement = CommandSupport.IPAddress;
SupportsConditionals = true;
AccessLevel = AccessLevel.Administrator;
Usage = "IPAddress <command> [condition]";
Description = "Invokes the command on one mobile from each IP address that is logged in. Optional condition arguments can further restrict the set of objects.";
}
public override void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
{
try
{
Extensions ext = Extensions.Parse( from, ref args );
bool items, mobiles;
if ( !CheckObjectTypes( command, ext, out items, out mobiles ) )
return;
if ( !mobiles ) // sanity check
{
command.LogFailure( "This command does not support mobiles." );
return;
}
ArrayList list = new ArrayList();
ArrayList addresses = new ArrayList();
System.Collections.Generic.List<NetState> states = NetState.Instances;
for ( int i = 0; i < states.Count; ++i )
{
NetState ns = (NetState)states[i];
Mobile mob = ns.Mobile;
if ( mob != null && !addresses.Contains( ns.Address ) && ext.IsValid( mob ) )
{
list.Add( mob );
addresses.Add( ns.Address );
}
}
ext.Filter( list );
obj = list;
}
catch ( Exception ex )
{
from.SendMessage( ex.Message );
}
}
}
}