mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-16 08:54:47 +01:00
implement campaign lost relic
This commit is contained in:
@@ -113,9 +113,12 @@ namespace EpinelPS.Database
|
||||
public List<int> CompletedTacticAcademyLessons = [];
|
||||
public List<int> CompletedSideStoryStages = new();
|
||||
|
||||
public List<int> Memorial = new();
|
||||
public List<int> JukeboxBgm = new();
|
||||
|
||||
// Event data
|
||||
public Dictionary<int, EventData> EventInfo = new();
|
||||
|
||||
|
||||
public void SetQuest(int tid, bool recievedReward)
|
||||
{
|
||||
if (MainQuestData.ContainsKey(tid))
|
||||
|
||||
@@ -39,6 +39,8 @@ namespace EpinelPS.StaticInfo
|
||||
private Dictionary<int, CharacterLevelData> LevelData = [];
|
||||
private Dictionary<int, TacticAcademyLessonRecord> TacticAcademyLessons = [];
|
||||
public Dictionary<int, int> SidestoryRewardTable = [];
|
||||
public Dictionary<string, int> PositionReward = new Dictionary<string, int>();
|
||||
public Dictionary<int, FieldItemRecord> FieldItems = [];
|
||||
|
||||
public byte[] Sha256Hash;
|
||||
public int Size;
|
||||
@@ -241,8 +243,9 @@ namespace EpinelPS.StaticInfo
|
||||
|
||||
return records;
|
||||
}
|
||||
int totalFiles = 12;
|
||||
int totalFiles = 14;
|
||||
int currentFile = 0;
|
||||
|
||||
public async Task Parse()
|
||||
{
|
||||
using var progress = new ProgressBar();
|
||||
@@ -342,6 +345,32 @@ namespace EpinelPS.StaticInfo
|
||||
SidestoryRewardTable.Add(id2, reward);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (ZipEntry item in MainZip)
|
||||
{
|
||||
if (item.Name.StartsWith("CampaignMap/"))
|
||||
{
|
||||
var x = await LoadZip(item.Name, progress);
|
||||
|
||||
var items = x[0]["ItemSpawner"];
|
||||
foreach (var item2 in items)
|
||||
{
|
||||
var id = item2["positionId"].ToObject<string>();
|
||||
var reward = item2["itemId"].ToObject<int>();
|
||||
|
||||
if (!PositionReward.ContainsKey(id))
|
||||
PositionReward.Add(id, reward);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var fieldItems = await LoadZip<FieldItemTable>("FieldItemTable.json", progress);
|
||||
foreach (var obj in fieldItems.records)
|
||||
{
|
||||
FieldItems.Add(obj.id, obj);
|
||||
}
|
||||
}
|
||||
|
||||
public MainQuestCompletionRecord? GetMainQuestForStageClearCondition(int stage)
|
||||
|
||||
@@ -134,4 +134,17 @@
|
||||
{
|
||||
public List<ItemEquipRecord> records;
|
||||
}
|
||||
|
||||
public class FieldItemRecord
|
||||
{
|
||||
public int id;
|
||||
public string item_type;
|
||||
public int type_value;
|
||||
public bool is_final_reward;
|
||||
public string difficulty;
|
||||
}
|
||||
public class FieldItemTable
|
||||
{
|
||||
public List<FieldItemRecord> records;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using EpinelPS.StaticInfo;
|
||||
using EpinelPS.LobbyServer.Msgs.Stage;
|
||||
using EpinelPS.StaticInfo;
|
||||
using EpinelPS.Utils;
|
||||
using Swan.Logging;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Msgs.Campaign
|
||||
{
|
||||
@@ -18,10 +20,27 @@ namespace EpinelPS.LobbyServer.Msgs.Campaign
|
||||
var key = chapter + "_" + mod;
|
||||
var field = user.FieldInfoNew[key];
|
||||
|
||||
// TODO
|
||||
response.Reward = new();
|
||||
|
||||
foreach (var item in field.CompletedObjects)
|
||||
{
|
||||
if (item.PositionId == req.FieldObject.PositionId)
|
||||
{
|
||||
Logger.Warn("attempted to collect campaign field object twice!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Register and return reward
|
||||
|
||||
if (!GameData.Instance.PositionReward.ContainsKey(req.FieldObject.PositionId)) throw new Exception("bad position id");
|
||||
var fieldReward = GameData.Instance.PositionReward[req.FieldObject.PositionId];
|
||||
var positionReward = GameData.Instance.FieldItems[fieldReward];
|
||||
var reward = GameData.Instance.GetRewardTableEntry(positionReward.type_value);
|
||||
if (reward == null) throw new Exception("failed to get reward");
|
||||
response.Reward = ClearStage.RegisterRewardsForUser(user, reward);
|
||||
|
||||
// Hide it from the field
|
||||
field.CompletedObjects.Add(new NetFieldObject() { PositionId = req.FieldObject.PositionId, Type = req.FieldObject.Type});
|
||||
|
||||
await WriteDataAsync(response);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,14 @@ namespace EpinelPS.LobbyServer.Msgs.Outpost
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
var req = await ReadData<ReqGetMemoryList>();
|
||||
var user = GetUser();
|
||||
|
||||
var response = new ResGetMemoryList();
|
||||
// TODO
|
||||
|
||||
response.MemoryList.AddRange(user.Memorial);
|
||||
|
||||
// TODO rewards
|
||||
|
||||
await WriteDataAsync(response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using EpinelPS.StaticInfo;
|
||||
using EpinelPS.Utils;
|
||||
using Swan.Logging;
|
||||
using System.Linq;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Msgs.Stage
|
||||
{
|
||||
@@ -213,6 +214,22 @@ namespace EpinelPS.LobbyServer.Msgs.Stage
|
||||
Isn = id
|
||||
});
|
||||
}
|
||||
else if (item.reward_type == "Memorial")
|
||||
{
|
||||
if (!user.Memorial.Contains(item.reward_id))
|
||||
{
|
||||
ret.Memorial.Add(item.reward_id);
|
||||
user.Memorial.Add(item.reward_id);
|
||||
}
|
||||
}
|
||||
else if (item.reward_type == "Bgm")
|
||||
{
|
||||
if (!user.JukeboxBgm.Contains(item.reward_id))
|
||||
{
|
||||
ret.JukeboxBgm.Add(item.reward_id);
|
||||
user.JukeboxBgm.Add(item.reward_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Warn("TODO: Reward type " + item.reward_type);
|
||||
|
||||
@@ -31,7 +31,7 @@ To skip stages, a basic command line interface is implemented.
|
||||
|
||||
|
||||
## TODO:
|
||||
- [X] Normal campaign
|
||||
- [X] Campaign (Normal, Hard, Lost items, Rewards)
|
||||
- [X] Lobby
|
||||
- [X] Save team info
|
||||
- [X] Profile UI
|
||||
@@ -41,8 +41,7 @@ To skip stages, a basic command line interface is implemented.
|
||||
- [X] Side story
|
||||
- [X] Archives
|
||||
- [ ] Skill level up
|
||||
- [ ] Outpost jukebox / relics saving
|
||||
- [ ] Field obtain object
|
||||
- [ ] Outpost jukebox
|
||||
- [ ] Admin panel
|
||||
- [ ] Test hard stage support
|
||||
- [ ] Event system
|
||||
|
||||
Reference in New Issue
Block a user