public bool UseOn(Mobile from, ILockable o) { if (o.KeyValue == this.KeyValue) { if (o is BaseDoor && !((BaseDoor)o).UseLocks()) { return(false); } else { o.Locked = !o.Locked; if (o is LockableContainer) { LockableContainer cont = (LockableContainer)o; if (cont.LockLevel == -255) { cont.LockLevel = cont.RequiredSkill - 10; } } if (o is Item) { Item item = (Item)o; if (o.Locked) { item.SendLocalizedMessageTo(from, 1048000); // You lock it. } else { item.SendLocalizedMessageTo(from, 1048001); // You unlock it. } if (item is LockableContainer) { LockableContainer cont = (LockableContainer)item; if (cont.TrapType != TrapType.None && cont.TrapOnLockpick) { if (o.Locked) { item.SendLocalizedMessageTo(from, 501673); // You re-enable the trap. } else { item.SendLocalizedMessageTo(from, 501672); // You disable the trap temporarily. Lock it again to re-enable it. } } } } return(true); } } else { return(false); } }
protected override void OnTick() { Item item = (Item)m_Item; if (!m_From.InRange(item.GetWorldLocation(), 1)) { if (m_From is PlayerMobile) { ((PlayerMobile)m_From).EndPlayerAction(); } return; } if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255) { // LockLevel of 0 means that the door can't be picklocked // LockLevel of -255 means it's magic locked item.SendLocalizedMessageTo(m_From, 502073); // This lock cannot be picked by normal means if (m_From is PlayerMobile) { ((PlayerMobile)m_From).EndPlayerAction(); } return; } if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill) { // Do some training to gain skills m_From.CheckSkill(SkillName.Lockpicking, 0, m_Item.LockLevel); // The LockLevel is higher thant the LockPicking of the player item.SendLocalizedMessageTo(m_From, 502072); // You don't see how that lock can be manipulated. if (m_From is PlayerMobile) { ((PlayerMobile)m_From).EndPlayerAction(); } return; } if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel)) { // Success! Pick the lock! item.SendLocalizedMessageTo(m_From, 502076); // The lock quickly yields to your skill. m_From.PlaySound(0x4A); m_Item.LockPick(m_From); } else { // The player failed to pick the lock BrokeLockPickTest(); item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock. } if (m_From is PlayerMobile) { ((PlayerMobile)m_From).EndPlayerAction(); } }
protected override void OnTick() { Item item = (Item)m_Item; if (!m_From.InRange(item.GetWorldLocation(), 1)) { return; } if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255) { // LockLevel of 0 means that the door can't be picklocked // LockLevel of -255 means it's magic locked item.SendLocalizedMessageTo(m_From, 502073); // This lock cannot be picked by normal means return; } if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill) { /* * // Do some training to gain skills * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/ // The LockLevel is higher thant the LockPicking of the player double diff = m_Item.RequiredSkill - m_From.Skills[SkillName.Lockpicking].Value; if (diff < 20 && m_From.Skills[SkillName.Lockpicking].Value < 40.0) { Skill m_skill = m_From.Skills[SkillName.Lockpicking]; double chnc = diff / 200; //m_From.SendMessage("chance: {0}", chnc); if (chnc > Utility.RandomDouble()) { Server.Misc.SkillCheck.Gain(m_From, m_skill); } } item.SendLocalizedMessageTo(m_From, 502072); // You don't see how that lock can be manipulated. return; } if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel)) { // Success! Pick the lock! item.SendLocalizedMessageTo(m_From, 502076); // The lock quickly yields to your skill. m_From.PlaySound(0x4A); m_Item.LockPick(m_From); } else { // The player failed to pick the lock BrokeLockPickTest(); item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock. } }
protected override void OnTick() { Item item = (Item)m_Item; Rogue rge = Perk.GetByType <Rogue>((Player)m_From); if (!m_From.InRange(item.GetWorldLocation(), 1)) { return; } if (m_Item.LockLevel == -255) { // LockLevel of -255 means it's magic locked item.SendLocalizedMessageTo(m_From, 502073); // This lock cannot be picked by normal means return; } if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill) { // Do some training to gain skills m_From.CheckSkill(SkillName.Lockpicking, 0, m_Item.LockLevel); // The LockLevel is higher thant the LockPicking of the player item.SendLocalizedMessageTo(m_From, 502072); // You don't see how that lock can be manipulated. return; } if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel)) { // Success! Pick the lock! item.SendLocalizedMessageTo(m_From, 502076); // The lock quickly yields to your skill. m_Item.LockPick(m_From); if (rge == null || !rge.SafeCracker()) { m_From.PlaySound(0x4A); } } else { // The player failed to pick the lock if (rge == null || !rge.SafeCracker()) { BrokeLockPickTest(); } item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock. } }
protected override void OnTick() { Item item = m_Item as Item; if (item != null && !item.Deleted) { if (m_Item.Locked) { if (m_From.InRange(item.GetWorldLocation(), 1)) { if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255) { // LockLevel of 0 means that the door can't be picklocked // LockLevel of -255 means it's magic locked item.SendLocalizedMessageTo(m_From, 502073); // This lock cannot be picked by normal means } else if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill) { /* * // Do some training to gain skills * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/ // The LockLevel is higher than the LockPicking of the player item.SendLocalizedMessageTo(m_From, 502072); // You don't see how that lock can be manipulated. } else if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel)) { // Success! Pick the lock! item.SendLocalizedMessageTo(m_From, 502076); // The lock quickly yields to your skill. m_From.PlaySound(0x4A); m_Item.LockPick(m_From); } else { // The player failed to pick the lock BrokeLockPickTest(); item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock. } } } else { m_From.SendLocalizedMessage(502069); // This does not appear to be locked } } }
protected override void OnTick() { if (!m_From.InRange(((Item)m_Item).GetWorldLocation(), 1)) { return; } if (DateTime.Now >= m_Time) { Item item = (Item)m_Item; if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255) { // LockLevel of 0 means that the door can't be picklocked // LockLevel of -255 means it's magic locked item.SendLocalizedMessageTo(m_From, 502073); // This lock cannot be picked by normal means } else if (m_From.Skills[SkillName.Crochetage].Value < m_Item.RequiredSkill) { m_From.CheckSkill(SkillName.Crochetage, 0, m_Item.LockLevel); // The LockLevel is higher thant the LockPicking of the player item.SendLocalizedMessageTo(m_From, 502072); // You don't see how that lock can be manipulated. } else if (m_From.CheckTargetSkill(SkillName.Crochetage, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel)) { // Success! Pick the lock! item.SendLocalizedMessageTo(m_From, 502076); // The lock quickly yields to your skill. m_From.PlaySound(0x4A); m_Item.LockPick(m_From); } else { // The player failed to pick the lock BrokeLockPickTest(); item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock. } Stop(); m_From.NextSkillTime = Core.TickCount + 10000; // 10 seconds. } else { m_From.PlaySound(0x241); } }
protected override void OnTick() { if (!(m_Item is Item)) { return; } Item item = (Item)m_Item; if (!m_From.InRange(item.GetWorldLocation(), 1)) { return; } if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255) { // LockLevel of 0 means that the door can't be picklocked // LockLevel of -255 means it's magic locked item.SendLocalizedMessageTo(m_From, 502073); // This lock cannot be picked by normal means return; } if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill) { item.SendLocalizedMessageTo(m_From, 502072); // You don't see how that lock can be manipulated. return; } if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel - 1, m_Item.MaxLockLevel)) { item.SendLocalizedMessageTo(m_From, 502076); // The lock quickly yields to your skill. m_From.PlaySound(0x4A); m_Item.LockPick(m_From); m_From.RevealingAction(); } else { if (Utility.Random(3) == 0) { item.SendLocalizedMessageTo(m_From, 502074); // You broke the lockpick. m_From.PlaySound(0x3A4); m_Lockpick.Consume(); } item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock. } }
protected override void OnTick() { m_Table.Remove(m_From); Item item = (Item)this.m_Item; if (!this.m_From.InRange(item.GetWorldLocation(), 1)) { return; } int message = -1; if (this.m_Item.LockLevel == 0 || this.m_Item.LockLevel == -255) { // LockLevel of 0 means that the door can't be picklocked // LockLevel of -255 means it's magic locked item.SendLocalizedMessageTo(this.m_From, 502073); // This lock cannot be picked by normal means return; } else if (!m_Item.IsLockedAndTrappedByPlayer() && m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill) { message = 502072; // You don't see how that lock can be manipulated. } else if (m_Item.CheckAccess(m_From)) { if (m_Lockpick.CheckSuccess(m_From, m_Item)) { message = m_Item.LockPick(m_From); m_Lockpick.OnSuccess(m_From, m_Item); } else { message = m_Item.FailLockPick(m_From); m_Lockpick.OnFailure(m_From, m_Item); } } if (message != -1) { item.SendLocalizedMessageTo(m_From, message); } }
protected void BrokeLockPickTest() { if (Utility.Random(2) == 0) { Item item = (Item)m_Item; // You broke the lockpick. item.SendLocalizedMessageTo(m_From, 502074); m_From.PlaySound(0x3A4); m_Lockpick.Consume(); } }
protected void BrokeLockPickTest() { // When failed, a 25% chance to break the lockpick if (Utility.Random(4) == 0) { Item item = (Item)m_Item; // You broke the lockpick. item.SendLocalizedMessageTo(m_From, 502074); m_From.PlaySound(0x3A4); m_Lockpick.Consume(); } }
protected override void OnTick() { Item item = (Item)m_Item; if (!m_From.InRange(item.GetWorldLocation(), 1)) { return; } item.SendLocalizedMessageTo(m_From, 502076); m_From.PlaySound(0x4A); m_Item.LockPick(m_From); m_From.SendMessage("The key opens the Treasure chest but is now rendered useless"); m_Skey.Delete(); }
protected override void OnTarget(Mobile from, object targeted) { 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) { 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 { o.Locked = !o.Locked; if (o is LockableContainer) { LockableContainer cont = (LockableContainer)o; 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; // 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 OnTick() { Item item = (Item)this.m_Item; if (!this.m_From.InRange(item.GetWorldLocation(), 1)) { return; } if (this.m_Item.LockLevel == 0 || this.m_Item.LockLevel == -255) { // LockLevel of 0 means that the door can't be picklocked // LockLevel of -255 means it's magic locked item.SendLocalizedMessageTo(this.m_From, 502073); // This lock cannot be picked by normal means return; } if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill - m_Lockpick.SkillBonus) { /* * // Do some training to gain skills * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/ // The LockLevel is higher thant the LockPicking of the player item.SendLocalizedMessageTo(this.m_From, 502072); // You don't see how that lock can be manipulated. return; } int maxlevel = m_Item.MaxLockLevel; int minLevel = m_Item.LockLevel; if (m_Item is Skeletonkey) { minLevel -= m_Lockpick.SkillBonus; maxlevel -= m_Lockpick.SkillBonus; //regulars subtract the bonus from the max level } if (m_Lockpick is MasterSkeletonKey || m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, minLevel, maxlevel)) { // Success! Pick the lock! item.SendLocalizedMessageTo(this.m_From, 502076); // The lock quickly yields to your skill. this.m_From.PlaySound(0x4A); this.m_Item.LockPick(this.m_From); } else { // The player failed to pick the lock this.BrokeLockPickTest(); item.SendLocalizedMessageTo(this.m_From, 502075); // You are unable to pick the lock. if (item is TreasureMapChest && ((Container)item).Items.Count > 0 && 0.25 > Utility.RandomDouble()) { Container cont = (Container)item; Item toBreak = cont.Items[Utility.Random(cont.Items.Count)]; if (!(toBreak is Container)) { toBreak.Delete(); Effects.PlaySound(item.Location, item.Map, 0x1DE); m_From.SendMessage(0x20, "The sound of gas escaping is heard from the chest."); } } } }
protected override void OnTarget(Mobile from, object targeted) { int number; if (targeted == m_KeyRing) { number = -1; //remove keys from keyring Item[] keys = m_KeyRing.FindItemsByType(typeof(Key)); foreach (Item i in keys) { if (i is Key) //doublecheck! { if (from is PlayerMobile) { Container b = ((PlayerMobile)from).Backpack; if (b != null) { b.DropItem(i); i.Movable = true; } } } } m_KeyRing.UpdateItemID(); from.SendMessage("You remove all the keys."); } else if (targeted is ILockable) { number = -1; ILockable o = (ILockable)targeted; if (m_KeyRing.IsKeyOnRing(o.KeyValue) && o.KeyValue != 0) { if (o is BaseDoor && !((BaseDoor)o).UseLocks()) { number = 501668; // This key doesn't seem to unlock that. } else if (o is BaseDoor && !(m_KeyRing.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.TrapType != TrapType.None) { if (cont.TrapEnabled) { from.SendMessage("You leave the trap enabled."); } else { from.SendMessage("You leave the trap disabled."); } } } 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 OnTick() { Item item = (Item)m_Item; int m_LockLvl = m_Item.LockLevel - 5; int m_MaxLockLvl = m_Item.MaxLockLevel - 5; if (m_LockLvl <= 0) { m_LockLvl = 1; } if (m_MaxLockLvl <= 0) { m_MaxLockLvl = 1; } if (!m_From.InRange(item.GetWorldLocation(), 1)) { return; } if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255) { // LockLevel of 0 means that the door can't be picklocked // LockLevel of -255 means it's magic locked item.SendLocalizedMessageTo(m_From, 502073); // This lock cannot be picked by normal means return; } if ((m_From.Skills[SkillName.Lockpicking].Value + 5.0) < m_Item.RequiredSkill) { // The LockLevel is higher thant the LockPicking of the player item.SendLocalizedMessageTo(m_From, 502072); // You don't see how that lock can be manipulated. return; } if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_LockLvl, m_MaxLockLvl)) { // Success! Pick the lock! item.SendLocalizedMessageTo(m_From, 502076); // The lock quickly yields to your skill. m_From.PlaySound(0x4A); m_Item.LockPick(m_From); --m_Skey.UsesRemaining; } else { // The player failed to pick the lock item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock. --m_Skey.UsesRemaining; if (m_Skey.UsesRemaining <= 0) { m_From.SendMessage("You have used up your skeleton key"); m_Skey.Delete(); } // ==== Random Item Disintergration upon Failure ==== if ((Core.SA) && m_Item is TreasureMapChest) { int i_Num = 0; Item i_Destroy = null; BaseContainer m_chest = m_Item as BaseContainer; Item Dust = new DustPile(); for (int i = 10; i > 0; i--) { i_Num = Utility.Random(m_chest.Items.Count); // Make sure DustPiles aren't called for destruction if ((m_chest.Items.Count > 0) && m_chest.Items[i_Num] is DustPile) { for (int ci = (m_chest.Items.Count - 1); ci >= 0; ci--) { i_Num = ci; if (i_Num < 0) { i_Num = 0; } if (m_chest.Items[i_Num] is DustPile) { i_Destroy = null; } else { i_Destroy = m_chest.Items[i_Num]; i_Num = i_Num; i = 0; } // Nothing left but Dust if (ci < 0 && i > 0) { i_Destroy = null; i = 0; } } } // Item targetted =+= prepare for object DOOM! >;D else { i_Destroy = m_chest.Items[i_Num]; i = 0; } } // Delete chosen Item and drop a Dust Pile if (i_Destroy is Gold) { if (i_Destroy.Amount > 1000) { i_Destroy.Amount -= 1000; } else { i_Destroy.Delete(); } Dust.Hue = 1177; m_chest.DropItem(Dust); } else if (i_Destroy != null) { i_Destroy.Delete(); m_chest.DropItem(Dust); } Effects.PlaySound(m_chest.Location, m_chest.Map, 0x1DE); m_chest.PublicOverheadMessage(MessageType.Regular, 2004, false, "The sound of gas escaping is heard from the chest."); } } }
protected override void OnTick() { Item item = (Item)m_Item; if (!m_From.InRange(item.GetWorldLocation(), 1)) { return; } bool canPsy = m_From.Competences[CompType.Psychologie].roll(10); foreach (NubiaMobile m in m_From.GetMobilesInRange(6)) { if (m is NubiaPlayer && m != m_From) { if (m.Competences[CompType.PerceptionAuditive].intRoll(false) >= m_From.Competences[CompType.Discretion].intRoll()) { if (canPsy) { m_From.SendMessage("{0} semble vous avoir repérez, vous manquez de discretion !", m.Name); } m_From.PrivateOverheadMessage(Server.Network.MessageType.Emote, 0, false, "*crochète une serrure*", m.NetState); } } } if (m_From.Competences[CompType.Crochetage].getPureMaitrise() < m_Item.MiniMaitrise || m_From.Competences[CompType.Crochetage].getPureMaitrise() + 20 < (int)m_Item.Serrure) { /* * // Do some training to gain skills * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/ // The LockLevel is higher thant the LockPicking of the player m_From.SendMessage("Réussite impossible"); item.SendLocalizedMessageTo(m_From, 502072); // You don't see how that lock can be manipulated. return; } int malus = 0; if (m_Lockpick == null) { malus = -4; m_From.SendMessage("Vous n'avez pas d'outils, malus de circonstance de " + malus.ToString()); } if (m_From.Competences[CompType.Crochetage].roll((int)m_Item.Serrure + malus)) { // Success! Pick the lock! item.SendLocalizedMessageTo(m_From, 502076); // The lock quickly yields to your skill. m_From.PlaySound(0x4A); m_Item.LockPick(m_From); } else { // The player failed to pick the lock item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock. } //Consomation du lockPick if (m_Lockpick != null && !m_From.Competences[CompType.Crochetage].roll((int)m_Item.Serrure)) { BrokeLockPickTest(); } }
protected override void OnTarget(Mobile from, object targeted) { if (m_KeyRing.Deleted || !m_KeyRing.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. return; } int number; if (targeted == m_KeyRing) { number = -1; //remove keys from keyring List <Key> list = new List <Key>(m_KeyRing.Keys); foreach (Key i in list) { if (i is Key) { if (from is PlayerMobile) { Container b = ((PlayerMobile)from).Backpack; if (b != null) { if (m_KeyRing.Keys.Contains(i)) { m_KeyRing.Keys.Remove(i); } b.DropItem(i); } } } } m_KeyRing.UpdateItemID(); from.SendMessage("You remove all the keys."); } else if (targeted is ILockable) { number = -1; ILockable o = (ILockable)targeted; if (m_KeyRing.IsKeyOnRing(o.KeyValue) && o.KeyValue != 0) { if (o is BaseDoor && !((BaseDoor)o).UseLocks()) { //number = 501668; // This key doesn't seem to unlock that. number = 1008140; // You do not have a key for that. } else { #region PUBLIC HOUSE (disabled) /*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; * } * }*/ #endregion o.Locked = !o.Locked; if (o is LockableContainer) { LockableContainer cont = (LockableContainer)o; if (Core.Publish < 4 || Core.UOAI || Core.UOAR) { // old-school traps (< publish 4) if (cont.TrapEnabled) { from.SendMessage("You leave the trap enabled."); } else { // only give a message if trapped (even if it's disabled.) if (cont.TrapType != TrapType.None) { from.SendMessage("You leave the trap disabled."); } } } else { // new-style traps (>= publish 4) if (cont.TrapType != TrapType.None) { if (cont.Locked) { if (Core.NewStyleTinkerTrap) // last person to lock trap is 'owner' { cont.Owner = from; } cont.TrapEnabled = true; (o as LockableContainer).SendLocalizedMessageTo(from, 501673); // You re-enable the trap. } else { cont.TrapEnabled = false; (o as LockableContainer).SendLocalizedMessageTo(from, 501672); // You disable the trap temporarily. Lock it again to re-enable it. } } } 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. number = 1008140; // You do not have a key for 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; 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.Locked) { o.Locked = false; if (targeted is Item) { Item item = (Item)targeted; item.SendLocalizedMessageTo(from, 1048001); // or 1048000 } // counter int remain = m_Key.MaxUses - ++m_Key.codeUses; switch (remain) { default: { from.SendMessage("You force the key to turn the lock"); break; } case 2: { from.SendMessage("The key bends as it opens the lock"); break; } case 1: { from.SendMessage("The lock opens but the key is cracked"); break; } case 0: { from.SendMessage("The lock opens but the key breaks in your hand"); if (m_Key != null) { m_Key.Delete(); } break; } } m_Key.InvalidateProperties(); // lock door new RelockTimer(from, o, m_Key.RelockDelay).Start(); } } } 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 (targeted == m_Key) { number = 501665; // Enter a description for this key. from.Prompt = new RenamePrompt(m_Key); } else if (targeted is StrongBox) { StrongBox sb = (StrongBox)targeted; if (sb.Owner == null || sb.Owner.Deleted) { from.SendAsciiMessage("You can not recover that strong box."); return; } if (sb.Owner == from || sb.Owner.Account == from.Account) { while (sb.Items.Count > 0) { ((Item)sb.Items[0]).MoveToWorld(sb.Location, sb.Map); } sb.Delete(); from.AddToBackpack(new StrongBoxDeed()); } else { from.SendAsciiMessage("You do not own that strong box."); } } else if (targeted is ILockable) { 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 { o.Locked = !o.Locked; 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 if (targeted is HouseSign) { HouseSign sign = (HouseSign)targeted; if (sign.Owner != null && sign.Owner.KeyValue == m_Key.KeyValue) { from.Prompt = new Prompts.HouseRenamePrompt(sign.Owner); number = 1060767; // Enter the new name of your house. } } else { number = 501666; // You can't unlock that! } if (number != -1) { from.SendLocalizedMessage(number); } }
protected override void OnTick() { Item item = (Item)m_Item; if (!m_From.InRange(item.GetWorldLocation(), 1)) { return; } if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255) { // LockLevel of 0 means that the door can't be picklocked // LockLevel of -255 means it's magic locked item.SendLocalizedMessageTo(m_From, 502073); // This lock cannot be picked by normal means return; } if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill) { /* * // Do some training to gain skills * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/ // The LockLevel is higher thant the LockPicking of the player m_From.SendMessage("Trying to manipulate the contraption resulted in a broken lockpick."); m_Lockpick.Consume(); return; } if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel)) { // Success! Pick the lock! m_From.SendMessage("Woot! You succeed at picking the lock."); m_From.PlaySound(0x4A); m_Item.LockPick(m_From); } else { // The player failed to pick the lock BrokeLockPickTest(); item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock. // ==== Random Item Disintergration upon Failure ==== if ((Core.SA) && m_Item is TreasureMapChest) { int i_Num = 0; Item i_Destroy = null; BaseContainer m_chest = m_Item as BaseContainer; Item Dust = new DustPile(); for (int i = 10; i > 0; i--) { i_Num = Utility.Random(m_chest.Items.Count); // Make sure DustPiles aren't called for destruction if ((m_chest.Items.Count > 0) && m_chest.Items[i_Num] is DustPile) { for (int ci = (m_chest.Items.Count - 1); ci >= 0; ci--) { i_Num = ci; if (i_Num < 0) { i_Num = 0; } if (m_chest.Items[i_Num] is DustPile) { i_Destroy = null; } else { i_Destroy = m_chest.Items[i_Num]; i_Num = i_Num; i = 0; } // Nothing left but Dust if (ci < 0 && i > 0) { i_Destroy = null; i = 0; } } } // Item targetted =+= prepare for object DOOM! >;D else { i_Destroy = m_chest.Items[i_Num]; i = 0; } } // Delete chosen Item and drop a Dust Pile if (i_Destroy is Gold) { if (i_Destroy.Amount > 1000) { i_Destroy.Amount -= 1000; } else { i_Destroy.Delete(); } Dust.Hue = 1177; m_chest.DropItem(Dust); } else if (i_Destroy != null) { i_Destroy.Delete(); m_chest.DropItem(Dust); } Effects.PlaySound(m_chest.Location, m_chest.Map, 0x1DE); m_chest.PublicOverheadMessage(MessageType.Regular, 2004, false, "The sound of gas escaping is heard from the chest."); } } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted == m_KeyRing) { from.SendLocalizedMessage(501685); // You open the keyring. m_KeyRing.ItemID = 0x1011; foreach (KeyInfo k in m_KeyRing.Keys) { Key key = new Key(k.type, k.KeyValue, k.Link); key.Description = k.Description; from.AddToBackpack(key); } m_KeyRing.Keys.Clear(); } else if (targeted is Item) { Item item = (Item)targeted; ILockable locker = targeted as ILockable; if (locker != null) { bool IsMatch = false; foreach (KeyInfo key in m_KeyRing.Keys) { if (key.KeyValue == locker.KeyValue) { IsMatch = true; break; } } if (IsMatch) { if (locker.Locked) { locker.Locked = false; item.SendLocalizedMessageTo(from, 1008137, item.Name); // Unlocked : } else { locker.Locked = true; item.SendLocalizedMessageTo(from, 1008136, item.Name); // Locked : } } else { from.SendLocalizedMessage(1008140); // You do not have a key for that. } } else { item.SendLocalizedMessageTo(from, 1008140); // You do not have a key for that. } } else if (targeted is Mobile) { Mobile m = targeted as Mobile; m.Say(1008140); // You do not have a key for that. } }
protected virtual void EndLockpick(object state) { object[] objs = (object[])state; ILockpickable lockpickable = objs[0] as ILockpickable; Mobile from = objs[1] as Mobile; Item item = (Item)lockpickable; if (!from.InRange(item.GetWorldLocation(), 1)) { return; } if (lockpickable.LockLevel == 0 || lockpickable.LockLevel == -255) { // LockLevel of 0 means that the door can't be picklocked // LockLevel of -255 means it's magic locked item.SendLocalizedMessageTo(from, 502073); // This lock cannot be picked by normal means return; } if (from.Skills[SkillName.Lockpicking].Value < lockpickable.RequiredSkill - SkillBonus) { /* * // Do some training to gain skills * from.CheckSkill( SkillName.Lockpicking, 0, lockpickable.LockLevel );*/ // The LockLevel is higher thant the LockPicking of the player item.SendLocalizedMessageTo(from, 502072); // You don't see how that lock can be manipulated. return; } int maxlevel = lockpickable.MaxLockLevel; int minLevel = lockpickable.LockLevel; if (lockpickable is Skeletonkey) { minLevel -= SkillBonus; maxlevel -= SkillBonus; //regulars subtract the bonus from the max level } if (this is MasterSkeletonKey || from.CheckTargetSkill(SkillName.Lockpicking, lockpickable, minLevel, maxlevel)) { // Success! Pick the lock! OnUse(); item.SendLocalizedMessageTo(from, 502076); // The lock quickly yields to your skill. from.PlaySound(0x4A); lockpickable.LockPick(from); } else { // The player failed to pick the lock BrokeLockPickTest(from); item.SendLocalizedMessageTo(from, 502075); // You are unable to pick the lock. if (item is TreasureMapChest && ((Container)item).Items.Count > 0 && 0.25 > Utility.RandomDouble()) { Container cont = (Container)item; Item toBreak = cont.Items[Utility.Random(cont.Items.Count)]; if (!(toBreak is Container)) { toBreak.Delete(); Effects.PlaySound(item.Location, item.Map, 0x1DE); from.SendMessage(0x20, "The sound of gas escaping is heard from the chest."); } } } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted == m_KeyRing) { from.SendLocalizedMessage(501685); // You open the keyring. m_KeyRing.ItemID = 0x1011; foreach (KeyInfo k in m_KeyRing.Keys) { Key key = new Key(k.type, k.KeyValue, k.Link); key.Description = k.Description; from.AddToBackpack(key); } m_KeyRing.Keys.Clear(); } else if (targeted is ILockable) { ILockable o = (ILockable)targeted; bool KeyMatched = false; foreach (KeyInfo key in m_KeyRing.Keys) { if (key.KeyValue == o.KeyValue) { KeyMatched = true; break; } } if (KeyMatched) { if (o is BaseDoor && !((BaseDoor)o).UseLocks()) { from.SendLocalizedMessage(1008140); // You do not have a key for that. } else { o.Locked = !o.Locked; if (o is LockableContainer) { LockableContainer cont = (LockableContainer)o; if (cont.LockLevel == -255) { cont.LockLevel = cont.RequiredSkill - 10; } } if (targeted is Item) { Item item = (Item)targeted; if (o.Locked) { item.SendLocalizedMessageTo(from, 1048000); // You lock it } else { item.SendLocalizedMessageTo(from, 1048001); // You unlock it. } } } } else { 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) { 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); } }