Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -3,208 +3,208 @@ using Server.Items;
namespace Server.Commands
{
public class GenKhaldun
{
private static int m_Count;
public class GenKhaldun
{
private static int m_Count;
public static void Initialize()
{
CommandSystem.Register( "GenKhaldun", AccessLevel.Administrator, GenKhaldun_OnCommand );
}
public static void Initialize()
{
CommandSystem.Register("GenKhaldun", AccessLevel.Administrator, GenKhaldun_OnCommand);
}
public static bool FindMorphItem( int x, int y, int z, int inactiveItemID, int activeItemID )
{
IPooledEnumerable<Item> eable = Map.Felucca.GetItemsInRange( new Point3D( x, y, z ), 0 );
public static bool FindMorphItem(int x, int y, int z, int inactiveItemID, int activeItemID)
{
IPooledEnumerable<Item> eable = Map.Felucca.GetItemsInRange(new Point3D(x, y, z), 0);
foreach ( Item item in eable )
{
if ( item is MorphItem morphItem && morphItem.Z == z && morphItem.InactiveItemID == inactiveItemID && morphItem.ActiveItemID == activeItemID )
{
eable.Free();
return true;
}
}
foreach (Item item in eable)
if (item is MorphItem morphItem && morphItem.Z == z && morphItem.InactiveItemID == inactiveItemID &&
morphItem.ActiveItemID == activeItemID)
{
eable.Free();
return true;
}
eable.Free();
return false;
}
eable.Free();
return false;
}
public static bool FindEffectController( int x, int y, int z )
{
IPooledEnumerable eable = Map.Felucca.GetItemsInRange( new Point3D( x, y, z ), 0 );
public static bool FindEffectController(int x, int y, int z)
{
IPooledEnumerable eable = Map.Felucca.GetItemsInRange(new Point3D(x, y, z), 0);
foreach ( Item item in eable )
{
if ( item is EffectController && item.Z == z )
{
eable.Free();
return true;
}
}
foreach (Item item in eable)
if (item is EffectController && item.Z == z)
{
eable.Free();
return true;
}
eable.Free();
return false;
}
eable.Free();
return false;
}
public static Item TryCreateItem( int x, int y, int z, Item srcItem )
{
IPooledEnumerable<Item> eable = Map.Felucca.GetItemsInBounds( new Rectangle2D( x, y, 1, 1 ) );
public static Item TryCreateItem(int x, int y, int z, Item srcItem)
{
IPooledEnumerable<Item> eable = Map.Felucca.GetItemsInBounds(new Rectangle2D(x, y, 1, 1));
foreach ( Item item in eable )
{
if ( item.GetType() == srcItem.GetType() )
{
eable.Free();
srcItem.Delete();
return item;
}
}
foreach (Item item in eable)
if (item.GetType() == srcItem.GetType())
{
eable.Free();
srcItem.Delete();
return item;
}
eable.Free();
srcItem.MoveToWorld( new Point3D( x, y, z ), Map.Felucca );
m_Count++;
eable.Free();
srcItem.MoveToWorld(new Point3D(x, y, z), Map.Felucca);
m_Count++;
return srcItem;
}
return srcItem;
}
public static void CreateMorphItem( int x, int y, int z, int inactiveItemID, int activeItemID, int range )
{
if ( FindMorphItem( x, y, z, inactiveItemID, activeItemID ) )
return;
public static void CreateMorphItem(int x, int y, int z, int inactiveItemID, int activeItemID, int range)
{
if (FindMorphItem(x, y, z, inactiveItemID, activeItemID))
return;
MorphItem item = new MorphItem( inactiveItemID, activeItemID, range, 3 );
MorphItem item = new MorphItem(inactiveItemID, activeItemID, range, 3);
item.MoveToWorld( new Point3D( x, y, z ), Map.Felucca );
m_Count++;
}
item.MoveToWorld(new Point3D(x, y, z), Map.Felucca);
m_Count++;
}
public static void CreateApproachLight( int x, int y, int z, int off, int on, LightType light )
{
if ( FindMorphItem( x, y, z, off, on ) )
return;
public static void CreateApproachLight(int x, int y, int z, int off, int on, LightType light)
{
if (FindMorphItem(x, y, z, off, on))
return;
MorphItem item = new MorphItem( off, on, 2, 3 );
item.Light = light;
MorphItem item = new MorphItem(off, on, 2, 3);
item.Light = light;
item.MoveToWorld( new Point3D( x, y, z ), Map.Felucca );
m_Count++;
}
item.MoveToWorld(new Point3D(x, y, z), Map.Felucca);
m_Count++;
}
public static void CreateSoundEffect( int x, int y, int z, int sound, int range )
{
if ( FindEffectController( x, y, z ) )
return;
public static void CreateSoundEffect(int x, int y, int z, int sound, int range)
{
if (FindEffectController(x, y, z))
return;
EffectController item = new EffectController();
item.SoundID = sound;
item.TriggerType = EffectTriggerType.InRange;
item.TriggerRange = range;
EffectController item = new EffectController();
item.SoundID = sound;
item.TriggerType = EffectTriggerType.InRange;
item.TriggerRange = range;
item.MoveToWorld( new Point3D( x, y, z ), Map.Felucca );
m_Count++;
}
item.MoveToWorld(new Point3D(x, y, z), Map.Felucca);
m_Count++;
}
public static void CreateBigTeleporterItem( int x, int y, bool reverse )
{
if ( FindMorphItem( x, y, 0, reverse ? 0x17DC : 0x17EE, reverse ? 0x17EE : 0x17DC ) )
return;
public static void CreateBigTeleporterItem(int x, int y, bool reverse)
{
if (FindMorphItem(x, y, 0, reverse ? 0x17DC : 0x17EE, reverse ? 0x17EE : 0x17DC))
return;
MorphItem item = new MorphItem( reverse ? 0x17DC : 0x17EE, reverse ? 0x17EE : 0x17DC, 1, 3 );
MorphItem item = new MorphItem(reverse ? 0x17DC : 0x17EE, reverse ? 0x17EE : 0x17DC, 1, 3);
item.MoveToWorld( new Point3D( x, y, 0 ), Map.Felucca );
m_Count++;
}
item.MoveToWorld(new Point3D(x, y, 0), Map.Felucca);
m_Count++;
}
public static void GenKhaldun_OnCommand( CommandEventArgs e )
{
m_Count = 0;
public static void GenKhaldun_OnCommand(CommandEventArgs e)
{
m_Count = 0;
// Generate Morph Items
CreateMorphItem( 5459, 1416, 0, 0x1D0, 0x1, 1 );
CreateMorphItem( 5460, 1416, 0, 0x1D0, 0x1, 1 );
CreateMorphItem( 5459, 1416, 0, 0x1, 0x53D, 1 );
CreateMorphItem( 5460, 1416, 0, 0x1, 0x53B, 1 );
// Generate Morph Items
CreateMorphItem(5459, 1416, 0, 0x1D0, 0x1, 1);
CreateMorphItem(5460, 1416, 0, 0x1D0, 0x1, 1);
CreateMorphItem(5459, 1416, 0, 0x1, 0x53D, 1);
CreateMorphItem(5460, 1416, 0, 0x1, 0x53B, 1);
CreateMorphItem( 5459, 1425, 0, 0x1, 0x53B, 2 );
CreateMorphItem( 5459, 1426, 0, 0x1, 0x53B, 2 );
CreateMorphItem( 5459, 1427, 0, 0x1, 0x53B, 2 );
CreateMorphItem( 5460, 1425, 0, 0x1, 0x53B, 2 );
CreateMorphItem( 5460, 1426, 0, 0x1, 0x53B, 2 );
CreateMorphItem( 5460, 1427, 0, 0x1, 0x53B, 2 );
CreateMorphItem( 5461, 1427, 0, 0x1, 0x53B, 2 );
CreateMorphItem( 5460, 1422, 0, 0x1, 0x544, 2 );
CreateMorphItem( 5460, 1419, 0, 0x1, 0x545, 2 );
CreateMorphItem( 5460, 1420, 0, 0x1, 0x545, 2 );
CreateMorphItem( 5460, 1423, 0, 0x1, 0x545, 2 );
CreateMorphItem( 5460, 1424, 0, 0x1, 0x545, 2 );
CreateMorphItem( 5461, 1426, 0, 0x1, 0x545, 2 );
CreateMorphItem( 5460, 1417, 0, 0x1, 0x546, 1 );
CreateMorphItem( 5460, 1418, 0, 0x1, 0x546, 2 );
CreateMorphItem( 5460, 1421, 0, 0x1, 0x546, 2 );
CreateMorphItem( 5461, 1425, 0, 0x1, 0x548, 2 );
CreateMorphItem( 5459, 1420, 0, 0x1, 0x54A, 2 );
CreateMorphItem( 5459, 1421, 0, 0x1, 0x54A, 2 );
CreateMorphItem( 5459, 1423, 0, 0x1, 0x54A, 2 );
CreateMorphItem( 5459, 1418, 0, 0x1, 0x54B, 2 );
CreateMorphItem( 5459, 1422, 0, 0x1, 0x54B, 2 );
CreateMorphItem( 5459, 1417, 0, 0x1, 0x54C, 1 );
CreateMorphItem( 5459, 1419, 0, 0x1, 0x54C, 2 );
CreateMorphItem( 5459, 1424, 0, 0x1, 0x54C, 2 );
CreateMorphItem(5459, 1425, 0, 0x1, 0x53B, 2);
CreateMorphItem(5459, 1426, 0, 0x1, 0x53B, 2);
CreateMorphItem(5459, 1427, 0, 0x1, 0x53B, 2);
CreateMorphItem(5460, 1425, 0, 0x1, 0x53B, 2);
CreateMorphItem(5460, 1426, 0, 0x1, 0x53B, 2);
CreateMorphItem(5460, 1427, 0, 0x1, 0x53B, 2);
CreateMorphItem(5461, 1427, 0, 0x1, 0x53B, 2);
CreateMorphItem(5460, 1422, 0, 0x1, 0x544, 2);
CreateMorphItem(5460, 1419, 0, 0x1, 0x545, 2);
CreateMorphItem(5460, 1420, 0, 0x1, 0x545, 2);
CreateMorphItem(5460, 1423, 0, 0x1, 0x545, 2);
CreateMorphItem(5460, 1424, 0, 0x1, 0x545, 2);
CreateMorphItem(5461, 1426, 0, 0x1, 0x545, 2);
CreateMorphItem(5460, 1417, 0, 0x1, 0x546, 1);
CreateMorphItem(5460, 1418, 0, 0x1, 0x546, 2);
CreateMorphItem(5460, 1421, 0, 0x1, 0x546, 2);
CreateMorphItem(5461, 1425, 0, 0x1, 0x548, 2);
CreateMorphItem(5459, 1420, 0, 0x1, 0x54A, 2);
CreateMorphItem(5459, 1421, 0, 0x1, 0x54A, 2);
CreateMorphItem(5459, 1423, 0, 0x1, 0x54A, 2);
CreateMorphItem(5459, 1418, 0, 0x1, 0x54B, 2);
CreateMorphItem(5459, 1422, 0, 0x1, 0x54B, 2);
CreateMorphItem(5459, 1417, 0, 0x1, 0x54C, 1);
CreateMorphItem(5459, 1419, 0, 0x1, 0x54C, 2);
CreateMorphItem(5459, 1424, 0, 0x1, 0x54C, 2);
CreateMorphItem( 5458, 1426, 0, 0x1, 0x1D1, 2 );
CreateMorphItem( 5459, 1427, 0, 0x1, 0x1E3, 2 );
CreateMorphItem( 5458, 1425, 3, 0x1, 0x1E4, 2 );
CreateMorphItem( 5458, 1427, 6, 0x1, 0x1E5, 2 );
CreateMorphItem( 5461, 1427, 0, 0x1, 0x1E8, 2 );
CreateMorphItem( 5460, 1427, 0, 0x1, 0x1E9, 2 );
CreateMorphItem( 5458, 1425, 0, 0x1, 0x1EA, 2 );
CreateMorphItem( 5458, 1427, 0, 0x1, 0x1EA, 2 );
CreateMorphItem( 5458, 1427, 3, 0x1, 0x1EA, 2 );
CreateMorphItem(5458, 1426, 0, 0x1, 0x1D1, 2);
CreateMorphItem(5459, 1427, 0, 0x1, 0x1E3, 2);
CreateMorphItem(5458, 1425, 3, 0x1, 0x1E4, 2);
CreateMorphItem(5458, 1427, 6, 0x1, 0x1E5, 2);
CreateMorphItem(5461, 1427, 0, 0x1, 0x1E8, 2);
CreateMorphItem(5460, 1427, 0, 0x1, 0x1E9, 2);
CreateMorphItem(5458, 1425, 0, 0x1, 0x1EA, 2);
CreateMorphItem(5458, 1427, 0, 0x1, 0x1EA, 2);
CreateMorphItem(5458, 1427, 3, 0x1, 0x1EA, 2);
// Generate Approach Lights
CreateApproachLight( 5393, 1417, 0, 0x1857, 0x1858, LightType.Circle150 );
CreateApproachLight( 5393, 1420, 0, 0x1857, 0x1858, LightType.Circle150 );
CreateApproachLight( 5395, 1421, 0, 0x1857, 0x1858, LightType.Circle150 );
CreateApproachLight( 5396, 1417, 0, 0x1857, 0x1858, LightType.Circle150 );
CreateApproachLight( 5397, 1419, 0, 0x1857, 0x1858, LightType.Circle150 );
// Generate Approach Lights
CreateApproachLight(5393, 1417, 0, 0x1857, 0x1858, LightType.Circle150);
CreateApproachLight(5393, 1420, 0, 0x1857, 0x1858, LightType.Circle150);
CreateApproachLight(5395, 1421, 0, 0x1857, 0x1858, LightType.Circle150);
CreateApproachLight(5396, 1417, 0, 0x1857, 0x1858, LightType.Circle150);
CreateApproachLight(5397, 1419, 0, 0x1857, 0x1858, LightType.Circle150);
CreateApproachLight( 5441, 1393, 5, 0x1F2B, 0x19BB, LightType.Circle225 );
CreateApproachLight( 5446, 1393, 5, 0x1F2B, 0x19BB, LightType.Circle225 );
CreateApproachLight(5441, 1393, 5, 0x1F2B, 0x19BB, LightType.Circle225);
CreateApproachLight(5446, 1393, 5, 0x1F2B, 0x19BB, LightType.Circle225);
// Generate Sound Effects
CreateSoundEffect( 5425, 1489, 5, 0x102, 1 );
CreateSoundEffect( 5425, 1491, 5, 0x102, 1 );
// Generate Sound Effects
CreateSoundEffect(5425, 1489, 5, 0x102, 1);
CreateSoundEffect(5425, 1491, 5, 0x102, 1);
CreateSoundEffect( 5449, 1499, 10, 0xF5, 1 );
CreateSoundEffect( 5451, 1499, 10, 0xF5, 1 );
CreateSoundEffect( 5453, 1499, 10, 0xF5, 1 );
CreateSoundEffect(5449, 1499, 10, 0xF5, 1);
CreateSoundEffect(5451, 1499, 10, 0xF5, 1);
CreateSoundEffect(5453, 1499, 10, 0xF5, 1);
CreateSoundEffect( 5524, 1367, 0, 0x102, 1 );
CreateSoundEffect(5524, 1367, 0, 0x102, 1);
CreateSoundEffect( 5450, 1370, 0, 0x220, 2 );
CreateSoundEffect( 5450, 1372, 0, 0x220, 2 );
CreateSoundEffect(5450, 1370, 0, 0x220, 2);
CreateSoundEffect(5450, 1372, 0, 0x220, 2);
CreateSoundEffect( 5460, 1416, 0, 0x244, 2 );
CreateSoundEffect(5460, 1416, 0, 0x244, 2);
CreateSoundEffect( 5483, 1439, 5, 0x14, 3 );
CreateSoundEffect(5483, 1439, 5, 0x14, 3);
// Generate Big Teleporter
CreateBigTeleporterItem( 5387, 1325, true );
CreateBigTeleporterItem( 5388, 1326, true );
CreateBigTeleporterItem( 5388, 1325, false );
CreateBigTeleporterItem( 5387, 1326, false );
// Generate Big Teleporter
CreateBigTeleporterItem(5387, 1325, true);
CreateBigTeleporterItem(5388, 1326, true);
CreateBigTeleporterItem(5388, 1325, false);
CreateBigTeleporterItem(5387, 1326, false);
// Generate Central Khaldun entrance
DisappearingRaiseSwitch sw = TryCreateItem( 5459, 1426, 10, new DisappearingRaiseSwitch() ) as DisappearingRaiseSwitch;
RaiseSwitch lv = TryCreateItem( 5403, 1359, 0, new RaiseSwitch() ) as RaiseSwitch;
// Generate Central Khaldun entrance
DisappearingRaiseSwitch sw =
TryCreateItem(5459, 1426, 10, new DisappearingRaiseSwitch()) as DisappearingRaiseSwitch;
RaiseSwitch lv = TryCreateItem(5403, 1359, 0, new RaiseSwitch()) as RaiseSwitch;
RaisableItem stone = TryCreateItem( 5403, 1360, 0, new RaisableItem( 0x788, 10, 0x477, 0x475, TimeSpan.FromMinutes( 1.5 ) ) ) as RaisableItem;
RaisableItem door = TryCreateItem( 5524, 1367, 0, new RaisableItem( 0x1D0, 20, 0x477, 0x475, TimeSpan.FromMinutes( 5.0 ) ) ) as RaisableItem;
RaisableItem stone =
TryCreateItem(5403, 1360, 0, new RaisableItem(0x788, 10, 0x477, 0x475, TimeSpan.FromMinutes(1.5))) as
RaisableItem;
RaisableItem door =
TryCreateItem(5524, 1367, 0, new RaisableItem(0x1D0, 20, 0x477, 0x475, TimeSpan.FromMinutes(5.0))) as
RaisableItem;
sw.RaisableItem = stone;
lv.RaisableItem = door;
sw.RaisableItem = stone;
lv.RaisableItem = door;
e.Mobile.SendMessage($"{m_Count} dynamic Khaldun item{(m_Count == 1 ? "" : "s")} generated.");
}
}
}
e.Mobile.SendMessage($"{m_Count} dynamic Khaldun item{(m_Count == 1 ? "" : "s")} generated.");
}
}
}

View file

@ -1,90 +1,93 @@
using Server.Mobiles;
namespace Server.Items
{
public class KhaldunPitTeleporter : Item
{
[CommandProperty( AccessLevel.GameMaster )]
public bool Active { get; set; }
public class KhaldunPitTeleporter : Item
{
[Constructible]
public KhaldunPitTeleporter() : this(new Point3D(5451, 1374, 0), Map.Felucca)
{
}
[CommandProperty( AccessLevel.GameMaster )]
public Point3D PointDest { get; set; }
[Constructible]
public KhaldunPitTeleporter(Point3D pointDest, Map mapDest) : base(0x053B)
{
Movable = false;
Hue = 1;
[CommandProperty( AccessLevel.GameMaster )]
public Map MapDest { get; set; }
Active = true;
PointDest = pointDest;
MapDest = mapDest;
}
public override int LabelNumber => 1016511; // the floor of the cavern seems to have collapsed here - a faint light is visible at the bottom of the pit
public KhaldunPitTeleporter(Serial serial) : base(serial)
{
}
[Constructible]
public KhaldunPitTeleporter() : this( new Point3D( 5451, 1374, 0 ), Map.Felucca )
{
}
[CommandProperty(AccessLevel.GameMaster)]
public bool Active{ get; set; }
[Constructible]
public KhaldunPitTeleporter( Point3D pointDest, Map mapDest ) : base( 0x053B )
{
Movable = false;
Hue = 1;
[CommandProperty(AccessLevel.GameMaster)]
public Point3D PointDest{ get; set; }
Active = true;
PointDest = pointDest;
MapDest = mapDest;
}
[CommandProperty(AccessLevel.GameMaster)]
public Map MapDest{ get; set; }
public KhaldunPitTeleporter( Serial serial ) : base( serial )
{
}
public override int LabelNumber =>
1016511; // the floor of the cavern seems to have collapsed here - a faint light is visible at the bottom of the pit
public override void OnDoubleClick( Mobile m )
{
if ( !Active )
return;
public override void OnDoubleClick(Mobile m)
{
if (!Active)
return;
Map map = MapDest;
Map map = MapDest;
if ( map == null || map == Map.Internal )
map = m.Map;
if (map == null || map == Map.Internal)
map = m.Map;
Point3D p = PointDest;
Point3D p = PointDest;
if ( p == Point3D.Zero )
p = m.Location;
if (p == Point3D.Zero)
p = m.Location;
if ( m.InRange( this, 3 ) )
{
Mobiles.BaseCreature.TeleportPets( m, PointDest, MapDest );
if (m.InRange(this, 3))
{
BaseCreature.TeleportPets(m, PointDest, MapDest);
m.MoveToWorld( PointDest, MapDest );
}
else
{
m.SendLocalizedMessage( 1019045 ); // I can't reach that.
}
}
m.MoveToWorld(PointDest, MapDest);
}
else
{
m.SendLocalizedMessage(1019045); // I can't reach that.
}
}
public override void OnDoubleClickDead( Mobile m )
{
OnDoubleClick( m );
}
public override void OnDoubleClickDead(Mobile m)
{
OnDoubleClick(m);
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int)0 ); // version
writer.Write(0); // version
writer.Write( Active );
writer.Write( PointDest );
writer.Write( MapDest );
}
writer.Write(Active);
writer.Write(PointDest);
writer.Write(MapDest);
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
int version = reader.ReadInt();
Active = reader.ReadBool();
PointDest = reader.ReadPoint3D();
MapDest = reader.ReadMap();
}
}
}
Active = reader.ReadBool();
PointDest = reader.ReadPoint3D();
MapDest = reader.ReadMap();
}
}
}

