예제 #1
0
        // hot-swap prevention
        public static bool IPStillHot(Server.Accounting.Account acct, IPAddress ourAddress)
        {
            if (!Enabled)
            {
                return(false);
            }

            int count = 0;

            for (int i = 0; i < NetState.Instances.Count; ++i)
            {
                NetState compState = NetState.Instances[i];
                if (ourAddress.Equals(compState.Address))
                {
                    ++count;
                }
            }

            // force this login to wait until the other client timesout (the same client is not restricted.)
            if (MaxAddresses == count && m_IPMRU.ContainsKey(ourAddress) && m_IPMRU[ourAddress].Account != acct)
            {
                // if one of these accounts is null, then this test delived a false positive whereby prohibiting the player from logging in
                Diagnostics.Assert(m_IPMRU[ourAddress].Account != null && acct != null, "Account null in IPStillHot()");

                if (DateTime.Now < m_IPMRU[ourAddress].Limit)
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #2
0
        public static bool Verify(IPAddress ourAddress)
        {
            if (!Enabled)
            {
                return(true);
            }

            // see if there is another logged in account with this IP address
            List <NetState> netStates = NetState.Instances;
            int             count     = 0;

            for (int i = 0; i < netStates.Count; ++i)
            {
                NetState compState = netStates[i];

                // don't count staff accounts
                //	note: because this check comes before the acct for ourAddress is known, staff can only exceed these limits if they login
                //	Player Accounts AFTER Staff Accounts.
                if (compState.Mobile != null && compState.Mobile.Account != null)
                {
                    Server.Accounting.Account acct = compState.Mobile.Account as Server.Accounting.Account;
                    if (acct.GetAccessLevel() > AccessLevel.Player)
                    {
                        continue;
                    }
                }

                // add up matching accounts (connections to this IP address)
                if (ourAddress.Equals(compState.Address))
                {
                    ++count;

                    if (count > MaxAddresses)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
예제 #3
0
        public static bool CheckSkill(Mobile from, Skill skill, object amObj, double chance)
        {
            if (from.Skills.Cap == 0)
            {
                return(false);
            }

            bool   success = (chance >= Utility.RandomDouble());
            double gc      = (double)(from.Skills.Cap - from.Skills.Total) / from.Skills.Cap;

            gc += (skill.Cap - skill.Base) / skill.Cap;
            gc /= 2;

            gc += (1.0 - chance) * (success ? 0.5 : (Core.AOS ? 0.0 : 0.2));
            gc /= 2;

            gc *= skill.Info.GainFactor;

            Server.Accounting.Account a = from.Account as Server.Accounting.Account;
            if (a != null && a.PHStart != null && a.PHStart + m_phLength > DateTime.Now)
            {
                gc *= 2;                 //Double gains during power hour
            }
            if (gc < 0.01)
            {
                gc = 0.01;
            }

            if (from is BaseCreature && ((BaseCreature)from).Controlled)
            {
                gc *= 2;
            }

            if (from.Alive && ((gc >= Utility.RandomDouble() && AllowGain(from, skill, amObj)) || skill.Base < 10.0))
            {
                Gain(from, skill);
            }

            return(success);
        }
예제 #4
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            PlayerMobile pm   = obj as PlayerMobile;
            Mobile       from = e.Mobile;

            try
            {
                if (pm != null)
                {
                    NetState ns = pm.NetState;
                    if (ns == null)
                    {
                        from.SendMessage("That player is no longer online.");
                        return;
                    }
                    Server.Accounting.Account pmAccount = (Server.Accounting.Account)pm.Account;
                    HardwareInfo pmHWInfo = pmAccount.HardwareInfo;

                    from.SendMessage("{0}/{1}: Finding possible multi-clients (IP: {2}, CV: {3})",
                                     pmAccount.Username, pm.Name, ns.Address.ToString(), ns.Version.ToString());

                    //ArrayList netStates = NetState.Instances;
                    List <NetState> netStates = NetState.Instances;

                    for (int i = 0; i < netStates.Count; i++)
                    {
                        NetState compState = netStates[i];

                        //guard against NetStates which haven't completely logged in yet
                        if (compState == null ||
                            compState.Address == null ||
                            compState.Mobile == null)
                        {
                            continue;
                        }

                        if (ns.Address.Equals(compState.Address))
                        {
                            if (compState.Mobile != pm)
                            {
                                Server.Accounting.Account compAcct = (Server.Accounting.Account)compState.Mobile.Account;
                                string clientName = string.Format("{0}/{1}", compAcct.Username, compState.Mobile.Name);

                                HardwareInfo compHWInfo = compAcct.HardwareInfo;

                                from.SendMessage("{0}: Same IP Address ({1})", clientName, compState.Address.ToString());

                                //Found another client from same IP, check client version
                                if (ns.Version.CompareTo(compState.Version) == 0)
                                {
                                    from.SendMessage("{0}: Same Client Version: {1}", clientName, compState.Version.ToString());
                                }
                                else
                                {
                                    from.SendMessage("{0}: Different Client Version: {1}", clientName, compState.Version.ToString());
                                }

                                //Check HWInfo
                                if (pmHWInfo == null && compHWInfo == null)
                                {
                                    from.SendMessage("{0}+{1}: BOTH Hardware UNKNOWN", pm.Name, clientName);
                                }
                                else if (pmHWInfo == null || (pmHWInfo.CpuClockSpeed == 0 && pmHWInfo.OSMajor == 0))
                                {
                                    from.SendMessage("{0}: Hardware UNKNOWN, {1} Known", pm.Name, clientName);
                                }
                                else if (compHWInfo == null || (compHWInfo.CpuClockSpeed == 0 && compHWInfo.OSMajor == 0))
                                {
                                    from.SendMessage("{0}: Hardware UNKNOWN, {1} Known", clientName, pm.Name);
                                }
                                else if (IsSameHWInfo(pmHWInfo, compHWInfo))
                                {
                                    from.SendMessage("{0}: Same Hardware", clientName);
                                }
                                else
                                {
                                    from.SendMessage("{0}: Different Hardware", clientName);
                                }
                            }
                        }
                    }
                }
                else
                {
                    AddResponse("Please target a player.");
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex);
                from.SendMessage("ERROR: Caught exception: " + ex.Message);
            }
        }
예제 #5
0
 public WatchDog(Mobile m)
 {
     m_DateTime = DateTime.Now + m.GetLogoutDelay();
     m_Account  = m.Account as Server.Accounting.Account;
 }
예제 #6
0
			public WatchDog(Mobile m)
			{
				m_DateTime = DateTime.Now + m.GetLogoutDelay();
				m_Account = m.Account as Server.Accounting.Account;
			}