private static void ProcessRegisteredUsersList(ref BinaryReader reader) { if (Network.NetworkMode == NetworkMode.Server) { return; } Network.RegisteredUsers.Clear(); int numberOfUsers = reader.ReadInt32(); for (int i = 0; i < numberOfUsers; i++) { UserWithID user = new UserWithID(); user.Username = reader.ReadString(); user.ID = reader.ReadInt32(); user.groupID = reader.ReadInt32(); Network.RegisteredUsers.Add(user); } }
private static void ProcessTileModificationCheckRequest(ref BinaryReader reader, int playerNumber) { if (Network.Players[playerNumber].Group.HasPermission("CheckTiles")) { int x = reader.ReadInt32(); int y = reader.ReadInt32(); if (x >= 0 && y >= 0 && x < Main.maxTilesX && y < Main.maxTilesY) { int playerID = Network.TileLastChangedBy[x, y]; if (playerID >= 0) { UserWithID user = null; UserWithID[] users = DatabaseController.GetRegisteredUsers(); for (int i = 0; i < users.Length; i++) { if (users[i].ID == playerID) { user = users[i]; } } if (user != null) { Network.SendTextToPlayer(string.Format(HEROsMod.HeroText("TileLastModifiedBy"), user.Username), playerNumber); } } else { // TODO: These should all be NetworkText.FromKey so they show up in correct language on Client Network.SendTextToPlayer(HEROsMod.HeroText("TileNotModified"), playerNumber); } } } else { Network.SendTextToPlayer(HEROsMod.HeroText("YouDontHavePermissionToDoThat"), playerNumber); } }
private static void ProcessTileModificationCheckRequest(ref BinaryReader reader, int playerNumber) { if (Network.Players[playerNumber].Group.HasPermission("CheckTiles")) { int x = reader.ReadInt32(); int y = reader.ReadInt32(); if (x >= 0 && y >= 0 && x < Main.maxTilesX && y < Main.maxTilesY) { int playerID = Network.TileLastChangedBy[x, y]; if (playerID >= 0) { UserWithID user = null; UserWithID[] users = DatabaseController.GetRegisteredUsers(); for (int i = 0; i < users.Length; i++) { if (users[i].ID == playerID) { user = users[i]; } } if (user != null) { Network.SendTextToPlayer("Tile last modified by " + user.Username, playerNumber); } } else { Network.SendTextToPlayer("This tile has not been modified since last server boot up.", playerNumber); } } } else { Network.SendTextToPlayer("You don't have permission to do that.", playerNumber); } }