mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-12 15:04:36 +01:00
Add support for user titles
This commit is contained in:
@@ -148,6 +148,7 @@ namespace EpinelPS.Database
|
||||
public bool IsAdmin = false;
|
||||
public bool sickpulls = false;
|
||||
public bool IsBanned = false;
|
||||
public int TitleId = 1;
|
||||
public DateTime BanStart;
|
||||
public DateTime BanEnd;
|
||||
public int BanId = 0;
|
||||
|
||||
@@ -52,6 +52,7 @@ namespace EpinelPS.StaticInfo
|
||||
public Dictionary<int, ArchiveEventStoryRecord> archiveEventStoryRecords = new Dictionary<int, ArchiveEventStoryRecord>();
|
||||
public Dictionary<int, ArchiveEventQuestRecord> archiveEventQuestRecords = new Dictionary<int, ArchiveEventQuestRecord>();
|
||||
public Dictionary<int, ArchiveEventDungeonStageRecord> archiveEventDungeonStageRecords = new Dictionary<int, ArchiveEventDungeonStageRecord>();
|
||||
public Dictionary<int, UserTitleRecord> userTitleRecords = new Dictionary<int, UserTitleRecord>();
|
||||
|
||||
|
||||
|
||||
@@ -423,6 +424,12 @@ namespace EpinelPS.StaticInfo
|
||||
{
|
||||
archiveEventDungeonStageRecords.Add(obj.id, obj);
|
||||
}
|
||||
|
||||
var userTitleTable = await LoadZip<UserTitleTable>("UserTitleTable.json", progress);
|
||||
foreach (var obj in userTitleTable.records)
|
||||
{
|
||||
userTitleRecords.Add(obj.id, obj);
|
||||
}
|
||||
|
||||
// Load and parse ArchiveEventStoryTable.json
|
||||
var archiveEventStoryTable = await LoadZip<ArchiveEventStoryTable>("ArchiveEventStoryTable.json", progress);
|
||||
|
||||
@@ -389,5 +389,21 @@
|
||||
{
|
||||
public List<ArchiveEventDungeonStageRecord> records;
|
||||
}
|
||||
public class UserTitleRecord
|
||||
{
|
||||
public int id;
|
||||
public int order;
|
||||
public string user_title_production_type = "";
|
||||
public int user_title_production_id;
|
||||
public string icon_resource_id = "";
|
||||
public string name_locale_key = "";
|
||||
public string desc_locale_key = "";
|
||||
public int reward_id;
|
||||
public bool not_acquired_is_visible;
|
||||
}
|
||||
|
||||
public class UserTitleTable
|
||||
{
|
||||
public List<UserTitleRecord> records;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +138,7 @@ namespace EpinelPS.LobbyServer
|
||||
Frame = user.ProfileFrame,
|
||||
Icon = user.ProfileIconId,
|
||||
IconPrism = user.ProfileIconIsPrism,
|
||||
UserTitleId = user.TitleId,
|
||||
Nickname = user.Nickname,
|
||||
Usn = (long)user.ID,
|
||||
LastActionAt = DateTimeOffset.UtcNow.Ticks,
|
||||
|
||||
@@ -62,7 +62,8 @@ namespace EpinelPS.LobbyServer.Msgs.Event
|
||||
EventSystemType = 1
|
||||
},
|
||||
JoinAt = 0
|
||||
});
|
||||
});
|
||||
// cinderella banner
|
||||
response.EventWithJoinData.Add(new NetEventWithJoinData()
|
||||
{
|
||||
EventData = new NetEventData()
|
||||
@@ -75,6 +76,20 @@ namespace EpinelPS.LobbyServer.Msgs.Event
|
||||
EventDisableDate = DateTime.Now.AddDays(20).Ticks
|
||||
},
|
||||
JoinAt = 0
|
||||
});
|
||||
//cinderella free pull
|
||||
response.EventWithJoinData.Add(new NetEventWithJoinData()
|
||||
{
|
||||
EventData = new NetEventData()
|
||||
{
|
||||
Id = 80004,
|
||||
EventSystemType = 21,
|
||||
EventVisibleDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(7)).Ticks,
|
||||
EventStartDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(1)).Ticks,
|
||||
EventEndDate = DateTime.Now.AddDays(20).Ticks,
|
||||
EventDisableDate = DateTime.Now.AddDays(20).Ticks
|
||||
},
|
||||
JoinAt = 0
|
||||
});
|
||||
|
||||
await WriteDataAsync(response);
|
||||
|
||||
@@ -215,6 +215,16 @@ namespace EpinelPS.LobbyServer.Msgs.Event
|
||||
EventStartDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(1)).Ticks,
|
||||
EventEndDate = DateTime.Now.AddDays(20).Ticks,
|
||||
EventDisableDate = DateTime.Now.AddDays(20).Ticks,
|
||||
});
|
||||
// free pull for cinderella
|
||||
response.EventList.Add(new NetEventData()
|
||||
{
|
||||
Id = 80004,
|
||||
EventSystemType = 21,
|
||||
EventVisibleDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(7)).Ticks,
|
||||
EventStartDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(1)).Ticks,
|
||||
EventEndDate = DateTime.Now.AddDays(20).Ticks,
|
||||
EventDisableDate = DateTime.Now.AddDays(20).Ticks,
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using EpinelPS.Utils;
|
||||
using EpinelPS.StaticInfo; // For GameData access
|
||||
|
||||
namespace EpinelPS.LobbyServer.Msgs.User
|
||||
{
|
||||
@@ -8,9 +9,15 @@ namespace EpinelPS.LobbyServer.Msgs.User
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
var req = await ReadData<ReqGetUserTitleList>();
|
||||
|
||||
var r = new ResGetUserTitleList();
|
||||
r.UserTitleList.Add(new NetUserTitle() { UserTitleId = 1 });
|
||||
|
||||
// Access GameData and get all UserTitle IDs
|
||||
var userTitleRecords = GameData.Instance.userTitleRecords;
|
||||
|
||||
foreach (var titleId in userTitleRecords.Keys)
|
||||
{
|
||||
r.UserTitleList.Add(new NetUserTitle() { UserTitleId = titleId });
|
||||
}
|
||||
|
||||
await WriteDataAsync(r);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using EpinelPS.Utils;
|
||||
|
||||
using EpinelPS.Database;
|
||||
namespace EpinelPS.LobbyServer.Msgs.User
|
||||
{
|
||||
[PacketPath("/lobby/usertitle/set")]
|
||||
@@ -8,7 +8,9 @@ namespace EpinelPS.LobbyServer.Msgs.User
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
var req = await ReadData<ReqSetUserTitle>();
|
||||
|
||||
var user = GetUser();
|
||||
user.TitleId = req.UserTitleId;
|
||||
JsonDb.Save();
|
||||
var response = new ResSetUserTitle();
|
||||
|
||||
await WriteDataAsync(response);
|
||||
|
||||
Reference in New Issue
Block a user