View file

@ -2,129 +2,129 @@ using Server.Items;
namespace Server.Mobiles
{
public class GrimmochDrummel : BaseCreature
{
public override bool ClickTitle => false;
public override bool ShowFameTitle => false;
public override bool DeleteCorpseOnDeath => true;
public override string DefaultName => "Grimmoch Drummel";
public class GrimmochDrummel : BaseCreature
{
[Constructible]
public GrimmochDrummel() : base(AIType.AI_Archer, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Title = "the Cursed";
[Constructible]
public GrimmochDrummel() : base( AIType.AI_Archer, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
Title = "the Cursed";
Hue = 0x8596;
Body = 0x190;
Hue = 0x8596;
Body = 0x190;
HairItemID = 0x204A; //Krisna
HairItemID = 0x204A; //Krisna
Bow bow = new Bow();
bow.Movable = false;
AddItem(bow);
Bow bow = new Bow();
bow.Movable = false;
AddItem( bow );
AddItem(new Boots(0x8A4));
AddItem(new BodySash(0x8A4));
AddItem( new Boots( 0x8A4 ) );
AddItem( new BodySash( 0x8A4 ) );
Backpack backpack = new Backpack();
backpack.Movable = false;
AddItem(backpack);
Backpack backpack = new Backpack();
backpack.Movable = false;
AddItem( backpack );
LeatherGloves gloves = new LeatherGloves();
LeatherChest chest = new LeatherChest();
gloves.Hue = 0x96F;
chest.Hue = 0x96F;
LeatherGloves gloves = new LeatherGloves();
LeatherChest chest = new LeatherChest();
gloves.Hue = 0x96F;
chest.Hue = 0x96F;
AddItem(gloves);
AddItem(chest);
AddItem( gloves );
AddItem( chest );
SetStr(111, 120);
SetDex(151, 160);
SetInt(41, 50);
SetStr( 111, 120 );
SetDex( 151, 160 );
SetInt( 41, 50 );
SetHits(180, 207);
SetMana(0);
SetHits( 180, 207 );
SetMana( 0 );
SetDamage(13, 16);
SetDamage( 13, 16 );
SetResistance(ResistanceType.Physical, 35, 45);
SetResistance(ResistanceType.Fire, 25, 30);
SetResistance(ResistanceType.Cold, 45, 55);
SetResistance(ResistanceType.Poison, 30, 40);
SetResistance(ResistanceType.Energy, 20, 25);
SetResistance( ResistanceType.Physical, 35, 45 );
SetResistance( ResistanceType.Fire, 25, 30 );
SetResistance( ResistanceType.Cold, 45, 55 );
SetResistance( ResistanceType.Poison, 30, 40 );
SetResistance( ResistanceType.Energy, 20, 25 );
SetSkill(SkillName.Archery, 90.1, 110.0);
SetSkill(SkillName.Swords, 60.1, 70.0);
SetSkill(SkillName.Tactics, 90.1, 100.0);
SetSkill(SkillName.MagicResist, 60.1, 70.0);
SetSkill(SkillName.Anatomy, 90.1, 100.0);
SetSkill( SkillName.Archery, 90.1, 110.0 );
SetSkill( SkillName.Swords, 60.1, 70.0 );
SetSkill( SkillName.Tactics, 90.1, 100.0 );
SetSkill( SkillName.MagicResist, 60.1, 70.0 );
SetSkill( SkillName.Anatomy, 90.1, 100.0 );
Fame = 5000;
Karma = -1000;
Fame = 5000;
Karma = -1000;
PackItem(new Arrow(40));
PackItem( new Arrow( 40 ) );
if (3 > Utility.Random(100))
PackItem(new FireHorn());
if ( 3 > Utility.Random( 100 ) )
PackItem( new FireHorn() );
if (1 > Utility.Random(3))
PackItem(Loot.RandomGrimmochJournal());
}
if ( 1 > Utility.Random( 3 ) )
PackItem( Loot.RandomGrimmochJournal() );
}
public GrimmochDrummel(Serial serial) : base(serial)
{
}
public override int GetIdleSound()
{
return 0x178;
}
public override bool ClickTitle => false;
public override bool ShowFameTitle => false;
public override bool DeleteCorpseOnDeath => true;
public override string DefaultName => "Grimmoch Drummel";
public override int GetAngerSound()
{
return 0x1AC;
}
public override bool AlwaysMurderer => true;
public override int GetDeathSound()
{
return 0x27E;
}
public override int GetIdleSound()
{
return 0x178;
}
public override int GetHurtSound()
{
return 0x177;
}
public override int GetAngerSound()
{
return 0x1AC;
}
public override bool OnBeforeDeath()
{
Gold gold = new Gold( Utility.RandomMinMax( 190, 230 ) );
gold.MoveToWorld( Location, Map );
public override int GetDeathSound()
{
return 0x27E;
}
Container pack = Backpack;
if ( pack != null )
{
pack.Movable = true;
pack.MoveToWorld( Location, Map );
}
public override int GetHurtSound()
{
return 0x177;
}
Effects.SendLocationEffect( Location, Map, 0x376A, 10, 1 );
return true;
}
public override bool OnBeforeDeath()
{
Gold gold = new Gold(Utility.RandomMinMax(190, 230));
gold.MoveToWorld(Location, Map);
public override bool AlwaysMurderer => true;
Container pack = Backpack;
if (pack != null)
{
pack.Movable = true;
pack.MoveToWorld(Location, Map);
}
public GrimmochDrummel( Serial serial ) : base( serial )
{
}
Effects.SendLocationEffect(Location, Map, 0x376A, 10, 1);
return true;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int) 0 ); // version
}
writer.Write(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}
int version = reader.ReadInt();
}
}
}

