mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-12 15:04:36 +01:00
InTheMirror Arcade's game (#56)
This commit is contained in:
@@ -243,6 +243,17 @@ namespace EpinelPS.Data
|
||||
[LoadRecord("EventPlaySodaPointRewardTable.json", "id")]
|
||||
public readonly Dictionary<int, EventPlaySodaPointRewardRecord> EventPlaySodaPointRewardTable = [];
|
||||
|
||||
// Tables related to InTheMirror Arcade's event.
|
||||
|
||||
[LoadRecord("EventMvgQuestTable.json", "id")]
|
||||
public readonly Dictionary<int, EventMVGQuestRecord_Raw> EventMvgQuestTable = [];
|
||||
|
||||
[LoadRecord("EventMvgQuestTable.json", "id")]
|
||||
public readonly Dictionary<int, EventMVGShopRecord_Raw> EventMvgShopTable = [];
|
||||
|
||||
[LoadRecord("EventMVGMissionTable.json", "id")]
|
||||
public readonly Dictionary<int, EventMVGMissionRecord_Raw> EventMvgMissionTable = [];
|
||||
|
||||
static async Task<GameData> BuildAsync()
|
||||
{
|
||||
await Load();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Data;
|
||||
using MemoryPack;
|
||||
using System.Data;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace EpinelPS.Data
|
||||
{
|
||||
@@ -1174,5 +1175,126 @@ namespace EpinelPS.Data
|
||||
public EventPlaySodaGameType game_type;
|
||||
public int step;
|
||||
public int reward_id;
|
||||
}
|
||||
|
||||
[MemoryPackable]
|
||||
public partial class EventMVGQuestRecord_Raw
|
||||
{
|
||||
public int id;
|
||||
public int condition_id;
|
||||
public int next_quest_id;
|
||||
public int parents_quest_id;
|
||||
public int time_line_group_id;
|
||||
public int reward_id;
|
||||
public EventMVGQuestConditionType condition_type;
|
||||
public int condition_value_1;
|
||||
public string condition_value_2 = "";
|
||||
public string description_localkey = "";
|
||||
public string name_localkey = "";
|
||||
public MVGQuestTargetType quest_target_type;
|
||||
public MVGQuestType quest_type;
|
||||
}
|
||||
|
||||
public enum EventMVGQuestConditionType
|
||||
{
|
||||
StartMission,
|
||||
EndMission,
|
||||
KillMonster,
|
||||
MissionTargetPoint,
|
||||
ClearMultiCondition,
|
||||
GetCollectable,
|
||||
GetCurrency,
|
||||
PlatformSwitchInteraction,
|
||||
ConditionCheckSwitchInteraction,
|
||||
TeleportDeviceInteraction
|
||||
}
|
||||
|
||||
public enum MVGQuestTargetType
|
||||
{
|
||||
First,
|
||||
Loop
|
||||
}
|
||||
|
||||
public enum MVGQuestType
|
||||
{
|
||||
Normal,
|
||||
MotherMission,
|
||||
ChildMission
|
||||
}
|
||||
|
||||
[MemoryPackable]
|
||||
public partial class EventMVGShopRecord_Raw
|
||||
{
|
||||
public int id;
|
||||
public int group_id;
|
||||
public int itemId;
|
||||
public string desc = "";
|
||||
public int itemSlot;
|
||||
public EventMVGShopItemTypeData itemType;
|
||||
public EventMVGQuestConditionType condition_type;
|
||||
public int order;
|
||||
//public List< condition_value_2 = "";
|
||||
public string description_localkey = "";
|
||||
public string name_localkey = "";
|
||||
public MVGQuestTargetType quest_target_type;
|
||||
public MVGQuestType quest_type;
|
||||
}
|
||||
|
||||
public enum EventMVGShopItemTypeData
|
||||
{
|
||||
Collectable,
|
||||
Module,
|
||||
None
|
||||
}
|
||||
|
||||
[MemoryPackable]
|
||||
public partial class EventMVGMissionRecord_Raw
|
||||
{
|
||||
public int id;
|
||||
public int mvg_id;
|
||||
public int condition_id;
|
||||
public int condition_value;
|
||||
public int order;
|
||||
public string name_localkey = "";
|
||||
public EventMVGMissionType mission_type;
|
||||
public EventMVGMIssionSubType mission_sub_type;
|
||||
public EventMVGMissionConditionType condition_type;
|
||||
public bool display_type;
|
||||
public bool is_reset;
|
||||
public int reward_id;
|
||||
public int point_value;
|
||||
}
|
||||
|
||||
public enum EventMVGMissionType
|
||||
{
|
||||
Daily,
|
||||
Achievement
|
||||
}
|
||||
|
||||
public enum EventMVGMIssionSubType
|
||||
{
|
||||
None,
|
||||
MonsterKill,
|
||||
BossMonsterKill,
|
||||
GetItem,
|
||||
ChapterClear,
|
||||
Explorer
|
||||
}
|
||||
|
||||
public enum EventMVGMissionConditionType
|
||||
{
|
||||
KillMonster,
|
||||
KillBossMonster,
|
||||
GetCurrency,
|
||||
GetCollectable,
|
||||
None,
|
||||
ClearAchievement,
|
||||
TargetPoint,
|
||||
ClearMap,
|
||||
GetUpgradeMax,
|
||||
GetModule,
|
||||
UseKey,
|
||||
GetMemory,
|
||||
PlayMVG,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using EpinelPS.Database;
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Minigame.InTheMirror
|
||||
{
|
||||
[PacketPath("/arcade/mvg/log/collectable")]
|
||||
public class GetAcquireMvgCollectable : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
var request = await ReadData<ReqAcquireArcadeMvgCollectable>();
|
||||
|
||||
var user = GetUser();
|
||||
|
||||
user.ArcadeInTheMirrorData.Collectables.Add(request.CollectableId);
|
||||
|
||||
await WriteDataAsync(new ResAcquireArcadeMvgCollectable());
|
||||
|
||||
JsonDb.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Minigame.InTheMirror
|
||||
{
|
||||
[PacketPath("/arcade/mvg/log/shop")]
|
||||
public class GetBuyFromArcadeMvgShop : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
await ReadData<ReqBuyFromArcadeMvgShop>();
|
||||
|
||||
await WriteDataAsync(new ResBuyFromArcadeMvgShop());
|
||||
}
|
||||
}
|
||||
}
|
||||
18
EpinelPS/LobbyServer/Minigame/InTheMirror/GetMvgData.cs
Normal file
18
EpinelPS/LobbyServer/Minigame/InTheMirror/GetMvgData.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Minigame.InTheMirror
|
||||
{
|
||||
[PacketPath("/arcade/mvg/get")]
|
||||
public class GetMvgData : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
await ReadData<ReqGetArcadeMvgData>();
|
||||
|
||||
var user = GetUser();
|
||||
|
||||
await WriteDataAsync(new ResGetArcadeMvgData() { Data = user.ArcadeInTheMirrorData });
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Minigame.InTheMirror
|
||||
{
|
||||
[PacketPath("/arcade/mvg/log/interaction")]
|
||||
public class GetMvgLogInteraction : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
await ReadData<ReqLogArcadeMvgInteraction>();
|
||||
|
||||
await WriteDataAsync(new ResLogArcadeMvgInteraction());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
15
EpinelPS/LobbyServer/Minigame/InTheMirror/GetMvgLogModule.cs
Normal file
15
EpinelPS/LobbyServer/Minigame/InTheMirror/GetMvgLogModule.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Minigame.InTheMirror
|
||||
{
|
||||
[PacketPath("/arcade/mvg/log/module")]
|
||||
public class GetMvgLogModule : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
await ReadData<ReqEquipArcadeMvgModule>();
|
||||
|
||||
await WriteDataAsync(new ResEquipArcadeMvgModule());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Minigame.InTheMirror
|
||||
{
|
||||
[PacketPath("/arcade/mvg/log/module/limit")]
|
||||
public class GetMvgLogModuleLimit : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
await ReadData<ReqIncreaseArcadeMvgModuleLimit>();
|
||||
|
||||
await WriteDataAsync(new ResIncreaseArcadeMvgModuleLimit());
|
||||
}
|
||||
}
|
||||
}
|
||||
16
EpinelPS/LobbyServer/Minigame/InTheMirror/GetMvgLogState.cs
Normal file
16
EpinelPS/LobbyServer/Minigame/InTheMirror/GetMvgLogState.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using EpinelPS.Database;
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Minigame.InTheMirror
|
||||
{
|
||||
[PacketPath("/arcade/mvg/log/state")]
|
||||
public class GetMvgLogState : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
await ReadData<ReqLogArcadeMvgState>();
|
||||
|
||||
await WriteDataAsync(new ResLogArcadeMvgState());
|
||||
}
|
||||
}
|
||||
}
|
||||
16
EpinelPS/LobbyServer/Minigame/InTheMirror/GetMvgLogUnlock.cs
Normal file
16
EpinelPS/LobbyServer/Minigame/InTheMirror/GetMvgLogUnlock.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using EpinelPS.Database;
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Minigame.InTheMirror
|
||||
{
|
||||
[PacketPath("/arcade/mvg/log/unlock")]
|
||||
public class GetMvgLogUpdate : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
await ReadData<ReqUnlockArcadeMvg>();
|
||||
|
||||
await WriteDataAsync(new ResUnlockArcadeMvg());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Minigame.InTheMirror
|
||||
{
|
||||
[PacketPath("/arcade/mvg/log/upgrade")]
|
||||
public class GetMvgLogUpgrade : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
await ReadData<ReqBuyFromArcadeMvgUpgradeShop>();
|
||||
|
||||
await WriteDataAsync(new ResBuyFromArcadeMvgUpgradeShop() );
|
||||
}
|
||||
}
|
||||
}
|
||||
22
EpinelPS/LobbyServer/Minigame/InTheMirror/GetMvgSave.cs
Normal file
22
EpinelPS/LobbyServer/Minigame/InTheMirror/GetMvgSave.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using EpinelPS.Database;
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Minigame.InTheMirror
|
||||
{
|
||||
[PacketPath("/arcade/mvg/save")]
|
||||
public class GetMvgSave : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
var request = await ReadData<ReqSaveArcadeMvgData>();
|
||||
|
||||
var user = GetUser();
|
||||
|
||||
user.ArcadeInTheMirrorData = request.Data;
|
||||
|
||||
await WriteDataAsync(new ResSaveArcadeMvgData());
|
||||
|
||||
JsonDb.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using EpinelPS.Data;
|
||||
using EpinelPS.Database;
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Minigame.PlaySoda
|
||||
{
|
||||
[PacketPath("/arcade/mvg/obtainachievementmissionreward")]
|
||||
public class ReqObtainAchievementMissionReward : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
var request = await ReadData<ReqObtainArcadeMvgAchievementMissionReward>();
|
||||
|
||||
var user = GetUser();
|
||||
|
||||
List<NetRewardData> rewards = [];
|
||||
|
||||
foreach (var missionId in request.MissionIds)
|
||||
{
|
||||
var mission = GameData.Instance.EventMvgMissionTable[missionId];
|
||||
user.ArcadeInTheMirrorData.AchievementMissions.First(m => m.MissionId == mission.id).IsReceived = true;
|
||||
|
||||
var achievement_mission = GameData.Instance.EventMvgMissionTable.First(m => m.Key > mission.id && m.Value.condition_type == EventMVGMissionConditionType.ClearAchievement);
|
||||
user.ArcadeInTheMirrorData.AchievementMissions.First(m => m.MissionId == achievement_mission.Key).Progress++;
|
||||
|
||||
rewards.Add(RewardUtils.RegisterRewardsForUser(user, mission.reward_id));
|
||||
}
|
||||
|
||||
var response = new ResObtainArcadeMvgAchievementMissionReward() { Reward = NetUtils.MergeRewards(rewards, user) };
|
||||
response.Missions.AddRange(user.ArcadeInTheMirrorData.AchievementMissions);
|
||||
|
||||
await WriteDataAsync(response);
|
||||
|
||||
JsonDb.Save();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using EpinelPS.Data;
|
||||
using EpinelPS.Database;
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Minigame.InTheMirror
|
||||
{
|
||||
[PacketPath("/arcade/mvg/obtainquestreward")]
|
||||
public class GetObtainMvgQuestReward : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
var request = await ReadData<ReqObtainArcadeMvgQuestReward>();
|
||||
|
||||
var user = GetUser();
|
||||
|
||||
List<NetRewardData> rewards = [];
|
||||
|
||||
foreach (var questId in request.QuestIds)
|
||||
{
|
||||
var quest = GameData.Instance.EventMvgQuestTable[questId];
|
||||
if (quest.id != 0)
|
||||
{
|
||||
user.ArcadeInTheMirrorData.Quests.First(q => q.QuestId == quest.id).IsReceived = true;
|
||||
|
||||
rewards.Add(RewardUtils.RegisterRewardsForUser(user, quest.reward_id));
|
||||
}
|
||||
}
|
||||
|
||||
await WriteDataAsync(new ResObtainArcadeMvgQuestReward() { Reward = NetUtils.MergeRewards(rewards, user) });
|
||||
|
||||
JsonDb.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using EpinelPS.Database;
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Minigame.InTheMirror
|
||||
{
|
||||
[PacketPath("/arcade/mvg/newgame")]
|
||||
public class GetStartMvgNewGame : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
await ReadData<ReqStartArcadeMvgNewGame>();
|
||||
|
||||
var user = GetUser();
|
||||
|
||||
user.ArcadeInTheMirrorData.Gold = 0;
|
||||
user.ArcadeInTheMirrorData.Core = 0;
|
||||
user.ArcadeInTheMirrorData.Quests.Clear();
|
||||
user.ArcadeInTheMirrorData.Collectables.Clear();
|
||||
user.ArcadeInTheMirrorData.ProgressJson = "";
|
||||
|
||||
await WriteDataAsync(new ResStartArcadeMvgNewGame());
|
||||
|
||||
JsonDb.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using EpinelPS.Data;
|
||||
using EpinelPS.Database;
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Minigame.InTheMirror
|
||||
{
|
||||
[PacketPath("/arcade/mvg/newgameplus")]
|
||||
public class GetStartMvgNewGamePlus : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
var request = await ReadData<ReqStartArcadeMvgNewGamePlus>();
|
||||
|
||||
var user = GetUser();
|
||||
|
||||
foreach (var questData in user.ArcadeInTheMirrorData.Quests.Where(q => q.IsReceived == false))
|
||||
{
|
||||
var quest = GameData.Instance.EventMvgQuestTable[questData.QuestId];
|
||||
if (quest.reward_id != 0)
|
||||
{
|
||||
foreach (var rewardEntry in GameData.Instance.RewardDataRecords[quest.reward_id].rewards ??= [])
|
||||
{
|
||||
if (!string.IsNullOrEmpty(rewardEntry.reward_type))
|
||||
{
|
||||
switch (rewardEntry.reward_id)
|
||||
{
|
||||
case 9810003:
|
||||
user.ArcadeInTheMirrorData.Gold += rewardEntry.reward_value;
|
||||
break;
|
||||
case 9811001:
|
||||
user.ArcadeInTheMirrorData.Core += rewardEntry.reward_value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var quest in user.ArcadeInTheMirrorData.Quests)
|
||||
{
|
||||
quest.Progress = default;
|
||||
quest.IsReceived = default;
|
||||
}
|
||||
|
||||
user.ArcadeInTheMirrorData.ProgressJson = request.ProgressJson;
|
||||
|
||||
await WriteDataAsync(new ResStartArcadeMvgNewGamePlus());
|
||||
|
||||
JsonDb.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,6 +103,7 @@ public class User
|
||||
public Dictionary<int, EventData> EventInfo = [];
|
||||
public MogMinigameInfo MogInfo = new();
|
||||
public List<NetPlaySodaEachGameInfo> ArcadePlaySodaInfoList = [];
|
||||
public NetArcadeMvgData ArcadeInTheMirrorData = new();
|
||||
|
||||
public TriggerModel AddTrigger(TriggerType type, int value, int conditionId = 0)
|
||||
{
|
||||
|
||||
@@ -162,6 +162,11 @@ namespace EpinelPS.Utils
|
||||
foreach (NetPointData? item in reward.Point)
|
||||
{
|
||||
result.Point.Add(item);
|
||||
}
|
||||
|
||||
foreach (int item in reward.JukeboxBgm)
|
||||
{
|
||||
result.JukeboxBgm.Add(item);
|
||||
}
|
||||
|
||||
foreach (NetCharacterData? c in reward.Character)
|
||||
|
||||
Reference in New Issue
Block a user