示例#1
0
        private void Purge()
        {
            IList list = UserUtility.bd.getInactiveUsers();

            foreach (User user in list)
            {
                Ruler ruler = Universe.instance.getRuler(user.RulerId);

                ruler.LooseAllBattles();
                ruler.FullReset();
                Universe.instance.removeRulerFromAlliance(ruler);

                foreach (Planet planet in ruler.Planets)
                {
                    planet.FullReset();
                }

                Universe.instance.planets.Remove(ruler.HomePlanet.Coordinate);
                Universe.instance.rulers.Remove(ruler.Id);

                user.RulerId    = -1;
                user.AllianceId = 0;

                UserUtility.bd.saveUser(user, "");

                Log.log("User `{0}' (id:{1}) Removed", user.Name, user.UserId);
            }
        }