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,77 +1,79 @@
using System;
using Server.Network;
using Server.Spells;
using Server.Targeting;
namespace Server.Ethics.Hero
{
public sealed class Bless : Power
{
public Bless()
{
m_Definition = new PowerDefinition(
15,
"Bless",
"Erstok Ontawl",
""
);
}
public sealed class Bless : Power
{
public Bless()
{
m_Definition = new PowerDefinition(
15,
"Bless",
"Erstok Ontawl",
""
);
}
public override void BeginInvoke( Player from )
{
from.Mobile.BeginTarget( 12, true, Targeting.TargetFlags.None, new TargetStateCallback( Power_OnTarget ), from );
from.Mobile.SendMessage( "Where do you wish to bless?" );
}
public override void BeginInvoke(Player from)
{
from.Mobile.BeginTarget(12, true, TargetFlags.None, new TargetStateCallback(Power_OnTarget), from);
from.Mobile.SendMessage("Where do you wish to bless?");
}
private void Power_OnTarget( Mobile fromMobile, object obj, object state )
{
if (!(state is Player from))
return;
private void Power_OnTarget(Mobile fromMobile, object obj, object state)
{
if (!(state is Player from))
return;
if ( !(obj is IPoint3D p) )
return;
if (!(obj is IPoint3D p))
return;
if ( !CheckInvoke( from ) )
return;
if (!CheckInvoke(from))
return;
bool powerFunctioned = false;
bool powerFunctioned = false;
SpellHelper.GetSurfaceTop( ref p );
SpellHelper.GetSurfaceTop(ref p);
foreach ( Mobile mob in from.Mobile.GetMobilesInRange( 6 ) )
{
if ( mob != from.Mobile && SpellHelper.ValidIndirectTarget( from.Mobile, mob ) )
continue;
foreach (Mobile mob in from.Mobile.GetMobilesInRange(6))
{
if (mob != from.Mobile && SpellHelper.ValidIndirectTarget(from.Mobile, mob))
continue;
if ( mob.GetStatMod( "Holy Bless" ) != null )
continue;
if (mob.GetStatMod("Holy Bless") != null)
continue;
if ( !from.Mobile.CanBeBeneficial( mob, false ) )
continue;
if (!from.Mobile.CanBeBeneficial(mob, false))
continue;
from.Mobile.DoBeneficial( mob );
from.Mobile.DoBeneficial(mob);
mob.AddStatMod( new StatMod( StatType.All, "Holy Bless", 10, TimeSpan.FromMinutes( 30.0 ) ) );
mob.AddStatMod(new StatMod(StatType.All, "Holy Bless", 10, TimeSpan.FromMinutes(30.0)));
mob.FixedParticles( 0x373A, 10, 15, 5018, EffectLayer.Waist );
mob.PlaySound( 0x1EA );
mob.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);
mob.PlaySound(0x1EA);
powerFunctioned = true;
}
powerFunctioned = true;
}
if ( powerFunctioned )
{
SpellHelper.Turn( from.Mobile, p );
if (powerFunctioned)
{
SpellHelper.Turn(from.Mobile, p);
Effects.PlaySound( p, from.Mobile.Map, 0x299 );
Effects.PlaySound(p, from.Mobile.Map, 0x299);
from.Mobile.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, false, "You consecrate the area." );
from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You consecrate the area.");
FinishInvoke( from );
}
else
{
from.Mobile.FixedEffect( 0x3735, 6, 30 );
from.Mobile.PlaySound( 0x5C );
}
}
}
}
FinishInvoke(from);
}
else
{
from.Mobile.FixedEffect(0x3735, 6, 30);
from.Mobile.PlaySound(0x5C);
}
}
}
}

View file

@ -1,19 +1,19 @@
namespace Server.Ethics.Hero
{
public sealed class HolyBlade : Power
{
public HolyBlade()
{
m_Definition = new PowerDefinition(
10,
"Holy Blade",
"Erstok Reyam",
""
);
}
public sealed class HolyBlade : Power
{
public HolyBlade()
{
m_Definition = new PowerDefinition(
10,
"Holy Blade",
"Erstok Reyam",
""
);
}
public override void BeginInvoke( Player from )
{
}
}
}
public override void BeginInvoke(Player from)
{
}
}
}

View file

@ -1,67 +1,71 @@
using Server.Items;
using Server.Network;
using Server.Targeting;
namespace Server.Ethics.Hero
{
public sealed class HolyItem : Power
{
public HolyItem()
{
m_Definition = new PowerDefinition(
5,
"Holy Item",
"Vidda K'balc",
""
);
}
public sealed class HolyItem : Power
{
public HolyItem()
{
m_Definition = new PowerDefinition(
5,
"Holy Item",
"Vidda K'balc",
""
);
}
public override void BeginInvoke( Player from )
{
from.Mobile.BeginTarget( 12, false, Targeting.TargetFlags.None, new TargetStateCallback( Power_OnTarget ), from );
from.Mobile.SendMessage( "Which item do you wish to imbue?" );
}
public override void BeginInvoke(Player from)
{
from.Mobile.BeginTarget(12, false, TargetFlags.None, new TargetStateCallback(Power_OnTarget), from);
from.Mobile.SendMessage("Which item do you wish to imbue?");
}
private void Power_OnTarget( Mobile fromMobile, object obj, object state )
{
if (!(state is Player from))
return;
private void Power_OnTarget(Mobile fromMobile, object obj, object state)
{
if (!(state is Player from))
return;
if ( !(obj is Item item) )
{
from.Mobile.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, false, "You may not imbue that." );
return;
}
if (!(obj is Item item))
{
from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You may not imbue that.");
return;
}
if ( item.Parent != from.Mobile )
{
from.Mobile.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, false, "You may only imbue items you are wearing." );
return;
}
if (item.Parent != from.Mobile)
{
from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
"You may only imbue items you are wearing.");
return;
}
if ( ( item.SavedFlags & 0x300 ) != 0 )
{
from.Mobile.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, false, "That has already beem imbued." );
return;
}
if ((item.SavedFlags & 0x300) != 0)
{
from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "That has already beem imbued.");
return;
}
bool canImbue = ( item is Spellbook || item is BaseClothing || item is BaseArmor || item is BaseWeapon ) && ( item.Name == null );
bool canImbue = (item is Spellbook || item is BaseClothing || item is BaseArmor || item is BaseWeapon) &&
item.Name == null;
if ( canImbue )
{
if ( !CheckInvoke( from ) )
return;
if (canImbue)
{
if (!CheckInvoke(from))
return;
item.Hue = Ethic.Hero.Definition.PrimaryHue;
item.SavedFlags |= 0x100;
item.Hue = Ethic.Hero.Definition.PrimaryHue;
item.SavedFlags |= 0x100;
from.Mobile.FixedEffect( 0x375A, 10, 20 );
from.Mobile.PlaySound( 0x209 );
from.Mobile.FixedEffect(0x375A, 10, 20);
from.Mobile.PlaySound(0x209);
FinishInvoke( from );
}
else
{
from.Mobile.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, false, "You may not imbue that." );
}
}
}
}
FinishInvoke(from);
}
else
{
from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You may not imbue that.");
}
}
}
}

View file

