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,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Commands;
using Server.Targeting;
@ -7,7 +6,7 @@ using Server.Targeting;
namespace Server.Factions
{
[CustomEnum(new[] { "Britain", "Magincia", "Minoc", "Moonglow", "Skara Brae", "Trinsic", "Vesper", "Yew" })]
public abstract class Town : IComparable
public abstract class Town : IComparable, IComparable<Town>
{
public const int SilverCaptureBonus = 10000;
@ -133,6 +132,11 @@ namespace Server.Factions
public static List<Town> Towns => Reflector.Towns;
public int CompareTo(Town other)
{
return Definition.Sort - other.Definition.Sort;
}
public int CompareTo(object obj)
{
return Definition.Sort - ((Town)obj).Definition.Sort;
@ -225,12 +229,12 @@ namespace Server.Factions
if (Silver + flow < 0)
{
ArrayList toDelete = BuildFinanceList();
List<Mobile> toDelete = BuildFinanceList();
while (Silver + flow < 0 && toDelete.Count > 0)
{
int index = Utility.Random(toDelete.Count);
Mobile mob = (Mobile)toDelete[index];
Mobile mob = toDelete[index];
mob.Delete();
@ -242,19 +246,15 @@ namespace Server.Factions
Silver += flow;
}
public ArrayList BuildFinanceList()
public List<Mobile> BuildFinanceList()
{
ArrayList list = new ArrayList();
List<Mobile> list = new List<Mobile>();
List<VendorList> vendorLists = VendorLists;
for (int i = 0; i < VendorLists.Count; ++i)
list.AddRange(VendorLists[i].Vendors);
for (int i = 0; i < vendorLists.Count; ++i)
list.AddRange(vendorLists[i].Vendors);
List<GuardList> guardLists = GuardLists;
for (int i = 0; i < guardLists.Count; ++i)
list.AddRange(guardLists[i].Guards);
for (int i = 0; i < GuardLists.Count; ++i)
list.AddRange(GuardLists[i].Guards);
return list;
}