mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-12 15:04:36 +01:00
improve limit breaks
This commit is contained in:
@@ -133,9 +133,9 @@
|
||||
public int piece_id;
|
||||
public string original_rare;
|
||||
public string corporation;
|
||||
public string grade_core_id;
|
||||
public string name_code;
|
||||
public string grow_grade;
|
||||
public int grade_core_id;
|
||||
public int name_code;
|
||||
public int grow_grade;
|
||||
}
|
||||
public class CharacterTable
|
||||
{
|
||||
|
||||
69
EpinelPS/LobbyServer/Msgs/Character/DoLimitBreak.cs
Normal file
69
EpinelPS/LobbyServer/Msgs/Character/DoLimitBreak.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using EpinelPS.Database;
|
||||
using EpinelPS.StaticInfo;
|
||||
using EpinelPS.Utils;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Msgs.Character
|
||||
{
|
||||
[PacketPath("/character/upgrade")]
|
||||
public class DoLimitBreak : LobbyMsgHandler
|
||||
{
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
// Read the incoming request that contains the current CSN and ISN
|
||||
var req = await ReadData<ReqCharacterUpgrade>(); // Contains csn and isn (read-only)
|
||||
var response = new ResCharacterUpgrade();
|
||||
var user = GetUser();
|
||||
|
||||
// Get all character data from the game's character table
|
||||
var fullchardata = GameData.Instance.characterTable.Values.ToList();
|
||||
|
||||
var targetCharacter = user.GetCharacterBySerialNumber(req.Csn);
|
||||
|
||||
// Find the element with the current csn from the request
|
||||
var currentCharacter = fullchardata.FirstOrDefault(c => c.id == targetCharacter.Tid);
|
||||
|
||||
if (currentCharacter != null && targetCharacter != null)
|
||||
{
|
||||
if (currentCharacter.grade_core_id == 103 || currentCharacter.grade_core_id == 11 || currentCharacter.grade_core_id == 201)
|
||||
{
|
||||
Console.WriteLine("cannot limit break any further!");
|
||||
await WriteDataAsync(response);
|
||||
return;
|
||||
}
|
||||
|
||||
// Find a new CSN based on the `name_code` of the current character and `grade_core_id + 1`
|
||||
var newCharacter = fullchardata.FirstOrDefault(c => c.grade_core_id == currentCharacter.grade_core_id + 1);
|
||||
|
||||
if (newCharacter != null)
|
||||
{
|
||||
targetCharacter.Grade++;
|
||||
targetCharacter.Tid = newCharacter.id;
|
||||
|
||||
response.Character = new NetUserCharacterDefaultData()
|
||||
{
|
||||
Csn = req.Csn,
|
||||
CostumeId = targetCharacter.CostumeId,
|
||||
Grade = targetCharacter.Grade,
|
||||
Level = user.GetSynchroLevel(),
|
||||
Skill1Lv = targetCharacter.Skill1Lvl,
|
||||
Skill2Lv = targetCharacter.Skill2Lvl,
|
||||
Tid = targetCharacter.Tid,
|
||||
UltiSkillLv = targetCharacter.UltimateLevel
|
||||
};
|
||||
|
||||
// TODO: remove spare body
|
||||
foreach (var item in user.Items)
|
||||
{
|
||||
response.Items.Add(NetUtils.ToNet(item));
|
||||
}
|
||||
|
||||
JsonDb.Save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Send the response back to the client
|
||||
await WriteDataAsync(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,10 @@ namespace EpinelPS.LobbyServer.Msgs.Character
|
||||
|
||||
var response = new ResGetCharacterData();
|
||||
// TODO: When Squad view opens in the game, or this request is sent, all character levels reset to 1 as well as costume IDs
|
||||
//foreach (var item in user.Characters)
|
||||
//{
|
||||
// response.Character.Add(new NetUserCharacterData() { Default = new() { Csn = item.Csn, Skill1Lv = item.Skill1Lvl, Skill2Lv = item.Skill2Lvl, CostumeId = item.CostumeId, Level = user.GetCharacterLevel(item.Csn, item.Level), Grade = item.Grade, Tid = item.Tid, UltiSkillLv = item.UltimateLevel }, IsSynchro = user.GetSynchro(item.Csn) });
|
||||
//}
|
||||
foreach (var item in user.Characters)
|
||||
{
|
||||
response.Character.Add(new NetUserCharacterData() { Default = new() { Csn = item.Csn, Skill1Lv = item.Skill1Lvl, Skill2Lv = item.Skill2Lvl, CostumeId = item.CostumeId, Level = user.GetCharacterLevel(item.Csn, item.Level), Grade = item.Grade, Tid = item.Tid, UltiSkillLv = item.UltimateLevel }, IsSynchro = user.GetSynchro(item.Csn) });
|
||||
}
|
||||
|
||||
var highestLevelCharacters = user.Characters.OrderByDescending(x => x.Level).Take(5).ToList();
|
||||
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace EpinelPS.LobbyServer.Msgs.Gacha
|
||||
var entireallCharacterData = GameData.Instance.characterTable.Values.ToList();
|
||||
// Remove the .Values part since it's already a list.
|
||||
// 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();
|
||||
// Always add characters with grade_core_id == 1 and 101
|
||||
var allCharacterData = entireallCharacterData.GroupBy(c => c.name_code).SelectMany(g => g.Where(c => c.grade_core_id == 1 || c.grade_core_id == 101 || 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();
|
||||
var rCharacters = allCharacterData.Where(c => c.original_rare == "R" ).ToList();
|
||||
var srCharacters = allCharacterData.Where(c => c.original_rare == "SR").ToList();
|
||||
|
||||
// Separate Pilgrim SSRs and non-Pilgrim SSRs
|
||||
@@ -61,7 +61,7 @@ namespace EpinelPS.LobbyServer.Msgs.Gacha
|
||||
{
|
||||
if (user.Characters.Any(c => c.Tid == characterData.id))
|
||||
{
|
||||
user.Items.Add(new Database.ItemData()
|
||||
user.Items.Add(new ItemData()
|
||||
{
|
||||
ItemType = characterData.piece_id, // Assuming item id corresponds to character id
|
||||
Csn = 0,
|
||||
@@ -117,10 +117,7 @@ namespace EpinelPS.LobbyServer.Msgs.Gacha
|
||||
Tid = characterId,
|
||||
UltiSkillLv = 1
|
||||
});
|
||||
}
|
||||
|
||||
if (!user.HasCharacter(characterId))
|
||||
{
|
||||
user.Characters.Add(new Database.Character()
|
||||
{
|
||||
CostumeId = 0,
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace EpinelPS
|
||||
// Group characters by name_code and always add those with grade_core_id == 11, 103, and include grade_core_id == 201
|
||||
var allCharacters = GameData.Instance.characterTable.Values
|
||||
.GroupBy(c => c.name_code) // Group by name_code to treat same name_code as one character 3999 = marian
|
||||
.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
|
||||
.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();
|
||||
|
||||
foreach (var character in allCharacters)
|
||||
|
||||
Reference in New Issue
Block a user