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,39 +1,14 @@
/***************************************************************************
* ScrollofAlacrity.cs
* -------------------
* begin : June 1, 2009
* copyright : (C) Shai'Tan Malkier aka Callandor2k
* email : ShaiTanMalkier@gmail.com
*
* $Id: ScrollofAlacrity.cs 1 2009-06-1 04:28:39Z Callandor2k $
*
***************************************************************************/
/***************************************************************************
*
* This Script/File is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using System;
using System.Collections;
using Server.Engines.MLQuests;
using Server.Engines.MLQuests.Objectives;
using Server.Mobiles;
namespace Server.Items
{
public class ScrollofAlacrity : SpecialScroll
{
private static Hashtable m_Table = new Hashtable();
public ScrollofAlacrity() : this(SkillName.Alchemy)
{
}
[Constructible]
public ScrollofAlacrity(SkillName skill) : base(skill, 0.0)
public ScrollofAlacrity(SkillName skill = SkillName.Alchemy) : base(skill, 0.0)
{
ItemID = 0x14EF;
Hue = 0x4AB;
@ -61,55 +36,41 @@ namespace Server.Items
public override bool CanUse(Mobile from)
{
if (!base.CanUse(from))
return false;
if (!(from is PlayerMobile pm))
if (!(base.CanUse(from) && from is PlayerMobile pm))
return false;
#region Mondain's Legacy
MLQuestContext context = MLQuestSystem.GetContext(pm);
/* to add when skillgain quests will be implemented
for (int i = pm.Quests.Count - 1; i >= 0; i--)
if (context != null)
{
BaseQuest quest = pm.Quests[i];
for (int j = quest.Objectives.Count - 1; j >= 0; j--)
foreach (MLQuestInstance instance in context.QuestInstances)
{
BaseObjective objective = quest.Objectives[j];
if (objective is ApprenticeObjective)
foreach (BaseObjectiveInstance objective in instance.Objectives)
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
if (!objective.Expired && objective is GainSkillObjectiveInstance objectiveInstance &&
objectiveInstance.Handles(Skill))
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
}
}
}
*/
#endregion
#region Scroll of Alacrity
if (pm.AcceleratedStart > DateTime.UtcNow)
{
from.SendLocalizedMessage(1077951); // You are already under the effect of an accelerated skillgain scroll.
return false;
}
#endregion
return true;
}
public override void Use(Mobile from)
{
if (!CanUse(from))
return;
if (!(from is PlayerMobile pm))
if (!(CanUse(from) && from is PlayerMobile pm))
return;
double tskill = from.Skills[Skill].Base;
@ -130,21 +91,17 @@ namespace Server.Items
Effects.SendTargetParticles(from, 0x373A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100);
pm.AcceleratedStart = DateTime.UtcNow + TimeSpan.FromMinutes(15);
m_Table[from] = Timer.DelayCall(TimeSpan.FromMinutes(15), new TimerStateCallback(Expire_Callback), from);
Timer.DelayCall(TimeSpan.FromMinutes(15), Expire_Callback, from);
pm.AcceleratedSkill = Skill;
Delete();
}
private static void Expire_Callback(object state)
// TODO: Handle this upon deserialization. Create Dictionary and serialize Mobile/Timers?
private static void Expire_Callback(Mobile m)
{
Mobile m = (Mobile)state;
m_Table.Remove(m);
m.PlaySound(0x1F8);
m.SendLocalizedMessage(
1077957); // The intense energy dissipates. You are no longer under the effects of an accelerated skillgain scroll.
}
@ -166,4 +123,4 @@ namespace Server.Items
Insured = false;
}
}
}
}

View file

@ -1,16 +1,14 @@
using System;
using Server.Engines.MLQuests;
using Server.Engines.MLQuests.Objectives;
using Server.Mobiles;
namespace Server.Items
{
public class ScrollofTranscendence : SpecialScroll
{
public ScrollofTranscendence() : this(SkillName.Alchemy, 0.0)
{
}
[Constructible]
public ScrollofTranscendence(SkillName skill, double value) : base(skill, value)
public ScrollofTranscendence(SkillName skill = SkillName.Alchemy, double value = 0.0) : base(skill, value)
{
ItemID = 0x14EF;
Hue = 0x490;
@ -49,46 +47,35 @@ namespace Server.Items
public override bool CanUse(Mobile from)
{
if (!base.CanUse(from))
return false;
if (!(from is PlayerMobile pm))
if (!(base.CanUse(from) && from is PlayerMobile pm))
return false;
#region Mondain's Legacy
MLQuestContext context = MLQuestSystem.GetContext(pm);
/* to add when skillgain quests will be implemented
for (int i = pm.Quests.Count - 1; i >= 0; i--)
if (context != null)
{
BaseQuest quest = pm.Quests[i];
for (int j = quest.Objectives.Count - 1; j >= 0; j--)
foreach (MLQuestInstance instance in context.QuestInstances)
{
BaseObjective objective = quest.Objectives[j];
if (objective is ApprenticeObjective)
foreach (BaseObjectiveInstance objective in instance.Objectives)
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
if (!objective.Expired && objective is GainSkillObjectiveInstance objectiveInstance &&
objectiveInstance.Handles(Skill))
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
}
}
}
*/
#endregion
#region Scroll of Alacrity
if (pm.AcceleratedStart > DateTime.UtcNow)
{
from.SendLocalizedMessage(1077951); // You are already under the effect of an accelerated skillgain scroll.
return false;
}
#endregion
return true;
}
@ -167,4 +154,4 @@ namespace Server.Items
Hue = 0x490;
}
}
}
}

View file

@ -74,7 +74,7 @@ namespace Server.Items
if (!CanUse(from))
return;
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(from, this));
}