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
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue