Unstable 1.8.4.0
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
@@ -178,6 +179,11 @@ namespace Barotrauma.Networking
|
||||
extraCargoPanel.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ReadPerks(incMsg))
|
||||
{
|
||||
GameMain.NetLobbyScreen?.UpdateDisembarkPointListFromServerSettings();
|
||||
}
|
||||
}
|
||||
|
||||
if (requiredFlags.HasFlag(NetFlags.HiddenSubs))
|
||||
@@ -194,10 +200,41 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
public static bool HasPermissionToChangePerks()
|
||||
{
|
||||
if (GameMain.Client.HasPermission(Networking.ClientPermissions.ManageSettings)) { return true; }
|
||||
|
||||
bool isPvP = GameMain.NetLobbyScreen?.SelectedMode == GameModePreset.PvP;
|
||||
bool hasSelectedTeam = MultiplayerPreferences.Instance.TeamPreference is CharacterTeamType.Team1 or CharacterTeamType.Team2;
|
||||
var otherClients = GameMain.Client?.ConnectedClients.Where(static c => c.SessionId != GameMain.Client.SessionId).ToImmutableArray() ?? ImmutableArray<Client>.Empty;
|
||||
|
||||
if (isPvP)
|
||||
{
|
||||
if (!hasSelectedTeam) { return false; }
|
||||
|
||||
return !otherClients
|
||||
.Where(static c => c.PreferredTeam == MultiplayerPreferences.Instance.TeamPreference)
|
||||
.Any(static c => c.HasPermission(Networking.ClientPermissions.ManageSettings));
|
||||
}
|
||||
else
|
||||
{
|
||||
return !otherClients.Any(static c => c.HasPermission(Networking.ClientPermissions.ManageSettings));
|
||||
}
|
||||
}
|
||||
|
||||
public void ClientAdminWritePerks()
|
||||
{
|
||||
IWriteMessage outMsg = new WriteOnlyMessage();
|
||||
|
||||
outMsg.WriteByte((byte)ClientPacketHeader.SERVER_SETTINGS_PERKS);
|
||||
WritePerks(outMsg);
|
||||
GameMain.Client?.ClientPeer?.Send(outMsg, DeliveryMethod.Reliable);
|
||||
}
|
||||
|
||||
public void ClientAdminWrite(
|
||||
NetFlags dataToSend,
|
||||
int? missionTypeOr = null,
|
||||
int? missionTypeAnd = null,
|
||||
Identifier addedMissionType = default,
|
||||
Identifier removedMissionType = default,
|
||||
int traitorDangerLevel = 0)
|
||||
{
|
||||
if (!GameMain.Client.HasPermission(Networking.ClientPermissions.ManageSettings)) { return; }
|
||||
@@ -220,7 +257,7 @@ namespace Barotrauma.Networking
|
||||
outMsg.WriteUInt32(count);
|
||||
foreach (KeyValuePair<UInt32, NetPropertyData> prop in changedProperties)
|
||||
{
|
||||
DebugConsole.NewMessage(prop.Value.Name.Value, Color.Lime);
|
||||
DebugConsole.NewMessage($"Changed {prop.Value.Name.Value} to {prop.Value.GUIComponentValue}", Color.Lime);
|
||||
outMsg.WriteUInt32(prop.Key);
|
||||
prop.Value.Write(outMsg, prop.Value.GUIComponentValue);
|
||||
}
|
||||
@@ -237,8 +274,8 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (dataToSend.HasFlag(NetFlags.Misc))
|
||||
{
|
||||
outMsg.WriteRangedInteger(missionTypeOr ?? (int)Barotrauma.MissionType.None, 0, (int)Barotrauma.MissionType.All);
|
||||
outMsg.WriteRangedInteger(missionTypeAnd ?? (int)Barotrauma.MissionType.All, 0, (int)Barotrauma.MissionType.All);
|
||||
outMsg.WriteIdentifier(addedMissionType);
|
||||
outMsg.WriteIdentifier(removedMissionType);
|
||||
outMsg.WriteByte((byte)(traitorDangerLevel + 1));
|
||||
outMsg.WritePadBits();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user