public static bool TSystem_AllowHarmful(Mobile from, Mobile target) { if (StaticRef != null) { if (StaticRef.Started) { if (StaticRef.IsParticipant(from) || StaticRef.IsParticipant(target)) { if (StaticRef.AreOpponents(from, target)) { return(true); } else { return(false); } } } } #region Dueling System if (DuelCore.Enabled && from != target) { Duel fDuel = DuelCore.FindActiveDuel(from); Duel tDuel = DuelCore.FindActiveDuel(target); if (fDuel != null || tDuel != null) { return(fDuel == tDuel); } } #endregion return(NotorietyHandlers.Mobile_AllowHarmful(from, target)); }
public static bool AllowHarmful(Mobile a, Mobile b) { if (_HarmfulParent == null) { return(NotorietyHandlers.Mobile_AllowHarmful(a, b)); } if (a == null || a.Deleted || b == null || b.Deleted || a == b) { return(_HarmfulParent(a, b)); } if (a is PlayerMobile && b is PlayerMobile) { PlayerMobile x = (PlayerMobile)a, y = (PlayerMobile)b; PvPBattle battleA = AutoPvP.FindBattle(x), battleB = AutoPvP.FindBattle(y); if (battleA == null || battleA.Deleted || battleB == null || battleB.Deleted || battleA != battleB || x == y) { return(_HarmfulParent(x, y)); } var battle = battleA; if (_HarmfulHandlers.ContainsKey(battle) && _HarmfulHandlers[battle] != null) { return(_HarmfulHandlers[battle](x, y)); } } return(_HarmfulParent(a, b)); }
public override void OnSingleClick(Mobile from) { var hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this)); if (ItemID == 0x2006) // Corpse form { from.NetState.SendMessageLocalized( Serial, ItemID, MessageType.Label, hue, 3, 1049318, "", Name ); // the remains of ~1_NAME~ the militia fighter } else { from.NetState.SendMessageLocalized( Serial, ItemID, MessageType.Label, hue, 3, 1049319 ); // the remains of a militia fighter } }
public static int Handle_Notoriety(Mobile from, Mobile target) { if (from is PlayerMobile && target is PlayerMobile) { if (Duel_Config.InADuel((PlayerMobile)from) && Duel_Config.InADuel((PlayerMobile)target)) { if (!Duel_Config.DuelStarted((PlayerMobile)from)) { return(NotorietyHandlers.MobileNotoriety2(from, target)); } if (Duel_Config.IsAlly((PlayerMobile)from, (PlayerMobile)target)) { return(Notoriety.Ally); } if (Duel_Config.IsEnemy((PlayerMobile)from, (PlayerMobile)target)) { return(Notoriety.Enemy); } } else if (Duel_Config.InADuel((PlayerMobile)from) || Duel_Config.InADuel((PlayerMobile)target)) { return(NotorietyHandlers.MobileNotoriety2(from, target)); } } return(NotorietyHandlers.MobileNotoriety2(from, target)); }
public override void OnSingleClick(Mobile from) { var hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this)); if (ItemID == 0x2006) // Corpse form { from.NetState.SendMessageLocalized( Serial, ItemID, MessageType.Label, hue, 3, 1049144, "", Name ); // the remains of ~1_NAME~ the apprentice } else { from.NetState.SendMessageLocalized( Serial, ItemID, MessageType.Label, hue, 3, 1049145 ); // the remains of a wizard's apprentice } }
public static int TSystem_Notoriety(Mobile source, Mobile target) { if (StaticRef != null) { if (StaticRef.Started) { if (StaticRef.IsParticipant(source) || StaticRef.IsParticipant(target)) { if (StaticRef.AreOpponents(source, target)) { return(Notoriety.Enemy); } else if (StaticRef.AreAllies(source, target)) { return(Notoriety.Ally); } else { return(Notoriety.Invulnerable); } } } } return(NotorietyHandlers.MobileNotoriety(source, target)); }
public bool IsCriminalAction(Mobile from) { if (from == m_Owner || from.AccessLevel >= AccessLevel.GameMaster) { return(false); } if (Owner is BaseCreature && !(Owner is Guard) && !(Owner.Body.IsHuman)) { return(false); } Party p = Party.Get(m_Owner); if (p != null && p.Contains(from)) { PartyMemberInfo pmi = p[m_Owner]; if (pmi != null && pmi.CanLoot) { return(false); } } return(NotorietyHandlers.CorpseNotoriety(from, this) == Notoriety.Innocent); }
private static bool PlayerMobile_AllowBenificial(Mobile from, Mobile target) { if (from == null || target == null) { return(NotorietyHandlers.Mobile_AllowBeneficial(from, target)); } ; Duel fromDuel, targetDuel; bool fromInDuel = IsInDuel(from, out fromDuel); bool targetInDuel = IsInDuel(target, out targetDuel); if (fromInDuel && targetInDuel) { if (fromDuel == null || targetDuel == null) { return(NotorietyHandlers.Mobile_AllowBeneficial(from, target)); } return(fromDuel == targetDuel); } else if ((fromInDuel && !targetInDuel) || (targetInDuel && !fromInDuel)) { if (from.Player && target.Player) { return(false); } } return(NotorietyHandlers.Mobile_AllowBeneficial(from, target)); }
public bool IsCriminalAction(Mobile from) { if (from == m_Owner || from.AccessLevel >= AccessLevel.GameMaster) { return(false); } if (!GetFlag(CorpseFlag.LootCriminal)) { return(false); } Party p = Party.Get(m_Owner); if (p != null && p.Contains(from)) { PartyMemberInfo pmi = p[m_Owner]; if (pmi != null && pmi.CanLoot) { return(false); } } return(NotorietyHandlers.CorpseNotoriety(from, this) == Notoriety.Innocent); }
public void GrabItems(bool ignoreNoteriety) { ArrayList items = new ArrayList(); bool rejected = false; bool lootAdded = false; Emote("*Rummages through items on the ground.*"); foreach (Item item in GetItemsInRange(2)) { if (item.Movable) { items.Add(item); } else if (item is Corpse) { // Either criminally loot any corpses or loot only corpses that we have rights to if (ignoreNoteriety || NotorietyHandlers.CorpseNotoriety(this, (Corpse)item) != Notoriety.Innocent) { Emote("*Rummages through items in a corpse.*"); foreach (Item corpseItem in ((Corpse)item).Items) { items.Add(corpseItem); } } } } foreach (Item item in items) { if (!Backpack.CheckHold(this, item, false, true)) { rejected = true; } else { bool isRejected; LRReason reason; NextActionTime = Core.TickCount; Lift(item, item.Amount, out isRejected, out reason); if (!isRejected) { Drop(this, Point3D.Zero); lootAdded = true; } else { rejected = true; } } } if (lootAdded) { PlaySound(0x2E6); //drop gold sound } if (rejected) { Say("I could not pick up all of the items."); } }
public bool IsCriminalAction(Mobile from) { if (from == m_Owner || from.AccessLevel >= AccessLevel.GameMaster) { return(false); } return(NotorietyHandlers.CorpseNotoriety(from, this) == Notoriety.Innocent); }
public override void OnAosSingleClick(Mobile from) { int hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this)); ObjectPropertyList opl = this.PropertyList; if (opl.Header > 0) { from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, opl.Header, Name, opl.HeaderArgs)); } }
public override TimeSpan GetLogoutDelay(Mobile m) { if (m_NoLogoutDelay) { if (m.Aggressors.Count == 0 && m.Aggressed.Count == 0 && !NotorietyHandlers.IsGuardCandidate(m)) { return(TimeSpan.Zero); } } return(base.GetLogoutDelay(m)); }
public override void OnSingleClick(Mobile from) { int hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this)); if (m_CorpseName != null) { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, "", m_CorpseName)); } else if (((Body)this.Amount).IsHuman || (this.Owner != null && this.Owner.Player)) { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, "", String.Format("a corpse of {0}", Name))); } else { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, "", String.Format("remains of {0}", Name))); } }
public static int TSystem_Notoriety(Mobile source, Mobile target) { if (StaticRef != null) { if (StaticRef.Started) { if (StaticRef.IsParticipant(source) || StaticRef.IsParticipant(target)) { if (StaticRef.AreOpponents(source, target)) { return(Notoriety.Enemy); } else if (StaticRef.AreAllies(source, target)) { return(Notoriety.Ally); } else { return(Notoriety.Invulnerable); } } } } #region Dueling System if (DuelCore.Enabled) { Duel fDuel = DuelCore.FindActiveDuel(source); Duel tDuel = DuelCore.FindActiveDuel(target); if (fDuel != null || tDuel != null) { if (fDuel == tDuel) { return(source == target ? Notoriety.Ally : Notoriety.Enemy); } else { return(Notoriety.Invulnerable); } } } #endregion return(NotorietyHandlers.MobileNotoriety(source, target)); }
// Healing Ki // Activate to heal all nearby allies for 1d4 (1 to 4), plus an additional // 1d4 (1 to 4) for every two monk levels. (Does not harm undead) public static void LightCombo(Mobile from) { from.SendMessage(2075, "You execute the maneuver: Healing Ki"); List <Mobile> mobiles = new List <Mobile>(); foreach (Mobile m in from.GetMobilesInRange(4)) { if (m != null) { if (NotorietyHandlers.Mobile_AllowBeneficial(from, m)) { mobiles.Add(m); } } } MonkFists mf = from.FindItemOnLayer(Layer.Gloves) as MonkFists; int amount = 0; if (mf != null) { amount = Utility.Dice(mf.Teir, 3, (3 * mf.Teir)); } else { amount = Utility.Dice(2, 6, 0); } for (int i = 0; i < mobiles.Count; i++) { mobiles[i].FixedParticles(0x3967, 10, 30, 5013, 36, 4, EffectLayer.CenterFeet, 0); mobiles[i].Heal(amount, from); } if (from.Female) { from.PlaySound(0x339); } else { from.PlaySound(0x44B); } }
public override void OnSingleClick(Mobile from) { int hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this)); if (ItemID == 0x2006) // Corpse form { if (m_CorpseName != null) { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, "", m_CorpseName)); } else { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, null, "the corpse of " + Name)); } } else // Bone form { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, null, "the remains of " + Name)); } }
public override void OnSingleClick(Mobile from) { int hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this)); if (ItemID == 0x2006) // Corpse form { if (CorpseName != null) { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, "", CorpseName)); } else { from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name)); } } else // Bone form { from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name)); } }
public override void OnSingleClick(Mobile from) { var hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this)); if (ItemID == 0x2006) // Corpse form { if (m_CorpseName != null) { from.NetState.SendMessage(Serial, ItemID, MessageType.Label, hue, 3, true, null, "", m_CorpseName); } else { from.NetState.SendMessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name); } } else // Bone form { from.NetState.SendMessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name); } }
public static int MobileNotoriety(Mobile a, Mobile b) { if (_NotorietyParent == null) { return(NotorietyHandlers.MobileNotoriety(a, b)); } if (a == null || a.Deleted || b == null || b.Deleted || a == b) { return(_NotorietyParent(a, b)); } if (a is PlayerMobile && b is PlayerMobile) { PlayerMobile x = (PlayerMobile)a, y = (PlayerMobile)b; PvPBattle battleA = AutoPvP.FindBattle(x), battleB = AutoPvP.FindBattle(y); if (battleA == null || battleA.Deleted || battleB == null || battleB.Deleted || battleA != battleB || x == y) { return(_NotorietyParent(x, y)); } var battle = battleA; if (_NameHandlers.ContainsKey(battle) && _NameHandlers[battle] != null) { var val = _NameHandlers[battle](x, y); if (val == Bubble) { val = _NotorietyParent(x, y); } return(val); } } return(_NotorietyParent(a, b)); }
public static bool TSystem_AllowHarmful(Mobile from, Mobile target) { if (StaticRef != null) { if (StaticRef.Started) { if (StaticRef.IsParticipant(from) || StaticRef.IsParticipant(target)) { if (StaticRef.AreOpponents(from, target)) { return(true); } else { return(false); } } } } return(NotorietyHandlers.Mobile_AllowHarmful(from, target)); }
public StuckMenu(Mobile beholder, Mobile beheld, bool markUse) : base(150, 50) { m_Sender = beholder; m_Mobile = beheld; m_MarkUse = markUse; Closable = false; Dragable = false; Disposable = false; AddBackground(0, 0, 300, 175, 2600); AddLabel(50, 20, 0, @"Are you sure that you are"); AddLabel(50, 40, 0, @"physically stuck and you can't"); AddLabel(50, 60, 0, @"continue playing normally?"); StuckMenuEntry[] entries; if (IsInSecondAgeArea(beheld)) { entries = m_T2AEntries; } else { entries = NotorietyHandlers.IsGuardCandidate(beheld) ? m_UnguardedEntries : m_Entries; } AddButton(55, 120, 4005, 4007, 0, GumpButtonType.Reply, 0); AddLabel(90, 120, 0, @"No"); AddLabel(200, 120, 0, @"Yes"); for (int i = 0; i < entries.Length; i++) { StuckMenuEntry entry = entries[i]; AddButton(165, 120 + 35 * i, 4005, 4007, i + 1, GumpButtonType.Reply, 0); } }
private static int Notoriety_HandleNotoriety(Mobile from, Mobile target) { if (from == null || target == null) { return(NotorietyHandlers.MobileNotoriety(from, target)); } Duel fromDuel, targetDuel; bool fromInDuel = IsInDuel(from, out fromDuel); bool targetInDuel = IsInDuel(target, out targetDuel); if (fromInDuel && targetInDuel) { if (fromDuel == null || targetDuel == null) { return(NotorietyHandlers.MobileNotoriety(from, target)); } if (fromDuel == targetDuel) { if (fromDuel.Started) { if ((fromDuel.Attackers.Contains(from) && fromDuel.Attackers.Contains(target)) || (fromDuel.Defenders.Contains(from) && fromDuel.Defenders.Contains(target))) { return(Notoriety.Ally); } else { return(Notoriety.Enemy); } } else { return(NotorietyHandlers.MobileNotoriety(from, target)); } } else { return(Notoriety.Invulnerable); } } else if ((fromInDuel && !targetInDuel) || (!fromInDuel && targetInDuel)) { if (!target.Player || !from.Player) { return(NotorietyHandlers.MobileNotoriety(from, target)); } else if (!(target.Region is GuardedRegion)) { return(NotorietyHandlers.MobileNotoriety(from, target)); } else if ((fromInDuel && fromDuel.Started) || (targetInDuel && targetDuel.Started)) { return(Notoriety.Invulnerable); } else { return(NotorietyHandlers.MobileNotoriety(from, target)); } } else { return(NotorietyHandlers.MobileNotoriety(from, target)); } }
public override TransferMessage ProcessMessage() { ArrayList tmparray = new ArrayList(); Type type = null; // is there a object type restriction? if (ObjectType != null && ObjectType.Length > 0) { //type = Type.GetType(ObjectType); type = SpawnerType.GetType(ObjectType); } if (type != null) { if (type == typeof(Mobile) || type.IsSubclassOf(typeof(Mobile))) { // because this is going to run in a separate thread, need to worry about the world lists // being modified while loooping, so make a copy ArrayList mobilearray = null; mobilearray = new ArrayList(World.Mobiles.Values); if (mobilearray != null) { foreach (Mobile m in mobilearray) { if (m.Map == null || m.Map == Map.Internal) { continue; } bool passed = true; // match map if (m.Map.MapID != SelectedMap && SelectedMap != -1) { passed = false; } // match type if (passed && type != m.GetType() && !m.GetType().IsSubclassOf(type)) { passed = false; } // check filters // apply playermobile filters if (m is PlayerMobile) { PlayerMobile b = (PlayerMobile)m; // AccessLevel restricted? 1=playeronly 2=staffonly 3=counseloronly 4=gmonly 5=seeronly 6=adminonly if (passed && Access > 0) { if (Access == 1 && b.AccessLevel != AccessLevel.Player) { passed = false; } else if (Access == 2 && b.AccessLevel == AccessLevel.Player) { passed = false; } else if (Access == 3 && b.AccessLevel != AccessLevel.Counselor) { passed = false; } else if (Access == 4 && b.AccessLevel != AccessLevel.GameMaster) { passed = false; } else if (Access == 5 && b.AccessLevel != AccessLevel.Seer) { passed = false; } else if (Access == 6 && b.AccessLevel != AccessLevel.Administrator) { passed = false; } } // criminal restricted? 1=innocentonly 2=criminalonly 3=murdereronly if (passed && Criminal > 0) { int noto = NotorietyHandlers.MobileNotoriety(b, b); if (Criminal == 1 && noto != Notoriety.Innocent) { passed = false; } else if (Criminal == 2 && noto != Notoriety.Criminal && noto != Notoriety.Murderer) { passed = false; } else if (Criminal == 3 && noto != Notoriety.Murderer) { passed = false; } } } // apply basecreature filters if (m is BaseCreature) { BaseCreature b = (BaseCreature)m; // controlled restricted? 1=controlledonly 2=notcontrolled if (passed && Controlled > 0) { if (Controlled == 1 && !b.Controled) { passed = false; } else if (Controlled == 2 && b.Controled) { passed = false; } } // innocent restricted? 1=innocentonly 2=invulnerable 3=attackable if (passed && Innocent > 0) { int noto = NotorietyHandlers.MobileNotoriety(b, b); if (Innocent == 1 && noto != Notoriety.Innocent) { passed = false; } else if (Innocent == 2 && noto != Notoriety.Invulnerable) { passed = false; } else if (Innocent == 3 && noto != Notoriety.CanBeAttacked) { passed = false; } } } // add it to the array if it passed all the tests if (passed) { tmparray.Add(m); } } } } else if (type == typeof(Item) || type.IsSubclassOf(typeof(Item))) { ArrayList itemarray = null; itemarray = new ArrayList(World.Items.Values); if (itemarray != null) { foreach (Item m in itemarray) { if (m.Map == null || m.Map == Map.Internal) { continue; } bool passed = true; if (m.Map.MapID != SelectedMap && SelectedMap != -1) { passed = false; } if (passed && type != m.GetType() && !m.GetType().IsSubclassOf(type)) { passed = false; } // movable restricted? 1=movableonly 2=not movable only if (passed && Movable > 0) { if (Movable == 1 && !m.Movable) { passed = false; } else if (Movable == 2 && m.Movable) { passed = false; } } // visible restricted? 1=visibleonly 2=not visible only if (passed && Visible > 0) { if (Visible == 1 && !m.Visible) { passed = false; } else if (Visible == 2 && m.Visible) { passed = false; } } // blessed restricted? 1=blessedonly 2=notblessed if (passed && Blessed > 0) { if (Blessed == 1 && m.LootType != LootType.Blessed) { passed = false; } else if (Blessed == 2 && m.LootType == LootType.Blessed) { passed = false; } } // static restricted? 1=staticsonly 2=no statics if (passed && Statics > 0) { if (Statics == 1 && !(m is Static)) { passed = false; } else if (Statics == 2 && m is Static) { passed = false; } } // container restricted? 1=incontaineronly 2=not in containers if (passed && InContainers > 0) { if (InContainers == 1 && !(m.Parent is Container)) { passed = false; } else if (InContainers == 2 && m.Parent is Container) { passed = false; } } // carried by mobiles restricted? 1=carriedonly 2=not carried if (passed && Carried > 0) { if (Carried == 1 && !(m.RootParent is Mobile)) { passed = false; } else if (Carried == 2 && m.RootParent is Mobile) { passed = false; } } // itemid restricted? if (passed && ItemID >= 0 && ItemID != m.ItemID) { passed = false; } if (passed) { tmparray.Add(m); } } } } } ObjectData [] objectlist = new ObjectData[tmparray.Count]; for (int i = 0; i < tmparray.Count; i++) { if (tmparray[i] is Mobile) { Mobile m = tmparray[i] as Mobile; string name = m.Name; if (name == null) { name = m.GetType().Name; } // append a title if they have one if (m.Title != null) { name += " " + m.Title; } // fill the return data array objectlist[i] = new ObjectData((short)m.Location.X, (short)m.Location.Y, (byte)m.Map.MapID, name); } else if (tmparray[i] is Item) { Item m = tmparray[i] as Item; // fill the return data array string name = m.Name; if (name == null) { name = m.GetType().Name; } short x = (short)m.Location.X; short y = (short)m.Location.Y; if (m.RootParent is Mobile) { x = (short)((Mobile)m.RootParent).Location.X; y = (short)((Mobile)m.RootParent).Location.Y; } else if (m.RootParent is Container) { x = (short)((Container)m.RootParent).Location.X; y = (short)((Container)m.RootParent).Location.Y; } objectlist[i] = new ObjectData(x, y, (byte)m.Map.MapID, name); } } return(new ReturnObjectData(objectlist)); }
public static int Handle_Notoriety(Mobile from, Mobile target) { //BaseCreature targetPet = null; //BaseCreature fromPet = null; if (from is PlayerMobile && target is PlayerMobile) { if (Field_Config.InAField((PlayerMobile)from) && Field_Config.InAField((PlayerMobile)target)) { if (!Field_Config.FieldStarted((PlayerMobile)from)) { return(NotorietyHandlers.MobileNotoriety2(from, target)); } if (Field_Config.IsAlly((PlayerMobile)from, (PlayerMobile)target)) { return(Notoriety.Ally); } if (Field_Config.IsEnemy((PlayerMobile)from, (PlayerMobile)target)) { return(Notoriety.Enemy); } } else if (Field_Config.InAField((PlayerMobile)from) || Field_Config.InAField((PlayerMobile)target)) { return(NotorietyHandlers.MobileNotoriety2(from, target)); } } else if (from is PlayerMobile && target is BaseCreature) { BaseCreature targetPet = (BaseCreature)target; if (Field_Config.InAField((PlayerMobile)from) && Field_Config.InAField((PlayerMobile)targetPet.ControlMaster) && targetPet.Controlled) { if (!Field_Config.FieldStarted((PlayerMobile)from)) { return(NotorietyHandlers.MobileNotoriety2(from, target)); } if (Field_Config.IsAlly((PlayerMobile)from, (PlayerMobile)targetPet.ControlMaster)) { return(Notoriety.Ally); } if (Field_Config.IsEnemy((PlayerMobile)from, (PlayerMobile)targetPet.ControlMaster)) { return(Notoriety.Enemy); } } } else if (from is BaseCreature && target is PlayerMobile) { BaseCreature fromPet = (BaseCreature)from; if (Field_Config.InAField((PlayerMobile)fromPet.ControlMaster) && Field_Config.InAField((PlayerMobile)target) && fromPet.Controlled) { if (!Field_Config.FieldStarted((PlayerMobile)fromPet.ControlMaster)) { return(NotorietyHandlers.MobileNotoriety2(from, target)); } if (Field_Config.IsAlly((PlayerMobile)fromPet.ControlMaster, (PlayerMobile)target)) { return(Notoriety.Ally); } if (Field_Config.IsEnemy((PlayerMobile)fromPet.ControlMaster, (PlayerMobile)target)) { return(Notoriety.Enemy); } } } else if (from is BaseCreature && target is BaseCreature) { BaseCreature fromPet = (BaseCreature)from; BaseCreature targetPet = (BaseCreature)target; if (Field_Config.InAField((PlayerMobile)fromPet.ControlMaster) && Field_Config.InAField((PlayerMobile)targetPet.ControlMaster) && fromPet.Controlled && targetPet.Controlled) { if (!Field_Config.FieldStarted((PlayerMobile)fromPet.ControlMaster)) { return(NotorietyHandlers.MobileNotoriety2(from, target)); } if (Field_Config.IsAlly((PlayerMobile)fromPet.ControlMaster, (PlayerMobile)targetPet.ControlMaster)) { return(Notoriety.Ally); } if (Field_Config.IsEnemy((PlayerMobile)fromPet.ControlMaster, (PlayerMobile)targetPet.ControlMaster)) { return(Notoriety.Enemy); } } } return(NotorietyHandlers.MobileNotoriety2(from, target)); }
protected override void OnTick() { m_Count++; m_BoostCount++; bool releaseLock = false; double chance = (m_From.Skills[SkillName.Meditation].Base - 5.0) / 100; if (m_From.Alive) { if (m_From.Mana >= m_From.ManaMax) { m_From.SendLocalizedMessage(501846); // You are at peace. releaseLock = true; } else if (m_From.Combatant != null || m_From.Warmode || (m_From is PlayerMobile && (((PlayerMobile)m_From).LastAttackTime + TimeSpan.FromSeconds(5.0)) >= DateTime.Now)) { m_From.SendAsciiMessage("You are preoccupied with thoughts of battle."); releaseLock = true; } else { if (m_From.Location != m_Location) { m_BoostCount = 0; m_Location = m_From.Location; chance -= 0.1; } if (m_Count / 2 >= m_Delay) { m_From.CheckSkill(SkillName.Meditation, 0.0, 100.0); m_Count = 0; int range = Math.Min((int)((100 - m_From.Skills[SkillName.Meditation].Value) / 2) + 10, 18); if (chance < 0.05) { chance = 0.05; } bool badCombat = (m_From.Combatant != null && m_From.InRange(m_From.Combatant.Location, range) && m_From.Combatant.InLOS(m_From)); bool ok = (!badCombat && chance > Utility.RandomDouble()); if (ok) { foreach (Mobile m in m_From.GetMobilesInRange(range)) { if (m.InLOS(m_From) && m.Combatant == m_From) { badCombat = true; break; } if (m is BaseCreature && NotorietyHandlers.IsGuardCandidate(m)) { m_BoostCount = 0; break; } } } if (badCombat) { m_From.SendAsciiMessage("You are preoccupied with thoughts of battle."); releaseLock = true; } if (!ok) { m_From.SendLocalizedMessage(501850); // You cannot focus your concentration. releaseLock = true; } if (ok && m_FirstUse) { m_From.SendLocalizedMessage(501851); // You enter a meditative trance. m_FirstUse = false; if (m_From.Player) { m_From.PlaySound(0xF9); } } } if (!releaseLock) { m_From.Warmode = false; m_From.PlaySound(0xF9); int toBoost; m_Boosted += (chance * Utility.RandomMinMax(1, 5)) / 6; if (m_BoostCount < 10) { m_Boosted /= 1.3; } if (m_Boosted >= 1) { toBoost = (int)Math.Floor(m_Boosted); m_Boosted -= Math.Floor(m_Boosted); if (m_From.Mana + toBoost > m_From.ManaMax) { m_From.Mana = m_From.ManaMax; } else { m_From.Mana += toBoost; } } } } if (releaseLock) { if (m_From is PlayerMobile) { ((PlayerMobile)m_From).EndPlayerAction(); } Stop(); } } }
public override void OnSingleClick(Mobile from) { int hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this)); from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, "", "a charred corpse")); }
public static void EventSink_PlayerDeath(PlayerDeathEventArgs e) { Mobile killed = e.Mobile; Mobile killer = e.Mobile.LastKiller; //Ignore non-players if (!(killed is PlayerMobile)) { return; } //Ignore players in events if ((killed).IsInEvent || ((killer != null) && killer.IsInEvent)) { return; } //Ignore players in a NoFameLoss region if (killed.Region is CustomRegion) { CustomRegion cR = (CustomRegion)killed.Region; if (cR.Controller.NoFameLoss) { return; } } //Remove 1/10th of the fame when a player dies killed.Fame -= (killed.Fame / 10); if (killer == null || killer.Combatant != killed) { return; } if (!killer.InRange(killed.Location, 15)) { return; } int n = Notoriety.Compute(killer, killed); bool innocent = (n == Notoriety.Innocent); bool faction = (n == Notoriety.Enemy || n == Notoriety.Ally); bool criminal = (n == Notoriety.Criminal || n == Notoriety.Murderer); int fameAward = killed.Fame / 10; int karmaAward = -killed.Karma / 10; if (innocent && karmaAward > 0) { karmaAward = -(karmaAward); } else if (criminal && karmaAward < 0) { karmaAward = -(karmaAward); } //Reward the killer karma only if he attacked first and it's not a faction kill if (!faction && (NotorietyHandlers.CheckAggressor(killed.Aggressors, killer) || NotorietyHandlers.CheckAggressed(killed.Aggressors, killer))) { Titles.AwardKarma(killer, karmaAward, true); } Titles.AwardFame(killer, fameAward, true); if (innocent) { ++killer.Kills; if (killer.Kills == 5) { killer.SendLocalizedMessage(502134); //You are now known as a murderer! } } else if (Stealing.SuspendOnMurder && killer.Kills >= 1 && killer is PlayerMobile && ((PlayerMobile)killer).NpcGuild == NpcGuild.ThievesGuild) { killer.SendLocalizedMessage(501562); // You have been suspended by the Thieves Guild. } }
public override bool DoActionCombat() { Mobile c = m_Mobile.Combatant; m_Mobile.Warmode = true; if (c == null || c.Deleted || !c.Alive || !m_Mobile.CanSee(c) || !m_Mobile.CanBeHarmful(c, false) || c.Map != m_Mobile.Map) { // Our combatant is deleted, dead, hidden, or we cannot hurt them // Try to find another combatant if (AquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.DebugSay("Something happened to my combatant, so I am going to fight {0}", m_Mobile.FocusMob.Name); m_Mobile.Combatant = c = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } else { m_Mobile.DebugSay("Something happened to my combatant, and nothing is around. I am on guard."); Action = ActionType.Wander; return(true); } } if (!m_Mobile.InLOS(c)) { if (AquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.Combatant = c = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } } if (!m_Mobile.InRange(c, m_Mobile.RangePerception)) { // They are somewhat far away, can we find something else? if (AquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.Combatant = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } else if (!m_Mobile.InRange(c, m_Mobile.RangePerception * 3)) { m_Mobile.Combatant = null; } c = m_Mobile.Combatant; if (c == null) { m_Mobile.DebugSay("My combatant has fled, so I am on guard"); Action = ActionType.Wander; return(true); } } if (m_Mobile.CheckFlee() && TeleHides > 0) { m_Mobile.DebugSay("I am going to flee from {0}", c.Name); Action = ActionType.Flee; return(true); } if (m_Mobile.Spell == null && DateTime.Now > m_NextCastTime && m_Mobile.InRange(c, 12)) { // We are ready to cast a spell if (c.Combatant != m_Mobile) { DamageEntry de = m_Mobile.FindDamageEntryFor(c); if (de == null || de.HasExpired) { de = c.FindDamageEntryFor(m_Mobile); if ((de == null || de.HasExpired)) { if (!NotorietyHandlers.CheckAggressor(m_Mobile.Aggressors, c) && !NotorietyHandlers.CheckAggressed(c.Aggressed, m_Mobile)) { // we cant cast because the player didnt hit us yet RunTo(c); return(true); } } } } Spell spell = null; Mobile toDispel = FindDispelTarget(true); if (m_Combo != -1) // We are doing a spell combo { spell = DoCombo(c); } else { spell = GetRandomDamageSpell(toDispel != null); } // Now we have a spell picked // Move first before casting if (toDispel != null) { if (m_Mobile.InRange(toDispel, 5)) { RunFrom(toDispel); } else if (!m_Mobile.InRange(toDispel, 11)) { RunTo(toDispel); } } else { RunTo(c); } if (spell != null && spell.Cast()) { TimeSpan delay; if (spell is DispelSpell) { delay = TimeSpan.FromSeconds(m_Mobile.ActiveSpeed); } else { delay = spell.GetCastDelay() + TimeSpan.FromSeconds(Utility.Random(3)); } m_NextCastTime = DateTime.Now + delay; } } else if (m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting) { RunTo(c); } return(true); }
public bool CheckLoot(Mobile from) { Map map = this.Map; if (!CanLoot(from)) { if (m_Owner == null || !m_Owner.Player) { from.SendLocalizedMessage(1005035); // You did not earn the right to loot this creature! } else { from.SendLocalizedMessage(1010049); // You may not loot this corpse. } return(false); } else if (IsCriminalAction(from)) { if (m_Owner == null || !m_Owner.Player) { from.SendLocalizedMessage(1005036); // Looting this monster corpse will be a criminal act! } else { from.SendLocalizedMessage(1005038); // Looting this corpse will be a criminal act! } } else if ((map == null || (map.Rules & MapRules.HarmfulRestrictions) != 0) && m_Owner.Player && NotorietyHandlers.CorpseNotoriety(from, this) == Notoriety.Criminal) { // Really it's not possible to become criminal in trammel/ilshenar/malas at all, but there're some bugs that allow this // So we need to prevent looting from criminal corpses // TODO: When criminals will be completely fixed remove this from.SendLocalizedMessage(1010049); // You may not loot this corpse. return(false); } return(true); }