Exemple #1
0
        private static void EventSink_Login(LoginEventArgs e)
        {
            Account acct = e.Mobile.Account as Account;

            if (acct == null)
            {
                return;
            }

            DateTime now = DateTime.UtcNow;

            for (int i = 0; i < m_Givers.Count; ++i)
            {
                GiftGiver giver = m_Givers[i];

                if (now < giver.Start || now >= giver.Finish)
                {
                    continue; // not in the correct timefream
                }
                if (acct.Created > (giver.Start - giver.MinimumAge))
                {
                    continue; // newly created account
                }
                if (acct.LastLogin >= giver.Start)
                {
                    continue; // already got one
                }
                giver.DelayGiveGift(TimeSpan.FromSeconds(5.0), e.Mobile);
            }

            acct.LastLogin = now;
        }
Exemple #2
0
		public static void Register( GiftGiver giver )
		{
			m_Givers.Add( giver );
		}
Exemple #3
0
 public static void Register(GiftGiver giver)
 {
     m_Givers.Add(giver);
 }
Exemple #4
0
        private static void EventSink_Login(LoginEventArgs e)
        {
            Account acct = e.Mobile.Account as Account;

            if (acct == null)
            {
                return;
            }

            DateTime now = DateTime.Now;

            for (int i = 0; i < m_Givers.Count; ++i)
            {
                GiftGiver giver = m_Givers[i];

                if (now < giver.Start || now >= giver.Finish)
                {
                    continue;                     // not in the correct timefream
                }
                if (acct.Created > (giver.Start - giver.MinimumAge))
                {
                    continue;                     // newly created account
                }
                if (acct.LastLogin >= giver.Start)
                {
                    continue;                     // already got one
                }
                giver.DelayGiveGift(TimeSpan.FromSeconds(5.0), e.Mobile);
            }

            //Platinum
            if (acct.LastLogin.Month != now.Month || acct.LastLogin.Year != now.Year)
            {
                double hours = 0;
                int    coins = 0;

                foreach (Mobile m in acct.Mobiles.ToList())
                {
                    PlayerMobile pm = m as PlayerMobile;

                    if (pm != null)
                    {
                        if (pm.MonthlyGameTime.Hours > 500)
                        {
                            pm.MonthlyGameTime = TimeSpan.FromHours(500);
                        }

                        hours += pm.MonthlyGameTime.TotalHours;

                        pm.MonthlyGameTime = TimeSpan.Zero;
                    }
                }

                coins = (int)hours / 50;

                //Not Too young
                if (DateTime.Now - acct.Created > TimeSpan.FromDays(30.0))
                {
                    acct.WalletBalance += coins;
                }
            }

            acct.LastLogin = now;
        }