Skip to content

Commit

Permalink
fix: typo in client.lua and SocketHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
TGRHavoc committed May 17, 2019
1 parent 345e266 commit 461e92c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
2 changes: 1 addition & 1 deletion client/client.lua
Expand Up @@ -96,7 +96,7 @@ function doIconUpdate()
newSprite = 56 -- PoliceCar
elseif vehicleModel == h("taxi") then
newSprite = 198
elseif (vehicleModel == h("brickade") or vehicleModel == h("stoackage") or vehicleModel == h("stoackage2")) then
elseif (vehicleModel == h("brickade") or vehicleModel == h("stockade") or vehicleModel == h("stockade2")) then
newSprite = 66 -- ArmoredTruck
elseif (vehicleModel == h("towtruck") or vehicleModel == h("towtruck")) then
newSprite = 68
Expand Down
26 changes: 7 additions & 19 deletions src/Live Map/SocketHandler.cs
Expand Up @@ -77,31 +77,32 @@ private void Server_OnError(WebSocket ws, Exception ex)

private void Server_OnDisconnect(WebSocket ws)
{
LiveMap.Log(LiveMap.LogLevel.Basic, "Socket connection was closed at {0}", ws.RemoteEndpoint.ToString());
LiveMap.Log(LiveMap.LogLevel.All, "Socket connection was closed at {0}", ws.RemoteEndpoint.ToString());

WebSocket destory;
if (clients.TryRemove(ws.RemoteEndpoint.ToString(), out destory))
{
destory.CloseAsync().GetAwaiter().GetResult();
destory.Dispose();
LiveMap.Log(LiveMap.LogLevel.Basic, "Removed {0} socket because it disconnected", ws.RemoteEndpoint.ToString());
LiveMap.Log(LiveMap.LogLevel.All, "Removed {0} socket because it disconnected", ws.RemoteEndpoint.ToString());
}
else
{
LiveMap.Log(LiveMap.LogLevel.Basic, "Couldn't remove {0} from the clients dic.", ws.RemoteEndpoint.ToString());
LiveMap.Log(LiveMap.LogLevel.All, "Couldn't remove {0} from the clients dic.", ws.RemoteEndpoint.ToString());
}
}

private void Server_OnConnect(WebSocket ws)
{
LiveMap.Log(LiveMap.LogLevel.Basic, "Socket connection opened at {0}", ws.RemoteEndpoint.ToString());
LiveMap.Log(LiveMap.LogLevel.All, "Socket connection opened at {0}", ws.RemoteEndpoint.ToString());

if (clients.TryAdd(ws.RemoteEndpoint.ToString(), ws))
{
LiveMap.Log(LiveMap.LogLevel.Basic, "Added client {0} to the client dictionary", ws.RemoteEndpoint.ToString());
LiveMap.Log(LiveMap.LogLevel.All, "Added client {0} to the client dictionary", ws.RemoteEndpoint.ToString());
}
else
{
LiveMap.Log(LiveMap.LogLevel.Basic, "Couldn't add {0} to the client dic", ws.RemoteEndpoint.ToString());
LiveMap.Log(LiveMap.LogLevel.All, "Couldn't add {0} to the client dic", ws.RemoteEndpoint.ToString());

}
}
Expand Down Expand Up @@ -207,19 +208,6 @@ public async Task SendWebsocketData()
}
}

private void PlayerHadBeenUpdated(string identifier, JToken playerData)
{
JObject payload = new JObject();

payload["type"] = "playerData";

JArray arr = new JArray();
arr.Add(playerData);
payload["payload"] = arr;

sendQueue.Enqueue(payload);
}

public void AddPlayerData(string identifier, string key, object data)
{
LiveMap.Log(LiveMap.LogLevel.All, "Adding player {0}'s \"{1}\"", identifier, key);
Expand Down

0 comments on commit 461e92c

Please sign in to comment.