From d8156d54b748865bc60085e1fb9ead5426527154 Mon Sep 17 00:00:00 2001 From: "Travis J. Gutjahr" <33809229+Squirrelies@users.noreply.github.com> Date: Sun, 5 Apr 2020 17:29:58 -0500 Subject: [PATCH] 1.4.2.0 --- CHANGELOG.md | 6 +++- RE2REmakeSRT/JSONServer.cs | 2 +- RE2REmakeSRT/Properties/AssemblyInfo.cs | 4 +-- RE2REmakeSRT/SampleJSONDisplayPage.html | 44 ++++++++++++++++++------- 4 files changed, 40 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 724e8ae..c9dc77e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,11 @@ To extract .7z archives, use [7-Zip](https://www.7-zip.org/)! ## [Click here](http://dudley.gg/squirrelies/re2/latest.7z) to download the latest release! -## [Download 1.4.1.0 Beta](http://dudley.gg/squirrelies/re2/RE2REmakeSRT-1410-Beta-Signed-Release.7z) (2020-01-02) +## [Download 1.4.2.0 Beta](http://dudley.gg/squirrelies/re2/RE2REmakeSRT-1420-Beta-Signed-Release.7z) (2020-04-05) +* Fix for JSON endpoint not listening on all interfaces. Listens on all IPv4 and IPv6 interfaces now. +* Moved some variables around in the Sample JSON HTML file. User configurable settings are near the top now. + +### [Download 1.4.1.0 Beta](http://dudley.gg/squirrelies/re2/RE2REmakeSRT-1410-Beta-Signed-Release.7z) (2020-01-02) * Added Microsoft.AspNetCore.Cors so I could allow cross-origin requests from any origin (such as the file server). Useful for local querying of the JSON data. * Added a sample HTML page with javascript query code to display the JSON values similar to how the SRT lays it out. Useful for OBS Browser Source displaying. diff --git a/RE2REmakeSRT/JSONServer.cs b/RE2REmakeSRT/JSONServer.cs index 1bb8172..6f9fb10 100644 --- a/RE2REmakeSRT/JSONServer.cs +++ b/RE2REmakeSRT/JSONServer.cs @@ -23,7 +23,7 @@ public JSONServer() hostBuilder = new WebHostBuilder() .UseKestrel() - .UseUrls("http://localhost:7190") + .UseUrls("http://::7190;http://0.0.0.0:7190") .UseContentRoot(contentRoot) .UseStartup<JSONServerStartup>() .UseEnvironment("Development") diff --git a/RE2REmakeSRT/Properties/AssemblyInfo.cs b/RE2REmakeSRT/Properties/AssemblyInfo.cs index 200d0bb..750733d 100644 --- a/RE2REmakeSRT/Properties/AssemblyInfo.cs +++ b/RE2REmakeSRT/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.1.0")] -[assembly: AssemblyFileVersion("1.4.1.0")] +[assembly: AssemblyVersion("1.4.2.0")] +[assembly: AssemblyFileVersion("1.4.2.0")] diff --git a/RE2REmakeSRT/SampleJSONDisplayPage.html b/RE2REmakeSRT/SampleJSONDisplayPage.html index ff0fb7a..3a64d0d 100644 --- a/RE2REmakeSRT/SampleJSONDisplayPage.html +++ b/RE2REmakeSRT/SampleJSONDisplayPage.html @@ -4,11 +4,18 @@ <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> - <title>RE2 REmake SRT JSON Display Page</title> + <title>RE3 REmake SRT JSON Display Page</title> + <script> + // USER CONFIGURABLE VARIABLES. + const JSON_ADDRESS = '127.0.0.1'; // IP OR HOSTNAME OF THE COMPUTER RUNNING THE SRT. USEFUL FOR MULTIPLE PC STREAMING SETUPS. + const JSON_PORT = 7190; // PORT OF THE JSON ENDPOINT. NOT LIKELY TO CHANGE UNLESS YOU COMPILED THE SRT YOURSELF FROM SOURCE CODE. + const POLLING_RATE = 333; // THE TIME IN MILLISECONDS WE'LL REQUEST UPDATED VALUES. + </script> <style> body { background-color: #000000; color: #FFFFFF; + font-family: Arial; } a { @@ -30,14 +37,20 @@ a:active { text-decoration: underline; } + + td { + text-align: right; + } </style> </head> <body> <div id="srtQueryData"></div> <script> + const JSON_ENDPOINT = `http://${JSON_ADDRESS}:${JSON_PORT}/`; + window.onload = function () { getData(); - setInterval(getData, 333); + setInterval(getData, POLLING_RATE); } var Asc = function (a, b) { @@ -53,7 +66,7 @@ } function getData() { - fetch('http://localhost:7190/') + fetch(JSON_ENDPOINT) .then(function (response) { return response.json(); }) @@ -69,14 +82,16 @@ var mainContainer = document.getElementById("srtQueryData"); mainContainer.innerHTML = ""; - if (data.PlayerCurrentHealth <= 1200 && data.PlayerCurrentHealth >= 801) - mainContainer.innerHTML += '<font size="6" color="#7cfc00"><b>' + data.PlayerCurrentHealth + '</b></font><br>'; + if (data.PlayerPoisoned) + mainContainer.innerHTML += '<font size="6" color="#7851a9"><b>' + data.PlayerCurrentHealth + '</b></font><br>'; // Toxic + else if (data.PlayerCurrentHealth <= 1200 && data.PlayerCurrentHealth >= 801) + mainContainer.innerHTML += '<font size="6" color="#7cfc00"><b>' + data.PlayerCurrentHealth + '</b></font><br>'; // aFineBoi else if (data.PlayerCurrentHealth <= 800 && data.PlayerCurrentHealth >= 361) - mainContainer.innerHTML += '<font size="6" color="#daa520"><b>' + data.PlayerCurrentHealth + '</b></font><br>'; + mainContainer.innerHTML += '<font size="6" color="#daa520"><b>' + data.PlayerCurrentHealth + '</b></font><br>'; // Caution! else if (data.PlayerCurrentHealth <= 360 && data.PlayerCurrentHealth >= 1) - mainContainer.innerHTML += '<font size="6" color="#ff0000"><b>' + data.PlayerCurrentHealth + '</b></font><br>'; + mainContainer.innerHTML += '<font size="6" color="#ff0000"><b>' + data.PlayerCurrentHealth + '</b></font><br>'; // Dangerops! else - mainContainer.innerHTML += '<font size="6" color="#ff0000"><b>' + data.PlayerCurrentHealth + '</b></font><br>'; + mainContainer.innerHTML += '<font size="6" color="#ff0000"><b>' + data.PlayerCurrentHealth + '</b></font><br>'; // Deaded. mainContainer.innerHTML += '<font size="6"><b>' + data.IGTFormattedString + '</b></font><br>'; //mainContainer.innerHTML += '<font size="4" color="#969696"><b>A:' + data.IGTRunningTimer + '</b></font><br>'; @@ -86,16 +101,21 @@ //mainContainer.innerHTML += '<br>'; mainContainer.innerHTML += '<font size="4" color="#969696"><b>DA Rank: ' + data.Rank + '</b></font><br>'; - mainContainer.innerHTML += '<font size="4" color="#969696"><b>DA Rank: ' + data.RankScore + '</b></font><br>'; + mainContainer.innerHTML += '<font size="4" color="#969696"><b>DA Score: ' + data.RankScore + '</b></font><br>'; mainContainer.innerHTML += '<font size="4" color="#ff0000"><b>Enemy HP</b></font><br>'; + var table = document.createElement("table"); data.EnemyHealth.sort(function (a, b) { return Asc(a.Percentage, b.Percentage) || Desc(a.CurrentHP, b.CurrentHP) }).forEach(function (item, index, arr) { if (item.IsAlive) { - var div = document.createElement("div"); - div.innerHTML = '<font size="3" color="#ff0000">' + item.CurrentHP + ' ' + parseFloat(item.Percentage * 100).toFixed(1) + '%</font><br>'; - mainContainer.appendChild(div); + table.innerHTML += `<tr> +<td><font size="4" color="#ff0000"><b>${item.CurrentHP}</b></font></td> +<td> </td> +<td> </td> +<td><font size="4" color="#ff0000"><b>${parseFloat(item.Percentage * 100).toFixed(1)}%</b></font></td> +</tr>`; } }); + mainContainer.appendChild(table); //mainContainer.innerHTML += '<BR>Last Updated: ' + new Date().toLocaleDateString() + ' ' + new Date().toLocaleTimeString(); }