Пример #1
0
		// On Load Mod
		public static void Init()
		{
			// Reset Values to defaults.
			Group.PermissionList.Clear();
			foreach (var item in Group.DefaultPermissions)
			{
				Group.PermissionList.Add(item);
			}

			ServerUsingHEROsMod = false;
			GravestonesAllowed = true;
			WillFreezeNonLoggedIn = true;
			Groups = new List<Group>();
			Players = new HEROsModPlayer[255];
			RegisteredUsers = new List<UserWithID>();
			for (int i = 0; i < Players.Length; i++)
			{
				Players[i] = new HEROsModPlayer(i);
			}
			Regions = new List<Region>();
			ResetWriter();
			LoggedIn = false;

			AdminGroup = new Group("Admin");
			AdminGroup.MakeAdmin();

			DatabaseController.Init();

			if (NetworkMode == NetworkMode.Server)
			{
				//TileLastChangedBy = new int[Main.maxTilesX, Main.maxTilesY];
				//for (int x = 0; x < TileLastChangedBy.GetLength(0); x++)
				//{
				//	for (int y = 0; y < TileLastChangedBy.GetLength(1); y++)
				//	{
				//		TileLastChangedBy[x, y] = -1;
				//	}
				//}

				//TileChangeController.Init();
				Groups = DatabaseController.GetGroups();
				//Regions = DatabaseController.GetRegions();
				//CTFGroup = new Group("CTFGroup");
				//CTFGroup.Permissions["StartCTF"] = true;

				foreach (Group group in Groups)
				{
					if (group.Name == "Default")
					{
						DefaultGroup = group;
						break;
					}
				}
				LoginService.GroupChanged += LoginService_GroupChanged;

				AuthCode = Main.rand.Next(100000, 999999);
				Console.ForegroundColor = ConsoleColor.Yellow;
				Console.WriteLine(string.Format(HEROsMod.HeroText("DedicatedServerAutoMessage"), AuthCode));
				Console.ResetColor();
			}
		}
Пример #2
0
		// On Load Mod
		public static void Init()
		{
			// Reset Values to defaults.
			Group.PermissionList.Clear();
			foreach (var item in Group.DefaultPermissions)
			{
				Group.PermissionList.Add(item);
			}

			ServerUsingHEROsMod = false;
			GravestonesAllowed = true;
			//TADHG: this variable would be phased out, 
			WillFreezeNonLoggedIn = true;
			Groups = new List<Group>();
			Players = new HEROsModPlayer[255];
			RegisteredUsers = new List<UserWithID>();
			for (int i = 0; i < Players.Length; i++)
			{
				Players[i] = new HEROsModPlayer(i);
			}
			Regions = new List<Region>();
			ResetWriter();
			LoggedIn = false;

			AdminGroup = new Group("Admin");
			AdminGroup.MakeAdmin();

			DatabaseController.Init();

			if (NetworkMode == NetworkMode.Server)
			{
				//TileLastChangedBy = new int[Main.maxTilesX, Main.maxTilesY];
				//for (int x = 0; x < TileLastChangedBy.GetLength(0); x++)
				//{
				//	for (int y = 0; y < TileLastChangedBy.GetLength(1); y++)
				//	{
				//		TileLastChangedBy[x, y] = -1;
				//	}
				//}

				//TileChangeController.Init();
				Groups = DatabaseController.GetGroups();
				//Regions = DatabaseController.GetRegions();
				//CTFGroup = new Group("CTFGroup");
				//CTFGroup.Permissions["StartCTF"] = true;

				foreach (Group group in Groups)
				{
					if (group.Name == "Default")
					{
						DefaultGroup = group;
					}
					else if (group.Name == "NotLoggedInGroup")
					{
						NotLoggedInGroup = group;
					}
				}
				LoginService.GroupChanged += LoginService_GroupChanged;

				AuthCode = Main.rand.Next(100000, 999999);
				Console.ForegroundColor = ConsoleColor.Yellow;
				Console.WriteLine("HERO's Mod: Create an account, login, and type /auth " + AuthCode + " to become Admin.");
				Console.ResetColor();
			}
		}