public void Return(PlayerMobile defender) { if (Team == null || Team.Deleted) { Delete(); return; } if (defender == null || defender.Deleted) { return; } if (Team.FlagPodium != null && !Team.FlagPodium.Deleted) { MoveToWorld(Team.FlagPodium.Location.Clone3D(0, 0, Team.FlagPodium.ItemData.Height + 5), Team.FlagPodium.Map); } else { MoveToWorld(Team.HomeBase, Team.Battle.Options.Locations.Map); } NextAssault = DateTime.UtcNow; Conquests.CheckProgress <ItemConquest>(defender, this, "return"); DamageInc = 0; Team.OnFlagReturned(defender); InvalidateCarrier(); }
public void Capture(PlayerMobile attacker) { if (Team == null || Team.Deleted || Team.Battle == null || Team.Battle.Deleted) { Delete(); return; } if (attacker == null || attacker.Deleted) { return; } Team.OnFlagCaptured(attacker, GetEnemyTeam(attacker)); InvalidateCarrier(); DamageInc = 0; Conquests.CheckProgress <ItemConquest>(attacker, this, "capture"); Delete(); var team = Team.Battle.FindTeam <UOF_CTFTeam>(attacker); if (team != null) { attacker.SolidHueOverride = team.Color; } }
public override void OnItemAdded(Item item) { base.OnItemAdded(item); if (item.RootParent is PlayerMobile) { Conquests.CheckProgress <ObtainConquest>((PlayerMobile)item.RootParent, item); } }
public void Target(Mobile m) { if (!Caster.CanSee(m)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (m == Caster) { Caster.SendLocalizedMessage(501039); // Thou can not resurrect thyself. } else if (!Caster.Alive) { Caster.SendLocalizedMessage(501040); // The resurrecter must be alive. } else if (m.Alive) { Caster.SendLocalizedMessage(501041); // Target is not dead. } else if (!Caster.InRange(m, 3)) { Caster.SendLocalizedMessage(501042); // Target is not close enough. } else if (!m.Player) { Caster.SendLocalizedMessage(501043); // Target is not a being. } else if (m.Map == null || !m.Map.CanFit(m.Location, 16, false, false)) { Caster.SendLocalizedMessage(501042); // Target can not be resurrected at that location. m.SendLocalizedMessage(502391); // Thou can not be resurrected there! } else if (m.Region != null && m.Region.IsPartOf("Khaldun")) { Caster.SendLocalizedMessage(1010395); // The veil of death in this area is too strong and resists thy efforts to restore life. } else if (CheckBSequence(m, true)) { SpellHelper.Turn(Caster, m); m.PlaySound(0x214); m.FixedEffect(0x376A, 10, 16); m.CloseGump(typeof(ResurrectGump)); /*PlayerMobile pres = m as PlayerMobile; * * if (pres.MurderBounty > 0) * m.SendGump( new ResurrectGump( m, Caster, pres.MurderBounty ) ); * else*/ m.SendGump(new ResurrectGump(m, Caster)); Conquests.CheckProgress <ResConquest>(Caster as PlayerMobile, m); } FinishSequence(); }
public override void OnMemberDeath(PlayerMobile pm) { base.OnMemberDeath(pm); var pk = pm.GetLastKiller <PlayerMobile>(true); if (pk != null) { Conquests.CheckProgress <BattleKillConquest>(pk, pm); } }
public void Steal(PlayerMobile attacker) { if (Team == null || Team.Deleted || Team.Battle == null || Team.Battle.Deleted) { Delete(); return; } if (attacker == null || attacker.Deleted || attacker == _Carrier || attacker.Backpack == null || attacker.Backpack.Deleted) { return; } if (NextAssault > DateTime.UtcNow) { attacker.SendMessage( 54, "This flag cannot be picked up for another {0} seconds.", (NextAssault - DateTime.UtcNow).Seconds); return; } Item flag = attacker.Backpack.FindItemByType <UOF_CTFFlag>(); if (flag != null) { attacker.SendMessage("You may only carry one flag at any given time!"); return; } if (!attacker.Backpack.TryDropItem(attacker, this, true)) { return; } _Carrier = attacker; attacker.SolidHueOverride = 2498; Conquests.CheckProgress <ItemConquest>(attacker, this, "assault"); Team.OnFlagStolen(attacker, GetEnemyTeam(attacker)); InvalidateCarrier(); }
public virtual bool Eat(Mobile from) { int oldHunger = from.Hunger; // Fill the Mobile with FillFactor if (CheckHunger(from)) { // Play a random "eat" sound from.PlaySound(Utility.Random(0x3A, 3)); if (from.Body.IsHuman && !from.Mounted) { from.Animate(34, 5, 1, true, false, 0); } if (m_Poison != null) { from.ApplyPoison(m_Poisoner, m_Poison); } //EventSink.InvokeOnConsume(new OnConsumeEventArgs(from, this, from.Hunger - oldHunger)); if (from is PlayerMobile) { Conquests.CheckProgress <ItemConquest>((PlayerMobile)from, this, from.Hunger - oldHunger); //CheckProgress<ConsumeItemConquest>((PlayerMobile)e.Consumer, e); } Consume(); return(true); } return(false); }
public override bool OnDragDrop(Mobile from, Item dropped) { // trigger returns true if returnoverride if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) && UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, dropped)) { return(true); } bool bReturn = false; if (dropped is Head2) { var h = (Head2)dropped; if (h.Player == null || h.Player.Deleted) { Say("This belonged to a nobody!"); h.Delete(); return(true); } if (h.Player != null) { Mobile mob = h.Player; from.CloseGump(typeof(HeadNegotiateGump)); mob.CloseGump(typeof(HeadOwnerListGump)); if (mob.Kills >= 5 && !h.Expired) { if (!h.Player.InStat) { LoggingCustom.Log("MurdererNegotiate.txt", DateTime.Now + "\t" + mob + "\t" + "STATTED by " + from.Name); if (CentralGump.EnsureProfile(mob as PlayerMobile).BuyHead) { if (PendingStatloss == null) { PendingStatloss = new List <HeadTurnInObj>(); } if (PendingStatlossTimer == null || !PendingStatlossTimer.Running) { PendingStatlossTimer = new InternalTimer(); PendingStatlossTimer.Start(); } if (!PendingStatloss.Exists(x => x.HeadOwner == mob as PlayerMobile)) { var headobject = new HeadTurnInObj(DateTime.UtcNow + TimeSpan.FromMinutes(5), from as PlayerMobile, mob as PlayerMobile); PendingStatloss.Add(headobject); Conquests.CheckProgress <ItemConquest>(from as PlayerMobile, h, "turnin"); bReturn = true; h.Delete(); } else { from.SendMessage(61, "This player is currently pending statloss. Try to turn the head in again in 5 minutes."); } } else { Conquests.CheckProgress <ItemConquest>(from as PlayerMobile, h, "turnin"); bReturn = true; BeginSkillLoss(mob); h.Delete(); } if (mob.Kills <= 10) { Say("My thanks for slaying this vile person."); } if (mob.Kills > 10 && mob.Kills < 25) { Say("Thank you for ridding Brittania of this evil fiend."); } if (mob.Kills >= 25) { Say("Thank you for destroying " + mob.Name + ", Britannia is a much safer place with that scum gone."); } } else //Owner of head is currently in statloss { Say("Begone. This murderer has already met justice!"); Say("I'll take that head, you just run along now."); bReturn = true; h.Delete(); } } else if (h.Expired) //if head is decayed, set to true and change hue { Say("Why are you trying to give me this decayed piece of trash?"); h.Expire(); } else { Say("You disgusting miscreant! Why are you giving me an innocent person's head?"); } } else { Say("I suspect treachery...."); Say("I'll take that head, you just run along now."); bReturn = true; h.Delete(); } } return(bReturn); }
public virtual bool OnDrink(Mobile from) { if (from == null || from.Deleted) { return(false); } int oldThirst = from.Thirst; from.PlaySound(Utility.RandomList(0x30, 0x2D6)); if (from.Stam < from.StamMax) { from.Stam += Utility.Random(2, 4); //restore some stamina } if (ContainsAlchohol) { from.Thirst = Math.Max(0, Math.Min(20, from.Thirst + _Quantity)); from.SendMessage("You feel more thirsty from drinking the alcoholic beverage."); CheckBAC(from, _Quantity); CheckHeaveTimer(from); } else { from.Thirst = Math.Max(0, Math.Min(20, from.Thirst - _Quantity)); if (from.Thirst > 15) { from.SendMessage("You drink the beverage, but are still extremely thirsty."); } else if (from.Thirst > 10) { from.SendMessage("You drink the beverage and begin to feel more satiated."); } else if (from.Thirst > 5) { from.SendMessage("After drinking the beverage, you feel much less thirsty."); } else if (from.Thirst > 0) { from.SendMessage("You feel quite full after drinking the beverage."); } else { from.SendMessage("You manage to drink the beverage, but are stuffed!"); } } //EventSink.InvokeOnConsume(new OnConsumeEventArgs(from, this, from.Thirst - oldThirst)); if (from is PlayerMobile) { Conquests.CheckProgress <ItemConquest>((PlayerMobile)from, this); //CheckProgress<ConsumeItemConquest>((PlayerMobile)e.Consumer, e); } ApplyPoison(from); return(true); }
public override bool Eat(Mobile from) { int oldHunger = from.Hunger; // Fill the Mobile with FillFactor if (CheckHunger(from)) { if (Owner != null) { if (Owner.RawInt > from.RawInt) { from.PrivateOverheadMessage( MessageType.Label, 54, true, "Yup, you definitely feel smarter after eating " + Owner.Name + "'s brain.", from.NetState); //SpellHelper.AddStatBonus(from, from, StatType.Int, true); } else if (Owner.RawInt == from.RawInt) { from.PrivateOverheadMessage( MessageType.Label, 54, true, "You don't feel any different after eating " + Owner.Name + "'s brain.", from.NetState); } else if (Owner.RawInt < from.RawInt) { from.PrivateOverheadMessage( MessageType.Label, 54, true, "You're pretty sure eating " + Owner.Name + "'s brain has made you not smart so good anymore.", from.NetState); //SpellHelper.AddStatCurse(from, from, StatType.Int, false); } } // Play a random "eat" sound from.PlaySound(Utility.Random(0x3A, 3)); if (from.Body.IsHuman && !from.Mounted) { from.Animate(34, 5, 1, true, false, 0); } if (Poison != null) { from.ApplyPoison(Poisoner, Poison); } //EventSink.InvokeOnConsume(new OnConsumeEventArgs(from, this, from.Hunger - oldHunger)); if (from is PlayerMobile) { Conquests.CheckProgress <ItemConquest>((PlayerMobile)from, this, from.Hunger - oldHunger); //CheckProgress<ConsumeItemConquest>((PlayerMobile)e.Consumer, e); } Consume(); return(true); } return(false); }
protected override void OnTick() { m_Count++; DamageEntry de = m_Creature.FindMostRecentDamageEntry(false); bool alreadyOwned = m_Creature.Owners.Contains(m_Tamer); if (!m_Tamer.InRange(m_Creature, m_Creature.EraAOS ? 7 : 6)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502795, m_Tamer.NetState); // You are too far away to continue taming. Stop(); } else if (!m_Tamer.CheckAlive()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502796, m_Tamer.NetState); // You are dead, and cannot continue taming. Stop(); } else if (!m_Tamer.CanSee(m_Creature) || !m_Tamer.InLOS(m_Creature) || !CanPath()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Tamer.SendLocalizedMessage(1049654); // You do not have a clear path to the animal you are taming, and must cease your attempt. Stop(); } else if (!m_Creature.Tamable) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, m_Tamer.NetState); // That creature cannot be tamed. Stop(); } else if (m_Creature.Controlled) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, m_Tamer.NetState); // That animal looks tame already. Stop(); } else if (m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains(m_Tamer)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, m_Tamer.NetState); // This animal has had too many owners and is too upset for you to tame. Stop(); } else if (MustBeSubdued(m_Creature)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, m_Tamer.NetState); // You must subdue this creature before you can tame it! Stop(); } else if (de != null && de.LastDamage > m_StartTime) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502794, m_Tamer.NetState); // The animal is too angry to continue taming. Stop(); } else if (m_Count < m_MaxCount) { m_Tamer.RevealingAction(); switch (Utility.Random(3)) { case 0: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(502790, 4)); break; case 1: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1005608, 6)); break; case 2: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1010593, 4)); break; } if (!alreadyOwned) // Passively check animal lore for gain { m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } if (m_Creature.Paralyzed) { m_Paralyzed = true; } } else { Skill tskill = m_Tamer.Skills[SkillName.AnimalLore]; Conquests.CheckProgress <SkillConquest>(m_Tamer as PlayerMobile, tskill); tskill = m_Tamer.Skills[SkillName.AnimalTaming]; Conquests.CheckProgress <SkillConquest>(m_Tamer as PlayerMobile, tskill); m_Tamer.RevealingAction(); m_Tamer.NextSkillTime = DateTime.UtcNow; m_BeingTamed.Remove(m_Creature); if (m_Creature.Paralyzed) { m_Paralyzed = true; } if (!alreadyOwned) // Passively check animal lore for gain { m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } double minSkill = m_Creature.MinTameSkill + (m_Creature.Owners.Count * 6.0); if (minSkill > -24.9 && CheckMastery(m_Tamer, m_Creature)) { minSkill = -24.9; // 50% at 0.0? } minSkill += 24.9; if (CheckMastery(m_Tamer, m_Creature) || alreadyOwned || m_Tamer.CheckTargetSkill(SkillName.AnimalTaming, m_Creature, minSkill - 25.0, minSkill + 25.0)) { if (m_Creature.Owners.Count == 0) // First tame { if (m_Creature is GreaterDragon) { ScaleSkills(m_Creature, 0.72, 0.90); // 72% of original skills trainable to 90% m_Creature.Skills[SkillName.Magery].Base = m_Creature.Skills[SkillName.Magery].Cap; // Greater dragons have a 90% cap reduction and 90% skill reduction on magery } else if (m_Paralyzed) { ScaleSkills(m_Creature, 0.86); // 86% of original skills if they were paralyzed during the taming } else { ScaleSkills(m_Creature, 0.90); // 90% of original skills } if (m_Creature.StatLossAfterTame) { ScaleStats(m_Creature, 0.50); } } if (alreadyOwned) { m_Tamer.SendLocalizedMessage(502797); // That wasn't even challenging. } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502799, m_Tamer.NetState); // It seems to accept you as master. m_Creature.Owners.Add(m_Tamer); } m_Creature.SetControlMaster(m_Tamer); m_Creature.IsBonded = false; m_Creature.Combatant = null; m_Creature.Warmode = false; if (!alreadyOwned) { Conquests.CheckProgress <CreatureTamingConquest>(m_Tamer as PlayerMobile, m_Creature); } Conquests.CheckProgress <ObtainConquest>(m_Tamer as PlayerMobile, m_Creature); m_Creature.ControlOrder = OrderType.Follow; m_Creature.ControlTarget = m_Tamer; DiscordanceInfo info = Discordance.GetDiscord(m_Creature); if (info != null && info.From == m_Tamer) { info.Ending = true; info.EndTime = DateTime.UtcNow + TimeSpan.FromSeconds(15); } } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502798, m_Tamer.NetState); // You fail to tame the creature. } } }
private void Sigil_OnTarget(Mobile from, object obj) { if (Deleted || !IsChildOf(from.Backpack)) { return; } #region Give To Mobile if (obj is Mobile) { if (obj is PlayerMobile) { PlayerMobile targ = (PlayerMobile)obj; Faction toFaction = Faction.Find(targ); Faction fromFaction = Faction.Find(from); if (toFaction == null) { from.SendLocalizedMessage(1005223); // You cannot give the sigil to someone not in a faction } else if (fromFaction != toFaction) { from.SendLocalizedMessage(1005222); // You cannot give the sigil to someone not in your faction } else if (Sigil.ExistsOn(targ)) { from.SendLocalizedMessage(1005220); // You cannot give this sigil to someone who already has a sigil } else if (!targ.Alive) { from.SendLocalizedMessage(1042248); // You cannot give a sigil to a dead person. } else if (!from.InRange(targ, 1)) { from.SendLocalizedMessage(1042249); // Your arms aren't long enough to give them the sigil from this distance. } else if (targ.Region.IsPartOf(typeof(HouseRegion))) { from.SendLocalizedMessage(1042243); // A strong magical energy prevents you from giving them the sigil. } else if (from.NetState != null && targ.NetState != null) { Container pack = targ.Backpack; if (pack != null) { pack.DropItem(this); } } } else { from.SendLocalizedMessage(1005221); //You cannot give the sigil to them } } #endregion else if (obj is BaseMonolith) { #region Put in Stronghold if (obj is StrongholdMonolith) { StrongholdMonolith m = (StrongholdMonolith)obj; if (m.Faction == null || m.Faction != Faction.Find(from)) { from.SendLocalizedMessage(1042246); // You can't place that on an enemy monolith } else if (m.Town == null || m.Town != m_Town) { from.SendLocalizedMessage(1042247); // That is not the correct faction monolith } else { m.Sigil = this; Faction newController = m.Faction; Faction oldController = m_Corrupting; if (oldController == null) { if (m_Corrupted != newController) { BeginCorrupting(newController); } } else if (m_GraceStart > DateTime.MinValue && (m_GraceStart + CorruptionGrace) < DateTime.UtcNow) { if (m_Corrupted != newController) { BeginCorrupting(newController); // grace time over, reset period } else { ClearCorrupting(); } m_GraceStart = DateTime.MinValue; } else if (newController == oldController) { m_GraceStart = DateTime.MinValue; // returned within grace period } else if (m_GraceStart == DateTime.MinValue) { m_GraceStart = DateTime.UtcNow; } m_PurificationStart = DateTime.MinValue; } } #endregion #region Put in Town else if (obj is TownMonolith) { TownMonolith m = (TownMonolith)obj; if (m.Town == null || m.Town != m_Town) { from.SendLocalizedMessage(1042245); // This is not the correct town sigil monolith } else if (m_Corrupted == null || m_Corrupted != Faction.Find(from)) { from.SendLocalizedMessage(1042244); // Your faction did not corrupt this sigil. Take it to your stronghold. } else { m.Sigil = this; m_Corrupting = null; m_PurificationStart = DateTime.UtcNow; m_CorruptionStart = DateTime.MinValue; if (from is PlayerMobile) { Conquests.CheckProgress <ItemConquest>((PlayerMobile)from, this); } m_Town.Capture(m_Corrupted); m_Corrupted = null; } } #endregion } else { from.SendLocalizedMessage(1005224); // You can't use the sigil on that } Update(); }
private void Power_OnTarget(Mobile fromMobile, object obj, object state) { var from = state as Player; var to = obj as Mobile; if (to == null) { EthicCaster.Mobile.SendMessage(54, "You must target a dead ally or bonded pet!"); return; } if (!to.Alive && to is PlayerMobile && !(to.Region.IsPartOf(typeof(HouseRegion)))) { to.PlaySound(0x214); to.FixedEffect(0x376A, 10, 16); to.CloseGump(typeof(ResurrectGump)); to.SendGump(new ResurrectGump(to, EthicCaster.Mobile)); } else if (to.IsDeadBondedPet && !(EthicCaster.Mobile.Region.IsPartOf(typeof(HouseRegion)))) { var pet = to as BaseCreature; if (pet != null) { if (pet.Map == null || !pet.Map.CanFit(pet.Location, 16, false, false)) { EthicCaster.Mobile.SendMessage(54, "Target cannot be resurrected at that location."); } if (pet.IsDeadPet) { Mobile master = pet.ControlMaster; if (master != null && EthicCaster.Mobile == master) { pet.ResurrectPet(); foreach (Skill s in pet.Skills) { s.Base -= 0.1; } Conquests.CheckProgress <ResConquest>(master as PlayerMobile, pet); } else if (master != null && master.InRange(pet, 3)) { EthicCaster.Mobile.SendMessage(54, "You were able to resurrect the creature."); master.CloseGump(typeof(PetResurrectGump)); master.SendGump(new PetResurrectGump(EthicCaster.Mobile, pet)); Conquests.CheckProgress <ResConquest>(EthicCaster.Mobile as PlayerMobile, pet); } else { bool found = false; List <Mobile> friends = pet.Friends; for (int i = 0; friends != null && i < friends.Count; ++i) { Mobile friend = friends[i]; if (!friend.InRange(pet, 3)) { continue; } EthicCaster.Mobile.SendMessage(54, "You were able to resurrect the creature."); friend.CloseGump(typeof(PetResurrectGump)); friend.SendGump(new PetResurrectGump(EthicCaster.Mobile, pet)); found = true; Conquests.CheckProgress <ResConquest>(EthicCaster.Mobile as PlayerMobile, pet); break; } if (!found) { EthicCaster.Mobile.SendMessage(54, "The pet owner must be near to attempt the resurrection."); } } } } } else if (to.Region.IsPartOf(typeof(HouseRegion))) { EthicCaster.Mobile.SendMessage(54, "You cannot resurrect them while they are in a house."); } else { EthicCaster.Mobile.SendMessage(54, "You must target a dead ally or bonded pet!"); } FinishInvoke(EthicCaster); FinishSequence(); }
protected override void OnTick() { if (m_NextSkillTime != m_From.NextSkillTime || m_NextSpellTime != m_From.NextSpellTime || m_NextActionTime != m_From.NextActionTime) { Terminate(); return; } if (m_LastMoveTime != m_From.LastMoveTime) { m_From.SendLocalizedMessage(503023); // You cannot move around while digging up treasure. You will need to start digging anew. Terminate(); return; } int z = (m_Chest != null) ? m_Chest.Z + m_Chest.ItemData.Height : int.MinValue; int height = 16; if (z > m_Location.Z) { height -= (z - m_Location.Z); } else { z = m_Location.Z; } if (!m_Map.CanFit(m_Location.X, m_Location.Y, z, height, true, true, false)) { m_From.SendLocalizedMessage(503024); // You stop digging because something is directly on top of the treasure chest. Terminate(); return; } m_Count++; m_From.RevealingAction(); m_From.Direction = m_From.GetDirectionTo(m_Location); if (m_Count > 1 && m_Dirt1 == null) { m_Dirt1 = new TreasureChestDirt(); m_Dirt1.MoveToWorld(m_Location, m_Map); m_Dirt2 = new TreasureChestDirt(); m_Dirt2.MoveToWorld(new Point3D(m_Location.X, m_Location.Y - 1, m_Location.Z), m_Map); } if (m_Count == 5) { m_Dirt1.Turn1(); } else if (m_Count == 10) { m_Dirt1.Turn2(); m_Dirt2.Turn2(); } else if (m_Count > 10) { if (m_Chest == null) { m_Chest = new TreasureMapChest(m_From, m_TreasureMap.Level, true); m_Chest.MoveToWorld(new Point3D(m_Location.X, m_Location.Y, m_Location.Z - 15), m_Map); } else { m_Chest.Z++; } Effects.PlaySound(m_Chest, m_Map, 0x33B); } if (m_Chest != null && m_Chest.Location.Z >= m_Location.Z) { Stop(); m_From.EndAction(typeof(TreasureMap)); m_Chest.Temporary = false; m_TreasureMap.Completed = true; m_TreasureMap.CompletedBy = m_From; Conquests.CheckProgress <ItemConquest>(m_From as PlayerMobile, m_Chest); int spawns; switch (m_TreasureMap.Level) { case 0: spawns = 3; break; case 1: spawns = 0; break; default: spawns = 4; break; } for (int i = 0; i < spawns; ++i) { BaseCreature bc = Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, true); if (bc != null) { m_Chest.Guardians.Add(bc); } } } else { if (m_From.Body.IsHuman && !m_From.Mounted) { m_From.Animate(11, 5, 1, true, false, 0); } new SoundTimer(m_From, 0x125 + (m_Count % 2)).Start(); } }
public override void OnDoubleClick(Mobile from) { if (Movable) { if (from.InRange(GetWorldLocation(), 1)) { if (!RequireFreeHand && !(from.FindItemOnLayer(Layer.TwoHanded) is BaseRanged) || HasFreeHand(from)) { if (this is BaseExplosionPotion && Amount > 1) { var pot = GetType().CreateInstanceSafe <BaseExplosionPotion>(); if (pot != null) { Amount--; if (from.Backpack != null && !from.Backpack.Deleted) { from.Backpack.DropItem(pot); } else { pot.MoveToWorld(from.Location, from.Map); } if (pot.Drink(from)) { //EventSink.InvokeOnConsume(new OnConsumeEventArgs(from, pot)); if (from is PlayerMobile) { Conquests.CheckProgress <ItemConquest>((PlayerMobile)from, this); //CheckProgress<ConsumeItemConquest>((PlayerMobile)e.Consumer, e); } } } } else { if (Drink(from)) { //EventSink.InvokeOnConsume(new OnConsumeEventArgs(from, pot)); if (from is PlayerMobile) { Conquests.CheckProgress <ItemConquest>((PlayerMobile)from, this); //CheckProgress<ConsumeItemConquest>((PlayerMobile)e.Consumer, e); } } } } else { from.SendLocalizedMessage(502172); // You must have a free hand to drink a potion. } } else { from.SendLocalizedMessage(502138); // That is too far away for you to use } } }
public void OnPlacement(Mobile from, Point3D p) { if (Deleted) { return; } if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (from is PlayerMobile && ((PlayerMobile)from).Young) { from.SendMessage("You are too young to place a house."); } else if (from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse(from)) { from.SendLocalizedMessage(501271); // You already own a house, you may not place another! } else { ArrayList toMove; Point3D center = new Point3D(p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z); HousePlacementResult res = HousePlacement.Check(from, m_MultiID, center, out toMove); switch (res) { case HousePlacementResult.Valid: { BaseHouse house = GetHouse(from); house.MoveToWorld(center, from.Map); Conquests.CheckProgress <HousePlacementConquest>(from as PlayerMobile, house); Delete(); for (int i = 0; i < toMove.Count; ++i) { object o = toMove[i]; if (o is Mobile) { ((Mobile)o).Location = house.BanLocation; } else if (o is Item) { ((Item)o).Location = house.BanLocation; } } break; } case HousePlacementResult.MobileBlocking: { from.SendMessage("There is somebody in the way, and you can't place on top of them!"); break; } case HousePlacementResult.ItemBlocking: { from.SendMessage("There is an item in the way, and you can't place on top of them!"); break; } case HousePlacementResult.BadItem: case HousePlacementResult.BadLand: case HousePlacementResult.BadStatic: case HousePlacementResult.BadRegionHidden: { from.SendLocalizedMessage(1043287); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain. break; } case HousePlacementResult.NoSurface: { from.SendMessage("The house could not be created here. Part of the foundation would not be on any surface."); break; } case HousePlacementResult.BadRegion: { from.SendLocalizedMessage(501265); // Housing cannot be created in this area. break; } case HousePlacementResult.BadRegionTemp: { from.SendLocalizedMessage(501270); //Lord British has decreed a 'no build' period, thus you cannot build this house at this time. break; } case HousePlacementResult.BadRegionRaffle: { from.SendLocalizedMessage(1150493); // You must have a deed for this plot of land in order to build here. break; } } } }
public void EndHeal() { StopHeal(); int healerNumber; int patientNumber; bool playSound = true; bool checkRes = false; bool checkPois = false; SkillName primarySkill = GetPrimarySkill(m_Patient); SkillName secondarySkill = GetSecondarySkill(m_Patient); var petPatient = m_Patient as BaseCreature; if (!m_Healer.Alive) { healerNumber = 500962; // You were unable to finish your work before you died. patientNumber = -1; playSound = false; } else if (!m_Healer.InRange(m_Patient, Bandage.GetRange(m_Healer.Expansion))) { healerNumber = 500963; // You did not stay close enough to heal your target. patientNumber = -1; playSound = false; } else if (!m_Patient.Alive || (petPatient != null && petPatient.IsDeadPet)) { 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); //TODO: Dbl check doesn't check for faction of the horse here? if (((checkRes = (healing >= 80.0 && anatomy >= 80.0)) && chance > Utility.RandomDouble()) || (m_Patient.EraSE && petPatient is FactionWarHorse && petPatient.ControlMaster == m_Healer)) { 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 (m_Patient.Region != null && m_Patient.Region.IsPartOf("Khaldun")) { healerNumber = 1010395; // The veil of death in this area is too strong and resists thy efforts to restore life. patientNumber = -1; } 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.IsDeadPet) { Mobile master = petPatient.ControlMaster; if (master != null && m_Healer == master) { petPatient.ResurrectPet(); foreach (Skill s in petPatient.Skills) { double skillloss = s.Base * 0.01; s.Base -= skillloss; } Conquests.CheckProgress <ResConquest>(m_Healer as PlayerMobile, petPatient); } else if (master != null && master.InRange(petPatient, 3)) { healerNumber = 503255; // You are able to resurrect the creature. master.CloseGump(typeof(PetResurrectGump)); master.SendGump(new PetResurrectGump(m_Healer, petPatient)); Conquests.CheckProgress <ResConquest>(m_Healer as PlayerMobile, petPatient); } else { bool found = false; List <Mobile> friends = petPatient.Friends; for (int i = 0; friends != null && i < friends.Count; ++i) { Mobile friend = friends[i]; if (!friend.InRange(petPatient, 3)) { continue; } healerNumber = 503255; // You are able to resurrect the creature. friend.CloseGump(typeof(PetResurrectGump)); friend.SendGump(new PetResurrectGump(m_Healer, petPatient)); found = true; Conquests.CheckProgress <ResConquest>(m_Healer as PlayerMobile, petPatient); break; } if (!found) { healerNumber = 1049670; // The pet's owner must be nearby to attempt resurrection. } } } else { m_Patient.CloseGump(typeof(ResurrectGump)); /*PlayerMobile pres = m_Patient as PlayerMobile; * * if (pres.MurderBounty > 0) * m_Patient.SendGump( new ResurrectGump( m_Patient, m_Healer, pres.MurderBounty ) ); * else*/ m_Patient.SendGump(new ResurrectGump(m_Patient, m_Healer)); Conquests.CheckProgress <ResConquest>(m_Healer as PlayerMobile, petPatient); } } } else { if (petPatient != null && petPatient.IsDeadPet) { 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) { 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.1) - (m_Slips * 0.02); if ((checkPois = (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 { healerNumber = 1010060; // You have failed to cure your target! patientNumber = -1; } } else if (BleedAttack.IsBleeding(m_Patient)) { healerNumber = 1060088; // You bind the wound and stop the bleeding patientNumber = 1060167; // The bleeding wounds have healed, you are no longer bleeding! BleedAttack.EndBleed(m_Patient, false); } else if (MortalStrike.IsWounded(m_Patient)) { healerNumber = (m_Healer == m_Patient ? 1005000 : 1010398); patientNumber = -1; playSound = false; } else if (m_Patient.Hits == m_Patient.HitsMax) { healerNumber = 500967; // You heal what little damage your patient had. patientNumber = -1; } else { patientNumber = -1; double healing = m_Healer.Skills[primarySkill].Value; double anatomy = m_Healer.Skills[secondarySkill].Value; double chance = ((healing + 10.0) / 100.0) - (m_Slips * 0.02); if (chance > Utility.RandomDouble()) { healerNumber = 500969; // You finish applying the bandages. double min = (anatomy / 5.5) + (healing / 5.5) + 4.0; double max = (anatomy / 5.0) + (healing / 2.5) + 10.0; double toHeal = min + (Utility.RandomDouble() * (max - min)); if ((m_Patient.Body.IsMonster || m_Patient.Body.IsAnimal) && m_Patient.NetState == null) // Alan Mod: player-controlled mobs heal like regular players { toHeal += m_Patient.HitsMax / 100; } toHeal -= m_Slips * 4; if (toHeal < 1) { toHeal = 1; healerNumber = 500968; // You apply the bandages, but they barely help. } var healfinal = (int)toHeal; int healmessage = Math.Min(m_Patient.HitsMax - m_Patient.Hits, healfinal); m_Patient.Heal(healfinal, m_Healer, false); if (healmessage > 0) { m_Patient.PrivateOverheadMessage( MessageType.Regular, 0x42, false, healmessage.ToString(CultureInfo.InvariantCulture), m_Patient.NetState); if (m_Healer != m_Patient) { m_Patient.PrivateOverheadMessage( MessageType.Regular, 0x42, false, healmessage.ToString(CultureInfo.InvariantCulture), m_Healer.NetState); } } } 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 (playSound) { m_Patient.PlaySound(0x57); } double minSkill = 0.0; double maxSkill = 90.0; if (checkRes) { minSkill = 65.0; maxSkill = 120.0; } else if (checkPois) { minSkill = 45.0; maxSkill = 120.0; } m_Healer.CheckSkill(secondarySkill, minSkill, maxSkill); m_Healer.CheckSkill(primarySkill, minSkill, maxSkill); }
public override bool Eat(Mobile from) { int oldHunger = from.Hunger; // Fill the Mobile with FillFactor if (CheckHunger(from)) { if (Owner != null) { if (Owner.RawStr > from.RawStr) { from.PrivateOverheadMessage( MessageType.Label, 54, true, "Even though " + Owner.Name + "flesh is tough, stringy and not very taste, you feel quite energized after the meal.", from.NetState); //SpellHelper.AddStatBonus(from, from, StatType.Str, true); } else if (Owner.RawStr == from.RawStr) { from.PrivateOverheadMessage( MessageType.Label, 54, true, "You marvel at the flavour of " + Owner.Name + "'s flesh. What they lacked in fighting prowess was made up for in their succulent taste.", from.NetState); } else if (Owner.RawStr < from.RawStr) { from.PrivateOverheadMessage( MessageType.Label, 54, true, Owner.Name + " was quite the tubby fellow. While delicious, his flesh wasn't very nutritious.", from.NetState); //SpellHelper.AddStatCurse(from, from, StatType.Str, false); } } // Play a random "eat" sound from.PlaySound(Utility.Random(0x3A, 3)); if (from.Body.IsHuman && !from.Mounted) { from.Animate(34, 5, 1, true, false, 0); } if (Poison != null) { from.ApplyPoison(Poisoner, Poison); } //EventSink.InvokeOnConsume(new OnConsumeEventArgs(from, this, from.Hunger - oldHunger)); if (from is PlayerMobile) { Conquests.CheckProgress <ItemConquest>((PlayerMobile)from, this, from.Hunger - oldHunger); //CheckProgress<ConsumeItemConquest>((PlayerMobile)e.Consumer, e); } Consume(); return(true); } return(false); }
public virtual bool CheckSequence() { int mana = ScaleMana(GetMana()); if (m_Caster.Deleted || !m_Caster.Alive || m_Caster.Spell != this || m_State != SpellState.Sequencing) { DoFizzle(); } else if (m_Scroll != null && !(m_Scroll is Runebook) && (m_Scroll.Amount <= 0 || m_Scroll.Deleted || m_Scroll.RootParent != m_Caster || (m_Scroll is BaseWand && (((BaseWand)m_Scroll).Charges <= 0 || m_Scroll.Parent != m_Caster)) || (m_Scroll is GnarledStaff && (((GnarledStaff)m_Scroll).Charges <= 0 || m_Scroll.Parent != m_Caster)))) { DoFizzle(); } else if (!ConsumeReagents()) { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502630); // More reagents are needed for this spell. } else if (m_Caster.Mana < mana) { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625); // Insufficient mana for this spell. } else if (m_Caster.Region is CustomRegion && !(m_Caster.Region).OnBeginSpellCast(m_Caster, this)) { m_Caster.SendMessage("You cannot cast that spell here."); } else if (m_Caster.EraAOS && (m_Caster.Frozen || m_Caster.Paralyzed)) { m_Caster.SendLocalizedMessage(502646); // You cannot cast a spell while frozen. DoFizzle(); } else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.UtcNow) { m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed. DoFizzle(); } else if (CheckFizzle()) { m_Caster.Mana -= mana; if (m_Scroll is SpellScroll) { m_Scroll.Consume(); } else if (m_Scroll is BaseWand) { ((BaseWand)m_Scroll).ConsumeCharge(m_Caster); } else if (m_Scroll is GnarledStaff) { ((GnarledStaff)m_Scroll).ConsumeCharge(m_Caster); } if (m_Scroll is BaseWand || m_Scroll is GnarledStaff) { m_Caster.RevealingAction(); bool m = m_Scroll.Movable; m_Scroll.Movable = false; if (ClearHandsOnCast) { m_Caster.ClearHands(); } m_Scroll.Movable = m; } else { if (ClearHandsOnCast) { m_Caster.ClearHands(); } } int karma = ComputeKarmaAward(); if (karma != 0) { Titles.AwardKarma(Caster, karma, true); } if (m_Caster is PlayerMobile) { Conquests.CheckProgress <SuccessfulSpellConquest>(m_Caster as PlayerMobile, m_Caster.Spell); } return(true); } else { DoFizzle(); } return(false); }
private Item TryStealItem(Item toSteal, ref bool caught) { //Close bank box on steal attempt -Adam BankBox box = m_Thief.FindBankNoCreate(); if (box != null && box.Opened) { box.Close(); m_Thief.Send(new MobileUpdate(m_Thief)); } Item stolen = null; object root = toSteal.RootParent; var contParent = toSteal.Parent as Container; StealableArtifactsSpawner.StealableInstance si = null; if (toSteal.Parent == null || !toSteal.Movable) { si = StealableArtifactsSpawner.GetStealableInstance(toSteal); } BaseAddon addon = null; if (toSteal is AddonComponent) { addon = ((AddonComponent)toSteal).Addon; } bool stealflag = (addon != null && addon.GetSavedFlag(ItemFlags.StealableFlag)) || toSteal.GetSavedFlag(ItemFlags.StealableFlag); if (!IsEmptyHanded(m_Thief)) { m_Thief.SendLocalizedMessage(1005584); // Both hands must be free to steal. } else if (root is Mobile && ((Mobile)root).Player && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild(m_Thief)) { m_Thief.SendLocalizedMessage(1005596); // You must be in the thieves guild to steal from other players. } else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0) { m_Thief.SendLocalizedMessage(502706); // You are currently suspended from the thieves guild. } else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable) { m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers. } else if (root is PlayerVendor) { m_Thief.SendLocalizedMessage(502709); // You can't steal from vendors. } else if (!m_Thief.CanSee(toSteal)) { m_Thief.SendLocalizedMessage(500237); // Target can not be seen. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true)) { m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else. } #region Sigils else if (toSteal is Sigil) { PlayerState pl = PlayerState.Find(m_Thief); Faction faction = (pl == null ? null : pl.Faction); var sig = (Sigil)toSteal; if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (root != null) // not on the ground { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (faction != null) { if (!m_Thief.CanBeginAction(typeof(IncognitoSpell))) { m_Thief.SendLocalizedMessage(1010581); // You cannot steal the sigil when you are incognito } else if (DisguiseTimers.IsDisguised(m_Thief)) { m_Thief.SendLocalizedMessage(1010583); // You cannot steal the sigil while disguised } else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell))) { m_Thief.SendLocalizedMessage(1010582); // You cannot steal the sigil while polymorphed } else if (TransformationSpellHelper.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1061622); // You cannot steal the sigil while in that form. } else if (m_Thief is PlayerMobile && ((PlayerMobile)m_Thief).SavagePaintExpiration > TimeSpan.Zero) { m_Thief.SendLocalizedMessage(1114352); // You cannot steal the sigil while disguised in savage paint. } else if (pl.IsLeaving) { m_Thief.SendLocalizedMessage(1005589); // You are currently quitting a faction and cannot steal the town sigil } else if (sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction) { m_Thief.SendLocalizedMessage(1005590); // You cannot steal your own sigil } else if (sig.IsPurifying) { m_Thief.SendLocalizedMessage(1005592); // You cannot steal this sigil until it has been purified } else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 0.0, 0.0)) { if (Sigil.ExistsOn(m_Thief)) { m_Thief.SendLocalizedMessage(1010258); // The sigil has gone back to its home location because you already have a sigil. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true)) { m_Thief.SendLocalizedMessage(1010259); // The sigil has gone home because your backpack is full } else { if (sig.IsBeingCorrupted) { sig.GraceStart = DateTime.UtcNow; // begin grace period } m_Thief.SendLocalizedMessage(1010586); // YOU STOLE THE SIGIL!!! (woah, calm down now) if (sig.LastMonolith != null && sig.LastMonolith.Sigil != null) { sig.LastMonolith.Sigil = null; sig.LastStolen = DateTime.UtcNow; } switch (PvPController._SigilAnnounceStolen) { case PvPController.SigilStolenAnnouncing.All: { foreach (Faction factionToBCast in Faction.Factions) { List <PlayerState> members = factionToBCast.Members; if (sig.Corrupted != null) { if (sig.Corrupted == factionToBCast) { foreach (PlayerState member in members) { member.Mobile.SendMessage( factionToBCast.Definition.HueBroadcast, "The {0} have stolen the {1} sigil from your faction stronghold!", faction.Definition.FriendlyName, sig.Town.Definition.FriendlyName); } } else { foreach (PlayerState member in members) { member.Mobile.SendMessage( factionToBCast.Definition.HueBroadcast, "The {0} have stolen the {1} sigil from the {2} stronghold!", faction.Definition.FriendlyName, sig.Town.Definition.FriendlyName, sig.Corrupted.Definition.FriendlyName); } } } else { foreach (PlayerState member in members) { member.Mobile.SendMessage( factionToBCast.Definition.HueBroadcast, "The {0} have stolen the {1} sigil!", faction.Definition.FriendlyName, sig.Town.Definition.FriendlyName); } } } } break; case PvPController.SigilStolenAnnouncing.Owner: { if (sig.Corrupted != null) { List <PlayerState> members = sig.Corrupted.Members; foreach (PlayerState member in members) { member.Mobile.SendMessage( sig.Corrupted.Definition.HueBroadcast, "The {0} have stolen the {1} sigil from your faction stronghold!", faction.Definition.FriendlyName, sig.Town.Definition.FriendlyName); } } } break; } return(sig); } } else { m_Thief.SendLocalizedMessage(1005594); // You do not have enough skill to steal the sigil } } else { m_Thief.SendLocalizedMessage(1005588); // You must join a faction to do that } } #endregion else if (!stealflag && si == null && (toSteal.Parent == null || !toSteal.Movable)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if ((toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) && !(toSteal.RootParent is FillableContainer) && !stealflag) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (toSteal is Spellbook) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (toSteal.Nontransferable) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (m_Thief.EraAOS && si == null && toSteal is Container) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (toSteal is IEthicsItem && ((IEthicsItem)toSteal).EthicsItemState != null && !((IEthicsItem)toSteal).EthicsItemState.HasExpired) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } // Alan: commented this out b/c there shouldn't be a required skill level to steal stealflag stuff //else if ( ( si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0 ) || ( stealflag ) && m_Thief.Skills[SkillName.Stealing].Value < 100.0 ) ) //&& m_Thief.Skills[SkillName.Stealing].Value < 90.0 ) ) // m_Thief.SendLocalizedMessage( 1060025, "", 0x66D ); // You're not skilled enough to attempt the theft of this item. else if (toSteal.Parent is Mobile) { m_Thief.SendLocalizedMessage(1005585); // You cannot steal items which are equipped. } else if (toSteal.GetSavedFlag(0x01)) //Not lootable item { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root == m_Thief || (root is BaseCreature && ((BaseCreature)root).GetMaster() == m_Thief)) { m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed. } else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root is Corpse) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (m_Thief.Spell != null) { m_Thief.SendMessage("You are too busy concentrating on your spell to steal that item."); } else { double w = toSteal.Weight + toSteal.TotalWeight; if (addon != null) { w = addon.Weight = addon.TotalWeight; } if (w > 10 && !stealflag) { m_Thief.SendMessage("That is too heavy to steal."); } else { m_Thief.BeginAction(typeof(Hiding)); Timer.DelayCall(TimeSpan.FromSeconds(SpecialMovesController._StealingRehideDelay), ReleaseHideLock, m_Thief); if (toSteal.Stackable && toSteal.Amount > 1) { var maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight); var minAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 25.0) / toSteal.Weight); //added a min amount if (minAmount < 1) { minAmount = 1; } if (maxAmount < 1) { maxAmount = 1; } else if (maxAmount > toSteal.Amount) { maxAmount = toSteal.Amount; } int amount = Utility.RandomMinMax(minAmount, maxAmount); //(change from 1, maxamount) if (amount >= toSteal.Amount) { var pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = toSteal; } } else { var pileWeight = (int)Math.Ceiling(toSteal.Weight * amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount) ?? toSteal; } } } else { var iw = (int)Math.Ceiling(w); iw *= 10; if (stealflag || m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5)) { stolen = toSteal; } } if (stolen is PowerScroll) { var scroll = (PowerScroll)stolen; bool success = Utility.RandomBool(); if (success || Utility.RandomBool()) { BaseMount.Dismount(m_Thief); BaseMount.SetMountPrevention( m_Thief, BlockMountType.DismountRecovery, TimeSpan.FromSeconds(success ? 60.0 : 5.0)); } } if (stolen != null) { m_Thief.SendLocalizedMessage(502724); // You successfully steal the item. if (stolen is Head2) { ((Head2)stolen).Owner = m_Thief as PlayerMobile; } if (si != null) { toSteal.Movable = true; si.Item = null; } if (stealflag) { //toSteal.SetSavedFlag( 0x04, false ); // 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); if (addon != null) //deed it up! { Item deed = addon.Deed; addon.Delete(); stolen = deed; } else // release it if it was locked down { toSteal.Movable = true; } if (toSteal.Spawner != null) //its not spawned anymore, its STOLEN! { toSteal.Spawner.Remove(toSteal); toSteal.Spawner = null; } } Conquests.CheckProgress <StealingConquest>(m_Thief as PlayerMobile, toSteal); } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } caught = !stealflag && (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150)); } } return(stolen); }