public static void MakeEvil_OnTarget(Mobile from, object obj) { if (obj is PlayerMobile) { PlayerMobile pm = obj as PlayerMobile; if (pm.EthicPlayer != null) { Player p = Player.Find(pm); if (p != null) { p.Detach(); pm.Delta(MobileDelta.Noto); from.SendMessage("That player has been removed from the ethics system."); } } Player pl = new Player(Server.Ethics.Ethic.Evil, pm); pl.Attach(); pm.Delta(MobileDelta.Noto); pm.FixedEffect(0x373A, 10, 30); pm.PlaySound(0x209); pm.SendLocalizedMessage(502595); // You are now evil. from.SendMessage("That player has been added to the ethics system."); } else { from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(RemoveEthic_OnTarget)); from.SendMessage("That is not a player. Try again."); } }
public override void OnAdded(IEntity parent) { PlayerMobile mob = parent as PlayerMobile; if (mob != null) { mob.MortEngine.MortEvo = EMort; mob.Delta(MobileDelta.Hits); mob.Delta(MobileDelta.Stam); mob.Delta(MobileDelta.Mana); } base.OnAdded(parent); }
public static void RemoveEthic_OnTarget(Mobile from, object obj) { if (obj is PlayerMobile) { PlayerMobile pm = obj as PlayerMobile; if (pm.EthicPlayer == null) { from.SendMessage("That player does not seem to be in the ethics system."); } else { Player p = Player.Find(pm); if (p != null) { p.Detach(); pm.Delta(MobileDelta.Noto); from.SendMessage("That player has been removed from the ethics system."); } } } else { from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(RemoveEthic_OnTarget)); from.SendMessage("That is not a player. Try again."); } }
protected override void OnTarget(Mobile from, object target) { //target //m_Thief Item unstolen = null; if (!(target is Mobile)) { m_Thief.SendMessage("You can only reverse pickpocket creatures"); } else { unstolen = TryUnstealItem((Mobile)target); } if (unstolen != null) { if (!(unstolen is Container || unstolen.Stackable)) { // do not return stolen containers or stackable items StolenItem.Add(unstolen, m_Thief as Mobile, target as Mobile); } } if (m_Caught) { Mobile mobRoot = (Mobile)target; if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot)) { m_Thief.CriminalAction(false); } string message = String.Format("You notice {0} trying to reverse pickpocket {1}.", m_Thief.Name, mobRoot.Name); foreach (NetState ns in m_Thief.GetClientsInRange(8)) { if (ns.Mobile != m_Thief) { ns.Mobile.SendMessage(message); } } } else if (target is Corpse && ((Corpse)target).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } if (target is Mobile && ((Mobile)target).Player && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)target) && !IsInGuild((Mobile)target)) { PlayerMobile pm = (PlayerMobile)m_Thief; pm.PermaFlags.Add((Mobile)target); pm.Delta(MobileDelta.Noto); } }
public void CheckResignation(PlayerMobile pm) { VvVPlayerEntry entry = GetPlayerEntry <VvVPlayerEntry>(pm); if (entry != null && entry.Resigning && entry.ResignExpiration < DateTime.UtcNow) { pm.PrivateOverheadMessage(MessageType.Regular, 1154, 1155561, pm.NetState); // You are no longer in Vice vs Virtue! entry.Active = false; entry.ResignExpiration = DateTime.MinValue; pm.Delta(MobileDelta.Noto); } }
public static void FixPets(PlayerMobile m) { if (m.AllFollowers == null || m.AllFollowers.Count == 0) { return; } BaseCreature pet; var count = m.AllFollowers.Count; while (--count >= 0) { pet = m.AllFollowers[count] as BaseCreature; if (pet == null || pet.IsStabled) { continue; } if (pet.Deleted || !pet.IsControlledBy(m)) { m.AllFollowers.RemoveAt(count); continue; } if (pet == m.Mount || pet.Stable(false)) { continue; } pet.MoveToWorld(m.Location, m.Map); pet.ControlTarget = m; pet.ControlOrder = OrderType.Follow; } m.Followers = m.AllFollowers.OfType <BaseCreature>() .Where(p => !p.IsStabled && p.Map == m.Map) .Aggregate(0, (c, p) => c + p.ControlSlots); m.Followers = Math.Max(0, m.Followers); m.Delta(MobileDelta.Followers); }
public void AddPlayer(PlayerMobile pm) { if (pm == null || pm.Guild == null) { return; } Guild g = pm.Guild as Guild; VvVPlayerEntry entry = GetEntry(pm, true) as VvVPlayerEntry; if (!entry.Active) { entry.Active = true; } pm.SendLocalizedMessage(1155564); // You have joined Vice vs Virtue! pm.SendLocalizedMessage(1063156, g.Name); // The guild information for ~1_val~ has been updated. pm.Delta(MobileDelta.Noto); pm.ProcessDelta(); CheckBattleStatus(pm); }
protected override void OnTick() { m_placer.PermaFlags.Remove(m_target); m_placer.Delta(MobileDelta.Noto); }
public override void Execute(CommandEventArgs e, object obj) { Mobile m = (Mobile)obj; //CommandLogging.WriteLine( e.Mobile, "{0} {1} {2} {3}", e.Mobile.AccessLevel, CommandLogging.Format( e.Mobile ), m_Value ? "hiding" : "unhiding", CommandLogging.Format( m ) ); if (e.Length == 1) { if ((m is PlayerMobile) && (m.AccessLevel == AccessLevel.Player)) // Can't put bounty on staff. { PlayerMobile bountyPlacer = (PlayerMobile)e.Mobile; Container cont = bountyPlacer.BankBox; int amount = 0; try { amount = Int32.Parse(e.GetString(0)); } catch { AddResponse("Bounty Amount was improperly formatted!"); return; } if (amount < 500) { AddResponse("No one would hunt for that low of a bounty!"); } else if (cont != null && cont.ConsumeTotal(typeof(Gold), amount)) { BountyKeeper.Add(new Bounty(bountyPlacer, (PlayerMobile)m, amount, false)); AddResponse("You have posted a bounty for the head of " + m.Name + "!"); AddResponse("Amount of GP removed from your bank: " + amount); ((PlayerMobile)m).SendMessage(bountyPlacer.Name + " has just placed a bounty on your head for " + amount + " gold."); //Flag player criminal, but don't guardwhack //bountyPlacer.Criminal = true; //Flag to only the player you place the bounty on. if (!bountyPlacer.PermaFlags.Contains(m)) { bountyPlacer.PermaFlags.Add(m); bountyPlacer.Delta(MobileDelta.Noto); ExpireTimer et = new ExpireTimer(bountyPlacer, m, TimeSpan.FromMinutes(2.0)); et.Start(); } } else { AddResponse("You do not have that much GP in your bank!"); } } else { AddResponse("Please target a player."); } } else { AddResponse("You must specify the amount of the bounty."); } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolen = null; object root = null; if (target is Item) { root = ((Item)target).RootParent; if (root != from)//Change to if (true) if this script f***s up { stolen = TryStealItem((Item)target); } else { m_Thief.SendMessage("Who would you like to reverse pickpocket?"); m_Thief.Target = new Stealing.StealingTarget.UnstealingTarget(m_Thief, (Item)target); } } else if (target is Mobile) { Container pack = ((Mobile)target).Backpack; if (pack != null && pack.Items.Count > 0) { int randomIndex = Utility.Random(pack.Items.Count); root = target; stolen = TryStealItem(pack.Items[randomIndex]); } } else { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } if (stolen != null) { from.AddToBackpack(stolen); if (!(stolen is Container || stolen.Stackable)) // do not return stolen containers or stackable items { StolenItem.Add(stolen, m_Thief, root as Mobile); } } if (m_Caught) { if (root == null) { m_Thief.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot)) { m_Thief.CriminalAction(false); } string message = String.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name); foreach (NetState ns in m_Thief.GetClientsInRange(8)) { if (ns.Mobile != m_Thief) { ns.Mobile.SendMessage(message); } } } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } if (root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild((Mobile)root)) { PlayerMobile pm = (PlayerMobile)m_Thief; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } }
public static void FixMe(this PlayerMobile m, FixMeFlags flags) { if (m == null || m.Deleted) { return; } if (m.Mounted && flags.HasFlag(FixMeFlags.Mount)) { var mountItem = m.FindItemOnLayer(Layer.Mount) as IMountItem; if (mountItem != null) { if (mountItem.Mount == null || mountItem.Mount != m.Mount) { m.RemoveItem(mountItem as Item); } else if (mountItem.Mount.Rider == null) { mountItem.Mount.Rider = m; } } else if (m.Mount != null && m.Mount.Rider == null) { m.Mount.Rider = m; } m.Delta(MobileDelta.Followers); m.SendMessage(0x55, "Your mount has been invalidated."); } if (flags.HasFlag(FixMeFlags.Pets)) { m.Followers = 0; m.AllFollowers.ToArray().ForEach( f => { if (f == null || !(f is BaseCreature)) { return; } var pet = (BaseCreature)f; if (pet.IsStabled || !pet.Controlled || pet.ControlMaster != m) { return; } if (pet != m.Mount) { pet.MoveToWorld(m.Location, m.Map); pet.ControlTarget = m; pet.ControlOrder = OrderType.Follow; } m.Followers += pet.ControlSlots; }); m.Followers = Math.Max(0, Math.Min(m.FollowersMax, m.Followers)); m.Delta(MobileDelta.Followers); m.SendMessage( 0x55, "Your pets have been teleported to you and your follower count has been normalized, it is now {0}.", m.Followers); } if (flags.HasFlag(FixMeFlags.Equip)) { m.ValidateEquipment(); } if (m.IsOnline() && flags.HasFlag(FixMeFlags.Gumps)) { foreach (Gump gump in m.NetState.Gumps.ToArray()) { if (gump is SuperGump) { ((SuperGump)gump).Refresh(); } else if (m.HasGump(gump.GetType())) { m.CloseGump(gump.GetType()); m.SendGump(gump); } } m.SendMessage(0x55, "Your gumps have been refreshed."); } if (flags.HasFlag(FixMeFlags.Tags)) { m.InvalidateProperties(); m.Items.ForEach( item => { if (item != null && !item.Deleted) { item.InvalidateProperties(); } }); if (m.Backpack != null) { m.Backpack.InvalidateProperties(); m.Backpack.FindItemsByType <Item>(true).ForEach( item => { if (item != null && !item.Deleted) { item.InvalidateProperties(); } }); } m.SendMessage(0x55, "Your tags have been invalidated."); } if (flags.HasFlag(FixMeFlags.Skills)) { foreach (Skill skill in m.Skills) { skill.Normalize(); } m.SendMessage(0x55, "Your skills have been normalized."); } if (flags.HasFlag(FixMeFlags.Quests)) { if (m.Quest != null) { if (m.Quest.From == null) { m.Quest.From = m; } if (m.Quest.Objectives == null || m.Quest.Objectives.Count == 0 || m.Quest.Conversations == null || m.Quest.Conversations.Count == 0) { m.Quest.Cancel(); } } m.SendMessage(0x55, "Your quests have been validated."); } if (OnFix != null) { OnFix(m, flags); } m.SendMessage(0x55, "FixMe completed! If you still have issues, contact a member of staff."); }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolen = null; object root = null; bool caught = false; if (target is Item) { root = ((Item)target).RootParent; stolen = TryStealItem((Item)target, ref caught); } else if (target is Mobile) { Container pack = ((Mobile)target).Backpack; if (pack != null && pack.Items.Count > 0) { int randomIndex = Utility.Random(pack.Items.Count); root = target; stolen = TryStealItem(pack.Items[randomIndex], ref caught); } #region Monster Stealables if (target is BaseCreature && from is PlayerMobile) { Server.Engines.CreatureStealing.StealingHandler.HandleSteal(target as BaseCreature, from as PlayerMobile); } #endregion } else { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } if (stolen != null) { if (stolen is AddonComponent) { BaseAddon addon = ((AddonComponent)stolen).Addon as BaseAddon; from.AddToBackpack(addon.Deed); addon.Delete(); } else { from.AddToBackpack(stolen); } if (!(stolen is Container || stolen.Stackable)) { // do not return stolen containers or stackable items StolenItem.Add(stolen, m_Thief, root as Mobile); } } if (caught) { if (root == null) { m_Thief.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot)) { m_Thief.CriminalAction(false); } string message = String.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name); foreach (NetState ns in m_Thief.GetClientsInRange(8)) { if (ns.Mobile != m_Thief) { ns.Mobile.SendMessage(message); } } } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } if (root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild((Mobile)root)) { PlayerMobile pm = (PlayerMobile)m_Thief; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0); Item stolen = null; Item attempt = null; object root = null; bool ok = false; bool caught = false; Mobile mobRoot = null; if (target is Item) { attempt = (Item)target; root = attempt.RootParent; mobRoot = root as Mobile; stolen = TryStealItem(attempt, root, 2, ref ok, ref caught); } else if (target is Mobile) { Container pack = ((Mobile)target).Backpack; if (pack != null && pack.Items.Count > 0) { from.SendAsciiMessage("You reach into {0}'s backpack and try to take something...", ((Mobile)target).Name); int randomIndex = Utility.Random(pack.Items.Count); root = target; mobRoot = root as Mobile; attempt = pack.Items[randomIndex] as Item; if (attempt != null) { stolen = TryStealItem(attempt, root, 1, ref ok, ref caught); } if (Notoriety.Compute(from, mobRoot) == Notoriety.Innocent) { Misc.Titles.AwardKarma(from, -4, true); } } else { from.SendAsciiMessage("You reach into {0}'s backpack... But find it's empty.", ((Mobile)target).Name); } } else { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } if (!ok) { return; } if (stolen != null) { from.AddToBackpack(stolen); if (mobRoot != null) { ArrayList list = m_Table[m_Thief] as ArrayList; if (list == null) { m_Table[m_Thief] = list = new ArrayList(1); } list.Add(mobRoot); new ThiefExpireTimer(mobRoot, m_Thief).Start(); } } if (caught) { bool crime; string fromStr = String.Empty; if (root is Corpse) { crime = ((Corpse)root).IsCriminalAction(m_Thief); } else if (mobRoot != null) { if (m_Saw != null && m_Saw.Count > 0) { crime = Notoriety.Compute(from, mobRoot) == Notoriety.Innocent; } else { crime = false; } fromStr = String.Format(" from {0}", mobRoot.Name); } else { crime = true; } if (crime) { m_Thief.CriminalAction(false); // calls guards } //else if ( noto != Notoriety.Enemy && noto != Notoriety.Ally ) // dont go criminal in guild situations // m_Thief.Criminal = true; // doesnt call guards if (m_Saw != null && m_Saw.Count > 0) { string message = null; foreach (Mobile m in m_Saw) { if (m.NetState != null) { if (root is Mobile && m == root) { StringBuilder sb = new StringBuilder("You notice "); sb.Append(m_Thief.Name); sb.Append(" trying to steal "); if (attempt.Amount > 1) { sb.Append("some "); } else { sb.Append("a "); } attempt.AppendClickName(sb); sb.Append(" from you!"); m.SendAsciiMessage(sb.ToString()); } else { if (message == null) { if (stolen != null) { attempt = stolen; } if (attempt != null) { StringBuilder sb = new StringBuilder("You notice "); sb.Append(m_Thief.Name); sb.Append(" trying to steal "); if (attempt.Amount > 1) { sb.Append("some "); } else { sb.Append("a "); } attempt.AppendClickName(sb); sb.Append(fromStr); sb.Append('!'); message = sb.ToString(); } else { message = String.Format("You notice {0} trying to something steal something{1}!", m_Thief.Name, fromStr); } } m.SendAsciiMessage(message); } } else if (m is BaseCreature) { if (m.Body.IsHuman) { if (!(m is BaseGuard) && !(m is PlayerVendor)) { m.Say(Utility.RandomList(1007037, 501603, 1013037, 1013038, 1013039, 1013041, 1013042, 1013043, 1013052)); } if (crime) { GuardedRegion reg = m.Region as GuardedRegion; if (reg != null && !reg.IsDisabled()) { reg.CallGuards(m.Location); } } } if (root == m && Utility.RandomBool()) { BaseCreature bc = (BaseCreature)m; if (!bc.Controlled && (bc.AlwaysMurderer || (bc.AlwaysAttackable && !bc.IsHarmfulCriminal(m_Thief)))) { bc.Attack(m_Thief); } } } }// foreach m_Saw } } if (root is Mobile && ((Mobile)root).Player && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild((Mobile)root)) { PlayerMobile pm = m_Thief; // you don't get perma if the guards killed you before this function was over if (pm.Alive) { pm.PermaFlags.Add((Mobile)root); } pm.Delta(MobileDelta.Noto); } }
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. } } } } } } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolenItem = null; object root = null; Mobile mobileTarget = root as Mobile; bool turnPermaGrey = false; bool caught = false; int amountStolen = 0; //Stealing Attempt if (target is Item) { root = ((Item)target).RootParent; stolenItem = TryStealItem((Item)target, ref amountStolen); } else if (target is Mobile) { Container pack = ((Mobile)target).Backpack; if (pack != null && pack.Items.Count > 0) { int randomIndex = Utility.Random(pack.Items.Count); root = target; stolenItem = TryStealItem(pack.Items[randomIndex], ref amountStolen); } } else { from.SendLocalizedMessage(502710); // You can't steal that! } //Successful Steal Attempt if (stolenItem != null) { //See if Nearby Mobiles Notice IPooledEnumerable nearbyMobiles = from.Map.GetMobilesInRange(from.Location, NoticeRange); foreach (Mobile mobile in nearbyMobiles) { double noticeChance = 0; if (mobile == from) { continue; } if (!mobile.Alive) { continue; } if (mobile is PlayerMobile) { if (from.Map.InLOS(from.Location, mobile.Location)) { noticeChance += PlayerNoticeChance; } else { noticeChance += PlayerNoticeChance * LOSBlockedCatchScalar; } if (Utility.RandomDouble() <= noticeChance && mobileTarget != null) { mobile.SendMessage("You notice " + from.Name + " trying to steal from " + mobileTarget.Name + "."); caught = true; } continue; } BaseCreature bc_Creature = mobile as BaseCreature; if (bc_Creature != null && mobile.Body.IsHuman) { if (from.Map.InLOS(from.Location, mobile.Location)) { noticeChance += MobileNoticeChance; } else { noticeChance += MobileNoticeChance * LOSBlockedCatchScalar; } if (Utility.RandomDouble() <= noticeChance && mobileTarget != null) { caught = true; } continue; } } nearbyMobiles.Free(); //Resolve if (caught) { if (root == null) { from.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(from)) { from.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if (!IsInGuild(mobRoot) && IsInnocentTo(from, mobRoot)) { from.CriminalAction(false); } } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(from)) { from.CriminalAction(false); } //Flagging and Permagrey if (root is Mobile && ((Mobile)root).Player && from is PlayerMobile && IsInnocentTo(from, (Mobile)root) && !IsInGuild((Mobile)root) && turnPermaGrey) { PlayerMobile pm = (PlayerMobile)from; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } //Move Item: Delay to Allow for Guard Whacking Preventing Theft Timer.DelayCall(TimeSpan.FromSeconds(.1), delegate { if (!SpecialAbilities.Exists(from)) { return; } if (from.Backpack == null) { return; } if (stolenItem == null) { return; } if (stolenItem.Deleted) { return; } if (stolenItem.Stackable && stolenItem.Amount > 1) { if (amountStolen >= stolenItem.Amount) { from.AddToBackpack(stolenItem); if (!(stolenItem is Container || stolenItem.Stackable)) { StolenItem.Add(stolenItem, from, root as Mobile); } from.SendMessage("You successfully steal the item."); } else { Item newItem = Mobile.LiftItemDupe(stolenItem, stolenItem.Amount - amountStolen); from.AddToBackpack(newItem); if (!(newItem is Container || newItem.Stackable)) { StolenItem.Add(newItem, from, root as Mobile); } from.SendMessage("You successfully steal the item."); } } else { from.AddToBackpack(stolenItem); if (!(stolenItem is Container || stolenItem.Stackable)) { StolenItem.Add(stolenItem, from, root as Mobile); } from.SendMessage("You successfully steal the item."); } }); } else { from.SendMessage("You fail in your stealing attempt."); } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolen = null; object root = null; bool caught = false; if (target is Item) { root = ((Item)target).RootParent; stolen = TryStealItem((Item)target, ref caught); } else if (target is Mobile) { var bc = target as BaseCreature; root = target; if (bc != null && from is PlayerMobile) { if (bc.Controlled || bc.Summoned) { from.SendLocalizedMessage(502708); //You can't steal from this. } if (bc.HasBeenStolen) { from.SendLocalizedMessage(1094948); //That creature has already been stolen from. There is nothing left to steal. } else { from.SendLocalizedMessage(1010579); // You reach into the backpack... and try to take something. Engines.CreatureStealing.StealingHandler.HandleSteal(bc, (PlayerMobile)from, ref stolen); if (stolen == null) { if (!bc.StealPackGenerated) { bc.GenerateLoot(LootStage.Stolen); } StealRandom((Mobile)target, ref caught, ref stolen); } } } else { from.SendLocalizedMessage(1010579); // You reach into the backpack... and try to take something. StealRandom((Mobile)target, ref caught, ref stolen); } } else { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } if (stolen != null) { if (stolen is AddonComponent) { BaseAddon addon = ((AddonComponent)stolen).Addon; from.AddToBackpack(addon.Deed); addon.Delete(); } else { from.AddToBackpack(stolen); } if (!(stolen is Container || stolen.Stackable)) { // do not return stolen containers or stackable items StolenItem.Add(stolen, m_Thief, root as Mobile); } if (target is BaseCreature) { ((BaseCreature)target).HasBeenStolen = true; } } if (caught) { if (root == null) { m_Thief.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot)) { m_Thief.CriminalAction(false); } string message = String.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name); foreach (NetState ns in m_Thief.GetClientsInRange(8)) { if (ns.Mobile != m_Thief) { ns.Mobile.SendMessage(message); } } } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } if (root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild((Mobile)root)) { PlayerMobile pm = (PlayerMobile)m_Thief; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } }
public void PlayerNoto(PlayerMobile pm) { pm.Delta(MobileDelta.Noto); pm.InvalidateProperties(); }
public static void Initialize() { if (!Enabled) { return; } EventSink.Login += OnLogin; EventSink.PlayerDeath += OnPlayerDeath; Server.Commands.CommandSystem.Register("BattleProps", AccessLevel.GameMaster, e => { if (Instance.Battle != null) { e.Mobile.SendGump(new PropertiesGump(e.Mobile, Instance.Battle)); } }); Server.Commands.CommandSystem.Register("ForceStartBattle", AccessLevel.GameMaster, e => { if (Instance.Battle != null && !Instance.Battle.OnGoing) { Instance.Battle.Begin(); } }); Server.Commands.CommandSystem.Register("ExemptCities", AccessLevel.Administrator, e => { e.Mobile.SendGump(new ExemptCitiesGump()); }); Server.Commands.CommandSystem.Register("VvVKick", AccessLevel.GameMaster, e => { e.Mobile.SendMessage("Target the person you'd like to remove from VvV."); e.Mobile.BeginTarget(-1, false, Server.Targeting.TargetFlags.None, (from, targeted) => { if (targeted is PlayerMobile) { PlayerMobile pm = targeted as PlayerMobile; VvVPlayerEntry entry = Instance.GetPlayerEntry <VvVPlayerEntry>(pm); if (entry != null && entry.Active) { pm.PrivateOverheadMessage(MessageType.Regular, 1154, 1155561, pm.NetState); // You are no longer in Vice vs Virtue! entry.Active = false; entry.ResignExpiration = DateTime.MinValue; pm.Delta(MobileDelta.Noto); pm.ValidateEquipment(); from.SendMessage("{0} has been removed from VvV.", pm.Name); pm.SendMessage("You have been removed from VvV."); } else { from.SendMessage("{0} is not an active VvV member.", pm.Name); } } }); }); if (!Instance.HasGenerated) { CreateSilverTraders(); } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolen = null; object root = null; bool caught = false; if (target is Item) { root = ((Item)target).RootParent; stolen = TryStealItem((Item)target, ref caught); } else if (target is Mobile) { Container pack = ((Mobile)target).Backpack; if (pack != null && pack.Items.Count > 0) { int randomIndex = Utility.Random(pack.Items.Count); root = target; stolen = TryStealItem(pack.Items[randomIndex], ref caught); } } else { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } if (stolen != null) { from.AddToBackpack(stolen); StolenItem.Add(stolen, m_Thief, root as Mobile); } if (caught) { if (root == null) { m_Thief.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot)) { m_Thief.CriminalAction(false); } string message = String.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name); foreach (NetState ns in m_Thief.GetClientsInRange(8)) { if (ns.Mobile != m_Thief) { ns.Mobile.SendMessage(message); } } } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } if (root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild((Mobile)root)) { PlayerMobile pm = (PlayerMobile)m_Thief; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolen = null; object root = null; bool caught = false; if (target is Item) { root = ((Item)target).RootParent; if (m_Thief.Map != Map.Felucca && root is BaseCreature && ((BaseCreature)root).ControlMaster != null) { m_Thief.SendLocalizedMessage(1005597); // The creature blocks your attempt to steal. } else { stolen = TryStealItem((Item)target, ref caught); } } else if (target is Mobile) { Container pack = ((Mobile)target).Backpack; if (m_Thief.Map != Map.Felucca && target is BaseCreature && ((BaseCreature)target).ControlMaster != null) { m_Thief.SendLocalizedMessage(1005597); // The creature blocks your attempt to steal. } else if (pack != null && pack.Items.Count > 0) { from.SendLocalizedMessage(1010579); // You reach into the backpack... and try to take something. int randomIndex = Utility.Random(pack.Items.Count); root = target; stolen = TryStealItem((Item)pack.Items[randomIndex], ref caught); } else { from.SendLocalizedMessage(1010578); // You reach into the backpack... but find it's empty. } } else { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } if (stolen != null) { from.AddToBackpack(stolen); StolenItem.Add(stolen, m_Thief, root as Mobile); } if (caught) { if (root == null) { m_Thief.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot)) { m_Thief.CriminalAction(false); } string message = String.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name); foreach (GameClient ns in m_Thief.GetClientsInRange(8)) { if (ns != m_Thief.Client) { ns.Mobile.SendMessage(message); } } } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } if (root is Mobile && ((Mobile)root).IsPlayer && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild((Mobile)root)) { PlayerMobile pm = (PlayerMobile)m_Thief; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolen = null; object root = null; bool caught = false; if (target is Item) { root = ((Item)target).RootParent; stolen = TryStealItem((Item)target, ref caught); } else if (target is Mobile) { Container pack = ((Mobile)target).Backpack; Item hat = from.FindItemOnLayer(Layer.Helm); // Added by OldSalty 6/12/04 from here... if (hat is OrcishKinMask && (target is Orc || target is OrcBomber || target is OrcBrute || target is OrcCaptain || target is OrcishLord || target is OrcishMage)) { AOS.Damage(from, 50, 0, 100, 0, 0, 0); hat.Delete(); from.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head); from.PlaySound(0x307); } // . . . to here if (pack != null && pack.Items.Count > 0) { int randomIndex = Utility.Random(pack.Items.Count); root = target; stolen = TryStealItem((Item)pack.Items[randomIndex], ref caught); } } else { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } if (stolen != null) { from.AddToBackpack(stolen); } if (caught) { if (root == null) { m_Thief.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if ( //!IsInGuild(mobRoot) && //Pix: we don't care if the target's also in the guild... IsInnocentTo(m_Thief, mobRoot)) { m_Thief.CriminalAction(false); } string message = String.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name); IPooledEnumerable eable = m_Thief.GetClientsInRange(8); foreach (NetState ns in eable) { if (ns != m_Thief.NetState) { ns.Mobile.SendMessage(message); } } eable.Free(); } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } if (root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) && //!IsInGuild( (Mobile)root ) && //Pix: we don't care if the target's also in the guild... stolen != null) { PlayerMobile pm = (PlayerMobile)m_Thief; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } //PIX: 11/17/07 - WTF is this? Why did I have this in my code? //if (stolen != null) //{ // if (root is Mobile) // { // ((Mobile)root).AggressiveAction(m_Thief, false); // } //} }
protected override void OnTick() { Item stolen = null; object root = toSteal.RootParent; if (!TryStealItem(toSteal, root, m_Thief)) { if (m_Thief is PlayerMobile) { ((PlayerMobile)m_Thief).EndPlayerAction(); } return; } if (toSteal.Stackable && toSteal.Amount > 1) { int maxAmount; if (toSteal.Weight == 0) { maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / 0.1); } else { maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight); } if (maxAmount < 1) { maxAmount = 1; } else if (maxAmount > toSteal.Amount) { maxAmount = toSteal.Amount; } int amount = Utility.RandomMinMax(1, maxAmount); int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount); pileWeight *= 10; if (pileWeight == 0) { pileWeight = 1; } double minSkill = -(m_Thief.Skills[SkillName.Stealing].Value / 2) + 50; double maxSkill = 100 + (pileWeight * 3); if (amount >= toSteal.Amount) { if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, minSkill, maxSkill)) { stolen = toSteal; } } else { if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, minSkill, maxSkill)) { stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount); if (stolen == null) { stolen = toSteal; } } } } else { double w = toSteal.Weight + toSteal.TotalWeight; int iw = (int)Math.Ceiling(w); iw *= 10; double minSkill = -(m_Thief.Skills[SkillName.Stealing].Value / 2) + 50; double maxSkill = 100 + (iw * 3); if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, minSkill, maxSkill)) { stolen = toSteal; } } bool caught; if (root is Mobile) { Mobile mobRoot = (Mobile)root; caught = ((m_Thief.Skills[SkillName.Stealing].Value + (m_Thief.Dex - mobRoot.Dex) / 3.0) < Utility.Random(150)); } else { caught = ((m_Thief.Skills[SkillName.Stealing].Value + (m_Thief.Dex - 100) / 3.0) < Utility.Random(150)); } if (stolen != null) { // ARTEGORDONMOD // set the taken flag to trigger release from any controlling spawner ItemFlags.SetTaken(stolen, true); // clear the stealable flag so that the item can only be stolen once if it is later locked down. ItemFlags.SetStealable(stolen, false); // release it if it was locked down stolen.Movable = true; m_Thief.AddToBackpack(stolen); StolenItem.Add(stolen, m_Thief, root as Mobile); m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item. } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } if (caught) { if (root == null) { m_Thief.CriminalAction(true); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(true); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot)) { m_Thief.CriminalAction(true); } string message = String.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name); foreach (NetState ns in m_Thief.GetClientsInRange(8)) { if (ns.Mobile == mobRoot) { ns.Mobile.SendAsciiMessage("You notice {0} trying to steal from you.", m_Thief.Name); } else if (ns.Mobile != m_Thief) { ns.Mobile.SendMessage(message); } } } } /* * else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) * { * m_Thief.CriminalAction(true); * }*/ if (root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild((Mobile)root)) { PlayerMobile pm = (PlayerMobile)m_Thief; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } if (m_Thief is PlayerMobile) { ((PlayerMobile)m_Thief).EndPlayerAction(); } }