public override void OnClick() { PlayerMobile player = m_From as PlayerMobile; if (player == null) { return; } if (ArenaController.GetArenaAtLocation(player.Location, player.Map) != null) { player.SendMessage("You cannot access stables while at that location."); return; } player.CloseGump(typeof(StableGump)); player.SendGump(new StableGump(m_Vendor, player, 0)); player.SendSound(0x055); }
public override void OnSpeech(SpeechEventArgs e) { PlayerMobile player = e.Mobile as PlayerMobile; if (player == null) { return; } string text = e.Speech.Trim().ToLower(); if (player.Alive) { if (text.IndexOf("house") != -1 || text.IndexOf("housing") != -1 || text.IndexOf("claim") != -1 || text.IndexOf("stable") != -1) { e.Handled = true; if (ArenaController.GetArenaAtLocation(player.Location, player.Map) != null) { player.SendMessage("You cannot access stables while at that location."); return; } player.CloseGump(typeof(StableGump)); player.SendGump(new StableGump(this, player, 0)); player.SendSound(0x055); return; } } else { base.OnSpeech(e); } }
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; 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; } ArenaController fromArenaController = ArenaController.GetArenaAtLocation(source.Location, source.Map); ArenaController targetArenaController = ArenaController.GetArenaAtLocation(target.Location, target.Map); if (fromArenaController != null && targetArenaController != null && fromArenaController == targetArenaController) { if (fromArenaController.m_ArenaFight != null) { if (fromArenaController.m_ArenaFight.m_FightPhase == ArenaFight.FightPhaseType.Fight) { if (fromArenaController.m_ArenaFight.m_ArenaMatch != null) { ArenaMatch arenaMatch = fromArenaController.m_ArenaFight.m_ArenaMatch; if (ArenaMatch.IsValidArenaMatch(arenaMatch, null, false)) { PlayerMobile rootPlayerFrom = null; PlayerMobile rootPlayerTarget = null; if (pm_Source != null) { rootPlayerFrom = pm_Source; } if (pm_Target != null) { rootPlayerTarget = pm_Target; } if (pm_SourceController != null) { rootPlayerFrom = pm_SourceController; } if (pm_TargetController != null) { rootPlayerTarget = pm_TargetController; } ArenaParticipant fromArenaParticipant = fromArenaController.m_ArenaFight.m_ArenaMatch.GetParticipant(rootPlayerFrom); ArenaParticipant targetArenaParticipant = fromArenaController.m_ArenaFight.m_ArenaMatch.GetParticipant(rootPlayerTarget); if (fromArenaParticipant != null && targetArenaParticipant != null) { if (fromArenaParticipant.m_FightStatus == ArenaParticipant.FightStatusType.Alive && targetArenaParticipant.m_FightStatus == ArenaParticipant.FightStatusType.Alive) { ArenaTeam fromTeam = null; ArenaTeam targetTeam = null; foreach (ArenaTeam team in arenaMatch.m_Teams) { if (team == null) { continue; } if (team.Deleted) { continue; } ArenaParticipant participant = team.GetPlayerParticipant(rootPlayerFrom); if (participant != null) { fromTeam = team; } participant = team.GetPlayerParticipant(rootPlayerTarget); if (participant != null) { targetTeam = team; } } if (fromTeam != null && targetTeam != null) { if (fromTeam == targetTeam) { return(Notoriety.Ally); } if (fromTeam != targetTeam) { return(Notoriety.Enemy); } } } } } } } } } //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); } } //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); } } } } } //Ships: Players and Creatures Friendly to a Ship Can Freely Attack Non-Friendly Mobiles on their Ship BaseShip sourceShip = null; if (bc_Source != null) { if (bc_Source.ShipOccupied != null) { sourceShip = bc_Source.ShipOccupied; } } if (pm_Source != null) { if (pm_Source.ShipOccupied != null) { sourceShip = pm_Source.ShipOccupied; } } if (sourceShip != null) { BaseShip targetShip = null; if (bc_Target != null) { if (bc_Target.ShipOccupied != null) { targetShip = bc_Target.ShipOccupied; } } if (pm_Target != null) { if (pm_Target.ShipOccupied != null) { targetShip = pm_Target.ShipOccupied; } } //On Same Ship if (sourceShip != null && targetShip != null && !sourceShip.Deleted && !targetShip.Deleted && sourceShip == targetShip) { bool sourceBelongs = false; bool targetBelongs = false; //Source Belongs n the Ship if (sourceShip.Crew.Contains(source) || sourceShip.IsFriend(source) || sourceShip.IsCoOwner(source) || sourceShip.IsOwner(source)) { sourceBelongs = true; } //Source's Owner Belongs on the Ship else if (bc_Source != null) { if (m_SourceController != null) { if (sourceShip.Crew.Contains(m_SourceController) || sourceShip.IsFriend(m_SourceController) || sourceShip.IsCoOwner(m_SourceController) || sourceShip.IsOwner(m_SourceController)) { sourceBelongs = true; } } } //Target Belongs On The Ship if (sourceShip.Crew.Contains(target) || sourceShip.IsFriend(target) || sourceShip.IsCoOwner(target) || sourceShip.IsOwner(target)) { targetBelongs = true; } //Target's Owner Belongs On the Ship else if (bc_Target != null) { if (m_TargetController != null) { if (sourceShip.Crew.Contains(m_TargetController) || sourceShip.IsFriend(m_TargetController) || sourceShip.IsCoOwner(m_TargetController) || sourceShip.IsOwner(m_TargetController)) { targetBelongs = true; } } } //Target May Be Freely Attacked on Ship 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); }
public void EndHeal() { StopHeal(); int healerNumber = -1, patientNumber = -1; bool playSound = true; bool checkSkills = false; SkillName primarySkill = GetPrimarySkill(m_Patient); SkillName secondarySkill = GetSecondarySkill(m_Patient); BaseCreature petPatient = m_Patient as BaseCreature; bool healDamage = true; bool healThroughPoison = true; double BandageHealThroughPoisonScalar = SpellHelper.HealThroughPoisonScalar; int effectHue = 0; AspectArmorProfile patientAspectArmorProfile = AspectGear.GetAspectArmorProfile(m_Patient); if (!m_Healer.Alive) { healDamage = false; healerNumber = 500962; // You were unable to finish your work before you died. patientNumber = -1; playSound = false; } else if (m_Patient.Hidden && m_Patient != m_Healer) { healDamage = false; m_Healer.SendMessage("You can no longer see your patient."); return; } else if (!m_Healer.InRange(m_Patient, Bandage.Range)) { healDamage = false; healerNumber = 500963; // You did not stay close enough to heal your target. patientNumber = -1; playSound = false; } else if ((SpellHelper.CheckMulti(m_Healer.Location, m_Healer.Map) || SpellHelper.CheckMulti(m_Patient.Location, m_Patient.Map)) && !m_Healer.InLOS(m_Patient)) { healDamage = false; healerNumber = 500963; // You did not stay close enough to heal your target. patientNumber = -1; playSound = false; } else if (!m_Patient.Alive || (petPatient != null && petPatient.IsDeadFollower)) { healDamage = false; double healing = m_Healer.Skills[primarySkill].Value; double anatomy = m_Healer.Skills[secondarySkill].Value; double chance = ((healing - 68.0) / 50.0) - (m_Slips * 0.02); if (((checkSkills = (healing >= 80.0 && anatomy >= 80.0)) && chance > Utility.RandomDouble()) || (Core.SE && petPatient.ControlMaster == m_Healer)) //TODO: Dbl check doesn't check for faction of the horse here? { if (m_Patient.Map == null || !m_Patient.Map.CanFit(m_Patient.Location, 16, false, false)) { healerNumber = 501042; // Target can not be resurrected at that location. patientNumber = 502391; // Thou can not be resurrected there! } else if (ArenaController.GetArenaAtLocation(m_Patient.Location, m_Patient.Map) != null) { healerNumber = 501042; // Target can not be resurrected at that location. patientNumber = 502391; // Thou can not be resurrected there! } else { healerNumber = 500965; // You are able to resurrect your patient. patientNumber = -1; m_Patient.PlaySound(0x214); m_Patient.FixedEffect(0x376A, 10, 16); if (petPatient != null && petPatient.IsDeadFollower) { Mobile master = petPatient.ControlMaster; if (master != null && master.InRange(petPatient, 3)) { healerNumber = 503255; // You are able to resurrect the creature. //TEST: NEW RESSURECT GUMP //master.CloseGump(typeof(PetResurrectGump)); //master.SendGump(new PetResurrectGump(m_Healer, petPatient)); } else { bool found = false; if (!found) { healerNumber = 1049670; // The pet's owner must be nearby to attempt resurrection. } } } else { m_Patient.CloseGump(typeof(ResurrectGump)); m_Patient.SendGump(new ResurrectGump(m_Patient, m_Healer)); } } } else { if (petPatient != null && petPatient.IsDeadFollower) { healerNumber = 503256; // You fail to resurrect the creature. } else { healerNumber = 500966; // You are unable to resurrect your patient. } patientNumber = -1; } } else if (m_Patient.Poisoned) { healDamage = false; m_Healer.SendLocalizedMessage(500969); // You finish applying the bandages. double healing = m_Healer.Skills[primarySkill].Value; double anatomy = m_Healer.Skills[secondarySkill].Value; double chance = ((healing - 30.0) / 50.0) - (m_Patient.Poison.Level * 0.05) - (m_Slips * 0.02); if ((checkSkills = (healing >= 60.0 && anatomy >= 60.0)) && chance > Utility.RandomDouble()) { if (m_Patient.CurePoison(m_Healer)) { healerNumber = (m_Healer == m_Patient) ? -1 : 1010058; // You have cured the target of all poisons. patientNumber = 1010059; // You have been cured of all poisons. } else { healerNumber = -1; patientNumber = -1; } } else { bool cured = false; AspectArmorProfile aspectArmorProfile = AspectGear.GetAspectArmorProfile(m_Patient); //Poison Aspect if (aspectArmorProfile != null) { if (aspectArmorProfile.m_Aspect == AspectEnum.Poison) { double extraCureChance = AspectGear.PoisonCureChanceBonus * (AspectGear.PoisonCureChanceBonusPerTier * (double)aspectArmorProfile.m_TierLevel); if (Utility.RandomDouble() <= extraCureChance) { m_Patient.CurePoison(m_Healer); cured = true; //TEST: Add Aspect Visuals } } } if (!cured) { healerNumber = 1010060; // You have failed to cure your target! patientNumber = -1; } } } else if (m_Patient.Hits == m_Patient.HitsMax) { healDamage = false; healerNumber = 500967; // You heal what little damage your patient had. patientNumber = -1; } if (healDamage) { checkSkills = true; patientNumber = -1; double healing = m_Healer.Skills[primarySkill].Value; double anatomy = m_Healer.Skills[secondarySkill].Value; double chance = ((healing + 20.0) / 100.0) - (m_Slips * 0.02); if (chance >= Utility.RandomDouble()) { healerNumber = 500969; // You finish applying the bandages. double min, max; if (Core.AOS) { min = (anatomy / 8.0) + (healing / 5.0) + 4.0; max = (anatomy / 6.0) + (healing / 2.5) + 4.0; } else { min = (anatomy / 5.0) + (healing / 5.0) + 3.0; max = (anatomy / 5.0) + (healing / 2.0) + 10.0; } double toHeal = min + (Utility.RandomDouble() * (max - min)); if (m_Patient.Body.IsMonster || m_Patient.Body.IsAnimal) { toHeal += m_Patient.HitsMax / 100; } toHeal -= m_Slips * 2.5; PlayerMobile playerHealer = m_Healer as PlayerMobile; if (playerHealer != null) { double superiorHealing = playerHealer.GetSpecialAbilityEntryValue(SpecialAbilityEffect.SuperiorHealing); if (superiorHealing > 0) { toHeal *= superiorHealing; } } if (toHeal < 1) { toHeal = 1; healerNumber = 500968; // You apply the bandages, but they barely help. } int finalHeal = (int)toHeal; m_Patient.Heal(finalHeal, m_Healer, false); } else { healerNumber = 500968; // You apply the bandages, but they barely help. playSound = false; } } if (healerNumber != -1) { m_Healer.SendLocalizedMessage(healerNumber); } if (patientNumber != -1) { m_Patient.SendLocalizedMessage(patientNumber); } if (healThroughPoison) { Effects.PlaySound(m_Healer.Location, m_Healer.Map, 0x64B); Effects.SendLocationParticles(EffectItem.Create(m_Healer.Location, m_Healer.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, effectHue, 0, 5005, 0); } if (playSound) { m_Patient.PlaySound(0x57); } if (checkSkills) { m_Healer.CheckSkill(secondarySkill, 0.0, 120.0, 1.0); m_Healer.CheckSkill(primarySkill, 0.0, 120.0, 1.0); } }