Fixes casting checks

This commit is contained in:
Kamron Batman 2018-08-19 01:38:55 +08:00
parent 7ea00fbf4f
commit 03dd5f1926
431 changed files with 5616 additions and 6250 deletions

View file

@ -60,13 +60,13 @@ namespace Server
public static int Damage( Mobile m, Mobile from, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois, int nrgy, int chaos, int direct, bool keepAlive, bool archer, bool deathStrike )
{
if( m == null || m.Deleted || !m.Alive || damage <= 0 )
if ( m == null || m.Deleted || !m.Alive || damage <= 0 )
return 0;
if( phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0 )
if ( phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0 )
Mobiles.MeerMage.StopEffect( m, true );
if( !Core.AOS )
if ( !Core.AOS )
{
m.Damage( damage, from );
return damage;
@ -99,7 +99,7 @@ namespace Server
int totalDamage;
if( !ignoreArmor )
if ( !ignoreArmor )
{
// Armor Ignore on OSI ignores all defenses, not just physical.
int resPhys = m.PhysicalResistance;
@ -124,10 +124,10 @@ namespace Server
totalDamage += totalDamage * quiver.DamageIncrease / 100;
}
if( totalDamage < 1 )
if ( totalDamage < 1 )
totalDamage = 1;
}
else if( Core.ML && m is PlayerMobile && from is PlayerMobile )
else if ( Core.ML && m is PlayerMobile && from is PlayerMobile )
{
if ( quiver != null )
damage += damage * quiver.DamageIncrease / 100;
@ -146,11 +146,11 @@ namespace Server
}
#region Dragon Barding
if( (from == null || !from.Player) && m.Player && m.Mount is SwampDragon )
if ( (from == null || !from.Player) && m.Player && m.Mount is SwampDragon )
{
SwampDragon pet = m.Mount as SwampDragon;
if( pet != null && pet.HasBarding )
if ( pet != null && pet.HasBarding )
{
int percent = (pet.BardingExceptional ? 20 : 10);
int absorbed = Scale( totalDamage, percent );
@ -158,7 +158,7 @@ namespace Server
totalDamage -= absorbed;
pet.BardingHP -= absorbed;
if( pet.BardingHP < 0 )
if ( pet.BardingHP < 0 )
{
pet.HasBarding = false;
pet.BardingHP = 0;
@ -169,16 +169,16 @@ namespace Server
}
#endregion
if( keepAlive && totalDamage > m.Hits )
if ( keepAlive && totalDamage > m.Hits )
totalDamage = m.Hits;
if( from != null && !from.Deleted && from.Alive )
if ( from != null && !from.Deleted && from.Alive )
{
int reflectPhys = AosAttributes.GetValue( m, AosAttribute.ReflectPhysical );
if( reflectPhys != 0 )
if ( reflectPhys != 0 )
{
if( from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive )
if ( from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive )
{
from.FixedParticles( 0x376A, 20, 10, 0x2530, EffectLayer.Waist );
from.PlaySound( 0x2F4 );
@ -197,7 +197,7 @@ namespace Server
public static void Fix( ref int val )
{
if( val < 0 )
if ( val < 0 )
val = 0;
}
@ -279,7 +279,7 @@ namespace Server
public static int GetValue( Mobile m, AosAttribute attribute )
{
if( !Core.AOS )
if ( !Core.AOS )
return 0;
List<Item> items = m.Items;
@ -289,52 +289,52 @@ namespace Server
{
Item obj = items[i];
if( obj is BaseWeapon )
if ( obj is BaseWeapon )
{
AosAttributes attrs = ((BaseWeapon)obj).Attributes;
if( attrs != null )
if ( attrs != null )
value += attrs[attribute];
if( attribute == AosAttribute.Luck )
if ( attribute == AosAttribute.Luck )
value += ((BaseWeapon)obj).GetLuckBonus();
}
else if( obj is BaseArmor )
else if ( obj is BaseArmor )
{
AosAttributes attrs = ((BaseArmor)obj).Attributes;
if( attrs != null )
if ( attrs != null )
value += attrs[attribute];
if( attribute == AosAttribute.Luck )
if ( attribute == AosAttribute.Luck )
value += ((BaseArmor)obj).GetLuckBonus();
}
else if( obj is BaseJewel )
else if ( obj is BaseJewel )
{
AosAttributes attrs = ((BaseJewel)obj).Attributes;
if( attrs != null )
if ( attrs != null )
value += attrs[attribute];
}
else if( obj is BaseClothing )
else if ( obj is BaseClothing )
{
AosAttributes attrs = ((BaseClothing)obj).Attributes;
if( attrs != null )
if ( attrs != null )
value += attrs[attribute];
}
else if( obj is Spellbook )
else if ( obj is Spellbook )
{
AosAttributes attrs = ((Spellbook)obj).Attributes;
if( attrs != null )
if ( attrs != null )
value += attrs[attribute];
}
else if( obj is BaseQuiver )
else if ( obj is BaseQuiver )
{
AosAttributes attrs = ((BaseQuiver)obj).Attributes;
if( attrs != null )
if ( attrs != null )
value += attrs[attribute];
}
else if ( obj is BaseTalisman )
@ -516,7 +516,7 @@ namespace Server
public static int GetValue( Mobile m, AosWeaponAttribute attribute )
{
if( !Core.AOS )
if ( !Core.AOS )
return 0;
List<Item> items = m.Items;
@ -526,18 +526,18 @@ namespace Server
{
Item obj = items[i];
if( obj is BaseWeapon )
if ( obj is BaseWeapon )
{
AosWeaponAttributes attrs = ((BaseWeapon)obj).WeaponAttributes;
if( attrs != null )
if ( attrs != null )
value += attrs[attribute];
}
else if ( obj is ElvenGlasses )
{
AosWeaponAttributes attrs = ((ElvenGlasses)obj).WeaponAttributes;
if( attrs != null )
if ( attrs != null )
value += attrs[attribute];
}
}
@ -660,7 +660,7 @@ namespace Server
public static int GetValue( Mobile m, AosArmorAttribute attribute )
{
if( !Core.AOS )
if ( !Core.AOS )
return 0;
List<Item> items = m.Items;
@ -670,18 +670,18 @@ namespace Server
{
Item obj = items[i];
if( obj is BaseArmor )
if ( obj is BaseArmor )
{
AosArmorAttributes attrs = ((BaseArmor)obj).ArmorAttributes;
if( attrs != null )
if ( attrs != null )
value += attrs[attribute];
}
else if( obj is BaseClothing )
else if ( obj is BaseClothing )
{
AosArmorAttributes attrs = ((BaseClothing)obj).ClothingAttributes;
if( attrs != null )
if ( attrs != null )
value += attrs[attribute];
}
}
@ -739,7 +739,7 @@ namespace Server
SkillName skill;
double bonus;
if( !GetValues( i, out skill, out bonus ) )
if ( !GetValues( i, out skill, out bonus ) )
continue;
list.Add( 1060451 + i, "#{0}\t{1}", GetLabel( skill ), bonus );
@ -766,10 +766,10 @@ namespace Server
SkillName skill;
double bonus;
if( !GetValues( i, out skill, out bonus ) )
if ( !GetValues( i, out skill, out bonus ) )
continue;
if( m_Mods == null )
if ( m_Mods == null )
m_Mods = new List<SkillMod>();
SkillMod sk = new DefaultSkillMod( skill, true, bonus );
@ -781,7 +781,7 @@ namespace Server
public void Remove()
{
if( m_Mods == null )
if ( m_Mods == null )
return;
for( int i = 0; i < m_Mods.Count; ++i ) {
@ -1083,17 +1083,17 @@ namespace Server
public int GetValue( int bitmask )
{
if( !Core.AOS )
if ( !Core.AOS )
return 0;
uint mask = (uint)bitmask;
if( (m_Names & mask) == 0 )
if ( (m_Names & mask) == 0 )
return 0;
int index = GetIndex( mask );
if( index >= 0 && index < m_Values.Length )
if ( index >= 0 && index < m_Values.Length )
return m_Values[index];
return 0;
@ -1101,35 +1101,35 @@ namespace Server
public void SetValue( int bitmask, int value )
{
if( (bitmask == (int)AosWeaponAttribute.DurabilityBonus) && (this is AosWeaponAttributes) )
if ( (bitmask == (int)AosWeaponAttribute.DurabilityBonus) && (this is AosWeaponAttributes) )
{
if( m_Owner is BaseWeapon )
if ( m_Owner is BaseWeapon )
((BaseWeapon)m_Owner).UnscaleDurability();
}
else if( (bitmask == (int)AosArmorAttribute.DurabilityBonus) && (this is AosArmorAttributes) )
else if ( (bitmask == (int)AosArmorAttribute.DurabilityBonus) && (this is AosArmorAttributes) )
{
if( m_Owner is BaseArmor )
if ( m_Owner is BaseArmor )
((BaseArmor)m_Owner).UnscaleDurability();
else if( m_Owner is BaseClothing )
else if ( m_Owner is BaseClothing )
((BaseClothing)m_Owner).UnscaleDurability();
}
uint mask = (uint)bitmask;
if( value != 0 )
if ( value != 0 )
{
if( (m_Names & mask) != 0 )
if ( (m_Names & mask) != 0 )
{
int index = GetIndex( mask );
if( index >= 0 && index < m_Values.Length )
if ( index >= 0 && index < m_Values.Length )
m_Values[index] = value;
}
else
{
int index = GetIndex( mask );
if( index >= 0 && index <= m_Values.Length )
if ( index >= 0 && index <= m_Values.Length )
{
int[] old = m_Values;
m_Values = new int[old.Length + 1];
@ -1146,15 +1146,15 @@ namespace Server
}
}
}
else if( (m_Names & mask) != 0 )
else if ( (m_Names & mask) != 0 )
{
int index = GetIndex( mask );
if( index >= 0 && index < m_Values.Length )
if ( index >= 0 && index < m_Values.Length )
{
m_Names &= ~mask;
if( m_Values.Length == 1 )
if ( m_Values.Length == 1 )
{
m_Values = m_Empty;
}
@ -1172,20 +1172,20 @@ namespace Server
}
}
if( (bitmask == (int)AosWeaponAttribute.DurabilityBonus) && (this is AosWeaponAttributes) )
if ( (bitmask == (int)AosWeaponAttribute.DurabilityBonus) && (this is AosWeaponAttributes) )
{
if( m_Owner is BaseWeapon )
if ( m_Owner is BaseWeapon )
((BaseWeapon)m_Owner).ScaleDurability();
}
else if( (bitmask == (int)AosArmorAttribute.DurabilityBonus) && (this is AosArmorAttributes) )
else if ( (bitmask == (int)AosArmorAttribute.DurabilityBonus) && (this is AosArmorAttributes) )
{
if( m_Owner is BaseArmor )
if ( m_Owner is BaseArmor )
((BaseArmor)m_Owner).ScaleDurability();
else if( m_Owner is BaseClothing )
else if ( m_Owner is BaseClothing )
((BaseClothing)m_Owner).ScaleDurability();
}
if( m_Owner.Parent is Mobile )
if ( m_Owner.Parent is Mobile )
{
Mobile m = (Mobile)m_Owner.Parent;
@ -1193,7 +1193,7 @@ namespace Server
m.UpdateResistances();
m.Delta( MobileDelta.Stat | MobileDelta.WeaponDamage | MobileDelta.Hits | MobileDelta.Stam | MobileDelta.Mana );
if( this is AosSkillBonuses )
if ( this is AosSkillBonuses )
{
((AosSkillBonuses)this).Remove();
((AosSkillBonuses)this).AddTo( m );
@ -1211,10 +1211,10 @@ namespace Server
while( currentBit != mask )
{
if( (ourNames & currentBit) != 0 )
if ( (ourNames & currentBit) != 0 )
++index;
if( currentBit == 0x80000000 )
if ( currentBit == 0x80000000 )
return -1;
currentBit <<= 1;

View file

@ -13,7 +13,7 @@ namespace Server.Misc
Console.WriteLine( "This server has no accounts." );
Console.Write( "Do you want to create the owner account now? (y/n)" );
if( Console.ReadKey( true ).Key == ConsoleKey.Y )
if ( Console.ReadKey( true ).Key == ConsoleKey.Y )
{
Console.WriteLine();
@ -37,4 +37,4 @@ namespace Server.Misc
}
}
}
}
}

View file

@ -12,13 +12,13 @@ namespace Server
public static void Initialize()
{
if( Enabled )
if ( Enabled )
{
EventSink.ClientVersionReceived += new ClientVersionReceivedHandler( delegate( ClientVersionReceivedArgs args )
{
PlayerMobile pm = args.State.Mobile as PlayerMobile;
if( pm != null )
if ( pm != null )
Timer.DelayCall( TimeSpan.Zero, pm.ResendBuffs );
} );
}
@ -81,7 +81,7 @@ namespace Server
{
PlayerMobile pm = m as PlayerMobile;
if( pm == null )
if ( pm == null )
return;
pm.RemoveBuff( this );
@ -152,7 +152,7 @@ namespace Server
{
PlayerMobile pm = m as PlayerMobile;
if( pm != null )
if ( pm != null )
pm.AddBuff( b );
}
@ -160,7 +160,7 @@ namespace Server
{
PlayerMobile pm = m as PlayerMobile;
if( pm != null )
if ( pm != null )
pm.RemoveBuff( b );
}
@ -168,7 +168,7 @@ namespace Server
{
PlayerMobile pm = m as PlayerMobile;
if( pm != null )
if ( pm != null )
pm.RemoveBuff( b );
}
#endregion
@ -257,7 +257,7 @@ namespace Server
m_Stream.Fill( 4 );
if( length < TimeSpan.Zero )
if ( length < TimeSpan.Zero )
length = TimeSpan.Zero;
m_Stream.Write( (short)length.TotalSeconds ); //Time in seconds
@ -266,7 +266,7 @@ namespace Server
m_Stream.Write( (int)titleCliloc );
m_Stream.Write( (int)secondaryCliloc );
if( !hasArgs )
if ( !hasArgs )
{
//m_Stream.Fill( 2 );
m_Stream.Fill( 10 );

View file

@ -361,7 +361,7 @@ namespace Server.Misc
PlaceItemIn( bank, 18, 124, cont );
if( Core.SE )
if ( Core.SE )
{
cont = new Bag();
cont.Hue = 0x501;
@ -391,7 +391,7 @@ namespace Server.Misc
PlaceItemIn( bank, 58, 124, cont );
}
if( Core.SE ) //This bag came only after SE.
if ( Core.SE ) //This bag came only after SE.
{
cont = new Bag();
cont.Name = "Bag of Bows";
@ -407,7 +407,7 @@ namespace Server.Misc
{
BaseRanged bow = cont.Items[i] as BaseRanged;
if( bow != null )
if ( bow != null )
{
bow.Attributes.WeaponSpeed = 35;
bow.Attributes.WeaponDamage = 35;
@ -590,7 +590,7 @@ namespace Server.Misc
private static void AddShoes( Mobile m )
{
if( m.Race == Race.Elf )
if ( m.Race == Race.Elf )
EquipItem( new ElvenBoots(), true );
else
EquipItem( new Shoes( Utility.RandomYellowHue() ), true );
@ -636,7 +636,7 @@ namespace Server.Misc
newChar.Female = args.Female;
//newChar.Body = newChar.Female ? 0x191 : 0x190;
if( Core.Expansion >= args.Race.RequiredExpansion )
if ( Core.Expansion >= args.Race.RequiredExpansion )
newChar.Race = args.Race; //Sets body
else
newChar.Race = Race.DefaultRace;
@ -667,13 +667,13 @@ namespace Server.Misc
Race race = newChar.Race;
if( race.ValidateHair( newChar, args.HairID ) )
if ( race.ValidateHair( newChar, args.HairID ) )
{
newChar.HairItemID = args.HairID;
newChar.HairHue = race.ClipHairHue( args.HairHue & 0x3FFF );
}
if( race.ValidateFacialHair( newChar, args.BeardID ) )
if ( race.ValidateFacialHair( newChar, args.BeardID ) )
{
newChar.FacialHairItemID = args.BeardID;
newChar.FacialHairHue = race.ClipHairHue( args.BeardHue & 0x3FFF );
@ -686,7 +686,7 @@ namespace Server.Misc
AddShoes( newChar );
}
if( TestCenter.Enabled )
if ( TestCenter.Enabled )
FillBankbox( newChar );
if ( young )
@ -742,9 +742,9 @@ namespace Server.Misc
private static CityInfo GetStartLocation( CharacterCreatedEventArgs args, bool isYoung )
{
if( Core.ML )
if ( Core.ML )
{
//if( args.State != null && args.State.NewHaven )
//if ( args.State != null && args.State.NewHaven )
return m_NewHavenInfo; //We don't get the client Version until AFTER Character creation
//return args.City; TODO: Uncomment when the old quest system is actually phased out
@ -765,14 +765,14 @@ namespace Server.Misc
}
else
{
useHaven = true;
useHaven = true;
new BadStartMessage( m, 1062205 );
/*
* Unfortunately you are playing on a *NON-Age-Of-Shadows* game
* installation and cannot be transported to Malas.
* You will not be able to take your new player quest in Malas
* without an AOS client. You are now being taken to the city of
* Unfortunately you are playing on a *NON-Age-Of-Shadows* game
* installation and cannot be transported to Malas.
* You will not be able to take your new player quest in Malas
* without an AOS client. You are now being taken to the city of
* Haven on the Trammel facet.
* */
}
@ -795,10 +795,10 @@ namespace Server.Misc
new BadStartMessage( m, 1063487 );
/*
* Unfortunately you are playing on a *NON-Samurai-Empire* game
* installation and cannot be transported to Tokuno.
* You will not be able to take your new player quest in Tokuno
* without an SE client. You are now being taken to the city of
* Unfortunately you are playing on a *NON-Samurai-Empire* game
* installation and cannot be transported to Tokuno.
* You will not be able to take your new player quest in Tokuno
* without an SE client. You are now being taken to the city of
* Haven on the Trammel facet.
* */
}
@ -817,10 +817,10 @@ namespace Server.Misc
new BadStartMessage( m, 1063487 );
/*
* Unfortunately you are playing on a *NON-Samurai-Empire* game
* installation and cannot be transported to Tokuno.
* You will not be able to take your new player quest in Tokuno
* without an SE client. You are now being taken to the city of
* Unfortunately you are playing on a *NON-Samurai-Empire* game
* installation and cannot be transported to Tokuno.
* You will not be able to take your new player quest in Tokuno
* without an SE client. You are now being taken to the city of
* Haven on the Trammel facet.
* */
}
@ -829,7 +829,7 @@ namespace Server.Misc
}
}
if( useHaven )
if ( useHaven )
return m_NewHavenInfo;
else
return args.City;
@ -1151,12 +1151,12 @@ namespace Server.Misc
{
addSkillItems = false;
EquipItem( new Kasa() );
int[] hues = new int[] { 0x1A8, 0xEC, 0x99, 0x90, 0xB5, 0x336, 0x89 };
//TODO: Verify that's ALL the hues for that above.
EquipItem( new TattsukeHakama( hues[Utility.Random(hues.Length)] ) );
EquipItem( new HakamaShita( 0x2C3 ) );
EquipItem( new NinjaTabi( 0x2C3 ) );
@ -1351,7 +1351,7 @@ namespace Server.Misc
EquipItem( new ElvenCompositeLongbow() );
else
EquipItem( new Bow() );
break;
}
case SkillName.ArmsLore:
@ -1442,7 +1442,7 @@ namespace Server.Misc
}
case SkillName.Chivalry:
{
if( Core.ML )
if ( Core.ML )
PackItem( new BookOfChivalry( (ulong)0x3FF ) );
break;
@ -1566,7 +1566,7 @@ namespace Server.Misc
{
EquipItem( new Circlet() );
if( m.Female )
if ( m.Female )
EquipItem( new FemaleElvenRobe( Utility.RandomBlueHue() ) );
else
EquipItem( new MaleElvenRobe( Utility.RandomBlueHue() ) );
@ -1591,7 +1591,7 @@ namespace Server.Misc
}
case SkillName.Necromancy:
{
if( Core.ML )
if ( Core.ML )
{
Container regs = new BagOfNecroReagents( 50 );
@ -1707,4 +1707,4 @@ namespace Server.Misc
}
}
}
}
}

View file

@ -84,7 +84,7 @@ namespace Server.Misc
items.Add( item );
continue;
}
else if( item.Parent == rootMobile )
else if ( item.Parent == rootMobile )
{
hairCleanup.Add( rootMobile );
continue;
@ -167,4 +167,4 @@ namespace Server.Misc
return false;
}
}
}
}

View file

@ -97,11 +97,11 @@ namespace Server.Misc
//ClientVersion.Required = null;
//Required = new ClientVersion( "6.0.0.0" );
if( m_DetectClientRequirement )
if ( m_DetectClientRequirement )
{
string path = Core.FindDataFile( "client.exe" );
if( File.Exists( path ) )
if ( File.Exists( path ) )
{
FileVersionInfo info = FileVersionInfo.GetVersionInfo( path );
@ -112,7 +112,7 @@ namespace Server.Misc
}
}
if( Required != null )
if ( Required != null )
{
Utility.PushColor( ConsoleColor.White );
Console.WriteLine( "Restricting client version to {0}. Action to be taken: {1}", Required, m_OldClientResponse );
@ -129,53 +129,53 @@ namespace Server.Misc
if ( state.Mobile == null || state.Mobile.AccessLevel > AccessLevel.Player )
return;
if( Required != null && version < Required && ( m_OldClientResponse == OldClientResponse.Kick ||( m_OldClientResponse == OldClientResponse.LenientKick && (DateTime.UtcNow - state.Mobile.CreationTime) > m_AgeLeniency && state.Mobile is PlayerMobile && ((PlayerMobile)state.Mobile).GameTime > m_GameTimeLeniency )))
if ( Required != null && version < Required && ( m_OldClientResponse == OldClientResponse.Kick ||( m_OldClientResponse == OldClientResponse.LenientKick && (DateTime.UtcNow - state.Mobile.CreationTime) > m_AgeLeniency && state.Mobile is PlayerMobile && ((PlayerMobile)state.Mobile).GameTime > m_GameTimeLeniency )))
{
kickMessage = String.Format( "This server requires your client version be at least {0}.", Required );
}
else if( !AllowGod || !AllowRegular || !AllowUOTD )
else if ( !AllowGod || !AllowRegular || !AllowUOTD )
{
if( !AllowGod && version.Type == ClientType.God )
if ( !AllowGod && version.Type == ClientType.God )
kickMessage = "This server does not allow god clients to connect.";
else if( !AllowRegular && version.Type == ClientType.Regular )
else if ( !AllowRegular && version.Type == ClientType.Regular )
kickMessage = "This server does not allow regular clients to connect.";
else if( !AllowUOTD && state.IsUOTDClient )
else if ( !AllowUOTD && state.IsUOTDClient )
kickMessage = "This server does not allow UO:TD clients to connect.";
if( !AllowGod && !AllowRegular && !AllowUOTD )
if ( !AllowGod && !AllowRegular && !AllowUOTD )
{
kickMessage = "This server does not allow any clients to connect.";
}
else if( AllowGod && !AllowRegular && !AllowUOTD && version.Type != ClientType.God )
else if ( AllowGod && !AllowRegular && !AllowUOTD && version.Type != ClientType.God )
{
kickMessage = "This server requires you to use the god client.";
}
else if( kickMessage != null )
else if ( kickMessage != null )
{
if( AllowRegular && AllowUOTD )
if ( AllowRegular && AllowUOTD )
kickMessage += " You can use regular or UO:TD clients.";
else if( AllowRegular )
else if ( AllowRegular )
kickMessage += " You can use regular clients.";
else if( AllowUOTD )
else if ( AllowUOTD )
kickMessage += " You can use UO:TD clients.";
}
}
if( kickMessage != null )
if ( kickMessage != null )
{
state.Mobile.SendMessage( 0x22, kickMessage );
state.Mobile.SendMessage( 0x22, "You will be disconnected in {0} seconds.", KickDelay.TotalSeconds );
Timer.DelayCall( KickDelay, delegate
{
if( state.Socket != null )
if ( state.Socket != null )
{
Console.WriteLine( "Client: {0}: Disconnecting, bad version", state );
state.Dispose();
}
} );
}
else if( Required != null && version < Required )
else if ( Required != null && version < Required )
{
switch( m_OldClientResponse )
{
@ -197,7 +197,7 @@ namespace Server.Misc
private static void SendAnnoyGump( Mobile m )
{
if( m.NetState != null && m.NetState.Version < Required )
if ( m.NetState != null && m.NetState.Version < Required )
{
Gump g = new WarningGump( 1060637, 30720, String.Format( "Your client is out of date. Please update your client.<br>This server recommends that your client version be at least {0}.<br> <br>You are currently using version {1}.<br> <br>To patch, run UOPatch.exe inside your Ultima Online folder.", Required, m.NetState.Version ), 0xFFC000, 480, 360,
delegate( Mobile mob, bool selection, object o )
@ -218,4 +218,4 @@ namespace Server.Misc
}
}
}
}
}

View file

@ -16,7 +16,7 @@ namespace Server.Misc
private static string CustomPath = null;
/* The following is a list of files which a required for proper execution:
*
*
* Multi.idx
* Multi.mul
* VerData.mul
@ -39,13 +39,13 @@ namespace Server.Misc
string pathSA = GetPath( @"Electronic Arts\EA Games\Ultima Online Stygian Abyss Classic", "InstallDir" );
string pathHS = GetPath( @"Electronic Arts\EA Games\Ultima Online Classic", "InstallDir" );
if ( CustomPath != null )
Core.DataDirectories.Add( CustomPath );
if ( CustomPath != null )
Core.DataDirectories.Add( CustomPath );
if ( pathUO != null )
Core.DataDirectories.Add( pathUO );
if ( pathUO != null )
Core.DataDirectories.Add( pathUO );
if ( pathTD != null )
if ( pathTD != null )
Core.DataDirectories.Add( pathTD );
if ( pathKR != null )
@ -72,19 +72,19 @@ namespace Server.Misc
{
string keyString;
if( Core.Is64Bit )
if ( Core.Is64Bit )
keyString = @"SOFTWARE\Wow6432Node\{0}";
else
keyString = @"SOFTWARE\{0}";
using( RegistryKey key = Registry.LocalMachine.OpenSubKey( String.Format( keyString, subName ) ) )
{
if( key == null )
if ( key == null )
return null;
string v = key.GetValue( keyName ) as string;
if( String.IsNullOrEmpty( v ) )
if ( String.IsNullOrEmpty( v ) )
return null;
if ( keyName == "InstallDir" )
@ -104,4 +104,4 @@ namespace Server.Misc
}
}
}
}
}

View file

@ -103,11 +103,11 @@ namespace Server.Guilds
public void CheckLeader()
{
if( m_Leader == null || m_Leader.Disbanded )
if ( m_Leader == null || m_Leader.Disbanded )
{
CalculateAllianceLeader();
if( m_Leader == null )
if ( m_Leader == null )
Disband();
}
}
@ -121,19 +121,19 @@ namespace Server.Guilds
}
set
{
if( m_Leader != value && value != null )
if ( m_Leader != value && value != null )
AllianceMessage( 1070765, value.Name ); // Your Alliance is now led by ~1_GUILDNAME~
m_Leader = value;
if( m_Leader == null )
if ( m_Leader == null )
CalculateAllianceLeader();
}
}
public bool IsPendingMember( Guild g )
{
if( g.Alliance != this )
if ( g.Alliance != this )
return false;
return m_PendingMembers.Contains( g );
@ -141,7 +141,7 @@ namespace Server.Guilds
public bool IsMember( Guild g )
{
if( g.Alliance != this )
if ( g.Alliance != this )
return false;
return m_Members.Contains( g );
@ -158,7 +158,7 @@ namespace Server.Guilds
leader.Alliance = this;
partner.Alliance = this;
if( !m_Alliances.ContainsKey( m_Name.ToLower() ) )
if ( !m_Alliances.ContainsKey( m_Name.ToLower() ) )
m_Alliances.Add( m_Name.ToLower(), this );
}
@ -172,7 +172,7 @@ namespace Server.Guilds
writer.WriteGuildList( m_Members, true );
writer.WriteGuildList( m_PendingMembers, true );
if( !m_Alliances.ContainsKey( m_Name.ToLower() ) )
if ( !m_Alliances.ContainsKey( m_Name.ToLower() ) )
m_Alliances.Add( m_Name.ToLower(), this );
}
@ -197,7 +197,7 @@ namespace Server.Guilds
public void AddPendingGuild( Guild g )
{
if( g.Alliance != this || m_PendingMembers.Contains( g ) || m_Members.Contains( g ) )
if ( g.Alliance != this || m_PendingMembers.Contains( g ) || m_Members.Contains( g ) )
return;
m_PendingMembers.Add( g );
@ -205,7 +205,7 @@ namespace Server.Guilds
public void TurnToMember( Guild g )
{
if( g.Alliance != this || !m_PendingMembers.Contains( g ) || m_Members.Contains( g ) )
if ( g.Alliance != this || !m_PendingMembers.Contains( g ) || m_Members.Contains( g ) )
return;
g.GuildMessage( 1070760, this.Name ); // Your Guild has joined the ~1_ALLIANCENAME~ Alliance.
@ -218,12 +218,12 @@ namespace Server.Guilds
public void RemoveGuild( Guild g )
{
if( m_PendingMembers.Contains( g ) )
if ( m_PendingMembers.Contains( g ) )
{
m_PendingMembers.Remove( g );
}
if( m_Members.Contains( g ) ) //Sanity, just incase someone with a custom script adds a character to BOTH arrays
if ( m_Members.Contains( g ) ) //Sanity, just incase someone with a custom script adds a character to BOTH arrays
{
m_Members.Remove( g );
g.InvalidateMemberProperties();
@ -236,19 +236,19 @@ namespace Server.Guilds
//to check on OSI: have 3 guilds, make 2 of them a member, one pending. remove one of the memebers. alliance still exist?
//ANSWER: NO
if( g == m_Leader )
if ( g == m_Leader )
{
CalculateAllianceLeader();
/*
if( m_Leader == null ) //only when m_members.count < 2
if ( m_Leader == null ) //only when m_members.count < 2
Disband();
else
AllianceMessage( 1070765, m_Leader.Name ); // Your Alliance is now led by ~1_GUILDNAME~
*/
}
if( m_Members.Count < 2 )
if ( m_Members.Count < 2 )
Disband();
}
@ -264,7 +264,7 @@ namespace Server.Guilds
m_Alliances.TryGetValue( m_Name.ToLower(), out AllianceInfo aInfo );
if( aInfo == this )
if ( aInfo == this )
m_Alliances.Remove( m_Name.ToLower() );
}
@ -353,9 +353,9 @@ namespace Server.Guilds
NetState state = m.NetState;
if( state != null )
if ( state != null )
{
if( p == null )
if ( p == null )
p = Packet.Acquire( new UnicodeMessage( from.Serial, from.Body, MessageType.Alliance, hue, 3, from.Language, from.Name, text ) );
state.Send( p );
@ -397,7 +397,7 @@ namespace Server.Guilds
public override void OnResponse( NetState sender, RelayInfo info )
{
if( info.ButtonID != 8 ) //So that they can't get to the AdvancedSearch button
if ( info.ButtonID != 8 ) //So that they can't get to the AdvancedSearch button
base.OnResponse( sender, info );
}
}
@ -514,34 +514,34 @@ namespace Server.Guilds
{
get
{
if( m_Opponent == null || m_Opponent.Disbanded )
if ( m_Opponent == null || m_Opponent.Disbanded )
return WarStatus.Win;
if( m_Guild == null || m_Guild.Disbanded )
if ( m_Guild == null || m_Guild.Disbanded )
return WarStatus.Lose;
WarDeclaration w = m_Opponent.FindActiveWar( m_Guild );
if( m_Opponent.FindPendingWar( m_Guild ) != null && m_Guild.FindPendingWar( m_Opponent ) != null )
if ( m_Opponent.FindPendingWar( m_Guild ) != null && m_Guild.FindPendingWar( m_Opponent ) != null )
return WarStatus.Pending;
if( w == null )
if ( w == null )
return WarStatus.Win;
if( m_WarLength != TimeSpan.Zero && (m_WarBeginning + m_WarLength) < DateTime.UtcNow )
if ( m_WarLength != TimeSpan.Zero && (m_WarBeginning + m_WarLength) < DateTime.UtcNow )
{
if( m_Kills > w.m_Kills )
if ( m_Kills > w.m_Kills )
return WarStatus.Win;
else if( m_Kills < w.m_Kills )
else if ( m_Kills < w.m_Kills )
return WarStatus.Lose;
else
return WarStatus.Draw;
}
else if( m_MaxKills > 0 )
else if ( m_MaxKills > 0 )
{
if( m_Kills >= m_MaxKills )
if ( m_Kills >= m_MaxKills )
return WarStatus.Win;
else if( w.m_Kills >= w.MaxKills )
else if ( w.m_Kills >= w.MaxKills )
return WarStatus.Lose;
}
@ -556,7 +556,7 @@ namespace Server.Guilds
public static void Initialize()
{
if( Guild.NewGuildSystem )
if ( Guild.NewGuildSystem )
new WarTimer().Start();
}
@ -592,7 +592,7 @@ namespace Server.Guilds
string arg = e.ArgString.Trim();
Mobile from = e.Mobile;
if( arg.Length == 0 )
if ( arg.Length == 0 )
{
e.Mobile.Target = new GuildPropsTarget();
}
@ -602,14 +602,14 @@ namespace Server.Guilds
int id;
if( int.TryParse( arg, out id ) )
if ( int.TryParse( arg, out id ) )
g = Guild.Find( id ) as Guild;
if( g == null )
if ( g == null )
{
g = Guild.FindByAbbrev( arg ) as Guild;
if( g == null )
if ( g == null )
g = Guild.FindByName( arg ) as Guild;
}
@ -632,7 +632,7 @@ namespace Server.Guilds
protected override void OnTarget( Mobile from, object o )
{
if( !BaseCommand.IsAccessible( from, o ) )
if ( !BaseCommand.IsAccessible( from, o ) )
{
from.SendMessage( "That is not accessible." );
return;
@ -640,10 +640,10 @@ namespace Server.Guilds
Guild g = null;
if( o is Guildstone )
if ( o is Guildstone )
{
Guildstone stone = o as Guildstone;
if( stone.Guild == null || stone.Guild.Disbanded )
if ( stone.Guild == null || stone.Guild.Disbanded )
{
from.SendMessage( "The guild associated with that Guildstone no longer exists" );
return;
@ -651,16 +651,16 @@ namespace Server.Guilds
else
g = stone.Guild;
}
else if( o is Mobile )
else if ( o is Mobile )
{
g = ((Mobile)o).Guild as Guild;
}
if( g != null )
if ( g != null )
{
from.SendGump( new PropertiesGump( from, g ) );
if( NewGuildSystem && from.AccessLevel >= AccessLevel.GameMaster && from is PlayerMobile )
if ( NewGuildSystem && from.AccessLevel >= AccessLevel.GameMaster && from is PlayerMobile )
from.SendGump( new GuildInfoGump( (PlayerMobile)from, g ) );
}
else
@ -675,10 +675,10 @@ namespace Server.Guilds
public static void EventSink_GuildGumpRequest( GuildGumpRequestArgs args )
{
PlayerMobile pm = args.Mobile as PlayerMobile;
if( !NewGuildSystem || pm == null )
if ( !NewGuildSystem || pm == null )
return;
if( pm.Guild == null )
if ( pm.Guild == null )
pm.SendGump( new CreateGuildGump( pm ) );
else
pm.SendGump( new GuildInfoGump( pm, pm.Guild as Guild ) );
@ -705,7 +705,7 @@ namespace Server.Guilds
public AllianceInfo Alliance
{
get{
if( m_AllianceInfo != null )
if ( m_AllianceInfo != null )
return m_AllianceInfo;
else if ( m_AllianceLeader != null )
return m_AllianceLeader.m_AllianceInfo;
@ -716,18 +716,18 @@ namespace Server.Guilds
{
AllianceInfo current = this.Alliance;
if( value == current )
if ( value == current )
return;
if( current != null )
if ( current != null )
{
current.RemoveGuild( this );
}
if( value != null )
if ( value != null )
{
if( value.Leader == this )
if ( value.Leader == this )
m_AllianceInfo = value;
else
m_AllianceLeader = value.Leader;
@ -748,7 +748,7 @@ namespace Server.Guilds
get
{
AllianceInfo al = this.Alliance;
if( al != null )
if ( al != null )
return al.Name;
return null;
@ -762,7 +762,7 @@ namespace Server.Guilds
{
AllianceInfo al = this.Alliance;
if( al != null )
if ( al != null )
return al.Leader;
return null;
@ -776,7 +776,7 @@ namespace Server.Guilds
{
AllianceInfo al = this.Alliance;
if( al != null )
if ( al != null )
return al.IsMember( this );
return false;
@ -790,7 +790,7 @@ namespace Server.Guilds
{
AllianceInfo al = this.Alliance;
if( al != null )
if ( al != null )
return al.IsPendingMember( this );
return false;
@ -827,7 +827,7 @@ namespace Server.Guilds
{
WarDeclaration w = PendingWars[i];
if( w.Opponent == g )
if ( w.Opponent == g )
return w;
}
@ -840,7 +840,7 @@ namespace Server.Guilds
{
WarDeclaration w = AcceptedWars[i];
if( w.Opponent == g )
if ( w.Opponent == g )
return w;
}
@ -856,7 +856,7 @@ namespace Server.Guilds
WarStatus status = w.Status;
if( status != WarStatus.InProgress )
if ( status != WarStatus.InProgress )
{
AllianceInfo myAlliance = this.Alliance;
bool inAlliance = ( myAlliance != null && myAlliance.IsMember( this ) );
@ -864,7 +864,7 @@ namespace Server.Guilds
AllianceInfo otherAlliance = ((g != null) ? g.Alliance : null);
bool otherInAlliance = ( otherAlliance != null && otherAlliance.IsMember( this ) );
if( inAlliance )
if ( inAlliance )
{
myAlliance.AllianceMessage( 1070739 + (int)status, (g == null) ? "a deleted opponent" : (otherInAlliance ? otherAlliance.Name : g.Name) );
myAlliance.InvalidateMemberProperties();
@ -877,12 +877,12 @@ namespace Server.Guilds
this.AcceptedWars.Remove( w );
if( g != null )
if ( g != null )
{
if( status != WarStatus.Draw )
if ( status != WarStatus.Draw )
status = (WarStatus)((int)status + 1 % 2);
if( otherInAlliance )
if ( otherInAlliance )
{
otherAlliance.AllianceMessage( 1070739 + (int)status, ( inAlliance ? this.Alliance.Name : this.Name ) );
otherAlliance.InvalidateMemberProperties();
@ -903,12 +903,12 @@ namespace Server.Guilds
WarDeclaration w = PendingWars[i];
Guild g = w.Opponent;
if( w.Status != WarStatus.Pending )
if ( w.Status != WarStatus.Pending )
{
//All sanity in here
this.PendingWars.Remove( w );
if( g != null )
if ( g != null )
{
g.PendingWars.Remove( g.FindPendingWar( this ) );
}
@ -923,13 +923,13 @@ namespace Server.Guilds
public static void HandleDeath( Mobile victim, Mobile killer )
{
if( !NewGuildSystem )
if ( !NewGuildSystem )
return;
if ( killer == null )
killer = victim.FindMostRecentDamager( false );
if( killer == null || victim.Guild == null || killer.Guild == null )
if ( killer == null || victim.Guild == null || killer.Guild == null )
return;
Guild victimGuild = GetAllianceLeader( victim.Guild as Guild );
@ -937,7 +937,7 @@ namespace Server.Guilds
WarDeclaration war = killerGuild.FindActiveWar( victimGuild );
if( war == null )
if ( war == null )
return;
war.Kills++;
@ -1006,7 +1006,7 @@ namespace Server.Guilds
AddMember( m_Leader );
if( m_Leader is PlayerMobile )
if ( m_Leader is PlayerMobile )
((PlayerMobile)m_Leader).GuildRank = RankDefinition.Leader;
m_AcceptedWars = new List<WarDeclaration>();
@ -1082,15 +1082,15 @@ namespace Server.Guilds
}
set
{
if( value != null )
if ( value != null )
this.AddMember( value ); //Also removes from old guild.
if( m_Leader is PlayerMobile && m_Leader.Guild == this )
if ( m_Leader is PlayerMobile && m_Leader.Guild == this )
((PlayerMobile)m_Leader).GuildRank = RankDefinition.Member;
m_Leader = value;
if( m_Leader is PlayerMobile )
if ( m_Leader is PlayerMobile )
((PlayerMobile)m_Leader).GuildRank = RankDefinition.Leader;
}
}
@ -1120,7 +1120,7 @@ namespace Server.Guilds
{
m.SendLocalizedMessage( 502131 ); // Your guild has disbanded.
if( m is PlayerMobile )
if ( m is PlayerMobile )
((PlayerMobile)m).GuildRank = RankDefinition.Lowest;
m.Guild = null;
@ -1154,7 +1154,7 @@ namespace Server.Guilds
public bool IsAlly( Guild g )
{
if( NewGuildSystem )
if ( NewGuildSystem )
{
return (Alliance != null && Alliance.IsMember( this ) && Alliance.IsMember( g ));
}
@ -1164,7 +1164,7 @@ namespace Server.Guilds
public bool IsEnemy( Guild g )
{
if( Type != GuildType.Regular && g.Type != GuildType.Regular && Type != g.Type )
if ( Type != GuildType.Regular && g.Type != GuildType.Regular && Type != g.Type )
return true;
return IsWar( g );
@ -1172,10 +1172,10 @@ namespace Server.Guilds
public bool IsWar( Guild g )
{
if( g == null )
if ( g == null )
return false;
if( NewGuildSystem )
if ( NewGuildSystem )
{
Guild guild = GetAllianceLeader( this );
Guild otherGuild = GetAllianceLeader( g );
@ -1198,7 +1198,7 @@ namespace Server.Guilds
CheckExpiredWars();
if( Alliance != null )
if ( Alliance != null )
Alliance.CheckLeader();
writer.Write( (int) 5 );//version
@ -1224,7 +1224,7 @@ namespace Server.Guilds
bool isAllianceLeader = (m_AllianceLeader == null && m_AllianceInfo != null );
writer.Write( isAllianceLeader );
if( isAllianceLeader )
if ( isAllianceLeader )
m_AllianceInfo.Serialize( writer );
else
writer.Write( m_AllianceLeader );
@ -1287,7 +1287,7 @@ namespace Server.Guilds
bool isAllianceLeader = reader.ReadBool();
if( isAllianceLeader )
if ( isAllianceLeader )
m_AllianceInfo = new AllianceInfo( reader );
else
m_AllianceLeader = reader.ReadGuild() as Guild;
@ -1324,7 +1324,7 @@ namespace Server.Guilds
{
m_Leader = reader.ReadMobile();
if( m_Leader is PlayerMobile )
if ( m_Leader is PlayerMobile )
((PlayerMobile)m_Leader).GuildRank = RankDefinition.Leader;
m_Name = reader.ReadString();
@ -1373,19 +1373,19 @@ namespace Server.Guilds
private void VerifyGuild_Callback()
{
if( (!NewGuildSystem && m_Guildstone == null) || m_Members.Count == 0 )
if ( (!NewGuildSystem && m_Guildstone == null) || m_Members.Count == 0 )
Disband();
CheckExpiredWars();
AllianceInfo alliance = this.Alliance;
if( alliance != null )
if ( alliance != null )
alliance.CheckLeader();
alliance = this.Alliance; //CheckLeader could possibly change the value of this.Alliance
if( alliance != null && !alliance.IsMember( this ) && !alliance.IsPendingMember( this ) ) //This block is there to fix a bug in the code in an older version.
if ( alliance != null && !alliance.IsMember( this ) && !alliance.IsPendingMember( this ) ) //This block is there to fix a bug in the code in an older version.
this.Alliance = null; //Will call Alliance.RemoveGuild which will set it null & perform all the pertient checks as far as alliacne disbanding
}
@ -1403,12 +1403,12 @@ namespace Server.Guilds
m_Members.Add( m );
m.Guild = this;
if( !NewGuildSystem )
if ( !NewGuildSystem )
m.GuildFealty = m_Leader;
else
m.GuildFealty = null;
if( m is PlayerMobile )
if ( m is PlayerMobile )
((PlayerMobile)m).GuildRank = RankDefinition.Lowest;
Guild guild = m.Guild as Guild;
@ -1432,10 +1432,10 @@ namespace Server.Guilds
m.Guild = null;
if( m is PlayerMobile )
if ( m is PlayerMobile )
((PlayerMobile)m).GuildRank = RankDefinition.Lowest;
if( message > 0 )
if ( message > 0 )
m.SendLocalizedMessage( message );
if ( m == m_Leader )
@ -1558,9 +1558,9 @@ namespace Server.Guilds
NetState state = m.NetState;
if( state != null )
if ( state != null )
{
if( p == null )
if ( p == null )
p = Packet.Acquire( new UnicodeMessage( from.Serial, from.Body, MessageType.Guild, hue, 3, from.Language, from.Name, text ) );
state.Send( p );
@ -1581,10 +1581,10 @@ namespace Server.Guilds
#region Voting
public bool CanVote( Mobile m )
{
if( NewGuildSystem )
if ( NewGuildSystem )
{
PlayerMobile pm = m as PlayerMobile;
if( pm == null || !pm.GuildRank.GetFlag( RankFlags.CanVote ) )
if ( pm == null || !pm.GuildRank.GetFlag( RankFlags.CanVote ) )
return false;
}
@ -1592,10 +1592,10 @@ namespace Server.Guilds
}
public bool CanBeVotedFor( Mobile m )
{
if( NewGuildSystem )
if ( NewGuildSystem )
{
PlayerMobile pm = m as PlayerMobile;
if( pm == null || pm.LastOnline + InactiveTime < DateTime.UtcNow )
if ( pm == null || pm.LastOnline + InactiveTime < DateTime.UtcNow )
return false;
}
@ -1617,7 +1617,7 @@ namespace Server.Guilds
Mobile m = memb.GuildFealty;
if( !CanBeVotedFor( m ) )
if ( !CanBeVotedFor( m ) )
{
if ( m_Leader != null && !m_Leader.Deleted && m_Leader.Guild == this )
m = m_Leader;
@ -1628,7 +1628,7 @@ namespace Server.Guilds
if ( m == null )
continue;
if( !votes.TryGetValue( m, out int v ) )
if ( !votes.TryGetValue( m, out int v ) )
votes[m] = 1;
else
votes[m] = v + 1;
@ -1651,7 +1651,7 @@ namespace Server.Guilds
}
}
if( NewGuildSystem && (highVotes * 100) / Math.Max( votingMembers, 1 ) < MajorityPercentage && m_Leader != null && winner != m_Leader && !m_Leader.Deleted && m_Leader.Guild == this )
if ( NewGuildSystem && (highVotes * 100) / Math.Max( votingMembers, 1 ) < MajorityPercentage && m_Leader != null && winner != m_Leader && !m_Leader.Deleted && m_Leader.Guild == this )
winner = m_Leader;
if ( m_Leader != winner && winner != null )
@ -1734,7 +1734,7 @@ namespace Server.Guilds
InvalidateMemberProperties( true );
if( m_Guildstone != null )
if ( m_Guildstone != null )
m_Guildstone.InvalidateProperties();
}
}

View file

@ -33,7 +33,7 @@ namespace Server.Misc
}
case 0x0032: // *i must consider my sins*
{
if( !Core.SE )
if ( !Core.SE )
{
from.SendMessage( "Short Term Murders : {0}", from.ShortTermMurders );
from.SendMessage( "Long Term Murders : {0}", from.Kills );
@ -57,4 +57,4 @@ namespace Server.Misc
}
}
}
}
}

View file

@ -17,7 +17,7 @@ namespace Server
int luck = killer.Luck;
PlayerMobile pmKiller = killer as PlayerMobile;
if( pmKiller != null && pmKiller.SentHonorContext != null && pmKiller.SentHonorContext.Target == victim )
if ( pmKiller != null && pmKiller.SentHonorContext != null && pmKiller.SentHonorContext.Target == victim )
luck += pmKiller.SentHonorContext.PerfectionLuckBonus;
if ( luck < 0 )
@ -78,7 +78,7 @@ namespace Server
{
checkLuck = false;
if( LootPack.CheckLuck( luckChance ) )
if ( LootPack.CheckLuck( luckChance ) )
shouldAdd = ( entry.Chance > Utility.Random( 10000 ) );
}
@ -991,4 +991,4 @@ namespace Server
m_Bonus = bonus;
}
}
}
}

View file

@ -36,9 +36,9 @@ namespace Server.Misc
private static GuildStatus GetGuildStatus( Mobile m )
{
if( m.Guild == null )
if ( m.Guild == null )
return GuildStatus.None;
else if( ((Guild)m.Guild).Enemies.Count == 0 && m.Guild.Type == GuildType.Regular )
else if ( ((Guild)m.Guild).Enemies.Count == 0 && m.Guild.Type == GuildType.Regular )
return GuildStatus.Peaceful;
return GuildStatus.Waring;
@ -46,7 +46,7 @@ namespace Server.Misc
private static bool CheckBeneficialStatus( GuildStatus from, GuildStatus target )
{
if( from == GuildStatus.Waring || target == GuildStatus.Waring )
if ( from == GuildStatus.Waring || target == GuildStatus.Waring )
return false;
return true;
@ -62,58 +62,58 @@ namespace Server.Misc
public static bool Mobile_AllowBeneficial( Mobile from, Mobile target )
{
if( from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player )
if ( from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player )
return true;
#region Dueling
PlayerMobile pmFrom = from as PlayerMobile;
PlayerMobile pmTarg = target as PlayerMobile;
if( pmFrom == null && from is BaseCreature )
if ( pmFrom == null && from is BaseCreature )
{
BaseCreature bcFrom = (BaseCreature)from;
if( bcFrom.Summoned )
if ( bcFrom.Summoned )
pmFrom = bcFrom.SummonMaster as PlayerMobile;
}
if( pmTarg == null && target is BaseCreature )
if ( pmTarg == null && target is BaseCreature )
{
BaseCreature bcTarg = (BaseCreature)target;
if( bcTarg.Summoned )
if ( bcTarg.Summoned )
pmTarg = bcTarg.SummonMaster as PlayerMobile;
}
if( pmFrom != null && pmTarg != null )
if ( pmFrom != null && pmTarg != null )
{
if( pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started)) )
if ( pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started)) )
return false;
if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated) )
if ( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated) )
return false;
if( pmFrom.DuelPlayer != null && !pmFrom.DuelPlayer.Eliminated && pmFrom.DuelContext != null && pmFrom.DuelContext.IsSuddenDeath )
if ( pmFrom.DuelPlayer != null && !pmFrom.DuelPlayer.Eliminated && pmFrom.DuelContext != null && pmFrom.DuelContext.IsSuddenDeath )
return false;
if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant != pmTarg.DuelPlayer.Participant )
if ( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant != pmTarg.DuelPlayer.Participant )
return false;
if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started )
if ( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started )
return true;
}
if( (pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started) )
if ( (pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started) )
return false;
Engines.ConPVP.SafeZone sz = from.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) as Engines.ConPVP.SafeZone;
if( sz != null /*&& sz.IsDisabled()*/ )
if ( sz != null /*&& sz.IsDisabled()*/ )
return false;
sz = target.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) as Engines.ConPVP.SafeZone;
if( sz != null /*&& sz.IsDisabled()*/ )
if ( sz != null /*&& sz.IsDisabled()*/ )
return false;
#endregion
@ -122,30 +122,30 @@ namespace Server.Misc
#region Factions
Faction targetFaction = Faction.Find( target, true );
if( (!Core.ML || map == Faction.Facet) && targetFaction != null )
if ( (!Core.ML || map == Faction.Facet) && targetFaction != null )
{
if( Faction.Find( from, true ) != targetFaction )
if ( Faction.Find( from, true ) != targetFaction )
return false;
}
#endregion
if( map != null && (map.Rules & MapRules.BeneficialRestrictions) == 0 )
if ( map != null && (map.Rules & MapRules.BeneficialRestrictions) == 0 )
return true; // In felucca, anything goes
if( !from.Player )
if ( !from.Player )
return true; // NPCs have no restrictions
if( target is BaseCreature && !((BaseCreature)target).Controlled )
if ( target is BaseCreature && !((BaseCreature)target).Controlled )
return false; // Players cannot heal uncontrolled mobiles
if( from is PlayerMobile && ((PlayerMobile)from).Young && (!(target is PlayerMobile) || !((PlayerMobile)target).Young) )
if ( from is PlayerMobile && ((PlayerMobile)from).Young && (!(target is PlayerMobile) || !((PlayerMobile)target).Young) )
return false; // Young players cannot perform beneficial actions towards older players
Guild fromGuild = from.Guild as Guild;
Guild targetGuild = target.Guild as Guild;
if( fromGuild != null && targetGuild != null && (targetGuild == fromGuild || fromGuild.IsAlly( targetGuild )) )
if ( fromGuild != null && targetGuild != null && (targetGuild == fromGuild || fromGuild.IsAlly( targetGuild )) )
return true; // Guild members can be beneficial
return CheckBeneficialStatus( GetGuildStatus( from ), GetGuildStatus( target ) );
@ -153,68 +153,68 @@ namespace Server.Misc
public static bool Mobile_AllowHarmful( Mobile from, Mobile target )
{
if( from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player )
if ( from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player )
return true;
#region Dueling
PlayerMobile pmFrom = from as PlayerMobile;
PlayerMobile pmTarg = target as PlayerMobile;
if( pmFrom == null && from is BaseCreature )
if ( pmFrom == null && from is BaseCreature )
{
BaseCreature bcFrom = (BaseCreature)from;
if( bcFrom.Summoned )
if ( bcFrom.Summoned )
pmFrom = bcFrom.SummonMaster as PlayerMobile;
}
if( pmTarg == null && target is BaseCreature )
if ( pmTarg == null && target is BaseCreature )
{
BaseCreature bcTarg = (BaseCreature)target;
if( bcTarg.Summoned )
if ( bcTarg.Summoned )
pmTarg = bcTarg.SummonMaster as PlayerMobile;
}
if( pmFrom != null && pmTarg != null )
if ( pmFrom != null && pmTarg != null )
{
if( pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started)) )
if ( pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started)) )
return false;
if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated) )
if ( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated) )
return false;
if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant == pmTarg.DuelPlayer.Participant )
if ( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant == pmTarg.DuelPlayer.Participant )
return false;
if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started )
if ( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started )
return true;
}
if( (pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started) )
if ( (pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started) )
return false;
Engines.ConPVP.SafeZone sz = from.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) as Engines.ConPVP.SafeZone;
if( sz != null /*&& sz.IsDisabled()*/ )
if ( sz != null /*&& sz.IsDisabled()*/ )
return false;
sz = target.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) as Engines.ConPVP.SafeZone;
if( sz != null /*&& sz.IsDisabled()*/ )
if ( sz != null /*&& sz.IsDisabled()*/ )
return false;
#endregion
Map map = from.Map;
if( map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0 )
if ( map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0 )
return true; // In felucca, anything goes
BaseCreature bc = from as BaseCreature;
if( !from.Player && !(bc != null && bc.GetMaster() != null && bc.GetMaster().AccessLevel == AccessLevel.Player ) )
if ( !from.Player && !(bc != null && bc.GetMaster() != null && bc.GetMaster().AccessLevel == AccessLevel.Player ) )
{
if( !CheckAggressor( from.Aggressors, target ) && !CheckAggressed( from.Aggressed, target ) && target is PlayerMobile && ((PlayerMobile)target).CheckYoungProtection( from ) )
if ( !CheckAggressor( from.Aggressors, target ) && !CheckAggressed( from.Aggressed, target ) && target is PlayerMobile && ((PlayerMobile)target).CheckYoungProtection( from ) )
return false;
return true; // Uncontrolled NPCs are only restricted by the young system
@ -223,18 +223,18 @@ namespace Server.Misc
Guild fromGuild = GetGuildFor( from.Guild as Guild, from );
Guild targetGuild = GetGuildFor( target.Guild as Guild, target );
if( fromGuild != null && targetGuild != null && (fromGuild == targetGuild || fromGuild.IsAlly( targetGuild ) || fromGuild.IsEnemy( targetGuild )) )
if ( fromGuild != null && targetGuild != null && (fromGuild == targetGuild || fromGuild.IsAlly( targetGuild ) || fromGuild.IsEnemy( targetGuild )) )
return true; // Guild allies or enemies can be harmful
if( target is BaseCreature && (((BaseCreature)target).Controlled || (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster)) )
if ( target is BaseCreature && (((BaseCreature)target).Controlled || (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster)) )
return false; // Cannot harm other controlled mobiles
if( target.Player )
if ( target.Player )
return false; // Cannot harm other players
if( !(target is BaseCreature && ((BaseCreature)target).InitialInnocent) )
if ( !(target is BaseCreature && ((BaseCreature)target).InitialInnocent) )
{
if( Notoriety.Compute( from, target ) == Notoriety.Innocent )
if ( Notoriety.Compute( from, target ) == Notoriety.Innocent )
return false; // Cannot harm innocent mobiles
}
@ -247,13 +247,13 @@ namespace Server.Misc
BaseCreature c = m as BaseCreature;
if( c != null && c.Controlled && c.ControlMaster != null )
if ( c != null && c.Controlled && c.ControlMaster != null )
{
c.DisplayGuildTitle = false;
if( c.Map != Map.Internal && (Core.AOS || Guild.NewGuildSystem || c.ControlOrder == OrderType.Attack || c.ControlOrder == OrderType.Guard) )
if ( c.Map != Map.Internal && (Core.AOS || Guild.NewGuildSystem || c.ControlOrder == OrderType.Attack || c.ControlOrder == OrderType.Guard) )
g = (Guild)(c.Guild = c.ControlMaster.Guild);
else if( c.Map == Map.Internal || c.ControlMaster.Guild == null )
else if ( c.Map == Map.Internal || c.ControlMaster.Guild == null )
g = (Guild)(c.Guild = null);
}
@ -262,41 +262,41 @@ namespace Server.Misc
public static int CorpseNotoriety( Mobile source, Corpse target )
{
if( target.AccessLevel > AccessLevel.Player )
if ( target.AccessLevel > AccessLevel.Player )
return Notoriety.CanBeAttacked;
Body body = (Body)target.Amount;
BaseCreature cretOwner = target.Owner as BaseCreature;
if( cretOwner != null )
if ( cretOwner != null )
{
Guild sourceGuild = GetGuildFor( source.Guild as Guild, source );
Guild targetGuild = GetGuildFor( target.Guild as Guild, target.Owner );
if( sourceGuild != null && targetGuild != null )
if ( sourceGuild != null && targetGuild != null )
{
if( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) )
if ( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) )
return Notoriety.Ally;
else if( sourceGuild.IsEnemy( targetGuild ) )
else if ( sourceGuild.IsEnemy( targetGuild ) )
return Notoriety.Enemy;
}
Faction srcFaction = Faction.Find( source, true, true );
Faction trgFaction = Faction.Find( target.Owner, true, true );
if( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet )
if ( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet )
return Notoriety.Enemy;
if( CheckHouseFlag( source, target.Owner, target.Location, target.Map ) )
if ( CheckHouseFlag( source, target.Owner, target.Location, target.Map ) )
return Notoriety.CanBeAttacked;
int actual = Notoriety.CanBeAttacked;
if( target.Kills >= 5 || (body.IsMonster && IsSummoned( target.Owner as BaseCreature )) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).AlwaysMurderer || ((BaseCreature)target.Owner).IsAnimatedDead)) )
if ( target.Kills >= 5 || (body.IsMonster && IsSummoned( target.Owner as BaseCreature )) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).AlwaysMurderer || ((BaseCreature)target.Owner).IsAnimatedDead)) )
actual = Notoriety.Murderer;
if( DateTime.UtcNow >= (target.TimeOfDeath + Corpse.MonsterLootRightSacrifice) )
if ( DateTime.UtcNow >= (target.TimeOfDeath + Corpse.MonsterLootRightSacrifice) )
return actual;
Party sourceParty = Party.Get( source );
@ -305,7 +305,7 @@ namespace Server.Misc
for( int i = 0; i < list.Count; ++i )
{
if( list[i] == source || (sourceParty != null && Party.Get( list[i] ) == sourceParty) )
if ( list[i] == source || (sourceParty != null && Party.Get( list[i] ) == sourceParty) )
return actual;
}
@ -313,7 +313,7 @@ namespace Server.Misc
}
else
{
if( target.Kills >= 5 || (body.IsMonster && IsSummoned( target.Owner as BaseCreature )) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).AlwaysMurderer || ((BaseCreature)target.Owner).IsAnimatedDead)) )
if ( target.Kills >= 5 || (body.IsMonster && IsSummoned( target.Owner as BaseCreature )) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).AlwaysMurderer || ((BaseCreature)target.Owner).IsAnimatedDead)) )
return Notoriety.Murderer;
if (target.Criminal && target.Map != null && ((target.Map.Rules & MapRules.HarmfulRestrictions) == 0))
@ -322,42 +322,42 @@ namespace Server.Misc
Guild sourceGuild = GetGuildFor( source.Guild as Guild, source );
Guild targetGuild = GetGuildFor( target.Guild as Guild, target.Owner );
if( sourceGuild != null && targetGuild != null )
if ( sourceGuild != null && targetGuild != null )
{
if( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) )
if ( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) )
return Notoriety.Ally;
else if( sourceGuild.IsEnemy( targetGuild ) )
else if ( sourceGuild.IsEnemy( targetGuild ) )
return Notoriety.Enemy;
}
Faction srcFaction = Faction.Find( source, true, true );
Faction trgFaction = Faction.Find( target.Owner, true, true );
if( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet )
if ( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet )
{
List<Mobile> secondList = target.Aggressors;
for( int i = 0; i < secondList.Count; ++i )
{
if( secondList[i] == source || secondList[i] is BaseFactionGuard )
if ( secondList[i] == source || secondList[i] is BaseFactionGuard )
return Notoriety.Enemy;
}
}
if( target.Owner != null && target.Owner is BaseCreature && ((BaseCreature)target.Owner).AlwaysAttackable )
if ( target.Owner != null && target.Owner is BaseCreature && ((BaseCreature)target.Owner).AlwaysAttackable )
return Notoriety.CanBeAttacked;
if( CheckHouseFlag( source, target.Owner, target.Location, target.Map ) )
if ( CheckHouseFlag( source, target.Owner, target.Location, target.Map ) )
return Notoriety.CanBeAttacked;
if( !(target.Owner is PlayerMobile) && !IsPet( target.Owner as BaseCreature ) )
if ( !(target.Owner is PlayerMobile) && !IsPet( target.Owner as BaseCreature ) )
return Notoriety.CanBeAttacked;
List<Mobile> list = target.Aggressors;
for( int i = 0; i < list.Count; ++i )
{
if( list[i] == source )
if ( list[i] == source )
return Notoriety.CanBeAttacked;
}
@ -373,20 +373,20 @@ namespace Server.Misc
return Notoriety.Invulnerable;
#region Dueling
if( source is PlayerMobile && target is PlayerMobile )
if ( source is PlayerMobile && target is PlayerMobile )
{
PlayerMobile pmFrom = (PlayerMobile)source;
PlayerMobile pmTarg = (PlayerMobile)target;
if( pmFrom.DuelContext != null && pmFrom.DuelContext.StartedBeginCountdown && !pmFrom.DuelContext.Finished && pmFrom.DuelContext == pmTarg.DuelContext )
if ( pmFrom.DuelContext != null && pmFrom.DuelContext.StartedBeginCountdown && !pmFrom.DuelContext.Finished && pmFrom.DuelContext == pmTarg.DuelContext )
return pmFrom.DuelContext.IsAlly( pmFrom, pmTarg ) ? Notoriety.Ally : Notoriety.Enemy;
}
#endregion
if( target.AccessLevel > AccessLevel.Player )
if ( target.AccessLevel > AccessLevel.Player )
return Notoriety.CanBeAttacked;
if( source.Player && !target.Player && source is PlayerMobile && target is BaseCreature )
if ( source.Player && !target.Player && source is PlayerMobile && target is BaseCreature )
{
BaseCreature bc = (BaseCreature)target;
@ -405,69 +405,69 @@ namespace Server.Misc
return MobileNotoriety( source, master );
}
if( !bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType() )
if ( !bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType() )
return Notoriety.Enemy;
}
if ( target.Kills >= 5 || ( target.Body.IsMonster && IsSummoned( target as BaseCreature ) && !( target is BaseFamiliar ) && !( target is ArcaneFey ) && !( target is Golem ) ) || ( target is BaseCreature && ( ( (BaseCreature)target ).AlwaysMurderer || ( (BaseCreature)target ).IsAnimatedDead ) ) )
return Notoriety.Murderer;
if( target.Criminal )
if ( target.Criminal )
return Notoriety.Criminal;
Guild sourceGuild = GetGuildFor( source.Guild as Guild, source );
Guild targetGuild = GetGuildFor( target.Guild as Guild, target );
if( sourceGuild != null && targetGuild != null )
if ( sourceGuild != null && targetGuild != null )
{
if( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) )
if ( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) )
return Notoriety.Ally;
else if( sourceGuild.IsEnemy( targetGuild ) )
else if ( sourceGuild.IsEnemy( targetGuild ) )
return Notoriety.Enemy;
}
Faction srcFaction = Faction.Find( source, true, true );
Faction trgFaction = Faction.Find( target, true, true );
if( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet )
if ( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet )
return Notoriety.Enemy;
if( SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains( source ) )
if ( SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains( source ) )
return Notoriety.CanBeAttacked;
if( target is BaseCreature && ((BaseCreature)target).AlwaysAttackable )
if ( target is BaseCreature && ((BaseCreature)target).AlwaysAttackable )
return Notoriety.CanBeAttacked;
if( CheckHouseFlag( source, target, target.Location, target.Map ) )
if ( CheckHouseFlag( source, target, target.Location, target.Map ) )
return Notoriety.CanBeAttacked;
if( !(target is BaseCreature && ((BaseCreature)target).InitialInnocent) ) //If Target is NOT A baseCreature, OR it's a BC and the BC is initial innocent...
if ( !(target is BaseCreature && ((BaseCreature)target).InitialInnocent) ) //If Target is NOT A baseCreature, OR it's a BC and the BC is initial innocent...
{
if( !target.Body.IsHuman && !target.Body.IsGhost && !IsPet( target as BaseCreature ) && !(target is PlayerMobile) || !Core.ML && !target.CanBeginAction( typeof( Server.Spells.Seventh.PolymorphSpell ) ) )
if ( !target.Body.IsHuman && !target.Body.IsGhost && !IsPet( target as BaseCreature ) && !(target is PlayerMobile) || !Core.ML && !target.CanBeginAction( typeof( Server.Spells.Seventh.PolymorphSpell ) ) )
return Notoriety.CanBeAttacked;
}
if( CheckAggressor( source.Aggressors, target ) )
if ( CheckAggressor( source.Aggressors, target ) )
return Notoriety.CanBeAttacked;
if( CheckAggressed( source.Aggressed, target ) )
if ( CheckAggressed( source.Aggressed, target ) )
return Notoriety.CanBeAttacked;
if( target is BaseCreature )
if ( target is BaseCreature )
{
BaseCreature bc = (BaseCreature)target;
if( bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source )
if ( bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source )
return Notoriety.CanBeAttacked;
}
if( source is BaseCreature )
if ( source is BaseCreature )
{
BaseCreature bc = (BaseCreature)source;
Mobile master = bc.GetMaster();
if( master != null )
if( CheckAggressor( master.Aggressors, target ) || MobileNotoriety( master, target ) == Notoriety.CanBeAttacked || target is BaseCreature )
if ( master != null )
if ( CheckAggressor( master.Aggressors, target ) || MobileNotoriety( master, target ) == Notoriety.CanBeAttacked || target is BaseCreature )
return Notoriety.CanBeAttacked;
}
@ -478,15 +478,15 @@ namespace Server.Misc
{
BaseHouse house = BaseHouse.FindHouseAt( p, map, 16 );
if( house == null || house.Public || !house.IsFriend( from ) )
if ( house == null || house.Public || !house.IsFriend( from ) )
return false;
if( m != null && house.IsFriend( m ) )
if ( m != null && house.IsFriend( m ) )
return false;
BaseCreature c = m as BaseCreature;
if( c != null && !c.Deleted && c.Controlled && c.ControlMaster != null )
if ( c != null && !c.Deleted && c.Controlled && c.ControlMaster != null )
return !house.IsFriend( c.ControlMaster );
return true;
@ -505,7 +505,7 @@ namespace Server.Misc
public static bool CheckAggressor( List<AggressorInfo> list, Mobile target )
{
for( int i = 0; i < list.Count; ++i )
if( list[i].Attacker == target )
if ( list[i].Attacker == target )
return true;
return false;
@ -517,11 +517,11 @@ namespace Server.Misc
{
AggressorInfo info = list[i];
if( !info.CriminalAggression && info.Defender == target )
if ( !info.CriminalAggression && info.Defender == target )
return true;
}
return false;
}
}
}
}

