Wired up notification alert reward - untested #576

This commit is contained in:
Chomp
2025-08-28 22:43:08 +01:00
parent a56fa9e017
commit d3f95de546
3 changed files with 37 additions and 2 deletions
@@ -1,5 +1,6 @@
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Eft.Profile;
using SPTarkov.Server.Core.Models.Eft.Ws;
@@ -33,6 +34,23 @@ public class NotifierHelper(HttpServerHelper httpServerHelper)
};
}
/// <summary>
/// Create a new notification that displays a message to the player - currently used by quests as a reward
/// </summary>
/// <param name="config">IllustrationConfig object from quest reward</param>
/// <param name="messageId">Message Id from quest reward</param>
/// <returns>WsNotificationPopup</returns>
public WsNotificationPopup CreateNotificationPopup(IllustrationConfig config, MongoId messageId)
{
return new WsNotificationPopup
{
EventType = NotificationEventType.NotificationPopup,
EventId = new MongoId(),
Image = config.BigImage,
Message = messageId,
};
}
/// <summary>
/// Create a new notification with the specified dialogueMessage object
/// </summary>
@@ -25,6 +25,7 @@ public class RewardHelper(
ServerLocalisationService serverLocalisationService,
TraderHelper traderHelper,
PresetHelper presetHelper,
NotifierHelper notifierHelper,
NotificationSendHelper notificationSendHelper,
ICloner cloner
)
@@ -130,8 +131,8 @@ public class RewardHelper(
break;
case RewardType.NotificationPopup:
// TODO: Wire up to notification system
logger.Error("UNHANDLED: RewardType.NotificationPopup");
var notification = notifierHelper.CreateNotificationPopup(reward.IllustrationConfig, reward.Message.Value);
notificationSendHelper.SendMessage(sessionId.Value, notification);
break;
case RewardType.WebPromoCode:
// TODO: ??? (Free arena trial from Balancing - Part 1)
@@ -0,0 +1,16 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
namespace SPTarkov.Server.Core.Models.Eft.Ws;
public record WsNotificationPopup : WsNotificationEvent
{
[JsonPropertyName("eventId")]
public MongoId EventId { get; set; }
[JsonPropertyName("image")]
public string Image { get; set; }
[JsonPropertyName("message")]
public MongoId Message { get; set; }
}