예제 #1
0
        public static void ProcessRegistrationRequest(string username, string password, int playerNumber)
        {
            DatabaseController.RegistrationResult regResult = DatabaseController.Register(username, password);
            switch (regResult)
            {
            case DatabaseController.RegistrationResult.Sucess:
                Network.SendTextToPlayer("You have successfully registered.  Please login.", playerNumber);
                for (int i = 0; i < Network.Players.Length; i++)
                {
                    HEROsModPlayer player = Network.Players[i];
                    if (player.ServerInstance.IsActive && player.Group.IsAdmin)
                    {
                        GeneralMessages.SendRegisteredUsersToPlayer(i);
                    }
                }
                break;

            case DatabaseController.RegistrationResult.UsernameTaken:
                Network.SendTextToPlayer("This username has already been taken.", playerNumber);
                break;

            case DatabaseController.RegistrationResult.Error:
                Network.SendTextToPlayer("An error occured when trying to register.", playerNumber);
                break;
            }
        }
예제 #2
0
        public static void SendPlayerPermissions(int playerNumber)
        {
            if (Network.NetworkMode == NetworkMode.Server)
            {
                WriteHeader(MessageType.SetPlayerGroup);
                HEROsModPlayer player = Network.Players[playerNumber];
                Group          group  = player.Group;
                Writer.Write(group.Name);
                Writer.Write(group.ID);
                Writer.Write(group.IsAdmin);
                byte[] permissions = group.ExportPermissions();
                //if(CTF.CaptureTheFlag.GameInProgress)
                //{
                //    permissions = Network.CTFGroup.ExportPermissions();
                //}
                Writer.Write(permissions.Length);
                Writer.Write(permissions);
                Network.SendDataToPlayer(playerNumber);

                if (group.IsAdmin)
                {
                    GeneralMessages.SendRegisteredUsersToPlayer(playerNumber);
                }
            }
        }
예제 #3
0
		public static void InitializeWorld()
		{
			foreach (var world in database.worlds)
			{
				if (world.worldID == Main.worldID)
				{
					currentDatabaseWorld = world;
				}
			}
			if (currentDatabaseWorld == null)
			{
				currentDatabaseWorld = new DatabaseWorld() { worldID = Main.worldID, name = Main.worldName };
				database.worlds.Add(currentDatabaseWorld);
				SaveSetting();
			}
			Waypoints.ClearPoints();
			foreach (var waypoint in currentDatabaseWorld.waypoints)
			{
				Waypoints.AddWaypoint(waypoint.name, new Vector2(waypoint.x, waypoint.y));
			}
			Network.GravestonesAllowed = !currentDatabaseWorld.GraveStonesDisabled;
			ItemBanner.ItemsBanned = currentDatabaseWorld.BanDestructiveExplosives;
			EnemyToggler.EnemiesAllowed = !currentDatabaseWorld.NPCSpawnsDiabled;
			TimeWeatherChanger.TimePaused = currentDatabaseWorld.TimePaused;
			if (TimeWeatherChanger.TimePaused)
			{
				TimeWeatherChanger.PausedTime = currentDatabaseWorld.TimePausedTime;
			//	TimeWeatherChanger.PausedTimeDayTime = currentDatabaseWorld.TimePausedIsDay;
			}
			if (Main.netMode == 0)
			{
				GeneralMessages.ProcessCurrentTogglesSP(EnemyToggler.EnemiesAllowed, Network.GravestonesAllowed, ItemBanner.ItemsBanned, TimeWeatherChanger.TimePaused);
			}
		}
예제 #4
0
 public static void PlayerLeft(int playerIndex)
 {
     Players[playerIndex].Reset();
     //if (CTF.CaptureTheFlag.GameInProgress || CTF.CaptureTheFlag.InPregameLobby)
     //{
     //	if (playerIndex == CTF.CaptureTheFlag.LobbyStartedBy)
     //	{
     //		CTF.CaptureTheFlag.EndGame();
     //	}
     //}
     GeneralMessages.TellClientsPlayerLeft(playerIndex);
 }