View file

@ -2,129 +2,129 @@ using Server.Items;
namespace Server.Mobiles
{
public class LysanderGathenwale : BaseCreature
{
public override bool ClickTitle => false;
public override bool ShowFameTitle => false;
public override bool DeleteCorpseOnDeath => true;
public override string DefaultName => "Lysander Gatherwale";
public class LysanderGathenwale : BaseCreature
{
[Constructible]
public LysanderGathenwale() : base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Title = "the Cursed";
[Constructible]
public LysanderGathenwale() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
Title = "the Cursed";
Hue = 0x8838;
Body = 0x190;
Hue = 0x8838;
Body = 0x190;
AddItem(new Boots(0x599));
AddItem(new Cloak(0x96F));
AddItem( new Boots( 0x599 ) );
AddItem( new Cloak( 0x96F ) );
Spellbook spellbook = new Spellbook();
RingmailGloves gloves = new RingmailGloves();
StuddedChest chest = new StuddedChest();
PlateArms arms = new PlateArms();
Spellbook spellbook = new Spellbook();
RingmailGloves gloves = new RingmailGloves();
StuddedChest chest = new StuddedChest();
PlateArms arms = new PlateArms();
spellbook.Hue = 0x599;
gloves.Hue = 0x599;
chest.Hue = 0x96F;
arms.Hue = 0x599;
spellbook.Hue = 0x599;
gloves.Hue = 0x599;
chest.Hue = 0x96F;
arms.Hue = 0x599;
AddItem(spellbook);
AddItem(gloves);
AddItem(chest);
AddItem(arms);
AddItem( spellbook );
AddItem( gloves );
AddItem( chest );
AddItem( arms );
SetStr(111, 120);
SetDex(71, 80);
SetInt(121, 130);
SetStr( 111, 120 );
SetDex( 71, 80 );
SetInt( 121, 130 );
SetHits(180, 207);
SetMana(227, 265);
SetHits( 180, 207 );
SetMana( 227, 265 );
SetDamage(5, 13);
SetDamage( 5, 13 );
SetResistance(ResistanceType.Physical, 35, 45);
SetResistance(ResistanceType.Fire, 25, 30);
SetResistance(ResistanceType.Cold, 50, 60);
SetResistance(ResistanceType.Poison, 25, 35);
SetResistance(ResistanceType.Energy, 25, 35);
SetResistance( ResistanceType.Physical, 35, 45 );
SetResistance( ResistanceType.Fire, 25, 30 );
SetResistance( ResistanceType.Cold, 50, 60 );
SetResistance( ResistanceType.Poison, 25, 35 );
SetResistance( ResistanceType.Energy, 25, 35 );
SetSkill(SkillName.Wrestling, 80.1, 90.0);
SetSkill(SkillName.Tactics, 90.1, 100.0);
SetSkill(SkillName.MagicResist, 80.1, 90.0);
SetSkill(SkillName.Magery, 90.1, 100.0);
SetSkill(SkillName.EvalInt, 95.1, 100.0);
SetSkill(SkillName.Meditation, 90.1, 100.0);
SetSkill( SkillName.Wrestling, 80.1, 90.0 );
SetSkill( SkillName.Tactics, 90.1, 100.0 );
SetSkill( SkillName.MagicResist, 80.1, 90.0 );
SetSkill( SkillName.Magery, 90.1, 100.0 );
SetSkill( SkillName.EvalInt, 95.1, 100.0 );
SetSkill( SkillName.Meditation, 90.1, 100.0 );
Fame = 5000;
Karma = -10000;
Fame = 5000;
Karma = -10000;
Item reags = Loot.RandomReagent();
reags.Amount = 30;
PackItem(reags);
}
Item reags = Loot.RandomReagent();
reags.Amount = 30;
PackItem( reags );
}
public LysanderGathenwale(Serial serial) : base(serial)
{
}
public override int GetIdleSound()
{
return 0x1CE;
}
public override bool ClickTitle => false;
public override bool ShowFameTitle => false;
public override bool DeleteCorpseOnDeath => true;
public override string DefaultName => "Lysander Gatherwale";
public override int GetAngerSound()
{
return 0x1AC;
}
public override bool AlwaysMurderer => true;
public override int GetDeathSound()
{
return 0x182;
}
public override int GetIdleSound()
{
return 0x1CE;
}
public override int GetHurtSound()
{
return 0x28D;
}
public override int GetAngerSound()
{
return 0x1AC;
}
public override void GenerateLoot()
{
AddLoot( LootPack.MedScrolls, 2 );
}
public override int GetDeathSound()
{
return 0x182;
}
public override bool OnBeforeDeath()
{
if ( !base.OnBeforeDeath() )
return false;
public override int GetHurtSound()
{
return 0x28D;
}
Backpack?.Destroy();
public override void GenerateLoot()
{
AddLoot(LootPack.MedScrolls, 2);
}
if ( Utility.Random( 3 ) == 0 )
{
BaseBook notebook = Loot.RandomLysanderNotebook();
notebook.MoveToWorld( Location, Map );
}
public override bool OnBeforeDeath()
{
if (!base.OnBeforeDeath())
return false;
Effects.SendLocationEffect( Location, Map, 0x376A, 10, 1 );
return true;
}
Backpack?.Destroy();
public override bool AlwaysMurderer => true;
if (Utility.Random(3) == 0)
{
BaseBook notebook = Loot.RandomLysanderNotebook();
notebook.MoveToWorld(Location, Map);
}
public LysanderGathenwale( Serial serial ) : base( serial )
{
}
Effects.SendLocationEffect(Location, Map, 0x376A, 10, 1);
return true;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int) 0 ); // version
}
writer.Write(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}
int version = reader.ReadInt();
}
}
}

View file

@ -2,108 +2,109 @@ using Server.Items;
namespace Server.Mobiles
{
public class MorgBergen : BaseCreature
{
public override bool ShowFameTitle => false;
public override bool DeleteCorpseOnDeath => true;
public override string DefaultName => "Morg Bergen";
public class MorgBergen : BaseCreature
{
[Constructible]
public MorgBergen() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Title = "the Cursed";
[Constructible]
public MorgBergen() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
Title = "the Cursed";
Hue = 0x8596;
Body = 0x190;
Hue = 0x8596;
Body = 0x190;
AddItem(new ShortPants(0x59C));
AddItem( new ShortPants( 0x59C ) );
Bardiche bardiche = new Bardiche();
LeatherGloves gloves = new LeatherGloves();
LeatherArms arms = new LeatherArms();
Bardiche bardiche = new Bardiche();
LeatherGloves gloves = new LeatherGloves();
LeatherArms arms = new LeatherArms();
bardiche.Hue = 0x96F;
bardiche.Movable = false;
gloves.Hue = 0x96F;
arms.Hue = 0x96F;
bardiche.Hue = 0x96F; bardiche.Movable = false;
gloves.Hue = 0x96F;
arms.Hue = 0x96F;
AddItem(bardiche);
AddItem(gloves);
AddItem(arms);
AddItem( bardiche );
AddItem( gloves );
AddItem( arms );
SetStr(111, 120);
SetDex(111, 120);
SetInt(51, 60);
SetStr( 111, 120 );
SetDex( 111, 120 );
SetInt( 51, 60 );
SetHits(180, 207);
SetMana(0);
SetHits( 180, 207 );
SetMana( 0 );
SetDamage(9, 17);
SetDamage( 9, 17 );
SetDamageType(ResistanceType.Physical, 40);
SetDamageType(ResistanceType.Cold, 60);
SetDamageType( ResistanceType.Physical, 40 );
SetDamageType( ResistanceType.Cold, 60 );
SetResistance(ResistanceType.Physical, 35, 45);
SetResistance(ResistanceType.Fire, 25, 30);
SetResistance(ResistanceType.Cold, 50, 60);
SetResistance(ResistanceType.Poison, 25, 35);
SetResistance(ResistanceType.Energy, 25, 35);
SetResistance( ResistanceType.Physical, 35, 45 );
SetResistance( ResistanceType.Fire, 25, 30 );
SetResistance( ResistanceType.Cold, 50, 60 );
SetResistance( ResistanceType.Poison, 25, 35 );
SetResistance( ResistanceType.Energy, 25, 35 );
SetSkill(SkillName.Swords, 90.1, 100.0);
SetSkill(SkillName.Tactics, 90.1, 100.0);
SetSkill(SkillName.MagicResist, 80.1, 90.0);
SetSkill(SkillName.Anatomy, 90.1, 100.0);
SetSkill( SkillName.Swords, 90.1, 100.0 );
SetSkill( SkillName.Tactics, 90.1, 100.0 );
SetSkill( SkillName.MagicResist, 80.1, 90.0 );
SetSkill( SkillName.Anatomy, 90.1, 100.0 );
Fame = 5000;
Karma = -1000;
}
Fame = 5000;
Karma = -1000;
}
public MorgBergen(Serial serial) : base(serial)
{
}
public override int GetIdleSound()
{
return 0x1CE;
}
public override bool ShowFameTitle => false;
public override bool DeleteCorpseOnDeath => true;
public override string DefaultName => "Morg Bergen";
public override int GetAngerSound()
{
return 0x263;
}
public override bool AlwaysMurderer => true;
public override int GetDeathSound()
{
return 0x1D1;
}
public override int GetIdleSound()
{
return 0x1CE;
}
public override int GetHurtSound()
{
return 0x25E;
}
public override int GetAngerSound()
{
return 0x263;
}
public override bool OnBeforeDeath()
{
Gold gold = new Gold( Utility.RandomMinMax( 190, 230 ) );
gold.MoveToWorld( Location, Map );
public override int GetDeathSound()
{
return 0x1D1;
}
Effects.SendLocationEffect( Location, Map, 0x376A, 10, 1 );
return true;
}
public override int GetHurtSound()
{
return 0x25E;
}
public override bool AlwaysMurderer => true;
public override bool OnBeforeDeath()
{
Gold gold = new Gold(Utility.RandomMinMax(190, 230));
gold.MoveToWorld(Location, Map);
public MorgBergen( Serial serial ) : base( serial )
{
}
Effects.SendLocationEffect(Location, Map, 0x376A, 10, 1);
return true;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int) 0 ); // version
}
writer.Write(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}
int version = reader.ReadInt();
}
}
}

View file

@ -2,117 +2,119 @@ using Server.Items;
namespace Server.Mobiles
{
public class TavaraSewel : BaseCreature
{
public override bool ShowFameTitle => false;
public override bool DeleteCorpseOnDeath => true;
public override string DefaultName => "Tavara Sewel";
public class TavaraSewel : BaseCreature
{
[Constructible]
public TavaraSewel() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Title = "the Cursed";
[Constructible]
public TavaraSewel () : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
Title = "the Cursed";
Hue = 0x8838;
Female = true;
Body = 0x191;
Hue = 0x8838;
Female = true;
Body = 0x191;
AddItem(new Kilt(0x59C));
AddItem(new Sandals(0x599));
AddItem( new Kilt( 0x59C ) );
AddItem( new Sandals( 0x599 ) );
Kryss kryss = new Kryss();
Buckler buckler = new Buckler();
RingmailGloves gloves = new RingmailGloves();
FemalePlateChest chest = new FemalePlateChest();
Kryss kryss = new Kryss();
Buckler buckler = new Buckler();
RingmailGloves gloves = new RingmailGloves();
FemalePlateChest chest = new FemalePlateChest();
kryss.Hue = 0x96F;
kryss.Movable = false;
buckler.Hue = 0x96F;
buckler.Movable = false;
gloves.Hue = 0x599;
chest.Hue = 0x96F;
kryss.Hue = 0x96F; kryss.Movable = false;
buckler.Hue = 0x96F; buckler.Movable = false;
gloves.Hue = 0x599;
chest.Hue = 0x96F;
AddItem(kryss);
AddItem(buckler);
AddItem(gloves);
AddItem(chest);
AddItem( kryss );
AddItem( buckler );
AddItem( gloves );
AddItem( chest );
SetStr(111, 120);
SetDex(111, 120);
SetInt(111, 120);
SetStr( 111, 120 );
SetDex( 111, 120 );
SetInt( 111, 120 );
SetHits(180, 207);
SetStam(126, 150);
SetMana(0);
SetHits( 180, 207 );
SetStam( 126, 150 );
SetMana( 0 );
SetDamage(13, 16);
SetDamage( 13, 16 );
SetResistance(ResistanceType.Physical, 25, 30);
SetResistance(ResistanceType.Fire, 25, 30);
SetResistance(ResistanceType.Cold, 50, 60);
SetResistance(ResistanceType.Poison, 25, 35);
SetResistance(ResistanceType.Energy, 25, 35);
SetResistance( ResistanceType.Physical, 25, 30 );
SetResistance( ResistanceType.Fire, 25, 30 );
SetResistance( ResistanceType.Cold, 50, 60 );
SetResistance( ResistanceType.Poison, 25, 35 );
SetResistance( ResistanceType.Energy, 25, 35 );
SetSkill(SkillName.Fencing, 90.1, 100.0);
SetSkill(SkillName.Tactics, 90.1, 100.0);
SetSkill(SkillName.MagicResist, 80.1, 90.0);
SetSkill(SkillName.Anatomy, 90.1, 100.0);
SetSkill( SkillName.Fencing, 90.1, 100.0 );
SetSkill( SkillName.Tactics, 90.1, 100.0 );
SetSkill( SkillName.MagicResist, 80.1, 90.0 );
SetSkill( SkillName.Anatomy, 90.1, 100.0 );
Fame = 5000;
Karma = -1000;
}
Fame = 5000;
Karma = -1000;
}
public TavaraSewel(Serial serial) : base(serial)
{
}
public override int GetIdleSound()
{
return 0x27F;
}
public override bool ShowFameTitle => false;
public override bool DeleteCorpseOnDeath => true;
public override string DefaultName => "Tavara Sewel";
public override int GetAngerSound()
{
return 0x258;
}
public override bool AlwaysMurderer => true;
public override int GetDeathSound()
{
return 0x25B;
}
public override int GetIdleSound()
{
return 0x27F;
}
public override int GetHurtSound()
{
return 0x257;
}
public override int GetAngerSound()
{
return 0x258;
}
public override bool OnBeforeDeath()
{
Gold gold = new Gold( Utility.RandomMinMax( 190, 230 ) );
gold.MoveToWorld( Location, Map );
public override int GetDeathSound()
{
return 0x25B;
}
if ( Utility.Random( 3 ) == 0 )
{
BaseBook journal = Loot.RandomTavarasJournal();
journal.MoveToWorld( Location, Map );
}
public override int GetHurtSound()
{
return 0x257;
}
Effects.SendLocationEffect( Location, Map, 0x376A, 10, 1 );
return true;
}
public override bool OnBeforeDeath()
{
Gold gold = new Gold(Utility.RandomMinMax(190, 230));
gold.MoveToWorld(Location, Map);
public override bool AlwaysMurderer => true;
if (Utility.Random(3) == 0)
{
BaseBook journal = Loot.RandomTavarasJournal();
journal.MoveToWorld(Location, Map);
}
public TavaraSewel( Serial serial ) : base( serial )
{
}
Effects.SendLocationEffect(Location, Map, 0x376A, 10, 1);
return true;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int) 0 ); // version
}
writer.Write(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}
int version = reader.ReadInt();
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -2,169 +2,169 @@ using System;
namespace Server.Items
{
public class RaisableItem : Item
{
private int m_MaxElevation;
public class RaisableItem : Item
{
private int m_Elevation;
private int m_MaxElevation;
private RaiseTimer m_RaiseTimer;
[CommandProperty( AccessLevel.GameMaster )]
public int MaxElevation
{
get => m_MaxElevation;
set
{
if ( value <= 0 )
m_MaxElevation = 0;
else if ( value >= 60 )
m_MaxElevation = 60;
else
m_MaxElevation = value;
}
}
[Constructible]
public RaisableItem(int itemID) : this(itemID, 20, -1, -1, TimeSpan.FromMinutes(1.0))
{
}
[CommandProperty( AccessLevel.GameMaster )]
public int MoveSound { get; set; }
[Constructible]
public RaisableItem(int itemID, int maxElevation, TimeSpan closeDelay) : this(itemID, maxElevation, -1, -1,
closeDelay)
{
}
[CommandProperty( AccessLevel.GameMaster )]
public int StopSound { get; set; }
[Constructible]
public RaisableItem(int itemID, int maxElevation, int moveSound, int stopSound, TimeSpan closeDelay) : base(itemID)
{
Movable = false;
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan CloseDelay { get; set; }
m_MaxElevation = maxElevation;
MoveSound = moveSound;
StopSound = stopSound;
CloseDelay = closeDelay;
}
[Constructible]
public RaisableItem( int itemID ) : this( itemID, 20, -1, -1, TimeSpan.FromMinutes( 1.0 ) )
{
}
public RaisableItem(Serial serial) : base(serial)
{
}
[Constructible]
public RaisableItem( int itemID, int maxElevation, TimeSpan closeDelay ) : this( itemID, maxElevation, -1, -1, closeDelay )
{
}
[CommandProperty(AccessLevel.GameMaster)]
public int MaxElevation
{
get => m_MaxElevation;
set
{
if (value <= 0)
m_MaxElevation = 0;
else if (value >= 60)
m_MaxElevation = 60;
else
m_MaxElevation = value;
}
}
[Constructible]
public RaisableItem( int itemID, int maxElevation, int moveSound, int stopSound, TimeSpan closeDelay ) : base( itemID )
{
Movable = false;
[CommandProperty(AccessLevel.GameMaster)]
public int MoveSound{ get; set; }
m_MaxElevation = maxElevation;
MoveSound = moveSound;
StopSound = stopSound;
CloseDelay = closeDelay;
}
[CommandProperty(AccessLevel.GameMaster)]
public int StopSound{ get; set; }
private int m_Elevation;
private RaiseTimer m_RaiseTimer;
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan CloseDelay{ get; set; }
public bool IsRaisable => m_RaiseTimer == null;
public bool IsRaisable => m_RaiseTimer == null;
public void Raise()
{
if ( !IsRaisable )
return;
public void Raise()
{
if (!IsRaisable)
return;
m_RaiseTimer = new RaiseTimer( this );
m_RaiseTimer.Start();
}
m_RaiseTimer = new RaiseTimer(this);
m_RaiseTimer.Start();
}
private class RaiseTimer : Timer
{
private RaisableItem m_Item;
private DateTime m_CloseTime;
private bool m_Up;
private int m_Step;
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
public RaiseTimer( RaisableItem item ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 0.5 ) )
{
m_Item = item;
m_CloseTime = DateTime.UtcNow + item.CloseDelay;
m_Up = true;
writer.WriteEncodedInt(0); // version
Priority = TimerPriority.TenMS;
}
writer.WriteEncodedInt(m_MaxElevation);
writer.WriteEncodedInt(MoveSound);
writer.WriteEncodedInt(StopSound);
writer.Write(CloseDelay);
protected override void OnTick()
{
if ( m_Item.Deleted )
{
Stop();
return;
}
writer.WriteEncodedInt(m_Elevation);
}
if ( m_Step++ % 3 == 0 )
{
if ( m_Up )
{
m_Item.Z++;
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
if ( ++m_Item.m_Elevation >= m_Item.MaxElevation )
{
Stop();
int version = reader.ReadEncodedInt();
if ( m_Item.StopSound >= 0 )
Effects.PlaySound( m_Item.Location, m_Item.Map, m_Item.StopSound );
m_MaxElevation = reader.ReadEncodedInt();
MoveSound = reader.ReadEncodedInt();
StopSound = reader.ReadEncodedInt();
CloseDelay = reader.ReadTimeSpan();
m_Up = false;
m_Step = 0;
int elevation = reader.ReadEncodedInt();
Z -= elevation;
}
TimeSpan delay = m_CloseTime - DateTime.UtcNow;
DelayCall( delay > TimeSpan.Zero ? delay : TimeSpan.Zero, Start );
private class RaiseTimer : Timer
{
private DateTime m_CloseTime;
private RaisableItem m_Item;
private int m_Step;
private bool m_Up;
return;
}
}
else
{
m_Item.Z--;
public RaiseTimer(RaisableItem item) : base(TimeSpan.Zero, TimeSpan.FromSeconds(0.5))
{
m_Item = item;
m_CloseTime = DateTime.UtcNow + item.CloseDelay;
m_Up = true;
if ( --m_Item.m_Elevation <= 0 )
{
Stop();
Priority = TimerPriority.TenMS;
}
if ( m_Item.StopSound >= 0 )
Effects.PlaySound( m_Item.Location, m_Item.Map, m_Item.StopSound );
protected override void OnTick()
{
if (m_Item.Deleted)
{
Stop();
return;
}
m_Item.m_RaiseTimer = null;
if (m_Step++ % 3 == 0)
{
if (m_Up)
{
m_Item.Z++;
return;
}
}
}
if (++m_Item.m_Elevation >= m_Item.MaxElevation)
{
Stop();
if ( m_Item.MoveSound >= 0 )
Effects.PlaySound( m_Item.Location, m_Item.Map, m_Item.MoveSound );
}
}
if (m_Item.StopSound >= 0)
Effects.PlaySound(m_Item.Location, m_Item.Map, m_Item.StopSound);
public RaisableItem( Serial serial ) : base( serial )
{
}
m_Up = false;
m_Step = 0;
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
TimeSpan delay = m_CloseTime - DateTime.UtcNow;
DelayCall(delay > TimeSpan.Zero ? delay : TimeSpan.Zero, Start);
writer.WriteEncodedInt( (int) 0 ); // version
return;
}
}
else
{
m_Item.Z--;
writer.WriteEncodedInt( (int) m_MaxElevation );
writer.WriteEncodedInt( (int) MoveSound );
writer.WriteEncodedInt( (int) StopSound );
writer.Write( (TimeSpan) CloseDelay );
if (--m_Item.m_Elevation <= 0)
{
Stop();
writer.WriteEncodedInt( (int) m_Elevation );
}
if (m_Item.StopSound >= 0)
Effects.PlaySound(m_Item.Location, m_Item.Map, m_Item.StopSound);
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
m_Item.m_RaiseTimer = null;
int version = reader.ReadEncodedInt();
return;
}
}
}
m_MaxElevation = reader.ReadEncodedInt();
MoveSound = reader.ReadEncodedInt();
StopSound = reader.ReadEncodedInt();
CloseDelay = reader.ReadTimeSpan();
int elevation = reader.ReadEncodedInt();
Z -= elevation;
}
}
if (m_Item.MoveSound >= 0)
Effects.PlaySound(m_Item.Location, m_Item.Map, m_Item.MoveSound);
}
}
}
}

