예제 #1
0
        public override void OnSingleClick(Mobile from)
        {
            try
            {
                base.OnSingleClick(from);
                bool valid = m_BaseHouse.Owner != null && m_BaseHouse.Owner.Account != null;

                // Display decay info to owner or Counselor+
                if (from.AccessLevel >= AccessLevel.Counselor)
                {
                    this.LabelTo(from, string.Format("[Staff Info Only] This tent will fall apart at {0}", DateTime.Now + TimeSpan.FromMinutes(m_BaseHouse.DecayMinutesStored)));
                }
                else if (valid && from.Account == m_BaseHouse.Owner.Account)
                {
                    TimeSpan decay = m_BaseHouse.StructureDecayTime - DateTime.Now;
                    int      days  = decay.Days;
                    double   hours = decay.Hours;
                    hours += ((double)decay.Minutes) / 60;
                    string decaystring = string.Format("{0} days, {1:0.0} hours", days, hours);

                    base.LabelTo(from, "This tent will fall apart in " + decaystring);
                }
                else
                {
                    base.LabelTo(from, m_BaseHouse.DecayState());
                }
            }
            catch (Exception e)
            {
                LogHelper.LogException(e);
            }
        }