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

@ -11,7 +11,7 @@ namespace Server.Mobiles
SpeechHue = Utility.RandomDyedHue();
Hue = Utility.RandomSkinHue();
Hue = Race.Human.RandomSkinHue();
if (Female = Utility.RandomBool())
{

View file

@ -15,7 +15,7 @@ namespace Server.Mobiles
SpeechHue = Utility.RandomDyedHue();
Title = "the artist";
Hue = Utility.RandomSkinHue();
Hue = Race.Human.RandomSkinHue();
if (Female = Utility.RandomBool())

View file

@ -127,7 +127,7 @@ namespace Server.Mobiles
}
}
public static Hashtable EscortTable{ get; } = new Hashtable();
public static Dictionary<Mobile, BaseEscortable> EscortTable{ get; } = new Dictionary<Mobile, BaseEscortable>();
protected override List<MLQuest> ConstructQuestList()
{
@ -200,7 +200,7 @@ namespace Server.Mobiles
SetDex(90, 100);
SetInt(15, 25);
Hue = Utility.RandomSkinHue();
Hue = Race.Human.RandomSkinHue();
if (Female = Utility.RandomBool())
{
@ -263,9 +263,9 @@ namespace Server.Mobiles
if (escorter != null || !m.Alive)
return false;
BaseEscortable escortable = (BaseEscortable)EscortTable[m];
BaseEscortable escortable = EscortTable[m];
if (escortable != null && !escortable.Deleted && escortable.GetEscorter() == m)
if (escortable?.Deleted == false && escortable.GetEscorter() == m)
{
Say("I see you already have an escort.");
return false;
@ -299,13 +299,7 @@ namespace Server.Mobiles
public override bool HandlesOnSpeech(Mobile from)
{
if (MLQuestSystem.Enabled)
return false;
if (from.InRange(Location, 3))
return true;
return base.HandlesOnSpeech(from);
return !MLQuestSystem.Enabled && (from.InRange(Location, 3) || base.HandlesOnSpeech(from));
}
public override void OnSpeech(SpeechEventArgs e)
@ -454,10 +448,7 @@ namespace Server.Mobiles
m_Destination = null;
m_DestinationString = null;
Container cont = escorter.Backpack;
if (cont == null)
cont = escorter.BankBox;
Container cont = escorter.Backpack ?? escorter.BankBox;
Gold gold = new Gold(500, 1000);
@ -589,7 +580,7 @@ namespace Server.Mobiles
}
if (escorter == from)
list.Add(new AbandonEscortEntry(this, from));
list.Add(new AbandonEscortEntry(this));
}
base.AddCustomContextEntries(from, list);
@ -597,9 +588,7 @@ namespace Server.Mobiles
public virtual string[] GetPossibleDestinations()
{
if (!Core.ML)
return m_TownNames;
return m_MLTownNames;
return Core.ML ? m_MLTownNames : m_TownNames;
}
public virtual string PickRandomDestination()
@ -660,24 +649,18 @@ namespace Server.Mobiles
public class EscortDestinationInfo
{
private static Hashtable m_Table;
private static Dictionary<string, EscortDestinationInfo> m_Table;
public EscortDestinationInfo(string name, Region region)
{
Name = name;
Region = region;
}
//private Rectangle2D[] m_Bounds;
public string Name{ get; }
public Region Region{ get; }
/*public Rectangle2D[] Bounds
{
get{ return m_Bounds; }
}*/
public bool Contains(Point3D p)
{
return Region.Contains(p);
@ -690,7 +673,7 @@ namespace Server.Mobiles
if (list.Count == 0)
return;
m_Table = new Hashtable();
m_Table = new Dictionary<string, EscortDestinationInfo>();
foreach (Region r in list)
{
@ -710,7 +693,7 @@ namespace Server.Mobiles
if (name == null || m_Table == null)
return null;
return (EscortDestinationInfo)m_Table[name];
return m_Table[name];
}
}
@ -752,14 +735,12 @@ namespace Server.Mobiles
public class AbandonEscortEntry : ContextMenuEntry
{
private Mobile m_From;
private BaseEscortable m_Mobile;
public AbandonEscortEntry(BaseEscortable m, Mobile from)
public AbandonEscortEntry(BaseEscortable m)
: base(6102, 3)
{
m_Mobile = m;
m_From = from;
}
public override void OnClick()
@ -767,4 +748,4 @@ namespace Server.Mobiles
m_Mobile.Delete(); // OSI just seems to delete instantly
}
}
}
}

View file

