protected override void OnTarget(Mobile from, object targeted) { if (m_KeyRing.Deleted || !m_KeyRing.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. return; } if (m_KeyRing == targeted) { m_KeyRing.Open(from); from.SendLocalizedMessage(501685); // You open the keyring. } else if (targeted is ILockable) { ILockable o = (ILockable)targeted; foreach (Key key in m_KeyRing.Keys) { if (key.UseOn(from, o)) { return; } } from.SendLocalizedMessage(1008140); // You do not have a key for that. } else { from.SendLocalizedMessage(501666); // You can't unlock that! } }
protected override void OnTarget(Mobile from, object targeted) { if (m_KeyRing.Deleted || !m_KeyRing.IsChildOf(from.Backpack)) { //from.SendLocalizedMessage( 1060640 ); // The item must be in your backpack to use it. from.SendAsciiMessage("The item must be in your backpack to use it."); return; } if (m_KeyRing == targeted) { m_KeyRing.Open(from); //from.SendLocalizedMessage( 501685 ); // You open the keyring. //from.SendAsciiMessage("You open the keyring."); } else if (targeted is ILockable) { ILockable o = (ILockable)targeted; foreach (Key key in m_KeyRing.Keys) { if (key.UseOn(from, o)) { return; } } //from.SendLocalizedMessage( 1008140 ); // You do not have a key for that. from.SendAsciiMessage("You do not have a key for that."); } else if (targeted is HouseSign) { HouseSign sign = (HouseSign)targeted; foreach (Key key in m_KeyRing.Keys) { if (key.KeyValue == sign.keyValue) { from.SendAsciiMessage("What dost thou wish the sign to say?"); from.Prompt = new HouseRenamePrompt(sign.Owner); return; } } //from.SendLocalizedMessage(1008140); // You do not have a key for that. from.SendAsciiMessage("You do not have a key for that."); } else { from.SendLocalizedMessage(501666); // You can't unlock that! from.SendAsciiMessage("You can't unlock that!"); } }
protected override void OnTarget(Mobile from, object targeted) { if (m_KeyRing.Deleted || !m_KeyRing.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. return; } if (m_KeyRing == targeted) { m_KeyRing.Open(from); from.SendLocalizedMessage(501685); // You open the keyring. } 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); string message = "That does not have a lock."; foreach (Key key in m_KeyRing.Keys) { if (target is ILockable) { if (key.UseOn(from, (ILockable)target)) { message = null; break; } message = "The key does not fit that lock."; continue; } if (itemRegion is Regions.HouseRegion) { Multis.BaseHouse house = ((Regions.HouseRegion)itemRegion).House; if (house == null || !from.Alive || house.Deleted) { continue; } if (target.RootParent != null) { message = "You can not lock that down"; continue; } if (house.HouseKeyVal != key.KeyValue) { message = "You must use the house key to lock down or unlock items."; continue; } if (!target.Movable && !house.IsLockedDown(target)) { message = "You can't unlock that!"; continue; } if (key.OnHouseItemTarget(from, target, ((Regions.HouseRegion)itemRegion).House)) { message = null; break; } } } if (message != null) { from.SendAsciiMessage(message); } } else { from.SendAsciiMessage("You can't use a key on that!"); } }