Beispiel #1
0
                protected override void OnTick()
                {
                    Item item = (Item)m_Item;

                    if (m_From.Skills[SkillName.Lockpicking].Base < 1)
                    {
                        int cycle = 10;

                        while (cycle > 0)
                        {
                            cycle--;
                            m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, 0, 10);
                        }
                    }

                    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
                        if (m_Lockpick.ItemID == 0x3A75)
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "This lock cannot be hacked by normal means.", m_From.NetState);
                        }
                        else
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "This lock cannot be picked by normal means.", m_From.NetState);
                        }

                        return;
                    }

                    if ((m_From.Skills[SkillName.Lockpicking].Value + 2) < 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
                        if (m_Lockpick.ItemID == 0x3A75)
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "You don't see how that lock can be hacked.", m_From.NetState);
                        }
                        else
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "You don't see how that lock can be manipulated.", m_From.NetState);
                        }
                        return;
                    }

                    if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel))
                    {
                        // Success! Pick the lock!
                        if (m_Lockpick.ItemID == 0x3A75)
                        {
                            m_From.PlaySound(0x54B); m_From.PrivateOverheadMessage(0, 1150, false, "Your skill at hacking worked.", m_From.NetState);
                        }
                        else
                        {
                            m_From.PlaySound(0x4A); m_From.PrivateOverheadMessage(0, 1150, false, "The lock quickly yields to your skill.", m_From.NetState);
                        }

                        m_Item.LockPick(m_From);
                    }
                    else
                    {
                        // The player failed to pick the lock
                        BrokeLockPickTest();

                        if (m_Lockpick.ItemID == 0x3A75)
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "You are unable to hack the lock.", m_From.NetState);
                        }
                        else
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "You are unable to pick the lock.", m_From.NetState);
                        }

                        // ==== Random Item Disintergration upon Failure ====
                        if (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         = 0;
                                        }
                                        // Nothing left but Dust
                                        if (ci < 0 && i > 0)
                                        {
                                            i_Destroy = null; i = 0;
                                        }
                                    }
                                }
                                // Item targeted =+= 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.");
                        }
                    }
                }
Beispiel #2
0
                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;
                    }

                    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.");
                        }
                    }
                }