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

@ -144,7 +144,7 @@ namespace Server.Items
}
else
{
from.CloseGump(typeof(DawnsMusicBoxGump));
from.CloseGump<DawnsMusicBoxGump>();
from.SendGump(new DawnsMusicBoxGump(this));
}
}

View file

@ -66,7 +66,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else

View file

@ -62,7 +62,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else

View file

@ -37,7 +37,7 @@ namespace Server.Items
}
}
public bool ShowUsesRemaining
bool IUsesRemaining.ShowUsesRemaining
{
get => true;
set { }

View file

@ -25,10 +25,7 @@ namespace Server.Items
{
if (Utility.InRange(Location, from.Location, 2))
{
int hours;
int minutes;
Clock.GetTime(Map, X, Y, out hours, out minutes);
Clock.GetTime(Map, X, Y, out int hours, out int _);
if (hours < 4 || hours > 20)
Effects.PlaySound(Location, Map, 0x569);
@ -68,10 +65,7 @@ namespace Server.Items
private void UpdateImage()
{
int hours;
int minutes;
Clock.GetTime(Map, X, Y, out hours, out minutes);
Clock.GetTime(Map, X, Y, out int hours, out int _);
if (FacingSouth)
{

View file

@ -140,11 +140,12 @@ namespace Server.Items
int y = m_Mobile.Y + Utility.RandomMinMax(-1, 1);
int z = m_Mobile.Z;
if (!m_Mobile.Map.CanFit(x, y, z, 1, false, false, true))
if (!m_Mobile.Map.CanFit(x, y, z, 1, false, false))
{
z = m_Mobile.Map.GetAverageZ(x, y);
if (!m_Mobile.Map.CanFit(x, y, z, 1, false, false, true)) continue;
if (!m_Mobile.Map.CanFit(x, y, z, 1, false, false))
continue;
}
Blood blood = new Blood(Utility.RandomMinMax(0x122C, 0x122F));

View file

@ -70,7 +70,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else

View file

@ -36,7 +36,7 @@ namespace Server.Items
{
if (from.InRange(GetWorldLocation(), 2))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump());
}
else

View file

@ -135,7 +135,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else

View file

@ -54,7 +54,7 @@ namespace Server.Items
{
from.Location = Location;
Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(Activate), new object[] { c, from });
Timer.DelayCall(TimeSpan.FromSeconds(0.5), () => Activate(c, from));
}
else
{
@ -82,14 +82,6 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
private void Activate(object obj)
{
object[] param = (object[])obj;
if (param[0] is AddonComponent component && param[1] is Mobile mobile)
Activate(component, mobile);
}
public virtual void Activate(AddonComponent c, Mobile from)
{
if (c.ItemID == 0x125E || c.ItemID == 0x1269 || c.ItemID == 0x1260)
@ -106,11 +98,11 @@ namespace Server.Items
int y = c.Y + Utility.RandomMinMax(-1, 1);
int z = c.Z;
if (!c.Map.CanFit(x, y, z, 1, false, false, true))
if (!c.Map.CanFit(x, y, z, 1, false, false))
{
z = c.Map.GetAverageZ(x, y);
if (!c.Map.CanFit(x, y, z, 1, false, false, true))
if (!c.Map.CanFit(x, y, z, 1, false, false))
continue;
}
@ -127,22 +119,19 @@ namespace Server.Items
501777); // Hmm... you suspect that if you used this again, it might hurt.
SpellHelper.Damage(TimeSpan.Zero, from, Utility.Dice(2, 10, 5));
Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 2, new TimerStateCallback(Deactivate), c);
Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 2, Deactivate, c);
}
private void Deactivate(object obj)
private void Deactivate(AddonComponent c)
{
if (obj is AddonComponent c)
{
if (c.ItemID == 0x1269)
c.ItemID = 0x1260;
else if (c.ItemID == 0x1260)
c.ItemID = 0x125E;
else if (c.ItemID == 0x1247)
c.ItemID = 0x1246;
else if (c.ItemID == 0x1246)
c.ItemID = 0x1230;
}
if (c.ItemID == 0x1269)
c.ItemID = 0x1260;
else if (c.ItemID == 0x1260)
c.ItemID = 0x125E;
else if (c.ItemID == 0x1247)
c.ItemID = 0x1246;
else if (c.ItemID == 0x1246)
c.ItemID = 0x1230;
}
}

View file

@ -62,7 +62,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else

View file

@ -62,7 +62,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else

View file

@ -87,7 +87,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else

View file

@ -26,8 +26,7 @@ namespace Server.Items
from.Location = Location;
c.ItemID = 0x124A;
Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 3,
new TimerStateCallback(Activate), new object[] { c, from });
Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 3, () => Activate(c, from));
}
else
{
@ -55,58 +54,44 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
private void Activate(object obj)
{
object[] param = (object[])obj;
if (param[0] is AddonComponent component && param[1] is Mobile mobile)
Activate(component, mobile);
}
public virtual void Activate(AddonComponent c, Mobile from)
{
c.ItemID += 1;
if (c.ItemID >= 0x124D)
if (c.ItemID < 0x124D)
return;
// blood
int amount = Utility.RandomMinMax(3, 7);
for (int i = 0; i < amount; i++)
{
// blood
int amount = Utility.RandomMinMax(3, 7);
int x = c.X + Utility.RandomMinMax(-1, 1);
int y = c.Y + Utility.RandomMinMax(-1, 1);
int z = c.Z;
for (int i = 0; i < amount; i++)
if (!c.Map.CanFit(x, y, z, 1, false, false))
{
int x = c.X + Utility.RandomMinMax(-1, 1);
int y = c.Y + Utility.RandomMinMax(-1, 1);
int z = c.Z;
z = c.Map.GetAverageZ(x, y);
if (!c.Map.CanFit(x, y, z, 1, false, false, true))
{
z = c.Map.GetAverageZ(x, y);
if (!c.Map.CanFit(x, y, z, 1, false, false, true))
continue;
}
Blood blood = new Blood(Utility.RandomMinMax(0x122C, 0x122F));
blood.MoveToWorld(new Point3D(x, y, z), c.Map);
if (!c.Map.CanFit(x, y, z, 1, false, false))
continue;
}
if (from.Female)
from.PlaySound(Utility.RandomMinMax(0x150, 0x153));
else
from.PlaySound(Utility.RandomMinMax(0x15A, 0x15D));
from.LocalOverheadMessage(MessageType.Regular, 0,
501777); // Hmm... you suspect that if you used this again, it might hurt.
SpellHelper.Damage(TimeSpan.Zero, from, Utility.Dice(2, 10, 5));
Timer.DelayCall(TimeSpan.FromSeconds(1), new TimerStateCallback(Deactivate), c);
Blood blood = new Blood(Utility.RandomMinMax(0x122C, 0x122F));
blood.MoveToWorld(new Point3D(x, y, z), c.Map);
}
}
private void Deactivate(object obj)
{
if (obj is AddonComponent component)
component.ItemID = 0x1249;
if (from.Female)
from.PlaySound(Utility.RandomMinMax(0x150, 0x153));
else
from.PlaySound(Utility.RandomMinMax(0x15A, 0x15D));
from.LocalOverheadMessage(MessageType.Regular, 0,
501777); // Hmm... you suspect that if you used this again, it might hurt.
SpellHelper.Damage(TimeSpan.Zero, from, Utility.Dice(2, 10, 5));
Timer.DelayCall(TimeSpan.FromSeconds(1), () => c.ItemID = 0x1249);
}
}

View file

@ -64,7 +64,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else

View file

@ -66,7 +66,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else

View file

@ -59,7 +59,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else

View file

@ -91,7 +91,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else

View file

@ -25,7 +25,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(HeritageTokenGump));
from.CloseGump<HeritageTokenGump>();
from.SendGump(new HeritageTokenGump(this));
}
else

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Multis;
namespace Server.Items
@ -12,7 +13,7 @@ namespace Server.Items
public class HolidayTree : Item, IAddon
{
private ArrayList m_Components;
private List<Item> m_Components;
public HolidayTree(Mobile from, HolidayTreeType type, Point3D loc) : base(1)
{
@ -20,7 +21,7 @@ namespace Server.Items
MoveToWorld(loc, from.Map);
Placer = from;
m_Components = new ArrayList();
m_Components = new List<Item>();
switch (type)
{
@ -112,7 +113,7 @@ namespace Server.Items
public override void OnAfterDelete()
{
for (int i = 0; i < m_Components.Count; ++i)
((Item)m_Components[i]).Delete();
m_Components[i].Delete();
}
private void AddOrnament(int x, int y, int z, int itemID)
@ -138,7 +139,7 @@ namespace Server.Items
writer.Write(m_Components.Count);
for (int i = 0; i < m_Components.Count; ++i)
writer.Write((Item)m_Components[i]);
writer.Write(m_Components[i]);
}
public override void Deserialize(GenericReader reader)
@ -159,7 +160,7 @@ namespace Server.Items
{
int count = reader.ReadInt();
m_Components = new ArrayList(count);
m_Components = new List<Item>(count);
for (int i = 0; i < count; ++i)
{
@ -178,9 +179,7 @@ namespace Server.Items
public void ValidatePlacement()
{
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house == null)
if (BaseHouse.FindHouseAt(this) == null)
{
HolidayTreeDeed deed = new HolidayTreeDeed();
deed.MoveToWorld(Location, Map);
@ -201,7 +200,8 @@ namespace Server.Items
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house != null && house.Addons.Contains(this)) house.Addons.Remove(this);
if (house?.Addons.Contains(this) == true)
house.Addons.Remove(this);
from.SendLocalizedMessage(503393); // A deed for the tree has been placed in your backpack.
}

View file

@ -60,7 +60,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -93,7 +93,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);

View file

@ -48,60 +48,51 @@ namespace Server.Items
public virtual void RunSequence(Mobile m, int message, bool freeze)
{
object[] arg = null;
if (freeze)
{
m.Frozen = true;
Timer.DelayCall(TimeSpan.FromSeconds(message == 1095162 ? 2.0 : 1.25),
new TimerStateCallback(EndFall_Callback), m);
Timer.DelayCall(TimeSpan.FromSeconds(message == 1095162 ? 2.0 : 1.25), EndFall_Callback, m);
}
m.SendLocalizedMessage(message);
int action = 0;
int sound = 0;
if (message == 1095162)
{
if (m.Mounted) m.Mount.Rider = null;
if (m.Mounted)
m.Mount.Rider = null;
Point3D p = new Point3D(Location);
if (SpellHelper.FindValidSpawnLocation(Map, ref p, true))
Timer.DelayCall(TimeSpan.FromSeconds(0), new TimerStateCallback(Relocate_Callback),
new object[] { m, p });
Timer.DelayCall(TimeSpan.FromSeconds(0), () => m.MoveToWorld(p, m.Map));
arg = new object[] { m, 21 + Utility.Random(2), !m.Female ? 0x426 : 0x317 };
action = 21 + Utility.Random(2);
sound = m.Female ? 0x317 : 0x426;
}
else if (message == 1095161)
{
arg = new object[] { m, 17, !m.Female ? 0x429 : 0x319 };
action = 17;
sound = m.Female ? 0x319 : 0x429;
}
if (arg != null) Timer.DelayCall(TimeSpan.FromSeconds(.4), new TimerStateCallback(BeginFall_Callback), arg);
if (action > 0)
Timer.DelayCall(TimeSpan.FromSeconds(0.4), from => BeginFall_Callback(from, action, sound), m);
}
private static void Relocate_Callback(object state)
private static void BeginFall_Callback(Mobile m, int action, int sound)
{
object[] states = (object[])state;
Mobile m = (Mobile)states[0];
Point3D to = (Point3D)states[1];
m.MoveToWorld(to, m.Map);
}
private static void BeginFall_Callback(object state)
{
object[] states = (object[])state;
Mobile m = (Mobile)states[0];
int action = (int)states[1];
int sound = (int)states[2];
if (!m.Mounted) m.Animate(action, 1, 1, false, true, 0);
if (!m.Mounted)
m.Animate(action, 1, 1, false, true, 0);
m.PlaySound(sound);
}
private static void EndFall_Callback(object state)
private static void EndFall_Callback(Mobile m)
{
((Mobile)state).Frozen = false;
m.Frozen = false;
}
public override void Serialize(GenericWriter writer)

View file

@ -148,7 +148,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -181,7 +181,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);

View file

@ -105,7 +105,7 @@ namespace Server.Items
{
if (from.InRange(GetWorldLocation(), 3))
{
from.CloseGump(typeof(WreathAddonGump));
from.CloseGump<WreathAddonGump>();
from.SendGump(new WreathAddonGump(from, this));
}
else
@ -202,7 +202,7 @@ namespace Server.Items
if (house != null && house.IsCoOwner(from))
{
from.SendLocalizedMessage(1062838); // Where would you like to place this decoration?
from.BeginTarget(-1, true, TargetFlags.None, Placement_OnTarget, null);
from.BeginTarget(-1, true, TargetFlags.None, Placement_OnTarget);
}
else
{
@ -215,7 +215,7 @@ namespace Server.Items
}
}
public void Placement_OnTarget(Mobile from, object targeted, object state)
public void Placement_OnTarget(Mobile from, object targeted)
{
if (!(targeted is IPoint3D p))
return;

View file

@ -118,7 +118,7 @@ namespace Server.Items
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(WritOfLeaseGump));
from.CloseGump<WritOfLeaseGump>();
from.SendGump(new WritOfLeaseGump(this));
}
else

View file

@ -1,4 +1,3 @@
using System.Collections.Generic;
using System.Linq;
using Server.Items;
using Server.Spells.Sixth;

View file

@ -447,10 +447,10 @@ namespace Server.Items
else
from.SendGump(new WarningGump(1150470, 0x7F00,
$"You are about to purchase a raffle ticket for the house plot located at {FormatLocation()}. The ticket price is {FormatPrice()}. Tickets are non-refundable and you can only purchase one ticket per account. Do you wish to continue?",
0xFFFFFF, 420, 280, Purchase_Callback, null)); // CONFIRM TICKET PURCHASE
0xFFFFFF, 420, 280, okay => Purchase_Callback(from, okay))); // CONFIRM TICKET PURCHASE
}
public void Purchase_Callback(Mobile from, bool okay, object state)
public void Purchase_Callback(Mobile from, bool okay)
{
if (Deleted || m_State != HouseRaffleState.Active || !from.CheckAlive() || HasEntered(from) || IsAtIPLimit(from))
return;

View file

@ -143,7 +143,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (from.Region.IsPartOf(typeof(Jail)))
if (from.Region.IsPartOf<Jail>())
from.SendMessage("You may not do that in jail.");
else if (!IsChildOf(from.Backpack))
MessageHelper.SendLocalizedMessageTo(this, from, 1062334,
@ -226,7 +226,7 @@ namespace Server.Items
if (m_Bag.Deleted)
return;
if (from.Region.IsPartOf(typeof(Jail)))
if (from.Region.IsPartOf<Jail>())
{
from.SendMessage("You may not do that in jail.");
}

View file

@ -201,8 +201,8 @@ namespace Server.Items
MessageHelper.SendLocalizedMessageTo(this, from, 1054127,
0x22); // The Crystal Ball fills with a red mist. You appear to have let your bond to your pet deteriorate.
}
else if (from.Map == Map.Ilshenar || from.Region.IsPartOf(typeof(DungeonRegion)) ||
from.Region.IsPartOf(typeof(Jail)) || from.Region.IsPartOf(typeof(SafeZone)))
else if (from.Map == Map.Ilshenar || from.Region.IsPartOf<DungeonRegion>() ||
from.Region.IsPartOf<Jail>() || from.Region.IsPartOf<SafeZone>())
{
from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0x22, 3, "",
"You cannot summon your pet to this location."));
@ -438,7 +438,7 @@ namespace Server.Items
public void Stop()
{
m_Stop = true;
Disturb(DisturbType.Hurt, false, false);
Disturb(DisturbType.Hurt, false);
}
public override bool CheckDisturb(DisturbType type, bool checkFirst, bool resistable)

View file

@ -255,13 +255,13 @@ namespace Server.Items
return false;
}
if (from.Region.IsPartOf(typeof(Jail)))
if (from.Region.IsPartOf<Jail>())
{
from.SendLocalizedMessage(1114345, "", 0x35); // You'll need a better jailbreak plan than that!
return false;
}
if (boundRoot.Region.IsPartOf(typeof(Jail)))
if (boundRoot.Region.IsPartOf<Jail>())
{
from.SendLocalizedMessage(1019004); // You are not allowed to travel there.
return false;

View file

@ -248,11 +248,11 @@ namespace Server.Items
if (!CheckUse(from))
return;
from.CloseGump(typeof(SelectSkillGump));
from.CloseGump(typeof(ConfirmSkillGump));
from.CloseGump(typeof(ConfirmTransferGump));
from.CloseGump(typeof(ConfirmRemovalGump));
from.CloseGump(typeof(ErrorGump));
from.CloseGump<SelectSkillGump>();
from.CloseGump<ConfirmSkillGump>();
from.CloseGump<ConfirmTransferGump>();
from.CloseGump<ConfirmRemovalGump>();
from.CloseGump<ErrorGump>();
if (IsEmpty)
from.SendGump(new SelectSkillGump(this, from));
@ -877,7 +877,7 @@ namespace Server.Items
}
public bool ShowUsesRemaining
bool IUsesRemaining.ShowUsesRemaining
{
get => true;
set { }

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));
}

View file

@ -73,7 +73,7 @@ namespace Server.Items
}
else
{
m.CloseGump(typeof(AnkhResurrectGump));
m.CloseGump<AnkhResurrectGump>();
m.SendGump(new AnkhResurrectGump(m, ResurrectMessage.VirtueShrine));
}
}
@ -310,7 +310,7 @@ namespace Server.Items
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(RewardOptionGump));
from.CloseGump<RewardOptionGump>();
from.SendGump(new RewardOptionGump(this));
}
else

View file

@ -83,7 +83,7 @@ namespace Server.Items
if (house != null && house.IsOwner(from))
{
from.CloseGump(typeof(RewardDemolitionGump));
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1018318)); // Do you wish to re-deed this banner?
}
else
@ -164,7 +164,7 @@ namespace Server.Items
if (house != null && house.IsOwner(from))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -209,7 +209,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);
@ -296,7 +296,7 @@ namespace Server.Items
if (north && west)
{
from.CloseGump(typeof(FacingGump));
from.CloseGump<FacingGump>();
from.SendGump(new FacingGump(m_Banner, m_ItemID, p3d, house));
}
else if (north || west)
@ -352,7 +352,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);

View file

@ -168,7 +168,7 @@ namespace Server.Items
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -213,7 +213,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);

View file

@ -334,7 +334,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);
@ -455,7 +455,7 @@ namespace Server.Items
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(RewardOptionGump));
from.CloseGump<RewardOptionGump>();
from.SendGump(new RewardOptionGump(this));
}
else

View file

@ -86,7 +86,7 @@ namespace Server.Items
if (house != null && house.IsOwner(from))
{
from.CloseGump(typeof(RewardDemolitionGump));
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
}
else
@ -163,7 +163,7 @@ namespace Server.Items
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -217,7 +217,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);
@ -312,7 +312,7 @@ namespace Server.Items
if (north && west)
{
from.CloseGump(typeof(FacingGump));
from.CloseGump<FacingGump>();
from.SendGump(new FacingGump(m_Shield, m_ItemID, p3d, house));
}
else if (north || west)
@ -368,7 +368,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);

View file

@ -84,7 +84,7 @@ namespace Server.Items
if (house != null && house.IsOwner(from))
{
from.CloseGump(typeof(RewardDemolitionGump));
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1018329)); // Do you wish to re-deed this skull?
}
else

View file

@ -88,7 +88,7 @@ namespace Server.Items
if (house != null && house.IsOwner(from))
{
from.CloseGump(typeof(RewardDemolitionGump));
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
}
else
@ -169,7 +169,7 @@ namespace Server.Items
if (house != null && house.IsOwner(from))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -221,7 +221,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);
@ -304,7 +304,7 @@ namespace Server.Items
if (north && west)
{
from.CloseGump(typeof(FacingGump));
from.CloseGump<FacingGump>();
from.SendGump(new FacingGump(m_Skeleton, m_ItemID, p3d, house));
}
else if (north || west)
@ -360,7 +360,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);

View file

@ -409,7 +409,7 @@ namespace Server.Items
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(RewardOptionGump));
from.CloseGump<RewardOptionGump>();
from.SendGump(new RewardOptionGump(this));
}
else

View file

@ -150,7 +150,7 @@ namespace Server.Items
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(RewardOptionGump));
from.CloseGump<RewardOptionGump>();
from.SendGump(new RewardOptionGump(this));
}
else

View file

@ -95,7 +95,7 @@ namespace Server.Items
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -141,7 +141,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);

View file

@ -112,7 +112,7 @@ namespace Server.Items
if (house != null && house.IsOwner(from))
{
from.CloseGump(typeof(RewardDemolitionGump));
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
}
else
@ -192,7 +192,7 @@ namespace Server.Items
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -242,7 +242,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);

View file

@ -280,7 +280,7 @@ namespace Server.Items
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(RewardOptionGump));
from.CloseGump<RewardOptionGump>();
from.SendGump(new RewardOptionGump(this));
}
else

View file

@ -317,7 +317,7 @@ namespace Server.Items
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -361,7 +361,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddBackground(25, 0, 500, 265, 0xA28);

View file

@ -54,7 +54,7 @@ namespace Server.Items
}
}
public virtual bool ShowUsesRemaining
public bool ShowUsesRemaining
{
get => true;
set { }
@ -211,7 +211,7 @@ namespace Server.Items
if (targeted is BaseWeapon item)
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(m_Tool, item));
}
else
@ -233,7 +233,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddBackground(50, 50, 400, 300, 0xA28);
@ -310,7 +310,7 @@ namespace Server.Items
Closable = false;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);