@ -1,93 +1,94 @@
using System;
using System.Text;
using Server.Network;
namespace Server.Ethics.Hero
{
public sealed class HolySense : Power
{
public HolySense()
{
m_Definition = new PowerDefinition(
0,
"Holy Sense",
"Drewrok Erstok",
""
);
}
public sealed class HolySense : Power
{
public HolySense()
{
m_Definition = new PowerDefinition(
0,
"Holy Sense",
"Drewrok Erstok",
""
);
}
public override void BeginInvoke( Player from )
{
Ethic opposition = Ethic.Evil;
public override void BeginInvoke(Player from)
{
Ethic opposition = Ethic.Evil;
int enemyCount = 0;
int enemyCount = 0;
int maxRange = 18 + from.Power;
int maxRange = 18 + from.Power;
Player primary = null;
Player primary = null;
foreach ( Player pl in opposition.Players )
{
Mobile mob = pl.Mobile;
foreach (Player pl in opposition.Players)
{
Mobile mob = pl.Mobile;
if ( mob == null || mob.Map != from.Mobile.Map || !mob.Alive )
continue;
if (mob == null || mob.Map != from.Mobile.Map || !mob.Alive)
continue;
if ( !mob.InRange( from.Mobile, Math.Max( 18, maxRange - pl.Power ) ) )
continue;
if (!mob.InRange(from.Mobile, Math.Max(18, maxRange - pl.Power)))
continue;
if ( primary == null || pl.Power > primary.Power )
primary = pl;
if (primary == null || pl.Power > primary.Power)
primary = pl;
++enemyCount;
}
++enemyCount;
}
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder();
sb.Append( "You sense " );
sb.Append( enemyCount == 0 ? "no" : enemyCount.ToString() );
sb.Append( enemyCount == 1 ? " enemy" : " enemies" );
sb.Append("You sense ");
sb.Append(enemyCount == 0 ? "no" : enemyCount.ToString());
sb.Append(enemyCount == 1 ? " enemy" : " enemies");
if ( primary != null )
{
sb.Append( ", and a strong presense" );
if (primary != null)
{
sb.Append(", and a strong presense");
switch ( from.Mobile.GetDirectionTo( primary.Mobile ) )
{
case Direction.West:
sb.Append( " to the west." );
break;
case Direction.East:
sb.Append( " to the east." );
break;
case Direction.North:
sb.Append( " to the north." );
break;
case Direction.South:
sb.Append( " to the south." );
break;
switch (from.Mobile.GetDirectionTo(primary.Mobile))
{
case Direction.West:
sb.Append(" to the west.");
break;
case Direction.East:
sb.Append(" to the east.");
break;
case Direction.North:
sb.Append(" to the north.");
break;
case Direction.South:
sb.Append(" to the south.");
break;
case Direction.Up:
sb.Append( " to the north-west." );
break;
case Direction.Down:
sb.Append( " to the south-east." );
break;
case Direction.Left:
sb.Append( " to the south-west." );
break;
case Direction.Right:
sb.Append( " to the north-east." );
break;
}
}
else
{
sb.Append( '.' );
}
case Direction.Up:
sb.Append(" to the north-west.");
break;
case Direction.Down:
sb.Append(" to the south-east.");
break;
case Direction.Left:
sb.Append(" to the south-west.");
break;
case Direction.Right:
sb.Append(" to the north-east.");
break;
}
}
else
{
sb.Append('.');
}
from.Mobile.LocalOverheadMessage( Network.MessageType.Regular, 0x59, false, sb.ToString() );
from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x59, false, sb.ToString());
FinishInvoke( from );
}
}
}
FinishInvoke(from);
}
}
}

View file

@ -1,30 +1,34 @@
using Server.Network;
namespace Server.Ethics.Hero
{
public sealed class HolyShield : Power
{
public HolyShield()
{
m_Definition = new PowerDefinition(
20,
"Holy Shield",
"Erstok K'blac",
""
);
}
public sealed class HolyShield : Power
{
public HolyShield()
{
m_Definition = new PowerDefinition(
20,
"Holy Shield",
"Erstok K'blac",
""
);
}
public override void BeginInvoke( Player from )
{
if ( from.IsShielded )
{
from.Mobile.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, false, "You are already under the protection of a holy shield." );
return;
}
public override void BeginInvoke(Player from)
{
if (from.IsShielded)
{
from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
"You are already under the protection of a holy shield.");
return;
}
from.BeginShield();
from.BeginShield();
from.Mobile.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, false, "You are now under the protection of a holy shield." );
from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
"You are now under the protection of a holy shield.");
FinishInvoke( from );
}
}
}
FinishInvoke(from);
}
}
}

View file

@ -1,44 +1,46 @@
using System;
using Server.Mobiles;
using Server.Network;
namespace Server.Ethics.Hero
{
public sealed class HolySteed : Power
{
public HolySteed()
{
m_Definition = new PowerDefinition(
30,
"Holy Steed",
"Trubechs Yeliab",
""
);
}
public sealed class HolySteed : Power
{
public HolySteed()
{
m_Definition = new PowerDefinition(
30,
"Holy Steed",
"Trubechs Yeliab",
""
);
}
public override void BeginInvoke( Player from )
{
if ( from.Steed != null && from.Steed.Deleted )
from.Steed = null;
public override void BeginInvoke(Player from)
{
if (from.Steed != null && from.Steed.Deleted)
from.Steed = null;
if ( from.Steed != null )
{
from.Mobile.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, false, "You already have a holy steed." );
return;
}
if (from.Steed != null)
{
from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You already have a holy steed.");
return;
}
if ( ( from.Mobile.Followers + 1 ) > from.Mobile.FollowersMax )
{
from.Mobile.SendLocalizedMessage( 1049645 ); // You have too many followers to summon that creature.
return;
}
if (from.Mobile.Followers + 1 > from.Mobile.FollowersMax)
{
from.Mobile.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
return;
}
Mobiles.HolySteed steed = new Mobiles.HolySteed();
Mobiles.HolySteed steed = new Mobiles.HolySteed();
if ( Mobiles.BaseCreature.Summon( steed, from.Mobile, from.Mobile.Location, 0x217, TimeSpan.FromHours( 1.0 ) ) )
{
from.Steed = steed;
if (BaseCreature.Summon(steed, from.Mobile, from.Mobile.Location, 0x217, TimeSpan.FromHours(1.0)))
{
from.Steed = steed;
FinishInvoke( from );
}
}
}
}
FinishInvoke(from);
}
}
}
}

View file

@ -1,19 +1,19 @@
namespace Server.Ethics.Hero
{
public sealed class HolyWord : Power
{
public HolyWord()
{
m_Definition = new PowerDefinition(
100,
"Holy Word",
"Erstok Oostrac",
""
);
}
public sealed class HolyWord : Power
{
public HolyWord()
{
m_Definition = new PowerDefinition(
100,
"Holy Word",
"Erstok Oostrac",
""
);
}
public override void BeginInvoke( Player from )
{
}
}
}
public override void BeginInvoke(Player from)
{
}
}
}

View file

@ -1,45 +1,46 @@
using System;
using Server.Mobiles;
using Server.Network;
namespace Server.Ethics.Hero
{
public sealed class SummonFamiliar : Power
{
public SummonFamiliar()
{
m_Definition = new PowerDefinition(
5,
"Summon Familiar",
"Trubechs Vingir",
""
);
}
public sealed class SummonFamiliar : Power
{
public SummonFamiliar()
{
m_Definition = new PowerDefinition(
5,
"Summon Familiar",
"Trubechs Vingir",
""
);
}
public override void BeginInvoke( Player from )
{
if ( from.Familiar != null && from.Familiar.Deleted )
from.Familiar = null;
public override void BeginInvoke(Player from)
{
if (from.Familiar != null && from.Familiar.Deleted)
from.Familiar = null;
if ( from.Familiar != null )
{
from.Mobile.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, false, "You already have a holy familiar." );
return;
}
if (from.Familiar != null)
{
from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You already have a holy familiar.");
return;
}
if ( ( from.Mobile.Followers + 1 ) > from.Mobile.FollowersMax )
{
from.Mobile.SendLocalizedMessage( 1049645 ); // You have too many followers to summon that creature.
return;
}
if (from.Mobile.Followers + 1 > from.Mobile.FollowersMax)
{
from.Mobile.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
return;
}
HolyFamiliar familiar = new HolyFamiliar();
HolyFamiliar familiar = new HolyFamiliar();
if ( BaseCreature.Summon( familiar, from.Mobile, from.Mobile.Location, 0x217, TimeSpan.FromHours( 1.0 ) ) )
{
from.Familiar = familiar;
if (BaseCreature.Summon(familiar, from.Mobile, from.Mobile.Location, 0x217, TimeSpan.FromHours(1.0)))
{
from.Familiar = familiar;
FinishInvoke( from );
}
}
}
}
FinishInvoke(from);
}
}
}
}