Fixes chaos damage bug with the spell system. Fixes various small other bugs. Fixes more merge cast type checks and uses default values.
This commit is contained in:
parent
9542c79ea4
commit
c155c82325
115 changed files with 644 additions and 1041 deletions
|
|
@ -138,7 +138,7 @@ namespace Server.Mobiles
|
|||
AddLoot(LootPack.Gems, 4);
|
||||
}
|
||||
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill)
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill = false)
|
||||
{
|
||||
double tamingChance = base.GetControlChance(m, useBaseSkill);
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill)
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill = false)
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill)
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill = false)
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill)
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill = false)
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ namespace Server.Mobiles
|
|||
return 0x2C8;
|
||||
}
|
||||
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill)
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill = false)
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ namespace Server.Mobiles
|
|||
return 0x21D;
|
||||
}
|
||||
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill)
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill = false)
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,9 +66,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;
|
||||
|
||||
|
|
@ -100,16 +98,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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -309,33 +309,31 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool CheckGold(Mobile from, Item dropped)
|
||||
{
|
||||
if (dropped is Gold)
|
||||
if (!(dropped is Gold g))
|
||||
return false;
|
||||
|
||||
if (g.Amount > 50)
|
||||
{
|
||||
Gold g = (Gold)dropped;
|
||||
PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "I cannot accept so large a tip!",
|
||||
from.NetState);
|
||||
}
|
||||
else
|
||||
{
|
||||
string tip = TipMessage;
|
||||
|
||||
if (g.Amount > 50)
|
||||
if (tip == null || (tip = tip.Trim()).Length == 0)
|
||||
{
|
||||
PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "I cannot accept so large a tip!",
|
||||
PrivateOverheadMessage(MessageType.Regular, 0x3B2, false,
|
||||
"It would not be fair of me to take your money and not offer you information in return.",
|
||||
from.NetState);
|
||||
}
|
||||
else
|
||||
{
|
||||
string tip = TipMessage;
|
||||
Direction = GetDirectionTo(from);
|
||||
PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, tip, from.NetState);
|
||||
|
||||
if (tip == null || (tip = tip.Trim()).Length == 0)
|
||||
{
|
||||
PrivateOverheadMessage(MessageType.Regular, 0x3B2, false,
|
||||
"It would not be fair of me to take your money and not offer you information in return.",
|
||||
from.NetState);
|
||||
}
|
||||
else
|
||||
{
|
||||
Direction = GetDirectionTo(from);
|
||||
PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, tip, from.NetState);
|
||||
|
||||
g.Delete();
|
||||
return true;
|
||||
}
|
||||
g.Delete();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,9 +107,9 @@ namespace Server.Mobiles
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!BaseHouse.NewVendorSystem && Parent is PlayerVendor)
|
||||
if (!BaseHouse.NewVendorSystem && Parent is PlayerVendor vendor)
|
||||
{
|
||||
BaseHouse house = ((PlayerVendor)Parent).House;
|
||||
BaseHouse house = vendor.House;
|
||||
|
||||
if (house != null && house.IsAosRules && !house.CheckAosStorage(1 + item.TotalItems + plusItems))
|
||||
{
|
||||
|
|
@ -155,9 +155,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
base.GetChildContextMenuEntries(from, list, item);
|
||||
|
||||
PlayerVendor pv = RootParent as PlayerVendor;
|
||||
|
||||
if (pv == null || pv.IsOwner(from))
|
||||
if (!(RootParent is PlayerVendor pv) || pv.IsOwner(from))
|
||||
return;
|
||||
|
||||
VendorItem vi = pv.GetVendorItem(item);
|
||||
|
|
@ -199,10 +197,8 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnSingleClickContained(Mobile from, Item item)
|
||||
{
|
||||
if (RootParent is PlayerVendor)
|
||||
if (RootParent is PlayerVendor vendor)
|
||||
{
|
||||
PlayerVendor vendor = (PlayerVendor)RootParent;
|
||||
|
||||
VendorItem vi = vendor.GetVendorItem(item);
|
||||
|
||||
if (vi != null)
|
||||
|
|
@ -985,9 +981,7 @@ namespace Server.Mobiles
|
|||
|
||||
public static void TryToBuy(Item item, Mobile from)
|
||||
{
|
||||
PlayerVendor vendor = item.RootParent as PlayerVendor;
|
||||
|
||||
if (vendor == null || !vendor.CanInteractWith(from, false))
|
||||
if (!(item.RootParent is PlayerVendor vendor) || !vendor.CanInteractWith(from, false))
|
||||
return;
|
||||
|
||||
if (vendor.IsOwner(from))
|
||||
|
|
@ -1330,7 +1324,8 @@ namespace Server.Mobiles
|
|||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (targeted is Item) TryToBuy((Item)targeted, from);
|
||||
if (targeted is Item item)
|
||||
TryToBuy(item, from);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1358,10 +1353,9 @@ namespace Server.Mobiles
|
|||
else
|
||||
firstWord = text;
|
||||
|
||||
int price;
|
||||
string description;
|
||||
|
||||
if (int.TryParse(firstWord, out price))
|
||||
if (int.TryParse(firstWord, out int price))
|
||||
{
|
||||
if (sep >= 0)
|
||||
description = text.Substring(sep + 1).Trim();
|
||||
|
|
@ -1397,7 +1391,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (item is Container)
|
||||
{
|
||||
if (item is LockableContainer && ((LockableContainer)item).Locked)
|
||||
if (item is LockableContainer container && container.Locked)
|
||||
m_Vendor.SayTo(from, 1043298); // Locked items may not be made not-for-sale.
|
||||
else if (item.Items.Count > 0)
|
||||
m_Vendor.SayTo(from, 1043299); // To be not for sale, all items in a container must be for sale.
|
||||
|
|
@ -1448,9 +1442,7 @@ namespace Server.Mobiles
|
|||
|
||||
text = text.Trim();
|
||||
|
||||
int amount;
|
||||
|
||||
if (!int.TryParse(text, out amount))
|
||||
if (!int.TryParse(text, out int amount))
|
||||
amount = 0;
|
||||
|
||||
GiveGold(from, amount);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue