public static void HandleDeath(Mobile victim, Mobile killer) { if (killer == null) { killer = victim.FindMostRecentDamager(true); } PlayerState killerState = PlayerState.Find(killer); Container pack = victim.Backpack; if (pack != null) { Container killerPack = (killer == null ? null : killer.Backpack); Item[] sigils = pack.FindItemsByType(typeof(Sigil)); for (int i = 0; i < sigils.Length; ++i) { Sigil sigil = (Sigil)sigils[i]; if (killerState != null && killerPack != null) { if (Sigil.ExistsOn(killer)) { sigil.ReturnHome(); killer.SendLocalizedMessage(1010258); // The sigil has gone back to its home location because you already have a sigil. } else if (!killerPack.TryDropItem(killer, sigil, false)) { sigil.ReturnHome(); killer.SendLocalizedMessage(1010259); // The sigil has gone home because your backpack is full. } } else { sigil.ReturnHome(); } } } if (killerState == null) { return; } if (victim is BaseCreature) { BaseCreature bc = (BaseCreature)victim; Faction victimFaction = bc.FactionAllegiance; if (bc.Map == Faction.Facet && victimFaction != null && killerState.Faction != victimFaction) { int silver = killerState.Faction.AwardSilver(killer, bc.FactionSilverWorth); if (silver > 0) { killer.SendLocalizedMessage(1042748, silver.ToString("N0")); // Thou hast earned ~1_AMOUNT~ silver for vanquishing the vile creature. } } #region Ethics if (bc.Map == Faction.Facet && bc.GetEthicAllegiance(killer) == BaseCreature.Allegiance.Enemy) { Ethics.Player killerEPL = Ethics.Player.Find(killer); if (killerEPL != null && (100 - killerEPL.Power) > Utility.Random(100)) { ++killerEPL.Power; ++killerEPL.History; } } #endregion return; } PlayerState victimState = PlayerState.Find(victim); if (victimState == null) { return; } if (killer == victim || killerState.Faction != victimState.Faction) { ApplySkillLoss(victim); } if (killerState.Faction != victimState.Faction) { if (victimState.KillPoints <= -6) { killer.SendLocalizedMessage(501693); // This victim is not worth enough to get kill points from. #region Ethics Ethics.Player killerEPL = Ethics.Player.Find(killer); Ethics.Player victimEPL = Ethics.Player.Find(victim); if (killerEPL != null && victimEPL != null && victimEPL.Power > 0 && victimState.CanGiveSilverTo(killer)) { int powerTransfer = Math.Max(1, victimEPL.Power / 5); if (powerTransfer > (100 - killerEPL.Power)) { powerTransfer = 100 - killerEPL.Power; } if (powerTransfer > 0) { victimEPL.Power -= (powerTransfer + 1) / 2; killerEPL.Power += powerTransfer; killerEPL.History += powerTransfer; victimState.OnGivenSilverTo(killer); } } #endregion } else { int award = Math.Max(victimState.KillPoints / 10, 1); if (award > 40) { award = 40; } if (victimState.CanGiveSilverTo(killer)) { if (victimState.KillPoints > 0) { int silver = 0; silver = killerState.Faction.AwardSilver(killer, award * 40); if (silver > 0) { killer.SendLocalizedMessage(1042736, String.Format("{0:N0} silver\t{1}", silver, victim.Name)); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~! } } victimState.KillPoints -= award; killerState.KillPoints += award; int offset = (award != 1 ? 0 : 2); // for pluralization string args = String.Format("{0}\t{1}\t{2}", award, victim.Name, killer.Name); killer.SendLocalizedMessage(1042737 + offset, args); // Thou hast been honored with ~1_KILL_POINTS~ kill point(s) for vanquishing ~2_DEAD_PLAYER~! victim.SendLocalizedMessage(1042738 + offset, args); // Thou has lost ~1_KILL_POINTS~ kill point(s) to ~3_ATTACKER_NAME~ for being vanquished! #region Ethics Ethics.Player killerEPL = Ethics.Player.Find(killer); Ethics.Player victimEPL = Ethics.Player.Find(victim); if (killerEPL != null && victimEPL != null && victimEPL.Power > 0) { int powerTransfer = Math.Max(1, victimEPL.Power / 5); if (powerTransfer > (100 - killerEPL.Power)) { powerTransfer = 100 - killerEPL.Power; } if (powerTransfer > 0) { victimEPL.Power -= (powerTransfer + 1) / 2; killerEPL.Power += powerTransfer; killerEPL.History += powerTransfer; } } #endregion victimState.OnGivenSilverTo(killer); } else { killer.SendLocalizedMessage(1042231); // You have recently defeated this enemy and thus their death brings you no honor. } } } }
public static void HandleDeath(Mobile victim, Mobile killer) { if (killer == null) { killer = victim.FindMostRecentDamager(true); } if (killer == null) { return; // happens if GM [kill'ed } // creature points if (victim is BaseCreature) { BaseCreature bc = (BaseCreature)victim; if (bc.Map == Factions.Faction.Facet && bc.GetEthicAllegiance(killer) == BaseCreature.Allegiance.Enemy) { Ethics.Player killerEPL = Server.Ethics.Player.Find(killer); if (killerEPL != null && (100 - killerEPL.Power) > Utility.Random(100)) { // killer belongs to an ethic if (killer is PlayerMobile) { // sanity if ((killerEPL.Ethic == Ethic.Evil && killer.ShortTermMurders == 0) || (killerEPL.Ethic == Ethic.Hero && killer.ShortTermMurders == 0 && !killer.Murderer)) { // no murder counts if Hero. Evil ok to have longs (this is how I read the docs) if (killerEPL.Ethic == Ethic.Evil || ((killer as PlayerMobile).NpcGuild != NpcGuild.ThievesGuild)) { // Heros can't belong to the Thieves guild and gain life force. Evil ok // from the evil/hero system doc // Note that in everything below, "kills" is defined by "the person who did the most damage when the // person was killed." (I assum this applied to creatures as well.) if (Mobile.MostDamage(victim, killer)) { if (killerEPL.Power < 100) { ++killerEPL.Power; ++killerEPL.History; killer.SendLocalizedMessage(1045100); // You have gained LifeForce } else { killer.SendLocalizedMessage(1045101); // Your LifeForce is at the maximum } } } } } } } return; } else { // player points Ethics.Player killerEPL = Server.Ethics.Player.Find(killer, true); Ethics.Player victimEPL = Server.Ethics.Player.Find(victim); // evil kill an innocent // When evils kill innocents that they attacked, all the evil's stats and skills fall by 50% for five minutes . // They also lose lifeforce. If the evil has 0 lifeforce, then the evil can also be reported for murder. // Lastly, they cannot hide, recall, or gate away for those five minutes. if (killer.Evil && !victim.Hero && !victim.Evil) { if (ComputeMurder(victim, killer)) { // stats and skills ApplySkillLoss(killer); ApplyStatLoss(killer); // loss of life force (no idea how much) killerEPL.Power -= Math.Min(killerEPL.Power, Utility.Random(10, 50)); // loss of sphere killerEPL.History -= Math.Min(killerEPL.History, Utility.Random(10, 50)); // set the EvilCrim state which will prevent gate and hide for 5 minutes killer.ExpirationFlags.Add(new Mobile.ExpirationFlag(killer, Mobile.ExpirationFlagID.EvilCrim, TimeSpan.FromMinutes(5))); killer.SendLocalizedMessage(1045108); // You have lost lifeforce killer.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, 500913); // The life force of this victim was not pure. You stumble back in pain. } } // good kill an innocent // Innocents who die to heroes are covered under the standard reputation system. In addition, the heroes are stripped of their status. // If you lose too much sphere or lifeforce, you become a "fallen hero." You are still gray to evils for an additional five minutes. // If a hero is reported for murder, all lifeforce and sphere immediately vanishes, and you become a fallen hero if (killer.Hero && !victim.Hero && !victim.Evil) { if (ComputeMurder(victim, killer)) { // the killer murdered the victim // loss of life force (no idea how much) killerEPL.Power -= Math.Min(killerEPL.Power, Utility.Random(10, 50)); // loss of sphere killerEPL.History -= Math.Min(killerEPL.History, Utility.Random(10, 50)); if (killerEPL.Power == 0 || killerEPL.History == 0) { // set the FallenHero state which make you gray to evil for 5 minutes (what does it mean for a hero to be gray to an evil?) killer.ExpirationFlags.Add(new Mobile.ExpirationFlag(killer, Mobile.ExpirationFlagID.FallenHero, TimeSpan.FromMinutes(5))); } killer.SendLocalizedMessage(1045108); // You have lost lifeforce } } // transfer lifeforce if (Mobile.MostDamage(victim, killer)) { // we did the most damage if (killerEPL != null && victimEPL != null && victimEPL.Power > 0) { // two participants in the ethics system if (killer is PlayerMobile) { // sanity if ((killerEPL.Ethic == Ethic.Evil && killer.ShortTermMurders == 0) || (killerEPL.Ethic == Ethic.Hero && killer.ShortTermMurders == 0 && !killer.Murderer)) { // no murder counts if Hero. Evil ok to have longs (this is how I read the docs) if (killerEPL.Ethic == Ethic.Evil || ((killer as PlayerMobile).NpcGuild != NpcGuild.ThievesGuild)) { // Heros can't belong to the Thieves guild and gain life force. Evil ok if (victim.CheckState(Mobile.ExpirationFlagID.NoPoints) == false) { // [un]holy word - No sphere nor lifeforce is granted for the kill. if (killerEPL.Ethic != victimEPL.Ethic) { // heros can't gain life force by killing other heros (we'll apply this to evils as well) // 20% of victim's power int powerTransfer = victimEPL.Power / 5; if (powerTransfer > (100 - killerEPL.Power)) { powerTransfer = 100 - killerEPL.Power; } if (powerTransfer > 0) { victimEPL.Power -= powerTransfer; killerEPL.Power += powerTransfer; killerEPL.History += powerTransfer; killer.SendLocalizedMessage(1045100); // You have gained LifeForce victim.SendLocalizedMessage(1045108); // You have lost lifeforce } else { killer.SendLocalizedMessage(1045101); // Your LifeForce is at the maximum } } } } } } } } // award special kill points to pre ethic enrollment participants that kill evil // to qualify we will use the rules for gaining life force for Hero i.e., // You cannot gain points life force while you are red, not while you have any short murder counts, // nor if you are a member of the Thieves' Guild. if (killerEPL == null && victimEPL != null && victimEPL.Ethic == Ethic.Evil) { // killer not in ethics && victim is Evil if (killer.ShortTermMurders == 0 && !killer.Murderer) { // no murder counts if (killer is PlayerMobile && (killer as PlayerMobile).NpcGuild != NpcGuild.ThievesGuild) { // not in the Thieves' Guild PlayerMobile pm = (killer as PlayerMobile); // check to make sure we have not killed thie evil before bool goodKill = true; foreach (PlayerMobile.EthicKillsLog ekl in pm.EthicKillsLogList) { if (ekl.Serial == victim.Serial && !ekl.Expired) { // we've killed this guy within the last 5 days goodKill = false; break; } } if (goodKill) { pm.EthicKillsLogList.Add(new PlayerMobile.EthicKillsLog(victim.Serial, DateTime.Now)); if (pm.EthicPoints >= 5) { // Add to Good alignment (EthicPoints log will be wipped on next serialization) if (Ethic.Hero.IsEligible(killer)) // make sure they are old enough { Player pl = new Player(Ethic.Hero, killer); pl.Attach(); pm.Delta(MobileDelta.Noto); killer.FixedEffect(0x373A, 10, 30); killer.PlaySound(0x209); killer.SendLocalizedMessage(501994); // For your heroic deeds you are granted the title of hero. } } else { // tell them they are on the path to hero! killer.SendLocalizedMessage(502598); // Strive to continue on the path of benevolence. } } } } } } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch (info.ButtonID) { case 1: { Mobile killer = m_Killers[m_Idx]; if (killer != null && !killer.Deleted) { killer.Kills++; killer.ShortTermMurders++; //if ( Core.SE ) //{ ((PlayerMobile)from).RecentlyReported.Add(killer); Timer.DelayCall <Mobile[]>(TimeSpan.FromMinutes(10), new TimerStateCallback <Mobile[]>(ReportedListExpiry_Callback), new Mobile[] { from, killer }); //} if (killer is PlayerMobile) { ((PlayerMobile)killer).ResetKillTime(); } killer.SendLocalizedMessage(1049067); //You have been reported for murder! Ethics.Player killerEPL = Ethics.Player.Find(killer); if (killer.Kills == Mobile.MurderCount) { killer.SendLocalizedMessage(502134); //You are now known as a murderer! if (killerEPL != null) { killer.SendMessage("You have been stripped of your status due to your dastardly actions."); killer.SendMessage("You must absolve yourself of sin before your abilities will return."); killerEPL.Power = 0; killerEPL.FallenExpire = DateTime.Now + Ethic.FallenPeriod; if (killer is PlayerMobile) { ((PlayerMobile)killer).ValidateEquipment(); //strip them of their ethics items. } } } else if (SkillHandlers.Stealing.SuspendOnMurder && killer.Kills == 1 && killer is PlayerMobile && ((PlayerMobile)killer).NpcGuild == NpcGuild.ThievesGuild) { killer.SendLocalizedMessage(501562); // You have been suspended by the Thieves Guild. } } break; } case 2: { break; } } m_Idx++; if (m_Idx < m_Killers.Count) { from.SendGump(new ReportMurdererGump(from, m_Killers, m_Location, m_Map, m_Idx)); } }
public static void HandleDeath(Mobile victim, Mobile killer) { if (killer != null && victim != null && killer != victim && !(killer is BaseCreature)) { if (victim is BaseCreature) { BaseCreature bc = (BaseCreature)victim; Region homeregion = Region.Find(bc.Home, victim.Map); if ((homeregion == null || !homeregion.IsPartOf(typeof(ChampionSpawnRegion))) && (killer.Region == null || !killer.Region.IsPartOf(typeof(ChampionSpawnRegion)))) { if (!(victim is BaseVendor) && bc.GetEthicAllegiance(killer) == BaseCreature.Allegiance.Enemy) { Player killerEPL = Player.Find(killer); if (killerEPL != null && killerEPL.Power < Player.MaxPower) { ++killerEPL.Power; killer.SendMessage("You gain a little life force for slaying a minion of {0}.", killerEPL.Ethic == Ethic.Evil ? "justice" : "evil"); } } } } else if (victim.Guild == null || killer.Guild == null || killer.Guild != victim.Guild) //not guild mates { Ethics.Player killerEPL = Player.Find(killer); Ethics.Player victimEPL = Player.Find(victim); PlayerState killerState = PlayerState.Find(killer); PlayerState victimState = PlayerState.Find(victim); bool applyskillloss = false; if (killerState != null && victimState != null && killerState.Faction == victimState.Faction) { applyskillloss = true; //Faction mate penalty, we assume they are of the same ethic, or one is not in ethics. } else if (killerEPL != null && !killerEPL.HasFallen) //Killer is in ethics { if (victimEPL != null && !victimEPL.HasFallen) //Victim is in ethics { if (killerEPL.Ethic != victimEPL.Ethic) { if ((killerEPL.Ethic == Ethic.Evil || (!killer.Criminal && killer.Kills < 5)) && victimEPL.Power > 0) { int powerTransfer = Math.Max(1, victimEPL.Power / 5); if (powerTransfer > (Player.MaxPower - killerEPL.Power)) { powerTransfer = Player.MaxPower - killerEPL.Power; } if (powerTransfer > 0) { victimEPL.Power -= powerTransfer; killerEPL.Power += powerTransfer; killer.FixedEffect(0x373A, 10, 30); killer.PlaySound(0x209); string message = "a little"; if (powerTransfer > 20) { message = "a lot"; } else if (powerTransfer > 10) { message = "a good amount"; } else if (powerTransfer > 5) { message = "some"; } killer.SendMessage("You have gained {0} life force for killing {1}.", powerTransfer, victim.Name); victim.SendMessage("You have lost {1} life force for falling victim to {1}.", powerTransfer, killer.Name); } if (victimEPL.Sphere > 0 && (victimEPL.Rank > 3 || (killerEPL.Rank - victimEPL.Rank < 3))) { int sphereTransfer = Math.Max(1, 1 + (victimEPL.Rank - killerEPL.Rank)); //Always at least 1pt victimEPL.Sphere -= sphereTransfer; killerEPL.Sphere += sphereTransfer; } } } else //Both are of the same ethic - PENALTY! { applyskillloss = true; } } else if (killerEPL.Ethic.IsAggressed(victim)) //Were they grey to this Ethic? { killerEPL.Ethic.RemoveAggressor(victim); } else if (victimState == null || killerState == null) //Not in ethics - PENALTY! { ApplySkillLoss(killer); killerEPL.Power -= Math.Min(killerEPL.Power, 20); killer.PlaySound(0x133); killer.FixedParticles(0x377A, 244, 25, 9950, 31, 0, EffectLayer.Waist); } } else if (victimEPL != null && !(killer is BaseCreature)) //Killer is NOT in ethics, but victim is. { if (victimEPL.Ethic == Ethic.Evil) { if (killer.Kills < 5 && !killer.Criminal) { killer.FixedEffect(0x373A, 10, 30); killer.PlaySound(0x209); killer.SendMessage("You have slayed an evil soul, embracing the path of heros."); } } else if (victimEPL.Ethic == Ethic.Hero) { killer.FixedEffect(0x373A, 10, 30); killer.PlaySound(0x209); killer.SendMessage("You have slayed a heroic soul, embracing the path of the evil."); } } if (applyskillloss) { ApplySkillLoss(killer); killerEPL.Power /= 3; killer.PlaySound(0x133); killer.FixedParticles(0x377A, 244, 25, 9950, 31, 0, EffectLayer.Waist); } } } }
public static void HandleDeath(Mobile victim, Mobile killer) { if (killer != null && victim != null && killer != victim && !(killer is BaseCreature)) { if (victim is BaseCreature) { BaseCreature bc = (BaseCreature)victim; Region homeregion = Region.Find(bc.Home, victim.Map); if ((homeregion == null || !homeregion.IsPartOf(typeof(ChampionSpawnRegion))) && (killer.Region == null || !killer.Region.IsPartOf(typeof(ChampionSpawnRegion)))) { if (!(victim is BaseVendor) && bc.GetEthicAllegiance(killer) == BaseCreature.Allegiance.Enemy) { Player killerEPL = Player.Find(killer); if (killerEPL != null && killerEPL.Power < Player.MaxPower) { ++killerEPL.Power; ++killerEPL.History; killer.SendMessage("You gain a little life force for slaying a minion of {0}.", killerEPL.Ethic == Ethic.Evil ? "good" : "evil"); } } } } else if (victim.Guild == null || killer.Guild == null || killer.Guild != victim.Guild) //not guild mates { Ethics.Player killerEPL = Player.Find(killer); Ethics.Player victimEPL = Player.Find(victim); PlayerState killerState = PlayerState.Find(killer); PlayerState victimState = PlayerState.Find(victim); bool applyskillloss = false; if (killerState != null && victimState != null && killerState.Faction == victimState.Faction) //Faction mate penalty { applyskillloss = true; } else if (killerEPL != null) //Killer is in ethics { if (victimEPL != null) //Victim is in ethics { if (killerEPL.Ethic != victimEPL.Ethic) { if ((killerEPL.Ethic == Ethic.Evil || (!killer.Criminal && killer.Kills < 5)) && victimEPL.Power > 0) { int powerTransfer = Math.Max(1, victimEPL.Power / 5); if (powerTransfer > (Player.MaxPower - killerEPL.Power)) { powerTransfer = Player.MaxPower - killerEPL.Power; } if (powerTransfer > 0) { victimEPL.Power -= powerTransfer; killerEPL.Power += powerTransfer; killerEPL.History += powerTransfer; killer.FixedEffect(0x373A, 10, 30); killer.PlaySound(0x209); string message = "a little"; if (powerTransfer > 20) { message = "a lot"; } else if (powerTransfer > 10) { message = "a good amount"; } else if (powerTransfer > 5) { message = "some"; } killer.SendMessage("You have gained {0} life force for killing {1}.", powerTransfer, victim.Name); victim.SendMessage("You have lost {1} life force for falling victim to {1}.", powerTransfer, killer.Name); } } } else if (victimEPL.Ethic == Ethic.Hero) //Both are Heros - PENALTY! { applyskillloss = true; } } else if (killerEPL.Ethic.IsAggressed(victim)) { killerEPL.Ethic.RemoveAggressor(victim); } else if ((victimState == null || killerState == null) && victim.Kills < 5) //Innocent - PENALTY! { ApplySkillLoss(killer); killerEPL.Power -= Math.Min(killerEPL.Power, 20); killer.PlaySound(0x133); killer.FixedParticles(0x377A, 244, 25, 9950, 31, 0, EffectLayer.Waist); } } else if (victimEPL != null && !(killer is BaseCreature)) //Killer is NOT in ethics, but victim is. { if (victimEPL.Ethic == Ethic.Evil) { if (killer.Kills < 5 && !killer.Criminal) { killer.FixedEffect(0x373A, 10, 30); killer.PlaySound(0x209); killer.SendMessage("You have slayed an evil soul and embraced the path of heros."); } } else if (victimEPL.Ethic == Ethic.Hero) { killer.FixedEffect(0x373A, 10, 30); killer.PlaySound(0x209); killer.SendMessage("You have slayed a heroic soul and embraced the path of the evil."); } } if (applyskillloss) { ApplySkillLoss(killer); killerEPL.Power /= 3; killer.PlaySound(0x133); killer.FixedParticles(0x377A, 244, 25, 9950, 31, 0, EffectLayer.Waist); } if (killer.Kills >= Mobile.MurderCount && killerEPL != null && killerEPL.Ethic == Ethic.Hero) { killer.SendMessage("You have been stripped of your hero status due to your dastardly actions."); Ethics.Player killerPLYR = Player.Find(killer, false); if (killerPLYR != null) { killerPLYR.Detach(); } } } } }