Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -2,115 +2,115 @@ using System;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TreasureChestLevel1 : LockableContainer
|
||||
{
|
||||
private const int m_Level = 1;
|
||||
public class TreasureChestLevel1 : LockableContainer
|
||||
{
|
||||
private const int m_Level = 1;
|
||||
|
||||
public override bool Decays => true;
|
||||
[Constructible]
|
||||
public TreasureChestLevel1()
|
||||
: base(0xE41)
|
||||
{
|
||||
SetChestAppearance();
|
||||
Movable = false;
|
||||
|
||||
public override bool IsDecoContainer => false;
|
||||
TrapType = TrapType.DartTrap;
|
||||
TrapPower = m_Level * Utility.Random(1, 25);
|
||||
Locked = true;
|
||||
|
||||
public override TimeSpan DecayTime => TimeSpan.FromMinutes( Utility.Random( 15, 60 ) );
|
||||
RequiredSkill = 57;
|
||||
LockLevel = RequiredSkill - Utility.Random(1, 10);
|
||||
MaxLockLevel = RequiredSkill + Utility.Random(1, 10);
|
||||
|
||||
private void SetChestAppearance()
|
||||
{
|
||||
bool UseFirstItemId = Utility.RandomBool();
|
||||
// According to OSI, loot in level 1 chest is:
|
||||
// Gold 25 - 50
|
||||
// Bolts 10
|
||||
// Gems
|
||||
// Normal weapon
|
||||
// Normal armour
|
||||
// Normal clothing
|
||||
// Normal jewelry
|
||||
|
||||
switch( Utility.RandomList( 0, 1, 2 ) )
|
||||
{
|
||||
case 0:// Large Crate
|
||||
ItemID = ( UseFirstItemId ? 0xe3c : 0xe3d );
|
||||
GumpID = 0x44;
|
||||
break;
|
||||
// Gold
|
||||
DropItem(new Gold(Utility.Random(30, 100)));
|
||||
|
||||
case 1:// Medium Crate
|
||||
ItemID = ( UseFirstItemId ? 0xe3e : 0xe3f );
|
||||
GumpID = 0x44;
|
||||
break;
|
||||
// Drop bolts
|
||||
//DropItem( new Bolt( 10 ) );
|
||||
|
||||
case 2:// Small Crate
|
||||
ItemID = ( UseFirstItemId ? 0x9a9 : 0xe7e );
|
||||
GumpID = 0x44;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Gems
|
||||
if (Utility.RandomBool())
|
||||
{
|
||||
Item GemLoot = Loot.RandomGem();
|
||||
GemLoot.Amount = Utility.Random(1, 3);
|
||||
DropItem(GemLoot);
|
||||
}
|
||||
|
||||
public override int DefaultGumpID => 0x42;
|
||||
// Weapon
|
||||
if (Utility.RandomBool())
|
||||
DropItem(Loot.RandomWeapon());
|
||||
|
||||
public override int DefaultDropSound => 0x42;
|
||||
// Armour
|
||||
if (Utility.RandomBool())
|
||||
DropItem(Loot.RandomArmorOrShield());
|
||||
|
||||
public override Rectangle2D Bounds => new Rectangle2D( 18, 105, 144, 73 );
|
||||
// Clothing
|
||||
if (Utility.RandomBool())
|
||||
DropItem(Loot.RandomClothing());
|
||||
|
||||
[Constructible]
|
||||
public TreasureChestLevel1()
|
||||
: base( 0xE41 )
|
||||
{
|
||||
SetChestAppearance();
|
||||
Movable = false;
|
||||
// Jewelry
|
||||
if (Utility.RandomBool())
|
||||
DropItem(Loot.RandomJewelry());
|
||||
}
|
||||
|
||||
TrapType = TrapType.DartTrap;
|
||||
TrapPower = m_Level * Utility.Random( 1, 25 );
|
||||
Locked = true;
|
||||
public TreasureChestLevel1(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
RequiredSkill = 57;
|
||||
LockLevel = RequiredSkill - Utility.Random( 1, 10 );
|
||||
MaxLockLevel = RequiredSkill + Utility.Random( 1, 10 );
|
||||
public override bool Decays => true;
|
||||
|
||||
// According to OSI, loot in level 1 chest is:
|
||||
// Gold 25 - 50
|
||||
// Bolts 10
|
||||
// Gems
|
||||
// Normal weapon
|
||||
// Normal armour
|
||||
// Normal clothing
|
||||
// Normal jewelry
|
||||
public override bool IsDecoContainer => false;
|
||||
|
||||
// Gold
|
||||
DropItem( new Gold( Utility.Random( 30, 100 ) ) );
|
||||
public override TimeSpan DecayTime => TimeSpan.FromMinutes(Utility.Random(15, 60));
|
||||
|
||||
// Drop bolts
|
||||
//DropItem( new Bolt( 10 ) );
|
||||
public override int DefaultGumpID => 0x42;
|
||||
|
||||
// Gems
|
||||
if ( Utility.RandomBool() == true )
|
||||
{
|
||||
Item GemLoot = Loot.RandomGem();
|
||||
GemLoot.Amount = Utility.Random( 1, 3 );
|
||||
DropItem( GemLoot );
|
||||
}
|
||||
public override int DefaultDropSound => 0x42;
|
||||
|
||||
// Weapon
|
||||
if ( Utility.RandomBool() == true )
|
||||
DropItem( Loot.RandomWeapon() );
|
||||
public override Rectangle2D Bounds => new Rectangle2D(18, 105, 144, 73);
|
||||
|
||||
// Armour
|
||||
if ( Utility.RandomBool() == true )
|
||||
DropItem( Loot.RandomArmorOrShield() );
|
||||
private void SetChestAppearance()
|
||||
{
|
||||
bool UseFirstItemId = Utility.RandomBool();
|
||||
|
||||
// Clothing
|
||||
if ( Utility.RandomBool() == true )
|
||||
DropItem( Loot.RandomClothing() );
|
||||
switch (Utility.RandomList(0, 1, 2))
|
||||
{
|
||||
case 0: // Large Crate
|
||||
ItemID = UseFirstItemId ? 0xe3c : 0xe3d;
|
||||
GumpID = 0x44;
|
||||
break;
|
||||
|
||||
// Jewelry
|
||||
if ( Utility.RandomBool() == true )
|
||||
DropItem( Loot.RandomJewelry() );
|
||||
}
|
||||
case 1: // Medium Crate
|
||||
ItemID = UseFirstItemId ? 0xe3e : 0xe3f;
|
||||
GumpID = 0x44;
|
||||
break;
|
||||
|
||||
public TreasureChestLevel1( Serial serial )
|
||||
: base( serial )
|
||||
{
|
||||
}
|
||||
case 2: // Small Crate
|
||||
ItemID = UseFirstItemId ? 0x9a9 : 0xe7e;
|
||||
GumpID = 0x44;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( ( int )1 ); // version
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(1); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,146 +2,147 @@ using System;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TreasureChestLevel2 : LockableContainer
|
||||
{
|
||||
private const int m_Level = 2;
|
||||
public class TreasureChestLevel2 : LockableContainer
|
||||
{
|
||||
private const int m_Level = 2;
|
||||
|
||||
public override bool Decays => true;
|
||||
[Constructible]
|
||||
public TreasureChestLevel2()
|
||||
: base(0xE41)
|
||||
{
|
||||
SetChestAppearance();
|
||||
Movable = false;
|
||||
|
||||
public override bool IsDecoContainer => false;
|
||||
TrapType = TrapType.ExplosionTrap;
|
||||
TrapPower = m_Level * Utility.Random(1, 25);
|
||||
Locked = true;
|
||||
|
||||
public override TimeSpan DecayTime => TimeSpan.FromMinutes( Utility.Random( 15, 60 ) );
|
||||
RequiredSkill = 72;
|
||||
LockLevel = RequiredSkill - Utility.Random(1, 10);
|
||||
MaxLockLevel = RequiredSkill + Utility.Random(1, 10);
|
||||
;
|
||||
|
||||
private void SetChestAppearance()
|
||||
{
|
||||
bool UseFirstItemId = Utility.RandomBool();
|
||||
// According to OSI, loot in level 2 chest is:
|
||||
// Gold 80 - 150
|
||||
// Arrows 10
|
||||
// Reagents
|
||||
// Scrolls
|
||||
// Potions
|
||||
// Gems
|
||||
|
||||
switch( Utility.RandomList( 0, 1, 2, 3, 4, 5, 6, 7 ) )
|
||||
{
|
||||
case 0:// Large Crate
|
||||
ItemID = ( UseFirstItemId ? 0xe3c : 0xe3d );
|
||||
GumpID = 0x44;
|
||||
break;
|
||||
// Gold
|
||||
DropItem(new Gold(Utility.Random(70, 100)));
|
||||
|
||||
case 1:// Medium Crate
|
||||
ItemID = ( UseFirstItemId ? 0xe3e : 0xe3f );
|
||||
GumpID = 0x44;
|
||||
break;
|
||||
// Drop bolts
|
||||
//DropItem( new Arrow( 10 ) );
|
||||
|
||||
case 2:// Small Crate
|
||||
ItemID = ( UseFirstItemId ? 0x9a9 : 0xe7e );
|
||||
GumpID = 0x44;
|
||||
break;
|
||||
// Reagents
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
{
|
||||
Item ReagentLoot = Loot.RandomReagent();
|
||||
ReagentLoot.Amount = Utility.Random(1, m_Level);
|
||||
DropItem(ReagentLoot);
|
||||
}
|
||||
|
||||
case 3:// Wooden Chest
|
||||
ItemID = ( UseFirstItemId ? 0xe42 : 0xe43 );
|
||||
GumpID = 0x49;
|
||||
break;
|
||||
// Scrolls
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
{
|
||||
Item ScrollLoot = Loot.RandomScroll(0, 39, SpellbookType.Regular);
|
||||
ScrollLoot.Amount = Utility.Random(1, 8);
|
||||
DropItem(ScrollLoot);
|
||||
}
|
||||
|
||||
case 4:// Metal Chest
|
||||
ItemID = ( UseFirstItemId ? 0x9ab : 0xe7c );
|
||||
GumpID = 0x4A;
|
||||
break;
|
||||
// Potions
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
{
|
||||
Item PotionLoot = Loot.RandomPotion();
|
||||
DropItem(PotionLoot);
|
||||
}
|
||||
|
||||
case 5:// Metal Golden Chest
|
||||
ItemID = ( UseFirstItemId ? 0xe40 : 0xe41 );
|
||||
GumpID = 0x42;
|
||||
break;
|
||||
// Gems
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
{
|
||||
Item GemLoot = Loot.RandomGem();
|
||||
GemLoot.Amount = Utility.Random(1, 6);
|
||||
DropItem(GemLoot);
|
||||
}
|
||||
}
|
||||
|
||||
case 6:// Keg
|
||||
ItemID = ( UseFirstItemId ? 0xe7f : 0xe7f );
|
||||
GumpID = 0x3e;
|
||||
break;
|
||||
public TreasureChestLevel2(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
case 7:// Barrel
|
||||
ItemID = ( UseFirstItemId ? 0xe77 : 0xe77 );
|
||||
GumpID = 0x3e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
public override bool Decays => true;
|
||||
|
||||
public override int DefaultGumpID => 0x42;
|
||||
public override bool IsDecoContainer => false;
|
||||
|
||||
public override int DefaultDropSound => 0x42;
|
||||
public override TimeSpan DecayTime => TimeSpan.FromMinutes(Utility.Random(15, 60));
|
||||
|
||||
public override Rectangle2D Bounds => new Rectangle2D( 18, 105, 144, 73 );
|
||||
public override int DefaultGumpID => 0x42;
|
||||
|
||||
[Constructible]
|
||||
public TreasureChestLevel2()
|
||||
: base( 0xE41 )
|
||||
{
|
||||
SetChestAppearance();
|
||||
Movable = false;
|
||||
public override int DefaultDropSound => 0x42;
|
||||
|
||||
TrapType = TrapType.ExplosionTrap;
|
||||
TrapPower = m_Level * Utility.Random( 1, 25 );
|
||||
Locked = true;
|
||||
public override Rectangle2D Bounds => new Rectangle2D(18, 105, 144, 73);
|
||||
|
||||
RequiredSkill = 72;
|
||||
LockLevel = RequiredSkill - Utility.Random( 1, 10 );
|
||||
MaxLockLevel = RequiredSkill + Utility.Random( 1, 10 ); ;
|
||||
private void SetChestAppearance()
|
||||
{
|
||||
bool UseFirstItemId = Utility.RandomBool();
|
||||
|
||||
// According to OSI, loot in level 2 chest is:
|
||||
// Gold 80 - 150
|
||||
// Arrows 10
|
||||
// Reagents
|
||||
// Scrolls
|
||||
// Potions
|
||||
// Gems
|
||||
switch (Utility.RandomList(0, 1, 2, 3, 4, 5, 6, 7))
|
||||
{
|
||||
case 0: // Large Crate
|
||||
ItemID = UseFirstItemId ? 0xe3c : 0xe3d;
|
||||
GumpID = 0x44;
|
||||
break;
|
||||
|
||||
// Gold
|
||||
DropItem( new Gold( Utility.Random( 70, 100 ) ) );
|
||||
case 1: // Medium Crate
|
||||
ItemID = UseFirstItemId ? 0xe3e : 0xe3f;
|
||||
GumpID = 0x44;
|
||||
break;
|
||||
|
||||
// Drop bolts
|
||||
//DropItem( new Arrow( 10 ) );
|
||||
case 2: // Small Crate
|
||||
ItemID = UseFirstItemId ? 0x9a9 : 0xe7e;
|
||||
GumpID = 0x44;
|
||||
break;
|
||||
|
||||
// Reagents
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
{
|
||||
Item ReagentLoot = Loot.RandomReagent();
|
||||
ReagentLoot.Amount = Utility.Random( 1, m_Level );
|
||||
DropItem( ReagentLoot );
|
||||
}
|
||||
case 3: // Wooden Chest
|
||||
ItemID = UseFirstItemId ? 0xe42 : 0xe43;
|
||||
GumpID = 0x49;
|
||||
break;
|
||||
|
||||
// Scrolls
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
{
|
||||
Item ScrollLoot = Loot.RandomScroll( 0, 39, SpellbookType.Regular );
|
||||
ScrollLoot.Amount = Utility.Random( 1, 8 );
|
||||
DropItem( ScrollLoot );
|
||||
}
|
||||
case 4: // Metal Chest
|
||||
ItemID = UseFirstItemId ? 0x9ab : 0xe7c;
|
||||
GumpID = 0x4A;
|
||||
break;
|
||||
|
||||
// Potions
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
{
|
||||
Item PotionLoot = Loot.RandomPotion();
|
||||
DropItem( PotionLoot );
|
||||
}
|
||||
case 5: // Metal Golden Chest
|
||||
ItemID = UseFirstItemId ? 0xe40 : 0xe41;
|
||||
GumpID = 0x42;
|
||||
break;
|
||||
|
||||
// Gems
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
{
|
||||
Item GemLoot = Loot.RandomGem();
|
||||
GemLoot.Amount = Utility.Random( 1, 6 );
|
||||
DropItem( GemLoot );
|
||||
}
|
||||
}
|
||||
case 6: // Keg
|
||||
ItemID = UseFirstItemId ? 0xe7f : 0xe7f;
|
||||
GumpID = 0x3e;
|
||||
break;
|
||||
|
||||
public TreasureChestLevel2( Serial serial )
|
||||
: base( serial )
|
||||
{
|
||||
}
|
||||
case 7: // Barrel
|
||||
ItemID = UseFirstItemId ? 0xe77 : 0xe77;
|
||||
GumpID = 0x3e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( ( int )1 ); // version
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(1); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,159 +2,160 @@ using System;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TreasureChestLevel3 : LockableContainer
|
||||
{
|
||||
private const int m_Level = 3;
|
||||
public class TreasureChestLevel3 : LockableContainer
|
||||
{
|
||||
private const int m_Level = 3;
|
||||
|
||||
public override bool Decays => true;
|
||||
[Constructible]
|
||||
public TreasureChestLevel3()
|
||||
: base(0xE41)
|
||||
{
|
||||
SetChestAppearance();
|
||||
Movable = false;
|
||||
|
||||
public override bool IsDecoContainer => false;
|
||||
TrapType = TrapType.PoisonTrap;
|
||||
TrapPower = m_Level * Utility.Random(1, 25);
|
||||
Locked = true;
|
||||
|
||||
public override TimeSpan DecayTime => TimeSpan.FromMinutes( Utility.Random( 15, 60 ) );
|
||||
RequiredSkill = 84;
|
||||
LockLevel = RequiredSkill - Utility.Random(1, 10);
|
||||
MaxLockLevel = RequiredSkill + Utility.Random(1, 10);
|
||||
;
|
||||
|
||||
private void SetChestAppearance()
|
||||
{
|
||||
bool UseFirstItemId = Utility.RandomBool();
|
||||
switch( Utility.RandomList( 0, 1, 2 ) )
|
||||
{
|
||||
case 0:// Wooden Chest
|
||||
ItemID = ( UseFirstItemId ? 0xe42 : 0xe43 );
|
||||
GumpID = 0x49;
|
||||
break;
|
||||
// According to OSI, loot in level 3 chest is:
|
||||
// Gold 250 - 350
|
||||
// Arrows 10
|
||||
// Reagents
|
||||
// Scrolls
|
||||
// Potions
|
||||
// Gems
|
||||
// Magic Wand
|
||||
// Magic weapon
|
||||
// Magic armour
|
||||
// Magic clothing (not implemented)
|
||||
// Magic jewelry (not implemented)
|
||||
|
||||
case 1:// Metal Chest
|
||||
ItemID = ( UseFirstItemId ? 0x9ab : 0xe7c );
|
||||
GumpID = 0x4A;
|
||||
break;
|
||||
// Gold
|
||||
DropItem(new Gold(Utility.Random(180, 240)));
|
||||
|
||||
case 2:// Metal Golden Chest
|
||||
ItemID = ( UseFirstItemId ? 0xe40 : 0xe41 );
|
||||
GumpID = 0x42;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Drop bolts
|
||||
//DropItem( new Arrow( 10 ) );
|
||||
|
||||
public override int DefaultGumpID => 0x42;
|
||||
// Reagents
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
{
|
||||
Item ReagentLoot = Loot.RandomReagent();
|
||||
ReagentLoot.Amount = Utility.Random(1, 9);
|
||||
DropItem(ReagentLoot);
|
||||
}
|
||||
|
||||
public override int DefaultDropSound => 0x42;
|
||||
// Scrolls
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
{
|
||||
Item ScrollLoot = Loot.RandomScroll(0, 47, SpellbookType.Regular);
|
||||
ScrollLoot.Amount = Utility.Random(1, 12);
|
||||
DropItem(ScrollLoot);
|
||||
}
|
||||
|
||||
public override Rectangle2D Bounds => new Rectangle2D( 18, 105, 144, 73 );
|
||||
// Potions
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
{
|
||||
Item PotionLoot = Loot.RandomPotion();
|
||||
DropItem(PotionLoot);
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public TreasureChestLevel3()
|
||||
: base( 0xE41 )
|
||||
{
|
||||
SetChestAppearance();
|
||||
Movable = false;
|
||||
// Gems
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
{
|
||||
Item GemLoot = Loot.RandomGem();
|
||||
GemLoot.Amount = Utility.Random(1, 9);
|
||||
DropItem(GemLoot);
|
||||
}
|
||||
|
||||
TrapType = TrapType.PoisonTrap;
|
||||
TrapPower = m_Level * Utility.Random( 1, 25 );
|
||||
Locked = true;
|
||||
// Magic Wand
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
DropItem(Loot.RandomWand());
|
||||
|
||||
RequiredSkill = 84;
|
||||
LockLevel = RequiredSkill - Utility.Random( 1, 10 );
|
||||
MaxLockLevel = RequiredSkill + Utility.Random( 1, 10 ); ;
|
||||
// Equipment
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
{
|
||||
Item item = Loot.RandomArmorOrShieldOrWeapon();
|
||||
|
||||
// According to OSI, loot in level 3 chest is:
|
||||
// Gold 250 - 350
|
||||
// Arrows 10
|
||||
// Reagents
|
||||
// Scrolls
|
||||
// Potions
|
||||
// Gems
|
||||
// Magic Wand
|
||||
// Magic weapon
|
||||
// Magic armour
|
||||
// Magic clothing (not implemented)
|
||||
// Magic jewelry (not implemented)
|
||||
if (item is BaseWeapon weapon)
|
||||
{
|
||||
weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(m_Level);
|
||||
weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(m_Level);
|
||||
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(m_Level);
|
||||
weapon.Quality = WeaponQuality.Regular;
|
||||
}
|
||||
else if (item is BaseArmor armor)
|
||||
{
|
||||
armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(m_Level);
|
||||
armor.Durability = (ArmorDurabilityLevel)Utility.Random(m_Level);
|
||||
armor.Quality = ArmorQuality.Regular;
|
||||
}
|
||||
|
||||
// Gold
|
||||
DropItem( new Gold( Utility.Random( 180, 240 ) ) );
|
||||
DropItem(item);
|
||||
}
|
||||
|
||||
// Drop bolts
|
||||
//DropItem( new Arrow( 10 ) );
|
||||
// Clothing
|
||||
for (int i = Utility.Random(1, 2); i > 1; i--)
|
||||
DropItem(Loot.RandomClothing());
|
||||
|
||||
// Reagents
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
{
|
||||
Item ReagentLoot = Loot.RandomReagent();
|
||||
ReagentLoot.Amount = Utility.Random( 1, 9 );
|
||||
DropItem( ReagentLoot );
|
||||
}
|
||||
// Jewelry
|
||||
for (int i = Utility.Random(1, 2); i > 1; i--)
|
||||
DropItem(Loot.RandomJewelry());
|
||||
}
|
||||
|
||||
// Scrolls
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
{
|
||||
Item ScrollLoot = Loot.RandomScroll( 0, 47, SpellbookType.Regular );
|
||||
ScrollLoot.Amount = Utility.Random( 1, 12 );
|
||||
DropItem( ScrollLoot );
|
||||
}
|
||||
public TreasureChestLevel3(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
// Potions
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
{
|
||||
Item PotionLoot = Loot.RandomPotion();
|
||||
DropItem( PotionLoot );
|
||||
}
|
||||
public override bool Decays => true;
|
||||
|
||||
// Gems
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
{
|
||||
Item GemLoot = Loot.RandomGem();
|
||||
GemLoot.Amount = Utility.Random( 1, 9 );
|
||||
DropItem( GemLoot );
|
||||
}
|
||||
public override bool IsDecoContainer => false;
|
||||
|
||||
// Magic Wand
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
DropItem( Loot.RandomWand() );
|
||||
public override TimeSpan DecayTime => TimeSpan.FromMinutes(Utility.Random(15, 60));
|
||||
|
||||
// Equipment
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
{
|
||||
Item item = Loot.RandomArmorOrShieldOrWeapon();
|
||||
public override int DefaultGumpID => 0x42;
|
||||
|
||||
if ( item is BaseWeapon weapon )
|
||||
{
|
||||
weapon.DamageLevel = ( WeaponDamageLevel )Utility.Random( m_Level );
|
||||
weapon.AccuracyLevel = ( WeaponAccuracyLevel )Utility.Random( m_Level );
|
||||
weapon.DurabilityLevel = ( WeaponDurabilityLevel )Utility.Random( m_Level );
|
||||
weapon.Quality = WeaponQuality.Regular;
|
||||
}
|
||||
else if ( item is BaseArmor armor )
|
||||
{
|
||||
armor.ProtectionLevel = ( ArmorProtectionLevel )Utility.Random( m_Level );
|
||||
armor.Durability = ( ArmorDurabilityLevel )Utility.Random( m_Level );
|
||||
armor.Quality = ArmorQuality.Regular;
|
||||
}
|
||||
public override int DefaultDropSound => 0x42;
|
||||
|
||||
DropItem( item );
|
||||
}
|
||||
public override Rectangle2D Bounds => new Rectangle2D(18, 105, 144, 73);
|
||||
|
||||
// Clothing
|
||||
for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
|
||||
DropItem( Loot.RandomClothing() );
|
||||
private void SetChestAppearance()
|
||||
{
|
||||
bool UseFirstItemId = Utility.RandomBool();
|
||||
switch (Utility.RandomList(0, 1, 2))
|
||||
{
|
||||
case 0: // Wooden Chest
|
||||
ItemID = UseFirstItemId ? 0xe42 : 0xe43;
|
||||
GumpID = 0x49;
|
||||
break;
|
||||
|
||||
// Jewelry
|
||||
for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
|
||||
DropItem( Loot.RandomJewelry() );
|
||||
}
|
||||
case 1: // Metal Chest
|
||||
ItemID = UseFirstItemId ? 0x9ab : 0xe7c;
|
||||
GumpID = 0x4A;
|
||||
break;
|
||||
|
||||
public TreasureChestLevel3( Serial serial )
|
||||
: base( serial )
|
||||
{
|
||||
}
|
||||
case 2: // Metal Golden Chest
|
||||
ItemID = UseFirstItemId ? 0xe40 : 0xe41;
|
||||
GumpID = 0x42;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( ( int )1 ); // version
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(1); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,168 +2,169 @@ using System;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TreasureChestLevel4 : LockableContainer
|
||||
{
|
||||
private const int m_Level = 4;
|
||||
public class TreasureChestLevel4 : LockableContainer
|
||||
{
|
||||
private const int m_Level = 4;
|
||||
|
||||
public override bool Decays => true;
|
||||
[Constructible]
|
||||
public TreasureChestLevel4()
|
||||
: base(0xE41)
|
||||
{
|
||||
SetChestAppearance();
|
||||
Movable = false;
|
||||
|
||||
public override bool IsDecoContainer => false;
|
||||
TrapType = TrapType.ExplosionTrap;
|
||||
TrapPower = m_Level * Utility.Random(10, 25);
|
||||
Locked = true;
|
||||
|
||||
public override TimeSpan DecayTime => TimeSpan.FromMinutes( Utility.Random( 15, 60 ) );
|
||||
RequiredSkill = 92;
|
||||
LockLevel = RequiredSkill - Utility.Random(1, 10);
|
||||
MaxLockLevel = RequiredSkill + Utility.Random(1, 10);
|
||||
;
|
||||
|
||||
private void SetChestAppearance()
|
||||
{
|
||||
bool UseFirstItemId = Utility.RandomBool();
|
||||
// According to OSI, loot in level 4 chest is:
|
||||
// Gold 500 - 900
|
||||
// Reagents
|
||||
// Scrolls
|
||||
// Blank scrolls
|
||||
// Potions
|
||||
// Gems
|
||||
// Magic Wand
|
||||
// Magic weapon
|
||||
// Magic armour
|
||||
// Magic clothing (not implemented)
|
||||
// Magic jewelry (not implemented)
|
||||
// Crystal ball (not implemented)
|
||||
|
||||
switch( Utility.Random( 4 ) )
|
||||
{
|
||||
case 0:// Wooden Chest
|
||||
ItemID = ( UseFirstItemId ? 0xe42 : 0xe43 );
|
||||
GumpID = 0x49;
|
||||
break;
|
||||
// Gold
|
||||
DropItem(new Gold(Utility.Random(200, 400)));
|
||||
|
||||
case 1:// Metal Chest
|
||||
ItemID = ( UseFirstItemId ? 0x9ab : 0xe7c );
|
||||
GumpID = 0x4A;
|
||||
break;
|
||||
// Reagents
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
{
|
||||
Item ReagentLoot = Loot.RandomReagent();
|
||||
ReagentLoot.Amount = 12;
|
||||
DropItem(ReagentLoot);
|
||||
}
|
||||
|
||||
case 2:// Metal Golden Chest
|
||||
ItemID = ( UseFirstItemId ? 0xe40 : 0xe41 );
|
||||
GumpID = 0x42;
|
||||
break;
|
||||
// Scrolls
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
{
|
||||
Item ScrollLoot = Loot.RandomScroll(0, 47, SpellbookType.Regular);
|
||||
ScrollLoot.Amount = 16;
|
||||
DropItem(ScrollLoot);
|
||||
}
|
||||
|
||||
case 3:// Keg
|
||||
ItemID = 0xe7f;
|
||||
GumpID = 0x3e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Drop blank scrolls
|
||||
DropItem(new BlankScroll(Utility.Random(1, m_Level)));
|
||||
|
||||
public override int DefaultGumpID => 0x42;
|
||||
// Potions
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
{
|
||||
Item PotionLoot = Loot.RandomPotion();
|
||||
DropItem(PotionLoot);
|
||||
}
|
||||
|
||||
public override int DefaultDropSound => 0x42;
|
||||
// Gems
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
{
|
||||
Item GemLoot = Loot.RandomGem();
|
||||
GemLoot.Amount = 12;
|
||||
DropItem(GemLoot);
|
||||
}
|
||||
|
||||
public override Rectangle2D Bounds => new Rectangle2D( 18, 105, 144, 73 );
|
||||
// Magic Wand
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
DropItem(Loot.RandomWand());
|
||||
|
||||
[Constructible]
|
||||
public TreasureChestLevel4()
|
||||
: base( 0xE41 )
|
||||
{
|
||||
SetChestAppearance();
|
||||
Movable = false;
|
||||
// Equipment
|
||||
for (int i = Utility.Random(1, m_Level); i > 1; i--)
|
||||
{
|
||||
Item item = Loot.RandomArmorOrShieldOrWeapon();
|
||||
|
||||
TrapType = TrapType.ExplosionTrap;
|
||||
TrapPower = m_Level * Utility.Random( 10, 25 );
|
||||
Locked = true;
|
||||
if (item is BaseWeapon weapon)
|
||||
{
|
||||
weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(m_Level);
|
||||
weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(m_Level);
|
||||
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(m_Level);
|
||||
weapon.Quality = WeaponQuality.Regular;
|
||||
}
|
||||
else if (item is BaseArmor armor)
|
||||
{
|
||||
armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(m_Level);
|
||||
armor.Durability = (ArmorDurabilityLevel)Utility.Random(m_Level);
|
||||
armor.Quality = ArmorQuality.Regular;
|
||||
}
|
||||
|
||||
RequiredSkill = 92;
|
||||
LockLevel = RequiredSkill - Utility.Random( 1, 10 );
|
||||
MaxLockLevel = RequiredSkill + Utility.Random( 1, 10 ); ;
|
||||
DropItem(item);
|
||||
}
|
||||
|
||||
// According to OSI, loot in level 4 chest is:
|
||||
// Gold 500 - 900
|
||||
// Reagents
|
||||
// Scrolls
|
||||
// Blank scrolls
|
||||
// Potions
|
||||
// Gems
|
||||
// Magic Wand
|
||||
// Magic weapon
|
||||
// Magic armour
|
||||
// Magic clothing (not implemented)
|
||||
// Magic jewelry (not implemented)
|
||||
// Crystal ball (not implemented)
|
||||
// Clothing
|
||||
for (int i = Utility.Random(1, 2); i > 1; i--)
|
||||
DropItem(Loot.RandomClothing());
|
||||
|
||||
// Gold
|
||||
DropItem( new Gold( Utility.Random( 200, 400 ) ) );
|
||||
// Jewelry
|
||||
for (int i = Utility.Random(1, 2); i > 1; i--)
|
||||
DropItem(Loot.RandomJewelry());
|
||||
|
||||
// Reagents
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
{
|
||||
Item ReagentLoot = Loot.RandomReagent();
|
||||
ReagentLoot.Amount = 12;
|
||||
DropItem( ReagentLoot );
|
||||
}
|
||||
// Crystal ball (not implemented)
|
||||
}
|
||||
|
||||
// Scrolls
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
{
|
||||
Item ScrollLoot = Loot.RandomScroll( 0, 47, SpellbookType.Regular );
|
||||
ScrollLoot.Amount = 16;
|
||||
DropItem( ScrollLoot );
|
||||
}
|
||||
public TreasureChestLevel4(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
// Drop blank scrolls
|
||||
DropItem( new BlankScroll( Utility.Random( 1, m_Level ) ) );
|
||||
public override bool Decays => true;
|
||||
|
||||
// Potions
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
{
|
||||
Item PotionLoot = Loot.RandomPotion();
|
||||
DropItem( PotionLoot );
|
||||
}
|
||||
public override bool IsDecoContainer => false;
|
||||
|
||||
// Gems
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
{
|
||||
Item GemLoot = Loot.RandomGem();
|
||||
GemLoot.Amount = 12;
|
||||
DropItem( GemLoot );
|
||||
}
|
||||
public override TimeSpan DecayTime => TimeSpan.FromMinutes(Utility.Random(15, 60));
|
||||
|
||||
// Magic Wand
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
DropItem( Loot.RandomWand() );
|
||||
public override int DefaultGumpID => 0x42;
|
||||
|
||||
// Equipment
|
||||
for( int i = Utility.Random( 1, m_Level ); i > 1; i-- )
|
||||
{
|
||||
Item item = Loot.RandomArmorOrShieldOrWeapon();
|
||||
public override int DefaultDropSound => 0x42;
|
||||
|
||||
if ( item is BaseWeapon weapon )
|
||||
{
|
||||
weapon.DamageLevel = ( WeaponDamageLevel )Utility.Random( m_Level );
|
||||
weapon.AccuracyLevel = ( WeaponAccuracyLevel )Utility.Random( m_Level );
|
||||
weapon.DurabilityLevel = ( WeaponDurabilityLevel )Utility.Random( m_Level );
|
||||
weapon.Quality = WeaponQuality.Regular;
|
||||
}
|
||||
else if ( item is BaseArmor armor )
|
||||
{
|
||||
armor.ProtectionLevel = ( ArmorProtectionLevel )Utility.Random( m_Level );
|
||||
armor.Durability = ( ArmorDurabilityLevel )Utility.Random( m_Level );
|
||||
armor.Quality = ArmorQuality.Regular;
|
||||
}
|
||||
public override Rectangle2D Bounds => new Rectangle2D(18, 105, 144, 73);
|
||||
|
||||
DropItem( item );
|
||||
}
|
||||
private void SetChestAppearance()
|
||||
{
|
||||
bool UseFirstItemId = Utility.RandomBool();
|
||||
|
||||
// Clothing
|
||||
for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
|
||||
DropItem( Loot.RandomClothing() );
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0: // Wooden Chest
|
||||
ItemID = UseFirstItemId ? 0xe42 : 0xe43;
|
||||
GumpID = 0x49;
|
||||
break;
|
||||
|
||||
// Jewelry
|
||||
for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
|
||||
DropItem( Loot.RandomJewelry() );
|
||||
case 1: // Metal Chest
|
||||
ItemID = UseFirstItemId ? 0x9ab : 0xe7c;
|
||||
GumpID = 0x4A;
|
||||
break;
|
||||
|
||||
// Crystal ball (not implemented)
|
||||
}
|
||||
case 2: // Metal Golden Chest
|
||||
ItemID = UseFirstItemId ? 0xe40 : 0xe41;
|
||||
GumpID = 0x42;
|
||||
break;
|
||||
|
||||
public TreasureChestLevel4( Serial serial )
|
||||
: base( serial )
|
||||
{
|
||||
}
|
||||
case 3: // Keg
|
||||
ItemID = 0xe7f;
|
||||
GumpID = 0x3e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( ( int )1 ); // version
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(1); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue