#W# Source and Scripts added. Added Scripts/Settings.cs to expose some basic tweak able settings.
This commit is contained in:
parent
b51c58f514
commit
3045c83799
3512 changed files with 627673 additions and 0 deletions
256
Scripts/Items/Special/Special Scrolls/PowerScroll.cs
Normal file
256
Scripts/Items/Special/Special Scrolls/PowerScroll.cs
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PowerScroll : SpecialScroll
|
||||
{
|
||||
public override int Message { get { return 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
|
||||
* Exalted Scroll (110 Skill): OR
|
||||
* Mythical Scroll (115 Skill): OR
|
||||
* Legendary Scroll (120 Skill): */
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override string DefaultTitle{ get{ return String.Format( "<basefont color=#FFFFFF>Power Scroll ({0} Skill):</basefont>", Value ); } }
|
||||
|
||||
private static SkillName[] m_Skills = new SkillName[]
|
||||
{
|
||||
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 = new SkillName[]
|
||||
{
|
||||
SkillName.Chivalry,
|
||||
SkillName.Focus,
|
||||
SkillName.Necromancy,
|
||||
SkillName.Stealing,
|
||||
SkillName.Stealth,
|
||||
SkillName.SpiritSpeak
|
||||
};
|
||||
|
||||
private static SkillName[] m_SESkills = new SkillName[]
|
||||
{
|
||||
SkillName.Ninjitsu,
|
||||
SkillName.Bushido
|
||||
};
|
||||
|
||||
private static SkillName[] m_MLSkills = new SkillName[]
|
||||
{
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
||||
public static PowerScroll CreateRandom( int min, int max )
|
||||
{
|
||||
min /= 5;
|
||||
max /= 5;
|
||||
|
||||
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 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public PowerScroll( SkillName skill, double value ) : base( skill, value )
|
||||
{
|
||||
Hue = 0x481;
|
||||
|
||||
if ( Value == 105.0 || skill == Server.SkillName.Blacksmith || skill == Server.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
|
||||
* 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 );
|
||||
}
|
||||
|
||||
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 )
|
||||
base.LabelTo( from, 1049639 + (int)level, GetNameLocalized() );
|
||||
else
|
||||
base.LabelTo( from, "a power scroll of {0} ({1} Skill)", GetName(), Value );
|
||||
}
|
||||
|
||||
public override bool CanUse( Mobile from )
|
||||
{
|
||||
if ( !base.CanUse( from ) )
|
||||
return false;
|
||||
|
||||
Skill skill = from.Skills[Skill];
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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.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.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 );
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
173
Scripts/Items/Special/Special Scrolls/ScrollofAlacrity.cs
Normal file
173
Scripts/Items/Special/Special Scrolls/ScrollofAlacrity.cs
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
/***************************************************************************
|
||||
* 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 Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using System.Collections;
|
||||
using Server.Engines.Quests;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ScrollofAlacrity : SpecialScroll
|
||||
{
|
||||
public override int LabelNumber { get { return 1078604; } } // Scroll of Alacrity
|
||||
|
||||
public override int Message { get { return 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 { get { return String.Format( "<basefont color=#FFFFFF>Scroll of Alacrity:</basefont>" ); } }
|
||||
|
||||
public ScrollofAlacrity() : this( SkillName.Alchemy )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public ScrollofAlacrity( SkillName skill ) : base( skill, 0.0 )
|
||||
{
|
||||
ItemID = 0x14EF;
|
||||
Hue = 0x4AB;
|
||||
}
|
||||
|
||||
public ScrollofAlacrity(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1071345, "{0} 15 Minutes", GetName()); // Skill: ~1_val~
|
||||
}
|
||||
|
||||
public override bool CanUse( Mobile from )
|
||||
{
|
||||
if ( !base.CanUse( from ) )
|
||||
return false;
|
||||
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
return false;
|
||||
|
||||
#region Mondain's Legacy
|
||||
/* to add when skillgain quests will be implemented
|
||||
|
||||
for (int i = pm.Quests.Count - 1; i >= 0; i--)
|
||||
{
|
||||
BaseQuest quest = pm.Quests[i];
|
||||
|
||||
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
|
||||
|
||||
#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;
|
||||
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
return;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
pm.AcceleratedStart = DateTime.UtcNow + TimeSpan.FromMinutes(15);
|
||||
|
||||
Timer t = (Timer)m_Table[from];
|
||||
|
||||
m_Table[from] = Timer.DelayCall( TimeSpan.FromMinutes( 15 ), new TimerStateCallback( Expire_Callback ), from );
|
||||
|
||||
pm.AcceleratedSkill = Skill;
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
|
||||
private static void Expire_Callback(object state)
|
||||
{
|
||||
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.
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = ( InheritsItem ? 0 : reader.ReadInt() ); //Required for SpecialScroll insertion
|
||||
|
||||
LootType = LootType.Cursed;
|
||||
Insured = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
168
Scripts/Items/Special/Special Scrolls/ScrollofTranscendence.cs
Normal file
168
Scripts/Items/Special/Special Scrolls/ScrollofTranscendence.cs
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Engines.Quests;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ScrollofTranscendence : SpecialScroll
|
||||
{
|
||||
public override int LabelNumber { get { return 1094934; } } // Scroll of Transcendence
|
||||
|
||||
public override int Message { get { return 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 { get { return String.Format( "<basefont color=#FFFFFF>Scroll of Transcendence ({0} Skill):</basefont>", Value ); } }
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public ScrollofTranscendence() : this( SkillName.Alchemy, 0.0 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public ScrollofTranscendence( SkillName skill, double value ) : base( skill, value )
|
||||
{
|
||||
ItemID = 0x14EF;
|
||||
Hue = 0x490;
|
||||
}
|
||||
|
||||
public ScrollofTranscendence(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
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 override bool CanUse( Mobile from )
|
||||
{
|
||||
if ( !base.CanUse( from ) )
|
||||
return false;
|
||||
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
return false;
|
||||
|
||||
#region Mondain's Legacy
|
||||
/* to add when skillgain quests will be implemented
|
||||
|
||||
for (int i = pm.Quests.Count - 1; i >= 0; i--)
|
||||
{
|
||||
BaseQuest quest = pm.Quests[i];
|
||||
|
||||
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
|
||||
|
||||
#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;
|
||||
|
||||
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;
|
||||
|
||||
double newValue = Value;
|
||||
|
||||
if ( ( tskill + newValue ) > tcap )
|
||||
newValue = tcap - tskill;
|
||||
|
||||
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[]
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1049513, GetNameLocalized() ); // You feel a surge of magic as the scroll enhances your ~1_type~!
|
||||
|
||||
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 );
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = ( InheritsItem ? 0 : reader.ReadInt() ); //Required for SpecialScroll insertion
|
||||
|
||||
LootType = LootType.Cursed;
|
||||
Insured = false;
|
||||
|
||||
if (Hue == 0x7E)
|
||||
Hue = 0x490;
|
||||
}
|
||||
}
|
||||
}
|
||||
187
Scripts/Items/Special/Special Scrolls/SpecialScroll.cs
Normal file
187
Scripts/Items/Special/Special Scrolls/SpecialScroll.cs
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class SpecialScroll : Item
|
||||
{
|
||||
private SkillName m_Skill;
|
||||
private double m_Value;
|
||||
|
||||
#region Old Item Serialization Vars
|
||||
/* DO NOT USE! Only used in serialization of special scrolls that originally derived from Item */
|
||||
private bool m_InheritsItem;
|
||||
|
||||
protected bool InheritsItem
|
||||
{
|
||||
get{ return m_InheritsItem; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
public abstract int Message{ get; }
|
||||
public virtual int Title{ get { return 0; } }
|
||||
public abstract string DefaultTitle{ get; }
|
||||
|
||||
public SpecialScroll( SkillName skill, double value ) : base( 0x14F0 )
|
||||
{
|
||||
LootType = LootType.Cursed;
|
||||
Weight = 1.0;
|
||||
|
||||
m_Skill = skill;
|
||||
m_Value = value;
|
||||
}
|
||||
|
||||
public SpecialScroll( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SkillName Skill
|
||||
{
|
||||
get { return m_Skill; }
|
||||
set { m_Skill = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public double Value
|
||||
{
|
||||
get { return m_Value; }
|
||||
set { m_Value = value; }
|
||||
}
|
||||
|
||||
public virtual string GetNameLocalized()
|
||||
{
|
||||
return String.Concat( "#", AosSkillBonuses.GetLabel( m_Skill ).ToString() );
|
||||
}
|
||||
|
||||
public virtual string GetName()
|
||||
{
|
||||
int index = (int)m_Skill;
|
||||
SkillInfo[] table = SkillInfo.Table;
|
||||
|
||||
if ( index >= 0 && index < table.Length )
|
||||
return table[index].Name.ToLower();
|
||||
else
|
||||
return "???";
|
||||
}
|
||||
|
||||
public virtual bool CanUse( Mobile from )
|
||||
{
|
||||
if ( Deleted )
|
||||
return false;
|
||||
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void Use( Mobile from )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !CanUse( from ) )
|
||||
return;
|
||||
|
||||
from.CloseGump( typeof( SpecialScroll.InternalGump ) );
|
||||
from.SendGump( new InternalGump( from, this ) );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( (int) m_Skill );
|
||||
writer.Write( (double) m_Value );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Skill = (SkillName)reader.ReadInt();
|
||||
m_Value = reader.ReadDouble();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_InheritsItem = true;
|
||||
|
||||
if ( !(this is StatCapScroll) )
|
||||
m_Skill = (SkillName)reader.ReadInt();
|
||||
else
|
||||
m_Skill = SkillName.Alchemy;
|
||||
|
||||
if ( this is ScrollofAlacrity )
|
||||
m_Value = 0.0;
|
||||
else if ( this is StatCapScroll )
|
||||
m_Value = (double)reader.ReadInt();
|
||||
else
|
||||
m_Value = reader.ReadDouble();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class InternalGump : Gump
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private SpecialScroll m_Scroll;
|
||||
|
||||
public InternalGump( Mobile mobile, SpecialScroll scroll ) : base( 25, 50 )
|
||||
{
|
||||
m_Mobile = mobile;
|
||||
m_Scroll = scroll;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 25, 10, 420, 200, 5054 );
|
||||
|
||||
AddImageTiled( 33, 20, 401, 181, 2624 );
|
||||
AddAlphaRegion( 33, 20, 401, 181 );
|
||||
|
||||
AddHtmlLocalized( 40, 48, 387, 100, m_Scroll.Message, true, true );
|
||||
|
||||
AddHtmlLocalized( 125, 148, 200, 20, 1049478, 0xFFFFFF, false, false ); // Do you wish to use this scroll?
|
||||
|
||||
AddButton( 100, 172, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 135, 172, 120, 20, 1046362, 0xFFFFFF, false, false ); // Yes
|
||||
|
||||
AddButton( 275, 172, 4005, 4007, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 310, 172, 120, 20, 1046363, 0xFFFFFF, false, false ); // No
|
||||
|
||||
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 );
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
132
Scripts/Items/Special/Special Scrolls/StatScroll.cs
Normal file
132
Scripts/Items/Special/Special Scrolls/StatScroll.cs
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class StatCapScroll : SpecialScroll
|
||||
{
|
||||
public override int Message { get { return 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
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
||||
public override string DefaultTitle { get { return String.Format( "<basefont color=#FFFFFF>Power Scroll ({0}{1} Maximum Stats):</basefont>", ( (int)Value - 225 ) >= 0 ? "+" : "", (int)Value - 225 ); } }
|
||||
|
||||
public StatCapScroll() : this( 105 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
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
|
||||
* 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 );
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
int level = ( (int)Value - 230 ) / 5;
|
||||
|
||||
if ( level >= 0 && level <= 4 && (int)Value % 5 == 0 )
|
||||
base.LabelTo( from, 1049463 + level, "#1049476" );
|
||||
else
|
||||
base.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;
|
||||
|
||||
int newValue = (int)Value;
|
||||
|
||||
if ( from is PlayerMobile && ((PlayerMobile)from).HasStatReward )
|
||||
newValue += 5;
|
||||
|
||||
if ( from.StatCap >= newValue )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049510 ); // Your stats are too high for this power scroll.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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!
|
||||
|
||||
if ( from is PlayerMobile && ((PlayerMobile)from).HasStatReward )
|
||||
from.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.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 );
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = ( InheritsItem ? 0 : reader.ReadInt() ); //Required for SpecialScroll insertion
|
||||
|
||||
LootType = LootType.Cursed;
|
||||
Insured = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue