示例#1
0
        public static bool HasAccess(Mobile mob, RewardList list, out TimeSpan tsAge, out TimeSpan tsGameTime)
        {
            if (list == null)
            {
                tsAge      = TimeSpan.Zero;
                tsGameTime = TimeSpan.Zero;
                return(false);
            }

            Account acct = mob.Account as Account;

            if (acct == null)
            {
                tsAge      = TimeSpan.Zero;
                tsGameTime = TimeSpan.Zero;
                return(false);
            }

            TimeSpan totalTime = (DateTime.Now - acct.Created);

            tsAge      = (list.Age - totalTime);
            tsGameTime = (list.GameTime - acct.TotalGameTime);

            if (tsAge <= TimeSpan.Zero && tsGameTime <= TimeSpan.Zero)
            {
                return(true);
            }

            return(false);
        }
示例#2
0
        public static bool HasAccess(Mobile mob, RewardList list, out TimeSpan ts)
        {
            if (list == null)
            {
                ts = TimeSpan.Zero;
                return(false);
            }

            if (!(mob.Account is Account acct))
            {
                ts = TimeSpan.Zero;
                return(false);
            }

            var totalTime = DateTime.UtcNow - acct.Created;

            ts = list.Age - totalTime;

            if (ts <= TimeSpan.Zero)
            {
                return(true);
            }

            return(false);
        }
示例#3
0
        public static bool HasAccess(Mobile mob, RewardList list, out TimeSpan ts)
        {
            if (list == null)
            {
                ts = TimeSpan.Zero;
                return(false);
            }

            Account acct = mob.Account as Account;

            if (acct == null)
            {
                ts = TimeSpan.Zero;
                return(false);
            }

            TimeSpan totalTime = (DateTime.UtcNow - acct.Created) + TimeSpan.FromDays(RewardInterval.TotalDays * StartingLevel);

            ts = (list.Age - totalTime);

            if (ts <= TimeSpan.Zero)
            {
                return(true);
            }

            return(false);
        }
示例#4
0
		public static bool HasAccess( Mobile mob, RewardList list, out TimeSpan ts )
		{
			if ( list == null )
			{
				ts = TimeSpan.Zero;
				return false;
			}

			Account acct = mob.Account as Account;

			if ( acct == null )
			{
				ts = TimeSpan.Zero;
				return false;
			}

			TimeSpan totalTime = (DateTime.Now - acct.Created);

			ts = ( list.Age - totalTime );

			if ( ts <= TimeSpan.Zero )
				return true;

			return false;
		}
示例#5
0
        public static bool HasAccess(Mobile mob, RewardList list, out TimeSpan ts)
        {
            if (list == null)
            {
                ts = TimeSpan.Zero;
                return(false);
            }

            Account acct = mob.Account as Account;

            if (acct == null)
            {
                ts = TimeSpan.Zero;
                return(false);
            }

            TimeSpan totalTime = (Core.Now - acct.Created);

            ts = (list.Age - totalTime);

            if (ts <= TimeSpan.Zero)
            {
                return(true);
            }

            return(false);
        }
示例#6
0
        public static bool HasAccess(Mobile mob, RewardList list, out TimeSpan ts)
        {
            if (list == null)
            {
                ts = TimeSpan.Zero;
                return false;
            }

            Account acct = mob.Account as Account;

            if (acct == null)
            {
                ts = TimeSpan.Zero;
                return false;
            }

			TimeSpan totalTime = (DateTime.UtcNow - acct.Created) + TimeSpan.FromDays(RewardInterval.TotalDays * StartingLevel);

			ts = (list.Age - totalTime);

            if (ts <= TimeSpan.Zero)
                return true;

            return false;
        }
示例#7
0
        public static int GetRewardYearHue(int hue)
        {
            if (m_Lists == null)
            {
                SetupRewardTables();
            }

            for (int i = 0; i < m_Lists.Length; ++i)
            {
                RewardList    list    = m_Lists[i];
                RewardEntry[] entries = list.Entries;

                for (int j = 0; j < entries.Length; ++j)
                {
                    if (entries[j].Args.Length == 0)
                    {
                        continue;
                    }

                    if (hue.Equals(entries[j].Args[0]))
                    {
                        int level = i + 1;

                        return(1076216 + ((level < 10) ? level : (level < 12) ? ((level - 9) + 4240) : ((level - 11) + 37585)));
                    }
                }
            }

            // no entry?
            return(0);
        }
