protected override void OnTarget(Mobile from, object targeted) { if (m_Key.Deleted || !m_Key.IsChildOf(from.Backpack)) { //from.SendLocalizedMessage( 501661 ); // That key is unreachable. from.SendAsciiMessage("That key is unreachable"); return; } //int number; if (targeted == m_Key) { //number = 501665; // Enter a description for this key. from.SendAsciiMessage("Enter a description for this key."); from.Prompt = new RenamePrompt(m_Key); } else if (targeted is ILockable) { if (m_Key.UseOn(from, (ILockable)targeted)) { } else { //number = 501668; // This key doesn't seem to unlock that. from.SendAsciiMessage("This key doesn't seem to unlock that."); } } else if (targeted is HouseSign) { HouseSign sign = (HouseSign)targeted; if (m_Key.KeyValue == sign.keyValue) { from.SendAsciiMessage("What dost thou wish the sign to say?"); from.Prompt = new HouseRenamePrompt(sign.Owner); //number = -1; } else { //number = 501666; // You can't unlock that! from.SendAsciiMessage("This key doesn't seem to work on that."); } } else { //number = 501666; // You can't unlock that! from.SendAsciiMessage("You can't unlock that!"); } /*if ( number != -1 ) * { * from.SendLocalizedMessage( number ); * }*/ }
public override void OnResponse(Mobile from, string text) { if (m_Key.Deleted || !m_Key.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(501661); // That key is unreachable. return; } m_Key.Description = Utility.FixHtml(text); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Key.Deleted || !m_Key.IsChildOf(from.Backpack)) { //from.SendLocalizedMessage( 501661 ); // That key is unreachable. from.SendAsciiMessage("That key is unreachable."); return; } //int number; if (targeted is Key) { Key k = (Key)targeted; if (k.m_KeyVal == 0) { //number = 501675; // This key is also blank. from.SendAsciiMessage("This key is also blank."); } else if (from.CheckTargetSkill(SkillName.Tinkering, k, 0, 75.0)) { //number = 501676; // You make a copy of the key. from.SendAsciiMessage("You make a copy of the key."); m_Key.Description = k.Description; m_Key.KeyValue = k.KeyValue; m_Key.Link = k.Link; m_Key.MaxRange = k.MaxRange; } else if (Utility.RandomDouble() <= 0.1) // 10% chance to destroy the key { //from.SendLocalizedMessage( 501677 ); // You fail to make a copy of the key. from.SendAsciiMessage("You fail to make a copy of the key."); //number = 501678; // The key was destroyed in the attempt. from.SendAsciiMessage("The key was destroyed in the attempt."); m_Key.Delete(); } else { //number = 501677; // You fail to make a copy of the key. from.SendAsciiMessage("You fail to make a copy of the key."); } } else { //number = 501688; // Not a key. from.SendAsciiMessage("That is not a key."); } //from.SendLocalizedMessage( number ); }
protected override void OnTarget(Mobile from, object targeted) { int number; if (targeted is Key) { Key k = (Key)targeted; if (!k.IsChildOf(from.Backpack)) { from.SendMessage("The key to be copied must be in your backpack."); return; } if (k.Type == KeyType.Magic) { from.SendLocalizedMessage(501677); // You fail to make a copy of the key. return; } if (k.m_KeyVal == 0) { number = 501675; // This key is also blank. } else if (from.CheckTargetSkill(SkillName.Tinkering, k, 0, 75.0)) { number = 501676; // You make a copy of the key. m_Key.Description = k.Description; m_Key.KeyValue = k.KeyValue; m_Key.Link = k.Link; m_Key.MaxRange = k.MaxRange; } else if (Utility.RandomDouble() <= 0.1) // 10% chance to destroy the key { from.SendLocalizedMessage(501677); // You fail to make a copy of the key. number = 501678; // The key was destroyed in the attempt. m_Key.Delete(); } else { number = 501677; // You fail to make a copy of the key. } } else { number = 501688; // Not a key. } from.SendLocalizedMessage(number); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Key.Deleted || !m_Key.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(501661); // That key is unreachable. return; } int number; if (targeted == m_Key) { number = 501665; // Enter a description for this key. from.Prompt = new RenamePrompt(m_Key); } else if (targeted is ILockable) { if (targeted is Plank && ((Plank)targeted).IsOpen) { ((Item)targeted).SendLocalizedMessageTo(from, 501671); // You cannot currently lock that. return; } if (m_Key.UseOn(from, (ILockable)targeted)) { number = -1; } 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); } }
protected override void OnTarget(Mobile from, object targeted) { // if it's NOT movable, allow use (access check for friends, etc. has already been performed by this point) if (m_Key.Movable) { if (m_Key.Deleted || !m_Key.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(501661); // That key is unreachable. return; } } int number; if (targeted == m_Key) { number = 501665; // Enter a description for this key. from.Prompt = new RenamePrompt(m_Key); } else if (targeted is ILockable) { if (m_Key.UseOn(from, (ILockable)targeted)) { number = -1; } 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); } }
protected override void OnTarget(Mobile from, object targeted) { int number; // rename the key if (targeted == m_Key) { // cannot rename magic keys if (m_Key.Type != KeyType.Magic) { number = 501665; // Enter a description for this key. from.Prompt = new RenamePrompt(m_Key); } else { return; } } else if (targeted is ILockable) { number = -1; ILockable o = (ILockable)targeted; if (o.KeyValue == m_Key.KeyValue) { if (o is BaseDoor && !((BaseDoor)o).UseLocks()) { number = 501668; // This key doesn't seem to unlock that. } else if (o is BaseDoor && !(m_Key.IsChildOf(from.Backpack))) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else { if (o is BaseHouseDoor) { BaseHouse home; home = ((BaseHouseDoor)o).FindHouse(); /*if (home.Public == true) * { * if (o.Locked != true) * from.SendMessage("You cannot lock a public house."); * o.Locked = false; * return; * }*/ } o.Locked = !o.Locked; if (o is LockableContainer) { LockableContainer cont = (LockableContainer)o; if (cont.TinkerMadeTrap) { if (cont.Locked) { cont.TrapEnabled = true; if (cont.TrapType != TrapType.None) { from.SendMessage("You enable the trap."); } } else { cont.TrapEnabled = false; if (cont.TrapType != TrapType.None) { from.SendMessage("You disable the trap."); } } } if (cont.LockLevel == -255) { cont.LockLevel = cont.RequiredSkill - 10; } } if (targeted is Item) { Item item = (Item)targeted; if (o.Locked) { item.SendLocalizedMessageTo(from, 1048000); } else { item.SendLocalizedMessageTo(from, 1048001); } } } } 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); } }
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); } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Key.Deleted || !m_Key.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(501661); // That key is unreachable. return; } if (targeted == m_Key) { from.SendLocalizedMessage(501665); // Enter a description for this key. from.Prompt = new RenamePrompt(m_Key); } else if (!from.InRange(targeted, 3) || !from.InLOS(targeted)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. } else if (targeted is Item) { Item target = (Item)targeted; Region itemRegion = Region.Find(target.Location, target.Map); if (itemRegion is Regions.HouseRegion) { BaseHouse house = ((Regions.HouseRegion)itemRegion).House; if (house == null || !from.Alive || house.Deleted) { return; } if (house.HouseKeyVal == m_Key.KeyValue) { if (target.RootParent != null) { from.SendAsciiMessage("You can not lock that down"); return; } if (target is BaseDoor) { if (m_Key.UseOn(from, (ILockable)targeted)) { return; } from.SendAsciiMessage("The key does not fit that lock"); return; } if (!target.Movable && !house.IsLockedDown(target)) { from.SendAsciiMessage("You can't unlock that!"); return; } if (m_Key.OnHouseItemTarget(from, target, ((Regions.HouseRegion)itemRegion).House)) { return; } } } if (target is ILockable) { if (m_Key.UseOn(from, (ILockable)target)) { return; } from.SendAsciiMessage("The key does not fit that lock"); return; } if (itemRegion is Regions.HouseRegion) { from.SendAsciiMessage(((Regions.HouseRegion)itemRegion).House != null ? "You must use the house key to lock down or unlock items." : "That does not have a lock."); return; } } else { from.SendAsciiMessage("You can't use a key on that!"); } /* * if (targeted is ILockable && m_Key.UseOn(from, (ILockable)targeted)) * number = -1; * else * { * Item target = (Item)targeted; * BaseHouse house = BaseHouse.FindHouseAt(from); * * if (target.RootParent == null) * { * if (house != null ) * { * m_Key.OnHouseItemTarget(from, target, house); * return; * } * } * * from.SendAsciiMessage("That does not have a lock."); * number = -1; * } * } * else * { * number = 501666; // You can't unlock that! * } * if (number != -1) * from.SendLocalizedMessage(number);*/ }