serializer for item event handling done
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Profile;
|
||||
using Core.Models.Utils;
|
||||
@@ -102,7 +103,7 @@ public abstract class ItemEventRouterDefinition : Router
|
||||
{
|
||||
public abstract Task<ItemEventRouterResponse>? HandleItemEvent(string url,
|
||||
PmcData pmcData,
|
||||
object body,
|
||||
BaseInteractionRequestData body,
|
||||
string sessionID,
|
||||
ItemEventRouterResponse output);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.Utils;
|
||||
|
||||
@@ -7,7 +8,7 @@ namespace Core.Models.Eft.ItemEvent;
|
||||
public record ItemEventRouterRequest : IRequestData
|
||||
{
|
||||
[JsonPropertyName("data")]
|
||||
public List<Daum>? Data { get; set; }
|
||||
public List<BaseInteractionRequestData>? Data { get; set; }
|
||||
|
||||
[JsonPropertyName("tm")]
|
||||
public int? Time { get; set; }
|
||||
|
||||
@@ -2,6 +2,7 @@ using SptCommon.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.Customization;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Utils;
|
||||
@@ -33,7 +34,7 @@ public class CustomizationItemEventRouter : ItemEventRouterDefinition
|
||||
};
|
||||
}
|
||||
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, BaseInteractionRequestData body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ using SptCommon.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.Health;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
|
||||
@@ -30,7 +31,7 @@ public class HealthItemEventRouter : ItemEventRouterDefinition
|
||||
];
|
||||
}
|
||||
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, BaseInteractionRequestData body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ using SptCommon.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.Hideout;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Enums;
|
||||
@@ -43,7 +44,7 @@ public class HideoutItemEventRouter : ItemEventRouterDefinition
|
||||
];
|
||||
}
|
||||
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, BaseInteractionRequestData body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url) {
|
||||
case HideoutEventActions.HIDEOUT_UPGRADE:
|
||||
|
||||
@@ -2,6 +2,7 @@ using SptCommon.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.Insurance;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
|
||||
@@ -28,7 +29,7 @@ public class InsuranceItemEventRouter : ItemEventRouterDefinition
|
||||
};
|
||||
}
|
||||
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, BaseInteractionRequestData body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ using SptCommon.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.Hideout;
|
||||
using Core.Models.Eft.Inventory;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
@@ -56,7 +57,7 @@ public class InventoryItemEventRouter : ItemEventRouterDefinition
|
||||
};
|
||||
}
|
||||
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, BaseInteractionRequestData body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url) {
|
||||
case ItemEventActions.MOVE:
|
||||
|
||||
@@ -2,6 +2,7 @@ using SptCommon.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Notes;
|
||||
|
||||
@@ -30,7 +31,7 @@ public class NoteItemEventRouter : ItemEventRouterDefinition
|
||||
};
|
||||
}
|
||||
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, BaseInteractionRequestData body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ using SptCommon.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Quests;
|
||||
|
||||
@@ -32,7 +33,7 @@ public class QuestItemEventRouter : ItemEventRouterDefinition
|
||||
};
|
||||
}
|
||||
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, BaseInteractionRequestData body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url) {
|
||||
case "QuestAccept":
|
||||
|
||||
@@ -2,6 +2,7 @@ using SptCommon.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Ragfair;
|
||||
|
||||
@@ -30,7 +31,7 @@ public class RagfairItemEventRouter : ItemEventRouterDefinition
|
||||
};
|
||||
}
|
||||
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, BaseInteractionRequestData body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url) {
|
||||
case "RagFairAddOffer":
|
||||
|
||||
@@ -2,6 +2,7 @@ using SptCommon.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Repair;
|
||||
|
||||
@@ -29,7 +30,7 @@ public class RepairItemEventRouter : ItemEventRouterDefinition
|
||||
};
|
||||
}
|
||||
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, BaseInteractionRequestData body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url) {
|
||||
case "Repair":
|
||||
|
||||
@@ -2,6 +2,7 @@ using SptCommon.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Trade;
|
||||
|
||||
@@ -30,7 +31,7 @@ public class TradeItemEventRouter : ItemEventRouterDefinition
|
||||
};
|
||||
}
|
||||
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, BaseInteractionRequestData body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url) {
|
||||
case "TradingConfirm":
|
||||
|
||||
@@ -2,6 +2,7 @@ using SptCommon.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Wishlist;
|
||||
|
||||
@@ -30,7 +31,7 @@ public class WishlistItemEventRouter : ItemEventRouterDefinition
|
||||
};
|
||||
}
|
||||
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
public override Task<ItemEventRouterResponse> HandleItemEvent(string url, PmcData pmcData, BaseInteractionRequestData body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
||||
@@ -158,8 +158,7 @@ public class BaseInteractionRequestDataConverter : JsonConverter<BaseInteraction
|
||||
case ItemEventActions.PIN_LOCK:
|
||||
return JsonSerializer.Deserialize<PinOrLockItemRequest>(jsonText, options);
|
||||
default:
|
||||
// bitch
|
||||
|
||||
throw new Exception($"Unhandled action type {value.Action}, make sure the BaseInteractionRequestDataConverter has the deserialization for this action handled.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,8 @@ public class JsonUtil
|
||||
new EftEnumConverter<RewardType>(),
|
||||
new EftEnumConverter<SideType>(),
|
||||
new EftEnumConverter<BonusSkillType>(),
|
||||
new EftEnumConverter<NotificationEventType>()
|
||||
new EftEnumConverter<NotificationEventType>(),
|
||||
new BaseInteractionRequestDataConverter()
|
||||
}
|
||||
};
|
||||
private static readonly JsonSerializerOptions jsonSerializerOptionsIndented = new(jsonSerializerOptionsNoIndent)
|
||||
|
||||
Reference in New Issue
Block a user