Skip to content

Commit

Permalink
Use main nickname rather than scav nickname during notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed May 15, 2024
1 parent fb02520 commit e1fc863
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
10 changes: 7 additions & 3 deletions Fika.Core/Coop/Players/ObservedCoopPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -710,21 +710,25 @@ public override void OnDead(EDamageType damageType)
{
if (!IsObservedAI)
{
string nickname = !string.IsNullOrEmpty(Profile.Info.MainProfileNickname) ? Profile.Info.MainProfileNickname : Profile.Nickname;
if (damageType != EDamageType.Undefined)
{
NotificationManagerClass.DisplayWarningNotification($"Group member '{Profile.Nickname}' has died from '{("DamageType_" + damageType.ToString()).Localized()}'");
NotificationManagerClass.DisplayWarningNotification($"Group member '{nickname}' has died from '{("DamageType_" + damageType.ToString()).Localized()}'");
}
else
{
NotificationManagerClass.DisplayWarningNotification($"Group member '{Profile.Nickname}' has died");
NotificationManagerClass.DisplayWarningNotification($"Group member '{nickname}' has died");
}
}
if (IsBoss(Profile.Info.Settings.Role, out string name) && IsObservedAI && LastAggressor != null)
{
if (LastAggressor is CoopPlayer aggressor)
{
string aggressorNickname = !string.IsNullOrEmpty(LastAggressor.Profile.Info.MainProfileNickname) ? LastAggressor.Profile.Info.MainProfileNickname : LastAggressor.Profile.Nickname;
if (aggressor.gameObject.name.StartsWith("Player_") || aggressor.IsYourPlayer)
NotificationManagerClass.DisplayMessageNotification($"{LastAggressor.Profile.Nickname} killed boss {name}", iconType: EFT.Communications.ENotificationIconType.Friend);
{
NotificationManagerClass.DisplayMessageNotification($"{LastAggressor.Profile.Info.MainProfileNickname} killed boss {name}", iconType: EFT.Communications.ENotificationIconType.Friend);
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion Fika.Core/Networking/FikaClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ private void OnGenericPacketReceived(GenericPacket packet)

if (FikaPlugin.ShowNotifications.Value)
{
NotificationManagerClass.DisplayMessageNotification($"Group member '{playerToApply.Profile.Nickname}' has extracted.",
string nickname = !string.IsNullOrEmpty(playerToApply.Profile.Info.MainProfileNickname) ? playerToApply.Profile.Info.MainProfileNickname : playerToApply.Profile.Nickname;
NotificationManagerClass.DisplayMessageNotification($"Group member '{nickname}' has extracted.",
EFT.Communications.ENotificationDurationType.Default, EFT.Communications.ENotificationIconType.EntryPoint);
}
}
Expand Down
3 changes: 2 additions & 1 deletion Fika.Core/Networking/FikaServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ private void OnGenericPacketReceived(GenericPacket packet, NetPeer peer)

if (FikaPlugin.ShowNotifications.Value)
{
NotificationManagerClass.DisplayMessageNotification($"Group member '{playerToApply.Profile.Nickname}' has extracted.",
string nickname = !string.IsNullOrEmpty(playerToApply.Profile.Info.MainProfileNickname) ? playerToApply.Profile.Info.MainProfileNickname : playerToApply.Profile.Nickname;
NotificationManagerClass.DisplayMessageNotification($"Group member '{nickname}' has extracted.",
EFT.Communications.ENotificationDurationType.Default, EFT.Communications.ENotificationIconType.EntryPoint);
}
}
Expand Down

0 comments on commit e1fc863

Please sign in to comment.