public void Target( TrapableContainer item ) { if ( !Caster.CanSee( item ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( item.Trapped && item.TrapType != TrapType.MagicTrap ) { base.DoFizzle(); } else if ( CheckSequence() ) { SpellHelper.Turn( Caster, item ); Point3D loc = item.GetWorldLocation(); Effects.SendLocationParticles( EffectItem.Create( loc, item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, 5015 ); Effects.PlaySound( loc, item.Map, 0x1F0 ); item.TrapType = TrapType.None; item.Trapped = false; item.TrapPower = 0; } FinishSequence(); }
public void Target( TrapableContainer item ) { if ( !Caster.CanSee( item ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap ) { base.DoFizzle(); } else if ( CheckSequence() ) { SpellHelper.Turn( Caster, item ); Point3D loc = item.GetWorldLocation(); Effects.SendLocationParticles( EffectItem.Create( loc, item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, 5015 ); Effects.PlaySound( loc, item.Map, 0x1F0 ); TreasureMapChest chest = item as TreasureMapChest; double skill = Caster.Skills[SkillName.Magery].Value; if ( ( chest != null && skill >= 100.0 && chest.TrapLevel <= 2 ) || ( chest == null && ( ( item.TrapCreator == null && item.TrapLevel <= (int)(skill/33.3) ) || ( item.TrapCreator != null && item.TrapLevel <= (int)(skill/20.0) ) ) ) ) { //Treasure Chests: Must be GM, up to level 2 //Non Treasure Chests: Up to level 3, Player constructed, up to level 5. item.TrapType = TrapType.None; item.TrapPower = 0; item.TrapLevel = 0; } } FinishSequence(); }
public void Target(TrapableContainer item) { if (!Caster.CanSee(item)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap) { base.DoFizzle(); } else if (CheckSequence()) { SpellHelper.Turn(Caster, item); item.TrapType = TrapType.MagicTrap; item.TrapPower = Core.AOS ? Utility.RandomMinMax(10, 50) : 1; item.TrapLevel = 0; Point3D loc = item.GetWorldLocation(); Effects.SendLocationParticles( EffectItem.Create( new Point3D( loc.X + 1, loc.Y, loc.Z ), item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 9502 ); Effects.SendLocationParticles( EffectItem.Create( new Point3D( loc.X, loc.Y - 1, loc.Z ), item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 9502 ); Effects.SendLocationParticles( EffectItem.Create( new Point3D( loc.X - 1, loc.Y, loc.Z ), item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 9502 ); Effects.SendLocationParticles( EffectItem.Create( new Point3D( loc.X, loc.Y + 1, loc.Z ), item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 9502 ); Effects.SendLocationParticles( EffectItem.Create( new Point3D( loc.X, loc.Y, loc.Z ), item.Map, EffectItem.DefaultDuration ), 0, 0, 0, 5014 ); Effects.PlaySound(loc, item.Map, 0x1EF); } FinishSequence(); }
public void Target(TrapableContainer item) { if (!Caster.CanSee(item)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap) { base.DoFizzle(); } else if (CheckSequence()) { SpellHelper.Turn(Caster, item); var pouch = item as ChargeableTrapPouch; if (pouch != null) { if (pouch.Charges == 0) { item.TrapType = TrapType.MagicTrap; item.TrapPower = Caster.EraAOS ? Utility.RandomMinMax(10, 50) : 4; //Change to depend on magery skill? item.TrapLevel = 0; pouch.Charges++; } else if (pouch.Charges < 30) { pouch.Charges++; } else { Caster.SendMessage(54, "This pouch can only hold 30 charges."); } } else { item.TrapType = TrapType.MagicTrap; item.TrapPower = Caster.EraAOS ? Utility.RandomMinMax(10, 50) : 4; //Change to depend on magery skill? item.TrapLevel = 0; } Point3D loc = item.GetWorldLocation(); Effects.SendLocationParticles( EffectItem.Create(new Point3D(loc.X + 1, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles( EffectItem.Create(new Point3D(loc.X, loc.Y - 1, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles( EffectItem.Create(new Point3D(loc.X - 1, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles( EffectItem.Create(new Point3D(loc.X, loc.Y + 1, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles( EffectItem.Create(new Point3D(loc.X, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0, 0, 0, 5014); Effects.PlaySound(loc, item.Map, 0x1EF); } FinishSequence(); }
protected override void OnTarget(Mobile from, object targeted) { if (!m_Key.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. } else if (targeted == m_Key) { from.SendMessage("This torch is to melt locks and traps on most chests."); } else if (targeted is BaseHouseDoor) // house door check { from.SendMessage("This torch is to melt locks and traps on most chests."); } else if (targeted is BookBox) // cursed box of books { from.SendMessage("This torch can never penetrate the magic of this cursed box."); } else if (targeted is UnidentifiedArtifact || targeted is UnidentifiedItem || targeted is CurseItem) { from.SendMessage("This torch is to melt locks and traps on most chests."); } else if (targeted is BaseDoor) { if (Server.Items.DoorType.IsDungeonDoor((BaseDoor)targeted)) { if (((BaseDoor)targeted).Locked == false) { from.SendMessage("That does not need to be unlocked."); } else { ((BaseDoor)targeted).Locked = false; Server.Items.DoorType.UnlockDoors((BaseDoor)targeted); from.RevealingAction(); from.PlaySound(0x227); m_Key.Consume(); } } else { from.SendMessage("That does not need to be unlocked."); } } else if (targeted is ILockable) { ILockable o = (ILockable)targeted; LockableContainer cont2 = (LockableContainer)o; TrapableContainer cont3 = (TrapableContainer)o; if ((o.Locked) || (cont3.TrapType != TrapType.None)) { if (o is BaseDoor && !((BaseDoor)o).UseLocks()) // this seems to check house doors also { from.SendMessage("This torch is to melt locks and traps on most chests."); } else if (targeted is TreasureMapChest) { from.SendMessage("The torch seems to have done nothing to the mechanism inside."); m_Key.Consume(); } else if (100 >= cont2.RequiredSkill) { o.Locked = false; if (o is LockableContainer) { LockableContainer cont = (LockableContainer)o; if (cont.LockLevel == -255) { cont.LockLevel = cont.RequiredSkill - 10; if (cont.LockLevel == 0) { cont.LockLevel = -1; } } cont.Picker = from; // sets "lockpicker" to the user. } if (o is TrapableContainer) { TrapableContainer cont = (TrapableContainer)o; if (cont.TrapType != TrapType.None) { cont.TrapType = TrapType.None; } } if (targeted is Item) { Item item = (Item)targeted; from.SendMessage("The torch seems to have melted the mechanism inside."); } from.RevealingAction(); from.PlaySound(0x227); m_Key.Consume(); } else if ((cont3.TrapType != TrapType.None) && (cont3.TrapLevel > 0)) { if (o is TrapableContainer) { TrapableContainer cont = (TrapableContainer)o; if (cont.TrapType != TrapType.None) { cont.TrapType = TrapType.None; } } if (targeted is Item) { Item item = (Item)targeted; from.SendMessage("The torch seems to have melted the mechanism inside."); } from.RevealingAction(); from.PlaySound(0x227); m_Key.Consume(); } else { from.SendMessage("The torch seems to have done nothing to the mechanism inside."); m_Key.Consume(); } } else { from.SendMessage("You don't need to use torch on that."); } } else { from.SendMessage("This torch is to melt locks and traps on most chests."); } }
protected override void OnTarget(Mobile from, object targeted) { if (!m_Key.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. } else if (targeted == m_Key) { from.SendMessage("This acid is to dissolve locks and traps on most chests."); } else if (targeted is BaseHouseDoor) // house door check { from.SendMessage("This acid is to dissolve locks and traps on most chests."); } else if (targeted is BookBox) // cursed box of books { from.SendMessage("This acid can never penetrate the magic of this cursed box."); } else if (targeted is UnidentifiedArtifact || targeted is UnidentifiedItem || targeted is CurseItem) { from.SendMessage("This acid is to dissolve locks and traps on most chests."); } else if (targeted is BaseDoor) { if (Server.Items.DoorType.IsDungeonDoor((BaseDoor)targeted)) { if (((BaseDoor)targeted).Locked == false) { from.SendMessage("That does not need to be unlocked."); } else { ((BaseDoor)targeted).Locked = false; Server.Items.DoorType.UnlockDoors((BaseDoor)targeted); from.RevealingAction(); from.PlaySound(0x231); if (m_Key.ItemID == 0x1007) { from.AddToBackpack(new Jar()); } else { from.AddToBackpack(new Bottle()); } m_Key.Consume(); } } else { from.SendMessage("That does not need to be unlocked."); } } else if (targeted is Head) { if (((Item)targeted).ItemID == 7584 || ((Item)targeted).ItemID == 7393) { from.RevealingAction(); from.PlaySound(0x231); if (m_Key.ItemID == 0x1007) { from.AddToBackpack(new Jar()); } else { from.AddToBackpack(new Bottle()); } m_Key.Consume(); ((Item)targeted).ItemID = 0x1AE0; if ((((Item)targeted).Name).Contains(" head ")) { (((Item)targeted).Name) = (((Item)targeted).Name).Replace(" head ", " skull "); } from.SendMessage("The acid melts the skin away, leaving only a skull."); } else { from.SendMessage("Someone already used acid to melt the skin away."); } } else if (targeted is ILockable) { ILockable o = (ILockable)targeted; LockableContainer cont2 = (LockableContainer)o; TrapableContainer cont3 = (TrapableContainer)o; if ((o.Locked) || (cont3.TrapType != TrapType.None)) { if (o is BaseDoor && !((BaseDoor)o).UseLocks()) // this seems to check house doors also { from.SendMessage("This acid is to dissolve locks and traps on most chests."); } else if (targeted is TreasureMapChest) { from.SendMessage("The acid seems to have done nothing to the mechanism inside."); m_Key.Consume(); } else if (100 >= cont2.RequiredSkill) { o.Locked = false; if (o is LockableContainer) { LockableContainer cont = (LockableContainer)o; if (cont.LockLevel == -255) { cont.LockLevel = cont.RequiredSkill - 10; if (cont.LockLevel == 0) { cont.LockLevel = -1; } } cont.Picker = from; // sets "lockpicker" to the user. } if (o is TrapableContainer) { TrapableContainer cont = (TrapableContainer)o; if (cont.TrapType != TrapType.None) { cont.TrapType = TrapType.None; } } if (targeted is Item) { Item item = (Item)targeted; from.SendMessage("The acid seems to have eaten away at the mechanism inside."); } from.RevealingAction(); from.PlaySound(0x231); if (m_Key.ItemID == 0x1007) { from.AddToBackpack(new Jar()); } else { from.AddToBackpack(new Bottle()); } m_Key.Consume(); } else if ((cont3.TrapType != TrapType.None) && (cont3.TrapLevel > 0)) { if (o is TrapableContainer) { TrapableContainer cont = (TrapableContainer)o; if (cont.TrapType != TrapType.None) { cont.TrapType = TrapType.None; } } if (targeted is Item) { Item item = (Item)targeted; from.SendMessage("The acid seems to have eaten away at the mechanism inside."); } from.RevealingAction(); from.PlaySound(0x231); if (m_Key.ItemID == 0x1007) { from.AddToBackpack(new Jar()); } else { from.AddToBackpack(new Bottle()); } m_Key.Consume(); } else { from.SendMessage("The acid seems to have done nothing to the mechanism inside."); m_Key.Consume(); } } else { from.SendMessage("You don't need to use acid on that."); } } else { from.SendMessage("This acid is to dissolve locks and traps on most chests."); } }
protected override void OnTarget(Mobile from, object targeted) { int number = -1; if (!m_Key.IsChildOf(from.Backpack)) { number = 1060640; // The item must be in your backpack to use it. } else if (targeted == m_Key) { number = 501666; // You can't unlock that! } // I added this. The basedoor check below "if ( o.Locked )" also seemed to check for housedoor type situations. else if (targeted is BaseHouseDoor) // house door check { number = 501666; // You can't unlock that! } // does this do what I think it does? edit: Nope, don't work at all. :> // Seems unnecessary tho, basic testing already showed secures seem to be OK, but better safe than sorry. // else if ( targeted is LockableContainer && !((LockableContainer)targeted).UseLocks() ) // secure container check?? // { // number = 501666; // You can't unlock that! // } else if (targeted is ILockable) { ILockable o = (ILockable)targeted; if (o.Locked) { if (o is BaseDoor && !((BaseDoor)o).UseLocks()) // this seems to check house doors also { number = 501668; // This key doesn't seem to unlock that. } else { o.Locked = false; if (o is LockableContainer) { LockableContainer cont = (LockableContainer)o; if (cont.LockLevel == -255) { cont.LockLevel = cont.RequiredSkill - 10; } cont.Picker = from; // new, sets "lockpicker" to the user. } // Traps don't seem to get disabled at all in the regular key.cs. Bug? if (o is TrapableContainer) { TrapableContainer cont = (TrapableContainer)o; if (cont.TrapType != TrapType.None) { cont.TrapType = TrapType.None; // this stumped me for reasons I don't care to admit. :> } } if (targeted is Item) { Item item = (Item)targeted; item.SendLocalizedMessageTo(from, 1048001); // you unlock it } // m_Key.Delete(); // I think this is a no-no. m_Key.Consume(); // bye bye key =) from.SendMessage("The magic key vanishes!"); } } else { number = 501668; // This key doesn't seem to unlock that. } } else { number = 501666; // You can't unlock that! } if (number != -1) { from.SendLocalizedMessage(number); } }
public InternalTimer(Mobile from, TrapableContainer targeted) : base(TimeSpan.FromSeconds(5.0)) { m_From = from; m_Targeted = targeted; if (from is PlayerMobile) ((PlayerMobile)from).ResetPlayerAction(this); }