public override void ReceiveDamage(Mobile from, int damage, BreakableStatic.InteractionType interactionType) { base.ReceiveDamage(from, damage, interactionType); double hitPointsPercent = (double)HitPoints / (double)MaxHitPoints; if (m_NextDamageStateNotification > 0.05 && hitPointsPercent < m_NextDamageStateNotification) { foreach (NetState state in NetState.Instances) { Mobile mobile = state.Mobile; PlayerMobile player = mobile as PlayerMobile; if (player == null) { continue; } if (UOACZRegion.ContainsMobile(player)) { player.SendMessage(UOACZSystem.yellowTextHue, "The Corruption Sourcestone is under attack and at " + Utility.CreatePercentageString(m_NextDamageStateNotification) + " durability."); } } m_NextDamageStateNotification -= NotificationInterval; } }
public static List <UOACZBaseCivilian> GetActiveInstances() { List <UOACZBaseCivilian> m_ActiveInstances = new List <UOACZBaseCivilian>(); for (int a = 0; a < m_Instances.Count; a++) { UOACZBaseCivilian instance = m_Instances[a]; if (instance.Deleted) { continue; } if (UOACZRegion.ContainsMobile(instance)) { m_ActiveInstances.Add(instance); } } return(m_ActiveInstances); }
public UOACZOverviewGump(PlayerMobile player) : base(10, 10) { if (player == null) { return; } if (player.Deleted) { return; } m_Player = player; Closable = true; Disposable = true; Dragable = true; Resizable = false; AddImage(2, 3, 9390); AddImage(513, 5, 9392); AddImage(2, 386, 9396); AddImage(514, 386, 9398); AddImageTiled(2, 139, 118, 250, 9393); AddImageTiled(115, 4, 400, 142, 9391); AddImageTiled(115, 386, 400, 140, 9397); AddImageTiled(513, 143, 104, 250, 9395); AddImageTiled(115, 142, 400, 250, 9394); //------------ int textHue = 2655; AddLabel(28, 9, 149, "UOACZ Guide Website"); AddButton(47, 30, 2095, 2094, 1, GumpButtonType.Reply, 0); AddLabel(243, 35, 2606, "UOACZ Session Overview"); int humanPlayers = 0; int undeadPlayers = 0; int averageHumanScore = 0; int averageUndeadScore = 0; int totalHumanScores = 0; int totalUndeadScores = 0; if (UOACZPersistance.Active) { foreach (NetState state in NetState.Instances) { Mobile mobile = state.Mobile; PlayerMobile pm_Mobile = mobile as PlayerMobile; if (pm_Mobile == null) { continue; } if (UOACZRegion.ContainsMobile(pm_Mobile)) { if (pm_Mobile.AccessLevel > AccessLevel.Player) { continue; } } if (pm_Mobile.IsUOACZHuman) { humanPlayers++; totalHumanScores += pm_Mobile.m_UOACZAccountEntry.CurrentSessionHumanScore; } if (pm_Mobile.IsUOACZUndead) { undeadPlayers++; totalUndeadScores += pm_Mobile.m_UOACZAccountEntry.CurrentSessionUndeadScore; } } } if (humanPlayers > 0) { averageHumanScore = (int)(Math.Ceiling((double)totalHumanScores / (double)humanPlayers)); } if (undeadPlayers > 0) { averageUndeadScore = (int)(Math.Ceiling((double)totalUndeadScores / (double)undeadPlayers)); } int humanPlayersTextHue = UOACZSystem.whiteTextHue; int undeadPlayersTextHue = UOACZSystem.whiteTextHue; int humanTotalScoreTextHue = UOACZSystem.whiteTextHue; int undeadTotalScoreTextHue = UOACZSystem.whiteTextHue; double humanUnderdogBonus = UOACZPersistance.HumanBalanceScalar - 1; double undeadUnderdogBonus = UOACZPersistance.UndeadBalanceScalar - 1; string humanUnderdogBonusText = Utility.CreateDecimalPercentageString(humanUnderdogBonus, 0); string undeadUnderdogBonusText = Utility.CreateDecimalPercentageString(undeadUnderdogBonus, 0); int humanUnderdogBonusTextHue = UOACZSystem.whiteTextHue; int undeadUnderdogBonusTextHue = UOACZSystem.whiteTextHue; bool humanRecommended = false; bool undeadRecommended = false; if (humanPlayers > undeadPlayers) { humanPlayersTextHue = UOACZSystem.greenTextHue; } if (undeadPlayers > humanPlayers) { undeadPlayersTextHue = UOACZSystem.greenTextHue; } if (totalHumanScores > totalUndeadScores) { humanTotalScoreTextHue = UOACZSystem.greenTextHue; } if (totalUndeadScores > totalHumanScores) { undeadTotalScoreTextHue = UOACZSystem.greenTextHue; } if (humanUnderdogBonus > undeadUnderdogBonus) { humanUnderdogBonusTextHue = UOACZSystem.greenTextHue; humanRecommended = true; } if (undeadUnderdogBonus > humanUnderdogBonus) { undeadUnderdogBonusTextHue = UOACZSystem.greenTextHue; undeadRecommended = true; } if (humanUnderdogBonus == undeadUnderdogBonus) { humanRecommended = true; undeadRecommended = false; } //Active Players + Avg Score AddLabel(118, 60, 1164, "Human Team"); AddLabel(49, 85, 1164, "Active Players"); AddLabel(Utility.CenteredTextOffset(95, humanPlayers.ToString()), 105, humanPlayersTextHue, humanPlayers.ToString()); AddLabel(186, 85, 1164, "Total Score"); AddLabel(Utility.CenteredTextOffset(215, totalHumanScores.ToString()), 105, humanTotalScoreTextHue, totalHumanScores.ToString()); AddLabel(446, 60, 2115, "Undead Team"); AddLabel(380, 85, 2115, "Active Players"); AddLabel(Utility.CenteredTextOffset(425, undeadPlayers.ToString()), 105, undeadPlayersTextHue, undeadPlayers.ToString()); AddLabel(516, 85, 2115, "Total Score"); AddLabel(Utility.CenteredTextOffset(545, totalUndeadScores.ToString()), 105, undeadTotalScoreTextHue, totalUndeadScores.ToString()); //Human Objectives #region Objectives Determination int humanObjectivesCompleted = 0; int undeadObjectivesCompleted = 0; int humanTotalObjectives = UOACZSystem.ObjectivesNeededForVictory; int undeadTotalObjectives = UOACZSystem.ObjectivesNeededForVictory; bool humanObjective1Completed = false; bool humanObjective2Completed = false; bool humanObjective3Completed = false; bool humanObjective4Completed = false; bool humanObjective5Completed = false; bool undeadObjective1Completed = false; bool undeadObjective2Completed = false; bool undeadObjective3Completed = false; bool undeadObjective4Completed = false; bool undeadObjective5Completed = false; string humanObjective1Progress = "0%"; string humanObjective2Progress = "0%"; string humanObjective3Progress = "0%"; string humanObjective4Progress = "0%"; string humanObjective5Progress = "0%"; string undeadObjective1Progress = "0%"; string undeadObjective2Progress = "0%"; string undeadObjective3Progress = "0%"; string undeadObjective4Progress = "0%"; string undeadObjective5Progress = "0%"; double progress = 0; //Human Objective Progress if (UOACZPersistance.m_HumanObjective1Target != 0) { progress = UOACZPersistance.m_HumanObjective1 / UOACZPersistance.m_HumanObjective1Target; humanObjective1Progress = Utility.CreateDecimalPercentageString(progress, 1); if (UOACZPersistance.m_HumanObjective1 == UOACZPersistance.m_HumanObjective1Target) { humanObjective1Completed = true; humanObjectivesCompleted++; } } if (UOACZPersistance.m_HumanObjective2Target != 0) { progress = UOACZPersistance.m_HumanObjective2 / UOACZPersistance.m_HumanObjective2Target; humanObjective2Progress = Utility.CreateDecimalPercentageString(progress, 1); if (UOACZPersistance.m_HumanObjective2 == UOACZPersistance.m_HumanObjective2Target) { humanObjective2Completed = true; humanObjectivesCompleted++; } } if (UOACZPersistance.m_HumanObjective3Target != 0) { progress = UOACZPersistance.m_HumanObjective3 / UOACZPersistance.m_HumanObjective3Target; humanObjective3Progress = Utility.CreateDecimalPercentageString(progress, 1); if (UOACZPersistance.m_HumanObjective3 == UOACZPersistance.m_HumanObjective3Target) { humanObjective3Completed = true; humanObjectivesCompleted++; } } if (UOACZPersistance.m_HumanObjective4Target != 0) { progress = UOACZPersistance.m_HumanObjective4 / UOACZPersistance.m_HumanObjective4Target; humanObjective4Progress = Utility.CreateDecimalPercentageString(progress, 1); if (UOACZPersistance.m_HumanObjective4 == UOACZPersistance.m_HumanObjective4Target) { humanObjective4Completed = true; humanObjectivesCompleted++; } } if (UOACZPersistance.m_HumanObjective5Target != 0) { progress = UOACZPersistance.m_HumanObjective5 / UOACZPersistance.m_HumanObjective5Target; humanObjective5Progress = Utility.CreateDecimalPercentageString(progress, 1); if (UOACZPersistance.m_HumanObjective5 == UOACZPersistance.m_HumanObjective5Target) { humanObjective5Completed = true; humanObjectivesCompleted++; } } if (humanObjectivesCompleted > humanTotalObjectives) { humanObjectivesCompleted = humanTotalObjectives; } //Undead Objectives if (UOACZPersistance.m_UndeadObjective1Target != 0) { progress = UOACZPersistance.m_UndeadObjective1 / UOACZPersistance.m_UndeadObjective1Target; undeadObjective1Progress = Utility.CreateDecimalPercentageString(progress, 1); if (UOACZPersistance.m_UndeadObjective1 == UOACZPersistance.m_UndeadObjective1Target) { undeadObjective1Completed = true; undeadObjectivesCompleted++; } } if (UOACZPersistance.m_UndeadObjective2Target != 0) { progress = UOACZPersistance.m_UndeadObjective2 / UOACZPersistance.m_UndeadObjective2Target; undeadObjective2Progress = Utility.CreateDecimalPercentageString(progress, 1); if (UOACZPersistance.m_UndeadObjective2 == UOACZPersistance.m_UndeadObjective2Target) { undeadObjective2Completed = true; undeadObjectivesCompleted++; } } if (UOACZPersistance.m_UndeadObjective3Target != 0) { progress = UOACZPersistance.m_UndeadObjective3 / UOACZPersistance.m_UndeadObjective3Target; undeadObjective3Progress = Utility.CreateDecimalPercentageString(progress, 1); if (UOACZPersistance.m_UndeadObjective3 == UOACZPersistance.m_UndeadObjective3Target) { undeadObjective3Completed = true; undeadObjectivesCompleted++; } } if (UOACZPersistance.m_UndeadObjective4Target != 0) { progress = UOACZPersistance.m_UndeadObjective4 / UOACZPersistance.m_UndeadObjective4Target; undeadObjective4Progress = Utility.CreateDecimalPercentageString(progress, 1); if (UOACZPersistance.m_UndeadObjective4 == UOACZPersistance.m_UndeadObjective4Target) { undeadObjective4Completed = true; undeadObjectivesCompleted++; } } if (UOACZPersistance.m_UndeadObjective5Target != 0) { progress = UOACZPersistance.m_UndeadObjective5 / UOACZPersistance.m_UndeadObjective5Target; undeadObjective5Progress = Utility.CreateDecimalPercentageString(progress, 1); if (UOACZPersistance.m_UndeadObjective5 == UOACZPersistance.m_UndeadObjective5Target) { undeadObjective5Completed = true; undeadObjectivesCompleted++; } } if (undeadObjectivesCompleted > undeadTotalObjectives) { undeadObjectivesCompleted = undeadTotalObjectives; } #endregion AddLabel(35, 136, 1164, "Human Objectives (" + humanObjectivesCompleted.ToString() + "/" + humanTotalObjectives.ToString() + ")"); if (humanObjective1Completed) { textHue = UOACZSystem.greenTextHue; } else { textHue = UOACZSystem.whiteTextHue; } AddLabel(35, 156, textHue, "Destroy Corruption Sourcestone"); AddLabel(250, 156, textHue, humanObjective1Progress); if (humanObjective2Completed) { textHue = UOACZSystem.greenTextHue; } else { textHue = UOACZSystem.whiteTextHue; } AddLabel(35, 176, textHue, "Build the Outpost"); AddLabel(250, 176, textHue, humanObjective2Progress); if (humanObjective3Completed) { textHue = UOACZSystem.greenTextHue; } else { textHue = UOACZSystem.whiteTextHue; } AddLabel(35, 196, textHue, "Gather Bones"); AddLabel(250, 195, textHue, humanObjective3Progress); if (humanObjective4Completed) { textHue = UOACZSystem.greenTextHue; } else { textHue = UOACZSystem.whiteTextHue; } if (UOACZPersistance.UndeadChampion == null && !humanObjective4Completed) { int minutesUntilSpawn = UOACZSystem.UndeadChampionSpawnMinutes - UOACZPersistance.m_MinutesActive; string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, DateTime.UtcNow + TimeSpan.FromMinutes(minutesUntilSpawn), true, false, true, true, false); AddLabel(35, 215, textHue, "Undead Champion"); AddLabel(250, 215, textHue, "(" + timeRemaining + ")"); } else { AddLabel(35, 215, textHue, "Slay Undead Champion"); AddLabel(250, 215, textHue, humanObjective4Progress); } if (humanObjective5Completed) { textHue = UOACZSystem.greenTextHue; } else { textHue = UOACZSystem.whiteTextHue; } if (UOACZPersistance.UndeadBoss == null && !humanObjective5Completed) { int minutesUntilSpawn = UOACZSystem.UndeadBossSpawnMinutes - UOACZPersistance.m_MinutesActive; string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, DateTime.UtcNow + TimeSpan.FromMinutes(minutesUntilSpawn), true, false, true, true, false); AddLabel(35, 235, textHue, "Undead Boss"); AddLabel(250, 235, textHue, "(" + timeRemaining + ")"); } else { AddLabel(35, 235, textHue, "Slay Undead Boss"); AddLabel(250, 235, textHue, humanObjective5Progress); } //Undead Objectives AddLabel(380, 136, 2115, "Undead Objectives (" + undeadObjectivesCompleted.ToString() + "/" + undeadTotalObjectives.ToString() + ")"); if (undeadObjective1Completed) { textHue = UOACZSystem.greenTextHue; } else { textHue = UOACZSystem.whiteTextHue; } AddLabel(380, 156, textHue, "Destroy Town Stockpiles"); AddLabel(548, 156, textHue, undeadObjective1Progress); if (undeadObjective2Completed) { textHue = UOACZSystem.greenTextHue; } else { textHue = UOACZSystem.whiteTextHue; } AddLabel(380, 176, textHue, "Kill Town Civilians"); AddLabel(547, 175, textHue, undeadObjective2Progress); if (undeadObjective3Completed) { textHue = UOACZSystem.greenTextHue; } else { textHue = UOACZSystem.whiteTextHue; } AddLabel(380, 196, textHue, "Spread Corruption"); AddLabel(548, 196, textHue, undeadObjective3Progress); if (undeadObjective4Completed) { textHue = UOACZSystem.greenTextHue; } else { textHue = UOACZSystem.whiteTextHue; } if (UOACZPersistance.HumanChampion == null && !undeadObjective4Completed) { int minutesUntilSpawn = UOACZSystem.HumanChampionSpawnMinutes - UOACZPersistance.m_MinutesActive; string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, DateTime.UtcNow + TimeSpan.FromMinutes(minutesUntilSpawn), true, false, true, true, false); AddLabel(380, 216, textHue, "Human Champion"); AddLabel(547, 216, textHue, "(" + timeRemaining + ")"); } else { AddLabel(380, 216, textHue, "Slay Human Champion"); AddLabel(547, 216, textHue, undeadObjective4Progress); } if (undeadObjective5Completed) { textHue = UOACZSystem.greenTextHue; } else { textHue = UOACZSystem.whiteTextHue; } if (UOACZPersistance.HumanBoss == null && !undeadObjective5Completed) { int minutesUntilSpawn = UOACZSystem.HumanBossSpawnMinutes - UOACZPersistance.m_MinutesActive; string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, DateTime.UtcNow + TimeSpan.FromMinutes(minutesUntilSpawn), true, false, true, true, false); AddLabel(379, 236, textHue, "Human Boss"); AddLabel(547, 236, textHue, "(" + timeRemaining + ")"); } else { AddLabel(379, 236, textHue, "Slay Human Boss"); AddLabel(547, 236, textHue, undeadObjective5Progress); } //Underdog Bonus AddLabel(248, 263, 2550, "Team Underdog Bonus"); AddLabel(111, 282, UOACZSystem.blueTextHue, "Bonus to Upgrade Chances, Loot Drops, and Ability Effectiveness"); AddLabel(61, 314, 1164, "Human Player Underdog Bonus"); AddImage(123, 338, 24019, 0); AddLabel(173, 348, humanUnderdogBonusTextHue, humanUnderdogBonusText); AddLabel(388, 314, 2115, "Undead Player Underdog Bonus"); AddImage(450, 338, 24012, 0); AddLabel(503, 348, undeadUnderdogBonusTextHue, undeadUnderdogBonusText); //Human Team Selection if (humanRecommended) { AddLabel(100, 392, 149, "(Recommended)"); } if (player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Human) { AddLabel(Utility.CenteredTextOffset(145, "Currently Playing as Human"), 412, UOACZSystem.greenTextHue, "Currently Playing as Human"); } else { AddLabel(Utility.CenteredTextOffset(145, "Become Human Player"), 412, UOACZSystem.whiteTextHue, "Become Human Player"); } if (player.m_UOACZAccountEntry.m_TeamSelectIndex == 0) { AddButton(102, 447, 9724, 9721, 2, GumpButtonType.Reply, 0); } else { AddButton(102, 447, 9721, 9724, 2, GumpButtonType.Reply, 0); } AddImage(140, 437, 11012, 0); //Undead Team Selection if (undeadRecommended) { AddLabel(423, 392, 149, "(Recommended)"); } if (player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Undead) { AddLabel(Utility.CenteredTextOffset(470, "Currently Playing as Undead"), 412, UOACZSystem.greenTextHue, "Currently Playing as Undead"); } else { AddLabel(Utility.CenteredTextOffset(470, "Become Undead Player"), 412, UOACZSystem.whiteTextHue, "Become Undead Player"); } if (player.m_UOACZAccountEntry.m_TeamSelectIndex == 1) { AddButton(424, 447, 9724, 9721, 3, GumpButtonType.Reply, 0); } else { AddButton(424, 447, 9721, 9724, 3, GumpButtonType.Reply, 0); } AddImage(462, 437, 11011, 0); if ((player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Human && player.m_UOACZAccountEntry.m_TeamSelectIndex == 1) || (player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Undead && player.m_UOACZAccountEntry.m_TeamSelectIndex == 0)) { if (UOACZPersistance.Active) { if (player.m_UOACZAccountEntry.NextTeamSwitchAllowed > DateTime.UtcNow) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.m_UOACZAccountEntry.NextTeamSwitchAllowed, true, true, true, true, true); AddLabel(Utility.CenteredTextOffset(315, "Cannot change teams for " + timeRemaining), 436, 149, "Cannot change teams for " + timeRemaining); } else { AddLabel(Utility.CenteredTextOffset(315, "Confirm Team Change"), 436, 149, "Confirm Team Change"); AddButton(283, 459, 238, 238, 4, GumpButtonType.Reply, 0); } } else { AddLabel(Utility.CenteredTextOffset(315, "Confirm Team Change"), 436, 149, "Confirm Team Change"); AddButton(283, 459, 238, 238, 4, GumpButtonType.Reply, 0); } } }
public static int DetermineMobileNotoriety(Mobile source, Mobile target, bool useVengeance) { BaseCreature bc_Source = source as BaseCreature; PlayerMobile pm_Source = source as PlayerMobile; Mobile m_SourceController = null; BaseCreature bc_SourceController = null; PlayerMobile pm_SourceController = null; BaseCreature bc_Target = target as BaseCreature; PlayerMobile pm_Target = target as PlayerMobile; Mobile m_TargetController = null; BaseCreature bc_TargetController = null; PlayerMobile pm_TargetController = null; #region UOACZ if (UOACZRegion.ContainsMobile(target)) { if (pm_Target != null) { UOACZPersistance.CheckAndCreateUOACZAccountEntry(pm_Target); if (pm_Target.IsUOACZUndead) { if (pm_Source != null) { if (pm_Source.IsUOACZHuman) { return(Notoriety.Enemy); } if (pm_Source.IsUOACZUndead) { if (pm_Target.Criminal) { return(Notoriety.CanBeAttacked); } return(Notoriety.Innocent); } } return(Notoriety.CanBeAttacked); } if (pm_Target.IsUOACZHuman) { if (pm_Source != null) { if (pm_Source.IsUOACZUndead) { return(Notoriety.Enemy); } } if (pm_Target.m_UOACZAccountEntry.HumanProfile.HonorPoints <= UOACZSystem.HonorAggressionThreshold) { return(Notoriety.Enemy); } if (pm_Target.Criminal) { return(Notoriety.CanBeAttacked); } if (pm_Source != null) { return(Notoriety.Innocent); } return(Notoriety.CanBeAttacked); } } if (bc_Target != null) { if (bc_Target is UOACZBaseUndead) { UOACZBaseUndead bc_Undead = bc_Target as UOACZBaseUndead; if (bc_Undead.ControlMaster == source) { return(Notoriety.Ally); } if (pm_Source != null && (bc_Undead == UOACZPersistance.UndeadChampion || bc_Undead == UOACZPersistance.UndeadBoss)) { if (pm_Source.IsUOACZHuman) { return(Notoriety.Murderer); } } return(Notoriety.CanBeAttacked); } if (bc_Target is UOACZBaseWildlife) { return(Notoriety.CanBeAttacked); } if (bc_Target is UOACZBaseHuman) { UOACZBaseHuman bc_Human = bc_Target as UOACZBaseHuman; if (source is UOACZBaseWildlife || source is UOACZBaseUndead) { return(Notoriety.CanBeAttacked); } if (pm_Source != null) { if (pm_Source.IsUOACZUndead) { if (bc_Human == UOACZPersistance.HumanChampion || bc_Human == UOACZPersistance.HumanBoss) { return(Notoriety.Murderer); } return(Notoriety.CanBeAttacked); } } return(Notoriety.Innocent); } } return(Notoriety.Innocent); } #endregion if (bc_Source != null) { m_SourceController = bc_Source.ControlMaster as Mobile; bc_SourceController = bc_Source.ControlMaster as BaseCreature; pm_SourceController = bc_Source.ControlMaster as PlayerMobile; } if (bc_Target != null) { m_TargetController = bc_Target.ControlMaster as Mobile; bc_TargetController = bc_Target.ControlMaster as BaseCreature; pm_TargetController = bc_Target.ControlMaster as PlayerMobile; } //Berserk Creatures if (bc_Source != null && (source is BladeSpirits || source is EnergyVortex)) { if (bc_Source.ControlMaster != null && pm_Target != null) { //Blade Spirits + Energy Vortexes Can Freely Attack Their Control Master Without Causing Criminal Action if (bc_Source.ControlMaster == pm_Target) { return(Notoriety.CanBeAttacked); } } if (bc_Source.ControlMaster != null && bc_Target != null) { //Blade Spirits + Energy Vortexes Can Freely Attack Other Followers Of Their Control Master Without Causing Criminal Action if (bc_Source.ControlMaster == bc_Target.ControlMaster) { return(Notoriety.CanBeAttacked); } } } if (target is BladeSpirits || target is EnergyVortex) { return(Notoriety.Murderer); } //Staff Members Always Attackable if (target.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } if (m_TargetController != null) { //Creature Controlled By Staff Member if (m_TargetController.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } } //Consensual PvP if (pm_Source != null && pm_Target != null) { //Duel if (pm_Source.DuelContext != null && pm_Source.DuelContext.StartedBeginCountdown && !pm_Source.DuelContext.Finished && pm_Source.DuelContext == pm_Target.DuelContext) { return(pm_Source.DuelContext.IsAlly(pm_Source, pm_Target) ? Notoriety.Ally : Notoriety.Enemy); } } //Enemy of One if (pm_Source != null && bc_Target != null) { if (!bc_Target.Summoned && !bc_Target.Controlled && pm_Source.EnemyOfOneType == target.GetType()) { return(Notoriety.Enemy); } } //Justice Free Zone if (SpellHelper.InBuccs(target.Map, target.Location) || SpellHelper.InYewOrcFort(target.Map, target.Location) || SpellHelper.InYewCrypts(target.Map, target.Location)) { return(Notoriety.CanBeAttacked); } //Grey Zone Totem Nearby if (GreyZoneTotem.InGreyZoneTotemArea(target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } //Hotspot Nearby if (Custom.Hotspot.InHotspotArea(target.Location, target.Map, true)) { return(Notoriety.CanBeAttacked); } //Player Notoriety if (pm_Target != null) { //Friendly if (pm_SourceController != null) { if (pm_SourceController == pm_Target) { return(Notoriety.Ally); } } //Murderer if (pm_Target.Murderer && !pm_Target.HideMurdererStatus) { return(Notoriety.Murderer); } //Criminal if (pm_Target.Criminal) { return(Notoriety.Criminal); } //Perma-Grey if (SkillHandlers.Stealing.ClassicMode && pm_Target.PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (pm_SourceController != null) { //Target is Perma-Grey to Source Creature's Controller if (SkillHandlers.Stealing.ClassicMode && pm_Target.PermaFlags.Contains(pm_SourceController)) { return(Notoriety.CanBeAttacked); } } } //Guilds //TEST: GUILD /* * Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); * Guild targetGuild = GetGuildFor(target.Guild as Guild, target); * * if (sourceGuild != null && targetGuild != null) * { * if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) * return Notoriety.Ally; * * else if (sourceGuild.IsEnemy(targetGuild)) * return Notoriety.Enemy; * } */ //Creature Notoriety if (bc_Target != null) { //Friendly if (m_TargetController != null) { //Target is Source's Controller if (source == m_TargetController) { return(Notoriety.Ally); } } if (m_SourceController != null) { //Source is Target's Controller if (m_SourceController == bc_Target) { return(Notoriety.Ally); } } //Murderer if (bc_Target.IsMurderer()) { return(Notoriety.Murderer); } if (pm_TargetController != null) { if (pm_TargetController.Murderer) { return(Notoriety.Murderer); } } if (bc_TargetController != null) { if (bc_TargetController.IsMurderer()) { return(Notoriety.Murderer); } } //Criminal if (bc_Target.Criminal) { return(Notoriety.Criminal); } if (pm_TargetController != null) { if (pm_TargetController.Criminal) { return(Notoriety.Criminal); } } if (bc_TargetController != null) { if (bc_TargetController.Criminal) { return(Notoriety.Criminal); } } //Perma-Grey if (pm_TargetController != null) { if (SkillHandlers.Stealing.ClassicMode && pm_TargetController.PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (pm_SourceController != null) { //Target is Perma-Grey to Source Creature's Controller if (SkillHandlers.Stealing.ClassicMode && pm_TargetController.PermaFlags.Contains(pm_SourceController)) { return(Notoriety.CanBeAttacked); } } } } //Housing if (CheckHouseFlag(source, target, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } //Aggressor: Source to Target if (CheckAggressor(source.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, target) && useVengeance) { return(Notoriety.CanBeAttacked); } //Aggressor: Source Controller to Target if (m_SourceController != null) { if (CheckAggressor(m_SourceController.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(m_SourceController.Aggressed, target) && useVengeance) { return(Notoriety.CanBeAttacked); } } //Aggressor: Source to Target's Controller if (m_TargetController != null) { if (CheckAggressor(source.Aggressors, m_TargetController)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, m_TargetController) && useVengeance) { return(Notoriety.CanBeAttacked); } } //Aggressor: Source Controller to Target's Controller if (m_SourceController != null && m_TargetController != null) { if (CheckAggressor(m_SourceController.Aggressors, m_TargetController)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(m_SourceController.Aggressed, m_TargetController) && useVengeance) { return(Notoriety.CanBeAttacked); } } //Player Followers: If A Player or Any of Their Followers Have been Aggressed or Barded, the Player and All Other Followers Can Attack the Aggressor PlayerMobile pm_Player = null; if (pm_Source != null) { pm_Player = pm_Source; } if (pm_SourceController != null) { pm_Player = pm_SourceController; } if (pm_Player != null) { if (pm_Player.AllFollowers.Count > 0) { //Any of the Player's Other Followers foreach (Mobile follower in pm_Player.AllFollowers) { BaseCreature bc_Follower = follower as BaseCreature; if (bc_Follower == null) { continue; } //Follower Has Been Aggressed/Aggresor to Target if (CheckAggressor(bc_Follower.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(bc_Follower.Aggressed, target) && useVengeance) { return(Notoriety.CanBeAttacked); } //Follower Has Been Aggressed/Aggresor by/to Target's Controller if (m_TargetController != null) { if (CheckAggressor(bc_Follower.Aggressors, m_TargetController)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(bc_Follower.Aggressed, m_TargetController) && useVengeance) { return(Notoriety.CanBeAttacked); } } } } } //Boats: Players and Creatures Friendly to a Boat Can Freely Attack Non-Friendly Mobiles on their Boat BaseBoat sourceBoat = null; if (bc_Source != null) { if (bc_Source.BoatOccupied != null) { sourceBoat = bc_Source.BoatOccupied; } } if (pm_Source != null) { if (pm_Source.BoatOccupied != null) { sourceBoat = pm_Source.BoatOccupied; } } if (sourceBoat != null) { BaseBoat targetBoat = null; if (bc_Target != null) { if (bc_Target.BoatOccupied != null) { targetBoat = bc_Target.BoatOccupied; } } if (pm_Target != null) { if (pm_Target.BoatOccupied != null) { targetBoat = pm_Target.BoatOccupied; } } //On Same Boat if (sourceBoat != null && targetBoat != null && !sourceBoat.Deleted && !targetBoat.Deleted && sourceBoat == targetBoat) { bool sourceBelongs = false; bool targetBelongs = false; //Source Belongs n the Boat if (sourceBoat.Crew.Contains(source) || sourceBoat.IsFriend(source) || sourceBoat.IsCoOwner(source) || sourceBoat.IsOwner(source)) { sourceBelongs = true; } //Source's Owner Belongs on the Boat else if (bc_Source != null) { if (m_SourceController != null) { if (sourceBoat.Crew.Contains(m_SourceController) || sourceBoat.IsFriend(m_SourceController) || sourceBoat.IsCoOwner(m_SourceController) || sourceBoat.IsOwner(m_SourceController)) { sourceBelongs = true; } } } //Target Belongs On The Boat if (sourceBoat.Crew.Contains(target) || sourceBoat.IsFriend(target) || sourceBoat.IsCoOwner(target) || sourceBoat.IsOwner(target)) { targetBelongs = true; } //Target's Owner Belongs On the Boat else if (bc_Target != null) { if (m_TargetController != null) { if (sourceBoat.Crew.Contains(m_TargetController) || sourceBoat.IsFriend(m_TargetController) || sourceBoat.IsCoOwner(m_TargetController) || sourceBoat.IsOwner(m_TargetController)) { targetBelongs = true; } } } //Target May Be Freely Attacked on Boat if (sourceBelongs && !targetBelongs) { return(Notoriety.CanBeAttacked); } } } //Polymorph or Body Transformation if (!(bc_Target != null && bc_Target.InitialInnocent)) { if (target.Player && target.BodyMod > 0) { } else if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(bc_Target) && !TransformationSpellHelper.UnderTransformation(target)) { return(Notoriety.CanBeAttacked); } } //If somehow a player is attacking us with their tamed creatures, and their creatures are flagged to us but the player isn't //if (pm_Source != null && pm_Target != null) //{ // if (pm_Target.AllFollowers.Count > 0) // { // //Any of the Player's Other Followers // foreach (Mobile follower in pm_Target.AllFollowers) // { // int notorietyResult = Notoriety.Compute(source, follower); // //Enemy Tamer Adopts Notoriety of Their Creature (Anything other than Innocent) // if (notorietyResult != 1) // { // foreach(var aggressor in source.Aggressors) // { // if (aggressor.Attacker == follower) // return notorietyResult; // } // } // } // } //} return(Notoriety.Innocent); }