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

View file

@ -1,202 +1,227 @@
namespace Server.Items
{
[Flippable]
public class ParagonChest : LockableContainer
{
private static int[] m_ItemIDs = {
0x9AB, 0xE40, 0xE41, 0xE7C
};
[Flippable]
public class ParagonChest : LockableContainer
{
private static int[] m_ItemIDs =
{
0x9AB, 0xE40, 0xE41, 0xE7C
};
private static int[] m_Hues = {
0x0, 0x455, 0x47E, 0x89F, 0x8A5, 0x8AB,
0x966, 0x96D, 0x972, 0x973, 0x979
};
private static int[] m_Hues =
{
0x0, 0x455, 0x47E, 0x89F, 0x8A5, 0x8AB,
0x966, 0x96D, 0x972, 0x973, 0x979
};
private string m_Name;
private string m_Name;
[Constructible]
public ParagonChest( string name, int level ) : base( Utility.RandomList( m_ItemIDs ) )
{
m_Name = name;
Hue = Utility.RandomList( m_Hues );
Fill( level );
}
[Constructible]
public ParagonChest(string name, int level) : base(Utility.RandomList(m_ItemIDs))
{
m_Name = name;
Hue = Utility.RandomList(m_Hues);
Fill(level);
}
public override void OnSingleClick( Mobile from )
{
base.OnSingleClick(from);
LabelTo( from, 1063449, m_Name );
}
public ParagonChest(Serial serial) : base(serial)
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
public override void OnSingleClick(Mobile from)
{
base.OnSingleClick(from);
LabelTo(from, 1063449, m_Name);
}
list.Add( 1063449, m_Name );
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
private static void GetRandomAOSStats( out int attributeCount, out int min, out int max )
{
int rnd = Utility.Random( 15 );
list.Add(1063449, m_Name);
}
if ( rnd < 1 )
{
attributeCount = Utility.RandomMinMax( 2, 6 );
min = 20; max = 70;
}
else if ( rnd < 3 )
{
attributeCount = Utility.RandomMinMax( 2, 4 );
min = 20; max = 50;
}
else if ( rnd < 6 )
{
attributeCount = Utility.RandomMinMax( 2, 3 );
min = 20; max = 40;
}
else if ( rnd < 10 )
{
attributeCount = Utility.RandomMinMax( 1, 2 );
min = 10; max = 30;
}
else
{
attributeCount = 1;
min = 10; max = 20;
}
}
private static void GetRandomAOSStats(out int attributeCount, out int min, out int max)
{
int rnd = Utility.Random(15);
public void Flip()
{
switch ( ItemID )
{
case 0x9AB : ItemID = 0xE7C; break;
case 0xE7C : ItemID = 0x9AB; break;
if (rnd < 1)
{
attributeCount = Utility.RandomMinMax(2, 6);
min = 20;
max = 70;
}
else if (rnd < 3)
{
attributeCount = Utility.RandomMinMax(2, 4);
min = 20;
max = 50;
}
else if (rnd < 6)
{
attributeCount = Utility.RandomMinMax(2, 3);
min = 20;
max = 40;
}
else if (rnd < 10)
{
attributeCount = Utility.RandomMinMax(1, 2);
min = 10;
max = 30;
}
else
{
attributeCount = 1;
min = 10;
max = 20;
}
}
case 0xE40 : ItemID = 0xE41; break;
case 0xE41 : ItemID = 0xE40; break;
}
}
public void Flip()
{
switch (ItemID)
{
case 0x9AB:
ItemID = 0xE7C;
break;
case 0xE7C:
ItemID = 0x9AB;
break;
private void Fill( int level )
{
TrapType = TrapType.ExplosionTrap;
TrapPower = level * 25;
TrapLevel = level;
Locked = true;
case 0xE40:
ItemID = 0xE41;
break;
case 0xE41:
ItemID = 0xE40;
break;
}
}
switch ( level )
{
case 1: RequiredSkill = 36; break;
case 2: RequiredSkill = 76; break;
case 3: RequiredSkill = 84; break;
case 4: RequiredSkill = 92; break;
case 5: RequiredSkill = 100; break;
}
private void Fill(int level)
{
TrapType = TrapType.ExplosionTrap;
TrapPower = level * 25;
TrapLevel = level;
Locked = true;
LockLevel = RequiredSkill - 10;
MaxLockLevel = RequiredSkill + 40;
switch (level)
{
case 1:
RequiredSkill = 36;
break;
case 2:
RequiredSkill = 76;
break;
case 3:
RequiredSkill = 84;
break;
case 4:
RequiredSkill = 92;
break;
case 5:
RequiredSkill = 100;
break;
}
DropItem( new Gold( level * 200 ) );
LockLevel = RequiredSkill - 10;
MaxLockLevel = RequiredSkill + 40;
for ( int i = 0; i < level; ++i )
DropItem( Loot.RandomScroll( 0, 63, SpellbookType.Regular ) );
DropItem(new Gold(level * 200));
for ( int i = 0; i < level * 2; ++i )
{
Item item;
for (int i = 0; i < level; ++i)
DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
if ( Core.AOS )
item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
else
item = Loot.RandomArmorOrShieldOrWeapon();
for (int i = 0; i < level * 2; ++i)
{
Item item;
if ( item is BaseWeapon weapon )
{
if ( Core.AOS )
{
GetRandomAOSStats( out var attributeCount, out var min, out var max );
BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
}
else
{
weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( 6 );
weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( 6 );
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
}
if (Core.AOS)
item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
else
item = Loot.RandomArmorOrShieldOrWeapon();
DropItem( weapon );
}
else if ( item is BaseArmor armor )
{
if ( Core.AOS )
{
GetRandomAOSStats( out var attributeCount, out var min, out var max );
BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
}
else
{
armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( 6 );
armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
}
if (item is BaseWeapon weapon)
{
if (Core.AOS)
{
GetRandomAOSStats(out int attributeCount, out int min, out int max);
BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);
}
else
{
weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(6);
weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(6);
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);
}
DropItem( armor );
}
else if ( item is BaseHat hat )
{
if ( Core.AOS )
{
GetRandomAOSStats( out var attributeCount, out var min, out var max );
BaseRunicTool.ApplyAttributesTo( hat, attributeCount, min, max );
}
DropItem(weapon);
}
else if (item is BaseArmor armor)
{
if (Core.AOS)
{
GetRandomAOSStats(out int attributeCount, out int min, out int max);
BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
}
else
{
armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
armor.Durability = (ArmorDurabilityLevel)Utility.Random(6);
}
DropItem( hat );
}
else if ( item is BaseJewel jewel )
{
GetRandomAOSStats( out var attributeCount, out var min, out var max );
BaseRunicTool.ApplyAttributesTo( jewel, attributeCount, min, max );
DropItem(armor);
}
else if (item is BaseHat hat)
{
if (Core.AOS)
{
GetRandomAOSStats(out int attributeCount, out int min, out int max);
BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max);
}
DropItem( jewel );
}
}
DropItem(hat);
}
else if (item is BaseJewel jewel)
{
GetRandomAOSStats(out int attributeCount, out int min, out int max);
BaseRunicTool.ApplyAttributesTo(jewel, attributeCount, min, max);
for ( int i = 0; i < level; i++ )
{
Item item = Loot.RandomPossibleReagent();
item.Amount = Utility.RandomMinMax( 40, 60 );
DropItem( item );
}
DropItem(jewel);
}
}
for ( int i = 0; i < level; i++ )
{
Item item = Loot.RandomGem();
DropItem( item );
}
for (int i = 0; i < level; i++)
{
Item item = Loot.RandomPossibleReagent();
item.Amount = Utility.RandomMinMax(40, 60);
DropItem(item);
}
DropItem( new TreasureMap( level + 1, ( Utility.RandomBool() ? Map.Felucca : Map.Trammel ) ) );
}
for (int i = 0; i < level; i++)
{
Item item = Loot.RandomGem();
DropItem(item);
}
public ParagonChest( Serial serial ) : base( serial )
{
}
DropItem(new TreasureMap(level + 1, Utility.RandomBool() ? Map.Felucca : Map.Trammel));
}
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( m_Name );
}
writer.Write(m_Name);
}
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();
m_Name = Utility.Intern( reader.ReadString() );
}
}
}
m_Name = Utility.Intern(reader.ReadString());
}
}
}