a few generics and misc code cleanup
slight tweaks/opt
This commit is contained in:
parent
83190372f8
commit
566de1c2cf
20 changed files with 125 additions and 164 deletions
|
|
@ -63,7 +63,7 @@ namespace Server.Commands
|
|||
|
||||
bc.GetDetails( out commandString, out argString, out args );
|
||||
|
||||
BaseCommand command = (BaseCommand)m_Scope.Commands[commandString];
|
||||
BaseCommand command = m_Scope.Commands[commandString];
|
||||
|
||||
commands[i] = command;
|
||||
eventArgs[i] = new CommandEventArgs( e.Mobile, commandString, argString, args );
|
||||
|
|
@ -415,7 +415,7 @@ namespace Server.Commands
|
|||
/* Options */
|
||||
for ( int i = 0; i < BaseCommandImplementor.Implementors.Count; ++i )
|
||||
{
|
||||
BaseCommandImplementor impl = (BaseCommandImplementor)BaseCommandImplementor.Implementors[i];
|
||||
BaseCommandImplementor impl = BaseCommandImplementor.Implementors[i];
|
||||
|
||||
if ( m_From.AccessLevel < impl.AccessLevel )
|
||||
continue;
|
||||
|
|
@ -441,7 +441,7 @@ namespace Server.Commands
|
|||
{
|
||||
if ( index < BaseCommandImplementor.Implementors.Count )
|
||||
{
|
||||
BaseCommandImplementor impl = (BaseCommandImplementor)BaseCommandImplementor.Implementors[index];
|
||||
BaseCommandImplementor impl = BaseCommandImplementor.Implementors[index];
|
||||
|
||||
if ( m_From.AccessLevel >= impl.AccessLevel )
|
||||
m_Batch.Scope = impl;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Server;
|
||||
|
||||
namespace Server.Commands.Generic
|
||||
{
|
||||
|
|
@ -45,7 +45,7 @@ namespace Server.Commands.Generic
|
|||
private string[] m_Accessors;
|
||||
private AccessLevel m_AccessLevel;
|
||||
private CommandSupport m_SupportRequirement;
|
||||
private Hashtable m_Commands;
|
||||
private Dictionary<string, BaseCommand> m_Commands;
|
||||
private string m_Usage;
|
||||
private string m_Description;
|
||||
private bool m_SupportsConditionals;
|
||||
|
|
@ -86,14 +86,14 @@ namespace Server.Commands.Generic
|
|||
set{ m_SupportRequirement = value; }
|
||||
}
|
||||
|
||||
public Hashtable Commands
|
||||
public Dictionary<string, BaseCommand> Commands
|
||||
{
|
||||
get{ return m_Commands; }
|
||||
}
|
||||
|
||||
public BaseCommandImplementor()
|
||||
{
|
||||
m_Commands = new Hashtable( StringComparer.OrdinalIgnoreCase );
|
||||
m_Commands = new Dictionary<string, BaseCommand>( StringComparer.OrdinalIgnoreCase );
|
||||
}
|
||||
|
||||
public virtual void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
|
||||
|
|
@ -276,7 +276,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
if ( e.Length >= 1 )
|
||||
{
|
||||
BaseCommand command = (BaseCommand)m_Commands[e.GetString( 0 )];
|
||||
BaseCommand command = m_Commands[e.GetString( 0 )];
|
||||
|
||||
if ( command == null )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Server.Commands.Generic
|
|||
}
|
||||
else
|
||||
{
|
||||
BaseCommand command = (BaseCommand) this.Commands[e.GetString( 1 )];
|
||||
BaseCommand command = this.Commands[e.GetString( 1 )];
|
||||
|
||||
if ( command == null )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public void Redirect( CommandEventArgs e )
|
||||
{
|
||||
BaseCommand command = (BaseCommand)Commands[e.Command];
|
||||
BaseCommand command = Commands[e.Command];
|
||||
|
||||
if ( command == null )
|
||||
e.Mobile.SendMessage( "That is either an invalid command name or one that does not support this modifier." );
|
||||
|
|
|
|||
|
|
@ -4706,11 +4706,11 @@ namespace Server.Mobiles
|
|||
private DateTime m_NextHourlyCheck;
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
bool hasHourElapsed = ( DateTime.Now >= m_NextHourlyCheck );
|
||||
|
||||
if ( hasHourElapsed )
|
||||
{
|
||||
if ( DateTime.Now >= m_NextHourlyCheck )
|
||||
m_NextHourlyCheck = DateTime.Now + TimeSpan.FromHours( 1.0 );
|
||||
else
|
||||
return;
|
||||
|
||||
List<BaseCreature> toRelease = new List<BaseCreature>();
|
||||
|
||||
|
|
@ -4751,9 +4751,7 @@ namespace Server.Mobiles
|
|||
|
||||
if ( c.Map != Map.Internal )
|
||||
{
|
||||
// Every hour all pets lose 10% of max loyalty.
|
||||
if ( hasHourElapsed )
|
||||
c.Loyalty -= (BaseCreature.MaxLoyalty / 10);
|
||||
c.Loyalty -= (BaseCreature.MaxLoyalty / 10);
|
||||
|
||||
if( c.Loyalty < (BaseCreature.MaxLoyalty / 10) )
|
||||
{
|
||||
|
|
@ -4767,7 +4765,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
|
||||
// added lines to check if a wild creature in a house region has to be removed or not
|
||||
if ( (!c.Controlled && ( c.Region.IsPartOf( typeof( HouseRegion ) ) && c.CanBeDamaged()) || (hasHourElapsed && c.RemoveIfUntamed && c.Spawner == null )) )
|
||||
if ( (!c.Controlled && ( c.Region.IsPartOf( typeof( HouseRegion ) ) && c.CanBeDamaged()) || ( c.RemoveIfUntamed && c.Spawner == null )) )
|
||||
{
|
||||
c.RemoveStep++;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,27 +1,25 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Targeting;
|
||||
using Server.Mobiles;
|
||||
using System.Collections;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Targets
|
||||
{
|
||||
public class AIControlMobileTarget : Target
|
||||
{
|
||||
private ArrayList m_List;
|
||||
private List<BaseAI> m_List;
|
||||
private OrderType m_Order;
|
||||
|
||||
public OrderType Order
|
||||
{
|
||||
get
|
||||
{
|
||||
public OrderType Order {
|
||||
get {
|
||||
return m_Order;
|
||||
}
|
||||
}
|
||||
|
||||
public AIControlMobileTarget( BaseAI ai, OrderType order ) : base( -1, false, ( order == OrderType.Attack ? TargetFlags.Harmful : TargetFlags.None ) )
|
||||
{
|
||||
m_List = new ArrayList();
|
||||
m_List = new List<BaseAI>();
|
||||
m_Order = order;
|
||||
|
||||
AddAI( ai );
|
||||
|
|
@ -35,10 +33,10 @@ namespace Server.Targets
|
|||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
if ( o is Mobile )
|
||||
{
|
||||
if ( o is Mobile ) {
|
||||
Mobile m = (Mobile)o;
|
||||
for ( int i = 0; i < m_List.Count; ++i )
|
||||
((BaseAI)m_List[i]).EndPickTarget( from, (Mobile)o, m_Order );
|
||||
m_List[i].EndPickTarget( from, m, m_Order );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Engines.Craft;
|
||||
using Mat = Server.Engines.BulkOrders.BulkMaterialType;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Items;
|
||||
using Mat = Server.Engines.BulkOrders.BulkMaterialType;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
|
|
@ -132,7 +131,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
CraftSystem system = DefBlacksmithy.CraftSystem;
|
||||
|
||||
ArrayList validEntries = new ArrayList();
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for ( int i = 0; i < entries.Length; ++i )
|
||||
{
|
||||
|
|
@ -156,7 +155,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
if ( validEntries.Count > 0 )
|
||||
{
|
||||
SmallBulkEntry entry = (SmallBulkEntry)validEntries[Utility.Random( validEntries.Count )];
|
||||
SmallBulkEntry entry = validEntries[Utility.Random( validEntries.Count )];
|
||||
return new SmallSmithBOD( entry, material, amountMax, reqExceptional );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Engines.Craft;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
|
|
@ -124,7 +123,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
CraftSystem system = DefTailoring.CraftSystem;
|
||||
|
||||
ArrayList validEntries = new ArrayList();
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for ( int i = 0; i < entries.Length; ++i )
|
||||
{
|
||||
|
|
@ -148,7 +147,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
if ( validEntries.Count > 0 )
|
||||
{
|
||||
SmallBulkEntry entry = (SmallBulkEntry)validEntries[Utility.Random( validEntries.Count )];
|
||||
SmallBulkEntry entry = validEntries[Utility.Random( validEntries.Count )];
|
||||
return new SmallTailorBOD( entry, material, amountMax, reqExceptional );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.Harvest
|
||||
{
|
||||
|
|
@ -53,9 +53,9 @@ namespace Server.Engines.Harvest
|
|||
public HarvestVein[] Veins{ get{ return m_Veins; } set{ m_Veins = value; } }
|
||||
public bool RaceBonus { get { return m_RaceBonus; } set { m_RaceBonus = value; } }
|
||||
|
||||
private Hashtable m_BanksByMap;
|
||||
private Dictionary<Map, Dictionary<Point2D, HarvestBank>> m_BanksByMap;
|
||||
|
||||
public Hashtable Banks{ get{ return m_BanksByMap; } set{ m_BanksByMap = value; } }
|
||||
public Dictionary<Map, Dictionary<Point2D, HarvestBank>> Banks{ get{ return m_BanksByMap; } set{ m_BanksByMap = value; } }
|
||||
|
||||
public void SendMessageTo( Mobile from, object message )
|
||||
{
|
||||
|
|
@ -73,13 +73,15 @@ namespace Server.Engines.Harvest
|
|||
x /= m_BankWidth;
|
||||
y /= m_BankHeight;
|
||||
|
||||
Hashtable banks = (Hashtable)m_BanksByMap[map];
|
||||
Dictionary<Point2D, HarvestBank> banks = null;
|
||||
m_BanksByMap.TryGetValue( map, out banks );
|
||||
|
||||
if ( banks == null )
|
||||
m_BanksByMap[map] = banks = new Hashtable();
|
||||
m_BanksByMap[map] = banks = new Dictionary<Point2D, HarvestBank>();
|
||||
|
||||
Point2D key = new Point2D( x, y );
|
||||
HarvestBank bank = (HarvestBank)banks[key];
|
||||
HarvestBank bank = null;
|
||||
banks.TryGetValue( key, out bank );
|
||||
|
||||
if ( bank == null )
|
||||
banks[key] = bank = new HarvestBank( this, GetVeinAt( map, x, y ) );
|
||||
|
|
@ -108,7 +110,7 @@ namespace Server.Engines.Harvest
|
|||
|
||||
public HarvestDefinition()
|
||||
{
|
||||
m_BanksByMap = new Hashtable();
|
||||
m_BanksByMap = new Dictionary<Map, Dictionary<Point2D, HarvestBank>>();
|
||||
}
|
||||
|
||||
public bool Validate( int tileID )
|
||||
|
|
|
|||
|
|
@ -166,13 +166,13 @@ namespace Server.PathAlgorithms.FastAStar
|
|||
int newCost = m_Nodes[bestNode].cost + 1;
|
||||
int newTotal = newCost + Heuristic( newNode % AreaSize, (newNode / AreaSize) % AreaSize, m_Nodes[newNode].z );
|
||||
|
||||
if ( !wasTouched || m_Nodes[newNode].total > newTotal )
|
||||
if ( m_Nodes[newNode].total > newTotal )
|
||||
{
|
||||
m_Nodes[newNode].parent = bestNode;
|
||||
m_Nodes[newNode].cost = newCost;
|
||||
m_Nodes[newNode].total = newTotal;
|
||||
|
||||
if ( !wasTouched || !m_OnOpen[newNode] )
|
||||
if ( !m_OnOpen[newNode] )
|
||||
{
|
||||
AddToChain( newNode );
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,8 @@ namespace Server.Gumps
|
|||
else
|
||||
tree = Tokuno;
|
||||
|
||||
ParentNode branch = (ParentNode)tree.LastBranch[from];
|
||||
ParentNode branch = null;
|
||||
tree.LastBranch.TryGetValue( from, out branch );
|
||||
|
||||
if ( branch == null )
|
||||
branch = tree.Root;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -10,11 +10,11 @@ namespace Server.Gumps
|
|||
{
|
||||
private Map m_Map;
|
||||
private ParentNode m_Root;
|
||||
private Hashtable m_LastBranch;
|
||||
private Dictionary<Mobile, ParentNode> m_LastBranch;
|
||||
|
||||
public LocationTree( string fileName, Map map )
|
||||
{
|
||||
m_LastBranch = new Hashtable();
|
||||
m_LastBranch = new Dictionary<Mobile, ParentNode>();
|
||||
m_Map = map;
|
||||
|
||||
string path = Path.Combine( "Data/Locations/", fileName );
|
||||
|
|
@ -31,7 +31,7 @@ namespace Server.Gumps
|
|||
}
|
||||
}
|
||||
|
||||
public Hashtable LastBranch
|
||||
public Dictionary<Mobile, ParentNode> LastBranch
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Commands;
|
||||
using Server.Mobiles;
|
||||
|
|
@ -75,38 +74,28 @@ namespace Server.Gumps
|
|||
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
|
||||
|
||||
private Mobile m_Owner;
|
||||
private ArrayList m_Mobiles;
|
||||
private List<Mobile> m_Mobiles;
|
||||
private int m_Page;
|
||||
|
||||
private class InternalComparer : IComparer
|
||||
private class InternalComparer : IComparer<Mobile>
|
||||
{
|
||||
public static readonly IComparer Instance = new InternalComparer();
|
||||
public static readonly IComparer<Mobile> Instance = new InternalComparer();
|
||||
|
||||
public InternalComparer()
|
||||
{
|
||||
}
|
||||
|
||||
public int Compare( object x, object y )
|
||||
public int Compare( Mobile x, Mobile y )
|
||||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
else if ( x == null )
|
||||
return -1;
|
||||
else if ( y == null )
|
||||
return 1;
|
||||
|
||||
Mobile a = x as Mobile;
|
||||
Mobile b = y as Mobile;
|
||||
|
||||
if ( a == null || b == null )
|
||||
if ( x == null || y == null )
|
||||
throw new ArgumentException();
|
||||
|
||||
if ( a.AccessLevel > b.AccessLevel )
|
||||
if ( x.AccessLevel > y.AccessLevel )
|
||||
return -1;
|
||||
else if ( a.AccessLevel < b.AccessLevel )
|
||||
else if ( x.AccessLevel < y.AccessLevel )
|
||||
return 1;
|
||||
else
|
||||
return Insensitive.Compare( a.Name, b.Name );
|
||||
return Insensitive.Compare( x.Name, y.Name );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +103,7 @@ namespace Server.Gumps
|
|||
{
|
||||
}
|
||||
|
||||
public WhoGump( Mobile owner, ArrayList list, int page ) : base( GumpOffsetX, GumpOffsetY )
|
||||
public WhoGump( Mobile owner, List<Mobile> list, int page ) : base( GumpOffsetX, GumpOffsetY )
|
||||
{
|
||||
owner.CloseGump( typeof( WhoGump ) );
|
||||
|
||||
|
|
@ -124,14 +113,14 @@ namespace Server.Gumps
|
|||
Initialize( page );
|
||||
}
|
||||
|
||||
public static ArrayList BuildList( Mobile owner, string filter )
|
||||
public static List<Mobile> BuildList( Mobile owner, string filter )
|
||||
{
|
||||
if ( filter != null && (filter = filter.Trim()).Length == 0 )
|
||||
filter = null;
|
||||
else
|
||||
filter = filter.ToLower();
|
||||
|
||||
ArrayList list = new ArrayList();
|
||||
List<Mobile> list = new List<Mobile>();
|
||||
List<NetState> states = NetState.Instances;
|
||||
|
||||
for ( int i = 0; i < states.Count; ++i )
|
||||
|
|
@ -213,7 +202,7 @@ namespace Server.Gumps
|
|||
x = BorderSize + OffsetSize;
|
||||
y += EntryHeight + OffsetSize;
|
||||
|
||||
Mobile m = (Mobile)m_Mobiles[index];
|
||||
Mobile m = m_Mobiles[index];
|
||||
|
||||
AddImageTiled( x, y, EntryWidth, EntryHeight, EntryGumpID );
|
||||
AddLabelCropped( x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, GetHueFor( m ), m.Deleted ? "(deleted)" : m.Name );
|
||||
|
|
@ -280,7 +269,7 @@ namespace Server.Gumps
|
|||
|
||||
if ( index >= 0 && index < m_Mobiles.Count )
|
||||
{
|
||||
Mobile m = (Mobile)m_Mobiles[index];
|
||||
Mobile m = m_Mobiles[index];
|
||||
|
||||
if ( m.Deleted )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Factions;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
@ -637,7 +637,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
ArrayList attrs = new ArrayList();
|
||||
List<EquipInfoAttribute> attrs = new List<EquipInfoAttribute>();
|
||||
|
||||
if ( DisplayLootType )
|
||||
{
|
||||
|
|
@ -670,7 +670,7 @@ namespace Server.Items
|
|||
if ( attrs.Count == 0 && Crafter == null && Name != null )
|
||||
return;
|
||||
|
||||
EquipmentInfo eqInfo = new EquipmentInfo( number, m_Crafter, false, (EquipInfoAttribute[])attrs.ToArray( typeof( EquipInfoAttribute ) ) );
|
||||
EquipmentInfo eqInfo = new EquipmentInfo( number, m_Crafter, false, attrs.ToArray() );
|
||||
|
||||
from.Send( new DisplayEquipmentInfo( this, eqInfo ) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Commands;
|
||||
using Server.Network;
|
||||
|
|
@ -90,7 +89,7 @@ namespace Server.Items
|
|||
[Description( "Chain-links two or more targeted doors together." )]
|
||||
private static void ChainLink_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
e.Mobile.BeginTarget( -1, false, TargetFlags.None, new TargetStateCallback( ChainLink_OnTarget ), new ArrayList() );
|
||||
e.Mobile.BeginTarget( -1, false, TargetFlags.None, new TargetStateCallback( ChainLink_OnTarget ), new List<BaseDoor>() );
|
||||
e.Mobile.SendMessage( "Target the first of a sequence of doors to link." );
|
||||
}
|
||||
|
||||
|
|
@ -105,14 +104,14 @@ namespace Server.Items
|
|||
}
|
||||
else
|
||||
{
|
||||
ArrayList list = (ArrayList)state;
|
||||
List<BaseDoor> list = (List<BaseDoor>)state;
|
||||
|
||||
if ( list.Count > 0 && list[0] == door )
|
||||
{
|
||||
if ( list.Count >= 2 )
|
||||
{
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
((BaseDoor)list[i]).Link = ((BaseDoor)list[(i + 1) % list.Count]);
|
||||
list[i].Link = list[(i + 1) % list.Count];
|
||||
|
||||
from.SendMessage( "The chain of doors have been linked." );
|
||||
}
|
||||
|
|
@ -403,9 +402,9 @@ namespace Server.Items
|
|||
|
||||
public virtual bool UseChainedFunctionality{ get{ return false; } }
|
||||
|
||||
public ArrayList GetChain()
|
||||
public List<BaseDoor> GetChain()
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
List<BaseDoor> list = new List<BaseDoor>();
|
||||
BaseDoor c = this;
|
||||
|
||||
do
|
||||
|
|
@ -422,12 +421,12 @@ namespace Server.Items
|
|||
if ( !UseChainedFunctionality )
|
||||
return CanClose();
|
||||
|
||||
ArrayList list = GetChain();
|
||||
List<BaseDoor> list = GetChain();
|
||||
|
||||
bool freeToClose = true;
|
||||
|
||||
for ( int i = 0; freeToClose && i < list.Count; ++i )
|
||||
freeToClose = ((BaseDoor)list[i]).CanClose();
|
||||
freeToClose = list[i].CanClose();
|
||||
|
||||
return freeToClose;
|
||||
}
|
||||
|
|
@ -490,10 +489,10 @@ namespace Server.Items
|
|||
{
|
||||
bool open = !m_Open;
|
||||
|
||||
ArrayList list = GetChain();
|
||||
List<BaseDoor> list = GetChain();
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
((BaseDoor)list[i]).Open = open;
|
||||
list[i].Open = open;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
|
@ -152,7 +152,7 @@ namespace Server.Items
|
|||
public Container ConvertToStandardContainer()
|
||||
{
|
||||
Container metalBox = new MetalBox();
|
||||
ArrayList subItems = new ArrayList( Items );
|
||||
List<Item> subItems = new List<Item>( Items );
|
||||
|
||||
foreach ( Item subItem in subItems )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.ContextMenus;
|
||||
using Server.Engines.PartySystem;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.ContextMenus;
|
||||
using Server.Engines.PartySystem;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
@ -274,7 +273,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
private ArrayList m_Lifted = new ArrayList();
|
||||
private List<Item> m_Lifted = new List<Item>();
|
||||
|
||||
private bool CheckLoot( Mobile m, bool criminalAction )
|
||||
{
|
||||
|
|
@ -365,7 +364,7 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) m_Level );
|
||||
writer.WriteDeltaTime( m_DeleteTime );
|
||||
writer.WriteItemList( m_Lifted, true );
|
||||
writer.Write( m_Lifted, true );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -393,7 +392,7 @@ namespace Server.Items
|
|||
{
|
||||
m_Level = reader.ReadInt();
|
||||
m_DeleteTime = reader.ReadDeltaTime();
|
||||
m_Lifted = reader.ReadItemList();
|
||||
m_Lifted = reader.ReadStrongItemList();
|
||||
|
||||
if ( version < 2 )
|
||||
m_Guardians = new List<Mobile>();
|
||||
|
|
|
|||
|
|
@ -387,16 +387,16 @@ namespace Server.Items
|
|||
|
||||
writer.WriteDeltaTime( m_TimeOfDeath );
|
||||
|
||||
ArrayList list = ( m_RestoreTable == null ? null : new ArrayList( m_RestoreTable ) );
|
||||
List<KeyValuePair<Item, Point3D>> list = ( m_RestoreTable == null ? null : new List<KeyValuePair<Item, Point3D>>( m_RestoreTable ) );
|
||||
int count = ( list == null ? 0 : list.Count );
|
||||
|
||||
writer.Write( count );
|
||||
|
||||
for ( int i = 0; list != null && i < list.Count; ++i )
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
DictionaryEntry de = (DictionaryEntry)list[i];
|
||||
Item item = (Item)de.Key;
|
||||
Point3D loc = (Point3D)de.Value;
|
||||
KeyValuePair<Item, Point3D> kvp = list[i];
|
||||
Item item = kvp.Key;
|
||||
Point3D loc = kvp.Value;
|
||||
|
||||
writer.Write( item );
|
||||
|
||||
|
|
@ -644,20 +644,14 @@ namespace Server.Items
|
|||
list.Add( new OpenCorpseEntry() );
|
||||
}
|
||||
|
||||
private Hashtable m_RestoreTable;
|
||||
private Dictionary<Item, Point3D> m_RestoreTable;
|
||||
|
||||
public bool GetRestoreInfo( Item item, ref Point3D loc )
|
||||
{
|
||||
if ( m_RestoreTable == null || item == null )
|
||||
return false;
|
||||
|
||||
object obj = m_RestoreTable[item];
|
||||
|
||||
if ( obj == null )
|
||||
return false;
|
||||
|
||||
loc = (Point3D)obj;
|
||||
return true;
|
||||
return m_RestoreTable.TryGetValue( item, out loc );
|
||||
}
|
||||
|
||||
public void SetRestoreInfo( Item item, Point3D loc )
|
||||
|
|
@ -666,7 +660,7 @@ namespace Server.Items
|
|||
return;
|
||||
|
||||
if ( m_RestoreTable == null )
|
||||
m_RestoreTable = new Hashtable();
|
||||
m_RestoreTable = new Dictionary<Item, Point3D>();
|
||||
|
||||
m_RestoreTable[item] = loc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -253,8 +253,6 @@ namespace Server.Mobiles
|
|||
|
||||
public GenericBuyInfo( string name, Type type, int price, int amount, int itemID, int hue, object[] args )
|
||||
{
|
||||
amount = 20;
|
||||
|
||||
m_Type = type;
|
||||
m_Price = price;
|
||||
m_MaxAmount = m_Amount = amount;
|
||||
|
|
|
|||
|
|
@ -28,50 +28,6 @@ namespace Server.Spells.Sixth
|
|||
Caster.Target = new InternalTarget( this );
|
||||
}
|
||||
|
||||
public void Target( Mobile m )
|
||||
{
|
||||
Type t = m.GetType();
|
||||
bool dispellable = false;
|
||||
|
||||
if ( m is BaseCreature )
|
||||
dispellable = ( m as BaseCreature ).IsDispellable;
|
||||
|
||||
if ( !Caster.CanSee( m ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
|
||||
}
|
||||
else if ( !dispellable )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1005049 ); // That cannot be dispelled.
|
||||
}
|
||||
else if ( CheckHSequence( m ) )
|
||||
{
|
||||
SpellHelper.Turn( Caster, m );
|
||||
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
|
||||
double dispelChance = 0;
|
||||
|
||||
if ( bc != null )
|
||||
dispelChance = (50.0 + ((100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus*2))) / 100;
|
||||
|
||||
if ( dispelChance > Utility.RandomDouble() )
|
||||
{
|
||||
Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );
|
||||
Effects.PlaySound( m, m.Map, 0x201 );
|
||||
|
||||
m.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
m.FixedEffect( 0x3779, 10, 20 );
|
||||
Caster.SendLocalizedMessage( 1010084 ); // The creature resisted the attempt to dispel it!
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public class InternalTarget : Target
|
||||
{
|
||||
private DispelSpell m_Owner;
|
||||
|
|
@ -85,7 +41,36 @@ namespace Server.Spells.Sixth
|
|||
{
|
||||
if ( o is Mobile )
|
||||
{
|
||||
m_Owner.Target( (Mobile)o );
|
||||
Mobile m = (Mobile)o;
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
|
||||
if ( !from.CanSee( m ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 500237 ); // Target can not be seen.
|
||||
}
|
||||
else if ( bc == null || !bc.IsDispellable )
|
||||
{
|
||||
from.SendLocalizedMessage( 1005049 ); // That cannot be dispelled.
|
||||
}
|
||||
else if ( m_Owner.CheckHSequence( m ) )
|
||||
{
|
||||
SpellHelper.Turn( from, m );
|
||||
|
||||
double dispelChance = (50.0 + ((100 * (from.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus*2))) / 100;
|
||||
|
||||
if ( dispelChance > Utility.RandomDouble() )
|
||||
{
|
||||
Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );
|
||||
Effects.PlaySound( m, m.Map, 0x201 );
|
||||
|
||||
m.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
m.FixedEffect( 0x3779, 10, 20 );
|
||||
from.SendLocalizedMessage( 1010084 ); // The creature resisted the attempt to dispel it!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue