コード例 #1
0
        public override void OnSingleClick(Mobile from)
        {
            if (m_Held == 0)
            {
                LabelTo(from, "a potion keg");
            }
            else
            {
                LabelTo(from, "a potion keg: " + BasePotion.GetName(m_Type));
            }

            if (m_MaxHeld > 100)
            {
                LabelTo(from, "(Capacity: " + m_Held.ToString() + " / " + m_MaxHeld.ToString() + ")");
            }

            else
            {
                double fillPercentage = (float)m_Held / (float)m_MaxHeld;
                int    number;

                if (fillPercentage <= 0)
                {
                    number = 502246; // The keg is empty.
                }
                else if (fillPercentage < .05)
                {
                    number = 502248; // The keg is nearly empty.
                }
                else if (fillPercentage < .20)
                {
                    number = 502249; // The keg is not very full.
                }
                else if (fillPercentage < .30)
                {
                    number = 502250; // The keg is about one quarter full.
                }
                else if (fillPercentage < .40)
                {
                    number = 502251; // The keg is about one third full.
                }
                else if (fillPercentage < .47)
                {
                    number = 502252; // The keg is almost half full.
                }
                else if (fillPercentage < .54)
                {
                    number = 502254; // The keg is approximately half full.
                }
                else if (fillPercentage < .70)
                {
                    number = 502253; // The keg is more than half full.
                }
                else if (fillPercentage < .80)
                {
                    number = 502255; // The keg is about three quarters full.
                }
                else if (fillPercentage < .96)
                {
                    number = 502256; // The keg is very full.
                }
                else if (fillPercentage < 1.0)
                {
                    number = 502257; // The liquid is almost to the top of the keg.
                }
                else
                {
                    number = 502258; // The keg is completely full.
                }
                LabelTo(from, number);
            }
        }