Unstable 0.1300.0.4
This commit is contained in:
@@ -230,12 +230,16 @@ namespace Barotrauma.Networking
|
||||
2 + //(UInt16)NetStateID
|
||||
1 + //(byte)Type
|
||||
Encoding.UTF8.GetBytes(Text).Length + 2;
|
||||
|
||||
|
||||
if (SenderClient != null)
|
||||
{
|
||||
length += 8; //SteamID or local ID (ulong)
|
||||
}
|
||||
if (Sender != null && c.InGame)
|
||||
{
|
||||
length += 2; //sender ID (UInt16)
|
||||
}
|
||||
else if (SenderName != null)
|
||||
if (SenderName != null)
|
||||
{
|
||||
length += Encoding.UTF8.GetBytes(SenderName).Length + 2;
|
||||
}
|
||||
@@ -252,11 +256,16 @@ namespace Barotrauma.Networking
|
||||
msg.Write(Text);
|
||||
|
||||
msg.Write(SenderName);
|
||||
msg.Write(SenderClient != null);
|
||||
msg.Write(SenderClient != null ?
|
||||
((SenderClient.SteamID != 0) ? SenderClient.SteamID : SenderClient.ID) :
|
||||
0);
|
||||
msg.Write(Sender != null && c.InGame);
|
||||
if (Sender != null && c.InGame)
|
||||
{
|
||||
msg.Write(Sender.ID);
|
||||
}
|
||||
msg.WritePadBits();
|
||||
if (Type == ChatMessageType.ServerMessageBoxInGame)
|
||||
{
|
||||
msg.Write(IconStyle);
|
||||
|
||||
@@ -938,6 +938,10 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
errorLines.Add("Submarine: " + GameMain.GameSession.Submarine.Info.Name);
|
||||
}
|
||||
if (GameMain.NetworkMember?.RespawnManager?.RespawnShuttle != null)
|
||||
{
|
||||
errorLines.Add("Respawn shuttle: " + GameMain.NetworkMember.RespawnManager.RespawnShuttle.Info.Name);
|
||||
}
|
||||
if (Level.Loaded != null)
|
||||
{
|
||||
errorLines.Add("Level: " + Level.Loaded.Seed + ", " + string.Join(", ", Level.Loaded.EqualityCheckValues.Select(cv => cv.ToString("X"))));
|
||||
@@ -3111,7 +3115,7 @@ namespace Barotrauma.Networking
|
||||
string myReceivedMessage = type == ChatMessageType.Server || type == ChatMessageType.Error ? TextManager.GetServerMessage(message) : message;
|
||||
if (!string.IsNullOrWhiteSpace(myReceivedMessage))
|
||||
{
|
||||
AddChatMessage(myReceivedMessage, (ChatMessageType)type, senderName, senderCharacter);
|
||||
AddChatMessage(myReceivedMessage, (ChatMessageType)type, senderName, senderClient, senderCharacter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3778,18 +3782,6 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
public static string ClientLogName(Client client, string name = null)
|
||||
{
|
||||
if (client == null) { return name; }
|
||||
string retVal = "‖";
|
||||
if (client.Karma < 40.0f)
|
||||
{
|
||||
retVal += "color:#ff9900;";
|
||||
}
|
||||
retVal += "metadata:" + (client.SteamID != 0 ? client.SteamID.ToString() : client.ID.ToString()) + "‖" + (name ?? client.Name).Replace("‖","") + "‖end‖";
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public static string CharacterLogName(Character character)
|
||||
{
|
||||
if (character == null) { return "[NULL]"; }
|
||||
|
||||
@@ -8,11 +8,16 @@
|
||||
msg.Write(NetStateID);
|
||||
msg.Write((byte)ChatMessageType.Order);
|
||||
msg.Write(SenderName);
|
||||
msg.Write(SenderClient != null);
|
||||
msg.Write(SenderClient != null ?
|
||||
((SenderClient.SteamID != 0) ? SenderClient.SteamID : SenderClient.ID) :
|
||||
0);
|
||||
msg.Write(Sender != null && c.InGame);
|
||||
if (Sender != null && c.InGame)
|
||||
{
|
||||
msg.Write(Sender.ID);
|
||||
}
|
||||
msg.WritePadBits();
|
||||
WriteOrder(msg);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -212,7 +212,7 @@ namespace Barotrauma.Networking
|
||||
return;
|
||||
}
|
||||
|
||||
if (connectedClients.Count >= serverSettings.MaxPlayers - 1)
|
||||
if (connectedClients.Count >= serverSettings.MaxPlayers)
|
||||
{
|
||||
RemovePendingClient(pendingClient, DisconnectReason.ServerFull, "");
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Barotrauma
|
||||
|
||||
public void ServerRead(IReadMessage inc, Client sender)
|
||||
{
|
||||
if (GameMain.Server == null || sender == null) return;
|
||||
if (GameMain.Server == null || sender == null) { return; }
|
||||
|
||||
byte voteTypeByte = inc.ReadByte();
|
||||
VoteType voteType = VoteType.Unknown;
|
||||
@@ -83,7 +83,10 @@ namespace Barotrauma
|
||||
{
|
||||
case VoteType.Sub:
|
||||
int equalityCheckVal = inc.ReadInt32();
|
||||
SubmarineInfo sub = SubmarineInfo.SavedSubmarines.FirstOrDefault(s => s.EqualityCheckVal == equalityCheckVal);
|
||||
string hash = equalityCheckVal > 0 ? string.Empty : inc.ReadString();
|
||||
SubmarineInfo sub = equalityCheckVal > 0 ?
|
||||
SubmarineInfo.SavedSubmarines.FirstOrDefault(s => s.Type == SubmarineType.Player && s.EqualityCheckVal == equalityCheckVal) :
|
||||
SubmarineInfo.SavedSubmarines.FirstOrDefault(s => s.Type == SubmarineType.Player && s.MD5Hash.Hash == hash);
|
||||
sender.SetVote(voteType, sub);
|
||||
break;
|
||||
case VoteType.Mode:
|
||||
|
||||
Reference in New Issue
Block a user