コード例 #1
0
ファイル: TreeStump.cs プロジェクト: FreeReign/imaginenation
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            /*
             * Unique problems have unique solutions.  OSI does not have a problem with 1000s of mining carts
             * due to the fact that they have only a miniscule fraction of the number of 10 year vets that a
             * typical RunUO shard will have (RunUO's scaled down account aging system makes this a unique problem),
             * and the "freeness" of free accounts. We also dont have mitigating factors like inactive (unpaid)
             * accounts not gaining veteran time.
             *
             * The lack of high end vets and vet rewards on OSI has made testing the *exact* ranging/stacking
             * behavior of these things all but impossible, so either way its just an estimation.
             *
             * If youd like your shard's carts/stumps to work the way they did before, simply replace the check
             * below with this line of code:
             *
             * if (!from.InRange(GetWorldLocation(), 2)
             *
             * However, I am sure these checks are more accurate to OSI than the former version was.
             *
             */

            if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this) || !((from.Z - Z) > -3 && (from.Z - Z) < 3))
            {
                from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
            }
            else if (house != null && house.HasSecureAccess(from, SecureLevel.Friends))
            {
                if (m_Logs > 0)
                {
                    Item logs = null;

                    switch (Utility.Random(11))
                    {
                        case 0: logs = new Log(); break;
                        case 1: logs = new AshLog(); break;
                        case 2: logs = new OakLog(); break;
                        case 3: logs = new YewLog(); break;
                        case 4: logs = new HeartwoodLog(); break;
                        case 5: logs = new BloodwoodLog(); break;
                        case 6: logs = new FrostwoodLog(); break;
                        case 7: logs = new MahoganyLog(); break;
                        case 8: logs = new CedarLog(); break;
                        case 9: logs = new WillowLog(); break;
                        case 10: logs = new MystWoodLog(); break;
                    }

                    int amount = Math.Min(10, m_Logs);
                    logs.Amount = amount;

                    if (!from.PlaceInBackpack(logs))
                    {
                        logs.Delete();
                        from.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again.
                    }
                    else
                    {
                        m_Logs -= amount;
                        PublicOverheadMessage(MessageType.Regular, 0, 1094719, m_Logs.ToString()); // Logs: ~1_COUNT~
                    }
                }
                else
                    from.SendLocalizedMessage(1094720); // There are no more logs available.
            }
            else
                from.SendLocalizedMessage(1061637); // You are not allowed to access this.
        }
コード例 #2
0
ファイル: TreeStump.cs プロジェクト: rberiot/imaginenation
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            /*
             * Unique problems have unique solutions.  OSI does not have a problem with 1000s of mining carts
             * due to the fact that they have only a miniscule fraction of the number of 10 year vets that a
             * typical RunUO shard will have (RunUO's scaled down account aging system makes this a unique problem),
             * and the "freeness" of free accounts. We also dont have mitigating factors like inactive (unpaid)
             * accounts not gaining veteran time.
             *
             * The lack of high end vets and vet rewards on OSI has made testing the *exact* ranging/stacking
             * behavior of these things all but impossible, so either way its just an estimation.
             *
             * If youd like your shard's carts/stumps to work the way they did before, simply replace the check
             * below with this line of code:
             *
             * if (!from.InRange(GetWorldLocation(), 2)
             *
             * However, I am sure these checks are more accurate to OSI than the former version was.
             *
             */

            if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this) || !((from.Z - Z) > -3 && (from.Z - Z) < 3))
            {
                from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
            }
            else if (house != null && house.HasSecureAccess(from, SecureLevel.Friends))
            {
                if (m_Logs > 0)
                {
                    Item logs = null;

                    switch (Utility.Random(11))
                    {
                    case 0: logs = new Log(); break;

                    case 1: logs = new AshLog(); break;

                    case 2: logs = new OakLog(); break;

                    case 3: logs = new YewLog(); break;

                    case 4: logs = new HeartwoodLog(); break;

                    case 5: logs = new BloodwoodLog(); break;

                    case 6: logs = new FrostwoodLog(); break;

                    case 7: logs = new MahoganyLog(); break;

                    case 8: logs = new CedarLog(); break;

                    case 9: logs = new WillowLog(); break;

                    case 10: logs = new MystWoodLog(); break;
                    }

                    int amount = Math.Min(10, m_Logs);
                    logs.Amount = amount;

                    if (!from.PlaceInBackpack(logs))
                    {
                        logs.Delete();
                        from.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again.
                    }
                    else
                    {
                        m_Logs -= amount;
                        PublicOverheadMessage(MessageType.Regular, 0, 1094719, m_Logs.ToString()); // Logs: ~1_COUNT~
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1094720); // There are no more logs available.
                }
            }
            else
            {
                from.SendLocalizedMessage(1061637); // You are not allowed to access this.
            }
        }
コード例 #3
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this) || !((from.Z - Z) > -3 && (from.Z - Z) < 3))
            {
                from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045);                 // I can't reach that.
            }
            else if (house != null && house.HasSecureAccess(from, SecureLevel.Friends))
            {
                if (m_Logs > 0)
                {
                    Item logs = null;

                    switch (Utility.Random(14))
                    {
                    case 0: logs = new Log(); break;

                    case 1: logs = new AshLog(); break;

                    case 2: logs = new CherryLog(); break;

                    case 3: logs = new EbonyLog(); break;

                    case 4: logs = new GoldenOakLog(); break;

                    case 5: logs = new HickoryLog(); break;

                    case 6: logs = new MahoganyLog(); break;

                    case 7: logs = new OakLog(); break;

                    case 8: logs = new PineLog(); break;

                    case 9: logs = new RosewoodLog(); break;

                    case 10: logs = new WalnutLog(); break;

                    case 11: logs = new GhostLog(); break;

                    case 12: logs = new PetrifiedLog(); break;

                    case 13: logs = new ElvenLog(); break;
                    }

                    int amount = Math.Min(10, m_Logs);
                    logs.Amount = amount;

                    if (!from.PlaceInBackpack(logs))
                    {
                        logs.Delete();
                        from.SendLocalizedMessage(1078837);                           // Your backpack is full! Please make room and try again.
                    }
                    else
                    {
                        m_Logs -= amount;
                        PublicOverheadMessage(MessageType.Regular, 0, 1094719, m_Logs.ToString());                           // Logs: ~1_COUNT~
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1094720);                       // There are no more logs available.
                }
            }
            else
            {
                from.SendLocalizedMessage(1061637);                   // You are not allowed to access this.
            }
        }