complete ItemEventRouters
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using Core.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Customization;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
|
||||
namespace Core.Routers.ItemEvents;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(ItemEventRouterDefinition))]
|
||||
public class CustomizationItemEventRouter : ItemEventRouterDefinition
|
||||
{
|
||||
protected CustomizationCallbacks _customizationCallbacks;
|
||||
|
||||
public CustomizationItemEventRouter
|
||||
(
|
||||
CustomizationCallbacks customizationCallbacks
|
||||
)
|
||||
{
|
||||
_customizationCallbacks = customizationCallbacks;
|
||||
}
|
||||
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new HandledRoute("CustomizationBuy", false),
|
||||
new HandledRoute("CustomizationSet", false)
|
||||
};
|
||||
}
|
||||
|
||||
public override object HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
case "CustomizationBuy":
|
||||
return _customizationCallbacks.BuyClothing(pmcData, body as BuyClothingRequestData, sessionID);
|
||||
case "CustomizationSet":
|
||||
return _customizationCallbacks.SetClothing(pmcData, body as CustomizationSetRequest, sessionID);
|
||||
default:
|
||||
throw new Exception($"CustomizationItemEventRouter being used when it cant handle route {url}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using Core.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Health;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
|
||||
namespace Core.Routers.ItemEvents;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(ItemEventRouterDefinition))]
|
||||
public class HealthItemEventRouter : ItemEventRouterDefinition
|
||||
{
|
||||
protected HealthCallbacks _healthCallbacks;
|
||||
|
||||
public HealthItemEventRouter
|
||||
(
|
||||
HealthCallbacks healthCallbacks
|
||||
)
|
||||
{
|
||||
_healthCallbacks = healthCallbacks;
|
||||
}
|
||||
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new HandledRoute("Eat", false),
|
||||
new HandledRoute("Heal", false),
|
||||
new HandledRoute("RestoreHealth", false)
|
||||
};
|
||||
}
|
||||
|
||||
public override object HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
case "Eat":
|
||||
return _healthCallbacks.OffraidEat(pmcData, body as OffraidEatRequestData, sessionID);
|
||||
case "Heal":
|
||||
return _healthCallbacks.OffraidHeal(pmcData, body as OffraidHealRequestData, sessionID);
|
||||
case "RestoreHealth":
|
||||
return _healthCallbacks.HealthTreatment(pmcData, body as HealthTreatmentRequestData, sessionID);
|
||||
default:
|
||||
throw new Exception($"HealthItemEventRouter being used when it cant handle route {url}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using Core.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Hideout;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Enums;
|
||||
|
||||
namespace Core.Routers.ItemEvents;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(ItemEventRouterDefinition))]
|
||||
public class HideoutItemEventRouter : ItemEventRouterDefinition
|
||||
{
|
||||
protected HideoutCallbacks _hideoutCallbacks;
|
||||
|
||||
public HideoutItemEventRouter
|
||||
(
|
||||
HideoutCallbacks hideoutCallbacks)
|
||||
{
|
||||
_hideoutCallbacks = hideoutCallbacks;
|
||||
}
|
||||
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_UPGRADE, false),
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_UPGRADE_COMPLETE, false),
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS, false),
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS, false),
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_TOGGLE_AREA, false),
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_SINGLE_PRODUCTION_START, false),
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_SCAV_CASE_PRODUCTION_START, false),
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_CONTINUOUS_PRODUCTION_START, false),
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_TAKE_PRODUCTION, false),
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_RECORD_SHOOTING_RANGE_POINTS, false),
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_IMPROVE_AREA, false),
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_CANCEL_PRODUCTION_COMMAND, false),
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_CIRCLE_OF_CULTIST_PRODUCTION_START, false),
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_DELETE_PRODUCTION_COMMAND, false),
|
||||
new HandledRoute(HideoutEventActions.HIDEOUT_CUSTOMIZATION_APPLY_COMMAND, false)
|
||||
};
|
||||
}
|
||||
|
||||
public override object HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url) {
|
||||
case HideoutEventActions.HIDEOUT_UPGRADE:
|
||||
return _hideoutCallbacks.Upgrade(pmcData, body as HideoutUpgradeRequestData, sessionID, output);
|
||||
case HideoutEventActions.HIDEOUT_UPGRADE_COMPLETE:
|
||||
return _hideoutCallbacks.UpgradeComplete(pmcData, body as HideoutUpgradeCompleteRequestData, sessionID, output);
|
||||
case HideoutEventActions.HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS:
|
||||
return _hideoutCallbacks.PutItemsInAreaSlots(pmcData, body as HideoutPutItemInRequestData, sessionID);
|
||||
case HideoutEventActions.HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS:
|
||||
return _hideoutCallbacks.TakeItemsFromAreaSlots(pmcData, body as HideoutTakeItemOutRequestData, sessionID);
|
||||
case HideoutEventActions.HIDEOUT_TOGGLE_AREA:
|
||||
return _hideoutCallbacks.ToggleArea(pmcData, body as HideoutToggleAreaRequestData, sessionID);
|
||||
case HideoutEventActions.HIDEOUT_SINGLE_PRODUCTION_START:
|
||||
return _hideoutCallbacks.SingleProductionStart(pmcData, body as HideoutSingleProductionStartRequestData, sessionID);
|
||||
case HideoutEventActions.HIDEOUT_SCAV_CASE_PRODUCTION_START:
|
||||
return _hideoutCallbacks.ScavCaseProductionStart(pmcData, body as HideoutScavCaseStartRequestData, sessionID);
|
||||
case HideoutEventActions.HIDEOUT_CONTINUOUS_PRODUCTION_START:
|
||||
return _hideoutCallbacks.ContinuousProductionStart(pmcData, body as HideoutContinuousProductionStartRequestData, sessionID);
|
||||
case HideoutEventActions.HIDEOUT_TAKE_PRODUCTION:
|
||||
return _hideoutCallbacks.TakeProduction(pmcData, body as HideoutTakeProductionRequestData, sessionID);
|
||||
case HideoutEventActions.HIDEOUT_RECORD_SHOOTING_RANGE_POINTS:
|
||||
return _hideoutCallbacks.RecordShootingRangePoints(pmcData, body as RecordShootingRangePoints, sessionID, output);
|
||||
case HideoutEventActions.HIDEOUT_IMPROVE_AREA:
|
||||
return _hideoutCallbacks.ImproveArea(pmcData, body as HideoutImproveAreaRequestData, sessionID);
|
||||
case HideoutEventActions.HIDEOUT_CANCEL_PRODUCTION_COMMAND:
|
||||
return _hideoutCallbacks.CancelProduction(pmcData, body as HideoutImproveAreaRequestData, sessionID);
|
||||
case HideoutEventActions.HIDEOUT_CIRCLE_OF_CULTIST_PRODUCTION_START:
|
||||
return _hideoutCallbacks.CicleOfCultistProductionStart(pmcData, body as HideoutCircleOfCultistProductionStartRequestData, sessionID);
|
||||
case HideoutEventActions.HIDEOUT_DELETE_PRODUCTION_COMMAND:
|
||||
return _hideoutCallbacks.HideoutDeleteProductionCommand(pmcData, body as HideoutDeleteProductionRequestData, sessionID);
|
||||
case HideoutEventActions.HIDEOUT_CUSTOMIZATION_APPLY_COMMAND:
|
||||
return _hideoutCallbacks.HideoutCustomizationApplyCommand(pmcData, body as HideoutCustomizationApplyRequestData, sessionID);
|
||||
default:
|
||||
throw new Exception($"HideoutItemEventRouter being used when it cant handle route {url}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using Core.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Insurance;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
|
||||
namespace Core.Routers.ItemEvents;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(ItemEventRouterDefinition))]
|
||||
public class InsuranceItemEventRouter : ItemEventRouterDefinition
|
||||
{
|
||||
protected InsuranceCallbacks _insuranceCallbacks;
|
||||
|
||||
public InsuranceItemEventRouter
|
||||
(
|
||||
InsuranceCallbacks insuranceCallbacks
|
||||
)
|
||||
{
|
||||
_insuranceCallbacks = insuranceCallbacks;
|
||||
}
|
||||
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new HandledRoute("Insure", false)
|
||||
};
|
||||
}
|
||||
|
||||
public override object HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
case "Insure":
|
||||
return _insuranceCallbacks.Insure(pmcData, body as InsureRequestData, sessionID);
|
||||
default:
|
||||
throw new Exception($"InsuranceItemEventRouter being used when it cant handle route {url}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
using Core.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Hideout;
|
||||
using Core.Models.Eft.Inventory;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Quests;
|
||||
using Core.Models.Enums;
|
||||
|
||||
namespace Core.Routers.ItemEvents;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(ItemEventRouterDefinition))]
|
||||
public class InventoryItemEventRouter : ItemEventRouterDefinition
|
||||
{
|
||||
protected InventoryCallbacks _inventoryCallbacks;
|
||||
protected HideoutCallbacks _hideoutCallbacks;
|
||||
|
||||
public InventoryItemEventRouter
|
||||
(
|
||||
InventoryCallbacks inventoryCallbacks,
|
||||
HideoutCallbacks hideoutCallbacks
|
||||
)
|
||||
{
|
||||
_inventoryCallbacks = inventoryCallbacks;
|
||||
_hideoutCallbacks = hideoutCallbacks;
|
||||
}
|
||||
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new HandledRoute(ItemEventActions.MOVE, false),
|
||||
new HandledRoute(ItemEventActions.REMOVE, false),
|
||||
new HandledRoute(ItemEventActions.SPLIT, false),
|
||||
new HandledRoute(ItemEventActions.MERGE, false),
|
||||
new HandledRoute(ItemEventActions.TRANSFER, false),
|
||||
new HandledRoute(ItemEventActions.SWAP, false),
|
||||
new HandledRoute(ItemEventActions.FOLD, false),
|
||||
new HandledRoute(ItemEventActions.TOGGLE, false),
|
||||
new HandledRoute(ItemEventActions.TAG, false),
|
||||
new HandledRoute(ItemEventActions.BIND, false),
|
||||
new HandledRoute(ItemEventActions.UNBIND, false),
|
||||
new HandledRoute(ItemEventActions.EXAMINE, false),
|
||||
new HandledRoute(ItemEventActions.READ_ENCYCLOPEDIA, false),
|
||||
new HandledRoute(ItemEventActions.APPLY_INVENTORY_CHANGES, false),
|
||||
new HandledRoute(ItemEventActions.CREATE_MAP_MARKER, false),
|
||||
new HandledRoute(ItemEventActions.DELETE_MAP_MARKER, false),
|
||||
new HandledRoute(ItemEventActions.EDIT_MAP_MARKER, false),
|
||||
new HandledRoute(ItemEventActions.OPEN_RANDOM_LOOT_CONTAINER, false),
|
||||
new HandledRoute(ItemEventActions.HIDEOUT_QTE_EVENT, false),
|
||||
new HandledRoute(ItemEventActions.REDEEM_PROFILE_REWARD, false),
|
||||
new HandledRoute(ItemEventActions.SET_FAVORITE_ITEMS, false),
|
||||
new HandledRoute(ItemEventActions.QUEST_FAIL, false),
|
||||
new HandledRoute(ItemEventActions.PIN_LOCK, false)
|
||||
};
|
||||
}
|
||||
|
||||
public override object HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url) {
|
||||
case ItemEventActions.MOVE:
|
||||
return _inventoryCallbacks.MoveItem(pmcData, body as InventoryMoveRequestData, sessionID, output);
|
||||
case ItemEventActions.REMOVE:
|
||||
return _inventoryCallbacks.RemoveItem(pmcData, body as InventoryRemoveRequestData, sessionID, output);
|
||||
case ItemEventActions.SPLIT:
|
||||
return _inventoryCallbacks.SplitItem(pmcData, body as InventorySplitRequestData, sessionID, output);
|
||||
case ItemEventActions.MERGE:
|
||||
return _inventoryCallbacks.MergeItem(pmcData, body as InventoryMergeRequestData, sessionID, output);
|
||||
case ItemEventActions.TRANSFER:
|
||||
return _inventoryCallbacks.TransferItem(pmcData, body as InventoryTransferRequestData, sessionID, output);
|
||||
case ItemEventActions.SWAP:
|
||||
return _inventoryCallbacks.SwapItem(pmcData, body as InventorySwapRequestData, sessionID);
|
||||
case ItemEventActions.FOLD:
|
||||
return _inventoryCallbacks.FoldItem(pmcData, body as InventoryFoldRequestData, sessionID);
|
||||
case ItemEventActions.TOGGLE:
|
||||
return _inventoryCallbacks.ToggleItem(pmcData, body as InventoryToggleRequestData, sessionID);
|
||||
case ItemEventActions.TAG:
|
||||
return _inventoryCallbacks.TagItem(pmcData, body as InventoryTagRequestData, sessionID);
|
||||
case ItemEventActions.BIND:
|
||||
return _inventoryCallbacks.BindItem(pmcData, body as InventoryBindRequestData, sessionID, output);
|
||||
case ItemEventActions.UNBIND:
|
||||
return _inventoryCallbacks.UnBindItem(pmcData, body as InventoryBindRequestData, sessionID, output);
|
||||
case ItemEventActions.EXAMINE:
|
||||
return _inventoryCallbacks.ExamineItem(pmcData, body as InventoryExamineRequestData, sessionID, output);
|
||||
case ItemEventActions.READ_ENCYCLOPEDIA:
|
||||
return _inventoryCallbacks.ReadEncyclopedia(pmcData, body as InventoryReadEncyclopediaRequestData, sessionID);
|
||||
case ItemEventActions.APPLY_INVENTORY_CHANGES:
|
||||
return _inventoryCallbacks.SortInventory(pmcData, body as InventorySortRequestData, sessionID, output);
|
||||
case ItemEventActions.CREATE_MAP_MARKER:
|
||||
return _inventoryCallbacks.CreateMapMarker(pmcData, body as InventoryCreateMarkerRequestData, sessionID, output);
|
||||
case ItemEventActions.DELETE_MAP_MARKER:
|
||||
return _inventoryCallbacks.DeleteMapMarker(pmcData, body as InventoryDeleteMarkerRequestData, sessionID, output);
|
||||
case ItemEventActions.EDIT_MAP_MARKER:
|
||||
return _inventoryCallbacks.EditMapMarker(pmcData, body as InventoryEditMarkerRequestData, sessionID, output);
|
||||
case ItemEventActions.OPEN_RANDOM_LOOT_CONTAINER:
|
||||
return _inventoryCallbacks.OpenRandomLootContainer(pmcData, body as OpenRandomLootContainerRequestData, sessionID, output);
|
||||
case ItemEventActions.HIDEOUT_QTE_EVENT:
|
||||
return _hideoutCallbacks.HandleQTEEvent(pmcData, body as HandleQTEEventRequestData, sessionID, output);
|
||||
case ItemEventActions.REDEEM_PROFILE_REWARD:
|
||||
return _inventoryCallbacks.RedeemProfileReward(pmcData, body as RedeemProfileRequestData, sessionID, output);
|
||||
case ItemEventActions.SET_FAVORITE_ITEMS:
|
||||
return _inventoryCallbacks.SetFavoriteItem(pmcData, body as SetFavoriteItems, sessionID, output);
|
||||
case ItemEventActions.QUEST_FAIL:
|
||||
return _inventoryCallbacks.FailQuest(pmcData, body as FailQuestRequestData, sessionID, output);
|
||||
case ItemEventActions.PIN_LOCK:
|
||||
return _inventoryCallbacks.PinOrLock(pmcData, body as PinOrLockItemRequest, sessionID, output);
|
||||
default:
|
||||
throw new Exception($"InventoryItemEventRouter being used when it cant handle route {url}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using Core.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Notes;
|
||||
|
||||
namespace Core.Routers.ItemEvents;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(ItemEventRouterDefinition))]
|
||||
public class NoteItemEventRouter : ItemEventRouterDefinition
|
||||
{
|
||||
protected NoteCallbacks _noteCallbacks;
|
||||
|
||||
public NoteItemEventRouter
|
||||
(
|
||||
NoteCallbacks noteCallbacks
|
||||
)
|
||||
{
|
||||
_noteCallbacks = noteCallbacks;
|
||||
}
|
||||
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new HandledRoute("AddNote", false),
|
||||
new HandledRoute("EditNote", false),
|
||||
new HandledRoute("DeleteNote", false)
|
||||
};
|
||||
}
|
||||
|
||||
public override object HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
case "AddNote":
|
||||
return _noteCallbacks.AddNote(pmcData, body as NoteActionData, sessionID);
|
||||
case "EditNote":
|
||||
return _noteCallbacks.EditNote(pmcData, body as NoteActionData, sessionID);
|
||||
case "DeleteNote":
|
||||
return _noteCallbacks.DeleteNote(pmcData, body as NoteActionData, sessionID);
|
||||
default:
|
||||
throw new Exception($"NoteItemEventRouter being used when it cant handle route {url}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using Core.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Quests;
|
||||
using ILogger = Core.Models.Utils.ILogger;
|
||||
|
||||
namespace Core.Routers.ItemEvents;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(ItemEventRouterDefinition))]
|
||||
public class QuestItemEventRouter : ItemEventRouterDefinition
|
||||
{
|
||||
protected QuestCallbacks _questCallbacks;
|
||||
|
||||
public QuestItemEventRouter
|
||||
(
|
||||
QuestCallbacks questCallbacks
|
||||
)
|
||||
{
|
||||
_questCallbacks = questCallbacks;
|
||||
}
|
||||
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new HandledRoute("QuestAccept", false),
|
||||
new HandledRoute("QuestComplete", false),
|
||||
new HandledRoute("QuestHandover", false),
|
||||
new HandledRoute("RepeatableQuestChange", false)
|
||||
};
|
||||
}
|
||||
|
||||
public override object HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url) {
|
||||
case "QuestAccept":
|
||||
return _questCallbacks.AcceptQuest(pmcData, body as AcceptQuestRequestData, sessionID);
|
||||
case "QuestComplete":
|
||||
return _questCallbacks.CompleteQuest(pmcData, body as CompleteQuestRequestData, sessionID);
|
||||
case "QuestHandover":
|
||||
return _questCallbacks.HandoverQuest(pmcData, body as HandoverQuestRequestData, sessionID);
|
||||
case "RepeatableQuestChange":
|
||||
return _questCallbacks.ChangeRepeatableQuest(pmcData, body as RepeatableQuestChangeRequest, sessionID);
|
||||
default:
|
||||
throw new Exception($"QuestItemEventRouter being used when it cant handle route {url}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using Core.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Ragfair;
|
||||
|
||||
namespace Core.Routers.ItemEvents;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(ItemEventRouterDefinition))]
|
||||
public class RagfairItemEventRouter : ItemEventRouterDefinition
|
||||
{
|
||||
protected RagfairCallbacks _ragfairCallbacks;
|
||||
|
||||
public RagfairItemEventRouter
|
||||
(
|
||||
RagfairCallbacks ragfairCallbacks
|
||||
)
|
||||
{
|
||||
_ragfairCallbacks = ragfairCallbacks;
|
||||
}
|
||||
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new HandledRoute("RagFairAddOffer", false),
|
||||
new HandledRoute("RagFairRemoveOffer", false),
|
||||
new HandledRoute("RagFairRenewOffer", false),
|
||||
};
|
||||
}
|
||||
|
||||
public override object HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url) {
|
||||
case "RagFairAddOffer":
|
||||
return _ragfairCallbacks.AddOffer(pmcData, body as AddOfferRequestData, sessionID);
|
||||
case "RagFairRemoveOffer":
|
||||
return _ragfairCallbacks.RemoveOffer(pmcData, body as RemoveOfferRequestData, sessionID);
|
||||
case "RagFairRenewOffer":
|
||||
return _ragfairCallbacks.ExtendOffer(pmcData, body as ExtendOfferRequestData, sessionID);
|
||||
default:
|
||||
throw new Exception($"CustomizationItemEventRouter being used when it cant handle route {url}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using Core.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Repair;
|
||||
|
||||
namespace Core.Routers.ItemEvents;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(ItemEventRouterDefinition))]
|
||||
public class RepairItemEventRouter : ItemEventRouterDefinition
|
||||
{
|
||||
protected RepairCallbacks _repairCallbacks;
|
||||
|
||||
public RepairItemEventRouter
|
||||
(
|
||||
RepairCallbacks repairCallbacks
|
||||
)
|
||||
{
|
||||
_repairCallbacks = repairCallbacks;
|
||||
}
|
||||
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new HandledRoute("Repair", false),
|
||||
new HandledRoute("TraderRepair", false)
|
||||
};
|
||||
}
|
||||
|
||||
public override object HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url) {
|
||||
case "Repair":
|
||||
return _repairCallbacks.Repair(pmcData, body as RepairActionDataRequest, sessionID);
|
||||
case "TraderRepair":
|
||||
return _repairCallbacks.TraderRepair(pmcData, body as TraderRepairActionDataRequest, sessionID);
|
||||
default:
|
||||
throw new Exception($"RepairItemEventRouter being used when it cant handle route {url}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using Core.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Trade;
|
||||
|
||||
namespace Core.Routers.ItemEvents;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(ItemEventRouterDefinition))]
|
||||
public class TradeItemEventRouter : ItemEventRouterDefinition
|
||||
{
|
||||
protected TradeCallbacks _tradeCallbacks;
|
||||
|
||||
public TradeItemEventRouter
|
||||
(
|
||||
TradeCallbacks tradeCallbacks
|
||||
)
|
||||
{
|
||||
_tradeCallbacks = tradeCallbacks;
|
||||
}
|
||||
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new HandledRoute("TradingConfirm", false),
|
||||
new HandledRoute("RagFairBuyOffer", false),
|
||||
new HandledRoute("SellAllFromSavage", false)
|
||||
};
|
||||
}
|
||||
|
||||
public override object HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url) {
|
||||
case "TradingConfirm":
|
||||
return _tradeCallbacks.ProcessTrade(pmcData, body as ProcessBaseTradeRequestData, sessionID);
|
||||
case "RagFairBuyOffer":
|
||||
return _tradeCallbacks.ProcessRagfairTrade(pmcData, body as ProcessRagfairTradeRequestData, sessionID);
|
||||
case "SellAllFromSavage":
|
||||
return _tradeCallbacks.SellAllFromSavage(pmcData, body as SellScavItemsToFenceRequestData, sessionID);
|
||||
default:
|
||||
throw new Exception($"TradeItemEventRouter being used when it cant handle route {url}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using Core.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Wishlist;
|
||||
|
||||
namespace Core.Routers.ItemEvents;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(ItemEventRouterDefinition))]
|
||||
public class WishlistItemEventRouter : ItemEventRouterDefinition
|
||||
{
|
||||
protected WishlistCallbacks _wishlistCallbacks;
|
||||
|
||||
public WishlistItemEventRouter
|
||||
(
|
||||
WishlistCallbacks wishlistCallbacks
|
||||
)
|
||||
{
|
||||
_wishlistCallbacks = wishlistCallbacks;
|
||||
}
|
||||
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new HandledRoute("AddToWishList", false),
|
||||
new HandledRoute("RemoveFromWishList", false),
|
||||
new HandledRoute("ChangeWishlistItemCategory", false)
|
||||
};
|
||||
}
|
||||
|
||||
public override object HandleItemEvent(string url, PmcData pmcData, object body, string sessionID, ItemEventRouterResponse output)
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
case "AddToWishList":
|
||||
return _wishlistCallbacks.AddToWishlist(pmcData, body as AddToWishlistRequest, sessionID);
|
||||
case "RemoveFromWishList":
|
||||
return _wishlistCallbacks.RemoveFromWishlist(pmcData, body as RemoveFromWishlistRequest, sessionID);
|
||||
case "ChangeWishlistItemCategory":
|
||||
return _wishlistCallbacks.ChangeWishlistItemCategory(pmcData, body as ChangeWishlistItemCategoryRequest, sessionID);
|
||||
default:
|
||||
throw new Exception($"CustomizationItemEventRouter being used when it cant handle route {url}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using Core.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Ragfair;
|
||||
using Core.Utils;
|
||||
|
||||
namespace Core.Routers.Static;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(StaticRouter))]
|
||||
public class RagfairStaticRouter : StaticRouter
|
||||
{
|
||||
protected static RagfairCallbacks _ragfairCallbacks;
|
||||
|
||||
public RagfairStaticRouter(
|
||||
JsonUtil jsonUtil,
|
||||
RagfairCallbacks ragfairCallbacks
|
||||
) : base(
|
||||
jsonUtil,
|
||||
[
|
||||
new RouteAction(
|
||||
"/client/ragfair/search",
|
||||
(
|
||||
url,
|
||||
info,
|
||||
sessionID,
|
||||
output
|
||||
) => _ragfairCallbacks.Search(url, info as SearchRequestData, sessionID),
|
||||
typeof(SearchRequestData)),
|
||||
new RouteAction(
|
||||
"/client/ragfair/find",
|
||||
(
|
||||
url,
|
||||
info,
|
||||
sessionID,
|
||||
output
|
||||
) => _ragfairCallbacks.Search(url, info as SearchRequestData, sessionID),
|
||||
typeof(SearchRequestData)),
|
||||
new RouteAction(
|
||||
"/client/ragfair/itemMarketPrice",
|
||||
(
|
||||
url,
|
||||
info,
|
||||
sessionID,
|
||||
output
|
||||
) => _ragfairCallbacks.GetMarketPrice(url, info as GetMarketPriceRequestData, sessionID),
|
||||
typeof(GetMarketPriceRequestData)),
|
||||
new RouteAction(
|
||||
"/client/ragfair/offerfees",
|
||||
(
|
||||
url,
|
||||
info,
|
||||
sessionID,
|
||||
output
|
||||
) => _ragfairCallbacks.StorePlayerOfferTaxAmount(url, info as StorePlayerOfferTaxAmountRequestData, sessionID),
|
||||
typeof(StorePlayerOfferTaxAmountRequestData)),
|
||||
new RouteAction(
|
||||
"/client/reports/ragfair/send",
|
||||
(
|
||||
url,
|
||||
info,
|
||||
sessionID,
|
||||
output
|
||||
) => _ragfairCallbacks.SendReport(url, info as SendRagfairReportRequestData, sessionID),
|
||||
typeof(SendRagfairReportRequestData)),
|
||||
new RouteAction(
|
||||
"/client/items/prices",
|
||||
(
|
||||
url,
|
||||
info,
|
||||
sessionID,
|
||||
output
|
||||
) => _ragfairCallbacks.GetFleaPrices(url, info as EmptyRequestData, sessionID)),
|
||||
new RouteAction(
|
||||
"/client/ragfair/offer/findbyid",
|
||||
(
|
||||
url,
|
||||
info,
|
||||
sessionID,
|
||||
output
|
||||
) => _ragfairCallbacks.GetFleaOfferById(url, info as GetRagfairOfferByIdRequest, sessionID),
|
||||
typeof(GetRagfairOfferByIdRequest))
|
||||
]
|
||||
)
|
||||
{
|
||||
_ragfairCallbacks = ragfairCallbacks;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using Core.Annotations;
|
||||
using Core.Callbacks;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Utils;
|
||||
|
||||
namespace Core.Routers.Static;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(StaticRouter))]
|
||||
public class WeatherStaticRouter : StaticRouter
|
||||
{
|
||||
protected static WeatherCallbacks _weatherCallbacks;
|
||||
|
||||
public WeatherStaticRouter(
|
||||
JsonUtil jsonUtil,
|
||||
WeatherCallbacks weatherCallbacks
|
||||
) : base(
|
||||
jsonUtil,
|
||||
[
|
||||
new RouteAction(
|
||||
"",
|
||||
(
|
||||
url,
|
||||
info,
|
||||
sessionID,
|
||||
output
|
||||
) => _weatherCallbacks.GetWeather(url, info as EmptyRequestData, sessionID)),
|
||||
new RouteAction(
|
||||
"",
|
||||
(
|
||||
url,
|
||||
info,
|
||||
sessionID,
|
||||
output
|
||||
) => _weatherCallbacks.GetLocalWeather(url, info as EmptyRequestData, sessionID)),
|
||||
]
|
||||
)
|
||||
{
|
||||
_weatherCallbacks = weatherCallbacks;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user