Changeset 163
- Timestamp:
- Sep 4, 2014, 5:45:22 PM (10 years ago)
- Location:
- binary-improvements
- Files:
-
- 1228 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/7dtd-server-fixes.csproj
r154 r163 110 110 <Compile Include="src\JSON\JSONBoolean.cs" /> 111 111 <Compile Include="src\NetConnections\Servers\Web\API\GetPlayersLocation.cs" /> 112 <Compile Include="src\CustomCommands\TeleportPlayer.cs" /> 113 <Compile Include="src\NetConnections\Servers\Web\API\GetPlayerInventory.cs" /> 112 114 </ItemGroup> 113 115 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> -
binary-improvements/7dtd-server-fixes/src/CommandExtensions.cs
r146 r163 10 10 { 11 11 try { 12 manager.m_GUIConsole.AddCommand (new CreativeMenu (manager.m_GUIConsole)); 13 manager.m_GUIConsole.AddCommand (new EnableRendering (manager.m_GUIConsole)); 14 manager.m_GUIConsole.AddCommand (new GetGamePrefs (manager.m_GUIConsole)); 15 manager.m_GUIConsole.AddCommand (new GetTime (manager.m_GUIConsole)); 16 manager.m_GUIConsole.AddCommand (new Give (manager.m_GUIConsole)); 17 manager.m_GUIConsole.AddCommand (new Kill (manager.m_GUIConsole)); 18 manager.m_GUIConsole.AddCommand (new ListItems (manager.m_GUIConsole)); 19 manager.m_GUIConsole.AddCommand (new ListKnownPlayers (manager.m_GUIConsole)); 20 manager.m_GUIConsole.AddCommand (new ListLandProtection (manager.m_GUIConsole)); 21 manager.m_GUIConsole.AddCommand (new ListPlayersExtended (manager.m_GUIConsole)); 22 manager.m_GUIConsole.AddCommand (new RemoveLandProtection (manager.m_GUIConsole)); 23 manager.m_GUIConsole.AddCommand (new RenderMap (manager.m_GUIConsole)); 24 manager.m_GUIConsole.AddCommand (new Reply (manager.m_GUIConsole)); 25 manager.m_GUIConsole.AddCommand (new SayToPlayer (manager.m_GUIConsole)); 26 manager.m_GUIConsole.AddCommand (new SetTimeReal (manager.m_GUIConsole)); 27 manager.m_GUIConsole.AddCommand (new ShowInventory (manager.m_GUIConsole)); 28 manager.m_GUIConsole.AddCommand (new AllocsFixes.CustomCommands.Version (manager.m_GUIConsole)); 12 ConsoleSdtd cons = manager.m_GUIConsole; 13 cons.AddCommand (new CreativeMenu (cons)); 14 cons.AddCommand (new EnableRendering (cons)); 15 cons.AddCommand (new GetGamePrefs (cons)); 16 cons.AddCommand (new GetTime (cons)); 17 cons.AddCommand (new Give (cons)); 18 cons.AddCommand (new Kill (cons)); 19 cons.AddCommand (new ListItems (cons)); 20 cons.AddCommand (new ListKnownPlayers (cons)); 21 cons.AddCommand (new ListLandProtection (cons)); 22 cons.AddCommand (new ListPlayersExtended (cons)); 23 cons.AddCommand (new RemoveLandProtection (cons)); 24 cons.AddCommand (new RenderMap (cons)); 25 cons.AddCommand (new Reply (cons)); 26 cons.AddCommand (new SayToPlayer (cons)); 27 cons.AddCommand (new SetTimeReal (cons)); 28 cons.AddCommand (new ShowInventory (cons)); 29 cons.AddCommand (new TeleportPlayer (cons)); 30 cons.AddCommand (new AllocsFixes.CustomCommands.Version (cons)); 29 31 } catch (Exception e) { 30 32 Log.Out ("Error registering custom commands: " + e); -
binary-improvements/7dtd-server-fixes/src/NetConnections/Servers/Web/ApiHandler.cs
r158 r163 18 18 apis.Add ("getplayersonline", new GetPlayersOnline ()); 19 19 apis.Add ("getplayerslocation", new GetPlayersLocation ()); 20 apis.Add ("getplayerinventory", new GetPlayerInventory ()); 20 21 } 21 22 -
binary-improvements/7dtd-server-fixes/src/NetConnections/Servers/Web/Web.cs
r154 r163 120 120 } 121 121 122 public static void SetResponseTextContent (HttpListenerResponse resp, string text) 123 { 124 byte[] buf = Encoding.UTF8.GetBytes (text); 125 resp.ContentLength64 = buf.Length; 126 resp.ContentType = "text/html"; 127 resp.ContentEncoding = Encoding.UTF8; 128 resp.OutputStream.Write (buf, 0, buf.Length); 129 } 130 122 131 } 123 132 } -
binary-improvements/7dtd-server-fixes/src/PersistentData/Inventory.cs
r145 r163 48 48 { 49 49 ItemBase iBase = ItemBase.list [item.itemValue.type]; 50 string name = iBase.name; 51 if (iBase.IsBlock ()) { 52 ItemBlock iBlock = (ItemBlock)iBase; 53 name = iBlock.GetItemName (item.itemValue); 54 } 55 return name; 50 return iBase.GetItemName(item.itemValue); 56 51 } 57 52 -
binary-improvements/bin/Release/7dtd-server-fixes_version.txt
r162 r163 1 Version: 0.91.5360.30 741 Version: 0.91.5360.30628 -
binary-improvements/webserver/css/style.css
r153 r163 1 1 html, body { 2 3 4 5 2 height: 100%; 3 margin: 0px; 4 padding: 0px; 5 background-color: #230000; 6 6 } 7 7 #map { 8 9 10 11 8 height: 100%; 9 margin: 0px; 10 padding: 0px; 11 background-color: #230000; 12 12 } 13 13 #info { 14 15 16 17 14 background-color: #aaaaaa; 15 position: absolute; 16 bottom: 10px; 17 left: 10px; 18 18 } 19 .invTable { 20 table-layout: fixed; 21 padding: 0px; 22 margin: 0px; 23 border-collapse: collapse; 24 background-color: #303030; 25 } 26 .invField { 27 width: 60px; 28 height: 42px; 29 padding: 1px 4px; 30 margin: 0px; 31 border: 1px solid gray; 32 background-size: 58px; 33 background-repeat: no-repeat; 34 background-position: center; 35 vertical-align: bottom; 36 text-align: right; 37 font-size: 14pt; 38 color: #ffffff; 39 text-shadow: 40 -1px -1px 0 #000, 41 1px -1px 0 #000, 42 -1px 1px 0 #000, 43 1px 1px 0 #000; 44 } 45 -
binary-improvements/webserver/index.html
r153 r163 6 6 <link rel="stylesheet prefetch" href="leaflet/leaflet.css"> 7 7 <link rel="stylesheet" href="css/style.css" media="screen" type="text/css" /> 8 <link rel="stylesheet" href="jquery-ui/jquery-ui.min.css" type="text/css" /> 8 9 <script type="text/javascript" src="leaflet/leaflet.js"></script> 9 10 <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script> 11 <script type="text/javascript" src="jquery-ui/jquery-ui.min.js"></script> 10 12 </head> 11 13 <body> … … 14 16 MouseCoords: <span id="pos"></span> 15 17 </div> 18 <div id="dialog-message" title="Player inventory" style="display:none"> 19 Player: <span id="invPlayerName"></span> 20 <table class="invTable" id="bagTable"> 21 </table> 22 <br/> 23 <table class="invTable" id="beltTable"> 24 </table> 25 </div> 16 26 17 27 <script type="text/javascript" src="js/index.js"></script> -
binary-improvements/webserver/js/index.js
r157 r163 3 3 var TILESIZE = 128; 4 4 var MAXZOOM = 4; 5 6 var BAG_COLS = 8; 7 var BAG_ROWS = 4; 8 var BELT_COLS = 8; 9 var INV_ITEM_WIDTH = 58; 10 var INV_ITEM_HEIGHT = 40; 5 11 6 12 SDTD_Projection = { … … 148 154 var playersMappingList = {}; 149 155 156 var showInv = function(steamid) { 157 $.getJSON( "../api/getplayerinventory", { steamid: steamid }) 158 .done(function(data) { 159 $("#invPlayerName").text(playersMappingList[steamid].name); 160 for (var y = 0; y < BAG_ROWS; y++) { 161 for (var x = 0; x < BAG_COLS; x++) { 162 if (data.bag[y*BAG_COLS+x].count > 0) { 163 $("#bagField"+x+"_"+y).attr("style", "background-image: url(itemimages/" + data.bag[y*BAG_COLS+x].name + ".png);"); 164 $("#bagFieldText"+x+"_"+y).text(data.bag[y*BAG_COLS+x].count); 165 } else { 166 $("#bagField"+x+"_"+y).attr("style", "background-image: none;"); 167 $("#bagFieldText"+x+"_"+y).text(""); 168 } 169 } 170 } 171 172 for (var x = 0; x < BELT_COLS; x++) { 173 if (data.belt[x].count > 0) { 174 $("#beltField"+x).attr("style", "background-image: url(itemimages/" + data.belt[x].name + ".png);"); 175 $("#beltFieldText"+x).text(data.belt[x].count); 176 } else { 177 $("#beltField"+x).attr("style", "background-image: none;"); 178 $("#beltFieldText"+x).text(""); 179 } 180 } 181 182 $( "#dialog-message" ).dialog({ 183 modal: true, 184 width: BAG_COLS*INV_ITEM_WIDTH + 60, 185 buttons: { 186 Ok: function() { 187 $( this ).dialog( "close" ); 188 } 189 } 190 }); 191 }) 192 .fail(function() { 193 console.log("Error fetching player inventory"); 194 }) 195 .always(function() { 196 }); 197 }; 198 199 for (var y = 0; y < BAG_ROWS; y++) { 200 $("#bagTable").append("<tr id=\"bagRow"+y+"\"></tr>"); 201 for (var x = 0; x < BAG_COLS; x++) { 202 $("#bagRow"+y).append( 203 "<td class=\"invField\" id=\"bagField"+x+"_"+y+"\">" + 204 "<span class=\"invFieldText\" id=\"bagFieldText"+x+"_"+y+"\"></span>" + 205 "</td>"); 206 } 207 } 208 209 $("#beltTable").append("<tr id=\"beltRow0\"></tr>"); 210 for (var x = 0; x < BELT_COLS; x++) { 211 $("#beltRow0").append( 212 "<td class=\"invField\" id=\"beltField"+x+"\">" + 213 "<span class=\"invFieldText\" id=\"beltFieldText"+x+"\"></span>" + 214 "</td>"); 215 } 216 150 217 var setPlayerMarkers = function(data) { 151 218 var online = 0; … … 157 224 marker.setLatLng([val.position.z, val.position.x]); 158 225 } else { 159 marker = L.marker([val.position.z, val.position.x]).bindPopup(val.name); 226 marker = L.marker([val.position.z, val.position.x]).bindPopup( 227 "Player: " + val.name + "<br/>" + 228 "<a onClick='showInv(\""+val.steamid+"\")'>Show inventory</a>" 229 ); 160 230 playersMappingList[val.steamid] = { online: !val.online }; 161 231 }
Note:
See TracChangeset
for help on using the changeset viewer.