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

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Network;
namespace Server.Items
@ -87,14 +88,14 @@ namespace Server.Items
}
}
private Hashtable m_Entries;
private Dictionary<Mobile, ScoreEntry> m_Entries;
private ScoreEntry GetEntryFor( Mobile from )
{
if ( m_Entries == null )
m_Entries = new Hashtable();
m_Entries = new Dictionary<Mobile, ScoreEntry>();
ScoreEntry e = (ScoreEntry)m_Entries[from];
ScoreEntry e = m_Entries[from];
if ( e == null )
m_Entries[from] = e = new ScoreEntry();

View file

@ -1,4 +1,3 @@
using System.Collections;
using System.Collections.Generic;
using Server.Multis;
@ -140,11 +139,11 @@ namespace Server.Items
}
}
ArrayList doors = house.Doors;
List<BaseDoor> doors = house.Doors;
for (int i = 0; i < doors.Count; ++i)
{
BaseDoor door = doors[i] as BaseDoor;
BaseDoor door = doors[i];
Point3D doorLoc = door.GetWorldLocation();
int doorHeight = door.ItemData.CalcHeight;

View file

@ -1,4 +1,3 @@
using System.Collections;
using System.Collections.Generic;
using Server.Multis;
@ -250,11 +249,11 @@ namespace Server.Items
if (house != null)
{
ArrayList doors = house.Doors;
List<BaseDoor> doors = house.Doors;
for (int i = 0; i < doors.Count; ++i)
{
BaseDoor door = doors[i] as BaseDoor;
BaseDoor door = doors[i];
if (door != null && door.Open)
return AddonFitResult.DoorsNotClosed;

View file

@ -71,11 +71,11 @@ namespace Server.Items
if (IsWorking)
return;
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(FinishWorking_Callback), from);
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), FinishWorking_Callback, from);
UpdateStage();
}
private void FinishWorking_Callback(object state)
private void FinishWorking_Callback(Mobile from)
{
if (m_Timer != null)
{
@ -83,11 +83,10 @@ namespace Server.Items
m_Timer = null;
}
if (state is Mobile from && !from.Deleted && !Deleted && IsFull)
if (from?.Deleted == false && !Deleted && IsFull)
{
SackFlour flour = new SackFlour();
SackFlour flour = new SackFlour { ItemID = Utility.RandomBool() ? 4153 : 4165 };
flour.ItemID = Utility.RandomBool() ? 4153 : 4165;
if (from.PlaceInBackpack(flour))
{

View file

@ -58,11 +58,11 @@ namespace Server.Items
if (IsWorking)
return;
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(FinishWorking_Callback), from);
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), FinishWorking_Callback, from);
UpdateStage();
}
private void FinishWorking_Callback(object state)
private void FinishWorking_Callback(Mobile from)
{
if (m_Timer != null)
{
@ -70,7 +70,7 @@ namespace Server.Items
m_Timer = null;
}
if (state is Mobile from && !from.Deleted && !Deleted && IsFull)
if (from?.Deleted == false && !Deleted && IsFull)
{
SackFlour flour = new SackFlour();

View file

@ -78,7 +78,7 @@ namespace Server.Items
SendLocalizedMessageTo(from, 501816); // You are too far away to do that.
else if (Swinging)
SendLocalizedMessageTo(from, 501815); // You have to wait until it stops swinging.
else if (from.Skills[SkillName.Stealing].Base >= MaxSkill)
else if (from.Skills.Stealing.Base >= MaxSkill)
SendLocalizedMessageTo(from,
501830); // Your ability to steal cannot improve any further by simply practicing on a dummy.
else if (from.Mounted)

View file

@ -14,7 +14,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (from.BeginAction(typeof(RejuvinationAddonComponent)))
if (from.BeginAction<RejuvinationAddonComponent>())
{
from.FixedEffect(0x373A, 1, 16);
@ -38,19 +38,13 @@ namespace Server.Items
SendLocalizedMessageTo(from, 500803); // You feel as though you've slept for days!
}
Timer.DelayCall(TimeSpan.FromHours(2.0), new TimerStateCallback(ReleaseUseLock_Callback),
new object[] { from, random });
Timer.DelayCall(TimeSpan.FromHours(2.0), () => ReleaseUseLock_Callback(from, random));
}
}
public virtual void ReleaseUseLock_Callback(object state)
public virtual void ReleaseUseLock_Callback(Mobile from, int random)
{
object[] states = (object[])state;
Mobile from = (Mobile)states[0];
int random = (int)states[1];
from.EndAction(typeof(RejuvinationAddonComponent));
from.EndAction<RejuvinationAddonComponent>();
if (random == 4)
{

View file

@ -15,7 +15,7 @@ namespace Server.Items
public override BaseAddonDeed Deed => new WaterTroughEastDeed();
public int Quantity
int IHasQuantity.Quantity
{
get => 500;
set { }

View file

@ -15,7 +15,7 @@ namespace Server.Items
public override BaseAddonDeed Deed => new WaterTroughSouthDeed();
public int Quantity
int IHasQuantity.Quantity
{
get => 500;
set { }