Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -1,248 +1,248 @@
using System;
using System.Collections.Generic;
namespace Server.Items
{
public class PowerScroll : SpecialScroll
{
public override int Message => 1049469; /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
public class PowerScroll : SpecialScroll
{
private static SkillName[] m_Skills =
{
SkillName.Blacksmith,
SkillName.Tailoring,
SkillName.Swords,
SkillName.Fencing,
SkillName.Macing,
SkillName.Archery,
SkillName.Wrestling,
SkillName.Parry,
SkillName.Tactics,
SkillName.Anatomy,
SkillName.Healing,
SkillName.Magery,
SkillName.Meditation,
SkillName.EvalInt,
SkillName.MagicResist,
SkillName.AnimalTaming,
SkillName.AnimalLore,
SkillName.Veterinary,
SkillName.Musicianship,
SkillName.Provocation,
SkillName.Discordance,
SkillName.Peacemaking
};
private static SkillName[] m_AOSSkills =
{
SkillName.Chivalry,
SkillName.Focus,
SkillName.Necromancy,
SkillName.Stealing,
SkillName.Stealth,
SkillName.SpiritSpeak
};
private static SkillName[] m_SESkills =
{
SkillName.Ninjitsu,
SkillName.Bushido
};
private static SkillName[] m_MLSkills =
{
SkillName.Spellweaving
};
/*
private static SkillName[] m_SASkills = new SkillName[]
{
SkillName.Throwing,
SkillName.Mysticism,
SkillName.Imbuing
};
private static SkillName[] m_HSSkills = new SkillName[]
{
SkillName.Fishing
};
*/
private static List<SkillName> _Skills = new List<SkillName>();
public PowerScroll() : this(SkillName.Alchemy, 0.0)
{
}
[Constructible]
public PowerScroll(SkillName skill, double value) : base(skill, value)
{
Hue = 0x481;
if (Value == 105.0 || skill == SkillName.Blacksmith || skill == SkillName.Tailoring)
LootType = LootType.Regular;
}
public PowerScroll(Serial serial) : base(serial)
{
}
public override int Message =>
1049469; /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
* When used, the effect is not immediately seen without a gain of points with that skill or statistics.
* You can view your maximum skill values in your skills window.
* You can view your maximum statistic value in your statistics window. */
public override int Title
{
get
{
double level = ( Value - 105.0 ) / 5.0;
if ( level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0 )
return 1049635 + (int)level; /* Wonderous Scroll (105 Skill): OR
public override int Title
{
get
{
double level = (Value - 105.0) / 5.0;
if (level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0)
return 1049635 + (int)level; /* Wonderous Scroll (105 Skill): OR
* Exalted Scroll (110 Skill): OR
* Mythical Scroll (115 Skill): OR
* Legendary Scroll (120 Skill): */
return 0;
}
}
return 0;
}
}
public override string DefaultTitle => $"<basefont color=#FFFFFF>Power Scroll ({Value} Skill):</basefont>";
public override string DefaultTitle => $"<basefont color=#FFFFFF>Power Scroll ({Value} Skill):</basefont>";
private static SkillName[] m_Skills = {
SkillName.Blacksmith,
SkillName.Tailoring,
SkillName.Swords,
SkillName.Fencing,
SkillName.Macing,
SkillName.Archery,
SkillName.Wrestling,
SkillName.Parry,
SkillName.Tactics,
SkillName.Anatomy,
SkillName.Healing,
SkillName.Magery,
SkillName.Meditation,
SkillName.EvalInt,
SkillName.MagicResist,
SkillName.AnimalTaming,
SkillName.AnimalLore,
SkillName.Veterinary,
SkillName.Musicianship,
SkillName.Provocation,
SkillName.Discordance,
SkillName.Peacemaking
};
public static List<SkillName> Skills
{
get
{
if (_Skills.Count == 0)
{
_Skills.AddRange(m_Skills);
if (Core.AOS)
{
_Skills.AddRange(m_AOSSkills);
if (Core.SE)
{
_Skills.AddRange(m_SESkills);
if (Core.ML) _Skills.AddRange(m_MLSkills);
}
}
}
private static SkillName[] m_AOSSkills = {
SkillName.Chivalry,
SkillName.Focus,
SkillName.Necromancy,
SkillName.Stealing,
SkillName.Stealth,
SkillName.SpiritSpeak
};
return _Skills;
}
}
private static SkillName[] m_SESkills = {
SkillName.Ninjitsu,
SkillName.Bushido
};
public static PowerScroll CreateRandom(int min, int max)
{
min /= 5;
max /= 5;
private static SkillName[] m_MLSkills = {
SkillName.Spellweaving
};
return new PowerScroll(Skills[Utility.Random(Skills.Count)], 100 + Utility.RandomMinMax(min, max) * 5);
}
/*
private static SkillName[] m_SASkills = new SkillName[]
{
SkillName.Throwing,
SkillName.Mysticism,
SkillName.Imbuing
};
public static PowerScroll CreateRandomNoCraft(int min, int max)
{
min /= 5;
max /= 5;
private static SkillName[] m_HSSkills = new SkillName[]
{
SkillName.Fishing
};
*/
SkillName skillName;
private static List<SkillName> _Skills = new List<SkillName>();
do
{
skillName = Skills[Utility.Random(Skills.Count)];
} while (skillName == SkillName.Blacksmith || skillName == SkillName.Tailoring);
public static List<SkillName> Skills
{
get
{
if ( _Skills.Count == 0 )
{
_Skills.AddRange( m_Skills );
if (Core.AOS)
{
_Skills.AddRange( m_AOSSkills );
if (Core.SE)
{
_Skills.AddRange( m_SESkills );
if (Core.ML)
{
_Skills.AddRange( m_MLSkills );
/*
if (Core.SA)
{
_Skills.AddRange( m_SASkills );
if (Core.HS)
_Skills.AddRange( m_HSSkills );
}
*/
}
}
}
}
return _Skills;
}
}
return new PowerScroll(skillName, 100 + Utility.RandomMinMax(min, max) * 5);
}
public static PowerScroll CreateRandom( int min, int max )
{
min /= 5;
max /= 5;
public override void AddNameProperty(ObjectPropertyList list)
{
double level = (Value - 105.0) / 5.0;
return new PowerScroll( Skills[Utility.Random( Skills.Count )], 100 + ( Utility.RandomMinMax( min, max ) * 5 ) );
}
public static PowerScroll CreateRandomNoCraft( int min, int max )
{
min /= 5;
max /= 5;
SkillName skillName;
do
{
skillName = Skills[Utility.Random( Skills.Count )];
} while ( skillName == SkillName.Blacksmith || skillName == SkillName.Tailoring );
return new PowerScroll( skillName, 100 + (Utility.RandomMinMax( min, max ) * 5));
}
public PowerScroll() : this( SkillName.Alchemy, 0.0 )
{
}
[Constructible]
public PowerScroll( SkillName skill, double value ) : base( skill, value )
{
Hue = 0x481;
if ( Value == 105.0 || skill == SkillName.Blacksmith || skill == SkillName.Tailoring )
LootType = LootType.Regular;
}
public PowerScroll( Serial serial ) : base( serial )
{
}
public override void AddNameProperty( ObjectPropertyList list )
{
double level = ( Value - 105.0 ) / 5.0;
if ( level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0 )
list.Add( 1049639 + (int)level, GetNameLocalized() ); /* a wonderous scroll of ~1_type~ (105 Skill) OR
if (level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0)
list.Add(1049639 + (int)level, GetNameLocalized()); /* a wonderous scroll of ~1_type~ (105 Skill) OR
* an exalted scroll of ~1_type~ (110 Skill) OR
* a mythical scroll of ~1_type~ (115 Skill) OR
* a legendary scroll of ~1_type~ (120 Skill) */
else
list.Add( "a power scroll of {0} ({1} Skill)", GetName(), Value );
}
else
list.Add("a power scroll of {0} ({1} Skill)", GetName(), Value);
}
public override void OnSingleClick( Mobile from )
{
double level = ( Value - 105.0 ) / 5.0;
public override void OnSingleClick(Mobile from)
{
double level = (Value - 105.0) / 5.0;
if ( level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0 )
LabelTo( from, 1049639 + (int)level, GetNameLocalized() );
else
LabelTo( from, "a power scroll of {0} ({1} Skill)", GetName(), Value );
}
if (level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0)
LabelTo(from, 1049639 + (int)level, GetNameLocalized());
else
LabelTo(from, "a power scroll of {0} ({1} Skill)", GetName(), Value);
}
public override bool CanUse( Mobile from )
{
if ( !base.CanUse( from ) )
return false;
public override bool CanUse(Mobile from)
{
if (!base.CanUse(from))
return false;
Skill skill = from.Skills[Skill];
Skill skill = from.Skills[Skill];
if ( skill == null )
return false;
if (skill == null)
return false;
if ( skill.Cap >= Value )
{
from.SendLocalizedMessage( 1049511, GetNameLocalized() ); // Your ~1_type~ is too high for this power scroll.
return false;
}
if (skill.Cap >= Value)
{
from.SendLocalizedMessage(1049511, GetNameLocalized()); // Your ~1_type~ is too high for this power scroll.
return false;
}
return true;
}
return true;
}
public override void Use( Mobile from )
{
if ( !CanUse( from ) )
return;
public override void Use(Mobile from)
{
if (!CanUse(from))
return;
from.SendLocalizedMessage( 1049513, GetNameLocalized() ); // You feel a surge of magic as the scroll enhances your ~1_type~!
from.SendLocalizedMessage(1049513,
GetNameLocalized()); // You feel a surge of magic as the scroll enhances your ~1_type~!
from.Skills[Skill].Cap = Value;
from.Skills[Skill].Cap = Value;
Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0, 0, 0, 0, 0, 5060, 0 );
Effects.PlaySound( from.Location, from.Map, 0x243 );
Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0, 0, 0, 0,
0, 5060, 0);
Effects.PlaySound(from.Location, from.Map, 0x243);
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 4, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 4, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X - 6, from.Y - 6, from.Z + 15), from.Map),
from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X - 4, from.Y - 6, from.Z + 15), from.Map),
from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X - 6, from.Y - 4, from.Z + 15), from.Map),
from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
Effects.SendTargetParticles( from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 );
Effects.SendTargetParticles(from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100);
Delete();
}
Delete();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int) 0 ); // version
}
writer.Write(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = ( InheritsItem ? 0 : reader.ReadInt() ); // Required for SpecialScroll insertion
int version = InheritsItem ? 0 : reader.ReadInt(); // Required for SpecialScroll insertion
if ( Value == 105.0 || Skill == SkillName.Blacksmith || Skill == SkillName.Tailoring )
{
LootType = LootType.Regular;
}
else
{
LootType = LootType.Cursed;
Insured = false;
}
}
}
}
if (Value == 105.0 || Skill == SkillName.Blacksmith || Skill == SkillName.Tailoring)
{
LootType = LootType.Regular;
}
else
{
LootType = LootType.Cursed;
Insured = false;
}
}
}
}

View file

@ -19,143 +19,151 @@
***************************************************************************/
using System;
using Server.Mobiles;
using System.Collections;
using Server.Mobiles;
namespace Server.Items
{
public class ScrollofAlacrity : SpecialScroll
{
public override int LabelNumber => 1078604; // Scroll of Alacrity
public class ScrollofAlacrity : SpecialScroll
{
private static Hashtable m_Table = new Hashtable();
public override int Message => 1078602; /*Using a Scroll of Transcendence for a given skill will permanently increase your current
public ScrollofAlacrity() : this(SkillName.Alchemy)
{
}
[Constructible]
public ScrollofAlacrity(SkillName skill) : base(skill, 0.0)
{
ItemID = 0x14EF;
Hue = 0x4AB;
}
public ScrollofAlacrity(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1078604; // Scroll of Alacrity
public override int Message =>
1078602; /*Using a Scroll of Transcendence for a given skill will permanently increase your current
*level in that skill by the amount of points displayed on the scroll.
*As you may not gain skills beyond your maximum skill cap, any excess points will be lost.*/
public override string DefaultTitle => string.Format( "<basefont color=#FFFFFF>Scroll of Alacrity:</basefont>" );
public override string DefaultTitle => "<basefont color=#FFFFFF>Scroll of Alacrity:</basefont>";
public ScrollofAlacrity() : this( SkillName.Alchemy )
{
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
[Constructible]
public ScrollofAlacrity( SkillName skill ) : base( skill, 0.0 )
{
ItemID = 0x14EF;
Hue = 0x4AB;
}
list.Add(1071345, "{0} 15 Minutes", GetName()); // Skill: ~1_val~
}
public ScrollofAlacrity(Serial serial) : base(serial)
{
}
public override bool CanUse(Mobile from)
{
if (!base.CanUse(from))
return false;
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
if (!(from is PlayerMobile pm))
return false;
list.Add(1071345, "{0} 15 Minutes", GetName()); // Skill: ~1_val~
}
#region Mondain's Legacy
public override bool CanUse( Mobile from )
{
if ( !base.CanUse( from ) )
return false;
/* to add when skillgain quests will be implemented
if ( !(from is PlayerMobile pm) )
return false;
for (int i = pm.Quests.Count - 1; i >= 0; i--)
{
BaseQuest quest = pm.Quests[i];
#region Mondain's Legacy
/* to add when skillgain quests will be implemented
for (int j = quest.Objectives.Count - 1; j >= 0; j--)
{
BaseObjective objective = quest.Objectives[j];
for (int i = pm.Quests.Count - 1; i >= 0; i--)
{
BaseQuest quest = pm.Quests[i];
if (objective is ApprenticeObjective)
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
}
}
for (int j = quest.Objectives.Count - 1; j >= 0; j--)
{
BaseObjective objective = quest.Objectives[j];
*/
if (objective is ApprenticeObjective)
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
}
}
#endregion
*/
#endregion
#region Scroll of Alacrity
#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
if (pm.AcceleratedStart > DateTime.UtcNow)
{
from.SendLocalizedMessage(1077951); // You are already under the effect of an accelerated skillgain scroll.
return false;
}
return true;
}
#endregion
public override void Use( Mobile from )
{
if ( !CanUse( from ) )
return;
return true;
}
if ( !(from is PlayerMobile pm) )
return;
public override void Use(Mobile from)
{
if (!CanUse(from))
return;
double tskill = from.Skills[Skill].Base;
double tcap = from.Skills[Skill].Cap;
if (!(from is PlayerMobile pm))
return;
if ( tskill >= tcap || from.Skills[Skill].Lock != SkillLock.Up )
{
from.SendLocalizedMessage( 1094935 ); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
double tskill = from.Skills[Skill].Base;
double tcap = from.Skills[Skill].Cap;
if (tskill >= tcap || from.Skills[Skill].Lock != SkillLock.Up)
{
from.SendLocalizedMessage(
1094935); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
*If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/
return;
}
return;
}
from.SendLocalizedMessage( 1077956 ); // You are infused with intense energy. You are under the effects of an accelerated skillgain scroll.
from.SendLocalizedMessage(
1077956); // You are infused with intense energy. You are under the effects of an accelerated skillgain scroll.
Effects.PlaySound( from.Location, from.Map, 0x1E9 );
Effects.SendTargetParticles( from, 0x373A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 );
Effects.PlaySound(from.Location, from.Map, 0x1E9);
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 );
pm.AcceleratedStart = DateTime.UtcNow + TimeSpan.FromMinutes(15);
m_Table[from] = Timer.DelayCall(TimeSpan.FromMinutes(15), new TimerStateCallback(Expire_Callback), from);
pm.AcceleratedSkill = Skill;
pm.AcceleratedSkill = Skill;
Delete();
}
Delete();
}
private static Hashtable m_Table = new Hashtable();
private static void Expire_Callback(object state)
{
Mobile m = (Mobile)state;
private static void Expire_Callback(object state)
{
Mobile m = (Mobile)state;
m_Table.Remove(m);
m_Table.Remove(m);
m.PlaySound(0x1F8);
m.PlaySound(0x1F8);
m.SendLocalizedMessage(
1077957); // The intense energy dissipates. You are no longer under the effects of an accelerated skillgain scroll.
}
m.SendLocalizedMessage(1077957);// The intense energy dissipates. You are no longer under the effects of an accelerated skillgain scroll.
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = InheritsItem ? 0 : reader.ReadInt(); //Required for SpecialScroll insertion
int version = ( InheritsItem ? 0 : reader.ReadInt() ); //Required for SpecialScroll insertion
LootType = LootType.Cursed;
Insured = false;
}
}
}
LootType = LootType.Cursed;
Insured = false;
}
}
}

View file

@ -3,161 +3,168 @@ using Server.Mobiles;
namespace Server.Items
{
public class ScrollofTranscendence : SpecialScroll
{
public override int LabelNumber => 1094934; // Scroll of Transcendence
public class ScrollofTranscendence : SpecialScroll
{
public ScrollofTranscendence() : this(SkillName.Alchemy, 0.0)
{
}
public override int Message => 1094933; /*Using a Scroll of Transcendence for a given skill will permanently increase your current
[Constructible]
public ScrollofTranscendence(SkillName skill, double value) : base(skill, value)
{
ItemID = 0x14EF;
Hue = 0x490;
}
public ScrollofTranscendence(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1094934; // Scroll of Transcendence
public override int Message =>
1094933; /*Using a Scroll of Transcendence for a given skill will permanently increase your current
*level in that skill by the amount of points displayed on the scroll.
*As you may not gain skills beyond your maximum skill cap, any excess points will be lost.*/
public override string DefaultTitle =>
$"<basefont color=#FFFFFF>Scroll of Transcendence ({Value} Skill):</basefont>";
public override string DefaultTitle =>
$"<basefont color=#FFFFFF>Scroll of Transcendence ({Value} Skill):</basefont>";
public static ScrollofTranscendence CreateRandom( int min, int max )
{
SkillName skill = (SkillName)Utility.Random( SkillInfo.Table.Length );
public static ScrollofTranscendence CreateRandom(int min, int max)
{
SkillName skill = (SkillName)Utility.Random(SkillInfo.Table.Length);
return new ScrollofTranscendence(skill, Utility.RandomMinMax(min, max) * 0.1);
}
return new ScrollofTranscendence(skill, Utility.RandomMinMax(min, max) * 0.1);
}
public ScrollofTranscendence() : this( SkillName.Alchemy, 0.0 )
{
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
[Constructible]
public ScrollofTranscendence( SkillName skill, double value ) : base( skill, value )
{
ItemID = 0x14EF;
Hue = 0x490;
}
if (Value == 1)
list.Add(1076759, "{0}\t{1}.0 Skill Points", GetName(), Value);
else
list.Add(1076759, "{0}\t{1} Skill Points", GetName(), Value);
}
public ScrollofTranscendence(Serial serial) : base(serial)
{
}
public override bool CanUse(Mobile from)
{
if (!base.CanUse(from))
return false;
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties(list);
if (!(from is PlayerMobile pm))
return false;
if ( Value == 1 )
list.Add(1076759, "{0}\t{1}.0 Skill Points", GetName(), Value);
else
list.Add(1076759, "{0}\t{1} Skill Points", GetName(), Value);
}
#region Mondain's Legacy
public override bool CanUse( Mobile from )
{
if ( !base.CanUse( from ) )
return false;
/* to add when skillgain quests will be implemented
if ( !(from is PlayerMobile pm) )
return false;
for (int i = pm.Quests.Count - 1; i >= 0; i--)
{
BaseQuest quest = pm.Quests[i];
#region Mondain's Legacy
/* to add when skillgain quests will be implemented
for (int j = quest.Objectives.Count - 1; j >= 0; j--)
{
BaseObjective objective = quest.Objectives[j];
for (int i = pm.Quests.Count - 1; i >= 0; i--)
{
BaseQuest quest = pm.Quests[i];
if (objective is ApprenticeObjective)
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
}
}
for (int j = quest.Objectives.Count - 1; j >= 0; j--)
{
BaseObjective objective = quest.Objectives[j];
*/
if (objective is ApprenticeObjective)
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
}
}
#endregion
*/
#endregion
#region Scroll of Alacrity
#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
if (pm.AcceleratedStart > DateTime.UtcNow)
{
from.SendLocalizedMessage(1077951); // You are already under the effect of an accelerated skillgain scroll.
return false;
}
return true;
}
#endregion
public override void Use( Mobile from )
{
if ( !CanUse( from ) )
return;
return true;
}
double tskill = from.Skills[Skill].Base; // value of skill without item bonuses etc
double tcap = from.Skills[Skill].Cap; // maximum value permitted
bool canGain = false;
public override void Use(Mobile from)
{
if (!CanUse(from))
return;
double newValue = Value;
double tskill = from.Skills[Skill].Base; // value of skill without item bonuses etc
double tcap = from.Skills[Skill].Cap; // maximum value permitted
bool canGain = false;
if ( ( tskill + newValue ) > tcap )
newValue = tcap - tskill;
double newValue = Value;
if ( tskill < tcap && from.Skills[Skill].Lock == SkillLock.Up )
{
if ( ( from.SkillsTotal + newValue * 10 ) > from.SkillsCap )
{
int ns = from.Skills.Length; // number of items in from.Skills[]
if (tskill + newValue > tcap)
newValue = tcap - tskill;
for ( int i = 0; i < ns; i++ )
{
// skill must point down and its value must be enough
if ( from.Skills[i].Lock == SkillLock.Down && from.Skills[i].Base >= newValue )
{
from.Skills[i].Base -= newValue;
canGain = true;
break;
}
}
}
else
canGain = true;
}
if (tskill < tcap && from.Skills[Skill].Lock == SkillLock.Up)
{
if (from.SkillsTotal + newValue * 10 > from.SkillsCap)
{
int ns = from.Skills.Length; // number of items in from.Skills[]
if ( !canGain )
{
from.SendLocalizedMessage( 1094935 ); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
for (int i = 0; i < ns; i++)
// skill must point down and its value must be enough
if (from.Skills[i].Lock == SkillLock.Down && from.Skills[i].Base >= newValue)
{
from.Skills[i].Base -= newValue;
canGain = true;
break;
}
}
else
{
canGain = true;
}
}
if (!canGain)
{
from.SendLocalizedMessage(
1094935); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
*If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/
return;
}
return;
}
from.SendLocalizedMessage( 1049513, GetNameLocalized() ); // You feel a surge of magic as the scroll enhances your ~1_type~!
from.SendLocalizedMessage(1049513,
GetNameLocalized()); // You feel a surge of magic as the scroll enhances your ~1_type~!
from.Skills[Skill].Base += newValue;
from.Skills[Skill].Base += newValue;
Effects.PlaySound( from.Location, from.Map, 0x1F7 );
Effects.SendTargetParticles( from, 0x373A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 );
Effects.SendTargetParticles( from, 0x376A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 );
Effects.PlaySound(from.Location, from.Map, 0x1F7);
Effects.SendTargetParticles(from, 0x373A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100);
Effects.SendTargetParticles(from, 0x376A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100);
Delete();
}
Delete();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize(writer);
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
writer.Write(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize(reader);
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = ( InheritsItem ? 0 : reader.ReadInt() ); //Required for SpecialScroll insertion
int version = InheritsItem ? 0 : reader.ReadInt(); //Required for SpecialScroll insertion
LootType = LootType.Cursed;
Insured = false;
LootType = LootType.Cursed;
Insured = false;
if (Hue == 0x7E)
Hue = 0x490;
}
}
}
if (Hue == 0x7E)
Hue = 0x490;
}
}
}

View file

@ -1,171 +1,171 @@
using System;
using Server.Gumps;
using Server.Network;
namespace Server.Items
{
public abstract class SpecialScroll : Item
{
#region Old Item Serialization Vars
/* DO NOT USE! Only used in serialization of special scrolls that originally derived from Item */
public abstract class SpecialScroll : Item
{
public SpecialScroll(SkillName skill, double value) : base(0x14F0)
{
LootType = LootType.Cursed;
Weight = 1.0;
protected bool InheritsItem { get; private set; }
Skill = skill;
Value = value;
}
#endregion
public SpecialScroll(Serial serial) : base(serial)
{
}
public abstract int Message{ get; }
public virtual int Title => 0;
public abstract string DefaultTitle{ get; }
#region Old Item Serialization Vars
public SpecialScroll( SkillName skill, double value ) : base( 0x14F0 )
{
LootType = LootType.Cursed;
Weight = 1.0;
/* DO NOT USE! Only used in serialization of special scrolls that originally derived from Item */
Skill = skill;
Value = value;
}
protected bool InheritsItem{ get; private set; }
public SpecialScroll( Serial serial ) : base( serial )
{
}
#endregion
[CommandProperty( AccessLevel.GameMaster )]
public SkillName Skill { get; set; }
public abstract int Message{ get; }
public virtual int Title => 0;
public abstract string DefaultTitle{ get; }
[CommandProperty( AccessLevel.GameMaster )]
public double Value { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public SkillName Skill{ get; set; }
public virtual string GetNameLocalized()
{
return string.Concat( "#", AosSkillBonuses.GetLabel( Skill ).ToString() );
}
[CommandProperty(AccessLevel.GameMaster)]
public double Value{ get; set; }
public virtual string GetName()
{
int index = (int)Skill;
SkillInfo[] table = SkillInfo.Table;
public virtual string GetNameLocalized()
{
return string.Concat("#", AosSkillBonuses.GetLabel(Skill).ToString());
}
if ( index >= 0 && index < table.Length )
return table[index].Name.ToLower();
return "???";
}
public virtual string GetName()
{
int index = (int)Skill;
SkillInfo[] table = SkillInfo.Table;
public virtual bool CanUse( Mobile from )
{
if ( Deleted )
return false;
if (index >= 0 && index < table.Length)
return table[index].Name.ToLower();
return "???";
}
if ( !IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
return false;
}
public virtual bool CanUse(Mobile from)
{
if (Deleted)
return false;
return true;
}
if (!IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
return false;
}
public virtual void Use( Mobile from )
{
}
return true;
}
public override void OnDoubleClick( Mobile from )
{
if ( !CanUse( from ) )
return;
public virtual void Use(Mobile from)
{
}
from.CloseGump( typeof( InternalGump ) );
from.SendGump( new InternalGump( from, this ) );
}
public override void OnDoubleClick(Mobile from)
{
if (!CanUse(from))
return;
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
from.CloseGump(typeof(InternalGump));
from.SendGump(new InternalGump(from, this));
}
writer.Write( (int) 1 ); // version
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int) Skill );
writer.Write( (double) Value );
}
writer.Write(1); // version
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
writer.Write((int)Skill);
writer.Write(Value);
}
int version = reader.ReadInt();
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
switch ( version )
{
case 1:
{
Skill = (SkillName)reader.ReadInt();
Value = reader.ReadDouble();
break;
}
case 0:
{
InheritsItem = true;
int version = reader.ReadInt();
if ( !(this is StatCapScroll) )
Skill = (SkillName)reader.ReadInt();
else
Skill = SkillName.Alchemy;
switch (version)
{
case 1:
{
Skill = (SkillName)reader.ReadInt();
Value = reader.ReadDouble();
break;
}
case 0:
{
InheritsItem = true;
if ( this is ScrollofAlacrity )
Value = 0.0;
else if ( this is StatCapScroll )
Value = (double)reader.ReadInt();
else
Value = reader.ReadDouble();
if (!(this is StatCapScroll))
Skill = (SkillName)reader.ReadInt();
else
Skill = SkillName.Alchemy;
break;
}
}
}
if (this is ScrollofAlacrity)
Value = 0.0;
else if (this is StatCapScroll)
Value = reader.ReadInt();
else
Value = reader.ReadDouble();
public class InternalGump : Gump
{
private Mobile m_Mobile;
private SpecialScroll m_Scroll;
break;
}
}
}
public InternalGump( Mobile mobile, SpecialScroll scroll ) : base( 25, 50 )
{
m_Mobile = mobile;
m_Scroll = scroll;
public class InternalGump : Gump
{
private Mobile m_Mobile;
private SpecialScroll m_Scroll;
AddPage( 0 );
public InternalGump(Mobile mobile, SpecialScroll scroll) : base(25, 50)
{
m_Mobile = mobile;
m_Scroll = scroll;
AddBackground( 25, 10, 420, 200, 5054 );
AddPage(0);
AddImageTiled( 33, 20, 401, 181, 2624 );
AddAlphaRegion( 33, 20, 401, 181 );
AddBackground(25, 10, 420, 200, 5054);
AddHtmlLocalized( 40, 48, 387, 100, m_Scroll.Message, true, true );
AddImageTiled(33, 20, 401, 181, 2624);
AddAlphaRegion(33, 20, 401, 181);
AddHtmlLocalized( 125, 148, 200, 20, 1049478, 0xFFFFFF, false, false ); // Do you wish to use this scroll?
AddHtmlLocalized(40, 48, 387, 100, m_Scroll.Message, true, true);
AddButton( 100, 172, 4005, 4007, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 135, 172, 120, 20, 1046362, 0xFFFFFF, false, false ); // Yes
AddHtmlLocalized(125, 148, 200, 20, 1049478, 0xFFFFFF, false, false); // Do you wish to use this scroll?
AddButton( 275, 172, 4005, 4007, 0, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 310, 172, 120, 20, 1046363, 0xFFFFFF, false, false ); // No
AddButton(100, 172, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(135, 172, 120, 20, 1046362, 0xFFFFFF, false, false); // Yes
if ( m_Scroll.Title != 0 )
AddHtmlLocalized( 40, 20, 260, 20, m_Scroll.Title, 0xFFFFFF, false, false );
else
AddHtml( 40, 20, 260, 20, m_Scroll.DefaultTitle, false, false );
AddButton(275, 172, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(310, 172, 120, 20, 1046363, 0xFFFFFF, false, false); // No
if ( m_Scroll is StatCapScroll )
AddHtmlLocalized( 310, 20, 120, 20, 1038019, 0xFFFFFF, false, false ); // Power
else
AddHtmlLocalized( 310, 20, 120, 20, AosSkillBonuses.GetLabel( m_Scroll.Skill ), 0xFFFFFF, false, false );
}
if (m_Scroll.Title != 0)
AddHtmlLocalized(40, 20, 260, 20, m_Scroll.Title, 0xFFFFFF, false, false);
else
AddHtml(40, 20, 260, 20, m_Scroll.DefaultTitle, false, false);
public override void OnResponse( NetState state, RelayInfo info )
{
if ( info.ButtonID == 1 )
m_Scroll.Use( m_Mobile );
}
}
}
}
if (m_Scroll is StatCapScroll)
AddHtmlLocalized(310, 20, 120, 20, 1038019, 0xFFFFFF, false, false); // Power
else
AddHtmlLocalized(310, 20, 120, 20, AosSkillBonuses.GetLabel(m_Scroll.Skill), 0xFFFFFF, false, false);
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == 1)
m_Scroll.Use(m_Mobile);
}
}
}
}

View file

@ -1,130 +1,135 @@
using System;
using Server.Mobiles;
namespace Server.Items
{
public class StatCapScroll : SpecialScroll
{
public override int Message => 1049469; /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
public class StatCapScroll : SpecialScroll
{
public StatCapScroll() : this(105)
{
}
[Constructible]
public StatCapScroll(int value) : base(SkillName.Alchemy, value)
{
Hue = 0x481;
}
public StatCapScroll(Serial serial) : base(serial)
{
}
public override int Message =>
1049469; /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
* When used, the effect is not immediately seen without a gain of points with that skill or statistics.
* You can view your maximum skill values in your skills window.
* You can view your maximum statistic value in your statistics window. */
public override int Title
{
get
{
int level = ( (int)Value - 230 ) / 5;
if ( level >= 0 && level <= 4 && Value % 5 == 0 )
return 1049458 + level; /* Wonderous Scroll (+5 Maximum Stats): OR
public override int Title
{
get
{
int level = ((int)Value - 230) / 5;
if (level >= 0 && level <= 4 && Value % 5 == 0)
return 1049458 + level; /* Wonderous Scroll (+5 Maximum Stats): OR
* Exalted Scroll (+10 Maximum Stats): OR
* Mythical Scroll (+15 Maximum Stats): OR
* Legendary Scroll (+20 Maximum Stats): OR
* Ultimate Scroll (+25 Maximum Stats): */
return 0;
}
}
return 0;
}
}
public override string DefaultTitle =>
$"<basefont color=#FFFFFF>Power Scroll ({(((int) Value - 225) >= 0 ? "+" : "")}{(int) Value - 225} Maximum Stats):</basefont>";
public override string DefaultTitle =>
$"<basefont color=#FFFFFF>Power Scroll ({((int)Value - 225 >= 0 ? "+" : "")}{(int)Value - 225} Maximum Stats):</basefont>";
public StatCapScroll() : this( 105 )
{
}
public override void AddNameProperty(ObjectPropertyList list)
{
int level = ((int)Value - 230) / 5;
[Constructible]
public StatCapScroll( int value ) : base( SkillName.Alchemy, value )
{
Hue = 0x481;
}
public StatCapScroll( Serial serial ) : base( serial )
{
}
public override void AddNameProperty(ObjectPropertyList list)
{
int level = ( (int)Value - 230 ) / 5;
if ( level >= 0 && level <= 4 && (int)Value % 5 == 0 )
list.Add( 1049463 + level, "#1049476" ); /* a wonderous scroll of ~1_type~ (+5 Maximum Stats) OR
if (level >= 0 && level <= 4 && (int)Value % 5 == 0)
list.Add(1049463 + level, "#1049476"); /* a wonderous scroll of ~1_type~ (+5 Maximum Stats) OR
* an exalted scroll of ~1_type~ (+10 Maximum Stats) OR
* a mythical scroll of ~1_type~ (+15 Maximum Stats) OR
* a legendary scroll of ~1_type~ (+20 Maximum Stats) OR
* an ultimate scroll of ~1_type~ (+25 Maximum Stats) */
else
list.Add( "a scroll of power ({0}{1} Maximum Stats)", (Value - 225) >= 0 ? "+" : "", Value - 225 );
}
else
list.Add("a scroll of power ({0}{1} Maximum Stats)", Value - 225 >= 0 ? "+" : "", Value - 225);
}
public override void OnSingleClick( Mobile from )
{
int level = ( (int)Value - 230 ) / 5;
public override void OnSingleClick(Mobile from)
{
int level = ((int)Value - 230) / 5;
if ( level >= 0 && level <= 4 && (int)Value % 5 == 0 )
LabelTo( from, 1049463 + level, "#1049476" );
else
LabelTo( from, "a scroll of power ({0}{1} Maximum Stats)", (Value - 225) >= 0 ? "+" : "", Value - 225 );
}
if (level >= 0 && level <= 4 && (int)Value % 5 == 0)
LabelTo(from, 1049463 + level, "#1049476");
else
LabelTo(from, "a scroll of power ({0}{1} Maximum Stats)", Value - 225 >= 0 ? "+" : "", Value - 225);
}
public override bool CanUse( Mobile from )
{
if ( !base.CanUse( from ) )
return false;
public override bool CanUse(Mobile from)
{
if (!base.CanUse(from))
return false;
int newValue = (int)Value;
int newValue = (int)Value;
if ( from is PlayerMobile mobile && mobile.HasStatReward )
newValue += 5;
if (from is PlayerMobile mobile && mobile.HasStatReward)
newValue += 5;
if ( from.StatCap >= newValue )
{
from.SendLocalizedMessage( 1049510 ); // Your stats are too high for this power scroll.
return false;
}
if (from.StatCap >= newValue)
{
from.SendLocalizedMessage(1049510); // Your stats are too high for this power scroll.
return false;
}
return true;
}
return true;
}
public override void Use( Mobile from )
{
if ( !CanUse( from ) )
return;
public override void Use(Mobile from)
{
if (!CanUse(from))
return;
from.SendLocalizedMessage( 1049512 ); // You feel a surge of magic as the scroll enhances your powers!
from.SendLocalizedMessage(1049512); // You feel a surge of magic as the scroll enhances your powers!
if ( from is PlayerMobile mobile && mobile.HasStatReward )
mobile.StatCap = (int)Value + 5;
else
from.StatCap = (int)Value;
if (from is PlayerMobile mobile && mobile.HasStatReward)
mobile.StatCap = (int)Value + 5;
else
from.StatCap = (int)Value;
Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0, 0, 0, 0, 0, 5060, 0 );
Effects.PlaySound( from.Location, from.Map, 0x243 );
Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0, 0, 0, 0,
0, 5060, 0);
Effects.PlaySound(from.Location, from.Map, 0x243);
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 4, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 4, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X - 6, from.Y - 6, from.Z + 15), from.Map),
from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X - 4, from.Y - 6, from.Z + 15), from.Map),
from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X - 6, from.Y - 4, from.Z + 15), from.Map),
from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
Effects.SendTargetParticles( from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 );
Effects.SendTargetParticles(from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100);
Delete();
}
Delete();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int) 0 ); // version
}
writer.Write(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = ( InheritsItem ? 0 : reader.ReadInt() ); //Required for SpecialScroll insertion
int version = InheritsItem ? 0 : reader.ReadInt(); //Required for SpecialScroll insertion
LootType = LootType.Cursed;
Insured = false;
}
}
}
LootType = LootType.Cursed;
Insured = false;
}
}
}