View file

@ -8,7 +8,7 @@ namespace Server.Misc
public static void Configure()
{
/* Here we configure all races. Some notes:
*
*
* 1) The first 32 races are reserved for core use.
* 2) Race 0x7F is reserved for core use.
* 3) Race 0xFF is reserved for core use.
@ -35,16 +35,16 @@ namespace Server.Misc
public override bool ValidateHair( bool female, int itemID )
{
if( itemID == 0 )
if ( itemID == 0 )
return true;
if( (female && itemID == 0x2048) || (!female && itemID == 0x2046 ) )
if ( (female && itemID == 0x2048) || (!female && itemID == 0x2046 ) )
return false; //Buns & Receeding Hair
if( itemID >= 0x203B && itemID <= 0x203D )
if ( itemID >= 0x203B && itemID <= 0x203D )
return true;
if( itemID >= 0x2044 && itemID <= 0x204A )
if ( itemID >= 0x2044 && itemID <= 0x204A )
return true;
return false;
@ -68,16 +68,16 @@ namespace Server.Misc
public override bool ValidateFacialHair( bool female, int itemID )
{
if( itemID == 0 )
if ( itemID == 0 )
return true;
if( female )
if ( female )
return false;
if( itemID >= 0x203E && itemID <= 0x2041 )
if ( itemID >= 0x203E && itemID <= 0x2041 )
return true;
if( itemID >= 0x204B && itemID <= 0x204D )
if ( itemID >= 0x204B && itemID <= 0x204D )
return true;
return false;
@ -85,7 +85,7 @@ namespace Server.Misc
public override int RandomFacialHair( bool female )
{
if( female )
if ( female )
return 0;
int rand = Utility.Random( 7 );
@ -95,9 +95,9 @@ namespace Server.Misc
public override int ClipSkinHue( int hue )
{
if( hue < 1002 )
if ( hue < 1002 )
return 1002;
else if( hue > 1058 )
else if ( hue > 1058 )
return 1058;
else
return hue;
@ -110,9 +110,9 @@ namespace Server.Misc
public override int ClipHairHue( int hue )
{
if( hue < 1102 )
if ( hue < 1102 )
return 1102;
else if( hue > 1149 )
else if ( hue > 1149 )
return 1149;
else
return hue;
@ -152,16 +152,16 @@ namespace Server.Misc
public override bool ValidateHair( bool female, int itemID )
{
if( itemID == 0 )
if ( itemID == 0 )
return true;
if( (female && (itemID == 0x2FCD || itemID == 0x2FBF)) || (!female && (itemID == 0x2FCC || itemID == 0x2FD0)) )
if ( (female && (itemID == 0x2FCD || itemID == 0x2FBF)) || (!female && (itemID == 0x2FCC || itemID == 0x2FD0)) )
return false;
if( itemID >= 0x2FBF && itemID <= 0x2FC2 )
if ( itemID >= 0x2FBF && itemID <= 0x2FC2 )
return true;
if( itemID >= 0x2FCC && itemID <= 0x2FD1 )
if ( itemID >= 0x2FCC && itemID <= 0x2FD1 )
return true;
return false;
@ -195,7 +195,7 @@ namespace Server.Misc
public override int ClipSkinHue( int hue )
{
for( int i = 0; i < m_SkinHues.Length; i++ )
if( m_SkinHues[i] == hue )
if ( m_SkinHues[i] == hue )
return hue;
return m_SkinHues[0];
@ -209,7 +209,7 @@ namespace Server.Misc
public override int ClipHairHue( int hue )
{
for( int i = 0; i < m_HairHues.Length; i++ )
if( m_HairHues[i] == hue )
if ( m_HairHues[i] == hue )
return hue;
return m_HairHues[0];

View file

@ -60,13 +60,13 @@ namespace Server.Misc
if ( (from is BaseCreature && ((BaseCreature)from).IsParagon) || from is Leviathan )
points += 40;
if( Core.ML && from.Race == Race.Human ) //Is this affected by the cap?
if ( Core.ML && from.Race == Race.Human ) //Is this affected by the cap?
points += 2;
if ( points < 0 )
points = 0;
if( Core.ML && from is PlayerMobile ) //does racial bonus go before/after?
if ( Core.ML && from is PlayerMobile ) //does racial bonus go before/after?
points = Math.Min( points, 18 );
if ( CheckTransform( from, typeof( HorrificBeastSpell ) ) )
@ -87,7 +87,7 @@ namespace Server.Misc
int points =(int)(from.Skills[SkillName.Focus].Value * 0.1);
if( (from is BaseCreature && ((BaseCreature)from).IsParagon) || from is Leviathan )
if ( (from is BaseCreature && ((BaseCreature)from).IsParagon) || from is Leviathan )
points += 40;
int cappedPoints = AosAttributes.GetValue( from, AosAttribute.RegenStam );
@ -98,7 +98,7 @@ namespace Server.Misc
if ( CheckAnimal( from, typeof( Kirin ) ) )
cappedPoints += 20;
if( Core.ML && from is PlayerMobile )
if ( Core.ML && from is PlayerMobile )
cappedPoints = Math.Min( cappedPoints, 24 );
points += cappedPoints;
@ -135,7 +135,7 @@ namespace Server.Misc
double totalPoints = focusPoints + medPoints + (from.Meditating ? (medPoints > 13.0 ? 13.0 : medPoints) : 0.0);
if( (from is BaseCreature && ((BaseCreature)from).IsParagon) || from is Leviathan )
if ( (from is BaseCreature && ((BaseCreature)from).IsParagon) || from is Leviathan )
totalPoints += 40;
int cappedPoints = AosAttributes.GetValue( from, AosAttribute.RegenMana );
@ -145,7 +145,7 @@ namespace Server.Misc
else if ( CheckTransform( from, typeof( LichFormSpell ) ) )
cappedPoints += 13;
if( Core.ML && from is PlayerMobile )
if ( Core.ML && from is PlayerMobile )
cappedPoints = Math.Min( cappedPoints, 18 );
totalPoints += cappedPoints;
@ -216,4 +216,4 @@ namespace Server.Misc
}
}
}
}
}

View file

@ -20,16 +20,16 @@ namespace Server.Misc
{
name = name.Trim();
if( NameVerification.Validate( name, 1, 16, true, false, true, 0, NameVerification.Empty, NameVerification.StartDisallowed, ( Core.ML ? NameVerification.Disallowed : new string[]{} ) ) )
if ( NameVerification.Validate( name, 1, 16, true, false, true, 0, NameVerification.Empty, NameVerification.StartDisallowed, ( Core.ML ? NameVerification.Disallowed : new string[]{} ) ) )
{
if( Core.ML )
if ( Core.ML )
{
string[] disallowed = ProfanityProtection.Disallowed;
for( int i = 0; i < disallowed.Length; i++ )
{
if( name.IndexOf( disallowed[i] ) != -1 )
if ( name.IndexOf( disallowed[i] ) != -1 )
{
from.SendLocalizedMessage( 1072622 ); // That name isn't very polite.
return;
@ -48,4 +48,4 @@ namespace Server.Misc
}
}
}
}
}

View file

@ -348,7 +348,7 @@ namespace Server.Misc
if ( (from.LastStrGain + m_PetStatGainDelay) >= DateTime.UtcNow )
return;
}
else if( (from.LastStrGain + m_StatGainDelay) >= DateTime.UtcNow )
else if ( (from.LastStrGain + m_StatGainDelay) >= DateTime.UtcNow )
return;
from.LastStrGain = DateTime.UtcNow;
@ -360,7 +360,7 @@ namespace Server.Misc
if ( (from.LastDexGain + m_PetStatGainDelay) >= DateTime.UtcNow )
return;
}
else if( (from.LastDexGain + m_StatGainDelay) >= DateTime.UtcNow )
else if ( (from.LastDexGain + m_StatGainDelay) >= DateTime.UtcNow )
return;
from.LastDexGain = DateTime.UtcNow;
@ -373,7 +373,7 @@ namespace Server.Misc
return;
}
else if( (from.LastIntGain + m_StatGainDelay) >= DateTime.UtcNow )
else if ( (from.LastIntGain + m_StatGainDelay) >= DateTime.UtcNow )
return;
from.LastIntGain = DateTime.UtcNow;
@ -386,4 +386,4 @@ namespace Server.Misc
IncreaseStat( from, stat, atrophy );
}
}
}
}

View file

@ -172,11 +172,11 @@ namespace Server.Misc
title.Append( beheld.Name );
}
if( beheld is PlayerMobile && ((PlayerMobile)beheld).DisplayChampionTitle )
if ( beheld is PlayerMobile && ((PlayerMobile)beheld).DisplayChampionTitle )
{
PlayerMobile.ChampionTitleInfo info = ((PlayerMobile)beheld).ChampionTitles;
if( info.Harrower > 0 )
if ( info.Harrower > 0 )
title.AppendFormat( ": {0} of Evil", HarrowerTitles[Math.Min( HarrowerTitles.Length, info.Harrower )-1] );
else
{
@ -185,7 +185,7 @@ namespace Server.Misc
{
int v = info.GetValue( i );
if( v > highestValue )
if ( v > highestValue )
{
highestValue = v;
highestType = i;
@ -193,12 +193,12 @@ namespace Server.Misc
}
int offset = 0;
if( highestValue > 800 )
if ( highestValue > 800 )
offset = 3;
else if( highestValue > 300 )
else if ( highestValue > 300 )
offset = (int)(highestValue/300);
if( offset > 0 )
if ( offset > 0 )
{
ChampionSpawnInfo champInfo = ChampionSpawnInfo.GetInfo( (ChampionSpawnType)highestType );
title.AppendFormat( ": {0} of the {1}", champInfo.LevelNames[Math.Min( offset, champInfo.LevelNames.Length ) -1], champInfo.Name );
@ -397,4 +397,4 @@ namespace Server.Misc
m_Title = title;
}
}
}
}