Fixes unavailable syntax for Mono.
This commit is contained in:
parent
f674ec2be0
commit
6ef32ce910
7 changed files with 99 additions and 144 deletions
|
|
@ -247,13 +247,13 @@ namespace Server.Commands
|
|||
|
||||
if ( x is CategoryEntry entry )
|
||||
a = entry.Title;
|
||||
else if ( x is CategoryTypeEntry typeEntry )
|
||||
a = typeEntry.Type.Name;
|
||||
else if ( x is CategoryTypeEntry xTypeEntry )
|
||||
a = xTypeEntry.Type.Name;
|
||||
|
||||
if ( y is CategoryEntry categoryEntry )
|
||||
b = categoryEntry.Title;
|
||||
else if ( y is CategoryTypeEntry typeEntry )
|
||||
b = typeEntry.Type.Name;
|
||||
else if ( y is CategoryTypeEntry yTypeEntry )
|
||||
b = yTypeEntry.Type.Name;
|
||||
|
||||
if ( a == null && b == null )
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -573,10 +573,10 @@ namespace Server.Factions
|
|||
StartBandage();
|
||||
}
|
||||
|
||||
if ( m_Mobile.Spell == null && Core.TickCount - m_Mobile.NextSpellTime >= 0 )
|
||||
{
|
||||
Spell spell = null;
|
||||
Spell spell = m_Mobile.Spell as Spell;
|
||||
|
||||
if ( spell == null && Core.TickCount - m_Mobile.NextSpellTime >= 0 )
|
||||
{
|
||||
DateTime toRelease = DateTime.MinValue;
|
||||
|
||||
if ( IsPoisoned )
|
||||
|
|
@ -678,7 +678,7 @@ namespace Server.Factions
|
|||
if ( types.Count > 1 )
|
||||
spell = new BlessSpell( m_Guard, null );
|
||||
else if ( types.Count == 1 )
|
||||
spell = (Spell) Activator.CreateInstance( types[0], new object[]{ m_Guard, null } );
|
||||
spell = Activator.CreateInstance( types[0], new object[]{ m_Guard, null } ) as Spell;
|
||||
}
|
||||
else if ( types.Count > 0 )
|
||||
{
|
||||
|
|
@ -757,7 +757,7 @@ namespace Server.Factions
|
|||
if ( spell == null || !spell.Cast() )
|
||||
EquipWeapon();
|
||||
}
|
||||
else if ( m_Mobile.Spell is Spell spell && spell.State == SpellState.Sequencing )
|
||||
else if ( spell?.State == SpellState.Sequencing )
|
||||
{
|
||||
EquipWeapon();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,17 +43,20 @@ namespace Server.Engines.MLQuests.Items
|
|||
|
||||
public static void Enhance( Item loot )
|
||||
{
|
||||
switch (loot)
|
||||
if (loot is BaseWeapon weapon)
|
||||
{
|
||||
case BaseWeapon weapon:
|
||||
BaseRunicTool.ApplyAttributesTo( weapon, Utility.RandomMinMax( 1, 5 ), 10, 80 );
|
||||
break;
|
||||
case BaseArmor armor:
|
||||
BaseRunicTool.ApplyAttributesTo( armor, Utility.RandomMinMax( 1, 5 ), 10, 80 );
|
||||
break;
|
||||
default:
|
||||
BaseRunicTool.ApplyAttributesTo((BaseJewel)loot, Utility.RandomMinMax( 1, 5 ), 10, 80 );
|
||||
break;
|
||||
BaseRunicTool.ApplyAttributesTo( weapon, Utility.RandomMinMax( 1, 5 ), 10, 80 );
|
||||
return;
|
||||
}
|
||||
|
||||
if (loot is BaseArmor armor)
|
||||
{
|
||||
BaseRunicTool.ApplyAttributesTo( armor, Utility.RandomMinMax( 1, 5 ), 10, 80 );
|
||||
}
|
||||
|
||||
if (loot is BaseJewel jewel)
|
||||
{
|
||||
BaseRunicTool.ApplyAttributesTo(jewel, Utility.RandomMinMax( 1, 5 ), 10, 80 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,19 +43,14 @@ namespace Server.Items
|
|||
#region Checks
|
||||
private bool Resmeltables() //Where context menu checks for metal items and dragon barding deeds
|
||||
{
|
||||
foreach( Item i in Items )
|
||||
foreach (Item i in Items)
|
||||
{
|
||||
if (i?.Deleted != false)
|
||||
continue;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case BaseWeapon weapon when CraftResources.GetType( weapon.Resource ) == CraftResourceType.Metal:
|
||||
case BaseArmor armor when CraftResources.GetType( armor.Resource ) == CraftResourceType.Metal:
|
||||
case DragonBardingDeed _:
|
||||
return true;
|
||||
}
|
||||
return i?.Deleted == false && (
|
||||
i is BaseWeapon weapon && CraftResources.GetType(weapon.Resource) == CraftResourceType.Metal ||
|
||||
i is BaseArmor armor && CraftResources.GetType(armor.Resource) == CraftResourceType.Metal ||
|
||||
i is DragonBardingDeed);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -63,20 +58,14 @@ namespace Server.Items
|
|||
{
|
||||
foreach( Item i in Items )
|
||||
{
|
||||
if (!(i is IScissorable && !i.Deleted))
|
||||
if (!(i is IScissorable) || i.Deleted)
|
||||
continue;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case BaseClothing _:
|
||||
case BaseArmor armor when CraftResources.GetType( armor.Resource ) == CraftResourceType.Leather:
|
||||
case Cloth _:
|
||||
case BoltOfCloth _:
|
||||
case Hides _:
|
||||
case BonePile _:
|
||||
return true;
|
||||
}
|
||||
if (i is BaseClothing || i is Cloth || i is BoltOfCloth || i is Hides || i is BonePile ||
|
||||
i is BaseArmor armor && CraftResources.GetType(armor.Resource) == CraftResourceType.Leather)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
|
@ -192,32 +181,25 @@ namespace Server.Items
|
|||
|
||||
Container sBag = this;
|
||||
|
||||
List<Item> Smeltables = sBag.FindItemsByType<Item>();
|
||||
List<Item> smeltables = sBag.FindItemsByType<Item>();
|
||||
|
||||
foreach (Item item in smeltables)
|
||||
{
|
||||
if (item?.Deleted != false)
|
||||
continue;
|
||||
|
||||
if (item is BaseArmor armor && Resmelt(from, armor, armor.Resource) ||
|
||||
item is BaseWeapon weapon && Resmelt(from, weapon, weapon.Resource) ||
|
||||
item is DragonBardingDeed)
|
||||
{
|
||||
salvaged++;
|
||||
}
|
||||
else
|
||||
{
|
||||
notSalvaged++;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = Smeltables.Count - 1; i >= 0; i--)
|
||||
{
|
||||
switch (Smeltables[i])
|
||||
{
|
||||
case BaseArmor armor when Resmelt( from, armor, armor.Resource ):
|
||||
salvaged++;
|
||||
break;
|
||||
case BaseArmor _:
|
||||
notSalvaged++;
|
||||
break;
|
||||
case BaseWeapon weapon when Resmelt( from, weapon, weapon.Resource ):
|
||||
salvaged++;
|
||||
break;
|
||||
case BaseWeapon _:
|
||||
notSalvaged++;
|
||||
break;
|
||||
case DragonBardingDeed deed when Resmelt( from, deed, deed.Resource ):
|
||||
salvaged++;
|
||||
break;
|
||||
case DragonBardingDeed _:
|
||||
notSalvaged++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( m_Failure )
|
||||
{
|
||||
from.SendLocalizedMessage( 1079975 ); // You failed to smelt some metal for lack of skill.
|
||||
|
|
|
|||
|
|
@ -61,21 +61,11 @@ namespace Server.Items
|
|||
|
||||
if ( obj is IArcaneEquip eq && eq is Item item )
|
||||
{
|
||||
CraftResource resource = CraftResource.None;
|
||||
BaseClothing clothing = item as BaseClothing;
|
||||
BaseArmor armor = item as BaseArmor;
|
||||
BaseWeapon weapon = item as BaseWeapon;
|
||||
|
||||
switch (item)
|
||||
{
|
||||
case BaseClothing clothing:
|
||||
resource = clothing.Resource;
|
||||
break;
|
||||
case BaseArmor armor:
|
||||
resource = armor.Resource;
|
||||
break;
|
||||
// Sanity, weapons cannot receive gems...
|
||||
case BaseWeapon weapon:
|
||||
resource = weapon.Resource;
|
||||
break;
|
||||
}
|
||||
CraftResource resource = clothing?.Resource ?? armor?.Resource ?? weapon?.Resource ?? CraftResource.None;
|
||||
|
||||
if ( !item.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
|
|
@ -119,39 +109,27 @@ namespace Server.Items
|
|||
}
|
||||
else if ( from.Skills[SkillName.Tailoring].Value >= 80.0 )
|
||||
{
|
||||
bool isExceptional = false;
|
||||
|
||||
switch (item)
|
||||
{
|
||||
case BaseClothing clothing:
|
||||
isExceptional = clothing.Quality == ClothingQuality.Exceptional;
|
||||
break;
|
||||
case BaseArmor armor:
|
||||
isExceptional = armor.Quality == ArmorQuality.Exceptional;
|
||||
break;
|
||||
case BaseWeapon weapon:
|
||||
isExceptional = weapon.Quality == WeaponQuality.Exceptional;
|
||||
break;
|
||||
}
|
||||
bool isExceptional = clothing?.Quality == ClothingQuality.Exceptional ||
|
||||
armor?.Quality == ArmorQuality.Exceptional ||
|
||||
weapon?.Quality == WeaponQuality.Exceptional;
|
||||
|
||||
if ( isExceptional )
|
||||
{
|
||||
switch (item)
|
||||
if (clothing != null)
|
||||
{
|
||||
case BaseClothing clothing:
|
||||
clothing.Quality = ClothingQuality.Regular;
|
||||
clothing.Crafter = @from;
|
||||
break;
|
||||
case BaseArmor armor:
|
||||
armor.Quality = ArmorQuality.Regular;
|
||||
armor.Crafter = @from;
|
||||
armor.PhysicalBonus = armor.FireBonus = armor.ColdBonus = armor.PoisonBonus = armor.EnergyBonus = 0; // Is there a method to remove bonuses?
|
||||
break;
|
||||
// Sanity, weapons cannot receive gems...
|
||||
case BaseWeapon weapon:
|
||||
weapon.Quality = WeaponQuality.Regular;
|
||||
weapon.Crafter = @from;
|
||||
break;
|
||||
clothing.Quality = ClothingQuality.Regular;
|
||||
clothing.Crafter = from;
|
||||
}
|
||||
else if (armor != null)
|
||||
{
|
||||
armor.Quality = ArmorQuality.Regular;
|
||||
armor.Crafter = from;
|
||||
armor.PhysicalBonus = armor.FireBonus = armor.ColdBonus = armor.PoisonBonus = armor.EnergyBonus = 0; // Is there a method to remove bonuses?
|
||||
}
|
||||
else if (weapon != null)
|
||||
{
|
||||
weapon.Quality = WeaponQuality.Regular;
|
||||
weapon.Crafter = from;
|
||||
}
|
||||
|
||||
eq.CurArcaneCharges = eq.MaxArcaneCharges = charges;
|
||||
|
|
|
|||
|
|
@ -155,28 +155,25 @@ namespace Server.Items
|
|||
BaseHouse house = BaseHouse.FindHouseAt( from );
|
||||
|
||||
bool isDecorableComponent = false;
|
||||
object addon = null;
|
||||
int count = 0;
|
||||
|
||||
if ( item is AddonComponent || item is AddonContainerComponent || item is BaseAddonContainer )
|
||||
if (item is AddonComponent component)
|
||||
{
|
||||
object addon = null;
|
||||
int count = 0;
|
||||
|
||||
switch (item)
|
||||
{
|
||||
case AddonComponent component:
|
||||
count = component.Addon.Components.Count;
|
||||
addon = component.Addon;
|
||||
break;
|
||||
case AddonContainerComponent containerComponent:
|
||||
count = containerComponent.Addon.Components.Count;
|
||||
addon = containerComponent.Addon;
|
||||
break;
|
||||
case BaseAddonContainer container:
|
||||
count = container.Components.Count;
|
||||
addon = container;
|
||||
break;
|
||||
}
|
||||
count = component.Addon.Components.Count;
|
||||
addon = component.Addon;
|
||||
} else if (item is AddonContainerComponent containerComponent)
|
||||
{
|
||||
count = containerComponent.Addon.Components.Count;
|
||||
addon = containerComponent.Addon;
|
||||
} else if (item is BaseAddonContainer container)
|
||||
{
|
||||
count = container.Components.Count;
|
||||
addon = container;
|
||||
}
|
||||
|
||||
if (addon != null)
|
||||
{
|
||||
if ( count == 1 && Core.SE )
|
||||
isDecorableComponent = true;
|
||||
|
||||
|
|
@ -236,22 +233,17 @@ namespace Server.Items
|
|||
|
||||
private static void Turn( Item item, Mobile from )
|
||||
{
|
||||
if ( item is AddonComponent || item is AddonContainerComponent || item is BaseAddonContainer )
|
||||
{
|
||||
object addon = null;
|
||||
object addon = null;
|
||||
|
||||
switch (item)
|
||||
{
|
||||
case AddonComponent component:
|
||||
addon = component.Addon;
|
||||
break;
|
||||
case AddonContainerComponent containerComponent:
|
||||
addon = containerComponent.Addon;
|
||||
break;
|
||||
case BaseAddonContainer container:
|
||||
addon = container;
|
||||
break;
|
||||
}
|
||||
if (item is AddonComponent component)
|
||||
addon = component.Addon;
|
||||
else if (item is AddonContainerComponent containerComponent)
|
||||
addon = containerComponent.Addon;
|
||||
else if (item is BaseAddonContainer container)
|
||||
addon = container;
|
||||
|
||||
if (addon != null)
|
||||
{
|
||||
|
||||
FlippableAddonAttribute[] aAttributes = (FlippableAddonAttribute[]) addon.GetType().GetCustomAttributes( typeof( FlippableAddonAttribute ), false );
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace Server {
|
|||
{
|
||||
this.PermitBackgroundWrite = permitBackgroundWrite;
|
||||
|
||||
Thread saveThread = new Thread( delegate {
|
||||
Thread saveThread = new Thread( delegate() {
|
||||
SaveItems(metrics);
|
||||
} );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue