generic pooled enumerators
guild event bcp
This commit is contained in:
parent
42bdaae3f1
commit
88488bc616
9 changed files with 645 additions and 476 deletions
|
|
@ -249,7 +249,7 @@ namespace Server.Items
|
|||
if ( direct )
|
||||
alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
|
||||
|
||||
IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange( loc, ExplosionRange ) : map.GetMobilesInRange( loc, ExplosionRange );
|
||||
IPooledEnumerable eable = LeveledExplosion ? (IPooledEnumerable)map.GetObjectsInRange( loc, ExplosionRange ) : (IPooledEnumerable)map.GetMobilesInRange( loc, ExplosionRange );
|
||||
ArrayList toExplode = new ArrayList();
|
||||
|
||||
int toDamage = 0;
|
||||
|
|
|
|||
|
|
@ -687,9 +687,9 @@ namespace Server.Guilds
|
|||
pm.SendGump( new GuildInfoGump( pm, pm.Guild as Guild ) );
|
||||
}
|
||||
|
||||
public static BaseGuild EventSink_CreateGuild( CreateGuildEventArgs args )
|
||||
public static void EventSink_CreateGuild(CreateGuildEventArgs args)
|
||||
{
|
||||
return (BaseGuild)(new Guild( args.Id ));
|
||||
args.Guild = new Guild(args.Id);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -2592,7 +2592,7 @@ namespace Server.Mobiles
|
|||
#if Framework_4_0
|
||||
object valLock = new object();
|
||||
|
||||
Parallel.ForEach( eable.Cast<Mobile>(), m => {
|
||||
Parallel.ForEach(eable, m => {
|
||||
if (m.Deleted || m.Blessed)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ namespace Server
|
|||
public delegate void SetAbilityEventHandler( SetAbilityEventArgs e );
|
||||
public delegate void FastWalkEventHandler( FastWalkEventArgs e );
|
||||
public delegate void ServerStartedEventHandler();
|
||||
public delegate BaseGuild CreateGuildHandler( CreateGuildEventArgs e );
|
||||
public delegate void CreateGuildHandler( CreateGuildEventArgs e );
|
||||
public delegate void GuildGumpRequestHandler( GuildGumpRequestArgs e );
|
||||
public delegate void QuestGumpRequestHandler( QuestGumpRequestArgs e );
|
||||
public delegate void ClientVersionReceivedHandler( ClientVersionReceivedArgs e );
|
||||
|
|
@ -95,6 +95,9 @@ namespace Server
|
|||
private int m_Id;
|
||||
public int Id { get { return m_Id; } set { m_Id = value; } }
|
||||
|
||||
private BaseGuild m_Guild;
|
||||
public BaseGuild Guild { get { return m_Guild; } set { m_Guild = value; } }
|
||||
|
||||
public CreateGuildEventArgs( int id )
|
||||
{
|
||||
m_Id = id;
|
||||
|
|
@ -853,6 +856,58 @@ namespace Server
|
|||
public static event GuildGumpRequestHandler GuildGumpRequest;
|
||||
public static event QuestGumpRequestHandler QuestGumpRequest;
|
||||
public static event ClientVersionReceivedHandler ClientVersionReceived;
|
||||
|
||||
/* The following is a .NET 2.0 "Generic EventHandler" implementation.
|
||||
* It is a breaking change; we would have to refactor all event handlers.
|
||||
* This style does not appear to be in widespread use.
|
||||
* We could also look into .NET 4.0 Action<T>/Func<T> implementations.
|
||||
*/
|
||||
|
||||
/*
|
||||
public static event EventHandler<CharacterCreatedEventArgs> CharacterCreated;
|
||||
public static event EventHandler<OpenDoorMacroEventArgs> OpenDoorMacroUsed;
|
||||
public static event EventHandler<SpeechEventArgs> Speech;
|
||||
public static event EventHandler<LoginEventArgs> Login;
|
||||
public static event EventHandler<ServerListEventArgs> ServerList;
|
||||
public static event EventHandler<MovementEventArgs> Movement;
|
||||
public static event EventHandler<HungerChangedEventArgs> HungerChanged;
|
||||
public static event EventHandler<CrashedEventArgs> Crashed;
|
||||
public static event EventHandler<ShutdownEventArgs> Shutdown;
|
||||
public static event EventHandler<HelpRequestEventArgs> HelpRequest;
|
||||
public static event EventHandler<DisarmRequestEventArgs> DisarmRequest;
|
||||
public static event EventHandler<StunRequestEventArgs> StunRequest;
|
||||
public static event EventHandler<OpenSpellbookRequestEventArgs> OpenSpellbookRequest;
|
||||
public static event EventHandler<CastSpellRequestEventArgs> CastSpellRequest;
|
||||
public static event EventHandler<BandageTargetRequestEventArgs> BandageTargetRequest;
|
||||
public static event EventHandler<AnimateRequestEventArgs> AnimateRequest;
|
||||
public static event EventHandler<LogoutEventArgs> Logout;
|
||||
public static event EventHandler<SocketConnectEventArgs> SocketConnect;
|
||||
public static event EventHandler<ConnectedEventArgs> Connected;
|
||||
public static event EventHandler<DisconnectedEventArgs> Disconnected;
|
||||
public static event EventHandler<RenameRequestEventArgs> RenameRequest;
|
||||
public static event EventHandler<PlayerDeathEventArgs> PlayerDeath;
|
||||
public static event EventHandler<VirtueGumpRequestEventArgs> VirtueGumpRequest;
|
||||
public static event EventHandler<VirtueItemRequestEventArgs> VirtueItemRequest;
|
||||
public static event EventHandler<VirtueMacroRequestEventArgs> VirtueMacroRequest;
|
||||
public static event EventHandler<ChatRequestEventArgs> ChatRequest;
|
||||
public static event EventHandler<AccountLoginEventArgs> AccountLogin;
|
||||
public static event EventHandler<PaperdollRequestEventArgs> PaperdollRequest;
|
||||
public static event EventHandler<ProfileRequestEventArgs> ProfileRequest;
|
||||
public static event EventHandler<ChangeProfileRequestEventArgs> ChangeProfileRequest;
|
||||
public static event EventHandler<AggressiveActionEventArgs> AggressiveAction;
|
||||
public static event EventHandler<CommandEventArgs> Command;
|
||||
public static event EventHandler<GameLoginEventArgs> GameLogin;
|
||||
public static event EventHandler<DeleteRequestEventArgs> DeleteRequest;
|
||||
public static event EventHandler<EventArgs> WorldLoad;
|
||||
public static event EventHandler<WorldSaveEventArgs> WorldSave;
|
||||
public static event EventHandler<SetAbilityEventArgs> SetAbility;
|
||||
public static event EventHandler<FastWalkEventArgs> FastWalk;
|
||||
public static event EventHandler<CreateGuildEventArgs> CreateGuild;
|
||||
public static event EventHandler<EventArgs> ServerStarted;
|
||||
public static event EventHandler<GuildGumpRequestArgs> GuildGumpRequest;
|
||||
public static event EventHandler<QuestGumpRequestArgs> QuestGumpRequest;
|
||||
public static event EventHandler<ClientVersionReceivedArgs> ClientVersionReceived;
|
||||
*/
|
||||
|
||||
public static void InvokeClientVersionReceived( ClientVersionReceivedArgs e )
|
||||
{
|
||||
|
|
@ -866,12 +921,10 @@ namespace Server
|
|||
ServerStarted();
|
||||
}
|
||||
|
||||
public static BaseGuild InvokeCreateGuild( CreateGuildEventArgs e )
|
||||
public static void InvokeCreateGuild( CreateGuildEventArgs e )
|
||||
{
|
||||
if ( CreateGuild != null )
|
||||
return CreateGuild( e );
|
||||
else
|
||||
return null;
|
||||
CreateGuild( e );
|
||||
}
|
||||
|
||||
public static void InvokeSetAbility( SetAbilityEventArgs e )
|
||||
|
|
|
|||
|
|
@ -2174,7 +2174,7 @@ namespace Server
|
|||
Map map = m_Map;
|
||||
|
||||
if ( map == null )
|
||||
return Server.Map.NullEnumerable.Instance;
|
||||
return Server.Map.NullEnumerable<IEntity>.Instance;
|
||||
|
||||
if ( m_Parent == null )
|
||||
return map.GetObjectsInRange( m_Location, range );
|
||||
|
|
@ -2187,7 +2187,7 @@ namespace Server
|
|||
Map map = m_Map;
|
||||
|
||||
if ( map == null )
|
||||
return Server.Map.NullEnumerable.Instance;
|
||||
return Server.Map.NullEnumerable<Item>.Instance;
|
||||
|
||||
if ( m_Parent == null )
|
||||
return map.GetItemsInRange( m_Location, range );
|
||||
|
|
@ -2200,7 +2200,7 @@ namespace Server
|
|||
Map map = m_Map;
|
||||
|
||||
if ( map == null )
|
||||
return Server.Map.NullEnumerable.Instance;
|
||||
return Server.Map.NullEnumerable<Mobile>.Instance;
|
||||
|
||||
if ( m_Parent == null )
|
||||
return map.GetMobilesInRange( m_Location, range );
|
||||
|
|
@ -2213,7 +2213,7 @@ namespace Server
|
|||
Map map = m_Map;
|
||||
|
||||
if ( map == null )
|
||||
return Server.Map.NullEnumerable.Instance;
|
||||
return Server.Map.NullEnumerable<NetState>.Instance;
|
||||
|
||||
if ( m_Parent == null )
|
||||
return map.GetClientsInRange( m_Location, range );
|
||||
|
|
|
|||
1015
Server/Map.cs
1015
Server/Map.cs
File diff suppressed because it is too large
Load diff
|
|
@ -4776,7 +4776,7 @@ namespace Server
|
|||
Map map = m_Map;
|
||||
|
||||
if( map == null )
|
||||
return Server.Map.NullEnumerable.Instance;
|
||||
return Server.Map.NullEnumerable<Item>.Instance;
|
||||
|
||||
return map.GetItemsInRange( m_Location, range );
|
||||
}
|
||||
|
|
@ -4786,7 +4786,7 @@ namespace Server
|
|||
Map map = m_Map;
|
||||
|
||||
if( map == null )
|
||||
return Server.Map.NullEnumerable.Instance;
|
||||
return Server.Map.NullEnumerable<IEntity>.Instance;
|
||||
|
||||
return map.GetObjectsInRange( m_Location, range );
|
||||
}
|
||||
|
|
@ -4796,7 +4796,7 @@ namespace Server
|
|||
Map map = m_Map;
|
||||
|
||||
if( map == null )
|
||||
return Server.Map.NullEnumerable.Instance;
|
||||
return Server.Map.NullEnumerable<Mobile>.Instance;
|
||||
|
||||
return map.GetMobilesInRange( m_Location, range );
|
||||
}
|
||||
|
|
@ -4806,7 +4806,7 @@ namespace Server
|
|||
Map map = m_Map;
|
||||
|
||||
if( map == null )
|
||||
return Server.Map.NullEnumerable.Instance;
|
||||
return Server.Map.NullEnumerable<NetState>.Instance;
|
||||
|
||||
return map.GetClientsInRange( m_Location, range );
|
||||
}
|
||||
|
|
@ -4866,7 +4866,7 @@ namespace Server
|
|||
IPooledEnumerable eable = m_Map.GetObjectsInRange( m_Location, range );
|
||||
|
||||
#if Framework_4_0
|
||||
Parallel.ForEach(eable.Cast<IEntity>(), o => {
|
||||
Parallel.ForEach(eable, o => {
|
||||
#else
|
||||
foreach(IEntity o in eable) {
|
||||
#endif
|
||||
|
|
@ -6601,9 +6601,9 @@ namespace Server
|
|||
{
|
||||
IPooledEnumerable eable = m_Map.GetObjectsInRange( m_Location, Core.GlobalMaxUpdateRange );
|
||||
#if Framework_4_0
|
||||
Parallel.ForEach( eable.Cast<IEntity>(), o => {
|
||||
Parallel.ForEach(eable, o => {
|
||||
#else
|
||||
foreach( object o in eable ) {
|
||||
foreach ( object o in eable ) {
|
||||
#endif
|
||||
if( o is Mobile ) {
|
||||
Mobile m = (Mobile)o;
|
||||
|
|
@ -6806,9 +6806,9 @@ namespace Server
|
|||
{
|
||||
IPooledEnumerable eable = m_Map.GetObjectsInRange( m_Location, Core.GlobalMaxUpdateRange );
|
||||
#if Framework_4_0
|
||||
Parallel.ForEach( eable.Cast<IEntity>(), o => {
|
||||
Parallel.ForEach(eable, o => {
|
||||
#else
|
||||
foreach( object o in eable ) {
|
||||
foreach ( object o in eable ) {
|
||||
#endif
|
||||
if( o is Item ) {
|
||||
Item item = (Item)o;
|
||||
|
|
@ -9139,9 +9139,9 @@ namespace Server
|
|||
|
||||
// We are attached to a client, so it's a bit more complex. We need to send new items and people to ourself, and ourself to other clients
|
||||
#if Framework_4_0
|
||||
Parallel.ForEach( eable.Cast<IEntity>(), o => {
|
||||
Parallel.ForEach(eable, o => {
|
||||
#else
|
||||
foreach( object o in eable ) {
|
||||
foreach ( object o in eable ) {
|
||||
#endif
|
||||
if( o is Item )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ namespace Server
|
|||
{
|
||||
IPooledEnumerable eable = m_Owner.GetMultiTilesAt( x, y );
|
||||
|
||||
if ( eable == Map.NullEnumerable.Instance )
|
||||
if ( eable == Map.NullEnumerable<StaticTile[]>.Instance )
|
||||
return tiles[x & 0x7][y & 0x7];
|
||||
|
||||
bool any = false;
|
||||
|
|
|
|||
|
|
@ -850,7 +850,8 @@ namespace Server {
|
|||
int length = idxReader.ReadInt32();
|
||||
|
||||
createEventArgs.Id = id;
|
||||
BaseGuild guild = EventSink.InvokeCreateGuild( createEventArgs );
|
||||
EventSink.InvokeCreateGuild(createEventArgs);
|
||||
BaseGuild guild = createEventArgs.Guild;
|
||||
if ( guild != null )
|
||||
guilds.Add( new GuildEntry( guild, pos, length ) );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue