Modernization Fixes & Updates to Default Values (#3)

This commit is contained in:
Kamron Batman 2018-10-28 00:33:16 -07:00 • committed by GitHub
parent 445eddff68
commit dcf64091b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
768 changed files with 10507 additions and 14196 deletions

View file

@ -35,7 +35,7 @@ namespace Server.Items
public int GetChargesFor(Mobile m)
{
int v = (int)(m.Skills[SkillName.Tailoring].Value / 5);
int v = (int)(m.Skills.Tailoring.Value / 5);
if (v < 16)
return 16;
@ -104,7 +104,7 @@ namespace Server.Items
else Amount--;
}
}
else if (from.Skills[SkillName.Tailoring].Value >= 80.0)
else if (from.Skills.Tailoring.Value >= 80.0)
{
bool isExceptional = clothing?.Quality == ClothingQuality.Exceptional ||
armor?.Quality == ArmorQuality.Exceptional ||

View file

@ -233,16 +233,16 @@ namespace Server.Items
if (qs is DarkTidesQuest)
{
QuestObjective obj = qs.FindObjective(typeof(CashBankCheckObjective));
QuestObjective obj = qs.FindObjective<CashBankCheckObjective>();
if (obj != null && !obj.Completed) obj.Complete();
if (obj?.Completed == false) obj.Complete();
}
if (qs is UzeraanTurmoilQuest)
{
QuestObjective obj = qs.FindObjective(typeof(Engines.Quests.Haven.CashBankCheckObjective));
if (obj != null && !obj.Completed) obj.Complete();
if (obj?.Completed == false) obj.Complete();
}
}
}

View file

@ -31,7 +31,7 @@ namespace Server.Items
{
from.SendLocalizedMessage(1040019); // The bola must be in your pack to use it.
}
else if (!from.CanBeginAction(typeof(Bola)))
else if (!from.CanBeginAction<Bola>())
{
from.SendLocalizedMessage(1049624); // You have to wait a few moments before you can use another bola!
}
@ -62,18 +62,8 @@ namespace Server.Items
}
}
private static void ReleaseBolaLock(object state)
private static void FinishThrow(Mobile from, Mobile to)
{
((Mobile)state).EndAction(typeof(Bola));
}
private static void FinishThrow(object state)
{
object[] states = (object[])state;
Mobile from = (Mobile)states[0];
Mobile to = (Mobile)states[1];
if (Core.AOS)
new Bola().MoveToWorld(to.Location, to.Map);
@ -99,7 +89,7 @@ namespace Server.Items
to.Damage(1);
Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(ReleaseBolaLock), from);
Timer.DelayCall(TimeSpan.FromSeconds(2.0), () => from.EndAction<Bola>());
}
private static bool HasFreeHands(Mobile from)
@ -197,7 +187,7 @@ namespace Server.Items
else if (!from.CanBeHarmful(to))
{
}
else if (from.BeginAction(typeof(Bola)))
else if (from.BeginAction<Bola>())
{
EtherealMount.StopMounting(from);
@ -209,8 +199,7 @@ namespace Server.Items
from.Animate(11, 5, 1, true, false, 0);
from.MovingEffect(to, 0x26AC, 10, 0, false, false);
Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(FinishThrow),
new object[] { from, to });
Timer.DelayCall(TimeSpan.FromSeconds(0.5), () => FinishThrow(from, to));
}
else
{

View file

@ -213,7 +213,7 @@ namespace Server.Items
int packetID = pvSrc.ReadByte();
if (!(World.FindItem(pvSrc.ReadInt32()) is BaseBulletinBoard board) || !board.CheckRange(from))
if (!(World.FindItem(pvSrc.ReadUInt32()) is BaseBulletinBoard board) || !board.CheckRange(from))
return;
switch (packetID)
@ -235,7 +235,7 @@ namespace Server.Items
public static void BBRequestContent(Mobile from, BaseBulletinBoard board, PacketReader pvSrc)
{
if (!(World.FindItem(pvSrc.ReadInt32()) is BulletinMessage msg) || msg.Parent != board)
if (!(World.FindItem(pvSrc.ReadUInt32()) is BulletinMessage msg) || msg.Parent != board)
return;
from.Send(new BBMessageContent(board, msg));
@ -243,7 +243,7 @@ namespace Server.Items
public static void BBRequestHeader(Mobile from, BaseBulletinBoard board, PacketReader pvSrc)
{
if (!(World.FindItem(pvSrc.ReadInt32()) is BulletinMessage msg) || msg.Parent != board)
if (!(World.FindItem(pvSrc.ReadUInt32()) is BulletinMessage msg) || msg.Parent != board)
return;
from.Send(new BBMessageHeader(board, msg));
@ -251,7 +251,7 @@ namespace Server.Items
public static void BBPostMessage(Mobile from, BaseBulletinBoard board, PacketReader pvSrc)
{
BulletinMessage thread = World.FindItem(pvSrc.ReadInt32()) as BulletinMessage;
BulletinMessage thread = World.FindItem(pvSrc.ReadUInt32()) as BulletinMessage;
if (thread != null && thread.Parent != board)
thread = null;
@ -292,7 +292,7 @@ namespace Server.Items
public static void BBRemoveMessage(Mobile from, BaseBulletinBoard board, PacketReader pvSrc)
{
if (!(World.FindItem(pvSrc.ReadInt32()) is BulletinMessage msg) || msg.Parent != board)
if (!(World.FindItem(pvSrc.ReadUInt32()) is BulletinMessage msg) || msg.Parent != board)
return;
if (from.AccessLevel < AccessLevel.GameMaster && msg.Poster != from)

View file

@ -25,7 +25,7 @@ namespace Server.Items
return;
}
double tinkerSkill = from.Skills[SkillName.Tinkering].Value;
double tinkerSkill = from.Skills.Tinkering.Value;
if (tinkerSkill < 60.0)
{

View file

@ -861,10 +861,7 @@ namespace Server.Items
public bool GetRestoreInfo(Item item, ref Point3D loc)
{
if (m_RestoreTable == null || item == null)
return false;
return m_RestoreTable.TryGetValue(item, out loc);
return item != null && m_RestoreTable?.TryGetValue(item, out loc) == true;
}
public void SetRestoreInfo(Item item, Point3D loc)
@ -1026,8 +1023,8 @@ namespace Server.Items
if (qs is UzeraanTurmoilQuest)
{
if (qs.FindObjective(typeof(GetDaemonBoneObjective)) is GetDaemonBoneObjective obj &&
obj.CorpseWithBone == this && (!obj.Completed || UzeraanTurmoilQuest.HasLostDaemonBone(player)))
GetDaemonBoneObjective obj = qs.FindObjective<GetDaemonBoneObjective>();
if (obj?.CorpseWithBone == this && (!obj.Completed || UzeraanTurmoilQuest.HasLostDaemonBone(player)))
{
Item bone = new QuestDaemonBone();
@ -1052,8 +1049,8 @@ namespace Server.Items
}
else if (qs is TheSummoningQuest)
{
if (qs.FindObjective(typeof(VanquishDaemonObjective)) is VanquishDaemonObjective obj &&
obj.Completed && obj.CorpseWithSkull == this)
VanquishDaemonObjective obj = qs.FindObjective<VanquishDaemonObjective>();
if (obj?.Completed == true && obj.CorpseWithSkull == this)
{
GoldenSkull sk = new GoldenSkull();

View file

@ -216,7 +216,7 @@ namespace Server.Items
private IEntity ReadEntity(GenericReader reader)
{
return World.FindEntity(reader.ReadInt());
return World.FindEntity(reader.ReadUInt());
}
public override void Deserialize(GenericReader reader)

View file

@ -173,22 +173,17 @@ namespace Server.Items
IEntity to = p as IEntity ?? new Entity(Serial.Zero, new Point3D(p), Map);
Effects.SendMovingEffect(from, to, ItemID, 7, 0, false, false, Hue, 0);
Effects.SendMovingEffect(from, to, ItemID, 7, 0, false, false, Hue);
Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(FirebombReposition_OnTick),
new object[] { p, Map });
Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => FirebombReposition_OnTick(p, Map));
Internalize();
}
private void FirebombReposition_OnTick(object state)
private void FirebombReposition_OnTick(IPoint3D p, Map map)
{
if (Deleted)
return;
object[] states = (object[])state;
IPoint3D p = (IPoint3D)states[0];
Map map = (Map)states[1];
MoveToWorld(new Point3D(p), map);
}

View file

@ -71,15 +71,17 @@ namespace Server.Items
int y = p.Y - 2 + Utility.Random(5);
int z = p.Z;
if (!f.CanFit(x, y, z, 1, false, false, true))
if (!f.CanFit(x, y, z, 1, false, false))
{
z = f.GetAverageZ(x, y);
if (!f.CanFit(x, y, z, 1, false, false, true))
if (!f.CanFit(x, y, z, 1, false, false))
continue;
}
new Blood().MoveToWorld(new Point3D(x, y, z), f);
Point3D loc = f.GetRandomNearbyLocation(p, 2, -2, 4, 1);
new Blood().MoveToWorld(loc, f);
}
}
@ -110,4 +112,4 @@ namespace Server.Items
ItemID = 4702;
}
}
}
}

View file

@ -35,7 +35,7 @@ namespace Server.Items
{
if (from.InRange(GetWorldLocation(), 1))
{
from.CloseGump(typeof(HairDyeGump));
from.CloseGump<HairDyeGump>();
from.SendGump(new HairDyeGump(this));
}
else

View file

@ -68,7 +68,7 @@ namespace Server.Items
if (!CheckUse(this, from))
return;
if (from.FindGump(typeof(InternalGump)) == null)
if (!from.HasGump<InternalGump>())
from.SendGump(new InternalGump(this));
if (m_Command != DecorateCommand.None)
@ -252,7 +252,7 @@ namespace Server.Items
protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType)
{
if (cancelType == TargetCancelType.Canceled)
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
}
private static void Turn(Item item, Mobile from)

View file

@ -523,7 +523,7 @@ namespace Server.Items
public PlayerBBGump( Mobile from, BaseHouse house, BasePlayerBB board, int page ) : base( 50, 10 )
{
from.CloseGump( typeof( PlayerBBGump ) );
from.CloseGump<PlayerBBGump>();
m_Page = page;
m_From = from;

View file

@ -76,8 +76,7 @@ namespace Server.Items
}
else
{
bool vendor, contract;
BaseHouse.IsThereVendor(from.Location, from.Map, out vendor, out contract);
BaseHouse.IsThereVendor(from.Location, from.Map, out bool vendor, out bool contract);
if (vendor)
{

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Gumps;
using Server.Network;
@ -57,7 +58,7 @@ namespace Server.Items
{
private static readonly TimeSpan m_UseTimeout = TimeSpan.FromMinutes(2.0);
private Hashtable m_DamageTable = new Hashtable();
private Dictionary<Mobile, DamageTimer> m_DamageTable = new Dictionary<Mobile, DamageTimer>();
private DateTime m_LastUse;
private int m_SideLength;
@ -167,7 +168,7 @@ namespace Server.Items
if (m_User != null)
{
m_User.CloseGump(typeof(GameGump));
m_User.CloseGump<GameGump>();
m_User = null;
}
}
@ -188,7 +189,7 @@ namespace Server.Items
if (m_User.Deleted || m_User.Map != Map || !m_User.InRange(this, 3)
|| m_User.NetState == null || DateTime.UtcNow - m_LastUse >= m_UseTimeout)
{
m_User.CloseGump(typeof(GameGump));
m_User.CloseGump<GameGump>();
}
else
{
@ -546,4 +547,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -37,7 +37,7 @@ namespace Server.Items
}
else
{
from.CloseGump( typeof( PromotionalTokenGump ) );
from.CloseGump<PromotionalTokenGump>();
from.SendGump( new PromotionalTokenGump( this ) );
}
}
@ -51,7 +51,7 @@ namespace Server.Items
else if ( parent is Mobile mobile )
m = mobile;
m?.CloseGump( typeof( PromotionalTokenGump ) );
m?.CloseGump<PromotionalTokenGump>();
}
public override void Serialize( GenericWriter writer )

View file

@ -50,7 +50,7 @@ namespace Server.Items
{
if (m is PlayerMobile)
if (!Utility.InRange(m.Location, Location, 1) && Utility.InRange(oldLocation, Location, 1))
m.CloseGump(typeof(MoongateGump));
m.CloseGump<MoongateGump>();
}
public bool UseGate(Mobile m)
@ -73,7 +73,7 @@ namespace Server.Items
return false;
}
m.CloseGump(typeof(MoongateGump));
m.CloseGump<MoongateGump>();
m.SendGump(new MoongateGump(m, this));
if (!m.Hidden || m.AccessLevel == AccessLevel.Player)

View file

@ -36,7 +36,7 @@ namespace Server.Items
{
if (from.InRange(GetWorldLocation(), 1))
{
from.CloseGump(typeof(SpecialBeardDyeGump));
from.CloseGump<SpecialBeardDyeGump>();
from.SendGump(new SpecialBeardDyeGump(this));
}
else

View file

@ -36,7 +36,7 @@ namespace Server.Items
{
if (from.InRange(GetWorldLocation(), 1))
{
from.CloseGump(typeof(SpecialHairDyeGump));
from.CloseGump<SpecialHairDyeGump>();
from.SendGump(new SpecialHairDyeGump(this));
}
else

View file

@ -392,11 +392,6 @@ namespace Server.Items
}
}
private void EndMessageLock(object state)
{
((Mobile)state).EndAction(this);
}
public override bool CanTeleport(Mobile m)
{
if (!base.CanTeleport(m))
@ -415,7 +410,7 @@ namespace Server.Items
m.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, m_MessageNumber, null,
""));
Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(EndMessageLock), m);
Timer.DelayCall(TimeSpan.FromSeconds(5.0), () => m.EndAction(this));
}
return false;

View file

@ -32,11 +32,11 @@ namespace Server.Items
{
from.SendLocalizedMessage(1010465); // You cannot disguise yourself while holding a sigil.
}
else if (!from.CanBeginAction(typeof(IncognitoSpell)))
else if (!from.CanBeginAction<IncognitoSpell>())
{
from.SendLocalizedMessage(501698); // You cannot disguise yourself while incognitoed.
}
else if (!from.CanBeginAction(typeof(PolymorphSpell)))
else if (!from.CanBeginAction<PolymorphSpell>())
{
from.SendLocalizedMessage(501699); // You cannot disguise yourself while polymorphed.
}