mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-12 23:14:34 +01:00
Equipment and main quest bug fixes
This commit is contained in:
@@ -100,10 +100,7 @@ namespace nksrv.Database
|
||||
public Dictionary<int, ClearedTutorialData> ClearedTutorialData = [];
|
||||
public NetWallpaperData[] WallpaperList = [];
|
||||
public Dictionary<int, NetUserTeamData> UserTeams = new Dictionary<int, NetUserTeamData>();
|
||||
public Dictionary<int, bool> MainQuestData = new()
|
||||
{
|
||||
{1, false }
|
||||
};
|
||||
public Dictionary<int, bool> MainQuestData = new();
|
||||
public int InfraCoreExp = 0;
|
||||
public int InfraCoreLvl = 1;
|
||||
public UserPointData userPointData = new();
|
||||
@@ -118,16 +115,16 @@ namespace nksrv.Database
|
||||
// Event data
|
||||
public Dictionary<int, EventData> EventInfo = new();
|
||||
|
||||
public void SetQuest(int tid, bool recieved)
|
||||
public void SetQuest(int tid, bool recievedReward)
|
||||
{
|
||||
if (MainQuestData.ContainsKey(tid))
|
||||
{
|
||||
MainQuestData[tid] = recieved;
|
||||
MainQuestData[tid] = recievedReward;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainQuestData.Add(tid, recieved);
|
||||
MainQuestData.Add(tid, recievedReward);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,26 +13,30 @@ namespace nksrv.LobbyServer.Msgs.Inventory
|
||||
|
||||
var response = new ResWearEquipment();
|
||||
|
||||
var pos = NetUtils.GetItemPos(user, req.Isn);
|
||||
|
||||
// unequip old item
|
||||
|
||||
foreach (var item in user.Items.ToArray())
|
||||
{
|
||||
if (item.Csn == req.Csn && item.Position == pos)
|
||||
{
|
||||
item.Csn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in user.Items.ToArray())
|
||||
{
|
||||
if (item.Isn == req.Isn)
|
||||
{
|
||||
// update character id
|
||||
item.Csn = req.Csn;
|
||||
item.Position = NetUtils.GetItemPos(user, item.Isn);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (var item in user.Items.ToArray())
|
||||
{
|
||||
if (item.Csn == req.Csn)
|
||||
{
|
||||
item.Position = pos;
|
||||
response.Items.Add(NetUtils.ToNet(item));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
JsonDb.Save();
|
||||
await WriteDataAsync(response);
|
||||
}
|
||||
|
||||
@@ -13,14 +13,27 @@ namespace nksrv.LobbyServer.Msgs.Inventory
|
||||
|
||||
var response = new ResWearEquipmentList();
|
||||
|
||||
// TODO optimize
|
||||
foreach (var item2 in req.IsnList)
|
||||
{
|
||||
var pos = NetUtils.GetItemPos(user, item2);
|
||||
|
||||
// unequip previous items
|
||||
foreach (var item in user.Items.ToArray())
|
||||
{
|
||||
if (item.Position == pos && item.Csn == req.Csn)
|
||||
{
|
||||
item.Csn = 0;
|
||||
item.Position = 0;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in user.Items.ToArray())
|
||||
{
|
||||
if (item2 == item.Isn)
|
||||
{
|
||||
item.Csn = req.Csn;
|
||||
item.Position = NetUtils.GetItemPos(user, item.Isn);
|
||||
item.Position = pos;
|
||||
response.Items.Add(NetUtils.ToNet(item));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace nksrv.LobbyServer.Msgs.Stage
|
||||
{
|
||||
var quest = StaticDataParser.Instance.GetMainQuestForStageClearCondition(clearedStageId);
|
||||
if (quest != null)
|
||||
user.SetQuest(quest.id, true);
|
||||
user.SetQuest(quest.id, false);
|
||||
|
||||
if (clearedStageId == 6000003)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace nksrv.LobbyServer.Msgs.Trigger
|
||||
var req = await ReadData<ReqFinMainQuest>();
|
||||
var user = GetUser();
|
||||
Console.WriteLine("Complete quest: " + req.Tid);
|
||||
user.SetQuest(req.Tid, true);
|
||||
user.SetQuest(req.Tid, false);
|
||||
|
||||
var completedQuest = StaticDataParser.Instance.GetMainQuestByTableId(req.Tid);
|
||||
if (completedQuest == null) throw new Exception("Quest not found");
|
||||
|
||||
@@ -238,8 +238,6 @@ namespace nksrv.StaticInfo
|
||||
{
|
||||
using var progress = new ProgressBar();
|
||||
|
||||
|
||||
|
||||
questDataRecords = await LoadZip("MainQuestTable.json", progress);
|
||||
stageDataRecords = await LoadZip("CampaignStageTable.json", progress);
|
||||
rewardDataRecords = await LoadZip("RewardTable.json", progress);
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace nksrv.Utils
|
||||
/// </summary>
|
||||
public class ProgressBar : IDisposable, IProgress<double>
|
||||
{
|
||||
private const int blockCount = 10;
|
||||
private const int blockCount = 17;
|
||||
private readonly TimeSpan animationInterval = TimeSpan.FromSeconds(1.0 / 8);
|
||||
private const string animation = @"|/-\";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user