diff --git a/DataCollection/gamedata.json b/DataCollection/gamedata.json index 2266aa6..ab8b672 100644 --- a/DataCollection/gamedata.json +++ b/DataCollection/gamedata.json @@ -12,7 +12,10 @@ "location_format":" You are%META% ", "tile_format":"%TILENAME%", "nothing_message":"^LYou see nothing on the ground of interest.^R1", - "seperator":"
" + "seperator":"
", + "areas":{ + "bridge_text":"A bridge crosses over the water to another isle. That'll save you some travel costs!" + } }, "chat":{ "for_others":{ @@ -43,9 +46,42 @@ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1], + 1,1,1,1,1,1] }, "overlay_tiles":{ + "passibility":[ + [0,0,0,0,0,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,0,0,0,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,0,1], + [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,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1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], + [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], + [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], + ], + "tile_depth":[3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,0,0,0,1,1,3,3,3,1,1,1,1,3,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,3,1,1,1,1,3,2,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 3,2,2,2,2,1,1,1,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,3,2,2,2,2,2, diff --git a/Horse Isle Server/Horse Isle Server/Chat.cs b/Horse Isle Server/Horse Isle Server/Chat.cs new file mode 100644 index 0000000..b93f663 --- /dev/null +++ b/Horse Isle Server/Horse Isle Server/Chat.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Horse_Isle_Server +{ + class Chat + { + public static bool isCommand(User user, string message) + { + if (message.Length < 1) + return false; + + if (user.Administrator || user.Moderator) + if (message[0] == '%') + return true; + if (message[0] == '!') + return true; + + } + public static bool isAppropriate(string message) + { + if (!ConfigReader.BadWords) + return true; + else + return true; // Fuck Censorship + } + + public static void HandleMessage(User user, byte channel, string message) + { + + } + + } +} diff --git a/Horse Isle Server/Horse Isle Server/Client.cs b/Horse Isle Server/Horse Isle Server/Client.cs index c1f53d2..48b4f51 100644 --- a/Horse Isle Server/Horse Isle Server/Client.cs +++ b/Horse Isle Server/Horse Isle Server/Client.cs @@ -1,13 +1,8 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Net; using System.Net.Sockets; using System.Text; using System.Threading; -using System.Threading.Tasks; - namespace Horse_Isle_Server { class Client @@ -21,6 +16,7 @@ namespace Horse_Isle_Server private Thread recvPackets; private Timer updateTimer; + private int updateInterval = 60 * 1000; private void updateTimerTick(object state) { Logger.DebugPrint("Sending update packet to "+ LoggedinUser.Username); @@ -32,7 +28,8 @@ namespace Horse_Isle_Server LoggedinUser = new User(id); LoggedIn = true; - + + updateTimer = new Timer(new TimerCallback(updateTimerTick), null, updateInterval, updateInterval); } private void receivePackets() { @@ -82,8 +79,11 @@ namespace Horse_Isle_Server { Logger.ErrorPrint("Received an invalid packet (size: "+Packet.Length+")"); } - byte identifier = Packet[0]; + + if (updateTimer != null) + updateTimer.Change(updateInterval, updateInterval); + if (!LoggedIn) // Must be either login or policy-file-request { if (Encoding.UTF8.GetString(Packet).StartsWith("")) // Policy File Request @@ -151,7 +151,6 @@ namespace Horse_Isle_Server RemoteIp = clientSocket.RemoteEndPoint.ToString(); Logger.DebugPrint("Client connected @ " + RemoteIp); - updateTimer = new Timer(new TimerCallback(updateTimerTick), null, 60 * 1000, 60 * 1000); recvPackets = new Thread(() => { diff --git a/Horse Isle Server/Horse Isle Server/ConfigReader.cs b/Horse Isle Server/Horse Isle Server/ConfigReader.cs index 1254087..a6eaa45 100644 --- a/Horse Isle Server/Horse Isle Server/ConfigReader.cs +++ b/Horse Isle Server/Horse Isle Server/ConfigReader.cs @@ -22,6 +22,9 @@ namespace Horse_Isle_Server public static string CrossDomainPolicyFile; public static bool Debug; + public static bool BadWords; + public static bool ExpandSlang; + private static string ConfigurationFileName = "server.properties"; public static void OpenConfig() { @@ -87,6 +90,12 @@ namespace Horse_Isle_Server case "crossdomain": CrossDomainPolicyFile = data; break; + case "filter_bad_words": + BadWords = data == "true"; + break; + case "correct_slang": + ExpandSlang = data == "true"; + break; case "debug": Debug = data == "true"; break; diff --git a/Horse Isle Server/Horse Isle Server/Gamedata.cs b/Horse Isle Server/Horse Isle Server/Gamedata.cs index 3261dc2..9233e0b 100644 --- a/Horse Isle Server/Horse Isle Server/Gamedata.cs +++ b/Horse Isle Server/Horse Isle Server/Gamedata.cs @@ -89,10 +89,9 @@ namespace Horse_Isle_Server Messages.TileFormat = gameData.messages.meta.tile_format; Messages.NothingMessage = gameData.messages.meta.nothing_message; - JArray overlayTileDepth = gameData.tile_paramaters.overlay_tiles.tile_depth; - JArray terrainTilePassibility = gameData.tile_paramaters.terrain_tiles.passibility; - Map.OverlayTileDepth = overlayTileDepth.ToObject(); - Map.TerrainTilePassibility = terrainTilePassibility.ToObject(); + Map.OverlayTileDepth = gameData.tile_paramaters.overlay_tiles.tile_depth.ToObject(); + Map.OverlayTilesetPassibility = gameData.tile_paramaters.overlay_tiles.passibility.ToObject(); + Map.TerrainTilePassibility = gameData.tile_paramaters.terrain_tiles.passibility.ToObject(); } } diff --git a/Horse Isle Server/Horse Isle Server/Map.cs b/Horse Isle Server/Horse Isle Server/Map.cs index 26de300..f9a6e70 100644 --- a/Horse Isle Server/Horse Isle Server/Map.cs +++ b/Horse Isle Server/Horse Isle Server/Map.cs @@ -11,7 +11,9 @@ namespace Horse_Isle_Server class Map { public static int[] OverlayTileDepth; + public static bool[] TerrainTilePassibility; + public static bool[][] OverlayTilesetPassibility; public static Bitmap MapData; @@ -31,9 +33,29 @@ namespace Horse_Isle_Server public static bool CheckPassable(int x, int y) { int tileId = GetTileId(x, y, false); - bool passable = TerrainTilePassibility[tileId-1]; - Logger.DebugPrint("Checking tile passibility for tileid: " + tileId + " at " + x + "," + y+" passable: " +passable); - return passable; + int otileId = GetTileId(x, y, true); + + bool terrainPassable = TerrainTilePassibility[tileId - 1]; + int tileset = 0; + + if (otileId > 190) + { + otileId -= 192; + if (World.InIsle(x, y)) + tileset = World.GetIsle(x, y).Tileset+1; + } + + bool overlayPassable = OverlayTilesetPassibility[tileset][otileId - 1]; + + bool tilePassable = false; + if (terrainPassable || overlayPassable) + tilePassable = true; + if (!overlayPassable && otileId != 1) + tilePassable = false; + + + Logger.DebugPrint("Checking tile passibility for tileid: " + tileId + " and overlay tileid " + otileId + " on tileset " + tileset + " at " + x + "," + y); + return tilePassable; } public static void OpenMap() diff --git a/Horse Isle Server/Horse Isle Server/Resources/server.properties b/Horse Isle Server/Horse Isle Server/Resources/server.properties index 4a0083f..939f5c0 100644 --- a/Horse Isle Server/Horse Isle Server/Resources/server.properties +++ b/Horse Isle Server/Horse Isle Server/Resources/server.properties @@ -24,5 +24,15 @@ crossdomain=CrossDomainPolicy.xml # Red Text Stating "Todays Note:" motd=April 11, 2020. New breed, Camarillo White Horse. Two new quests. +# Chat Filter Settings + +# Wether to block 'bad' words +# ex 'Fuck You!' gets blocked +filter_bad_words=true + +# Wether to expand slang. +# ex 'lol' becomes '*laughing out loud!*' +correct_slang=true + # Should print debug logs debug=false \ No newline at end of file