v1.6.17.0 (Unto the Breach update)

This commit is contained in:
Regalis11
2024-10-22 17:29:04 +03:00
parent e74b3cdb17
commit 6e6c17e100
417 changed files with 17166 additions and 5870 deletions
@@ -298,17 +298,12 @@ namespace Barotrauma
Kill(causeOfDeath.type, causeOfDeath.affliction);
}
break;
case EventType.ConfirmTalentRefund:
if (!CanManageTalents(c)) { return; }
Info?.RefundTalents();
break;
case EventType.UpdateTalents:
if (c.Character != this)
{
if (!IsBot || !c.HasPermission(ClientPermissions.ManageBotTalents))
{
#if DEBUG
DebugConsole.Log("Received a character update message from a client who's not controlling the character");
#endif
return;
}
}
if (!CanManageTalents(c)) { return; }
// get the full list of talents from the player, only give the ones
// that are not already given (or otherwise not viable)
@@ -332,6 +327,22 @@ namespace Barotrauma
}
break;
}
bool CanManageTalents(Client client)
{
if (client.Character != this)
{
if (client.TeamID != TeamID || !IsBot || !client.HasPermission(ClientPermissions.ManageBotTalents) || client.Spectating)
{
#if DEBUG
DebugConsole.Log("A client tried to manage talents of a character they don't control or have permission to manage");
#endif
return false;
}
}
return true;
}
}
public void ServerWritePosition(ReadWriteMessage tempBuffer, Client c)
@@ -377,8 +388,15 @@ namespace Barotrauma
tempBuffer.WriteBoolean(shoot);
tempBuffer.WriteBoolean(use);
tempBuffer.WriteBoolean(AnimController is HumanoidAnimController { Crouching: true });
if (AnimController is HumanoidAnimController humanAnim)
{
tempBuffer.WriteBoolean(humanAnim.Crouching);
}
else if (AnimController is FishAnimController fishAnim)
{
tempBuffer.WriteBoolean(fishAnim.Reverse);
}
tempBuffer.WriteBoolean(attack);
Vector2 relativeCursorPos = cursorPosition - AimRefPosition;
@@ -464,20 +482,17 @@ namespace Barotrauma
case CharacterStatusEventData statusEventData:
WriteStatus(msg, statusEventData.ForceAfflictionData);
break;
case UpdateSkillsEventData _:
if (Info?.Job == null)
case UpdateSkillsEventData updateSkillsData:
if (Info?.Job is { } job)
{
msg.WriteByte((byte)0);
msg.WriteIdentifier(updateSkillsData.SkillIdentifier);
msg.WriteBoolean(updateSkillsData.ForceNotification);
//don't use Character.GetSkillLevel here, because it applies all the temporary boosts from items and afflictions on the skill level
msg.WriteSingle(job.GetSkillLevel(updateSkillsData.SkillIdentifier));
}
else
{
var skills = Info.Job.GetSkills();
msg.WriteByte((byte)skills.Count());
foreach (Skill skill in skills)
{
msg.WriteIdentifier(skill.Identifier);
msg.WriteSingle(skill.Level);
}
msg.WriteIdentifier(Identifier.Empty);
}
break;
case IAttackEventData attackEventData:
@@ -555,6 +570,7 @@ namespace Barotrauma
break;
case UpdateExperienceEventData _:
msg.WriteInt32(Info.ExperiencePoints);
msg.WriteInt32(info.AdditionalTalentPoints);
break;
case UpdateTalentsEventData _:
msg.WriteUInt16((ushort)characterTalents.Count);
@@ -565,9 +581,16 @@ namespace Barotrauma
}
break;
case UpdateMoneyEventData _:
msg.WriteInt32(GameMain.GameSession.Campaign.GetWallet(c).Balance);
msg.WriteInt32(Wallet?.Balance ?? 0);
break;
case UpdateRefundPointsEventData when Info is { } i:
msg.WriteInt32(i.TalentRefundPoints);
break;
case ConfirmRefundEventData:
// No data
break;
case UpdatePermanentStatsEventData updatePermanentStatsEventData:
StatTypes statType = updatePermanentStatsEventData.StatType;
if (Info == null)
{