more fun stuff

This commit is contained in:
mark 2006-06-24 18:35:37 +00:00
parent 90c2233e4c
commit 6fcfced3fa
8 changed files with 31 additions and 39 deletions

View file

@ -432,20 +432,16 @@ namespace Server.Mobiles
private void UpgradeFromVersion0( object newVendorSystem ) private void UpgradeFromVersion0( object newVendorSystem )
{ {
ArrayList toRemove = new ArrayList(); List<Item> toRemove = new List<Item>();
foreach ( VendorItem vi in m_SellItems.Values ) foreach ( VendorItem vi in m_SellItems.Values )
{
if ( !CanBeVendorItem( vi.Item ) ) if ( !CanBeVendorItem( vi.Item ) )
toRemove.Add( vi.Item ); toRemove.Add( vi.Item );
else else
vi.Description = Utility.FixHtml( vi.Description ); vi.Description = Utility.FixHtml( vi.Description );
}
foreach ( Item item in toRemove ) foreach ( Item item in toRemove )
{
RemoveVendorItem( item ); RemoveVendorItem( item );
}
House = BaseHouse.FindHouseAt( this ); House = BaseHouse.FindHouseAt( this );

View file

@ -1,5 +1,5 @@
using System; using System;
using System.Collections; using System.Collections.Generic;
using Server.Network; using Server.Network;
using Server.Items; using Server.Items;
using Server.Mobiles; using Server.Mobiles;
@ -27,7 +27,7 @@ namespace Server.Spells.Bushido
BaseWeapon weapon = attacker.Weapon as BaseWeapon; BaseWeapon weapon = attacker.Weapon as BaseWeapon;
ArrayList targets = new ArrayList(); List<Mobile> targets = new List<Mobile>();
foreach ( Mobile m in attacker.GetMobilesInRange( weapon.MaxRange ) ) foreach ( Mobile m in attacker.GetMobilesInRange( weapon.MaxRange ) )
{ {
@ -45,7 +45,7 @@ namespace Server.Spells.Bushido
if ( !CheckMana( attacker, true ) ) if ( !CheckMana( attacker, true ) )
return; return;
Mobile target = (Mobile)targets[Utility.Random( targets.Count )]; Mobile target = targets[Utility.Random( targets.Count )];
double damageBonus = attacker.Skills[SkillName.Bushido].Value / 100.0; double damageBonus = attacker.Skills[SkillName.Bushido].Value / 100.0;

View file

@ -1,5 +1,5 @@
using System; using System;
using System.Collections; using System.Collections.Generic;
using Server.Network; using Server.Network;
using Server.Items; using Server.Items;
using Server.Targeting; using Server.Targeting;
@ -38,7 +38,7 @@ namespace Server.Spells.Chivalry
{ {
if ( CheckSequence() ) if ( CheckSequence() )
{ {
ArrayList targets = new ArrayList(); List<Mobile> targets = new List<Mobile>();
foreach ( Mobile m in Caster.GetMobilesInRange( 8 ) ) foreach ( Mobile m in Caster.GetMobilesInRange( 8 ) )
{ {
@ -55,7 +55,7 @@ namespace Server.Spells.Chivalry
for ( int i = 0; i < targets.Count; ++i ) for ( int i = 0; i < targets.Count; ++i )
{ {
Mobile m = (Mobile)targets[i]; Mobile m = targets[i];
BaseCreature bc = m as BaseCreature; BaseCreature bc = m as BaseCreature;
if ( bc != null ) if ( bc != null )

View file

@ -1,5 +1,5 @@
using System; using System;
using System.Collections; using System.Collections.Generic;
using Server.Network; using Server.Network;
using Server.Items; using Server.Items;
using Server.Targeting; using Server.Targeting;
@ -31,13 +31,11 @@ namespace Server.Spells.Chivalry
{ {
if ( CheckSequence() ) if ( CheckSequence() )
{ {
ArrayList targets = new ArrayList(); List<Mobile> targets = new List<Mobile>();
foreach ( Mobile m in Caster.GetMobilesInRange( 3 ) ) foreach ( Mobile m in Caster.GetMobilesInRange( 3 ) )
{
if ( Caster != m && SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) ) if ( Caster != m && SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) )
targets.Add( m ); targets.Add( m );
}
Caster.PlaySound( 0x212 ); Caster.PlaySound( 0x212 );
Caster.PlaySound( 0x206 ); Caster.PlaySound( 0x206 );
@ -47,7 +45,7 @@ namespace Server.Spells.Chivalry
for ( int i = 0; i < targets.Count; ++i ) for ( int i = 0; i < targets.Count; ++i )
{ {
Mobile m = (Mobile)targets[i]; Mobile m = targets[i];
int damage = ComputePowerValue( 10 ) + Utility.RandomMinMax( 0, 2 ); int damage = ComputePowerValue( 10 ) + Utility.RandomMinMax( 0, 2 );

View file

@ -1,5 +1,5 @@
using System; using System;
using System.Collections; using System.Collections.Generic;
using Server.Network; using Server.Network;
using Server.Items; using Server.Items;
using Server.Targeting; using Server.Targeting;
@ -30,24 +30,20 @@ namespace Server.Spells.Eighth
{ {
if ( SpellHelper.CheckTown( Caster, Caster ) && CheckSequence() ) if ( SpellHelper.CheckTown( Caster, Caster ) && CheckSequence() )
{ {
ArrayList targets = new ArrayList(); List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map; Map map = Caster.Map;
if ( map != null ) if ( map != null )
{
foreach ( Mobile m in Caster.GetMobilesInRange( 1 + (int)(Caster.Skills[SkillName.Magery].Value / 15.0) ) ) foreach ( Mobile m in Caster.GetMobilesInRange( 1 + (int)(Caster.Skills[SkillName.Magery].Value / 15.0) ) )
{
if ( Caster != m && SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) && (!Core.AOS || Caster.InLOS( m )) ) if ( Caster != m && SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) && (!Core.AOS || Caster.InLOS( m )) )
targets.Add( m ); targets.Add( m );
}
}
Caster.PlaySound( 0x2F3 ); Caster.PlaySound( 0x2F3 );
for ( int i = 0; i < targets.Count; ++i ) for ( int i = 0; i < targets.Count; ++i )
{ {
Mobile m = (Mobile)targets[i]; Mobile m = targets[i];
int damage; int damage;

View file

@ -1,5 +1,5 @@
using System; using System;
using System.Collections; using System.Collections.Generic;
using Server.Network; using Server.Network;
using Server.Items; using Server.Items;
using Server.Targeting; using Server.Targeting;
@ -42,7 +42,7 @@ namespace Server.Spells.Fourth
SpellHelper.GetSurfaceTop( ref p ); SpellHelper.GetSurfaceTop( ref p );
ArrayList targets = new ArrayList(); List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map; Map map = Caster.Map;
@ -68,7 +68,7 @@ namespace Server.Spells.Fourth
for ( int i = 0; i < targets.Count; ++i ) for ( int i = 0; i < targets.Count; ++i )
{ {
Mobile m = (Mobile)targets[i]; Mobile m = targets[i];
Caster.DoBeneficial( m ); Caster.DoBeneficial( m );

View file

@ -1,5 +1,5 @@
using System; using System;
using System.Collections; using System.Collections.Generic;
using Server.Network; using Server.Network;
using Server.Items; using Server.Items;
using Server.Targeting; using Server.Targeting;
@ -41,7 +41,7 @@ namespace Server.Spells.Fourth
SpellHelper.GetSurfaceTop( ref p ); SpellHelper.GetSurfaceTop( ref p );
ArrayList targets = new ArrayList(); List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map; Map map = Caster.Map;
@ -64,9 +64,9 @@ namespace Server.Spells.Fourth
for ( int i = 0; i < targets.Count; ++i ) for ( int i = 0; i < targets.Count; ++i )
{ {
Mobile m = (Mobile)targets[i]; Mobile m = targets[i];
if ( m == Caster || (party != null && party.Contains( m )) ) if ( m == Caster || ( party != null && party.Contains( m ) ) )
{ {
Caster.DoBeneficial( m ); Caster.DoBeneficial( m );
Spells.Second.ProtectionSpell.Toggle( Caster, m ); Spells.Second.ProtectionSpell.Toggle( Caster, m );
@ -83,7 +83,7 @@ namespace Server.Spells.Fourth
{ {
for ( int i = 0; i < targets.Count; ++i ) for ( int i = 0; i < targets.Count; ++i )
{ {
Mobile m = (Mobile)targets[i]; Mobile m = targets[i];
if ( m.BeginAction( typeof( ArchProtectionSpell ) ) ) if ( m.BeginAction( typeof( ArchProtectionSpell ) ) )
{ {

View file

@ -1,5 +1,5 @@
using System; using System;
using System.Collections; using System.Collections.Generic;
using Server.Network; using Server.Network;
using Server.Mobiles; using Server.Mobiles;
using Server.Targeting; using Server.Targeting;
@ -195,7 +195,7 @@ namespace Server.Spells.Necromancy
if ( c.Owner != null ) if ( c.Owner != null )
type = c.Owner.GetType(); type = c.Owner.GetType();
if ( c.ItemID != 0x2006 || c.Channeled || type == typeof( PlayerMobile ) || type == null || (c.Owner != null && c.Owner.Fame < 100) || ((c.Owner != null) && (c.Owner is BaseCreature) && (((BaseCreature)c.Owner).Summoned || ((BaseCreature)c.Owner).IsBonded)) ) if ( c.ItemID != 0x2006 || c.Channeled || type == typeof( PlayerMobile ) || type == null || ( c.Owner != null && c.Owner.Fame < 100 ) || ( ( c.Owner != null ) && ( c.Owner is BaseCreature ) && ( ((BaseCreature)c.Owner).Summoned || ((BaseCreature)c.Owner).IsBonded)) )
{ {
Caster.SendLocalizedMessage( 1061085 ); // There's not enough life force there to animate. Caster.SendLocalizedMessage( 1061085 ); // There's not enough life force there to animate.
} }
@ -229,14 +229,15 @@ namespace Server.Spells.Necromancy
FinishSequence(); FinishSequence();
} }
private static Hashtable m_Table = new Hashtable(); private static Dictionary<Mobile, List<Mobile>> m_Table = new Dictionary<Mobile, List<Mobile>>();
public static void Unregister( Mobile master, Mobile summoned ) public static void Unregister( Mobile master, Mobile summoned )
{ {
if ( master == null ) if ( master == null )
return; return;
ArrayList list = (ArrayList)m_Table[master]; List<Mobile> list = null;
m_Table.TryGetValue( master, out list );
if ( list == null ) if ( list == null )
return; return;
@ -252,17 +253,18 @@ namespace Server.Spells.Necromancy
if ( master == null ) if ( master == null )
return; return;
ArrayList list = (ArrayList)m_Table[master]; List<Mobile> list = null;
m_Table.TryGetValue( master, out list );
if ( list == null ) if ( list == null )
m_Table[master] = list = new ArrayList(); m_Table[master] = list = new List<Mobile>();
for ( int i = list.Count - 1; i >= 0; --i ) for ( int i = list.Count - 1; i >= 0; --i )
{ {
if ( i >= list.Count ) if ( i >= list.Count )
continue; continue;
Mobile mob = (Mobile)list[i]; Mobile mob = list[i];
if ( mob.Deleted ) if ( mob.Deleted )
list.RemoveAt( i-- ); list.RemoveAt( i-- );
@ -271,7 +273,7 @@ namespace Server.Spells.Necromancy
list.Add( summoned ); list.Add( summoned );
if ( list.Count > 3 ) if ( list.Count > 3 )
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( ((Mobile)list[0]).Kill ) ); Timer.DelayCall( TimeSpan.Zero, new TimerCallback( list[0].Kill ) );
Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), TimeSpan.FromSeconds( 2.0 ), new TimerStateCallback( Summoned_Damage ), summoned ); Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), TimeSpan.FromSeconds( 2.0 ), new TimerStateCallback( Summoned_Damage ), summoned );
} }