예제 #5
0
		//public static bool SendDataCheck(int msgType, int number)
		//{
		//	switch (msgType)
		//	{
		//		case 27: //projectiles
		//			if (!GravestonesAllowed)
		//			{
		//				Projectile proj = Main.projectile[number];
		//				if (proj.type == 43 || (proj.type > 200 && proj.type < 206))
		//				{
		//					proj.active = false;
		//					return true;
		//				}
		//			}
		//			break;
		//	}
		//	return false;
		//}

		private static void PlayerJoined(int playerNumber)
		{
			Players[playerNumber] = new HEROsModPlayer(playerNumber);
			// chat message hack: SendTextToPlayer(HEROsModCheckMessage, playerNumber, Color.Red);

			var packet = HEROsMod.instance.GetPacket();
			packet.Write((byte)MessageType.LoginMessage);
			packet.Write((byte)LoginService.MessageType.ServerToClientHandshake);
			packet.Send(playerNumber);

			GeneralMessages.TellClientsPlayerJoined(playerNumber);
		}
예제 #6
0
        private static void ProcessSetOfflinePlayerGroupRequest(ref BinaryReader reader, int playerNumber)
        {
            if (Network.Players[playerNumber].Group.IsAdmin)
            {
                int id      = reader.ReadInt32();
                int groupID = reader.ReadInt32();

                //Network.Players[id].Group = Network.GetGroupByID(groupID);
                //SendPlayerPermissions(id);
                DatabaseController.SetPlayerGroup(id, groupID);
                for (int i = 0; i < Network.Players.Length; i++)
                {
                    HEROsModPlayer player = Network.Players[i];
                    if (player.ServerInstance.IsActive && player.Group.IsAdmin)
                    {
                        GeneralMessages.SendRegisteredUsersToPlayer(i);
                    }
                }
                //GeneralMessages.SendRegisteredUsersToPlayer(playerNumber);
            }
        }
예제 #7
0
		public static void HEROsModMessaged(BinaryReader binaryReader, int playerNumber)
		{
			//if (msgType == HEROsModNetworkMessageType)
			{
				//We found a HEROsMod only message
				MessageType subMsgType = (MessageType)binaryReader.ReadByte();
				ModUtils.DebugText("subMsgType " + subMsgType);

				switch (subMsgType)
				{
					case MessageType.GeneralMessage:
						GeneralMessages.ProcessData(ref binaryReader, playerNumber);
						break;
					case MessageType.LoginMessage:
						LoginService.ProcessData(ref binaryReader, playerNumber);
						break;
						//case MessageType.CTFMessage:
						//	CTF.CTFMessages.ProcessData(ref binaryReader, playerNumber);
						//	break;
				}
			}
		}
예제 #8
0
        public static void ProcessData(ref BinaryReader reader, int playerNumber)
        {
            MessageType msgType = (MessageType)reader.ReadByte();

            switch (msgType)
            {
            case MessageType.RequestLogin:
                ProcessLoginRequest(ref reader, playerNumber);
                break;

            case MessageType.LoginSucess:
                ProcessLoginSuccess(ref reader);
                break;

            case MessageType.RequestLogout:
                ProcessLogoutRequest(playerNumber);
                break;

            case MessageType.LogoutSucess:
                ProcessLogoutSuccess(ref reader);
                break;

            case MessageType.RequestRegistration:
                ReadRegistrationRequest(ref reader, playerNumber);
                break;

            case MessageType.RequestAddGroup:
                ProcessAddGroupReqest(ref reader, playerNumber);
                break;

            case MessageType.RequestDeleteGroup:
                ProcessDeleteGroupRequest(ref reader, playerNumber);
                break;

            case MessageType.RequestGroupList:
                SendGroupList(playerNumber);
                break;

            case MessageType.GroupList:
                ProcessGroupList(ref reader);
                break;

            case MessageType.SetPlayerGroup:
                ProcessGroupPermissions(ref reader);
                break;

            case MessageType.RequestSetGroupPermissions:
                ProcessSetGroupPermissionsRequest(ref reader, playerNumber);
                break;

            case MessageType.RequestPlayerInfo:
                ProcessPlayerInfoRequest(ref reader, playerNumber);
                break;

            case MessageType.PlayerInfo:
                ProcessPlayerInfo(ref reader);
                break;

            case MessageType.RequestSetPlayerGroup:
                ProcessSetPlayerGroupRequest(ref reader, playerNumber);
                break;

            case MessageType.RequestSetOfflinePlayerGroup:
                ProcessSetOfflinePlayerGroupRequest(ref reader, playerNumber);
                break;

            case MessageType.ServerToClientHandshake:
                Network.ServerUsingHEROsMod    = true;
                HEROsMod.ServiceHotbar.Visible = true;
                GeneralMessages.TellSereverImUsingHEROsMod();
                break;
            }
        }
예제 #9
0
		//public static bool SendDataCheck(int msgType, int number)
		//{
		//	switch (msgType)
		//	{
		//		case 27: //projectiles
		//			if (!GravestonesAllowed)
		//			{
		//				Projectile proj = Main.projectile[number];
		//				if (proj.type == 43 || (proj.type > 200 && proj.type < 206))
		//				{
		//					proj.active = false;
		//					return true;
		//				}
		//			}
		//			break;
		//	}
		//	return false;
		//}

		private static void PlayerJoined(int playerNumber)
		{
			Players[playerNumber] = new HEROsModPlayer(playerNumber);
			SendTextToPlayer(HEROsModCheckMessage, playerNumber, Color.Red);
			GeneralMessages.TellClientsPlayerJoined(playerNumber);
		}
예제 #10
0
		// TODO -- How will any of these work....?
		public static bool CheckIncomingDataForHEROsModMessage(ref byte msgType, ref BinaryReader binaryReader, int playerNumber)
		{
			long readerPos = binaryReader.BaseStream.Position;

			switch (msgType)
			{
				case 12:
					if (NetworkMode == NetworkMode.Server)
					{
						//if (CTF.CaptureTheFlag.GameInProgress && Netplay.Clients[playerNumber].State == 10)
						//{
						//	if (Players[playerNumber].CTFTeam != CTF.TeamColor.None)
						//	{
						//		CTF.CTFMessages.SendPlayerToSpawnPlatform(Players[playerNumber]);
						//		return true;
						//	}

						//}
						if (Netplay.Clients[playerNumber].State == 3)
						{
							PlayerJoined(playerNumber);
						}
					}
					break;
				//case 14:
				//	if (NetworkMode != global::HEROsModMod.NetworkMode.Server)
				//	{
				//		if (CTF.CaptureTheFlag.GameInProgress)
				//		{
				//			int index = (int)binaryReader.ReadByte();
				//			byte active = binaryReader.ReadByte();
				//			if (Players[index].CTFTeam == CTF.TeamColor.None && active == 1 && Players[index].GameInstance.ghost)
				//			{
				//				return true;
				//			}
				//		}
				//	}
				//	break;
				case 17: //Terrain Modified
					if (NetworkMode == NetworkMode.Server)
					{
						bool canBuild = false;
						TileModifyType tileModifyType = (TileModifyType)binaryReader.ReadByte();
						int x = (int)binaryReader.ReadInt16();
						int y = (int)binaryReader.ReadInt16();
						short placeType = binaryReader.ReadInt16();
						int style = (int)binaryReader.ReadByte();
						bool fail = placeType == 1;
						HEROsModPlayer player = Players[playerNumber];

						Tile tile;
						if (x >= 0 && y >= 0 && x < Main.maxTilesX && y < Main.maxTilesY)
						{
							tile = Main.tile[x, y];
						}
						else
						{
							binaryReader.BaseStream.Position = readerPos;
							return false;
						}

						//if (CTF.CaptureTheFlag.GameInProgress && player.CTFTeam != CTF.TeamColor.None && CTF.CaptureTheFlag.AllowTerrainModification)
						//{
						//	canBuild = true;
						//	if (CTF.CaptureTheFlag.ListeningForTileChanges)
						//	{
						//		Tile backupTile = CTF.CaptureTheFlag.ModifiedTiles[x, y];
						//		if (backupTile == null)
						//		{
						//			CTF.CaptureTheFlag.ModifiedTiles[x, y] = new Tile();
						//			CTF.CaptureTheFlag.ModifiedTiles[x, y].CopyFrom(tile);
						//			Console.WriteLine("tile added");
						//		}
						//	}
						//}
						if (!canBuild)
						{
							canBuild = PlayerHasPermissionToBuildAtBlock(player, x, y);
						}

						if (tileModifyType == TileModifyType.PlaceTile && placeType == TileID.LandMine)
						{
							SendTextToPlayer("Landmines are disabled on this server", playerNumber, Color.Red);
						}
						else if (canBuild)
						{
							TileLastChangedBy[x, y] = player.ID;
							binaryReader.BaseStream.Position = readerPos;
							if (tileModifyType == TileModifyType.KillTile)
							{
								LastTileKilledBy = player;
								WorldGen.KillTile(x, y, fail, false, false);
								NetMessage.SendData(17, -1, playerNumber, "", (int)tileModifyType, (float)x, (float)y, (float)placeType, style);
								LastTileKilledBy = null;
								return true;
							}
							else
							{
								TileChangeController.RecordChanges(player, x, y);
							}
							return false;
						}
						else
						{
							SendTextToPlayer("You do not have permission to build here", playerNumber, Color.Red);
						}

						switch (tileModifyType)
						{
							case TileModifyType.KillTile:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceTile, (float)x, (float)y, (float)tile.type, tile.slope());
								break;
							case TileModifyType.PlaceTile:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillTile, (float)x, (float)y, (float)placeType, style);
								break;
							case TileModifyType.KillWall:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceWall, (float)x, (float)y, (float)tile.wall, style);
								break;
							case TileModifyType.PlaceWall:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillWall, (float)x, (float)y, (float)placeType, style);
								break;
							case TileModifyType.KillTileNoItem:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceTile, (float)x, (float)y, (float)tile.type, tile.slope());
								break;
							case TileModifyType.PlaceWire:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillWire, (float)x, (float)y, (float)placeType, style);
								break;
							case TileModifyType.PlaceWire2:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillWire2, (float)x, (float)y, (float)placeType, style);
								break;
							case TileModifyType.PlaceWire3:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillWire3, (float)x, (float)y, (float)placeType, style);
								break;
							case TileModifyType.KillWire:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceWire, (float)x, (float)y, (float)placeType, style);
								break;
							case TileModifyType.KillWire2:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceWire2, (float)x, (float)y, (float)placeType, style);
								break;
							case TileModifyType.KillWire3:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceWire3, (float)x, (float)y, (float)placeType, style);
								break;
							case TileModifyType.KillActuator:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceActuator, (float)x, (float)y, (float)placeType, style);
								break;
							case TileModifyType.PlaceActuator:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillActuator, (float)x, (float)y, (float)placeType, style);
								break;
							case TileModifyType.PoundTile:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PoundTile, (float)x, (float)y, (float)placeType, tile.slope());
								break;
							case TileModifyType.SlopeTile:
								NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.SlopeTile, (float)x, (float)y, (float)placeType, tile.slope());
								break;
						}
						return true;
					}
					break;
				case 25: //revieved a chat message

					binaryReader.ReadByte();
					Color color = binaryReader.ReadRGB();
					string text = binaryReader.ReadString();
					if (NetworkMode == NetworkMode.Client)
					{
						if (text == HEROsModCheckMessage)
						{
							ServerUsingHEROsMod = true;
							HEROsMod.ServiceHotbar.Visible = true;
							GeneralMessages.TellSereverImUsingHEROsMod();
							return true;
						}
					}
					else if (NetworkMode == NetworkMode.Server)
					{
						if (text.Length > 1 && text.Substring(0, 1) == "/")
						{
							string[] parameters = text.Substring(1, text.Length - 1).Split(' ');
							parameters[0] = parameters[0].ToLower();
							switch (parameters[0])
							{
								case "auth":
									if (parameters.Length != 2 || parameters[1].Length != 6)
									{
										SendTextToPlayer("Invalid Input", playerNumber);
										return true;
									}
									string authStr = parameters[1];
									if (authStr == AuthCode.ToString())
									{
										if (!Players[playerNumber].UsingHEROsMod)
										{
											SendTextToPlayer("You need HEROsMod Mod to use this feature", playerNumber);
											return true;
										}
										if (Players[playerNumber].Username.Length > 0)
										{
											Players[playerNumber].Group = AdminGroup;
											DatabaseController.SetPlayerGroup(Players[playerNumber].ID, Players[playerNumber].Group.ID);
											LoginService.SendPlayerPermissions(playerNumber);
											SendTextToPlayer("You are now Admin", playerNumber);
											return true;
										}
										else
										{
											SendTextToPlayer("Please login first", playerNumber);
											return true;
										}
									}
									else
									{
										SendTextToPlayer("Invalid Auth Code", playerNumber);
										return true;
									}
								case "login":
									if (parameters.Length != 3)
									{
										SendTextToPlayer("Invalid Input", playerNumber);
										return true;
									}
									LoginService.ProcessLoginRequest(parameters[1], parameters[2], playerNumber);
									return true;
								case "logout":
									if (parameters.Length != 1)
									{
										SendTextToPlayer("Invalid Input", playerNumber);
										return true;
									}
									LoginService.ProcessLogoutRequest(playerNumber);
									return true;
								case "register":
									if (parameters.Length != 3)
									{
										SendTextToPlayer("Invalid Input", playerNumber);
										return true;
									}
									LoginService.ProcessRegistrationRequest(parameters[1], parameters[2], playerNumber);
									break;
								case "help":
									if (parameters.Length != 1)
									{
										SendTextToPlayer("Invalid Input", playerNumber);
									}
									SendTextToPlayer("/login <username> <password> - Login with your account", playerNumber);
									SendTextToPlayer("/register <username> <password> - Create an account", playerNumber);
									SendTextToPlayer("/logout - Logout of your account", playerNumber);
									SendTextToPlayer("Use HEROsMod Mod to unlock all server features.", playerNumber);
									break;
								default:
									SendTextToPlayer("Invalid Command, type /help for a list of commands.", playerNumber);
									break;

							}
						}
						else
						{
							string text2 = text.ToLower();
							if (text2 == Lang.mp[6] || text2 == Lang.mp[21])
							{
								string text3 = "";
								for (int i = 0; i < 255; i++)
								{
									if (Main.player[i].active)
									{
										if (text3 == "")
										{
											text3 = Main.player[i].name;
										}
										else
										{
											text3 = text3 + ", " + Main.player[i].name;
										}
									}
								}
								NetMessage.SendData(25, playerNumber, -1, Lang.mp[7] + " " + text3 + ".", 255, 255f, 240f, 20f, 0);
							}
							else if (text2.StartsWith("/me "))
							{
								NetMessage.SendData(25, -1, -1, "*" + Main.player[playerNumber].name + " " + text.Substring(4), 255, 200f, 100f, 0f, 0);
							}
							else if (text2 == Lang.mp[8])
							{
								NetMessage.SendData(25, -1, -1, string.Concat(new object[]
							{
								"*",
								Main.player[playerNumber].name,
								" ",
								Lang.mp[9],
								" ",
								Main.rand.Next(1, 101)
							}), 255, 255f, 240f, 20f, 0);
							}
							else if (text2.StartsWith("/p "))
							{
								int num28 = Main.player[playerNumber].team;
								color = Main.teamColor[num28];
								if (num28 != 0)
								{
									for (int i = 0; i < 255; i++)
									{
										if (Main.player[i].team == num28)
										{
											NetMessage.SendData(25, i, -1, text.Substring(3), 255, (float)color.R, (float)color.G, (float)color.B, 0);
										}
									}
								}
								else
								{
									NetMessage.SendData(25, playerNumber, -1, Lang.mp[10], 255, 255f, 240f, 20f, 0);
								}
							}
							else
							{
								return false;
								// why are chat messages randomized?
								/*color = chatColor[chatColorIndex];
								chatColorIndex++;
								if (chatColorIndex >= chatColor.Length) chatColorIndex = 0;
								NetMessage.SendData(25, -1, -1, text, 255, (float)color.R, (float)color.G, (float)color.B, 0);
								if (Main.dedServ)
								{
									Console.WriteLine("<" + Main.player[playerNumber].name + "> " + text);
								}*/
							}
						}
						return true;
					}
					break;
				//case 27:
				//	if (ItemBanner.ItemsBanned && !Players[playerNumber].Group.IsAdmin)
				//	{
				//		int projIdentity = (int)binaryReader.ReadInt16();
				//		Vector2 position = binaryReader.ReadVector2();
				//		Vector2 velocity = binaryReader.ReadVector2();
				//		float knockback = binaryReader.ReadSingle();
				//		int damage = (int)binaryReader.ReadInt16();
				//		int owner = (int)binaryReader.ReadByte();
				//		int type = (int)binaryReader.ReadInt16();

				//		Console.WriteLine("Prof: " + type);
				//		int[] bannedProjectiles = ItemBanner.bannedProjectiles;
				//		for (int i = 0; i < bannedProjectiles.Length; i++)
				//		{
				//			if (bannedProjectiles[i] == type)
				//			{
				//				Projectile newProj = new Projectile();
				//				newProj.SetDefaults(type);
				//				SendTextToPlayer(newProj.name + " is banned on the server", playerNumber, Color.Red);

				//				int projIndex = 0;
				//				for (int j = 0; j < 1000; j++)
				//				{
				//					if (!Main.projectile[j].active)
				//					{
				//						Projectile proj = Main.projectile[j];
				//						proj.owner = owner;
				//						projIndex = j;
				//						break;
				//					}
				//				}

				//				NetMessage.SendData(27, playerNumber, -1, "", projIndex);
				//				NetMessage.SendData(29, playerNumber, -1, "", projIdentity, (float)owner);
				//				return true;
				//			}
				//		}
				//	}
				//	break;
				//case 30:
				//	if (NetworkMode == global::HEROsModMod.NetworkMode.Server)
				//	{
				//		if (CTF.CaptureTheFlag.GameInProgress)
				//		{
				//			SendTextToPlayer("You cannot change your hostility while Capture the Flag is in progress.", playerNumber);
				//			CTF.CaptureTheFlag.SetPlayerHostility(Players[playerNumber]);
				//			return true;
				//		}
				//	}
				//	break;
				//case 45:
				//	if (NetworkMode == global::HEROsModMod.NetworkMode.Server)
				//	{
				//		if (CTF.CaptureTheFlag.GameInProgress)
				//		{
				//			SendTextToPlayer("You cannot change parties while Capture the Flag is in progress.", playerNumber);
				//			CTF.CaptureTheFlag.SetPlayerHostility(Players[playerNumber]);
				//			return true;
				//		}
				//	}
				//	break;
				case 63: //block painted
					if (NetworkMode == global::HEROsMod.NetworkMode.Server)
					{
						int x = (int)binaryReader.ReadInt16();
						int y = (int)binaryReader.ReadInt16();
						byte paintColor = binaryReader.ReadByte();
						HEROsModPlayer player = Players[playerNumber];

						if (PlayerHasPermissionToBuildAtBlock(player, x, y))
						{
							TileLastChangedBy[x, y] = player.ID;
							binaryReader.BaseStream.Position = readerPos;
							return false;
						}
						else
						{
							NetMessage.SendData(63, playerNumber, -1, "", x, (float)y, (float)Main.tile[x, y].color());
							SendTextToPlayer("You do not have permission to build here", playerNumber, Color.Red);
							return true;
						}
					}
					break;
				case 64: //wall painted
					if (NetworkMode == global::HEROsMod.NetworkMode.Server)
					{
						int x = (int)binaryReader.ReadInt16();
						int y = (int)binaryReader.ReadInt16();
						byte paintColor = binaryReader.ReadByte();
						HEROsModPlayer player = Players[playerNumber];

						if (PlayerHasPermissionToBuildAtBlock(player, x, y))
						{
							TileLastChangedBy[x, y] = player.ID;
							binaryReader.BaseStream.Position = readerPos;
							return false;
						}
						else
						{
							NetMessage.SendData(64, playerNumber, -1, "", x, (float)y, (float)Main.tile[x, y].wallColor());
							SendTextToPlayer("You do not have permission to build here", playerNumber, Color.Red);
							return true;
						}
					}
					break;
			}

			//if (msgType == HEROsModNetworkMessageType)
			//{
			//    //We found a HEROsMod only message
			//    MessageType subMsgType = (MessageType)binaryReader.ReadByte();
			//    switch(subMsgType)
			//    {
			//        case MessageType.GeneralMessage:
			//            GeneralMessages.ProcessData(ref binaryReader, playerNumber);
			//            break;
			//        case MessageType.LoginMessage:
			//            LoginService.ProcessData(ref binaryReader, playerNumber);
			//            break;
			//        case MessageType.CTFMessage:
			//            CTF.CTFMessages.ProcessData(ref binaryReader, playerNumber);
			//            break;
			//    }
			//}

			//we need to set the stream position back to where it was before we got it
			binaryReader.BaseStream.Position = readerPos;
			return false;
		}