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

@ -148,7 +148,7 @@ namespace Server.Engines.MLQuests.Definitions
// The ability is awarded regardless of blacksmithy skill
pm.AcquireRecipe(32);
if (pm.Skills[SkillName.Blacksmith].Base < 45.0) // TODO: Verify threshold
if (pm.Skills.Blacksmith.Base < 45.0) // TODO: Verify threshold
pm.SendLocalizedMessage(
1075005); // You observe carefully but you can't grasp the complexities of smithing a bone handled machete.
else

View file

@ -161,7 +161,7 @@ namespace Server.Engines.MLQuests.Definitions
SetDex(70, 80);
SetInt(80, 90);
Hue = Utility.RandomSkinHue();
Hue = Race.Human.RandomSkinHue();
Female = true;
Body = 401;

View file

@ -284,12 +284,12 @@ namespace Server.Engines.MLQuests.Gumps
*/
public static void CloseOtherGumps(PlayerMobile pm)
{
pm.CloseGump(typeof(InfoNPCGump));
pm.CloseGump(typeof(QuestRewardGump));
pm.CloseGump(typeof(QuestConversationGump));
pm.CloseGump(typeof(QuestReportBackGump));
pm.CloseGump<InfoNPCGump>();
pm.CloseGump<QuestRewardGump>();
pm.CloseGump<QuestConversationGump>();
pm.CloseGump<QuestReportBackGump>();
//pm.CloseGump( typeof( UnknownGump807 ) );
pm.CloseGump(typeof(QuestCancelConfirmGump));
pm.CloseGump<QuestCancelConfirmGump>();
}
}
}

View file

@ -26,7 +26,7 @@ namespace Server.Engines.MLQuests.Gumps
if (closeGumps)
{
CloseOtherGumps(pm);
pm.CloseGump(typeof(QuestLogDetailedGump));
pm.CloseGump<QuestLogDetailedGump>();
}
SetTitle(quest.Title);

View file

@ -23,8 +23,8 @@ namespace Server.Engines.MLQuests.Gumps
if (closeGumps)
{
pm.CloseGump(typeof(QuestLogGump));
pm.CloseGump(typeof(QuestLogDetailedGump));
pm.CloseGump<QuestLogGump>();
pm.CloseGump<QuestLogDetailedGump>();
}
RegisterButton(ButtonPosition.Right, ButtonGraphic.Okay, 3);

View file

@ -16,7 +16,7 @@ namespace Server.Engines.MLQuests.Gumps
m_Quester = quester;
CloseOtherGumps(pm);
pm.CloseGump(typeof(QuestOfferGump));
pm.CloseGump<QuestOfferGump>();
SetTitle(quest.Title);
RegisterButton(ButtonPosition.Left, ButtonGraphic.Accept, 1);

View file

@ -19,8 +19,6 @@ namespace Server.Engines.MLQuests.Gumps
public class RaceChangeConfirmGump : Gump
{
public static readonly Type Type = typeof(RaceChangeConfirmGump);
private static Dictionary<NetState, RaceChangeState> m_Pending;
private PlayerMobile m_From;
@ -30,7 +28,7 @@ namespace Server.Engines.MLQuests.Gumps
public RaceChangeConfirmGump(IRaceChanger owner, PlayerMobile from, Race targetRace)
: base(50, 50)
{
from.CloseGump(Type);
from.CloseGump<RaceChangeConfirmGump>();
m_Owner = owner;
m_From = from;
@ -152,8 +150,8 @@ namespace Server.Engines.MLQuests.Gumps
from.SendLocalizedMessage(1073646); // Only the living may proceed...
else if (from.Mounted)
from.SendLocalizedMessage(1073647); // You may not continue while mounted...
else if (!from.CanBeginAction(typeof(PolymorphSpell)) || DisguiseTimers.IsDisguised(from) ||
AnimalForm.UnderTransformation(from) || !from.CanBeginAction(typeof(IncognitoSpell)) ||
else if (!from.CanBeginAction<PolymorphSpell>() || DisguiseTimers.IsDisguised(from) ||
AnimalForm.UnderTransformation(from) || !from.CanBeginAction<IncognitoSpell>() ||
from.IsBodyMod) // TODO: Does this cover everything?
from.SendLocalizedMessage(1073648); // You may only proceed while in your original state...
else if (from.Spell != null && from.Spell.IsCasting)
@ -233,7 +231,6 @@ namespace Server.Engines.MLQuests.Gumps
private class RaceChangeState
{
private static readonly TimeSpan m_TimeoutDelay = TimeSpan.FromMinutes(1);
private static readonly TimerStateCallback<NetState> m_TimeoutCallback = Timeout;
public IRaceChanger m_Owner;
public Race m_TargetRace;
@ -243,7 +240,7 @@ namespace Server.Engines.MLQuests.Gumps
{
m_Owner = owner;
m_TargetRace = targetRace;
m_Timeout = Timer.DelayCall(m_TimeoutDelay, m_TimeoutCallback, ns);
m_Timeout = Timer.DelayCall(m_TimeoutDelay, Timeout, ns);
}
}
}

View file

@ -129,9 +129,7 @@ namespace Server.Engines.MLQuests
while (checkQuest != null)
{
DateTime nextAvailable;
if (context.HasDoneQuest(checkQuest, out nextAvailable))
if (context.HasDoneQuest(checkQuest, out DateTime nextAvailable))
{
if (checkQuest.OneTimeOnly)
{

View file

@ -459,7 +459,7 @@ namespace Server.Engines.MLQuests
MLQuest quest = MLQuestSystem.ReadQuestRef(reader);
// TODO: Serialize quester TYPE too, the quest giver reference then becomes optional (only for escorts)
IQuestGiver quester = World.FindEntity(reader.ReadInt()) as IQuestGiver;
IQuestGiver quester = World.FindEntity(reader.ReadUInt()) as IQuestGiver;
bool claimReward = reader.ReadBool();
int objectives = reader.ReadInt();

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Server.Commands;
@ -158,9 +157,8 @@ namespace Server.Engines.MLQuests
}
Type index = ScriptCompiler.FindTypeByName(e.GetString(0));
MLQuest quest;
if (index == null || !Quests.TryGetValue(index, out quest))
if (index == null || !Quests.TryGetValue(index, out MLQuest quest))
{
m.SendMessage("Invalid quest type name.");
return;
@ -232,7 +230,7 @@ namespace Server.Engines.MLQuests
{
Mobile m = e.Mobile;
ArrayList found = new ArrayList();
List<object> found = new List<object>();
foreach (Item item in World.Items.Values)
if (item.QuestItem)
@ -303,10 +301,7 @@ namespace Server.Engines.MLQuests
MLQuestContext context = GetContext(pm);
MLQuest quest;
MLQuestInstance entry;
if (!FindQuest(quester, pm, context, out quest, out entry))
if (!FindQuest(quester, pm, context, out MLQuest quest, out MLQuestInstance entry))
{
Tell(quester, pm, 1080107); // I'm sorry, I have nothing for you at this time.
return;

View file

@ -79,7 +79,7 @@ namespace Server.Engines.MLQuests.Mobiles
public void TryTalkTo(Mobile from, bool fromClick)
{
if (!from.Hidden && !from.HasGump(typeOfRaceChangeConfirmGump) &&
if (!from.Hidden && !from.HasGump<RaceChangeConfirmGump>() &&
!RaceChangeConfirmGump.IsPending(from.NetState) && CanTalkTo(from))
TalkTo(from as PlayerMobile);
else if (fromClick)

View file

@ -4,6 +4,7 @@ using Server.Mobiles;
namespace Server.Engines.MLQuests.Objectives
{
[Flags]
public enum GainSkillObjectiveFlags : byte
{
None = 0x00,
@ -15,17 +16,7 @@ namespace Server.Engines.MLQuests.Objectives
{
private GainSkillObjectiveFlags m_Flags;
public GainSkillObjective()
: this(SkillName.Alchemy, 0)
{
}
public GainSkillObjective(SkillName skill, int thresholdFixed)
: this(skill, thresholdFixed, false, false)
{
}
public GainSkillObjective(SkillName skill, int thresholdFixed, bool useReal, bool accelerate)
public GainSkillObjective(SkillName skill = SkillName.Alchemy, int thresholdFixed = 0, bool useReal = false, bool accelerate = false)
{
Skill = skill;
ThresholdFixed = thresholdFixed;
@ -74,10 +65,7 @@ namespace Server.Engines.MLQuests.Objectives
int skillLabel = AosSkillBonuses.GetLabel(Skill);
string args;
if (ThresholdFixed % 10 == 0)
args = $"#{skillLabel}\t{ThresholdFixed / 10}"; // as seen on OSI
else
args = $"#{skillLabel}\t{(double)ThresholdFixed / 10:0.0}"; // for non-integer skill levels
args = ThresholdFixed % 10 == 0 ? $"#{skillLabel}\t{ThresholdFixed / 10}" : $"#{skillLabel}\t{(double)ThresholdFixed / 10:0.0}";
g.AddHtmlLocalized(98, y, 312, 16, 1077485, args, 0x15F90, false, false); // Increase ~1_SKILL~ to ~2_VALUE~
y += 16;
@ -171,4 +159,4 @@ namespace Server.Engines.MLQuests.Objectives
}
}
}
}
}