View file

@ -3,214 +3,216 @@ using Server.Network;
namespace Server.Items
{
public class RaiseSwitch : Item
{
[CommandProperty( AccessLevel.GameMaster )]
public RaisableItem RaisableItem { get; set; }
public class RaiseSwitch : Item
{
private ResetTimer m_ResetTimer;
[Constructible]
public RaiseSwitch() : this( 0x1093 )
{
}
[Constructible]
public RaiseSwitch() : this(0x1093)
{
}
protected RaiseSwitch( int itemID ) : base( itemID )
{
Movable = false;
}
protected RaiseSwitch(int itemID) : base(itemID)
{
Movable = false;
}
public override void OnDoubleClick( Mobile m )
{
if ( !m.InRange( this, 2 ) )
{
m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
return;
}
public RaiseSwitch(Serial serial) : base(serial)
{
}
if ( RaisableItem != null && RaisableItem.Deleted )
RaisableItem = null;
[CommandProperty(AccessLevel.GameMaster)]
public RaisableItem RaisableItem{ get; set; }
Flip();
public override void OnDoubleClick(Mobile m)
{
if (!m.InRange(this, 2))
{
m.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
}
if ( RaisableItem != null )
{
if ( RaisableItem.IsRaisable )
{
RaisableItem.Raise();
m.LocalOverheadMessage( MessageType.Regular, 0x5A, true, "You hear a grinding noise echoing in the distance." );
}
else
{
m.LocalOverheadMessage( MessageType.Regular, 0x5A, true, "You flip the switch again, but nothing happens." );
}
}
}
if (RaisableItem != null && RaisableItem.Deleted)
RaisableItem = null;
protected virtual void Flip()
{
if ( ItemID != 0x1093 )
{
ItemID = 0x1093;
Flip();
StopResetTimer();
}
else
{
ItemID = 0x1095;
if (RaisableItem != null)
{
if (RaisableItem.IsRaisable)
{
RaisableItem.Raise();
m.LocalOverheadMessage(MessageType.Regular, 0x5A, true,
"You hear a grinding noise echoing in the distance.");
}
else
{
m.LocalOverheadMessage(MessageType.Regular, 0x5A, true,
"You flip the switch again, but nothing happens.");
}
}
}
if ( RaisableItem != null && RaisableItem.CloseDelay >= TimeSpan.Zero )
StartResetTimer( RaisableItem.CloseDelay );
else
StartResetTimer( TimeSpan.FromMinutes( 2.0 ) );
}
protected virtual void Flip()
{
if (ItemID != 0x1093)
{
ItemID = 0x1093;
Effects.PlaySound( Location, Map, 0x3E8 );
}
StopResetTimer();
}
else
{
ItemID = 0x1095;
private ResetTimer m_ResetTimer;
if (RaisableItem != null && RaisableItem.CloseDelay >= TimeSpan.Zero)
StartResetTimer(RaisableItem.CloseDelay);
else
StartResetTimer(TimeSpan.FromMinutes(2.0));
}
protected void StartResetTimer( TimeSpan delay )
{
StopResetTimer();
Effects.PlaySound(Location, Map, 0x3E8);
}
m_ResetTimer = new ResetTimer( this, delay );
m_ResetTimer.Start();
}
protected void StartResetTimer(TimeSpan delay)
{
StopResetTimer();
protected void StopResetTimer()
{
if ( m_ResetTimer != null )
{
m_ResetTimer.Stop();
m_ResetTimer = null;
}
}
m_ResetTimer = new ResetTimer(this, delay);
m_ResetTimer.Start();
}
protected virtual void Reset()
{
if ( ItemID != 0x1093 )
Flip();
}
protected void StopResetTimer()
{
if (m_ResetTimer != null)
{
m_ResetTimer.Stop();
m_ResetTimer = null;
}
}
private class ResetTimer : Timer
{
private RaiseSwitch m_RaiseSwitch;
protected virtual void Reset()
{
if (ItemID != 0x1093)
Flip();
}
public ResetTimer( RaiseSwitch raiseSwitch, TimeSpan delay ) : base( delay )
{
m_RaiseSwitch = raiseSwitch;
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
Priority = ComputePriority( delay );
}
writer.WriteEncodedInt(0); // version
protected override void OnTick()
{
if ( m_RaiseSwitch.Deleted )
return;
writer.Write(RaisableItem);
}
m_RaiseSwitch.m_ResetTimer = null;
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
m_RaiseSwitch.Reset();
}
}
int version = reader.ReadEncodedInt();
public RaiseSwitch( Serial serial ) : base( serial )
{
}
RaisableItem = (RaisableItem)reader.ReadItem();
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
Reset();
}
writer.WriteEncodedInt( (int) 0 ); // version
private class ResetTimer : Timer
{
private RaiseSwitch m_RaiseSwitch;
writer.Write( (Item) RaisableItem );
}
public ResetTimer(RaiseSwitch raiseSwitch, TimeSpan delay) : base(delay)
{
m_RaiseSwitch = raiseSwitch;
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
Priority = ComputePriority(delay);
}
int version = reader.ReadEncodedInt();
protected override void OnTick()
{
if (m_RaiseSwitch.Deleted)
return;
RaisableItem = (RaisableItem) reader.ReadItem();
m_RaiseSwitch.m_ResetTimer = null;
Reset();
}
}
m_RaiseSwitch.Reset();
}
}
}
public class DisappearingRaiseSwitch : RaiseSwitch
{
public int CurrentRange => Visible ? 3 : 2;
public class DisappearingRaiseSwitch : RaiseSwitch
{
[Constructible]
public DisappearingRaiseSwitch() : base(0x108F)
{
}
[Constructible]
public DisappearingRaiseSwitch() : base( 0x108F )
{
}
public DisappearingRaiseSwitch(Serial serial) : base(serial)
{
}
protected override void Flip()
{
}
public int CurrentRange => Visible ? 3 : 2;
protected override void Reset()
{
}
public override bool HandlesOnMovement => true;
public override bool HandlesOnMovement => true;
protected override void Flip()
{
}
public override void OnMovement( Mobile m, Point3D oldLocation )
{
if ( Utility.InRange( m.Location, Location, CurrentRange ) || Utility.InRange( oldLocation, Location, CurrentRange ) )
Refresh();
}
protected override void Reset()
{
}
public override void OnMapChange()
{
if ( !Deleted )
Refresh();
}
public override void OnMovement(Mobile m, Point3D oldLocation)
{
if (Utility.InRange(m.Location, Location, CurrentRange) || Utility.InRange(oldLocation, Location, CurrentRange))
Refresh();
}
public override void OnLocationChange( Point3D oldLoc )
{
if ( !Deleted )
Refresh();
}
public override void OnMapChange()
{
if (!Deleted)
Refresh();
}
public void Refresh()
{
bool found = false;
foreach ( Mobile mob in GetMobilesInRange( CurrentRange ) )
{
if ( mob.Hidden && mob.AccessLevel > AccessLevel.Player )
continue;
public override void OnLocationChange(Point3D oldLoc)
{
if (!Deleted)
Refresh();
}
found = true;
break;
}
public void Refresh()
{
bool found = false;
foreach (Mobile mob in GetMobilesInRange(CurrentRange))
{
if (mob.Hidden && mob.AccessLevel > AccessLevel.Player)
continue;
Visible = found;
}
found = true;
break;
}
public DisappearingRaiseSwitch( Serial serial ) : base( serial )
{
}
Visible = found;
}
public override void Serialize( GenericWriter writer )
{
if ( RaisableItem != null && RaisableItem.Deleted )
RaisableItem = null;
public override void Serialize(GenericWriter writer)
{
if (RaisableItem != null && RaisableItem.Deleted)
RaisableItem = null;
base.Serialize( writer );
base.Serialize(writer);
writer.WriteEncodedInt( (int) 0 ); // version
}
writer.WriteEncodedInt(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
int version = reader.ReadEncodedInt();
Timer.DelayCall( TimeSpan.Zero, Refresh );
}
}
}
Timer.DelayCall(TimeSpan.Zero, Refresh);
}
}
}