示例#8
0
    public static int GetRewardYear(Item item, object[] args)
    {
      if (m_Lists == null)
        SetupRewardTables();

      Type type = item.GetType();

      for (int i = 0; i < m_Lists.Length; ++i)
      {
        RewardList list = m_Lists[i];
        RewardEntry[] entries = list.Entries;

        for (int j = 0; j < entries.Length; ++j)
          if (entries[j].ItemType == type)
          {
            if (args == null && entries[j].Args.Length == 0)
              return i + 1;

            if (args.Length == entries[j].Args.Length)
            {
              bool match = true;

              for (int k = 0; match && k < args.Length; ++k)
                match = args[k].Equals(entries[j].Args[k]);

              if (match)
                return i + 1;
            }
          }
      }

      // no entry?
      return 0;
    }
示例#9
0
        public static bool CheckIsUsableBy(Mobile from, Item item, object[] args)
        {
            if (m_Lists == null)
            {
                SetupRewardTables();
            }

            bool isRelaxedRules = (item is DyeTub || item is MonsterStatuette);

            Type type = item.GetType();

            for (int i = 0; i < m_Lists.Length; ++i)
            {
                RewardList    list    = m_Lists[i];
                RewardEntry[] entries = list.Entries;
                TimeSpan      ts;

                for (int j = 0; j < entries.Length; ++j)
                {
                    if (entries[j].ItemType == type)
                    {
                        if (args == null && entries[j].Args.Length == 0)
                        {
                            if ((!isRelaxedRules || i > 0) && !HasAccess(from, list, out ts))
                            {
                                from.SendLocalizedMessage(1008126, true, Math.Ceiling(ts.TotalDays / 30.0).ToString()); // Your account is not old enough to use this item. Months until you can use this item :
                                return(false);
                            }

                            return(true);
                        }

                        if (args.Length == entries[j].Args.Length)
                        {
                            bool match = true;

                            for (int k = 0; match && k < args.Length; ++k)
                            {
                                match = (args[k].Equals(entries[j].Args[k]));
                            }

                            if (match)
                            {
                                if ((!isRelaxedRules || i > 0) && !HasAccess(from, list, out ts))
                                {
                                    from.SendLocalizedMessage(1008126, true, Math.Ceiling(ts.TotalDays / 30.0).ToString()); // Your account is not old enough to use this item. Months until you can use this item :
                                    return(false);
                                }

                                return(true);
                            }
                        }
                    }
                }
            }

            // no entry?
            return(true);
        }
示例#10
0
        public static bool HasAccess(Mobile mob, RewardList list, out TimeSpan ts)
        {
            if (list == null)
            {
                ts = TimeSpan.Zero;
                return(false);
            }

            if (mob.Account is not Account acct)
            {
                ts = TimeSpan.Zero;
                return(false);
            }

            ts = list.Age - acct.AccountAge;

            return(ts <= TimeSpan.Zero);
        }
示例#11
0
        public static bool HasAccess(Mobile mob, RewardList list, out TimeSpan ts)
        {
            if (list == null)
            {
                ts = TimeSpan.Zero;
                return(false);
            }

            if (!(mob.Account is Account acct))
            {
                ts = TimeSpan.Zero;
                return(false);
            }

            ts = list.Age - (Core.Now - acct.Created);

            return(ts <= TimeSpan.Zero);
        }
示例#12
0
        public static int GetRewardYear(Item item, object[] args)
        {
            Type type = item.GetType();

            for (int i = 0; i < Lists.Length; ++i)
            {
                RewardList    list    = Lists[i];
                RewardEntry[] entries = list.Entries;

                for (int j = 0; j < entries.Length; ++j)
                {
                    if (entries[j].ItemType == type)
                    {
                        if (args == null && entries[j].Args.Length == 0)
                        {
                            return(i + 1);
                        }

                        if (args?.Length == entries[j].Args.Length)
                        {
                            bool match = true;

                            for (int k = 0; match && k < args.Length; ++k)
                            {
                                match = args[k].Equals(entries[j].Args[k]);
                            }

                            if (match)
                            {
                                return(i + 1);
                            }
                        }
                    }
                }
            }

            // no entry?
            return(0);
        }