From 81b122eff186f73d2f2699eba329c4f001de0a9a Mon Sep 17 00:00:00 2001 From: Anthony BOSCO Date: Mon, 6 Jun 2016 17:20:54 +0200 Subject: [PATCH 1/2] Windows 0.3.3.1 Fix url encoding Branch only for Windows --- .gitignore | 13 + Dynmap.sln | 22 ++ Dynmap.cs => Dynmap/Dynmap.cs | 24 +- Dynmap/Dynmap.csproj | 78 ++++ Dynmap/Properties/AssemblyInfo.cs | 36 ++ Dynmap/References/RocketMod/README.md | 9 + Dynmap/References/Unturned/README.md | 9 + README.md | 12 + dynmap-config.php | 8 - dynmap-core.php | 102 ------ index.php | 502 -------------------------- 11 files changed, 195 insertions(+), 620 deletions(-) create mode 100644 Dynmap.sln rename Dynmap.cs => Dynmap/Dynmap.cs (91%) create mode 100644 Dynmap/Dynmap.csproj create mode 100644 Dynmap/Properties/AssemblyInfo.cs create mode 100644 Dynmap/References/RocketMod/README.md create mode 100644 Dynmap/References/Unturned/README.md create mode 100644 README.md delete mode 100644 dynmap-config.php delete mode 100644 dynmap-core.php delete mode 100644 index.php diff --git a/.gitignore b/.gitignore index 96374c4..0b4658a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,19 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +*.dll + # ========================= # Operating System Files # ========================= diff --git a/Dynmap.sln b/Dynmap.sln new file mode 100644 index 0000000..8b30c1a --- /dev/null +++ b/Dynmap.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dynmap", "Dynmap\Dynmap.csproj", "{3A5AF8BC-41A6-46A3-8677-A6B54B278B68}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3A5AF8BC-41A6-46A3-8677-A6B54B278B68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3A5AF8BC-41A6-46A3-8677-A6B54B278B68}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3A5AF8BC-41A6-46A3-8677-A6B54B278B68}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3A5AF8BC-41A6-46A3-8677-A6B54B278B68}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Dynmap.cs b/Dynmap/Dynmap.cs similarity index 91% rename from Dynmap.cs rename to Dynmap/Dynmap.cs index 2c2a929..752f5e5 100644 --- a/Dynmap.cs +++ b/Dynmap/Dynmap.cs @@ -24,12 +24,14 @@ public class DynmapConfiguration : IRocketPluginConfiguration public string PrivateKey; public int syncInterval; public string WebCoreAddress; + public bool displayInChat; public void LoadDefaults() { PrivateKey = "MySecretPrivateKey"; syncInterval = 5000; WebCoreAddress = "http://localhost"; + displayInChat = true; } } @@ -39,7 +41,7 @@ public class Dynmap : RocketPlugin public static Dynmap Instance; public List Nicks = new List(); public Timer myTimer; - public string directory = Directory.GetCurrentDirectory(); + public string directory = System.IO.Directory.GetCurrentDirectory(); public string[] maps; public string sendMaps; public string data = string.Empty; @@ -58,11 +60,16 @@ public class Dynmap : RocketPlugin protected override void Load() - { + { + Logger.Log("Loading ..."); + //Načtení privátního klíče a složky Maps PrivateKey = Configuration.Instance.PrivateKey; - maps = Directory.GetDirectories(directory + @"/../../../Maps"); - + maps = System.IO.Directory.GetDirectories(System.IO.Path.GetFullPath(directory + @"/../../../Maps")); + foreach(string map in maps) + { + Logger.Log("Finding map : " + map); + } //Vypsání map na serveru foreach (string splitMap in maps) @@ -111,6 +118,7 @@ protected override void Load() if (sentMessage == false) { Logger.LogWarning("Uploading map files to the server! This may take some time!"); sentMessage = true; }; if (uploadMaps[o] != string.Empty) { + Logger.Log("Uploading map : " + uploadMaps[o]); //Generování TransferID RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); @@ -149,7 +157,7 @@ protected override void Load() //Nahrání souborů map na server System.Net.WebClient Client = new System.Net.WebClient (); Client.Headers.Add("Content-Type", "binary/octet-stream"); - byte[] result = Client.UploadFile(Configuration.Instance.WebCoreAddress + "/dynmap-core.php?user=server&do=uploadfile&TransferID=" + Uri.EscapeDataString(TransferID) + "&mapname=" + uploadMaps[o], "POST", directory + @"/../../../Maps/" + uploadMaps[o] + @"/Map.png"); + byte[] result = Client.UploadFile(Configuration.Instance.WebCoreAddress + "/dynmap-core.php?user=server&do=uploadfile&TransferID=" + Uri.EscapeDataString(TransferID) + "&mapname=" + Uri.EscapeDataString(uploadMaps[o].Split('\\')[uploadMaps[0].Split('\\').Length - 1]), "POST", @"../../../Maps/" + uploadMaps[o] + @"/Map.png"); String s = System.Text.Encoding.UTF8.GetString (result,0,result.Length); if (s == "Error.UploadDone") @@ -222,7 +230,7 @@ private void ShowCords() characterName = player.CharacterName.Replace(";", ";").Replace("[", "[").Replace("]", "]").Replace("=", "="); rotation = Convert.ToInt32(player.Rotation); if (player.IsAdmin == true) { playerStatus = "admin"; } else if (player.IsPro == true) { playerStatus = "pro"; } else { playerStatus = "player"; } - UnturnedChat.Say(player, player.Position + "=Position"); + if (Configuration.Instance.displayInChat == true) { UnturnedChat.Say(player, player.Position + "=Position"); } if (player.Features.VanishMode == false) { data = data + "[Charactername=" + characterName + ";CSteamID=" + player.CSteamID + ";Position=" + player.Position + ";Rotation=" + rotation + ";PlayerStatus=" + playerStatus + "]"; }; } @@ -230,8 +238,8 @@ private void ShowCords() if (data != string.Empty || firstrun == true) { url = Configuration.Instance.WebCoreAddress + "/dynmap-core.php?user=server"; - postData = "map=" + SDG.Unturned.Provider.map + "&data=" + Uri.EscapeDataString(data) + "&privatekey=" + PrivateKey; - if (shutdown == true) { postData = "map=" + SDG.Unturned.Provider.map + "&privatekey=" + PrivateKey; }; + postData = "map=" + Uri.EscapeDataString(SDG.Unturned.Provider.map) + "&data=" + Uri.EscapeDataString(data) + "&privatekey=" + PrivateKey; + if (shutdown == true) { postData = "map=" + Uri.EscapeDataString(SDG.Unturned.Provider.map) + "&privatekey=" + PrivateKey; }; var post = Encoding.ASCII.GetBytes(postData); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); diff --git a/Dynmap/Dynmap.csproj b/Dynmap/Dynmap.csproj new file mode 100644 index 0000000..12d9e29 --- /dev/null +++ b/Dynmap/Dynmap.csproj @@ -0,0 +1,78 @@ + + + + + Debug + AnyCPU + {3A5AF8BC-41A6-46A3-8677-A6B54B278B68} + Library + Properties + Dynmap + Dynmap + v4.5.2 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + References\RocketMod\Assembly-CSharp.dll + False + + + References\Unturned\Assembly-CSharp-firstpass.dll + False + + + References\RocketMod\Rocket.API.dll + False + + + References\RocketMod\Rocket.Core.dll + False + + + References\RocketMod\Rocket.Unturned.dll + False + + + + + + + + + + + References\Unturned\UnityEngine.dll + False + + + + + + + + + \ No newline at end of file diff --git a/Dynmap/Properties/AssemblyInfo.cs b/Dynmap/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c3e6d51 --- /dev/null +++ b/Dynmap/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Les informations générales relatives à un assembly dépendent de +// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations +// associées à un assembly. +[assembly: AssemblyTitle("Dynmap")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Dynmap")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly +// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de +// COM, affectez la valeur true à l'attribut ComVisible sur ce type. +[assembly: ComVisible(false)] + +// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM +[assembly: Guid("3a5af8bc-41a6-46a3-8677-a6b54b278b68")] + +// Les informations de version pour un assembly se composent des quatre valeurs suivantes : +// +// Version principale +// Version secondaire +// Numéro de build +// Révision +// +// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut +// en utilisant '*', comme indiqué ci-dessous : +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Dynmap/References/RocketMod/README.md b/Dynmap/References/RocketMod/README.md new file mode 100644 index 0000000..0e98380 --- /dev/null +++ b/Dynmap/References/RocketMod/README.md @@ -0,0 +1,9 @@ +## RocketMod + +Download RocketMod from https://rocketmod.net/get-rocket + +Copy/Paste file from RocketMod to this folder : +* Assembly-CSharp.dll +* Rocket.API.dll +* Rocket.Core.dll +* Rocket.Unturned.dll diff --git a/Dynmap/References/Unturned/README.md b/Dynmap/References/Unturned/README.md new file mode 100644 index 0000000..fc45d6c --- /dev/null +++ b/Dynmap/References/Unturned/README.md @@ -0,0 +1,9 @@ +## Unturned + +Copy/Paste file from your Unturned game. +Files are located : +> Unturned\Unturned_Data\Managed + +Copy/Paste file from RocketMod to this folder : +* Assembly-CSharp-firstpass.dll +* UnityEngine.dll diff --git a/README.md b/README.md new file mode 100644 index 0000000..2e79a10 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# Unturned Dynmap + +_**Only for Windows**_ +If you want use Linux version, checkout [Linux branch](https://github.com/AnthoDingo/DynmapSource/tree/Linux) + +## 1 Required files + +Read the README in folders Dynmap/References/RocketMod and Dynmap/References/RocketMod + +## 2 Build + +After copyign required files, you can start the solution and build the project. \ No newline at end of file diff --git a/dynmap-config.php b/dynmap-config.php deleted file mode 100644 index 256f10a..0000000 --- a/dynmap-config.php +++ /dev/null @@ -1,8 +0,0 @@ - color of bars on the sides - $serverIP = ""; //IP address of server without port - $serverPort = ""; //Port of the server -?> \ No newline at end of file diff --git a/dynmap-core.php b/dynmap-core.php deleted file mode 100644 index 0b98d88..0000000 --- a/dynmap-core.php +++ /dev/null @@ -1,102 +0,0 @@ - \ No newline at end of file diff --git a/index.php b/index.php deleted file mode 100644 index 429b660..0000000 --- a/index.php +++ /dev/null @@ -1,502 +0,0 @@ - - - - - - <?php echo $DynmapTitle;?> - - - - - - -
-
- -
-
-
-
-
Version: Beta 0.3.6, Developed by LinhyCZ, http://linhy.cz
- ">
 Connect to server!
- - - - - - \ No newline at end of file From cccf07e4687cb1e4be661f4d6895a9155a6ae845 Mon Sep 17 00:00:00 2001 From: Janus Date: Wed, 8 Jun 2016 00:33:51 +0200 Subject: [PATCH 2/2] Exploid branch master branch is only for presentation. source code are in separate branch. --- .gitattributes | 17 -- .gitignore | 56 ------ Dynmap.sln | 22 --- Dynmap/Dynmap.cs | 274 -------------------------- Dynmap/Dynmap.csproj | 78 -------- Dynmap/Properties/AssemblyInfo.cs | 36 ---- Dynmap/References/RocketMod/README.md | 9 - Dynmap/References/Unturned/README.md | 9 - README.md | 23 ++- 9 files changed, 11 insertions(+), 513 deletions(-) delete mode 100644 .gitattributes delete mode 100644 .gitignore delete mode 100644 Dynmap.sln delete mode 100644 Dynmap/Dynmap.cs delete mode 100644 Dynmap/Dynmap.csproj delete mode 100644 Dynmap/Properties/AssemblyInfo.cs delete mode 100644 Dynmap/References/RocketMod/README.md delete mode 100644 Dynmap/References/Unturned/README.md diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cab..0000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 0b4658a..0000000 --- a/.gitignore +++ /dev/null @@ -1,56 +0,0 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -*.dll - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear on external disk -.Spotlight-V100 -.Trashes - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk diff --git a/Dynmap.sln b/Dynmap.sln deleted file mode 100644 index 8b30c1a..0000000 --- a/Dynmap.sln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dynmap", "Dynmap\Dynmap.csproj", "{3A5AF8BC-41A6-46A3-8677-A6B54B278B68}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3A5AF8BC-41A6-46A3-8677-A6B54B278B68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3A5AF8BC-41A6-46A3-8677-A6B54B278B68}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3A5AF8BC-41A6-46A3-8677-A6B54B278B68}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3A5AF8BC-41A6-46A3-8677-A6B54B278B68}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Dynmap/Dynmap.cs b/Dynmap/Dynmap.cs deleted file mode 100644 index 752f5e5..0000000 --- a/Dynmap/Dynmap.cs +++ /dev/null @@ -1,274 +0,0 @@ -using Rocket.API; -using Rocket.API.Collections; -using Rocket.Core.Logging; -using Rocket.Core.Plugins; -using Rocket.Unturned; -using Rocket.Unturned.Chat; -using Rocket.Unturned.Player; -using SDG.Unturned; -using Steamworks; -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Security.Cryptography; -using System.Text; -using System.Timers; -using UnityEngine; - -namespace dynmap.core -{ - public class DynmapConfiguration : IRocketPluginConfiguration - { - //Konfigurační soubor - public string PrivateKey; - public int syncInterval; - public string WebCoreAddress; - public bool displayInChat; - - public void LoadDefaults() - { - PrivateKey = "MySecretPrivateKey"; - syncInterval = 5000; - WebCoreAddress = "http://localhost"; - displayInChat = true; - } - } - - public class Dynmap : RocketPlugin - { - //Definice proměnných - public static Dynmap Instance; - public List Nicks = new List(); - public Timer myTimer; - public string directory = System.IO.Directory.GetCurrentDirectory(); - public string[] maps; - public string sendMaps; - public string data = string.Empty; - public string url = string.Empty; - public string encoded = string.Empty; - public string output = string.Empty; - public string map = string.Empty; - public string[] uploadMaps; - public string PrivateKey; - public string postData; - public bool firstrun = true; - public bool shutdown = false; - public string characterName; - public int rotation; - public string playerStatus; - - - protected override void Load() - { - Logger.Log("Loading ..."); - - //Načtení privátního klíče a složky Maps - PrivateKey = Configuration.Instance.PrivateKey; - maps = System.IO.Directory.GetDirectories(System.IO.Path.GetFullPath(directory + @"/../../../Maps")); - foreach(string map in maps) - { - Logger.Log("Finding map : " + map); - } - - //Vypsání map na serveru - foreach (string splitMap in maps) - { - var map = splitMap.Split('\\'); - int length = map.Length; - sendMaps += map[length - 1] + ";"; - } - - //Odeslání map serveru do PHP skriptu - var mapUrl = Configuration.Instance.WebCoreAddress + "/dynmap-core.php?user=server&maps=" + Uri.EscapeDataString(sendMaps); - string postData = "&privatekey=" + PrivateKey; - var post = Encoding.ASCII.GetBytes(postData); - - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(mapUrl); - request.Method = "POST"; - request.ContentType = "application/x-www-form-urlencoded"; - request.ContentLength = post.Length; - using (var stream = request.GetRequestStream()) - { - stream.Write(post, 0, post.Length); - } - - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - using (Stream stream = response.GetResponseStream()) - { - StreamReader reader = new StreamReader(stream, Encoding.UTF8); - output = reader.ReadToEnd(); - } - - //Deaktivuje plugin, pokud se PrivateKey neshoduje - - if(output == "Error.PrivateKeyNotMatch") - { - Logger.LogError("Priavte keys in dynmap-config.php and in Dynmap.configuration.xml doesn't match!"); - Logger.LogError("Unloading plugin!"); - return; - } - - //Příjem názvů map, které se ještě nenacházejí na serveru - var sentMessage = false; - - uploadMaps = output.Split(';'); - for (var o = 0; o < uploadMaps.Length; o++) - { - if (sentMessage == false) { Logger.LogWarning("Uploading map files to the server! This may take some time!"); sentMessage = true; }; - if (uploadMaps[o] != string.Empty) - { - Logger.Log("Uploading map : " + uploadMaps[o]); - //Generování TransferID - - RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); - byte[] rndNumber = new byte[20]; - rng.GetBytes(rndNumber); - string TransferID = Convert.ToBase64String(rndNumber); - - //TransferID - TransferID = TransferID.Remove(TransferID.Length - 1); - - - //Odeslání TransferID na server - url = Configuration.Instance.WebCoreAddress + "/dynmap-core.php?user=server"; - string TransferIDdata = "TransferID=" + Uri.EscapeDataString(TransferID) + "&privatekey=" + PrivateKey; - var postTransferID = Encoding.ASCII.GetBytes(TransferIDdata); - - CookieContainer cookies = new CookieContainer(); - HttpWebRequest requestTransferID = (HttpWebRequest)WebRequest.Create(url); - - requestTransferID.Method = "POST"; - requestTransferID.ContentType = "application/x-www-form-urlencoded"; - requestTransferID.ContentLength = TransferIDdata.Length; - requestTransferID.CookieContainer = cookies; - using (var stream = requestTransferID.GetRequestStream()) - { - stream.Write(postTransferID, 0, postTransferID.Length); - } - - HttpWebResponse responseTransferID = (HttpWebResponse)requestTransferID.GetResponse(); - using (Stream stream = responseTransferID.GetResponseStream()) - { - StreamReader reader = new StreamReader(stream, Encoding.UTF8); - output = reader.ReadToEnd(); - } - - //Nahrání souborů map na server - System.Net.WebClient Client = new System.Net.WebClient (); - Client.Headers.Add("Content-Type", "binary/octet-stream"); - byte[] result = Client.UploadFile(Configuration.Instance.WebCoreAddress + "/dynmap-core.php?user=server&do=uploadfile&TransferID=" + Uri.EscapeDataString(TransferID) + "&mapname=" + Uri.EscapeDataString(uploadMaps[o].Split('\\')[uploadMaps[0].Split('\\').Length - 1]), "POST", @"../../../Maps/" + uploadMaps[o] + @"/Map.png"); - String s = System.Text.Encoding.UTF8.GetString (result,0,result.Length); - - if (s == "Error.UploadDone") - { - Logger.LogWarning("Uploaded " + uploadMaps[o]); - } - else if (s == "1Error.UploadFailed") - { - Logger.LogError("Uploading " + uploadMaps[o] + " failed because the uploaded file exceeds the upload_max_filesize directive in php.ini."); - Logger.LogError("See http://php.net/manual/en/ini.core.php#ini.upload-max-filesize for further information!"); - } - else - { - Logger.LogError("Uploading " + uploadMaps[o] + " failed!"); - } - } - if (o == uploadMaps.Length - 1) { Logger.LogWarning("Uploading done!");}; - - } - - //Časovač odesílající data o pozici na server - myTimer = new System.Timers.Timer(); - myTimer.Elapsed += new ElapsedEventHandler(callFunc); - myTimer.Interval = Configuration.Instance.syncInterval; - myTimer.Enabled = true; - - //Přidání hráčů do listu při načtení pluginu - int f = 0; - foreach (SDG.Unturned.SteamPlayer plr in SDG.Unturned.Provider.Players) - { - UnturnedPlayer unturnedPlayer = UnturnedPlayer.FromSteamPlayer(plr); - Nicks.Add(unturnedPlayer.CSteamID); - f++; - } - - //Přidání hráčů do listu při připojení na server - U.Events.OnPlayerConnected += (UnturnedPlayer player) => - { - Nicks.Add(player.CSteamID); - }; - //Odebrání hráčů z listu při odpojení ze serveru - U.Events.OnPlayerDisconnected += (UnturnedPlayer player) => - { - Nicks.Remove(player.CSteamID); - }; - U.Events.OnShutdown += () => - { - shutdown = true; - ShowCords(); - }; - } - - //Zjištění souřadnic - private void callFunc(object sender, EventArgs e) - { - ShowCords(); - } - - private void ShowCords() - { - int count = Nicks.Count; - data = string.Empty; - url = string.Empty; - encoded = string.Empty; - - //Pro každého hráče zjistí jméno, CSteamID a pozici - for (int i = 1; i <= count; i++) - { - UnturnedPlayer player = UnturnedPlayer.FromCSteamID(Nicks[i - 1]); - characterName = player.CharacterName.Replace(";", ";").Replace("[", "[").Replace("]", "]").Replace("=", "="); - rotation = Convert.ToInt32(player.Rotation); - if (player.IsAdmin == true) { playerStatus = "admin"; } else if (player.IsPro == true) { playerStatus = "pro"; } else { playerStatus = "player"; } - if (Configuration.Instance.displayInChat == true) { UnturnedChat.Say(player, player.Position + "=Position"); } - if (player.Features.VanishMode == false) { data = data + "[Charactername=" + characterName + ";CSteamID=" + player.CSteamID + ";Position=" + player.Position + ";Rotation=" + rotation + ";PlayerStatus=" + playerStatus + "]"; }; - } - - //Odešle data na server - if (data != string.Empty || firstrun == true) - { - url = Configuration.Instance.WebCoreAddress + "/dynmap-core.php?user=server"; - postData = "map=" + Uri.EscapeDataString(SDG.Unturned.Provider.map) + "&data=" + Uri.EscapeDataString(data) + "&privatekey=" + PrivateKey; - if (shutdown == true) { postData = "map=" + Uri.EscapeDataString(SDG.Unturned.Provider.map) + "&privatekey=" + PrivateKey; }; - var post = Encoding.ASCII.GetBytes(postData); - - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); - - request.Method = "POST"; - request.ContentType = "application/x-www-form-urlencoded"; - request.ContentLength = post.Length; - using (var stream = request.GetRequestStream()) - { - stream.Write(post, 0, post.Length); - } - - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - using (Stream stream = response.GetResponseStream()) - { - StreamReader reader = new StreamReader(stream, Encoding.UTF8); - output = reader.ReadToEnd(); - } - - //Deaktivuje plugin, pokud se PrivateKey neshoduje - if (output == "Error.PrivateKeyNotMatch") - { - Logger.LogError("Priavte keys in dynmap-config.php and in Dynmap.configuration.xml doesn't match!"); - Logger.LogError("Unloading plugin!"); - myTimer.Enabled = false; - } - - if (data != string.Empty) { firstrun = true; } else { firstrun = false; }; - } - } - } -} \ No newline at end of file diff --git a/Dynmap/Dynmap.csproj b/Dynmap/Dynmap.csproj deleted file mode 100644 index 12d9e29..0000000 --- a/Dynmap/Dynmap.csproj +++ /dev/null @@ -1,78 +0,0 @@ - - - - - Debug - AnyCPU - {3A5AF8BC-41A6-46A3-8677-A6B54B278B68} - Library - Properties - Dynmap - Dynmap - v4.5.2 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - References\RocketMod\Assembly-CSharp.dll - False - - - References\Unturned\Assembly-CSharp-firstpass.dll - False - - - References\RocketMod\Rocket.API.dll - False - - - References\RocketMod\Rocket.Core.dll - False - - - References\RocketMod\Rocket.Unturned.dll - False - - - - - - - - - - - References\Unturned\UnityEngine.dll - False - - - - - - - - - \ No newline at end of file diff --git a/Dynmap/Properties/AssemblyInfo.cs b/Dynmap/Properties/AssemblyInfo.cs deleted file mode 100644 index c3e6d51..0000000 --- a/Dynmap/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Les informations générales relatives à un assembly dépendent de -// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations -// associées à un assembly. -[assembly: AssemblyTitle("Dynmap")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Dynmap")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly -// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de -// COM, affectez la valeur true à l'attribut ComVisible sur ce type. -[assembly: ComVisible(false)] - -// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM -[assembly: Guid("3a5af8bc-41a6-46a3-8677-a6b54b278b68")] - -// Les informations de version pour un assembly se composent des quatre valeurs suivantes : -// -// Version principale -// Version secondaire -// Numéro de build -// Révision -// -// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut -// en utilisant '*', comme indiqué ci-dessous : -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Dynmap/References/RocketMod/README.md b/Dynmap/References/RocketMod/README.md deleted file mode 100644 index 0e98380..0000000 --- a/Dynmap/References/RocketMod/README.md +++ /dev/null @@ -1,9 +0,0 @@ -## RocketMod - -Download RocketMod from https://rocketmod.net/get-rocket - -Copy/Paste file from RocketMod to this folder : -* Assembly-CSharp.dll -* Rocket.API.dll -* Rocket.Core.dll -* Rocket.Unturned.dll diff --git a/Dynmap/References/Unturned/README.md b/Dynmap/References/Unturned/README.md deleted file mode 100644 index fc45d6c..0000000 --- a/Dynmap/References/Unturned/README.md +++ /dev/null @@ -1,9 +0,0 @@ -## Unturned - -Copy/Paste file from your Unturned game. -Files are located : -> Unturned\Unturned_Data\Managed - -Copy/Paste file from RocketMod to this folder : -* Assembly-CSharp-firstpass.dll -* UnityEngine.dll diff --git a/README.md b/README.md index 2e79a10..7c8c9bd 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ -# Unturned Dynmap - -_**Only for Windows**_ -If you want use Linux version, checkout [Linux branch](https://github.com/AnthoDingo/DynmapSource/tree/Linux) - -## 1 Required files - -Read the README in folders Dynmap/References/RocketMod and Dynmap/References/RocketMod - -## 2 Build - -After copyign required files, you can start the solution and build the project. \ No newline at end of file +# Unturned Dynmap + +The project is divied in 2 branch: +* [Windows](https://github.com/AnthoDingo/DynmapSource/tree/Windows) +* [Linux](https://github.com/AnthoDingo/DynmapSource/tree/Linux) +* [Web](https://github.com/AnthoDingo/DynmapSource/tree/Web) + + +Windows and Linux are source code for Unturned Plugins. + +Web is required to display players on the map. \ No newline at end of file