Add all event and favorite item wallpapers

This commit is contained in:
SELEKCJONER
2024-09-15 22:36:41 +02:00
parent 32d329eafa
commit f6ce7d06be
6 changed files with 76 additions and 7 deletions

View File

@@ -28,7 +28,6 @@ namespace EpinelPS.Database
public int Csn = 0;
public int Tid = 0;
public int CostumeId = 0;
public int Level = 1;
public int UltimateLevel = 1;
public int Skill1Lvl = 1;

View File

@@ -45,6 +45,8 @@ namespace EpinelPS.StaticInfo
private Dictionary<int, JukeboxThemeRecord> jukeboxThemeDataRecords;
public Dictionary<int, GachaType> gachaTypes = new Dictionary<int, GachaType>(); // Fixed initialization
public Dictionary<int, EventManager> eventManagers = new Dictionary<int, EventManager>();
public Dictionary<int, LiveWallpaperRecord> lwptablemgrs = new Dictionary<int, LiveWallpaperRecord>(); // Fixed initialization
public byte[] Sha256Hash;
@@ -387,7 +389,13 @@ namespace EpinelPS.StaticInfo
eventManagers.Add(obj.id, obj); // Use obj.id as the key and obj (the EventManager) as the value
}
var lwptable = await LoadZip<LiveWallpaperTable>("LiveWallpaperTable.json", progress);
// Add the records to the dictionary
foreach (var obj in lwptable.records)
{
lwptablemgrs.Add(obj.id, obj); // Use obj.id as the key and obj (the LiveWallpaperRecord) as the value
}
// Load Jukebox data
await LoadJukeboxListData(progress);
await LoadJukeboxThemeData(progress);

View File

@@ -135,6 +135,7 @@
public string corporation;
public string grade_core_id;
public string name_code;
public string grow_grade;
}
public class CharacterTable
{
@@ -271,5 +272,15 @@
{
public List<EventManager> records;
}
public class LiveWallpaperRecord
{
public int id;
public string livewallpaper_type;
}
public class LiveWallpaperTable
{
public List<LiveWallpaperRecord> records;
}
}

View File

@@ -0,0 +1,43 @@
using EpinelPS.Database;
using EpinelPS.Utils;
using EpinelPS.StaticInfo;
//this file is work in progress and currently its fucked
namespace EpinelPS.LobbyServer.Msgs.Character
{
[PacketPath("/character/coreupgrade")]
public class CoreUpgrade : LobbyMsgHandler
{
protected override async Task HandleAsync()
{
// Read the incoming request that contains the current CSN and ISN
var req = await ReadData<ReqCharacterCoreUpgrade>(); // Contains csn and isn (read-only)
var response = new ResCharacterCoreUpgrade();
// Get all character data from the game's character table
var fullchardata = GameData.Instance.characterTable.Values.ToList();
// Find the element with the current csn from the request
var currentCharacter = fullchardata.FirstOrDefault(c => c.id == req.Csn);
if (currentCharacter != null)
{
// Find a new CSN based on the `name_code` of the current character and `grade_core_id + 1`
var newCharacter = fullchardata.FirstOrDefault(c => c.name_code == currentCharacter.name_code && c.grade_core_id == currentCharacter.grade_core_id + 1);
if (newCharacter != null)
{
// Update the characterData with the new CSN
var characterData = new NetUserCharacterDefaultData
{
Csn = newCharacter.id
// Add any other required data here
};
}
}
// Send the response back to the client
await WriteDataAsync(response);
}
}
}

View File

@@ -25,10 +25,9 @@ namespace EpinelPS.LobbyServer.Msgs.Gacha
var entireallCharacterData = GameData.Instance.characterTable.Values.ToList();
// Remove the .Values part since it's already a list.
var allCharacterData = entireallCharacterData
.GroupBy(c => c.name_code) // Group by name_code to treat same name_code as one character
.SelectMany(g => g.Where(c => c.grade_core_id == "11" || c.grade_core_id == "103" || c.grade_core_id == "201" || c.name_code == "3999")) // Always add characters with grade_core_id == 11 and 103
.ToList();
// Group by name_code to treat same name_code as one character
// Always add characters with grade_core_id == 11 and 103
var allCharacterData = entireallCharacterData.GroupBy(c => c.name_code).SelectMany(g => g.Where(c => c.grade_core_id == "11" || c.grade_core_id == "103" || c.grade_core_id == "201" || c.name_code == "3999")).ToList();
// Separate characters by rarity categories
var rCharacters = allCharacterData.Where(c => c.original_rare == "R").ToList();

View File

@@ -1,5 +1,5 @@
using EpinelPS.Utils;
using EpinelPS.StaticInfo;
namespace EpinelPS.LobbyServer.Msgs.User
{
[PacketPath("/user/getwallpaperinventory")]
@@ -9,8 +9,17 @@ namespace EpinelPS.LobbyServer.Msgs.User
{
var req = await ReadData<ReqGetWallpaperInventory>();
// Prepare the response
var r = new ResGetWallpaperInventory();
// Fetch all the wallpaper IDs from the LiveWallpaperTable,
// excluding records where livewallpaper_type is "SkillCutScene"
var wallpaperIds = GameData.Instance.lwptablemgrs.Where(w => w.Value.livewallpaper_type != "SkillCutScene").Select(w => w.Key).ToList();
// Add the filtered wallpaper IDs to the LivewallpaperIds field
r.LivewallpaperIds.AddRange(wallpaperIds);
// Send the response back
await WriteDataAsync(r);
}
}