Fixes casting checks
This commit is contained in:
parent
7ea00fbf4f
commit
03dd5f1926
431 changed files with 5616 additions and 6250 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue