Fixes several more expression issues and cast type check merges.
This commit is contained in:
parent
f93c3b992e
commit
9542c79ea4
24 changed files with 106 additions and 145 deletions
|
|
@ -242,7 +242,7 @@ namespace Server.Factions
|
|||
IPooledEnumerable<IEntity> eable = mob.Map.GetObjectsInRange(mob.Location, range, items, mobs);
|
||||
|
||||
foreach (IEntity obj in eable)
|
||||
if (type.IsAssignableFrom(obj.GetType()))
|
||||
if (type.IsInstanceOfType(obj))
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Factions
|
||||
|
|
@ -68,11 +69,7 @@ namespace Server.Factions
|
|||
|
||||
private static bool CheckExistance(Point3D loc, Map facet, Type type)
|
||||
{
|
||||
foreach (Item item in facet.GetItemsInRange(loc, 0))
|
||||
if (type.IsAssignableFrom(item.GetType()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return facet.GetItemsInRange(loc, 0).Any(type.IsInstanceOfType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -136,7 +136,7 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
{
|
||||
Type destType = Objective.Destination;
|
||||
|
||||
return destType != null && destType.IsAssignableFrom(type);
|
||||
return destType?.IsAssignableFrom(type) == true;
|
||||
}
|
||||
|
||||
public override bool IsCompleted()
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace Server.Gumps
|
|||
targeted is AddonComponent)
|
||||
targeted = ((AddonComponent)targeted).Addon;
|
||||
|
||||
if (m_Type.IsAssignableFrom(targeted.GetType()))
|
||||
if (m_Type.IsInstanceOfType(targeted))
|
||||
{
|
||||
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, targeted.ToString());
|
||||
m_Property.SetValue(m_Object, targeted, null);
|
||||
|
|
|
|||
|
|
@ -503,12 +503,9 @@ namespace Server
|
|||
* Bleh.
|
||||
*/
|
||||
|
||||
Type[] ifaces = active.FindInterfaces( delegate( Type type, object obj )
|
||||
{
|
||||
return ( type.IsGenericType )
|
||||
&& ( type.GetGenericTypeDefinition() == typeof( IComparable<> ) )
|
||||
&& ( type.GetGenericArguments()[0].IsAssignableFrom( active ) );
|
||||
}, null );
|
||||
Type[] ifaces = active.FindInterfaces((type, obj) => (type.IsGenericType)
|
||||
&& (type.GetGenericTypeDefinition() == typeof(IComparable<>))
|
||||
&& (type.GetGenericArguments()[0].IsAssignableFrom(active)), null );
|
||||
|
||||
if ( ifaces.Length > 0 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3552,12 +3552,7 @@ namespace Server.Mobiles
|
|||
private Item[] m_Items;
|
||||
private int m_Page;
|
||||
|
||||
public ItemInsuranceMenuGump(PlayerMobile from, Item[] items)
|
||||
: this(from, items, null, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public ItemInsuranceMenuGump(PlayerMobile from, Item[] items, bool[] insure, int page)
|
||||
public ItemInsuranceMenuGump(PlayerMobile from, Item[] items, bool[] insure = null, int page = 0)
|
||||
: base(25, 50)
|
||||
{
|
||||
m_From = from;
|
||||
|
|
|
|||
|
|
@ -69,10 +69,10 @@ namespace Server.Mobiles
|
|||
|
||||
Item artifact = Loot.Construct(type);
|
||||
|
||||
if (artifact is MonsterStatuette && StatueTypes.Length > 0)
|
||||
if (artifact is MonsterStatuette statuette && StatueTypes.Length > 0)
|
||||
{
|
||||
((MonsterStatuette)artifact).Type = StatueTypes[Utility.Random(StatueTypes.Length)];
|
||||
((MonsterStatuette)artifact).LootType = LootType.Regular;
|
||||
statuette.Type = StatueTypes[Utility.Random(StatueTypes.Length)];
|
||||
statuette.LootType = LootType.Regular;
|
||||
}
|
||||
|
||||
return artifact;
|
||||
|
|
|
|||
|
|
@ -111,9 +111,8 @@ namespace Server.Mobiles
|
|||
e.Handled = true;
|
||||
|
||||
Mobile from = e.Mobile;
|
||||
Guild g = from.Guild as Guild;
|
||||
|
||||
if (g == null || g.Type != Type)
|
||||
if (!(from.Guild is Guild g) || g.Type != Type)
|
||||
{
|
||||
Say(SignupNumber);
|
||||
}
|
||||
|
|
@ -124,7 +123,7 @@ namespace Server.Mobiles
|
|||
Item twoHanded = from.FindItemOnLayer(Layer.TwoHanded);
|
||||
|
||||
if (pack?.FindItemByType(shield.GetType()) != null ||
|
||||
twoHanded != null && shield.GetType().IsAssignableFrom(twoHanded.GetType()))
|
||||
twoHanded != null && shield.GetType().IsInstanceOfType(twoHanded))
|
||||
{
|
||||
Say(1007110); // Why dost thou ask about virtue guards when thou art one?
|
||||
shield.Delete();
|
||||
|
|
|
|||
|
|
@ -323,8 +323,8 @@ namespace Server.Mobiles
|
|||
{
|
||||
DamageStore ds = rights[i];
|
||||
|
||||
if (ds.m_HasRight && ds.m_Mobile is PlayerMobile)
|
||||
PlayerMobile.ChampionTitleInfo.AwardHarrowerTitle((PlayerMobile)ds.m_Mobile);
|
||||
if (ds.m_HasRight && ds.m_Mobile is PlayerMobile mobile)
|
||||
PlayerMobile.ChampionTitleInfo.AwardHarrowerTitle(mobile);
|
||||
}
|
||||
|
||||
if (!NoKillAwards)
|
||||
|
|
|
|||
|
|
@ -102,8 +102,8 @@ namespace Server.Mobiles
|
|||
if (m == this || !CanBeHarmful(m))
|
||||
continue;
|
||||
|
||||
if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned ||
|
||||
((BaseCreature)m).Team != Team))
|
||||
if (m is BaseCreature creature && (creature.Controlled || creature.Summoned ||
|
||||
creature.Team != Team))
|
||||
targets.Add(m);
|
||||
else if (m.Player)
|
||||
targets.Add(m);
|
||||
|
|
|
|||
|
|
@ -94,8 +94,8 @@ namespace Server.Mobiles
|
|||
if (m == this || !CanBeHarmful(m))
|
||||
continue;
|
||||
|
||||
if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned ||
|
||||
((BaseCreature)m).Team != Team))
|
||||
if (m is BaseCreature creature && (creature.Controlled || creature.Summoned ||
|
||||
creature.Team != Team))
|
||||
list.Add(m);
|
||||
else if (m.Player)
|
||||
list.Add(m);
|
||||
|
|
|
|||
|
|
@ -122,58 +122,55 @@ namespace Server.Mobiles
|
|||
|
||||
private void DoCounter(Mobile attacker)
|
||||
{
|
||||
if (Map == null || attacker is BaseCreature && ((BaseCreature)attacker).BardProvoked)
|
||||
if (Map == null)
|
||||
return;
|
||||
|
||||
if (0.2 > Utility.RandomDouble())
|
||||
{
|
||||
/* Counterattack with Hit Poison Area
|
||||
if (!(0.2 > Utility.RandomDouble()))
|
||||
return;
|
||||
|
||||
BaseCreature bc = attacker as BaseCreature;
|
||||
|
||||
if (bc?.BardProvoked == true)
|
||||
return;
|
||||
|
||||
/* Counterattack with Hit Poison Area
|
||||
* 20-25 damage, unresistable
|
||||
* Lethal poison, 100% of the time
|
||||
* Particle effect: Type: "2" From: "0x4061A107" To: "0x0" ItemId: "0x36BD" ItemIdName: "explosion" FromLocation: "(296 615, 17)" ToLocation: "(296 615, 17)" Speed: "1" Duration: "10" FixedDirection: "True" Explode: "False" Hue: "0xA6" RenderMode: "0x0" Effect: "0x1F78" ExplodeEffect: "0x1" ExplodeSound: "0x0" Serial: "0x4061A107" Layer: "255" Unknown: "0x0"
|
||||
* Doesn't work on provoked monsters
|
||||
*/
|
||||
|
||||
Mobile target = null;
|
||||
Mobile target = bc?.GetMaster();
|
||||
|
||||
if (attacker is BaseCreature)
|
||||
{
|
||||
Mobile m = ((BaseCreature)attacker).GetMaster();
|
||||
if (target == null || !target.InRange(this, 25))
|
||||
target = attacker;
|
||||
|
||||
if (m != null)
|
||||
target = m;
|
||||
}
|
||||
Animate(10, 4, 1, true, false, 0);
|
||||
|
||||
if (target == null || !target.InRange(this, 25))
|
||||
target = attacker;
|
||||
ArrayList targets = new ArrayList();
|
||||
|
||||
Animate(10, 4, 1, true, false, 0);
|
||||
foreach (Mobile m in target.GetMobilesInRange(8))
|
||||
{
|
||||
if (m == this || !CanBeHarmful(m))
|
||||
continue;
|
||||
|
||||
ArrayList targets = new ArrayList();
|
||||
if (m is BaseCreature creature && (creature.Controlled || creature.Summoned ||
|
||||
creature.Team != Team))
|
||||
targets.Add(m);
|
||||
else if (m.Player)
|
||||
targets.Add(m);
|
||||
}
|
||||
|
||||
foreach (Mobile m in target.GetMobilesInRange(8))
|
||||
{
|
||||
if (m == this || !CanBeHarmful(m))
|
||||
continue;
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
Mobile m = (Mobile)targets[i];
|
||||
|
||||
if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned ||
|
||||
((BaseCreature)m).Team != Team))
|
||||
targets.Add(m);
|
||||
else if (m.Player)
|
||||
targets.Add(m);
|
||||
}
|
||||
DoHarmful(m);
|
||||
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
Mobile m = (Mobile)targets[i];
|
||||
AOS.Damage(m, this, Utility.RandomMinMax(20, 25), true, 0, 0, 0, 100, 0);
|
||||
|
||||
DoHarmful(m);
|
||||
|
||||
AOS.Damage(m, this, Utility.RandomMinMax(20, 25), true, 0, 0, 0, 100, 0);
|
||||
|
||||
m.FixedParticles(0x36BD, 1, 10, 0x1F78, 0xA6, 0, (EffectLayer)255);
|
||||
m.ApplyPoison(this, Poison.Lethal);
|
||||
}
|
||||
m.FixedParticles(0x36BD, 1, 10, 0x1F78, 0xA6, 0, (EffectLayer)255);
|
||||
m.ApplyPoison(this, Poison.Lethal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ namespace Server.Mobiles
|
|||
bool okay = true;
|
||||
|
||||
foreach (BaseObjective obj in quest.Objectives)
|
||||
if (obj is EscortObjective && ((EscortObjective)obj).Destination.Contains(reg))
|
||||
if (obj is EscortObjective objective && objective.Destination.Contains(reg))
|
||||
{
|
||||
okay = false; // We're already there!
|
||||
break;
|
||||
|
|
@ -271,10 +271,10 @@ namespace Server.Mobiles
|
|||
return false;
|
||||
}
|
||||
|
||||
if (m is PlayerMobile && ((PlayerMobile)m).LastEscortTime + EscortDelay >= DateTime.UtcNow)
|
||||
if (m is PlayerMobile mobile && mobile.LastEscortTime + EscortDelay >= DateTime.UtcNow)
|
||||
{
|
||||
int minutes =
|
||||
(int)Math.Ceiling((((PlayerMobile)m).LastEscortTime + EscortDelay - DateTime.UtcNow).TotalMinutes);
|
||||
(int)Math.Ceiling((mobile.LastEscortTime + EscortDelay - DateTime.UtcNow).TotalMinutes);
|
||||
|
||||
Say("You must rest {0} minute{1} before we set out on this journey.", minutes, minutes == 1 ? "" : "s");
|
||||
return false;
|
||||
|
|
@ -284,8 +284,8 @@ namespace Server.Mobiles
|
|||
{
|
||||
m_LastSeenEscorter = DateTime.UtcNow;
|
||||
|
||||
if (m is PlayerMobile)
|
||||
((PlayerMobile)m).LastEscortTime = DateTime.UtcNow;
|
||||
if (m is PlayerMobile playerMobile)
|
||||
playerMobile.LastEscortTime = DateTime.UtcNow;
|
||||
|
||||
Say("Lead on! Payment will be made when we arrive in {0}.",
|
||||
dest.Name == "Ocllo" && m.Map == Map.Trammel ? "Haven" : dest.Name);
|
||||
|
|
@ -473,9 +473,7 @@ namespace Server.Mobiles
|
|||
|
||||
bool gainedPath = false;
|
||||
|
||||
PlayerMobile pm = escorter as PlayerMobile;
|
||||
|
||||
if (pm != null)
|
||||
if (escorter is PlayerMobile pm)
|
||||
{
|
||||
if (pm.CompassionGains > 0 && DateTime.UtcNow > pm.NextCompassionDay)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1415,9 +1415,8 @@ namespace Server.Mobiles
|
|||
|
||||
IBuyItemInfo[] buyinfo = (IBuyItemInfo[])m_ArmorBuyInfo.ToArray(typeof(IBuyItemInfo));
|
||||
|
||||
if (buyinfo != null)
|
||||
foreach (IBuyItemInfo info in buyinfo)
|
||||
info.PriceScalar = priceScalar;
|
||||
foreach (IBuyItemInfo info in buyinfo)
|
||||
info.PriceScalar = priceScalar;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ namespace Server.Mobiles
|
|||
|
||||
object Obj_Disp = GetDisplayEntity();
|
||||
|
||||
if (Core.ML && Obj_Disp is Item && !(Obj_Disp as Item).Stackable)
|
||||
if (Core.ML && Obj_Disp is Item item && !item.Stackable)
|
||||
MaxAmount = Math.Min(20, MaxAmount);
|
||||
else
|
||||
MaxAmount = Math.Min(999, MaxAmount * 2);
|
||||
|
|
@ -257,10 +257,10 @@ namespace Server.Mobiles
|
|||
if (cache)
|
||||
m_Table[key] = obj;
|
||||
|
||||
if (obj is Item)
|
||||
AddItem((Item)obj);
|
||||
else if (obj is Mobile)
|
||||
m_Mobiles.Add((Mobile)obj);
|
||||
if (obj is Item item)
|
||||
AddItem(item);
|
||||
else if (obj is Mobile mobile)
|
||||
m_Mobiles.Add(mobile);
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
|
|
|
|||
|
|
@ -23,9 +23,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
m_Table.TryGetValue( item.GetType(), out int price );
|
||||
|
||||
if ( item is BaseArmor ) {
|
||||
BaseArmor armor = (BaseArmor)item;
|
||||
|
||||
if ( item is BaseArmor armor ) {
|
||||
if ( armor.Quality == ArmorQuality.Low )
|
||||
price = (int)( price * 0.60 );
|
||||
else if ( armor.Quality == ArmorQuality.Exceptional )
|
||||
|
|
@ -38,9 +36,7 @@ namespace Server.Mobiles
|
|||
if ( price < 1 )
|
||||
price = 1;
|
||||
}
|
||||
else if ( item is BaseWeapon ) {
|
||||
BaseWeapon weapon = (BaseWeapon)item;
|
||||
|
||||
else if ( item is BaseWeapon weapon ) {
|
||||
if ( weapon.Quality == WeaponQuality.Low )
|
||||
price = (int)( price * 0.60 );
|
||||
else if ( weapon.Quality == WeaponQuality.Exceptional )
|
||||
|
|
@ -53,18 +49,16 @@ namespace Server.Mobiles
|
|||
if ( price < 1 )
|
||||
price = 1;
|
||||
}
|
||||
else if ( item is BaseBeverage ) {
|
||||
else if ( item is BaseBeverage bev ) {
|
||||
int price1 = price, price2 = price;
|
||||
|
||||
if ( item is Pitcher )
|
||||
if ( bev is Pitcher )
|
||||
{ price1 = 3; price2 = 5; }
|
||||
else if ( item is BeverageBottle )
|
||||
else if ( bev is BeverageBottle )
|
||||
{ price1 = 3; price2 = 3; }
|
||||
else if ( item is Jug )
|
||||
else if ( bev is Jug )
|
||||
{ price1 = 6; price2 = 6; }
|
||||
|
||||
BaseBeverage bev = (BaseBeverage)item;
|
||||
|
||||
if ( bev.IsEmpty || bev.Content == BeverageType.Milk )
|
||||
price = price1;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -466,8 +466,8 @@ namespace Server.Mobiles
|
|||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (targeted is BaseCreature)
|
||||
m_Trainer.EndStable(from, (BaseCreature)targeted);
|
||||
if (targeted is BaseCreature creature)
|
||||
m_Trainer.EndStable(from, creature);
|
||||
else if (targeted == from)
|
||||
m_Trainer.SayTo(from, 502672); // HA HA HA! Sorry, I am not an inn.
|
||||
else
|
||||
|
|
|
|||
|
|
@ -97,9 +97,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override Item CreateBulkOrder(Mobile from, bool fromContextMenu)
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if (pm != null && pm.NextSmithBulkOrder == TimeSpan.Zero && (fromContextMenu || 0.2 > Utility.RandomDouble()))
|
||||
if (from is PlayerMobile pm && pm.NextSmithBulkOrder == TimeSpan.Zero && (fromContextMenu || 0.2 > Utility.RandomDouble()))
|
||||
{
|
||||
double theirSkill = pm.Skills[SkillName.Blacksmith].Base;
|
||||
|
||||
|
|
@ -131,16 +129,16 @@ namespace Server.Mobiles
|
|||
|
||||
public override TimeSpan GetNextBulkOrder(Mobile from)
|
||||
{
|
||||
if (from is PlayerMobile)
|
||||
return ((PlayerMobile)from).NextSmithBulkOrder;
|
||||
if (from is PlayerMobile mobile)
|
||||
return mobile.NextSmithBulkOrder;
|
||||
|
||||
return TimeSpan.Zero;
|
||||
}
|
||||
|
||||
public override void OnSuccessfulBulkOrderReceive(Mobile from)
|
||||
{
|
||||
if (Core.SE && from is PlayerMobile)
|
||||
((PlayerMobile)from).NextSmithBulkOrder = TimeSpan.Zero;
|
||||
if (Core.SE && from is PlayerMobile mobile)
|
||||
mobile.NextSmithBulkOrder = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -73,20 +73,18 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
if (!e.Handled && from is PlayerMobile && from.InRange(Location, 2) && WasNamed(e.Speech))
|
||||
if (!e.Handled && from is PlayerMobile pm && pm.InRange(Location, 2) && WasNamed(e.Speech))
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)from;
|
||||
|
||||
if (e.HasKeyword(0x0004)) // *join* | *member*
|
||||
{
|
||||
if (pm.NpcGuild == NpcGuild)
|
||||
SayTo(from, 501047); // Thou art already a member of our guild.
|
||||
SayTo(pm, 501047); // Thou art already a member of our guild.
|
||||
else if (pm.NpcGuild != NpcGuild.None)
|
||||
SayTo(from, 501046); // Thou must resign from thy other guild first.
|
||||
SayTo(pm, 501046); // Thou must resign from thy other guild first.
|
||||
else if (pm.GameTime < JoinGameAge || pm.CreationTime + JoinAge > DateTime.UtcNow)
|
||||
SayTo(from, 501048); // You are too young to join my guild...
|
||||
SayTo(pm, 501048); // You are too young to join my guild...
|
||||
else if (CheckCustomReqs(pm))
|
||||
SayPriceTo(from);
|
||||
SayPriceTo(pm);
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
|
@ -94,16 +92,16 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (pm.NpcGuild != NpcGuild)
|
||||
{
|
||||
SayTo(from, 501052); // Thou dost not belong to my guild!
|
||||
SayTo(pm, 501052); // Thou dost not belong to my guild!
|
||||
}
|
||||
else if (pm.NpcGuildJoinTime + QuitAge > DateTime.UtcNow ||
|
||||
pm.NpcGuildGameTime + QuitGameAge > pm.GameTime)
|
||||
{
|
||||
SayTo(from, 501053); // You just joined my guild! You must wait a week to resign.
|
||||
SayTo(pm, 501053); // You just joined my guild! You must wait a week to resign.
|
||||
}
|
||||
else
|
||||
{
|
||||
SayTo(from, 501054); // I accept thy resignation.
|
||||
SayTo(pm, 501054); // I accept thy resignation.
|
||||
pm.NpcGuild = NpcGuild.None;
|
||||
}
|
||||
|
||||
|
|
@ -116,25 +114,23 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool OnGoldGiven(Mobile from, Gold dropped)
|
||||
{
|
||||
if (from is PlayerMobile && dropped.Amount == JoinCost)
|
||||
if (from is PlayerMobile pm && dropped.Amount == JoinCost)
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)from;
|
||||
|
||||
if (pm.NpcGuild == NpcGuild)
|
||||
{
|
||||
SayTo(from, 501047); // Thou art already a member of our guild.
|
||||
SayTo(pm, 501047); // Thou art already a member of our guild.
|
||||
}
|
||||
else if (pm.NpcGuild != NpcGuild.None)
|
||||
{
|
||||
SayTo(from, 501046); // Thou must resign from thy other guild first.
|
||||
SayTo(pm, 501046); // Thou must resign from thy other guild first.
|
||||
}
|
||||
else if (pm.GameTime < JoinGameAge || pm.CreationTime + JoinAge > DateTime.UtcNow)
|
||||
{
|
||||
SayTo(from, 501048); // You are too young to join my guild...
|
||||
SayTo(pm, 501048); // You are too young to join my guild...
|
||||
}
|
||||
else if (CheckCustomReqs(pm))
|
||||
{
|
||||
SayWelcomeTo(from);
|
||||
SayWelcomeTo(pm);
|
||||
|
||||
pm.NpcGuild = NpcGuild;
|
||||
pm.NpcGuildJoinTime = DateTime.UtcNow;
|
||||
|
|
|
|||
|
|
@ -77,14 +77,12 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
if (!e.Handled && from is PlayerMobile && from.InRange(Location, 2) && e.HasKeyword(0x1F)) // *disguise*
|
||||
if (!e.Handled && from is PlayerMobile pm && pm.InRange(Location, 2) && e.HasKeyword(0x1F)) // *disguise*
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)from;
|
||||
|
||||
if (pm.NpcGuild == NpcGuild.ThievesGuild)
|
||||
SayTo(from, 501839); // That particular item costs 700 gold pieces.
|
||||
SayTo(pm, 501839); // That particular item costs 700 gold pieces.
|
||||
else
|
||||
SayTo(from, 501838); // I don't know what you're talking about.
|
||||
SayTo(pm, 501838); // I don't know what you're talking about.
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
|
@ -94,13 +92,11 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool OnGoldGiven(Mobile from, Gold dropped)
|
||||
{
|
||||
if (from is PlayerMobile && dropped.Amount == 700)
|
||||
if (from is PlayerMobile pm && dropped.Amount == 700)
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)from;
|
||||
|
||||
if (pm.NpcGuild == NpcGuild.ThievesGuild)
|
||||
{
|
||||
from.AddToBackpack(new DisguiseKit());
|
||||
pm.AddToBackpack(new DisguiseKit());
|
||||
|
||||
dropped.Delete();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -69,9 +69,8 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if (dropped is HouseDeed)
|
||||
if (dropped is HouseDeed deed)
|
||||
{
|
||||
HouseDeed deed = (HouseDeed)dropped;
|
||||
int price = ComputePriceFor(deed);
|
||||
|
||||
if (price > 0)
|
||||
|
|
@ -98,9 +97,8 @@ namespace Server.Mobiles
|
|||
|
||||
public void Appraise_OnTarget(Mobile from, object obj)
|
||||
{
|
||||
if (obj is HouseDeed)
|
||||
if (obj is HouseDeed deed)
|
||||
{
|
||||
HouseDeed deed = (HouseDeed)obj;
|
||||
int price = ComputePriceFor(deed);
|
||||
|
||||
if (price > 0)
|
||||
|
|
@ -126,8 +124,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
int price = 0;
|
||||
|
||||
if (deed is SmallBrickHouseDeed || deed is StonePlasterHouseDeed || deed is FieldStoneHouseDeed ||
|
||||
deed is SmallBrickHouseDeed || deed is WoodHouseDeed || deed is WoodPlasterHouseDeed ||
|
||||
if (deed is SmallBrickHouseDeed || deed is StonePlasterHouseDeed || deed is FieldStoneHouseDeed || deed is WoodHouseDeed || deed is WoodPlasterHouseDeed ||
|
||||
deed is ThatchedRoofCottageDeed)
|
||||
price = 43800;
|
||||
else if (deed is BrickHouseDeed)
|
||||
|
|
|
|||
|
|
@ -47,9 +47,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override Item CreateBulkOrder(Mobile from, bool fromContextMenu)
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if (pm != null && pm.NextTailorBulkOrder == TimeSpan.Zero && (fromContextMenu || 0.2 > Utility.RandomDouble()))
|
||||
if (from is PlayerMobile pm && pm.NextTailorBulkOrder == TimeSpan.Zero && (fromContextMenu || 0.2 > Utility.RandomDouble()))
|
||||
{
|
||||
double theirSkill = pm.Skills[SkillName.Tailoring].Base;
|
||||
|
||||
|
|
@ -81,16 +79,16 @@ namespace Server.Mobiles
|
|||
|
||||
public override TimeSpan GetNextBulkOrder(Mobile from)
|
||||
{
|
||||
if (from is PlayerMobile)
|
||||
return ((PlayerMobile)from).NextTailorBulkOrder;
|
||||
if (from is PlayerMobile mobile)
|
||||
return mobile.NextTailorBulkOrder;
|
||||
|
||||
return TimeSpan.Zero;
|
||||
}
|
||||
|
||||
public override void OnSuccessfulBulkOrderReceive(Mobile from)
|
||||
{
|
||||
if (Core.SE && from is PlayerMobile)
|
||||
((PlayerMobile)from).NextTailorBulkOrder = TimeSpan.Zero;
|
||||
if (Core.SE && from is PlayerMobile mobile)
|
||||
mobile.NextTailorBulkOrder = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -1272,7 +1272,7 @@ namespace Server.Items
|
|||
{
|
||||
Item item = list[i];
|
||||
|
||||
if (type.IsAssignableFrom(item.GetType()))
|
||||
if (type.IsInstanceOfType(item))
|
||||
{
|
||||
int need = amount - consumed;
|
||||
int theirAmount = item.Amount;
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ namespace Server
|
|||
|
||||
do
|
||||
{
|
||||
if (regionType.IsAssignableFrom(r.GetType()))
|
||||
if (regionType.IsInstanceOfType(r))
|
||||
return r;
|
||||
|
||||
r = r.Parent;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue