Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -1,203 +1,208 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Network;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Spells.Necromancy
|
||||
{
|
||||
public class SummonFamiliarSpell : NecromancerSpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Summon Familiar", "Kal Xen Bal",
|
||||
203,
|
||||
9031,
|
||||
Reagent.BatWing,
|
||||
Reagent.GraveDust,
|
||||
Reagent.DaemonBlood
|
||||
);
|
||||
public class SummonFamiliarSpell : NecromancerSpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Summon Familiar", "Kal Xen Bal",
|
||||
203,
|
||||
9031,
|
||||
Reagent.BatWing,
|
||||
Reagent.GraveDust,
|
||||
Reagent.DaemonBlood
|
||||
);
|
||||
|
||||
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds( 2.0 );
|
||||
public SummonFamiliarSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override double RequiredSkill => 30.0;
|
||||
public override int RequiredMana => 17;
|
||||
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(2.0);
|
||||
|
||||
public SummonFamiliarSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
|
||||
{
|
||||
}
|
||||
public override double RequiredSkill => 30.0;
|
||||
public override int RequiredMana => 17;
|
||||
|
||||
public static Hashtable Table { get; } = new Hashtable();
|
||||
public static Hashtable Table{ get; } = new Hashtable();
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
BaseCreature check = (BaseCreature)Table[Caster];
|
||||
public static SummonFamiliarEntry[] Entries{ get; } =
|
||||
{
|
||||
new SummonFamiliarEntry(typeof(HordeMinionFamiliar), 1060146, 30.0, 30.0), // Horde Minion
|
||||
new SummonFamiliarEntry(typeof(ShadowWispFamiliar), 1060142, 50.0, 50.0), // Shadow Wisp
|
||||
new SummonFamiliarEntry(typeof(DarkWolfFamiliar), 1060143, 60.0, 60.0), // Dark Wolf
|
||||
new SummonFamiliarEntry(typeof(DeathAdder), 1060145, 80.0, 80.0), // Death Adder
|
||||
new SummonFamiliarEntry(typeof(VampireBatFamiliar), 1060144, 100.0, 100.0) // Vampire Bat
|
||||
};
|
||||
|
||||
if ( check != null && !check.Deleted )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1061605 ); // You already have a familiar.
|
||||
return false;
|
||||
}
|
||||
public override bool CheckCast()
|
||||
{
|
||||
BaseCreature check = (BaseCreature)Table[Caster];
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
if (check != null && !check.Deleted)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061605); // You already have a familiar.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
if ( CheckSequence() )
|
||||
{
|
||||
Caster.CloseGump( typeof( SummonFamiliarGump ) );
|
||||
Caster.SendGump( new SummonFamiliarGump( Caster, Entries, this ) );
|
||||
}
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
public override void OnCast()
|
||||
{
|
||||
if (CheckSequence())
|
||||
{
|
||||
Caster.CloseGump(typeof(SummonFamiliarGump));
|
||||
Caster.SendGump(new SummonFamiliarGump(Caster, Entries, this));
|
||||
}
|
||||
|
||||
public static SummonFamiliarEntry[] Entries { get; } =
|
||||
{
|
||||
new SummonFamiliarEntry( typeof( HordeMinionFamiliar ), 1060146, 30.0, 30.0 ), // Horde Minion
|
||||
new SummonFamiliarEntry( typeof( ShadowWispFamiliar ), 1060142, 50.0, 50.0 ), // Shadow Wisp
|
||||
new SummonFamiliarEntry( typeof( DarkWolfFamiliar ), 1060143, 60.0, 60.0 ), // Dark Wolf
|
||||
new SummonFamiliarEntry( typeof( DeathAdder ), 1060145, 80.0, 80.0 ), // Death Adder
|
||||
new SummonFamiliarEntry( typeof( VampireBatFamiliar ), 1060144, 100.0, 100.0 ) // Vampire Bat
|
||||
};
|
||||
}
|
||||
FinishSequence();
|
||||
}
|
||||
}
|
||||
|
||||
public class SummonFamiliarEntry
|
||||
{
|
||||
public Type Type { get; }
|
||||
public class SummonFamiliarEntry
|
||||
{
|
||||
public SummonFamiliarEntry(Type type, object name, double reqNecromancy, double reqSpiritSpeak)
|
||||
{
|
||||
Type = type;
|
||||
Name = name;
|
||||
ReqNecromancy = reqNecromancy;
|
||||
ReqSpiritSpeak = reqSpiritSpeak;
|
||||
}
|
||||
|
||||
public object Name { get; }
|
||||
public Type Type{ get; }
|
||||
|
||||
public double ReqNecromancy { get; }
|
||||
public object Name{ get; }
|
||||
|
||||
public double ReqSpiritSpeak { get; }
|
||||
public double ReqNecromancy{ get; }
|
||||
|
||||
public SummonFamiliarEntry( Type type, object name, double reqNecromancy, double reqSpiritSpeak )
|
||||
{
|
||||
Type = type;
|
||||
Name = name;
|
||||
ReqNecromancy = reqNecromancy;
|
||||
ReqSpiritSpeak = reqSpiritSpeak;
|
||||
}
|
||||
}
|
||||
public double ReqSpiritSpeak{ get; }
|
||||
}
|
||||
|
||||
public class SummonFamiliarGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private SummonFamiliarEntry[] m_Entries;
|
||||
public class SummonFamiliarGump : Gump
|
||||
{
|
||||
private const int EnabledColor16 = 0x0F20;
|
||||
private const int DisabledColor16 = 0x262A;
|
||||
|
||||
private SummonFamiliarSpell m_Spell;
|
||||
private const int EnabledColor32 = 0x18CD00;
|
||||
private const int DisabledColor32 = 0x4A8B52;
|
||||
|
||||
private const int EnabledColor16 = 0x0F20;
|
||||
private const int DisabledColor16 = 0x262A;
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
private SummonFamiliarEntry[] m_Entries;
|
||||
private Mobile m_From;
|
||||
|
||||
private const int EnabledColor32 = 0x18CD00;
|
||||
private const int DisabledColor32 = 0x4A8B52;
|
||||
private SummonFamiliarSpell m_Spell;
|
||||
|
||||
public SummonFamiliarGump( Mobile from, SummonFamiliarEntry[] entries, SummonFamiliarSpell spell ) : base( 200, 100 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Entries = entries;
|
||||
m_Spell = spell;
|
||||
public SummonFamiliarGump(Mobile from, SummonFamiliarEntry[] entries, SummonFamiliarSpell spell) : base(200, 100)
|
||||
{
|
||||
m_From = from;
|
||||
m_Entries = entries;
|
||||
m_Spell = spell;
|
||||
|
||||
AddPage( 0 );
|
||||
AddPage(0);
|
||||
|
||||
AddBackground( 10, 10, 250, 178, 9270 );
|
||||
AddAlphaRegion( 20, 20, 230, 158 );
|
||||
AddBackground(10, 10, 250, 178, 9270);
|
||||
AddAlphaRegion(20, 20, 230, 158);
|
||||
|
||||
AddImage( 220, 20, 10464 );
|
||||
AddImage( 220, 72, 10464 );
|
||||
AddImage( 220, 124, 10464 );
|
||||
AddImage(220, 20, 10464);
|
||||
AddImage(220, 72, 10464);
|
||||
AddImage(220, 124, 10464);
|
||||
|
||||
AddItem( 188, 16, 6883 );
|
||||
AddItem( 198, 168, 6881 );
|
||||
AddItem( 8, 15, 6882 );
|
||||
AddItem( 2, 168, 6880 );
|
||||
AddItem(188, 16, 6883);
|
||||
AddItem(198, 168, 6881);
|
||||
AddItem(8, 15, 6882);
|
||||
AddItem(2, 168, 6880);
|
||||
|
||||
AddHtmlLocalized( 30, 26, 200, 20, 1060147, EnabledColor16, false, false ); // Chose thy familiar...
|
||||
AddHtmlLocalized(30, 26, 200, 20, 1060147, EnabledColor16, false, false); // Chose thy familiar...
|
||||
|
||||
double necro = from.Skills[SkillName.Necromancy].Value;
|
||||
double spirit = from.Skills[SkillName.SpiritSpeak].Value;
|
||||
double necro = from.Skills[SkillName.Necromancy].Value;
|
||||
double spirit = from.Skills[SkillName.SpiritSpeak].Value;
|
||||
|
||||
for ( int i = 0; i < entries.Length; ++i )
|
||||
{
|
||||
object name = entries[i].Name;
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
object name = entries[i].Name;
|
||||
|
||||
bool enabled = ( necro >= entries[i].ReqNecromancy && spirit >= entries[i].ReqSpiritSpeak );
|
||||
bool enabled = necro >= entries[i].ReqNecromancy && spirit >= entries[i].ReqSpiritSpeak;
|
||||
|
||||
AddButton( 27, 53 + (i * 21), 9702, 9703, i + 1, GumpButtonType.Reply, 0 );
|
||||
AddButton(27, 53 + i * 21, 9702, 9703, i + 1, GumpButtonType.Reply, 0);
|
||||
|
||||
if ( name is int )
|
||||
AddHtmlLocalized( 50, 51 + (i * 21), 150, 20, (int)name, enabled ? EnabledColor16 : DisabledColor16, false, false );
|
||||
else if ( name is string )
|
||||
AddHtml( 50, 51 + (i * 21), 150, 20,
|
||||
$"<BASEFONT COLOR=#{(enabled ? EnabledColor32 : DisabledColor32):X6}>{name}</BASEFONT>", false, false );
|
||||
}
|
||||
}
|
||||
if (name is int)
|
||||
AddHtmlLocalized(50, 51 + i * 21, 150, 20, (int)name, enabled ? EnabledColor16 : DisabledColor16, false,
|
||||
false);
|
||||
else if (name is string)
|
||||
AddHtml(50, 51 + i * 21, 150, 20,
|
||||
$"<BASEFONT COLOR=#{(enabled ? EnabledColor32 : DisabledColor32):X6}>{name}</BASEFONT>", false,
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
int index = info.ButtonID - 1;
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
int index = info.ButtonID - 1;
|
||||
if (index >= 0 && index < m_Entries.Length)
|
||||
{
|
||||
SummonFamiliarEntry entry = m_Entries[index];
|
||||
|
||||
if ( index >= 0 && index < m_Entries.Length )
|
||||
{
|
||||
SummonFamiliarEntry entry = m_Entries[index];
|
||||
double necro = m_From.Skills[SkillName.Necromancy].Value;
|
||||
double spirit = m_From.Skills[SkillName.SpiritSpeak].Value;
|
||||
|
||||
double necro = m_From.Skills[SkillName.Necromancy].Value;
|
||||
double spirit = m_From.Skills[SkillName.SpiritSpeak].Value;
|
||||
BaseCreature check = (BaseCreature)SummonFamiliarSpell.Table[m_From];
|
||||
|
||||
BaseCreature check = (BaseCreature)SummonFamiliarSpell.Table[m_From];
|
||||
#region Dueling
|
||||
|
||||
#region Dueling
|
||||
if ( (m_From as PlayerMobile)?.DuelContext != null && !( (PlayerMobile)m_From ).DuelContext.AllowSpellCast( m_From, m_Spell ) )
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
else if ( check != null && !check.Deleted )
|
||||
{
|
||||
m_From.SendLocalizedMessage( 1061605 ); // You already have a familiar.
|
||||
}
|
||||
else if ( necro < entry.ReqNecromancy || spirit < entry.ReqSpiritSpeak )
|
||||
{
|
||||
// That familiar requires ~1_NECROMANCY~ Necromancy and ~2_SPIRIT~ Spirit Speak.
|
||||
m_From.SendLocalizedMessage( 1061606, $"{entry.ReqNecromancy:F1}\t{entry.ReqSpiritSpeak:F1}");
|
||||
if ((m_From as PlayerMobile)?.DuelContext != null &&
|
||||
!((PlayerMobile)m_From).DuelContext.AllowSpellCast(m_From, m_Spell))
|
||||
{
|
||||
}
|
||||
|
||||
m_From.CloseGump( typeof( SummonFamiliarGump ) );
|
||||
m_From.SendGump( new SummonFamiliarGump( m_From, SummonFamiliarSpell.Entries, m_Spell ) );
|
||||
}
|
||||
else if ( entry.Type == null )
|
||||
{
|
||||
m_From.SendMessage( "That familiar has not yet been defined." );
|
||||
#endregion
|
||||
|
||||
m_From.CloseGump( typeof( SummonFamiliarGump ) );
|
||||
m_From.SendGump( new SummonFamiliarGump( m_From, SummonFamiliarSpell.Entries, m_Spell ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)Activator.CreateInstance( entry.Type );
|
||||
else if (check != null && !check.Deleted)
|
||||
{
|
||||
m_From.SendLocalizedMessage(1061605); // You already have a familiar.
|
||||
}
|
||||
else if (necro < entry.ReqNecromancy || spirit < entry.ReqSpiritSpeak)
|
||||
{
|
||||
// That familiar requires ~1_NECROMANCY~ Necromancy and ~2_SPIRIT~ Spirit Speak.
|
||||
m_From.SendLocalizedMessage(1061606, $"{entry.ReqNecromancy:F1}\t{entry.ReqSpiritSpeak:F1}");
|
||||
|
||||
bc.Skills.MagicResist = m_From.Skills.MagicResist;
|
||||
m_From.CloseGump(typeof(SummonFamiliarGump));
|
||||
m_From.SendGump(new SummonFamiliarGump(m_From, SummonFamiliarSpell.Entries, m_Spell));
|
||||
}
|
||||
else if (entry.Type == null)
|
||||
{
|
||||
m_From.SendMessage("That familiar has not yet been defined.");
|
||||
|
||||
if ( BaseCreature.Summon( bc, m_From, m_From.Location, -1, TimeSpan.FromDays( 1.0 ) ) )
|
||||
{
|
||||
m_From.FixedParticles( 0x3728, 1, 10, 9910, EffectLayer.Head );
|
||||
bc.PlaySound( bc.GetIdleSound() );
|
||||
SummonFamiliarSpell.Table[m_From] = bc;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage( 1061825 ); // You decide not to summon a familiar.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_From.CloseGump(typeof(SummonFamiliarGump));
|
||||
m_From.SendGump(new SummonFamiliarGump(m_From, SummonFamiliarSpell.Entries, m_Spell));
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)Activator.CreateInstance(entry.Type);
|
||||
|
||||
bc.Skills.MagicResist = m_From.Skills.MagicResist;
|
||||
|
||||
if (BaseCreature.Summon(bc, m_From, m_From.Location, -1, TimeSpan.FromDays(1.0)))
|
||||
{
|
||||
m_From.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head);
|
||||
bc.PlaySound(bc.GetIdleSound());
|
||||
SummonFamiliarSpell.Table[m_From] = bc;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage(1061825); // You decide not to summon a familiar.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue