Changeset 251 for binary-improvements
- Timestamp:
- Oct 28, 2015, 7:51:20 PM (9 years ago)
- Location:
- binary-improvements
- Files:
-
- 15 added
- 1 deleted
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-binaries/README.txt
r244 r251 1 1 Put the Assembly-CSharp.dll, Assembly-CSharp-firstpass.dll, LogLibrary.dll, mscorlib.dll, 2 System.dll, System. Xml.dll and UnityEngine.dll from your dedicated server in this folder.2 System.dll, System.Drawing.dll, System.Xml.dll and UnityEngine.dll from your dedicated server in this folder. 3 3 -
binary-improvements/7dtd-server-fixes/7dtd-server-fixes.csproj
r244 r251 1 <?xml version="1.0" encoding="utf-8"?>1 <?xml version="1.0" encoding="utf-8"?> 2 2 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 3 3 <PropertyGroup> … … 46 46 <Private>False</Private> 47 47 </Reference> 48 <Reference Include="System.Drawing"> 49 <HintPath>..\7dtd-binaries\System.Drawing.dll</HintPath> 50 <Private>False</Private> 51 </Reference> 48 52 <Reference Include="UnityEngine"> 49 53 <HintPath>..\7dtd-binaries\UnityEngine.dll</HintPath> … … 62 66 <Compile Include="src\AssemblyInfo.cs" /> 63 67 <Compile Include="src\AllocsLogFunctions.cs" /> 68 <Compile Include="src\LiveData\Animals.cs" /> 69 <Compile Include="src\LiveData\Hostiles.cs" /> 64 70 <Compile Include="src\PlayerDataStuff.cs" /> 65 71 <Compile Include="src\PersistentData\PersistentContainer.cs" /> … … 86 92 <Compile Include="src\API.cs" /> 87 93 <Compile Include="src\ChatHookExample.cs" /> 94 <Compile Include="src\PetesUtils.cs" /> 88 95 </ItemGroup> 89 96 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> -
binary-improvements/7dtd-server-fixes/src/PersistentData/InvItem.cs
r250 r251 11 11 public int quality; 12 12 public InvItem[] parts; 13 public string icon = ""; 14 public string iconcolor = ""; 13 15 14 16 public InvItem (string itemName, int count, int quality = -1) -
binary-improvements/7dtd-server-fixes/src/PersistentData/Inventory.cs
r250 r251 72 72 item = new InvItem (name, _count); 73 73 } 74 75 // Figure out the icon's name 76 string icon_name = ""; 77 78 ItemClass item_class = ItemClass.list [_itemValue.type]; 79 80 if (!PetesUtils.ValidText (icon_name)) { 81 try { 82 icon_name = item_class.GetIconName (); 83 } 84 catch { } 85 } 86 87 if (!PetesUtils.ValidText (icon_name)) { 88 try { 89 icon_name = item_class.MeshFile; 90 } 91 catch { } 92 } 93 94 if (!PetesUtils.ValidText (icon_name)) { 95 try { 96 icon_name = item_class.DropMeshFile; 97 } 98 catch { } 99 } 100 101 if (!PetesUtils.ValidText (icon_name)) 102 icon_name = item_class.GetItemName (); 103 104 if (icon_name.Contains ("\\")) 105 icon_name = icon_name.Substring (icon_name.LastIndexOf ("\"") + 1); 106 107 item.icon = icon_name; 108 109 try { 110 item.iconcolor = item_class.CustomIconTint.ToHexStringRGB (); 111 } 112 catch { 113 item.iconcolor = "FFFFFF"; 114 } 115 74 116 return item; 75 117 } else { … … 77 119 } 78 120 } 79 80 81 121 } 82 122 } 83 -
binary-improvements/7dtd-server-fixes/src/PersistentData/Players.cs
r233 r251 6 6 namespace AllocsFixes.PersistentData 7 7 { 8 8 [Serializable] 9 9 public class Players 10 10 { -
binary-improvements/AllocsCommands/AllocsCommands.csproj
r238 r251 49 49 <Compile Include="Commands\ShowInventory.cs" /> 50 50 <Compile Include="Commands\TeleportPlayer.cs" /> 51 <Compile Include="PrivateM assageConnections.cs" />51 <Compile Include="PrivateMessageConnections.cs" /> 52 52 <Compile Include="Chat.cs" /> 53 53 <Compile Include="Commands\ListItems.cs" /> -
binary-improvements/AllocsCommands/Chat.cs
r238 r251 8 8 string senderName; 9 9 if (_sender != null) { 10 PrivateM assageConnections.SetLastPMSender (_sender, _receiver);10 PrivateMessageConnections.SetLastPMSender (_sender, _receiver); 11 11 senderName = _sender.playerName; 12 12 } else { -
binary-improvements/AllocsCommands/Commands/Reply.cs
r238 r251 31 31 string message = _params [0]; 32 32 33 ClientInfo receiver = PrivateM assageConnections.GetLastPMSenderForPlayer (_sender);33 ClientInfo receiver = PrivateMessageConnections.GetLastPMSenderForPlayer (_sender); 34 34 if (receiver != null) { 35 35 Chat.SendMessage (receiver, _sender, message); -
binary-improvements/MapRendering/Web/API/GetLandClaims.cs
r245 r251 11 11 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel) 12 12 { 13 string steamid = string.Empty; 13 string ViewersSteamID = string.Empty; 14 ulong lViewersSteamID = 0L; 14 15 15 16 if (req.QueryString ["steamid"] != null) { 16 long tempLong; 17 steamid = req.QueryString ["steamid"]; 18 if (steamid.Length != 17 || !long.TryParse (steamid, out tempLong)) { 17 ViewersSteamID = req.QueryString ["steamid"]; 18 if (ViewersSteamID.Length != 17 || !ulong.TryParse (ViewersSteamID, out lViewersSteamID)) { 19 19 resp.StatusCode = (int)HttpStatusCode.BadRequest; 20 20 Web.SetResponseTextContent (resp, "Invalid SteamID given"); … … 23 23 } 24 24 25 // default user, cheap way to avoid 'null reference exception' 26 try { user = user ?? new WebConnection ("", "", 0L); } catch { } 27 28 bool bViewAll = false; try { bViewAll = user.CanViewAllClaims (permissionLevel); } catch { } 29 25 30 JSONObject result = new JSONObject (); 26 31 result.Add ("claimsize", new JSONNumber (GamePrefs.GetInt (EnumGamePrefs.LandClaimSize))); … … 33 38 World w = GameManager.Instance.World; 34 39 Dictionary<PersistentPlayerData, List<Vector3i>> owners = new Dictionary<PersistentPlayerData, List<Vector3i>> (); 40 41 // Add all owners to this temporary list regardless of permissions 35 42 foreach (KeyValuePair<Vector3i, PersistentPlayerData> kvp in d) { 36 if ( steamid.Length == 0 || kvp.Value.PlayerId.Equals (steamid)) {43 if (kvp.Value.PlayerId.Equals (ViewersSteamID)) { 37 44 if (!owners.ContainsKey (kvp.Value)) { 38 45 owners.Add (kvp.Value, new List<Vector3i> ()); … … 42 49 } 43 50 51 // Loop through all claim owners... 44 52 foreach (KeyValuePair<PersistentPlayerData, List<Vector3i>> kvp in owners) { 45 if (steamid.Length == 0 || kvp.Key.PlayerId.Equals (steamid)) { 46 string curID = kvp.Key.PlayerId; 47 bool isActive = w.IsLandProtectionValidForPlayer (kvp.Key); 53 try 54 { 55 // ... but only show us claims that are from the current web user or if the current web user can see all claims regardless of ownership 56 if (kvp.Key.PlayerId.Equals (ViewersSteamID) || bViewAll) 57 { 58 string currentSteamID = kvp.Key.PlayerId; 59 bool isActive = w.IsLandProtectionValidForPlayer (kvp.Key); 48 60 49 50 61 JSONObject owner = new JSONObject (); 62 claimOwners.Add (owner); 51 63 52 owner.Add ("steamid", new JSONString (curID));53 owner.Add("claimactive", new JSONBoolean (isActive));64 owner.Add("steamid", new JSONString (currentSteamID)); 65 owner.Add("claimactive", new JSONBoolean (isActive)); 54 66 55 if (PersistentContainer.Instance.Players [curID, false] != null) {56 owner.Add ("playername", new JSONString (PersistentContainer.Instance.Players [curID, false].Name));57 58 owner.Add("playername", new JSONNull ());59 67 if (PersistentContainer.Instance.Players [currentSteamID, false] != null) { 68 owner.Add("playername", new JSONString (PersistentContainer.Instance.Players [currentSteamID, false].Name)); 69 } else { 70 owner.Add("playername", new JSONNull ()); 71 } 60 72 61 62 73 JSONArray claims = new JSONArray (); 74 owner.Add ("claims", claims); 63 75 64 65 66 67 68 76 foreach (Vector3i v in kvp.Value) { 77 JSONObject claim = new JSONObject (); 78 claim.Add ("x", new JSONNumber (v.x)); 79 claim.Add ("y", new JSONNumber (v.y)); 80 claim.Add ("z", new JSONNumber (v.z)); 69 81 70 claims.Add (claim); 71 } 72 } 82 claims.Add (claim); 83 } 84 } 85 } 86 catch { } 73 87 } 74 88 } -
binary-improvements/MapRendering/Web/API/GetPlayerInventory.cs
r250 r251 75 75 JSONObject jsonItem = new JSONObject (); 76 76 jsonItem.Add ("count", new JSONNumber (_item.count)); 77 jsonItem.Add ("name", new JSONString (_item.itemName)); 78 jsonItem.Add ("quality", new JSONNumber (_item.quality)); 77 jsonItem.Add ("name", new JSONString (_item.itemName)); 78 jsonItem.Add ("icon", new JSONString (_item.icon)); 79 jsonItem.Add ("iconcolor", new JSONString ((string.IsNullOrEmpty (_item.iconcolor) || _item.iconcolor == "FFFFFF" ? "" : _item.iconcolor))); 80 jsonItem.Add ("quality", new JSONNumber(_item.quality)); 79 81 if (_item.quality >= 0) { 80 82 jsonItem.Add ("qualitycolor", new JSONString (QualityInfo.GetQualityColorHex (_item.quality))); -
binary-improvements/MapRendering/Web/API/GetPlayersLocation.cs
r244 r251 11 11 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel) 12 12 { 13 JSONArray playersJsResult = new JSONArray (); 13 AdminTools admTools = null; 14 15 try { admTools = GameManager.Instance.adminTools; } catch { } 16 try { user = user ?? new WebConnection ("", "", 0L); } catch { } // default user, cheap way to avoid 'null reference exception' 17 18 bool bViewAll = false; try { bViewAll = user.CanViewAllPlayers (permissionLevel); } catch { } 19 20 JSONArray playersJsResult = new JSONArray (); 14 21 15 22 Players playersList = PersistentContainer.Instance.Players; 16 23 17 24 foreach (string sid in playersList.SteamIDs) { 18 Player p = playersList[sid, false]; 25 try { 26 if ((admTools != null) && (PetesUtils.ValidText (sid))) 27 if (admTools.IsBanned (sid)) 28 continue; 29 } 30 catch { } 19 31 20 JSONObject pos = new JSONObject(); 21 pos.Add("x", new JSONNumber(p.LastPosition.x)); 22 pos.Add("y", new JSONNumber(p.LastPosition.y)); 23 pos.Add("z", new JSONNumber(p.LastPosition.z)); 32 try 33 { 34 Player p = playersList [sid, false]; 24 35 25 JSONObject pJson = new JSONObject(); 26 pJson.Add("steamid", new JSONString(sid)); 27 pJson.Add("ip", new JSONString(p.IP)); 28 pJson.Add("name", new JSONString(p.Name)); 29 pJson.Add("online", new JSONBoolean(p.IsOnline)); 30 pJson.Add("position", pos); 36 ulong player_steam_ID = 0L; 37 if (!ulong.TryParse (sid, out player_steam_ID)) 38 player_steam_ID = 0L; 31 39 32 playersJsResult.Add(pJson); 33 } 40 if ((player_steam_ID == user.SteamID) || bViewAll) { 41 JSONObject pos = new JSONObject (); 42 pos.Add("x", new JSONNumber (p.LastPosition.x)); 43 pos.Add("y", new JSONNumber (p.LastPosition.y)); 44 pos.Add("z", new JSONNumber (p.LastPosition.z)); 34 45 35 WriteJSON(resp, playersJsResult); 46 JSONObject pJson = new JSONObject (); 47 pJson.Add("steamid", new JSONString (sid)); 48 pJson.Add("ip", new JSONString (p.IP)); 49 pJson.Add("name", new JSONString (p.Name)); 50 pJson.Add("online", new JSONBoolean (p.IsOnline)); 51 pJson.Add("position", pos); 52 53 playersJsResult.Add (pJson); 54 } 55 } 56 catch { } 57 } 58 59 WriteJSON (resp, playersJsResult); 36 60 } 37 61 } -
binary-improvements/MapRendering/Web/API/GetStats.cs
r245 r251 1 1 using AllocsFixes.JSON; 2 using AllocsFixes.LiveData; 2 3 using AllocsFixes.PersistentData; 3 4 using System; … … 20 21 21 22 result.Add ("players", new JSONNumber (GameManager.Instance.World.Players.Count)); 23 result.Add ("hostiles", new JSONNumber (Hostiles.Count)); 24 result.Add ("animals", new JSONNumber (Animals.Count)); 22 25 23 26 WriteJSON (resp, result); -
binary-improvements/MapRendering/Web/API/GetWebUIUpdates.cs
r250 r251 1 1 using AllocsFixes.JSON; 2 using AllocsFixes.LiveData; 2 3 using AllocsFixes.PersistentData; 3 4 using System; … … 23 24 24 25 result.Add ("players", new JSONNumber (GameManager.Instance.World.Players.Count)); 26 result.Add ("hostiles", new JSONNumber (Hostiles.Count)); 27 result.Add ("animals", new JSONNumber (Animals.Count)); 25 28 26 29 result.Add ("newlogs", new JSONNumber (LogBuffer.Instance.LatestLine - latestLine)); -
binary-improvements/MapRendering/Web/Handlers/ApiHandler.cs
r250 r251 13 13 private Dictionary<String, WebAPI> apis = new Dictionary<string, WebAPI> (); 14 14 15 public ApiHandler (string staticPart, string moduleName = null) : base (moduleName) {15 public ApiHandler (string staticPart, string moduleName = null) : base (moduleName) { 16 16 this.staticPart = staticPart; 17 17 18 18 foreach (Type t in Assembly.GetExecutingAssembly ().GetTypes ()) { 19 19 if (!t.IsAbstract && t.IsSubclassOf (typeof(WebAPI))) { 20 ConstructorInfo ctor = t.GetConstructor (new Type [0]);20 ConstructorInfo ctor = t.GetConstructor (new Type [0]); 21 21 if (ctor != null) { 22 WebAPI apiInstance = (WebAPI)ctor.Invoke (new object [0]);22 WebAPI apiInstance = (WebAPI)ctor.Invoke (new object [0]); 23 23 addApi (t.Name.ToLower (), apiInstance); 24 24 } 25 25 } 26 26 } 27 28 // Add dummy types 29 Type dummy_t = typeof (API.Null); 30 ConstructorInfo dummy_ctor = dummy_t.GetConstructor (new Type [0]); 31 if (dummy_ctor != null) { 32 WebAPI dummy_apiInstance = (WebAPI)dummy_ctor.Invoke (new object[0]); 33 34 // Permissions that don't map to a real API 35 addApi("viewallclaims", dummy_apiInstance); 36 addApi("viewallplayers", dummy_apiInstance); 37 } 27 38 } 28 39 -
binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs
r244 r251 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.IO;4 3 using System.Net; 5 4 using System.Threading; … … 13 12 private string staticPart; 14 13 private bool logMissingFiles; 15 16 14 private Dictionary<string, byte[]> icons = new Dictionary<string, byte[]> (); 15 private bool loaded = false; 17 16 18 17 public ItemIconHandler (string staticPart, bool logMissingFiles, string moduleName = null) : base(moduleName) { … … 30 29 } 31 30 32 string fn = req.Url.AbsolutePath.Remove (0, staticPart.Length); 33 fn = fn.Remove (fn.LastIndexOf ('.')); 31 // BEGIN CHANGED BY PSOUZA4 32 string requestFileName = req.Url.AbsolutePath.Remove (0, staticPart.Length); 33 requestFileName = requestFileName.Remove (requestFileName.LastIndexOf ('.')); 34 34 35 if (icons.ContainsKey (fn)) { 35 string requestColorTintHex = string.Empty; 36 37 // Chose a split instead of using a querystring variable in the URI, but that may arguably be cleaner 38 if (requestFileName.Contains("@@")) { 39 try { 40 string[] tempTintingOptions = requestFileName.Split (new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries); 41 requestFileName = tempTintingOptions [0]; 42 requestColorTintHex = tempTintingOptions [1].Trim ().ToUpper (); 43 } 44 catch { } 45 } 46 47 if (icons.ContainsKey (requestFileName) && req.Url.AbsolutePath.ToLower ().EndsWith(".png")) { 36 48 resp.ContentType = MimeType.GetMimeType (".png"); 37 resp.ContentLength64 = icons [fn].Length; 38 resp.OutputStream.Write (icons [fn], 0, icons [fn].Length); 49 50 byte[] itemIconData = icons [requestFileName]; 51 52 // Note: optionally split this code into a ImageMultiplyBlend method 53 if (!string.IsNullOrEmpty (requestColorTintHex) && (requestColorTintHex != "FFFFFF")) { 54 try { 55 System.Drawing.Color colorTint = System.Drawing.ColorTranslator.FromHtml ("#" + requestColorTintHex); 56 System.Drawing.Bitmap image = (System.Drawing.Bitmap)PetesUtils.GetImageFromBytes (itemIconData); 57 58 for (var x = 0; x < image.Width; x++) { 59 for (int y = 0; y < image.Height; y++) { 60 System.Drawing.Color originalColor = image.GetPixel (x, y); 61 System.Drawing.Color changedColor = originalColor; 62 63 // Only change the icon tinting if the alpha channel is fully opaque 64 if (originalColor.A == 255) { 65 // based on http://stackoverflow.com/questions/3837757/multiply-two-images-in-c-sharp-as-multiply-two-layers-in-photoshop 66 67 double component_R = (((double)originalColor.R) * ((double)colorTint.R)) / 255.0; 68 double component_G = (((double)originalColor.G) * ((double)colorTint.G)) / 255.0; 69 double component_B = (((double)originalColor.B) * ((double)colorTint.B)) / 255.0; 70 71 if (component_R > 255.0) component_R = 255.0; 72 if (component_G > 255.0) component_G = 255.0; 73 if (component_B > 255.0) component_B = 255.0; 74 75 // multiply blend shouldn't ever calculate below 0, but for completeness let's leave in this logic 76 if (component_R < 0.0) component_R = 0.0; 77 if (component_G < 0.0) component_G = 0.0; 78 if (component_B < 0.0) component_B = 0.0; 79 80 changedColor = System.Drawing.Color.FromArgb (originalColor.A, (int)component_R, (int)component_G, (int)component_B); 81 } 82 83 image.SetPixel (x, y, changedColor); 84 } 85 } 86 87 itemIconData = PetesUtils.SaveImage_ToBytes (image, true); 88 } 89 catch { } 90 } 91 92 resp.ContentLength64 = itemIconData.Length; 93 resp.OutputStream.Write (itemIconData, 0, itemIconData.Length); 94 // END CHANGED BY PSOUZA4 39 95 } else { 40 96 resp.StatusCode = (int)HttpStatusCode.NotFound; -
binary-improvements/MapRendering/Web/Handlers/StaticHandler.cs
r244 r251 27 27 28 28 byte[] content = cache.GetFileContent (datapath + "/" + fn); 29 29 30 if (content != null) { 30 31 resp.ContentType = MimeType.GetMimeType (Path.GetExtension (fn)); -
binary-improvements/MapRendering/Web/WebConnection.cs
r250 r251 1 1 using System; 2 2 using System.Collections.Generic; 3 3 using AllocsFixes.NetConnections.Servers.Web; 4 4 using UnityEngine; 5 5 … … 29 29 get { return DateTime.Now - lastAction; } 30 30 } 31 32 public bool CanViewAllPlayers (int _permissionLevel) { 33 bool val = false; 34 35 try { 36 const int defaultPermissionLevel = 0; 37 38 val = _permissionLevel <= defaultPermissionLevel; 39 40 foreach (WebPermissions.WebModulePermission wap in WebPermissions.Instance.GetModules ()) 41 if (wap.module.Trim ().ToLower () == "webapi.viewallplayers") 42 val = _permissionLevel <= wap.permissionLevel; 43 } 44 catch { } 45 46 return val; 47 } 48 49 public bool CanViewAllClaims (int _permissionLevel) { 50 bool val = false; 51 52 try { 53 const int defaultPermissionLevel = 0; 54 55 val = _permissionLevel <= defaultPermissionLevel; 56 57 foreach (WebPermissions.WebModulePermission wap in WebPermissions.Instance.GetModules ()) 58 if (wap.module.Trim ().ToLower () == "webapi.viewallclaims") 59 val = _permissionLevel <= wap.permissionLevel; 60 } 61 catch { } 62 63 return val; 64 } 31 65 32 66 public WebConnection (string _sessionId, string _endpoint, ulong _steamId) { -
binary-improvements/MapRendering/Web/WebPermissions.cs
r244 r251 99 99 if (!string.IsNullOrEmpty (_module)) { 100 100 lock (this) { 101 knownModules.Add (_module, new WebModulePermission (_module, 0)); 101 if (!IsKnownModule( _module)) { 102 knownModules.Add (_module, new WebModulePermission (_module, 0)); 103 } 102 104 } 103 105 } … … 269 271 270 272 using (StreamWriter sw = new StreamWriter(GetFullPath ())) { 271 sw.WriteLine ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); 272 sw.WriteLine ("<webpermissions>"); 273 sw.WriteLine (" <admintokens>"); 274 sw.WriteLine (" <!-- <token name=\"adminuser1\" token=\"supersecrettoken\" permission_level=\"0\" /> -->"); 275 foreach (AdminToken at in admintokens.Values) { 276 sw.WriteLine (string.Format (" <token name=\"{0}\" token=\"{1}\" permission_level=\"{2}\" />", at.name, at.token, at.permissionLevel)); 277 } 278 sw.WriteLine (" </admintokens>"); 279 sw.WriteLine (); 280 sw.WriteLine (" <permissions>"); 281 sw.WriteLine (" <!-- <permission module=\"webapi.executeconsolecommand\" permission_level=\"0\" /> -->"); 282 sw.WriteLine (" <!-- <permission module=\"webapi.getplayersonline\" permission_level=\"1\" /> -->"); 283 sw.WriteLine (" <!-- <permission module=\"web.map\" permission_level=\"1000\" /> -->"); 284 foreach (WebModulePermission wap in modules.Values) { 285 sw.WriteLine (string.Format (" <permission module=\"{0}\" permission_level=\"{1}\" />", wap.module, wap.permissionLevel)); 286 } 287 sw.WriteLine (" </permissions>"); 288 sw.WriteLine (); 289 sw.WriteLine ("</webpermissions>"); 290 273 sw.WriteLine ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); 274 sw.WriteLine ("<webpermissions>"); 275 sw.WriteLine (); 276 sw.WriteLine (" <admintokens>"); 277 sw.WriteLine (" <!-- <token name=\"adminuser1\" token=\"supersecrettoken\" permission_level=\"0\" /> -->"); 278 foreach (AdminToken at in admintokens.Values) { 279 sw.WriteLine (string.Format (" <token name=\"{0}\" token=\"{1}\" permission_level=\"{2}\" />", at.name, at.token, at.permissionLevel)); 280 } 281 sw.WriteLine (" </admintokens>"); 282 sw.WriteLine (); 283 sw.WriteLine (" <permissions>"); 284 foreach (WebModulePermission wap in modules.Values) { 285 sw.WriteLine (string.Format (" <permission module=\"{0}\" permission_level=\"{1}\" />", wap.module, wap.permissionLevel)); 286 } 287 sw.WriteLine (" <!-- <permission module=\"web.map\" permission_level=\"1000\" /> -->"); 288 sw.WriteLine (); 289 sw.WriteLine (" <!-- <permission module=\"webapi.getlog\" permission_level=\"0\" /> -->"); 290 sw.WriteLine (" <!-- <permission module=\"webapi.executeconsolecommand\" permission_level=\"0\" /> -->"); 291 sw.WriteLine (); 292 sw.WriteLine (" <!-- <permission module=\"webapi.getstats\" permission_level=\"1000\" /> -->"); 293 sw.WriteLine (" <!-- <permission module=\"webapi.getplayersonline\" permission_level=\"1000\" /> -->"); 294 sw.WriteLine (); 295 sw.WriteLine (" <!-- <permission module=\"webapi.getplayerslocation\" permission_level=\"1000\" /> -->"); 296 sw.WriteLine (" <!-- <permission module=\"webapi.viewallplayers\" permission_level=\"1\" /> -->"); 297 sw.WriteLine (); 298 sw.WriteLine (" <!-- <permission module=\"webapi.getlandclaims\" permission_level=\"1000\" /> -->"); 299 sw.WriteLine (" <!-- <permission module=\"webapi.viewallclaims\" permission_level=\"1\" /> -->"); 300 sw.WriteLine (); 301 sw.WriteLine (" <!-- <permission module=\"webapi.getplayerinventory\" permission_level=\"1\" /> -->"); 302 sw.WriteLine (); 303 sw.WriteLine (" <!-- <permission module=\"webapi.gethostilelocation\" permission_level=\"1\" /> -->"); 304 sw.WriteLine (" <!-- <permission module=\"webapi.getanimalslocation\" permission_level=\"1\" /> -->"); 305 sw.WriteLine (" </permissions>"); 306 sw.WriteLine (); 307 sw.WriteLine ("</webpermissions>"); 308 291 309 sw.Flush (); 292 310 sw.Close (); -
binary-improvements/MapRendering/WebAndMapRendering.csproj
r250 r251 1 <?xml version="1.0" encoding="utf-8"?>1 <?xml version="1.0" encoding="utf-8"?> 2 2 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 3 3 <PropertyGroup> … … 21 21 </PropertyGroup> 22 22 <ItemGroup> 23 <Reference Include="System" /> 23 <Reference Include="System"> 24 <HintPath>..\7dtd-binaries\System.dll</HintPath> 25 <Private>False</Private> 26 </Reference> 27 <Reference Include="System.Drawing"> 28 <HintPath>..\7dtd-binaries\System.Drawing.dll</HintPath> 29 <Private>False</Private> 30 </Reference> 24 31 <Reference Include="LogLibrary"> 25 32 <HintPath>..\7dtd-binaries\LogLibrary.dll</HintPath> … … 51 58 <Compile Include="Commands\EnableRendering.cs" /> 52 59 <Compile Include="API.cs" /> 60 <Compile Include="Web\API\GetAnimalsLocation.cs" /> 61 <Compile Include="Web\API\GetRawEntitiesList.cs" /> 62 <Compile Include="Web\API\GetHostileLocation.cs" /> 63 <Compile Include="Web\API\Null.cs" /> 53 64 <Compile Include="Web\Web.cs" /> 54 65 <Compile Include="Web\MimeType.cs" /> … … 87 98 </ProjectReference> 88 99 </ItemGroup> 89 <ItemGroup> 90 <Folder Include="Commands\" /> 91 <Folder Include="Web\Handlers\" /> 92 </ItemGroup> 100 <ItemGroup /> 93 101 <ItemGroup> 94 102 <None Include="ModInfo.xml"> -
binary-improvements/webserver/index.html
r250 r251 3 3 <head> 4 4 <meta charset="UTF-8"> 5 <title>7 dtd map browser</title>5 <title>7 Days to Die Map</title> 6 6 7 7 <!-- jQuery --> … … 59 59 <div id="serverstats"> 60 60 <span id="stats_time">-</span><br/> 61 <span id="stats_players">-</span> Players 61 <span id="stats_players">-</span> Players<br /> 62 <span id="stats_hostiles">-</span> Hostiles<br /> 63 <span id="stats_animals">-</span> Animals 62 64 </div> 63 65 … … 87 89 </div> 88 90 <div id="admincontent"> 89 <h1 id="nopermissionwarning" style="display:none">An error occured or you do not have any permissions on this WebPanel. Log in with the link on the lower left!</h1>91 <h1 id="nopermissionwarning" style="display:none">An error occured or you have not logged in. Try logging in with the Steam login in the lower left!</h1> 90 92 <div id="tab_map" class="adminmap"></div> 91 93 <div id="tab_log" class="adminlog"> -
binary-improvements/webserver/js/inventory_dialog.js
r250 r251 19 19 20 20 if (itemdata !== null) { 21 cell.attr("style", "background-image: url(" + ITEMICONBASEURL + itemdata. name+ ".png);");21 cell.attr("style", "background-image: url(" + ITEMICONBASEURL + itemdata.icon + "@@" + itemdata.iconcolor + ".png);"); 22 22 if (itemdata.quality >= 0) { 23 23 cell.attr("title", itemdata.name + " (quality: " + itemdata.quality + ")"); -
binary-improvements/webserver/js/map.js
r250 r251 48 48 var tileLayerMiniMap = GetSdtdTileLayer (mapinfo, initTime, true); 49 49 50 50 // player icon 51 var playerIcon = L.icon({ 52 iconUrl: '/static/leaflet/images/marker-survivor.png', 53 iconRetinaUrl: '/static/leaflet/images/marker-survivor-2x.png', 54 iconSize: [25, 48], 55 iconAnchor: [12, 24], 56 popupAnchor: [0, -20] 57 }); 58 59 // hostile icon 60 var hostileIcon = L.icon({ 61 iconUrl: '/static/leaflet/images/marker-zombie.png', 62 iconRetinaUrl: '/static/leaflet/images/marker-zombie-2x.png', 63 iconSize: [25, 33], 64 iconAnchor: [12, 16], 65 popupAnchor: [0, -10] 66 }); 67 68 // animal icon 69 var animalIcon = L.icon({ 70 iconUrl: '/static/leaflet/images/marker-animal.png', 71 iconRetinaUrl: '/static/leaflet/images/marker-animal-2x.png', 72 iconSize: [25, 26], 73 iconAnchor: [12, 13], 74 popupAnchor: [0, -10] 75 }); 76 51 77 52 78 … … 58 84 }); 59 85 var playersOfflineMarkerGroup = L.markerClusterGroup({ 86 maxClusterRadius: function(zoom) { return zoom == mapinfo.maxzoom ? 10 : 50; } 87 }); 88 var hostilesMarkerGroup = L.markerClusterGroup({ 89 maxClusterRadius: function(zoom) { return zoom == mapinfo.maxzoom ? 10 : 50; } 90 }); 91 var animalsMarkerGroup = L.markerClusterGroup({ 60 92 maxClusterRadius: function(zoom) { return zoom == mapinfo.maxzoom ? 10 : 50; } 61 93 }); … … 107 139 } 108 140 141 if (HasPermission ("webapi.gethostilelocation")) { 142 layerControl.addOverlay (hostilesMarkerGroup, "Hostiles (<span id='mapControlHostileCount'>0</span>)"); 143 layerCount++; 144 } 145 146 if (HasPermission ("webapi.getanimalslocation")) { 147 layerControl.addOverlay (animalsMarkerGroup, "Animals (<span id='mapControlAnimalsCount'>0</span>)"); 148 layerCount++; 149 } 150 109 151 if (HasPermission ("webapi.getplayerslocation")) { 110 152 layerControl.addOverlay (playersOfflineMarkerGroup, "Players (offline) (<span id='mapControlOfflineCount'>0</span>)"); … … 120 162 121 163 164 var hostilesMappingList = {}; 165 var animalsMappingList = {}; 122 166 var playersMappingList = {}; 123 167 124 168 125 169 126 170 // =============================================================================================== … … 155 199 marker = playersMappingList[val.steamid].currentPosMarker; 156 200 } else { 157 marker = L.marker([val.position.x, val.position.z] ).bindPopup(201 marker = L.marker([val.position.x, val.position.z], {icon: playerIcon}).bindPopup( 158 202 "Player: " + val.name + 159 203 (HasPermission ("webapi.getplayerinventory") ? … … 226 270 227 271 272 273 274 // =============================================================================================== 275 // Hostiles markers 276 277 var setHostileMarkers = function(data) { 278 updatingMarkersHostile = true; 279 280 var hostileCount = 0; 281 282 hostilesMarkerGroup.clearLayers(); 283 284 $.each( data, function( key, val ) { 285 var marker; 286 if (hostilesMappingList.hasOwnProperty(val.id)) { 287 marker = hostilesMappingList[val.id].currentPosMarker; 288 } else { 289 marker = L.marker([val.position.x, val.position.z], {icon: hostileIcon}).bindPopup( 290 "Hostile: " + val.name 291 ); 292 //hostilesMappingList[val.id] = { }; 293 hostilesMarkerGroup.addLayer(marker); 294 } 295 296 var bAbort = false; 297 298 oldpos = marker.getLatLng (); 299 300 //if ( oldpos.lat != val.position.x || oldpos.lng != val.position.z ) { 301 // hostilesMarkerGroup.removeLayer(marker); 302 marker.setLatLng([val.position.x, val.position.z]); 303 marker.setOpacity(1.0); 304 hostilesMarkerGroup.addLayer(marker); 305 //} 306 307 val.currentPosMarker = marker; 308 hostilesMappingList[val.id] = val; 309 310 hostileCount++; 311 }); 312 313 $( "#mapControlHostileCount" ).text( hostileCount ); 314 315 updatingMarkersHostile = false; 316 } 317 318 var updateHostileTimeout; 319 var updateHostileEvent = function() { 320 $.getJSON( "../api/gethostilelocation") 321 .done(setHostileMarkers) 322 .fail(function(jqxhr, textStatus, error) { 323 console.log("Error fetching hostile list"); 324 }) 325 .always(function() { 326 updateHostileTimeout = window.setTimeout(updateHostileEvent, 4000); 327 }); 328 } 329 330 tabs.on ("tabbedcontenttabopened", function (event, data) { 331 if (data.newTab === "#tab_map") { 332 if (HasPermission ("webapi.gethostilelocation")) { 333 updateHostileEvent (); 334 } 335 } else { 336 window.clearTimeout (updateHostileTimeout); 337 } 338 }); 339 340 if (tabs.tabbedContent ("isTabOpen", "tab_map")) { 341 if (HasPermission ("webapi.gethostilelocation")) { 342 updateHostileEvent (); 343 } 344 } 345 346 347 348 // =============================================================================================== 349 // Animals markers 350 351 var setAnimalMarkers = function(data) { 352 updatingMarkersAnimals = true; 353 354 var animalsCount = 0; 355 356 animalsMarkerGroup.clearLayers(); 357 358 $.each( data, function( key, val ) { 359 var marker; 360 if (animalsMappingList.hasOwnProperty(val.id)) { 361 marker = animalsMappingList[val.id].currentPosMarker; 362 } else { 363 marker = L.marker([val.position.x, val.position.z], {icon: animalIcon}).bindPopup( 364 "Animal: " + val.name 365 ); 366 //animalsMappingList[val.id] = { }; 367 animalsMarkerGroup.addLayer(marker); 368 } 369 370 var bAbort = false; 371 372 oldpos = marker.getLatLng (); 373 374 //if ( oldpos.lat != val.position.x || oldpos.lng != val.position.z ) { 375 // animalsMarkerGroup.removeLayer(marker); 376 marker.setLatLng([val.position.x, val.position.z]); 377 marker.setOpacity(1.0); 378 animalsMarkerGroup.addLayer(marker); 379 //} 380 381 val.currentPosMarker = marker; 382 animalsMappingList[val.id] = val; 383 384 animalsCount++; 385 }); 386 387 $( "#mapControlAnimalsCount" ).text( animalsCount ); 388 389 updatingMarkersAnimals = false; 390 } 391 392 var updateAnimalsTimeout; 393 var updateAnimalsEvent = function() { 394 $.getJSON( "../api/getanimalslocation") 395 .done(setAnimalMarkers) 396 .fail(function(jqxhr, textStatus, error) { 397 console.log("Error fetching animals list"); 398 }) 399 .always(function() { 400 updateAnimalsTimeout = window.setTimeout(updateAnimalsEvent, 4000); 401 }); 402 } 403 404 tabs.on ("tabbedcontenttabopened", function (event, data) { 405 if (data.newTab === "#tab_map") { 406 if (HasPermission ("webapi.getanimalslocation")) { 407 updateAnimalsEvent (); 408 } 409 } else { 410 window.clearTimeout (updateAnimalsTimeout); 411 } 412 }); 413 414 if (tabs.tabbedContent ("isTabOpen", "tab_map")) { 415 if (HasPermission ("webapi.getanimalslocation")) { 416 updateAnimalsEvent (); 417 } 418 } 419 228 420 } 229 421 -
binary-improvements/webserver/js/stats.js
r250 r251 14 14 $("#stats_time").html (time); 15 15 $("#stats_players").html (data.players); 16 $("#stats_hostiles").html (data.hostiles); 17 $("#stats_animals").html (data.animals); 16 18 }) 17 19 .fail(function(jqxhr, textStatus, error) { … … 40 42 $("#stats_time").html (time); 41 43 $("#stats_players").html (data.players); 44 $("#stats_hostiles").html (data.hostiles); 45 $("#stats_animals").html (data.animals); 42 46 $("#newlogcount").html (data.newlogs); 43 47 if (data.newlogs > 0) { -
binary-improvements/webserver/sessionheader.tmpl
r244 r251 3 3 <head> 4 4 <meta charset="UTF-8"> 5 <title>7 dtd map browser</title>5 <title>7 Days to Die Map</title> 6 6 7 7 <!-- Own stylesheet -->
Note:
See TracChangeset
for help on using the changeset viewer.