refactoring part 1

This commit is contained in:
Mikhail
2025-05-03 10:35:36 -04:00
parent 734349a297
commit 4265c43b4f
64 changed files with 261 additions and 227 deletions

View File

@@ -3,10 +3,9 @@ using ICSharpCode.SharpZipLib.Zip;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System.Diagnostics; using System.Diagnostics;
using System.Reflection;
using System.Security.Cryptography; using System.Security.Cryptography;
namespace EpinelPS.StaticInfo namespace EpinelPS.Data
{ {
public class GameData public class GameData
{ {
@@ -72,6 +71,7 @@ namespace EpinelPS.StaticInfo
public readonly Dictionary<int, SubquestRecord> Subquests = []; public readonly Dictionary<int, SubquestRecord> Subquests = [];
public readonly Dictionary<string, MessengerDialogRecord> Messages = []; public readonly Dictionary<string, MessengerDialogRecord> Messages = [];
public readonly Dictionary<int, MessengerMsgConditionRecord> MessageConditions = []; public readonly Dictionary<int, MessengerMsgConditionRecord> MessageConditions = [];
public readonly Dictionary<string, ScenarioRewardRecord> ScenarioRewards = [];
public byte[] Sha256Hash; public byte[] Sha256Hash;
@@ -549,6 +549,12 @@ namespace EpinelPS.StaticInfo
{ {
this.MessageConditions.Add(obj.id, obj); this.MessageConditions.Add(obj.id, obj);
} }
var scr = await LoadZip<ScenarioRewardTable>("ScenarioRewardsTable.json", progress);
foreach (var obj in scr.records)
{
this.ScenarioRewards.Add(obj.condition_id, obj);
}
} }
public MainQuestCompletionRecord? GetMainQuestForStageClearCondition(int stage) public MainQuestCompletionRecord? GetMainQuestForStageClearCondition(int stage)
@@ -760,151 +766,4 @@ namespace EpinelPS.StaticInfo
return false; return false;
} }
} }
public enum TriggerType
{
None = 0,
UserLevel = 1,
CampaignClear = 2,
ChapterClear = 3,
CampaignStart = 4,
TowerAllStart = 5,
TowerBasicClear = 6,
CharacterLevel = 7,
CharacterGrade = 8,
CharacterCore = 9,
CharacterAttractiveLevel = 10,
MainShopBuy = 11,
ShopGuildBuy = 12,
GachaCharacter = 13,
OutpostBattleReward = 14,
OutpostFastBattleReward = 15,
PointRewardDaily = 16,
PointRewardWeekly = 17,
ObtainCharacter = 18,
OutpostBuilding = 19,
SendFriendShipPoint = 20,
SendDispatch = 21,
MainQuestClear = 22,
ObtainJukeboxTheme = 23,
SubQuestClear = 24,
CampaignGroupClear = 25,
NpcTalk = 26,
TowerElysionClear = 27,
TowerMissilisClear = 28,
TowerTetraClear = 29,
TowerOverspecClear = 30,
AchieveRanking1st = 31,
AchieveRanking5th = 32,
AchieveRanking10th = 33,
EventPoint = 34,
HardChapterClear = 35,
ObtainCharacterSSR = 36,
GachaCompany = 37,
ObtainCharacterNew = 38,
WinArena = 39,
SpecialArenaTier = 40,
PointRewardAchievement = 41,
ObtainCharacterPilgrim = 42,
ShopDisassembleBuy = 43,
CharacterCounsel = 44,
CharacterAttractivePresent = 45,
ObtainEquipItemT3T4 = 46,
ObtainEquipItemT5T6 = 47,
ObtainEquipItemT7T8 = 48,
ObtainEquipItemT9 = 49,
PointRewardEvent = 50,
MissionClearEvent = 51,
ObtainMemorialItem = 52,
LostSectorClear = 53,
ObtainHarmonyCube = 54,
HarmonyCubeLevel = 55,
CooperationEventClear = 56,
SynchroDeviceSlot = 57,
ObtainEquipItemALL = 58,
EquipItemLevel = 59,
CharacterSkillLevel = 60,
PickupGachaCharacter = 61,
ObtainSilverMileage = 62,
ObtainGoldMileage = 63,
SendDispatchGrade = 64,
OutpostBattleBoxLevel = 65,
GetFriendShipPoint = 66,
MessageClear = 67,
RecycleResearchLevel = 68,
GachaPremium = 69,
CharacterLevelUpCount = 70,
CharacterGradeUpCount = 71,
CharacterLevelMax = 72,
CharacterGradeMax = 73,
HarmonyCubeLevelMax = 74,
CharacterSkillLevelMax = 75,
CharacterAttractiveLevelMax = 76,
EquipItemLevelMax = 77,
ObtainEquipItemT2 = 78,
FieldObjectCollection = 79,
SimulationRoomStart = 80,
InterceptStart = 81,
EquipItemLevelCount = 82,
SimulationRoomClear = 83,
InterceptClear = 84,
DailyEventClear = 85,
EventStageClear = 86,
ObtainEventCurrencyMaterialMiraclesnow = 87,
EventDungeonStageClear = 88,
EventSortOutClear = 89,
EventSortOutPointMax = 90,
EquipItemLevelUpCount = 91,
CharacterSkillLevelUpCount = 92,
FirstPaidGacha_Legecy = 93,
ObtainCharacterCostume = 94,
SyncroDeviceLevelMax = 95,
ObtainEventCurrencyMaterial = 96,
SimulationRoomClearWithoutCondition = 97,
EventTextAdventureClear = 98,
RookieArenaPlayCount = 99,
EventDicePlayCount = 100,
EventBBQTycoonDailyRewardCheck = 101,
EventBBQTycoonHighScore = 102,
ChampionArenaGambleWinAll = 103,
ChampionArenaGambleLoseAll = 104,
EventMiniGameCe002PlayCheck = 105,
EventMiniGameNKSPlayCheck = 106,
EventSnowfallOasisDailyRewardCheck = 107,
EventMiniGameCe003RewardCheck = 108,
EventTowerDefensePlayCheck = 109,
EventPlaySodaPlayCheck = 110,
EventIslandAdventureFishingPlayCheck = 111,
MiniGameDDCompleteDive = 112,
MiniGameDDCompleteSushi = 113,
MiniGameDDTotalGold = 114,
MiniGameDDSushiPreTurnover = 115,
MiniGameDDTotalFish = 116,
MiniGameDDPerUnderwaterEncounter = 117,
MiniGameDDUnlockEmployeeCount = 118,
MiniGameDDUnlockNikkeCount = 119,
MiniGameDDGunLevel = 120,
MiniGameDDIDiverLevel = 121,
MiniGameDDUnlockSushiCount = 122,
MiniGameDDSushiLevel = 123,
MiniGameDDSushiCookScore = 124,
MiniGameDDSushiPreTurnoverTotalMax = 125,
MiniGameDDSushiLevelTotalMax = 126,
MiniGameDDAllAchievement = 127,
ComebackPollComplete = 128,
AliceAccessAttractiveScenario = 129,
AliceEquipCollectionItemLevel = 130,
AliceEquipCollectionItemSR = 131,
AliceEquipItemOverload = 132,
AliceSkill1Level = 133,
AliceSkillBurstLevel = 134,
InterceptNormalClearWithCondition = 135,
InterceptSpecialClearWithCondition = 136,
SimulationRoomClearCount1Only = 137,
TacticAcademyFinish9_4 = 138,
EventMiniGameCe004RewardCheck = 139,
EventMVGPlayCheck = 140,
EventDDRRewardCheck = 141
}
} }

View File

@@ -1,4 +1,4 @@
namespace EpinelPS.StaticInfo namespace EpinelPS.Data
{ {
public class MainQuestCompletionRecord public class MainQuestCompletionRecord
{ {
@@ -749,4 +749,15 @@
{ {
public List<MessengerMsgConditionRecord> records = []; public List<MessengerMsgConditionRecord> records = [];
} }
public class ScenarioRewardRecord
{
public int id;
public string condition_id = "";
public string condition_type = "";
public int reward_id;
}
public class ScenarioRewardTable
{
public List<ScenarioRewardRecord> records = [];
}
} }

View File

@@ -0,0 +1,149 @@
namespace EpinelPS.Data
{
public enum TriggerType
{
None = 0,
UserLevel = 1,
CampaignClear = 2,
ChapterClear = 3,
CampaignStart = 4,
TowerAllStart = 5,
TowerBasicClear = 6,
CharacterLevel = 7,
CharacterGrade = 8,
CharacterCore = 9,
CharacterAttractiveLevel = 10,
MainShopBuy = 11,
ShopGuildBuy = 12,
GachaCharacter = 13,
OutpostBattleReward = 14,
OutpostFastBattleReward = 15,
PointRewardDaily = 16,
PointRewardWeekly = 17,
ObtainCharacter = 18,
OutpostBuilding = 19,
SendFriendShipPoint = 20,
SendDispatch = 21,
MainQuestClear = 22,
ObtainJukeboxTheme = 23,
SubQuestClear = 24,
CampaignGroupClear = 25,
NpcTalk = 26,
TowerElysionClear = 27,
TowerMissilisClear = 28,
TowerTetraClear = 29,
TowerOverspecClear = 30,
AchieveRanking1st = 31,
AchieveRanking5th = 32,
AchieveRanking10th = 33,
EventPoint = 34,
HardChapterClear = 35,
ObtainCharacterSSR = 36,
GachaCompany = 37,
ObtainCharacterNew = 38,
WinArena = 39,
SpecialArenaTier = 40,
PointRewardAchievement = 41,
ObtainCharacterPilgrim = 42,
ShopDisassembleBuy = 43,
CharacterCounsel = 44,
CharacterAttractivePresent = 45,
ObtainEquipItemT3T4 = 46,
ObtainEquipItemT5T6 = 47,
ObtainEquipItemT7T8 = 48,
ObtainEquipItemT9 = 49,
PointRewardEvent = 50,
MissionClearEvent = 51,
ObtainMemorialItem = 52,
LostSectorClear = 53,
ObtainHarmonyCube = 54,
HarmonyCubeLevel = 55,
CooperationEventClear = 56,
SynchroDeviceSlot = 57,
ObtainEquipItemALL = 58,
EquipItemLevel = 59,
CharacterSkillLevel = 60,
PickupGachaCharacter = 61,
ObtainSilverMileage = 62,
ObtainGoldMileage = 63,
SendDispatchGrade = 64,
OutpostBattleBoxLevel = 65,
GetFriendShipPoint = 66,
MessageClear = 67,
RecycleResearchLevel = 68,
GachaPremium = 69,
CharacterLevelUpCount = 70,
CharacterGradeUpCount = 71,
CharacterLevelMax = 72,
CharacterGradeMax = 73,
HarmonyCubeLevelMax = 74,
CharacterSkillLevelMax = 75,
CharacterAttractiveLevelMax = 76,
EquipItemLevelMax = 77,
ObtainEquipItemT2 = 78,
FieldObjectCollection = 79,
SimulationRoomStart = 80,
InterceptStart = 81,
EquipItemLevelCount = 82,
SimulationRoomClear = 83,
InterceptClear = 84,
DailyEventClear = 85,
EventStageClear = 86,
ObtainEventCurrencyMaterialMiraclesnow = 87,
EventDungeonStageClear = 88,
EventSortOutClear = 89,
EventSortOutPointMax = 90,
EquipItemLevelUpCount = 91,
CharacterSkillLevelUpCount = 92,
FirstPaidGacha_Legecy = 93,
ObtainCharacterCostume = 94,
SyncroDeviceLevelMax = 95,
ObtainEventCurrencyMaterial = 96,
SimulationRoomClearWithoutCondition = 97,
EventTextAdventureClear = 98,
RookieArenaPlayCount = 99,
EventDicePlayCount = 100,
EventBBQTycoonDailyRewardCheck = 101,
EventBBQTycoonHighScore = 102,
ChampionArenaGambleWinAll = 103,
ChampionArenaGambleLoseAll = 104,
EventMiniGameCe002PlayCheck = 105,
EventMiniGameNKSPlayCheck = 106,
EventSnowfallOasisDailyRewardCheck = 107,
EventMiniGameCe003RewardCheck = 108,
EventTowerDefensePlayCheck = 109,
EventPlaySodaPlayCheck = 110,
EventIslandAdventureFishingPlayCheck = 111,
MiniGameDDCompleteDive = 112,
MiniGameDDCompleteSushi = 113,
MiniGameDDTotalGold = 114,
MiniGameDDSushiPreTurnover = 115,
MiniGameDDTotalFish = 116,
MiniGameDDPerUnderwaterEncounter = 117,
MiniGameDDUnlockEmployeeCount = 118,
MiniGameDDUnlockNikkeCount = 119,
MiniGameDDGunLevel = 120,
MiniGameDDIDiverLevel = 121,
MiniGameDDUnlockSushiCount = 122,
MiniGameDDSushiLevel = 123,
MiniGameDDSushiCookScore = 124,
MiniGameDDSushiPreTurnoverTotalMax = 125,
MiniGameDDSushiLevelTotalMax = 126,
MiniGameDDAllAchievement = 127,
ComebackPollComplete = 128,
AliceAccessAttractiveScenario = 129,
AliceEquipCollectionItemLevel = 130,
AliceEquipCollectionItemSR = 131,
AliceEquipItemOverload = 132,
AliceSkill1Level = 133,
AliceSkillBurstLevel = 134,
InterceptNormalClearWithCondition = 135,
InterceptSpecialClearWithCondition = 136,
SimulationRoomClearCount1Only = 137,
TacticAcademyFinish9_4 = 138,
EventMiniGameCe004RewardCheck = 139,
EventMVGPlayCheck = 140,
EventDDRRewardCheck = 141
}
}

View File

@@ -1,5 +1,5 @@
using EpinelPS.LobbyServer; using EpinelPS.LobbyServer;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
using Newtonsoft.Json; using Newtonsoft.Json;
using Paseto.Builder; using Paseto.Builder;

View File

@@ -1,6 +1,6 @@
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; // Ensure this namespace is included using EpinelPS.Data; // Ensure this namespace is included
namespace EpinelPS.LobbyServer.Archive namespace EpinelPS.LobbyServer.Archive
{ {

View File

@@ -1,5 +1,5 @@
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; using EpinelPS.Data;
namespace EpinelPS.LobbyServer.Archive namespace EpinelPS.LobbyServer.Archive
{ {

View File

@@ -1,5 +1,5 @@
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; // Ensure this namespace is included using EpinelPS.Data; // Ensure this namespace is included
namespace EpinelPS.LobbyServer.Archive namespace EpinelPS.LobbyServer.Archive

View File

@@ -1,5 +1,5 @@
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; using EpinelPS.Data;
namespace EpinelPS.LobbyServer.Archive namespace EpinelPS.LobbyServer.Archive
{ {
[PacketPath("/archive/scenario/getresettable")] [PacketPath("/archive/scenario/getresettable")]

View File

@@ -1,5 +1,5 @@
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; using EpinelPS.Data;
namespace EpinelPS.LobbyServer.Archive namespace EpinelPS.LobbyServer.Archive
{ {

View File

@@ -1,5 +1,5 @@
using EpinelPS.LobbyServer.Stage; using EpinelPS.LobbyServer.Stage;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Campaign namespace EpinelPS.LobbyServer.Campaign

View File

@@ -1,6 +1,6 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.LobbyServer.Stage; using EpinelPS.LobbyServer.Stage;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Campaign namespace EpinelPS.LobbyServer.Campaign

View File

@@ -1,6 +1,6 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.LobbyServer.Stage; using EpinelPS.LobbyServer.Stage;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Campaign namespace EpinelPS.LobbyServer.Campaign

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Campaign namespace EpinelPS.LobbyServer.Campaign

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Character namespace EpinelPS.LobbyServer.Character

View File

@@ -1,4 +1,4 @@
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Character namespace EpinelPS.LobbyServer.Character

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Character namespace EpinelPS.LobbyServer.Character

View File

@@ -1,5 +1,5 @@
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Database; using EpinelPS.Database;
namespace EpinelPS.LobbyServer.Character namespace EpinelPS.LobbyServer.Character

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Character namespace EpinelPS.LobbyServer.Character

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Character namespace EpinelPS.LobbyServer.Character

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Character namespace EpinelPS.LobbyServer.Character

View File

@@ -1,6 +1,6 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; using EpinelPS.Data;
namespace EpinelPS.LobbyServer.Character namespace EpinelPS.LobbyServer.Character
{ {

View File

@@ -1,6 +1,6 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; // For GameData access using EpinelPS.Data; // For GameData access
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;

View File

@@ -4,7 +4,7 @@
//NetUserCurrencyData fields Type 9000 and Value 150 //NetUserCurrencyData fields Type 9000 and Value 150
//NetRewardData field Currency = new NetUserCurrencyData copy type and value from response.Currencies new NetUserCurrencyData //NetRewardData field Currency = new NetUserCurrencyData copy type and value from response.Currencies new NetUserCurrencyData
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Gacha namespace EpinelPS.LobbyServer.Gacha

View File

@@ -2,7 +2,7 @@
//but only does 1x pull //but only does 1x pull
//its here only so there is no system error on 1x free gacha event //its here only so there is no system error on 1x free gacha event
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Gacha namespace EpinelPS.LobbyServer.Gacha

View File

@@ -1,5 +1,5 @@
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; using EpinelPS.Data;
namespace EpinelPS.LobbyServer namespace EpinelPS.LobbyServer
{ {

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Inventory namespace EpinelPS.LobbyServer.Inventory

View File

@@ -1,5 +1,5 @@
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; using EpinelPS.Data;
namespace EpinelPS.LobbyServer.LobbyUser namespace EpinelPS.LobbyServer.LobbyUser
{ {

View File

@@ -1,5 +1,5 @@
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; // For GameData access using EpinelPS.Data; // For GameData access
namespace EpinelPS.LobbyServer.LobbyUser namespace EpinelPS.LobbyServer.LobbyUser
{ {

View File

@@ -1,5 +1,5 @@
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; using EpinelPS.Data;
namespace EpinelPS.LobbyServer.LobbyUser namespace EpinelPS.LobbyServer.LobbyUser
{ {
[PacketPath("/user/getwallpaperinventory")] [PacketPath("/user/getwallpaperinventory")]

View File

@@ -1,5 +1,5 @@
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; // For GameData access using EpinelPS.Data; // For GameData access
namespace EpinelPS.LobbyServer.LobbyUser namespace EpinelPS.LobbyServer.LobbyUser
{ {

View File

@@ -12,9 +12,11 @@ namespace EpinelPS.LobbyServer.LobbyUser
var user = GetUser(); var user = GetUser();
user.Nickname = req.Nickname; user.Nickname = req.Nickname;
var response = new ResSetNicknameFree(); var response = new ResSetNicknameFree
response.Result = SetNicknameResult.SetNicknameResultOkay; {
response.Nickname = req.Nickname; Result = SetNicknameResult.SetNicknameResultOkay,
Nickname = req.Nickname
};
JsonDb.Save(); JsonDb.Save();

View File

@@ -12,9 +12,11 @@ namespace EpinelPS.LobbyServer.LobbyUser
var user = GetUser(); var user = GetUser();
user.Nickname = req.Nickname; user.Nickname = req.Nickname;
var response = new ResSetNicknameInTutorial(); var response = new ResSetNicknameInTutorial
response.Result = SetNicknameResult.SetNicknameResultOkay; {
response.Nickname = req.Nickname; Result = SetNicknameResult.SetNicknameResultOkay,
Nickname = req.Nickname
};
JsonDb.Save(); JsonDb.Save();

View File

@@ -1,4 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.LobbyUser namespace EpinelPS.LobbyServer.LobbyUser
@@ -9,21 +10,20 @@ namespace EpinelPS.LobbyServer.LobbyUser
protected override async Task HandleAsync() protected override async Task HandleAsync()
{ {
var req = await ReadData<ReqSetScenarioComplete>(); var req = await ReadData<ReqSetScenarioComplete>();
var user = GetUser();
var response = new ResSetScenarioComplete var response = new ResSetScenarioComplete
{ {
// Mark the story "scenario" as completed.
// TODO: Get rewards by making a database of them from actual server.
Reward = new NetRewardData() Reward = new NetRewardData()
}; };
var user = JsonDb.GetUser(UserId);
if (user == null)
{
throw new Exception("null user in SetScenarioComplete command");
}
user.CompletedScenarios.Add(req.ScenarioId); user.CompletedScenarios.Add(req.ScenarioId);
if (GameData.Instance.ScenarioRewards.TryGetValue(req.ScenarioId, out ScenarioRewardRecord? record))
{
response.Reward = RewardUtils.RegisterRewardsForUser(user, record.reward_id);
}
JsonDb.Save(); JsonDb.Save();
await WriteDataAsync(response); await WriteDataAsync(response);

View File

@@ -11,11 +11,11 @@ namespace EpinelPS.LobbyServer.LobbyUser
var req = await ReadData<ReqSetWallpaper>(); var req = await ReadData<ReqSetWallpaper>();
var response = new ResSetWallpaper(); var response = new ResSetWallpaper();
var user = GetUser(); var user = GetUser();
user.WallpaperList = req.WallpaperList.ToArray(); user.WallpaperList = [.. req.WallpaperList];
user.WallpaperBackground = req.WallpaperBackgroundList.ToArray(); user.WallpaperBackground = [.. req.WallpaperBackgroundList];
user.WallpaperFavoriteList = req.WallpaperFavoriteList.ToArray(); user.WallpaperFavoriteList = [.. req.WallpaperFavoriteList];
user.WallpaperPlaylistList = req.WallpaperPlaylistList.ToArray(); user.WallpaperPlaylistList = [.. req.WallpaperPlaylistList];
user.WallpaperJukeboxList = req.WallpaperJukeboxList.ToArray(); user.WallpaperJukeboxList = [.. req.WallpaperJukeboxList];
JsonDb.Save(); JsonDb.Save();

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.LobbyUser.Tutorial namespace EpinelPS.LobbyServer.LobbyUser.Tutorial

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Messenger namespace EpinelPS.LobbyServer.Messenger
@@ -17,7 +17,7 @@ namespace EpinelPS.LobbyServer.Messenger
var opener = GameData.Instance.Subquests.Where(x => x.Key == req.SubQuestId).First(); var opener = GameData.Instance.Subquests.Where(x => x.Key == req.SubQuestId).First();
var conversation = GameData.Instance.Messages.Where(x => x.Value.conversation_id == opener.Value.end_messenger_conversation_id && x.Value.is_opener).First(); var conversation = GameData.Instance.Messages.Where(x => x.Value.conversation_id == opener.Value.end_messenger_conversation_id && x.Value.is_opener).First();
response.Message = user.CreateMessage(conversation.Value); response.Message = user.CreateMessage(conversation.Value, 1);
JsonDb.Save(); JsonDb.Save();
await WriteDataAsync(response); await WriteDataAsync(response);

View File

@@ -1,5 +1,5 @@
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Database; using EpinelPS.Database;
namespace EpinelPS.LobbyServer.Messenger namespace EpinelPS.LobbyServer.Messenger

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Messenger namespace EpinelPS.LobbyServer.Messenger

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Messenger namespace EpinelPS.LobbyServer.Messenger

View File

@@ -1,5 +1,5 @@
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Database; using EpinelPS.Database;
namespace EpinelPS.LobbyServer.Messenger namespace EpinelPS.LobbyServer.Messenger

View File

@@ -1,4 +1,4 @@
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
using Google.Protobuf; using Google.Protobuf;

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Mission namespace EpinelPS.LobbyServer.Mission

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Mission namespace EpinelPS.LobbyServer.Mission

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Mission namespace EpinelPS.LobbyServer.Mission

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Outpost namespace EpinelPS.LobbyServer.Outpost

View File

@@ -1,5 +1,6 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.Data;
namespace EpinelPS.LobbyServer.Outpost namespace EpinelPS.LobbyServer.Outpost
{ {
@@ -29,7 +30,7 @@ namespace EpinelPS.LobbyServer.Outpost
response.Currencies.Add(new NetUserCurrencyData() { Type = (int)item.Key, Value = item.Value}); response.Currencies.Add(new NetUserCurrencyData() { Type = (int)item.Key, Value = item.Value});
} }
user.AddTrigger(StaticInfo.TriggerType.OutpostFastBattleReward, 1); user.AddTrigger(TriggerType.OutpostFastBattleReward, 1);
JsonDb.Save(); JsonDb.Save();

View File

@@ -1,6 +1,6 @@
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
namespace EpinelPS.LobbyServer.Outpost namespace EpinelPS.LobbyServer.Outpost
{ {
[PacketPath("/outpost/getoutpostdata")] [PacketPath("/outpost/getoutpostdata")]

View File

@@ -1,5 +1,6 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.Data;
namespace EpinelPS.LobbyServer.Msgs.Outpost namespace EpinelPS.LobbyServer.Msgs.Outpost
{ {
@@ -27,7 +28,7 @@ namespace EpinelPS.LobbyServer.Msgs.Outpost
user.BattleTime = DateTime.UtcNow; user.BattleTime = DateTime.UtcNow;
user.AddTrigger(StaticInfo.TriggerType.OutpostBattleReward, 1); user.AddTrigger(TriggerType.OutpostBattleReward, 1);
JsonDb.Save(); JsonDb.Save();

View File

@@ -2,7 +2,7 @@
using System.Globalization; // Ensure this is included using System.Globalization; // Ensure this is included
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Shop namespace EpinelPS.LobbyServer.Shop

View File

@@ -1,6 +1,6 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.LobbyServer.Stage; using EpinelPS.LobbyServer.Stage;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Sidestory namespace EpinelPS.LobbyServer.Sidestory

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Stage namespace EpinelPS.LobbyServer.Stage

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Stage namespace EpinelPS.LobbyServer.Stage

View File

@@ -1,4 +1,4 @@
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.Database; using EpinelPS.Database;

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Subquest namespace EpinelPS.LobbyServer.Subquest

View File

@@ -1,6 +1,6 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.StaticInfo; using EpinelPS.Data;
namespace EpinelPS.LobbyServer.Tower namespace EpinelPS.LobbyServer.Tower
{ {

View File

@@ -1,5 +1,6 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.Utils; using EpinelPS.Utils;
using EpinelPS.Data;
namespace EpinelPS.LobbyServer.Tower namespace EpinelPS.LobbyServer.Tower
{ {
@@ -14,7 +15,7 @@ namespace EpinelPS.LobbyServer.Tower
var response = new ResEnterTower(); var response = new ResEnterTower();
user.AddTrigger(StaticInfo.TriggerType.TowerAllStart, 1); user.AddTrigger(TriggerType.TowerAllStart, 1);
JsonDb.Save(); JsonDb.Save();
await WriteDataAsync(response); await WriteDataAsync(response);

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Trigger namespace EpinelPS.LobbyServer.Trigger

View File

@@ -1,6 +1,6 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.LobbyServer.Stage; using EpinelPS.LobbyServer.Stage;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@@ -1,7 +1,7 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.LobbyServer; using EpinelPS.LobbyServer;
using EpinelPS.LobbyServer.Stage; using EpinelPS.LobbyServer.Stage;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using EpinelPS.Utils; using EpinelPS.Utils;
using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.AspNetCore.Server.Kestrel.Https; using Microsoft.AspNetCore.Server.Kestrel.Https;

View File

@@ -1,4 +1,4 @@
using EpinelPS.StaticInfo; using EpinelPS.Data;
namespace EpinelPS.Utils namespace EpinelPS.Utils
{ {

View File

@@ -1,5 +1,5 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
using Google.Protobuf.WellKnownTypes; using Google.Protobuf.WellKnownTypes;
using System.Collections.Generic; using System.Collections.Generic;
using static Google.Rpc.Context.AttributeContext.Types; using static Google.Rpc.Context.AttributeContext.Types;

View File

@@ -1,13 +1,17 @@
using EpinelPS.Database; using EpinelPS.Database;
using EpinelPS.StaticInfo; using EpinelPS.Data;
namespace EpinelPS.Utils namespace EpinelPS.Utils
{ {
// Calculate rewards for various messages // Calculate rewards for various messages
public class RewardUtils public class RewardUtils
{ {
public static NetRewardData RegisterRewardsForUser(User user, int rewardId)
public static NetRewardData RegisterRewardsForUser(Database.User user, RewardTableRecord rewardData) {
var rewardData = GameData.Instance.GetRewardTableEntry(rewardId) ?? throw new Exception($"unknown reward id {rewardId}");
return RegisterRewardsForUser(user, rewardData);
}
public static NetRewardData RegisterRewardsForUser(User user, RewardTableRecord rewardData)
{ {
NetRewardData ret = new(); NetRewardData ret = new();
ret.PassPoint = new(); ret.PassPoint = new();

View File

@@ -60,6 +60,8 @@ namespace ServerSelector
string launcherCertList = launcherPath + "/intl_service/cacert.pem"; string launcherCertList = launcherPath + "/intl_service/cacert.pem";
string gameCertList = gamePath + "/nikke_Data/Plugins/x86_64/intl_cacert.pem"; string gameCertList = gamePath + "/nikke_Data/Plugins/x86_64/intl_cacert.pem";
if (!File.Exists(gameCertList))
gameCertList = gamePath + "/nikke_Data/Plugins/x86_64/cacert.pem"; // older INTL sdk versions
if (File.Exists(launcherCertList)) if (File.Exists(launcherCertList))
{ {
@@ -163,6 +165,8 @@ namespace ServerSelector
string launcherCertList = launcherPath + "/intl_service/cacert.pem"; string launcherCertList = launcherPath + "/intl_service/cacert.pem";
string gameCertList = gamePath + "/nikke_Data/Plugins/x86_64/intl_cacert.pem"; string gameCertList = gamePath + "/nikke_Data/Plugins/x86_64/intl_cacert.pem";
if (!File.Exists(gameCertList))
gameCertList = gamePath + "/nikke_Data/Plugins/x86_64/cacert.pem"; // older INTL sdk versions
bool supported = true; bool supported = true;
if (OperatingSystem.IsLinux()) if (OperatingSystem.IsLinux())