@ -16,7 +16,7 @@ namespace Server.Mobiles
SetSkill(SkillName.Snooping, 65, 88);
SetSkill(SkillName.Stealing, 65, 88);
Hue = Utility.RandomSkinHue();
Hue = Race.Human.RandomSkinHue();
if (Female = Utility.RandomBool())
{

View file

@ -14,7 +14,7 @@ namespace Server.Mobiles
SpeechHue = Utility.RandomDyedHue();
Hue = Utility.RandomSkinHue();
Hue = Race.Human.RandomSkinHue();
Blessed = true;

View file

@ -48,29 +48,10 @@ namespace Server.Mobiles
else
AddItem(new Shoes(lowHue));
//if ( !Female )
//AddItem( new BodySash( lowHue ) );
int randomHair = Utility.Random(4);
HairItemID = randomHair == 4 ? 0x203B : 0x2048 + randomHair;
//AddItem( new Cloak( GetRandomHue() ) );
//if ( !Female )
//AddItem( new Longsword() );
switch (Utility.Random(4))
{
case 0:
AddItem(new ShortHair(Utility.RandomHairHue()));
break;
case 1:
AddItem(new TwoPigTails(Utility.RandomHairHue()));
break;
case 2:
AddItem(new ReceedingHair(Utility.RandomHairHue()));
break;
case 3:
AddItem(new KrisnaHair(Utility.RandomHairHue()));
break;
}
HairHue = Race.RandomHairHue();
PackGold(200, 250);
}

View file

@ -20,7 +20,7 @@ namespace Server.Mobiles
SpeechHue = Utility.RandomDyedHue();
Hue = Utility.RandomSkinHue();
Hue = Race.Human.RandomSkinHue();
if (Female = Utility.RandomBool())
{

View file

@ -18,7 +18,7 @@ namespace Server.Mobiles
SpeechHue = Utility.RandomDyedHue();
Hue = Utility.RandomSkinHue();
Hue = Race.Human.RandomSkinHue();
if (Female = Utility.RandomBool())
{

View file

@ -12,7 +12,7 @@ namespace Server.Mobiles
SpeechHue = Utility.RandomDyedHue();
Title = "the sculptor";
Hue = Utility.RandomSkinHue();
Hue = Race.Human.RandomSkinHue();
if (Female = Utility.RandomBool())
{

View file

@ -131,9 +131,7 @@ namespace Server.Mobiles
public override void OnResponse(Mobile from, string text)
{
TimeSpan ts;
if (!TimeSpan.TryParse(text, out ts))
if (!TimeSpan.TryParse(text, out TimeSpan ts))
{
from.SendMessage("Value was not properly formatted. Use: <hours:minutes:seconds>");
from.SendGump(new TownCrierGump(from, m_Owner));
@ -211,7 +209,7 @@ namespace Server.Mobiles
m_From = from;
m_Owner = owner;
from.CloseGump(typeof(TownCrierGump));
from.CloseGump<TownCrierGump>();
AddPage(0);
@ -319,7 +317,7 @@ namespace Server.Mobiles
InitStats(100, 100, 25);
Title = "the town crier";
Hue = Utility.RandomSkinHue();
Hue = Race.Human.RandomSkinHue();
if (!Core.AOS)
NameHue = 0x35;
@ -461,29 +459,24 @@ namespace Server.Mobiles
}
else if (m_NewsTimer == null)
{
int index = 0;
m_NewsTimer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(3.0),
new TimerStateCallback(ShoutNews_Callback), new object[] { tce, 0 });
() => ShoutNews_Callback(tce, index));
PublicOverheadMessage(MessageType.Regular, 0x3B2, 502976); // Hear ye! Hear ye!
}
}
private void ShoutNews_Callback(object state)
private void ShoutNews_Callback(TownCrierEntry tce, int index)
{
object[] states = (object[])state;
TownCrierEntry tce = (TownCrierEntry)states[0];
int index = (int)states[1];
if (index < 0 || index >= tce.Lines.Length)
{
m_NewsTimer?.Stop();
m_NewsTimer = null;
}
else
{
PublicOverheadMessage(MessageType.Regular, 0x3B2, false, tce.Lines[index]);
states[1] = index + 1;
}
}
@ -514,8 +507,9 @@ namespace Server.Mobiles
}
else
{
int index = 0;
m_NewsTimer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(3.0),
new TimerStateCallback(ShoutNews_Callback), new object[] { tce, 0 });
() => ShoutNews_Callback(tce, index));
PublicOverheadMessage(MessageType.Regular, 0x3B2, 502978); // Some of the latest news!
}