private int Verify(LockableContainer container) { if (container == null || container.KeyValue == 0) { return(1005638); // You can only trap lockable chests. } if (this.From.Map != container.Map || !this.From.InRange(container.GetWorldLocation(), 2)) { return(500446); // That is too far away. } if (!container.Movable) { return(502944); // You cannot trap this item because it is locked down. } if (!container.IsAccessibleTo(this.From)) { return(502946); // That belongs to someone else. } if (container.Locked) { return(502943); // You can only trap an unlocked object. } if (container.TrapType != TrapType.None) { return(502945); // You can only place one trap on an object at a time. } return(0); }
public void Target(LockableContainer targ) { if (targ.Locked || targ.LockLevel == 0 || targ.MaxLockLevel == 0) { Caster.SendLocalizedMessage(501762); // Target must be an unlocked chest. } else if (targ.MaxLockLevel > 65) { Caster.SendAsciiMessage("This chest cannot be magically locked."); } else if (CheckSequence()) { SpellHelper.Turn(Caster, targ); Point3D loc = targ.GetWorldLocation(); Effects.SendLocationParticles( EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5020); Effects.PlaySound(loc, targ.Map, 0x1FA); // The chest is now locked! Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501763); targ.LockLevel = -255; // signal magic lock targ.Locked = true; } FinishSequence(); }
private void OnTargetLoc(Mobile from, object target, object item) { object loc = null; if (target is LandTarget) { loc = ((LandTarget)target).Location; } else if (target is StaticTarget) { loc = ((StaticTarget)target).Location; } else if (target is Item) { loc = ((Item)target).Location; } else if (target is Mobile) { loc = ((Mobile)target).Location; } if (loc == null) { from.SendAsciiMessage("You cannot create that there."); return; } Item made = (Item)item; if (from.Map.CanFit((Point3D)loc, made.ItemData.Height, true, true)) { made.MoveToWorld((Point3D)loc, from.Map); if (made is LockableContainer) { if (from.Skills[SkillName.Tinkering].Value >= Utility.Random(100)) { LockableContainer cont = (LockableContainer)made; Key key = new Key(KeyType.Copper, Key.RandomValue()); cont.LockLevel = (int)(from.Skills[SkillName.Tinkering].Value / 2) - 15; if (cont.LockLevel < 1) { cont.LockLevel = 1; } cont.MaxLockLevel = cont.LockLevel + 30; cont.RequiredSkill = cont.LockLevel; cont.KeyValue = key.KeyValue; cont.DropItem(key); from.SendAsciiMessage("Your tinker skill was sufficient to make the item lockable."); } } } else { from.SendAsciiMessage("You cannot create that there."); made.Delete(); } }
public void Target(LockableContainer targ) { if (Multis.BaseHouse.CheckLockedDownOrSecured(targ)) { // You cannot cast this on a locked down item. Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 501761); } else if (targ.Locked || targ.LockLevel == 0) { // Target must be an unlocked chest. Caster.SendLocalizedMessage(501762); } else if (CheckSequence()) { SpellHelper.Turn(Caster, targ); Point3D loc = targ.GetWorldLocation(); Effects.SendLocationParticles( EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5020); Effects.PlaySound(loc, targ.Map, 0x1FA); // The chest is now locked! Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501763); targ.LockLevel = -255; // signal magic lock targ.Locked = true; } FinishSequence(); }
public void Target(IPoint3D loc) { var from = Caster; if (CheckSequence()) { SpellHelper.Turn(from, loc); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc), from.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024); Effects.PlaySound(loc, from.Map, 0x1FF); if (loc is Mobile) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (!(loc is LockableContainer)) { from.SendLocalizedMessage(501666); // You can't unlock that! } else { LockableContainer cont = (LockableContainer)loc; if (Multis.BaseHouse.CheckSecured(cont)) { from.SendLocalizedMessage(503098); // You cannot cast this on a secure item. } else if (!cont.Locked) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (cont.LockLevel == 0) { from.SendLocalizedMessage(501666); // You can't unlock that! } else { int level = (int)(from.Skills[SkillName.Magery].Value * 0.8) - 4; if (level >= cont.RequiredSkill && !(cont is TreasureMapChest && ((TreasureMapChest)cont).Level > 2)) { cont.Locked = false; if (cont.LockLevel == -255) { cont.LockLevel = cont.RequiredSkill - 10; } } else { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); // My spell does not seem to have an effect on that lock. } } } } FinishSequence(); }
private void AddCampChests(IronGate gate) { LockableContainer chest = null; chest = new MetalChest(); chest.ItemID = 3708; chest.LiftOverride = true; TreasureMapChest.Fill(chest, 1); chest.DropItem(new Key(KeyType.Iron, gate.KeyValue)); AddItem(chest, 4, 4, 1); LockableContainer crates = null; switch (Utility.Random(4)) { case 0: crates = new SmallCrate(); break; case 1: crates = new MediumCrate(); break; case 2: crates = new LargeCrate(); break; default: crates = new LockableBarrel(); break; } crates.TrapType = TrapType.ExplosionTrap; crates.TrapPower = Utility.RandomMinMax(30, 40); crates.TrapLevel = 2; crates.RequiredSkill = 76; crates.LockLevel = 66; crates.MaxLockLevel = 116; crates.Locked = true; crates.DropItem(new Gold(Utility.RandomMinMax(100, 400))); crates.DropItem(new Arrow(10)); crates.DropItem(new Bolt(10)); crates.LiftOverride = true; if (Utility.RandomDouble() < 0.8) { switch (Utility.Random(4)) { case 0: crates.DropItem(new LesserCurePotion()); break; case 1: crates.DropItem(new LesserExplosionPotion()); break; case 2: crates.DropItem(new LesserHealPotion()); break; default: crates.DropItem(new LesserPoisonPotion()); break; } } AddItem(crates, 2, 2, 0); }
public void Target(LockableContainer targ) { if (Multis.BaseHouse.CheckSecured(targ)) { Caster.SendAsciiMessage("You cannot cast this on a secure item."); } else if (CheckSequence()) { SpellHelper.Turn(Caster, targ); Point3D loc = targ.GetWorldLocation(); Effects.SendLocationParticles( EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024); Effects.PlaySound(loc, targ.Map, 0x1FF); if (targ.Locked && targ.LockLevel != 0) { double magery = Caster.Skills[SkillName.Magery].Value; int level = (int)(magery * 0.8) - 4; if (level >= targ.RequiredSkill && !(targ is TreasureMapChest && ((TreasureMapChest)targ).Level > 2) && !(targ is BaseTreasureChest && ((BaseTreasureChest)targ).Level > (BaseTreasureChest.TreasureLevel) 1)) { targ.Locked = false; if (targ.LockLevel == -255) { targ.LockLevel = targ.RequiredSkill - 10; } if (targ.LockLevel == 0) { targ.LockLevel = -1; } if (targ is BaseTreasureChest) { ((BaseTreasureChest)targ).UnlockSpell(); } } else { // My spell does not seem to have an effect on that lock. Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); } } else { // That did not need to be unlocked. Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); } } FinishSequence(); }
public static void Fill(LockableContainer cont, int level) { cont.Movable = false; cont.Locked = true; if (level == 0) { cont.LockLevel = ILockpickable.CannotPick; cont.DropItem(new Gold(Utility.RandomMinMax(50, 100))); if (Utility.RandomDouble() < 0.75) { cont.DropItem(new TreasureMap(0, Map.Trammel)); } } else { cont.TrapType = TrapType.ExplosionTrap; cont.TrapPower = level * 25; cont.TrapLevel = level; cont.RequiredSkill = level switch { 1 => 36, 2 => 76, 3 => 84, 4 => 92, 5 => 100, _ => 100 }; cont.LockLevel = cont.RequiredSkill - 10; cont.MaxLockLevel = cont.RequiredSkill + 40; // Publish 67 gold change // if (Core.SA) // cont.DropItem( new Gold( level * 5000 ) ); // else cont.DropItem(new Gold(level * 1000)); for (var i = 0; i < level * 5; ++i) { cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular)); } var numberItems = Core.SE ? level switch { 1 => 5, 2 => 10, 3 => 15, 4 => 38, 5 => 50, 6 => 60, _ => 0 } : level * 6;
public void Target(LockableContainer targ) { if (Multis.BaseHouse.CheckSecured(targ)) { // You cannot cast this on a secure item. Caster.SendLocalizedMessage(503098); } else if (CheckSequence()) { SpellHelper.Turn(Caster, targ); Point3D loc = targ.GetWorldLocation(); Effects.SendLocationParticles( EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024); Effects.PlaySound(loc, targ.Map, 0x1FF); if (targ.Locked /* && targ.LockLevel != 0 */) { double level = Caster.Skills[SkillName.Animisme].Value; level = SpellHelper.AdjustValue(Caster, level); if ((int)level >= targ.RequiredSkill) { targ.Locked = false; if (targ.LockLevel == -255) { targ.LockLevel = targ.RequiredSkill - 10; } if (targ.LockLevel == 0) { targ.LockLevel = -1; } } else { // My spell does not seem to have an effect on that lock. Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); } } else { // That did not need to be unlocked. Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); } } FinishSequence(); }
private bool Acquire(object target, out int message) { LockableContainer container = target as LockableContainer; message = Verify(container); if (message > 0) { return(false); } m_Container = container; return(true); }
public void Target(LockableContainer targ) { if (CheckSequence()) { SpellHelper.Turn(Caster, targ); Point3D loc = targ.GetWorldLocation(); Effects.SendLocationParticles( EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024); Effects.PlaySound(loc, targ.Map, 0x1FF); if (targ.Locked) { if (targ.LockLevel != 0 && (targ.LockLevel == -255 || (targ.MaxLockLevel <= 50 && Caster.Skills[SkillName.Magery].Value > targ.RequiredSkill))) { targ.Locked = false; if (targ.LockLevel == -255) { targ.LockLevel = targ.MaxLockLevel - 30; if (targ.RequiredSkill < targ.LockLevel) { targ.LockLevel = targ.RequiredSkill; } if (targ.LockLevel < 1) { targ.LockLevel = 1; } } } else { // My spell does not seem to have an effect on that lock. Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); } } else { // That did not need to be unlocked. Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); } } FinishSequence(); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is BookBox && from.Backpack != null) { m_Thief.SayTo(from, "I cannot help with such a cursed item."); } else if (targeted is LockableContainer && from.Backpack != null) { LockableContainer box = (LockableContainer)targeted; Container pack = from.Backpack; int toConsume = 1000; if (BeggingPose(from) > 0) // LET US SEE IF THEY ARE BEGGING { toConsume = toConsume - (int)((from.Skills[SkillName.Begging].Value * 0.005) * toConsume); } if (toConsume == 0) { return; } if (pack.ConsumeTotal(typeof(Gold), toConsume)) { if (BeggingPose(from) > 0) { Titles.AwardKarma(from, -BeggingKarma(from), true); } // DO ANY KARMA LOSS m_Thief.SayTo(from, "That is now unlocked."); from.SendMessage(String.Format("You pay {0} gold.", toConsume)); Effects.PlaySound(from.Location, from.Map, 0x241); box.Locked = false; box.TrapPower = 0; box.TrapLevel = 0; box.LockLevel = 0; box.MaxLockLevel = 0; box.RequiredSkill = 0; box.TrapType = TrapType.None; } else { m_Thief.SayTo(from, "It would cost you {0} gold to have that unlocked.", toConsume); from.SendMessage("You do not have enough gold."); } } else { m_Thief.SayTo(from, "That does not need my services."); } }
private void AddCampChests() { LockableContainer chest = Utility.Random(3) switch { 0 => new MetalChest(), 1 => new MetalGoldenChest(), _ => new WoodenChest() }; chest.LiftOverride = true; TreasureMapChest.Fill(chest, 1); AddItem(chest, -2, -2, 0); LockableContainer crates = Utility.Random(4) switch { 0 => new SmallCrate(), 1 => new MediumCrate(), 2 => new LargeCrate(), _ => new LockableBarrel() }; crates.TrapType = TrapType.ExplosionTrap; crates.TrapPower = Utility.RandomMinMax(30, 40); crates.TrapLevel = 2; crates.RequiredSkill = 76; crates.LockLevel = 66; crates.MaxLockLevel = 116; crates.Locked = true; crates.DropItem(new Gold(Utility.RandomMinMax(100, 400))); crates.DropItem(new Arrow(10)); crates.DropItem(new Bolt(10)); crates.LiftOverride = true; crates.DropItem( Utility.Random(5) switch { 0 => new LesserCurePotion(), 1 => new LesserExplosionPotion(), 2 => new LesserHealPotion(), 3 => new LesserPoisonPotion(), _ => null // 4 }
public void Target(LockableContainer targ) { if (Multis.BaseHouse.CheckSecured(targ)) { // You cannot cast this on a secure item. Caster.SendLocalizedMessage(503098); } else if (CheckSequence()) { SpellHelper.Turn(Caster, targ); Point3D loc = targ.GetWorldLocation(); Effects.SendLocationParticles( EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024); Effects.PlaySound(loc, targ.Map, 0x1FF); if (targ.Locked && targ.LockLevel == -255) { double level = Caster.Skills[CastSkill].Value; level = SpellHelper.AdjustValue(Caster, level); if ((int)level >= targ.RequiredSkill) { targ.Locked = false; } else { Caster.SendMessage("Vous n'êtes pas assez compétent pour ouvrir ce coffre !"); } } else { // My spell does not seem to have an effect on that lock. Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); } } FinishSequence(); }
public static bool MeetsCustomReqs(LockableContainer cont) { if (cont.LockLevel < 0) { return(true); } if (cont is TreasureMapChest) { var chest = cont as TreasureMapChest; return(chest.Level < 2); } else if (cont is BaseTreasureChest) { var chest = cont as BaseTreasureChest; return(chest.Level < BaseTreasureChest.TreasureLevel.Level2); } return(true); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 1: { m_Chest = reader.ReadItem <LockableContainer>(); m_Crate = reader.ReadItem <LockableContainer>(); m_Filled = reader.ReadBool(); } goto case 0; case 0: m_Prisoner = reader.ReadMobile <BaseCreature>(); break; } }
private int Verify(LockableContainer container) { if (container == null || container.KeyValue == 0) { return(1005638); // You can only trap lockable chests. } if (From.Map != container.Map || !From.InRange(container.GetWorldLocation(), 2)) { return(500446); // That is too far away. } if (!container.IsAccessibleTo(From)) { return(502946); // That belongs to someone else. } if (container.Locked) { return(502943); // You can only trap an unlocked object. } //return 502945; // You can only place one trap on an object at a time. return(0); }
private int Verify(LockableContainer container) { if (container == null || container.KeyValue == 0) { From.SendAsciiMessage("You can only trap lockable chests."); return(1005638); // You can only trap lockable chests. } if (From.Map != container.Map || !From.InRange(container.GetWorldLocation(), 2)) { int OldHue = From.SpeechHue; From.SpeechHue = 0; From.SayTo(From, true, "I can't reach that."); From.SpeechHue = OldHue; return(500446); // That is too far away. } if (!container.Movable) { return(502944); // You cannot trap this item because it is locked down. } if (!container.IsAccessibleTo(From)) { From.SendAsciiMessage("That belongs to someone else."); return(502946); // That belongs to someone else. } if (container.Locked) { From.SendAsciiMessage("You can only trap an unlocked object."); return(502943); // You can only trap an unlocked object. } if (container.TrapType != TrapType.None) { From.SendAsciiMessage("You can only place one trap on an object at a time."); return(502945); // You can only place one trap on an object at a time. } return(0); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Mobile) { from.SendLocalizedMessage(502816); // You feel that such an action would be inappropriate } else if (targeted is TrapableContainer) { if (from.Skills[SkillName.Lockpicking].Value < 50) { from.SendLocalizedMessage(502366); // You do not know enough about locks. Become better at picking locks. return; } else if (from.Skills[SkillName.DetectHidden].Value < 50) { from.SendLocalizedMessage(502367); // You are not perceptive enough. Become better at detect hidden. return; } TrapableContainer targ = (TrapableContainer)targeted; from.Direction = from.GetDirectionTo(targ); if (targ.TrapType == TrapType.None) { from.SendLocalizedMessage(502373); // That doesn't appear to be trapped return; } from.PlaySound(0x241); int minskill; int maxskill; LockableContainer lc = targ as LockableContainer; if (lc != null && (targ.TrapType == TrapType.ExplosionTrap || targ.TrapType == TrapType.PoisonTrap)) { // values used for tinkertraps maxskill = targ.TrapPower; minskill = (int)(targ.TrapPower * 0.8); } else // original values { maxskill = targ.TrapPower + 30; minskill = targ.TrapPower; } if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, minskill, maxskill)) { targ.TrapPower = 0; targ.TrapLevel = 0; targ.TrapType = TrapType.None; from.SendLocalizedMessage(502377); // You successfully render the trap harmless } else { from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off } } else if (targeted is BaseFactionTrap) { BaseFactionTrap trap = (BaseFactionTrap)targeted; Faction faction = Faction.Find(from); FactionTrapRemovalKit kit = (from.Backpack == null ? null : from.Backpack.FindItemByType(typeof(FactionTrapRemovalKit)) as FactionTrapRemovalKit); bool commander = trap.Faction != null && trap.Faction.IsCommander(from); bool isOwner = (trap.Placer == from || commander); if (!commander && from.Skills[SkillName.Lockpicking].Value < 50) { from.SendLocalizedMessage(502366); // You do not know enough about locks. Become better at picking locks. } else if (!commander && from.Skills[SkillName.DetectHidden].Value < 50) { from.SendLocalizedMessage(502367); // You are not perceptive enough. Become better at detect hidden. } else if (faction == null) { from.SendLocalizedMessage(1010538); // You may not disarm faction traps unless you are in an opposing faction } else if (faction == trap.Faction /*&& trap.Faction != null*/ && !isOwner) { from.SendLocalizedMessage(1010537); // You may not disarm traps set by your own faction! } else if (trap.Faction != null && kit == null) { from.SendLocalizedMessage(1042530); // You must have a trap removal kit at the base level of your pack to disarm a faction trap. } else { if (from.CheckTargetSkill(SkillName.RemoveTrap, trap, 80.0, 100.0) || commander) { from.PrivateOverheadMessage(MessageType.Regular, trap.MessageHue, trap.DisarmMessage, from.NetState); if (!isOwner) { int silver = faction.AwardSilver(from, trap.SilverFromDisarm); if (silver > 0) { from.SendLocalizedMessage(1008113, true, silver.ToString("N0")); // You have been granted faction silver for removing the enemy trap : } } trap.Delete(); } else { from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off } if (!isOwner && kit != null) { kit.ConsumeCharge(from); } } } else { from.SendLocalizedMessage(502373); // That doesn't appear to be trapped } }
public override void AddComponents() { this.AddItem(new Item(0xFAC), 0, 0, 0); // fire pit this.AddItem(new Item(0xDE3), 0, 0, 0); // camp fire this.AddItem(new Item(0x974), 0, 0, 1); // cauldron for (int i = 0; i < 2; i++) { LockableContainer cont = null; switch (Utility.Random(3)) { case 0: cont = new MetalChest(); break; case 1: cont = new WoodenChest(); break; case 2: cont = new SmallCrate(); break; } cont.Movable = false; cont.Locked = true; cont.TrapType = TrapType.ExplosionTrap; cont.TrapPower = Utility.RandomMinMax(30, 40); cont.TrapLevel = 2; cont.RequiredSkill = 76; cont.LockLevel = 66; cont.MaxLockLevel = 116; cont.DropItem(new Gold(Utility.RandomMinMax(100, 400))); cont.DropItem(new Arrow(10)); cont.DropItem(new Bolt(10)); if (Utility.RandomDouble() < 0.8) { switch (Utility.Random(4)) { case 0: cont.DropItem(new LesserCurePotion()); break; case 1: cont.DropItem(new LesserExplosionPotion()); break; case 2: cont.DropItem(new LesserHealPotion()); break; case 3: cont.DropItem(new LesserPoisonPotion()); break; } } if (Utility.RandomDouble() < 0.5) { Item item = Loot.RandomArmorOrShieldOrWeapon(); cont.DropItem(item); } Point3D loc = this.GetRandomSpawnPoint(3); this.AddItem(cont, loc.X, loc.Y, loc.Z); } switch (Utility.Random(2)) { case 0: this.m_Prisoner = new Noble(); break; case 1: this.m_Prisoner = new SeekerOfAdventure(); break; } for (int i = 0; i < 4; i++) { Point3D loc = this.GetRandomSpawnPoint(5); this.AddMobile(this.Camper, 6, loc.X, loc.Y, loc.Z); } Point3D p = this.GetRandomSpawnPoint(3); this.AddMobile(this.m_Prisoner, 0, p.X, p.Y, p.Z); }
public override void AddComponents() { AddItem(new Item(0xFAC), 0, 0, 0); // fire pit AddItem(new Item(0xDE3), 0, 0, 0); // camp fire AddItem(new Item(0x974), 0, 0, 1); // cauldron for (int i = 0; i < 2; i++) { LockableContainer cont = null; switch (Utility.Random(3)) { case 0: cont = new MetalChest(); break; case 1: cont = new WoodenChest(); break; case 2: cont = new SmallCrate(); break; } cont.Movable = false; cont.Locked = true; cont.TrapType = TrapType.ExplosionTrap; cont.TrapPower = Utility.RandomMinMax(30, 40); cont.TrapLevel = 2; cont.RequiredSkill = 76; cont.LockLevel = 66; cont.MaxLockLevel = 116; cont.DropItem(new Gold(Utility.RandomMinMax(100, 400))); cont.DropItem(new Arrow(10)); cont.DropItem(new Bolt(10)); if (Utility.RandomDouble() < 0.8) { switch (Utility.Random(4)) { case 0: cont.DropItem(new LesserCurePotion()); break; case 1: cont.DropItem(new LesserExplosionPotion()); break; case 2: cont.DropItem(new LesserHealPotion()); break; case 3: cont.DropItem(new LesserPoisonPotion()); break; } } if (Utility.RandomDouble() < 0.5) { Item item = Loot.RandomArmorOrShieldOrWeapon(); if (item is BaseWeapon) { BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, 0, Utility.RandomMinMax(1, 5), 10, 100); } else if (item is BaseArmor) { BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, 0, Utility.RandomMinMax(1, 5), 10, 100); } cont.DropItem(item); } Point3D loc = GetRandomSpawnPoint(3); AddItem(cont, loc.X, loc.Y, loc.Z); } switch (Utility.Random(2)) { case 0: m_Prisoner = new Noble(); break; case 1: m_Prisoner = new SeekerOfAdventure(); break; } for (int i = 0; i < 4; i++) { Point3D loc = GetRandomSpawnPoint(5); AddMobile(Camper, 6, loc.X, loc.Y, loc.Z); } Point3D p = GetRandomSpawnPoint(3); AddMobile(m_Prisoner, 0, p.X, p.Y, p.Z); Console.WriteLine(Location.ToString()); }
protected override void OnTarget(Mobile from, object o) { IPoint3D loc = o as IPoint3D; if (loc == null) { return; } if (m_Owner.CheckSequence()) { SpellHelper.Turn(from, o); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc), from.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(from, 0), 0, 5024, 0); Effects.PlaySound(loc, from.Map, 0x1FF); if (o is Mobile) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (o is BaseHouseDoor) // house door check { from.SendMessage("This spell is to unlock certain containers and other types of doors."); } else if (o is BookBox) // cursed box of books { from.SendMessage("This spell can never unlock this cursed box."); } else if (o is UnidentifiedArtifact || o is UnidentifiedItem || o is CurseItem) { from.SendMessage("This spell is used to unlock any container."); } else if (o is BaseDoor) { if (Server.Items.DoorType.IsDungeonDoor((BaseDoor)o)) { if (((BaseDoor)o).Locked == false) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else { ((BaseDoor)o).Locked = false; Server.Items.DoorType.UnlockDoors((BaseDoor)o); } } else { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } } else if (!(o is LockableContainer)) { from.SendLocalizedMessage(501666); // You can't unlock that! } else { LockableContainer cont = (LockableContainer)o; if (Multis.BaseHouse.CheckSecured(cont)) { from.SendLocalizedMessage(503098); // You cannot cast this on a secure item. } else if (!cont.Locked) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (cont.LockLevel == 0) { from.SendLocalizedMessage(501666); // You can't unlock that! } else if (this is TreasureMapChest) { from.SendMessage("A magical aura on this long lost treasure seems to negate your spell."); } else if (this is ParagonChest) { from.SendMessage("A magical aura on this long lost treasure seems to negate your spell."); } else if (this is PirateChest) { from.SendMessage("This seems to be protected from magic, but maybe a thief can get it open."); } else { int level = (int)(from.Skills[SkillName.Magery].Value) + 20; // WIZARD CHANGED FOR WANDS AND SUCH if (level > 50) { level = 50; } // WIZARD ADDED FOR A MAXIMUM SO THIEF IS SPECIAL if (level >= cont.RequiredSkill && !(cont is TreasureMapChest && ((TreasureMapChest)cont).Level > 2)) { cont.Locked = false; if (cont.LockLevel == -255) { cont.LockLevel = cont.RequiredSkill - 10; } } else { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); // My spell does not seem to have an effect on that lock. } } } } m_Owner.FinishSequence(); }
private void AddCampChests() { LockableContainer chest = null; switch (Utility.Random(3)) { case 0: chest = new MetalChest(); break; case 1: chest = new MetalGoldenChest(); break; default: chest = new WoodenChest(); break; } chest.LiftOverride = true; TreasureMapChest.Fill(chest, Utility.Random(10, 40), Utility.Random(1, 2), false, Map.SerpentIsle); //UOSI draws random values for level and luck this.AddItem(chest, -2, 2, 0); LockableContainer crates = null; switch (Utility.Random(4)) { case 0: crates = new SmallCrate(); break; case 1: crates = new MediumCrate(); break; case 2: crates = new LargeCrate(); break; default: crates = new LockableBarrel(); break; } crates.TrapType = TrapType.ExplosionTrap; crates.TrapPower = Utility.RandomMinMax(30, 40); crates.TrapLevel = 2; crates.RequiredSkill = 76; crates.LockLevel = 66; crates.MaxLockLevel = 116; crates.Locked = true; crates.DropItem(new Gold(Utility.RandomMinMax(100, 400))); crates.DropItem(new Arrow(10)); crates.DropItem(new Bolt(10)); crates.LiftOverride = true; if (Utility.RandomDouble() < 0.8) { switch (Utility.Random(4)) { case 0: crates.DropItem(new LesserCurePotion()); break; case 1: crates.DropItem(new LesserExplosionPotion()); break; case 2: crates.DropItem(new LesserHealPotion()); break; default: crates.DropItem(new LesserPoisonPotion()); break; } } this.AddItem(crates, 2, -2, 0); }
public override Item Construct(Type type, Mobile from) { if (type == typeof(TreasureMap)) { int level; //if ( from is PlayerMobile && ((PlayerMobile)from).Young && from.Map == Map.Trammel && TreasureMap.IsInHavenIsland( from ) ) // level = 0; //else level = 1; return(new TreasureMap(level, /*from.Map == Map.Felucca ?*/ Map.Felucca /* : Map.Trammel*/)); } else if (type == typeof(MessageInABottle)) { return(new MessageInABottle(/*from.Map == Map.Felucca ?*/ Map.Felucca /* : Map.Trammel*/)); } Container pack = from.Backpack; if (pack != null) { List <SOS> messages = pack.FindItemsByType <SOS>(); for (int i = 0; i < messages.Count; ++i) { SOS sos = messages[i]; if (from.Map == sos.TargetMap && from.InRange(sos.TargetLocation, 60)) { Item preLoot = null; switch (Utility.Random(8)) { case 0: // Body parts { int[] list = new int[] { 0x1CDD, 0x1CE5, // arm 0x1CE0, 0x1CE8, // torso 0x1CE1, 0x1CE9, // head 0x1CE2, 0x1CEC // leg }; preLoot = new ShipwreckedItem(Utility.RandomList(list)); break; } case 1: // Bone parts { int[] list = new int[] { 0x1AE0, 0x1AE1, 0x1AE2, 0x1AE3, 0x1AE4, // skulls 0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, // bone piles 0x1B15, 0x1B16 // pelvis bones }; preLoot = new ShipwreckedItem(Utility.RandomList(list)); break; } case 2: // Paintings and portraits { preLoot = new ShipwreckedItem(Utility.Random(0xE9F, 10)); break; } case 3: // Pillows { preLoot = new ShipwreckedItem(Utility.Random(0x13A4, 11)); break; } case 4: // Shells { preLoot = new ShipwreckedItem(Utility.Random(0xFC4, 9)); break; } case 5: //Hats { if (Utility.RandomBool()) { preLoot = new SkullCap(); } else { preLoot = new TricorneHat(); } break; } case 6: // Misc { int[] list = new int[] { 0x1EB5, // unfinished barrel 0xA2A, // stool 0xC1F, // broken clock 0x1047, 0x1048, // globe 0x1EB1, 0x1EB2, 0x1EB3, 0x1EB4 // barrel staves }; if (Utility.Random(list.Length + 1) == 0) { preLoot = new Candelabra(); } else { preLoot = new ShipwreckedItem(Utility.RandomList(list)); } break; } } if (preLoot != null) { if (preLoot is IShipwreckedItem) { ((IShipwreckedItem)preLoot).IsShipwreckedItem = true; } return(preLoot); } LockableContainer chest = null; switch (Utility.Random(3)) { case 0: chest = new MetalGoldenChest(); break; case 1: chest = new MetalChest(); break; default: case 2: chest = new WoodenChest(); break; } if (sos.IsAncient) { int hue = 1150; if (0.20 > Utility.RandomDouble()) { switch (Utility.Random((chest is WoodenChest) ? 6 : 14)) { case 0: hue = 1193; break; case 1: hue = 1281; break; case 2: hue = 1190; break; case 3: hue = 1165; break; case 4: hue = 1160; break; case 5: hue = 1126; break; case 6: hue = CraftResources.GetInfo(CraftResource.Valorite).Hue; break; case 7: hue = CraftResources.GetInfo(CraftResource.Verite).Hue; break; case 8: hue = CraftResources.GetInfo(CraftResource.Agapite).Hue; break; case 9: hue = CraftResources.GetInfo(CraftResource.Gold).Hue; break; case 10: hue = CraftResources.GetInfo(CraftResource.Bronze).Hue; break; case 11: hue = CraftResources.GetInfo(CraftResource.Copper).Hue; break; case 12: hue = CraftResources.GetInfo(CraftResource.ShadowIron).Hue; break; case 13: hue = CraftResources.GetInfo(CraftResource.DullCopper).Hue; break; } } chest.Hue = hue; } else if ((chest is MetalChest || chest is MetalGoldenChest) && (0.5 * sos.Level) >= Utility.RandomDouble()) { int randhue = Utility.Random(120); CraftResource resource = CraftResource.None; if (randhue >= 118) { resource = CraftResource.Valorite; } else if (randhue >= 115) { resource = CraftResource.Verite; } else if (randhue >= 110) { resource = CraftResource.Agapite; } else if (randhue >= 100) { resource = CraftResource.Gold; } else if (randhue >= 90) { resource = CraftResource.Bronze; } else if (randhue >= 70) { resource = CraftResource.Copper; } else if (randhue >= 40) { resource = CraftResource.ShadowIron; } else { resource = CraftResource.DullCopper; } chest.Hue = CraftResources.GetInfo(resource).Hue; } int soslevel = Math.Max(1, Math.Max(4, sos.Level)); TreasureMapChest.Fill(chest, soslevel); if (sos.IsAncient) { chest.DropItem(new FabledFishingNet()); } else { chest.DropItem(new SpecialFishingNet()); } chest.Movable = true; chest.Locked = false; chest.Name = "treasure chest"; chest.IsShipwreckedItem = true; if (sos.Level > 0) { chest.TrapType = TrapType.ExplosionTrap; chest.TrapPower = soslevel * Utility.RandomMinMax(5, 15); chest.TrapLevel = 0; } else { chest.TrapType = TrapType.None; chest.TrapPower = 0; chest.TrapLevel = 0; } sos.Delete(); return(chest); } } } return(base.Construct(type, from)); }
public static void LoadItems() { Console.Write("Start Loading items..."); string filePath = "itemstosave.xml"; if (!File.Exists(filePath)) { return; } XmlDocument doc = new XmlDocument(); doc.Load(filePath); XmlElement root = doc["items"]; foreach (XmlElement node in root.GetElementsByTagName("item")) { string itemstring = Utility.GetText(node["type"], null); if (!String.IsNullOrEmpty(itemstring)) { Type itemtype = ScriptCompiler.FindTypeByFullName(itemstring, true); if (itemtype != null) { Item item = Activator.CreateInstance(itemtype) as Item; if (item != null) { item.ItemID = Utility.GetXMLInt32(Utility.GetText(node["itemid"], "0"), 0); item.Hue = Utility.GetXMLInt32(Utility.GetText(node["hue"], "0"), 0); item.Movable = false; int x = Utility.GetXMLInt32(Utility.GetAttribute(node, "x"), 0); int y = Utility.GetXMLInt32(Utility.GetAttribute(node, "y"), 0); int z = Utility.GetXMLInt32(Utility.GetAttribute(node, "z"), 0); Map map = Map.Parse(Utility.GetAttribute(node, "map")); item.MoveToWorld(new Point3D(x, y, z), map); if (item is FillableContainer) { ((FillableContainer)item).ContentType = (FillableContentType)Utility.GetXMLInt32(Utility.GetText(node["contenttype"], "0"), 0); } if (item is LockableContainer) { LockableContainer cont = item as LockableContainer; cont.MaxLockLevel = Utility.GetXMLInt32(Utility.GetText(node["maxlocklevel"], "0"), 0); cont.LockLevel = Utility.GetXMLInt32(Utility.GetText(node["maxlocklevel"], "0"), 0); cont.RequiredSkill = Utility.GetXMLInt32(Utility.GetText(node["maxlocklevel"], "0"), 0); cont.Locked = Utility.GetText(node["locked"], "false") == "true"; cont.TrapOnLockpick = Utility.GetText(node["traponlockpick"], "false") == "true"; } if (item is BaseLight) { BaseLight light = item as BaseLight; light.Protected = Utility.GetText(node["protected"], "true") == "true"; light.Duration = Utility.GetXMLTimeSpan(Utility.GetText(node["duration"], "0"), TimeSpan.Zero); light.Burning = Utility.GetText(node["burning"], "true") == "true"; } } else { Console.WriteLine("Error loading: {0}", itemtype.FullName); } } else { Console.WriteLine("Error loading type from xml: {0}", itemstring); } } else { Console.WriteLine("Error loading string from xml: {0}", itemstring); } } Console.WriteLine("done."); }
private void AddCampChests() { switch (Utility.Random(3)) { case 0: m_Chest = new MetalChest(); break; case 1: m_Chest = new MetalGoldenChest(); break; default: m_Chest = new WoodenChest(); break; } m_Chest.LiftOverride = true; AddItem(m_Chest, -2, 2, 0); switch (Utility.Random(4)) { case 0: m_Crate = new SmallCrate(); break; case 1: m_Crate = new MediumCrate(); break; case 2: m_Crate = new LargeCrate(); break; default: m_Crate = new LockableBarrel(); break; } m_Crate.TrapType = TrapType.ExplosionTrap; m_Crate.TrapPower = Utility.RandomMinMax(30, 40); m_Crate.TrapLevel = 2; m_Crate.RequiredSkill = 76; m_Crate.LockLevel = 66; m_Crate.MaxLockLevel = 116; m_Crate.Locked = true; m_Crate.DropItem(new Gold(Utility.RandomMinMax(100, 400))); m_Crate.DropItem(new Arrow(10)); m_Crate.DropItem(new Bolt(10)); m_Crate.LiftOverride = true; if (Utility.RandomDouble() < 0.8) { switch (Utility.Random(4)) { case 0: m_Crate.DropItem(new LesserCurePotion()); break; case 1: m_Crate.DropItem(new LesserExplosionPotion()); break; case 2: m_Crate.DropItem(new LesserHealPotion()); break; default: m_Crate.DropItem(new LesserPoisonPotion()); break; } } AddItem(m_Crate, 2, -2, 0); }
protected override void OnTarget(Mobile from, object o) { IPoint3D loc = o as IPoint3D; if (loc == null) { return; } if (m_Owner.CheckSequence()) { SpellHelper.Turn(from, o); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc), from.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024); Effects.PlaySound(loc, from.Map, 0x1FF); if (o is Mobile) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (!(o is LockableContainer)) { from.SendLocalizedMessage(501666); // You can't unlock that! } else { LockableContainer cont = (LockableContainer)o; if (Multis.BaseHouse.CheckSecured(cont)) { from.SendLocalizedMessage(503098); // You cannot cast this on a secure item. } else if (!cont.Locked) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (cont.Serrure >= SerrureQuality.Excellente) { from.SendLocalizedMessage(501666); // You can't unlock that! } else { int level = (int)(from.Skills[SkillName.Magery].Value * 0.8) - 4; if (/*level >= cont.RequiredSkill &&*/ !(cont is TreasureMapChest && ((TreasureMapChest)cont).Level > 2)) { cont.Locked = false; /*if ( cont.CrochetageDD == -255 ) * cont.CrochetageDD = cont.RequiredSkill - 10;*/ } else { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); // My spell does not seem to have an effect on that lock. } } } } m_Owner.FinishSequence(); }
protected override void OnTarget(Mobile from, object o) { IEntity entity = o as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, m_Owner)) { return; } IPoint3D loc = o as IPoint3D; if (loc == null) { return; } if (m_Owner.CheckSequence()) { SpellHelper.Turn(from, o); if (o is Mobile) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (!(o is LockableContainer)) { from.SendLocalizedMessage(501666); // You can't unlock that! } else { LockableContainer cont = (LockableContainer)o; if (Multis.BaseHouse.CheckSecured(cont)) { from.SendLocalizedMessage(503098); // You cannot cast this on a secure item. } else if (!cont.Locked) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (cont.LockLevel == 0) { from.SendLocalizedMessage(501666); // You can't unlock that! } else { Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc), from.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024); Effects.PlaySound(loc, from.Map, 0x1FF); int level = (int)(from.Skills[SkillName.Magery].Value * 0.55) - 4; // Note from Alan: I see why somebody changed this from below, so you can't magic unlock a GM tinker chest // but it is also preventing you from picking that lock which is pretty silly //int level = (int)(from.Skills[SkillName.Magery].Value * 0.8) - 4; // <-- this is RunUO default if (cont.LockLevel == -255) // it is magic locked so always succeed at unlocking { cont.Locked = false; cont.LockLevel = cont.RequiredSkill - 10; } else if (level >= cont.RequiredSkill && !(cont is TreasureMapChest && ((TreasureMapChest)cont).Level > 2)) // this is basically a magery skill vs lock level check { cont.Locked = false; } else { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); // My spell does not seem to have an effect on that lock. } } } m_Owner.FinishSequence(); } }
protected override void OnTarget(Mobile from, object o) { IPoint3D loc = o as IPoint3D; if (loc == null) { return; } if (m_Owner.CheckSequence()) { SpellHelper.Turn(from, o); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc), from.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024); Effects.PlaySound(loc, from.Map, 0x17E); if (o is Mobile) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (o is BaseDoor) { if (Server.Items.DoorType.IsDungeonDoor((BaseDoor)o)) { if (((BaseDoor)o).Locked == false) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else { ((BaseDoor)o).Locked = false; Server.Items.DoorType.UnlockDoors((BaseDoor)o); } } else { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } } else if (!(o is LockableContainer)) { from.SendLocalizedMessage(501666); // You can't unlock that! } else { LockableContainer cont = (LockableContainer)o; if (Multis.BaseHouse.CheckSecured(cont)) { from.SendMessage("You cannot use this on a secure item."); } else if (!cont.Locked) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (cont.LockLevel == 0) { from.SendLocalizedMessage(501666); // You can't unlock that! } else { int level = (int)(from.Skills[SkillName.Necromancy].Value); if (level > 90) { level = 90; } if (level >= cont.RequiredSkill && !(cont is TreasureMapChest)) { cont.Locked = false; if (cont.LockLevel == -255) { cont.LockLevel = cont.RequiredSkill - 10; } } else { from.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "This does not seem to work on that lock.", from.NetState); } } } } m_Owner.FinishSequence(); }
protected override void OnTarget(Mobile from, object o) { IPoint3D loc = o as IPoint3D; if (loc == null) { return; } if (this.m_Owner.CheckSequence()) { SpellHelper.Turn(from, o); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc), from.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024); Effects.PlaySound(loc, from.Map, 0x1FF); if (o is Mobile) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (o is IMageUnlockable) { ((IMageUnlockable)o).OnMageUnlock(from); } else if (!(o is LockableContainer)) { from.SendLocalizedMessage(501666); // You can't unlock that! } else { LockableContainer cont = (LockableContainer)o; if (Multis.BaseHouse.CheckSecured(cont)) { from.SendLocalizedMessage(503098); // You cannot cast this on a secure item. } else if (!cont.Locked) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (cont.LockLevel == 0) { from.SendLocalizedMessage(501666); // You can't unlock that! } else if (cont is TreasureMapChest && ((TreasureMapChest)cont).Level > 2) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); // My spell does not seem to have an effect on that lock. } else { int level; int reqSkill; if (cont is TreasureMapChest && TreasureMapInfo.NewSystem) { level = (int)from.Skills[SkillName.Magery].Value; switch (((TreasureMapChest)cont).Level) { default: case 0: reqSkill = 50; break; case 1: reqSkill = 80; break; case 2: reqSkill = 100; break; } } else { level = (int)(from.Skills[SkillName.Magery].Value * 0.8) - 4; reqSkill = cont.RequiredSkill; } if (level >= reqSkill) { cont.Locked = false; if (cont.LockLevel == -255) { cont.LockLevel = cont.RequiredSkill - 10; } } else { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); // My spell does not seem to have an effect on that lock. } } } } this.m_Owner.FinishSequence(); }