public static void SendMobileMoving(this NetState ns, Mobile source, Mobile target) => ns.SendMobileMoving(target, Notoriety.Compute(source, target));
public static void SendMobileMovingUsingCache(this NetState ns, Span2D <byte> cache, Mobile source, Mobile target) => ns.SendMobileMovingUsingCache(cache, target, Notoriety.Compute(source, target));
public static bool Mobile_AllowHarmful(Mobile from, IDamageable damageable) { Mobile target = damageable as Mobile; if (from == null || target == null || from.IsStaff() || target.IsStaff()) { return(true); } #region Mondain's Legacy if (target is Gregorio) { if (Gregorio.IsMurderer(from)) { return(true); } from.SendLocalizedMessage(1075456); // You are not allowed to damage this NPC unless your on the Guilty Quest return(false); } #endregion #region Dueling PlayerMobile pmFrom = from as PlayerMobile; PlayerMobile pmTarg = target as PlayerMobile; if (pmFrom == null && from is BaseCreature) { BaseCreature bcFrom = (BaseCreature)from; if (bcFrom.Summoned) { pmFrom = bcFrom.SummonMaster as PlayerMobile; } } if (pmTarg == null && target is BaseCreature) { BaseCreature bcTarg = (BaseCreature)target; if (bcTarg.Summoned) { pmTarg = bcTarg.SummonMaster as PlayerMobile; } } if (pmFrom != null && pmTarg != null) { 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)) { 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) { return(false); } 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)) { return(false); } Engines.ConPVP.SafeZone sz = from.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone; if (sz != null /*&& sz.IsDisabled()*/) { return(false); } sz = target.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone; if (sz != null /*&& sz.IsDisabled()*/) { return(false); } #endregion Map map = from.Map; if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0) { return(true); // In felucca, anything goes } // Summons should follow the same rules as their masters if (from is BaseCreature && ((BaseCreature)from).Summoned && ((BaseCreature)from).SummonMaster != null) { from = ((BaseCreature)from).SummonMaster; } if (target is BaseCreature && ((BaseCreature)target).Summoned && ((BaseCreature)target).SummonMaster != null) { target = ((BaseCreature)target).SummonMaster; } BaseCreature bc = from as BaseCreature; if (!from.Player && !(bc != null && bc.GetMaster() != null && bc.GetMaster().IsPlayer())) { 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 } if (XmlPoints.AreChallengers(from, target)) { return(true); } 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))) { return(true); // Guild allies or enemies can be harmful } if (target is BaseCreature && (((BaseCreature)target).Controlled || (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster))) { return(false); // Cannot harm other controlled mobiles } if (target.Player) { return(false); // Cannot harm other players } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) { if (Notoriety.Compute(from, target) == Notoriety.Innocent) { return(false); // Cannot harm innocent mobiles } } return(true); }
public static bool Mobile_AllowHarmful(Mobile from, IDamageable damageable) { var target = damageable as Mobile; if (from == null || target == null || from.IsStaff() || target.IsStaff()) { return(true); } var map = from.Map; if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0) { return(true); // In felucca, anything goes } // Summons should follow the same rules as their masters if (from is BaseCreature && ((BaseCreature)from).Summoned && ((BaseCreature)from).SummonMaster != null) { from = ((BaseCreature)from).SummonMaster; } if (target is BaseCreature && ((BaseCreature)target).Summoned && ((BaseCreature)target).SummonMaster != null) { target = ((BaseCreature)target).SummonMaster; } var bc = from as BaseCreature; if (!from.Player && !(bc != null && bc.GetMaster() != null && bc.GetMaster().IsPlayer())) { 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 } var fromGuild = GetGuildFor(from.Guild as Guild, from); var targetGuild = GetGuildFor(target.Guild as Guild, target); if (fromGuild != null && targetGuild != null) { if (fromGuild == targetGuild || fromGuild.IsAlly(targetGuild) || fromGuild.IsEnemy(targetGuild)) { return(true); // Guild allies or enemies can be harmful } } if (ViceVsVirtueSystem.Enabled && ViceVsVirtueSystem.EnhancedRules && ViceVsVirtueSystem.IsEnemy(from, damageable)) { return(true); } if (target is BaseCreature) { if (((BaseCreature)target).Controlled) { return(false); // Cannot harm other controlled mobiles } if (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster) { return(false); // Cannot harm other controlled mobiles } } if (target.Player) { return(false); // Cannot harm other players } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) { if (Notoriety.Compute(from, target) == Notoriety.Innocent) { return(false); // Cannot harm innocent mobiles } } return(true); }
public static bool IsInnocentTo(Mobile from, Mobile to) { return(Notoriety.Compute(from, (Mobile)to) == Notoriety.Innocent); }
public static bool ValidIndirectTarget(Mobile from, Mobile to) { if (from == to) { return(true); } if (to.Hidden && to.AccessLevel > from.AccessLevel) { return(false); } Guild fromGuild = GetGuildFor(from); Guild toGuild = GetGuildFor(to); if (fromGuild != null && toGuild != null && (fromGuild == toGuild || fromGuild.IsAlly(toGuild))) { return(false); } Party p = Party.Get(from); if (p != null && p.Contains(to)) { return(false); } if (to is BaseCreature) { BaseCreature c = (BaseCreature)to; if (c.Controlled || c.Summoned) { if (c.ControlMaster == from || c.SummonMaster == from) { return(false); } if (p != null && (p.Contains(c.ControlMaster) || p.Contains(c.SummonMaster))) { return(false); } } } if (from is BaseCreature) { BaseCreature c = (BaseCreature)from; if (c.Controlled || c.Summoned) { if (c.ControlMaster == to || c.SummonMaster == to) { return(false); } p = Party.Get(to); if (p != null && (p.Contains(c.ControlMaster) || p.Contains(c.SummonMaster))) { return(false); } } } if (to is BaseCreature && !((BaseCreature)to).Controlled && ((BaseCreature)to).InitialInnocent) { return(true); } int noto = Notoriety.Compute(from, to); return(noto != Notoriety.Innocent || from.Kills >= 5); }
public static bool Mobile_AllowHarmful(Mobile from, Mobile target) { if (from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player) { return(true); } var pmFrom = from as PlayerMobile; var pmTarg = target as PlayerMobile; var bcTarg = target as BaseCreature; if (pmFrom == null && from is BaseCreature bcFrom && bcFrom.Summoned) { pmFrom = bcFrom.SummonMaster as PlayerMobile; } if (pmTarg == null && bcTarg?.Summoned == true) { pmTarg = bcTarg.SummonMaster as PlayerMobile; } if (pmFrom != null && pmTarg != null) { if (pmFrom.DuelContext != pmTarg.DuelContext && (pmFrom.DuelContext?.Started == true || pmTarg.DuelContext?.Started == true)) { 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)) { return(false); } if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament?.IsNotoRestricted == true && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant == pmTarg.DuelPlayer.Participant) { return(false); } if (pmFrom.DuelContext?.Started == true && pmFrom.DuelContext == pmTarg.DuelContext) { return(true); } } if (pmFrom?.DuelContext?.Started == true || pmTarg?.DuelContext?.Started == true) { return(false); } if (from.Region.IsPartOf <SafeZone>() || target.Region.IsPartOf <SafeZone>()) { return(false); } var map = from.Map; if ((map?.Rules & MapRules.HarmfulRestrictions) == 0) { return(true); // In felucca, anything goes } if (!from.Player && !(from is BaseCreature bc && bc.GetMaster() != null && bc.GetMaster().AccessLevel == AccessLevel.Player)) { if (!CheckAggressor(from.Aggressors, target) && !CheckAggressed(from.Aggressed, target) && pmTarg?.CheckYoungProtection(from) == true) { return(false); } return(true); // Uncontrolled NPCs are only restricted by the young system } var fromGuild = GetGuildFor(from.Guild as Guild, from); var targetGuild = GetGuildFor(target.Guild as Guild, target); if (fromGuild != null && targetGuild != null && (fromGuild == targetGuild || fromGuild.IsAlly(targetGuild) || fromGuild.IsEnemy(targetGuild))) { return(true); // Guild allies or enemies can be harmful } if (bcTarg?.Controlled == true || bcTarg?.Summoned == true && bcTarg?.SummonMaster != @from) { return(false); // Cannot harm other controlled mobiles } if (target.Player) { return(false); // Cannot harm other players } return(bcTarg?.InitialInnocent == true || Notoriety.Compute(from, target) != Notoriety.Innocent); }
public static void EventSink_PlayerDeath(PlayerDeathEventArgs e) { Mobile m = e.Mobile; List <Mobile> killers = new List <Mobile>(); List <Mobile> toGive = new List <Mobile>(); foreach (AggressorInfo ai in m.Aggressors) { if (ai.Attacker.Player && ai.CanReportMurder && !ai.Reported) { if (!((PlayerMobile)m).RecentlyReported.Contains(ai.Attacker)) { if (!killers.Contains(ai.Attacker)) { killers.Add(ai.Attacker); ai.Reported = true; ai.CanReportMurder = false; } } } if (ai.Attacker.Player && (DateTime.UtcNow - ai.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(ai.Attacker)) { toGive.Add(ai.Attacker); } } foreach (AggressorInfo ai in m.Aggressed) { if (ai.Defender.Player && (DateTime.UtcNow - ai.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(ai.Defender)) { toGive.Add(ai.Defender); } } foreach (Mobile g in toGive) { int n = Notoriety.Compute(g, m); int theirKarma = m.Karma, ourKarma = g.Karma; bool innocent = (n == Notoriety.Innocent); bool criminal = (n == Notoriety.Criminal || n == Notoriety.Murderer); int fameAward = m.Fame / 200; int karmaAward = 0; if (innocent) { karmaAward = (ourKarma > -2500 ? -850 : -110 - (m.Karma / 100)); } else if (criminal) { karmaAward = 50; } Titles.AwardFame(g, fameAward, false); Titles.AwardKarma(g, karmaAward, true); if (killers.Contains(g)) { EventSink.InvokePlayerMurdered(new PlayerMurderedEventArgs(g, m)); } } if (m is PlayerMobile && ((PlayerMobile)m).NpcGuild == NpcGuild.ThievesGuild) { return; } if (killers.Count > 0) { new GumpTimer(m, killers).Start(); } }
private static bool IsInnocentTo(Mobile from, Mobile to) { return(Notoriety.Compute(from, to) == Notoriety.Innocent); }
private static bool IsAllyTo(Mobile from, Mobile to) { return(Notoriety.Compute(from, to) == Notoriety.Ally); }
private static bool IsAllyTo(Mobile from, Mobile to) => Notoriety.Compute(from, to) == Notoriety.Ally;
public static bool Mobile_AllowHarmful(Mobile from, Mobile target) { 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) { BaseCreature bcFrom = (BaseCreature)from; if (bcFrom.Summoned) { pmFrom = bcFrom.SummonMaster as PlayerMobile; } } if (pmTarg == null && target is BaseCreature) { BaseCreature bcTarg = (BaseCreature)target; if (bcTarg.Summoned) { pmTarg = bcTarg.SummonMaster as PlayerMobile; } } if (pmFrom != null && pmTarg != null) { 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)) { 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) { return(false); } 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)) { return(false); } Engines.ConPVP.SafeZone sz = from.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone; if (sz != null /*&& sz.IsDisabled()*/) { return(false); } sz = target.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone; if (sz != null /*&& sz.IsDisabled()*/) { return(false); } #endregion Map map = from.Map; 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 (!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 } 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))) { return(true); // Guild allies or enemies can be harmful } if (target is BaseCreature && (((BaseCreature)target).Controlled || (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster))) { return(false); // Cannot harm other controlled mobiles } if (target.Player) { return(false); // Cannot harm other players } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) { if (Notoriety.Compute(from, target) == Notoriety.Innocent) { return(false); // Cannot harm innocent mobiles } } return(true); }
public void TestMobileIncoming( ProtocolChanges protocolChanges, int hairItemId, int hairHue, int facialHairItemId, int facialHairHue ) { var beholder = new Mobile(0x1) { Name = "Random Mobile 1" }; beholder.DefaultMobileInit(); var beheld = new Mobile(0x2) { Name = "Random Mobile 2" }; beheld.DefaultMobileInit(); beheld.AddItem( new Item((Serial)0x1000) { Layer = Layer.OneHanded } ); // Test Dupe beheld.AddItem( new Item((Serial)0x1001) { Layer = Layer.OneHanded } ); beheld.HairItemID = hairItemId; beheld.HairHue = hairHue; beheld.FacialHairItemID = facialHairItemId; beheld.FacialHairHue = facialHairHue; var ns = new NetState(null) { ProtocolChanges = protocolChanges }; var data = new MobileIncoming(ns, beholder, beheld).Compile(); var sa = ns.StygianAbyss; var newPacket = ns.NewMobileIncoming; var itemIdMask = newPacket ? 0xFFFF : 0x7FFF; Span <bool> layers = stackalloc bool[256]; #if NO_LOCAL_INIT layers.Clear(); #endif var items = beheld.Items; var count = items.Count; if (beheld.HairItemID > 0) { count++; } if (beheld.FacialHairItemID > 0) { count++; } var length = 23 + count * 9; // Max Size Span <byte> expectedData = stackalloc byte[length]; var pos = 0; expectedData.Write(ref pos, (byte)0x78); pos += 2; // Length var isSolidHue = beheld.SolidHueOverride >= 0; expectedData.Write(ref pos, beheld.Serial); expectedData.Write(ref pos, (ushort)beheld.Body); expectedData.Write(ref pos, (ushort)beheld.X); expectedData.Write(ref pos, (ushort)beheld.Y); expectedData.Write(ref pos, (byte)beheld.Z); expectedData.Write(ref pos, (byte)beheld.Direction); expectedData.Write(ref pos, (ushort)(isSolidHue ? beheld.SolidHueOverride : beheld.Hue)); expectedData.Write(ref pos, (byte)beheld.GetPacketFlags(sa)); expectedData.Write(ref pos, (byte)Notoriety.Compute(beholder, beheld)); byte layer; for (var i = 0; i < items.Count; i++) { var item = items[i]; layer = (byte)item.Layer; if (!item.Deleted && !layers[layer] && beholder.CanSee(item)) { layers[layer] = true; expectedData.Write(ref pos, item.Serial); var hue = isSolidHue ? beheld.SolidHueOverride : item.Hue; var itemID = item.ItemID & itemIdMask; var writeHue = newPacket || hue != 0; if (!newPacket) { itemID |= 0x8000; } expectedData.Write(ref pos, (ushort)itemID); expectedData.Write(ref pos, layer); if (writeHue) { expectedData.Write(ref pos, (ushort)hue); } } } layer = (byte)Layer.Hair; var itemId = beheld.HairItemID; if (itemId > 0 && !layers[layer]) { expectedData.Write(ref pos, HairInfo.FakeSerial(beheld)); var hue = isSolidHue ? beheld.SolidHueOverride : beheld.HairHue; itemId &= itemIdMask; var writeHue = newPacket || hue != 0; if (!newPacket) { itemId |= 0x8000; } expectedData.Write(ref pos, (ushort)itemId); expectedData.Write(ref pos, layer); if (writeHue) { expectedData.Write(ref pos, (ushort)hue); } } layer = (byte)Layer.FacialHair; itemId = beheld.FacialHairItemID; if (itemId > 0 && !layers[layer]) { expectedData.Write(ref pos, FacialHairInfo.FakeSerial(beheld)); var hue = isSolidHue ? beheld.SolidHueOverride : beheld.FacialHairHue; itemId &= itemIdMask; var writeHue = newPacket || hue != 0; if (!newPacket) { itemId |= 0x8000; } expectedData.Write(ref pos, (ushort)itemId); expectedData.Write(ref pos, layer); if (writeHue) { expectedData.Write(ref pos, (ushort)hue); } } #if NO_LOCAL_INIT expectedData.Write(ref pos, 0); // Zero serial, terminate list #else pos += 4; #endif expectedData.Slice(1, 2).Write((ushort)pos); // Length expectedData = expectedData.Slice(0, pos); AssertThat.Equal(data, expectedData); }
public override void OnSingleClick(Mobile from) { if (Deleted || (AccessLevel == AccessLevel.Player && DisableHiddenSelfClick && Hidden && from == this)) { return; } if (Mobile.GuildClickMessage) { Server.Guilds.Guild guild = this.Guild as Server.Guilds.Guild; if (guild != null && (this.DisplayGuildTitle || guild.Type != Server.Guilds.GuildType.Regular)) { string title = GuildTitle; string type; if (title == null) { title = ""; } else { title = title.Trim(); } if (guild.Type >= 0 && (int)guild.Type < m_GuildTypes.Length) { type = m_GuildTypes[(int)guild.Type]; } else { type = ""; } string text = String.Format(title.Length <= 0 ? "[{1}]{2}" : "[{0}, {1}]{2}", title, guild.Abbreviation, type); PrivateOverheadMessage(MessageType.Regular, SpeechHue, true, text, from.NetState); } } int hue; if (NameHue != -1) { hue = NameHue; } else if (AccessLevel > AccessLevel.Player) { hue = 11; } else { hue = Notoriety.GetHue(Notoriety.Compute(from, this)); } System.Text.StringBuilder sb = new System.Text.StringBuilder(); if ((Karma >= (int)Noto.LordLady || Karma <= (int)Noto.Dark)) { sb.Append(Female ? "Lady " : "Lord "); } sb.Append(Name); if (ClickTitle && Title != null && Title.Length > 0) { sb.Append(' '); sb.Append(Title); } if (Frozen || Paralyzed || (this.Spell != null && this.Spell is Spell && this.Spell.IsCasting && ((Spell)this.Spell).BlocksMovement)) { sb.Append(" (frozen)"); } if (Blessed) { sb.Append(" (invulnerable)"); } PrivateOverheadMessage(MessageType.Label, hue, Mobile.AsciiClickMessage, sb.ToString(), from.NetState); }
public static bool Mobile_AllowHarmful(Mobile from, Mobile target) { if (from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player) { return(true); } Map map = from.Map; #region Mondain's Legacy if (target is Gregorio) { if (Gregorio.IsMurderer(from)) { return(true); } from.SendLocalizedMessage(1075456); // You are not allowed to damage this NPC unless your on the Guilty Quest return(false); } #endregion 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 (!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 } 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))) { return(true); // Guild allies or enemies can be harmful } if (target is BaseCreature && (((BaseCreature)target).Controlled || (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster))) { return(false); // Cannot harm other controlled mobiles } if (target.Player) { return(false); // Cannot harm other players } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) { if (Notoriety.Compute(from, target) == Notoriety.Innocent) { return(false); // Cannot harm innocent mobiles } } return(true); }