Files
EpinelPS/EpinelPS/LobbyServer/Inventory/AllClearEquipment.cs
fxz2018 206fa429ee feat: implement equipment awakening system with interception updates (#57)
- Implement comprehensive equipment awakening system with multiple new endpoints:
  * Awakening.cs: Handle equipment awakening process
  * ChangeOption.cs: Change equipment awakening options
  * GetAwakeningDetail.cs: Get detailed awakening information
  * LockOption.cs: Lock awakening options (with Disposable option)
  * ResetOption.cs: Reset awakening options
  * UpgradeOption.cs: Upgrade awakening options

- Enhance interception system:
  * Simplify GetInterceptData to use fixed normal group ID (1)
  * Update InterceptionHelper to support type 1 in addition to type 0
  * Modify GetInterceptData to use simplified special ID calculation

- Implement new inventory system features:
  * Replace ClearAllEquipment with AllClearEquipment
  * Enhance GetInventoryData to properly handle HarmonyCubes and Awakenings
  * Update WearEquipmentList for improved equipment management

- Update data models and game data:
  * Modify GetConditionReward to handle valueMax == 0 cases
  * Update EquipmentAwakeningData model with proper default values
  * Update ResetableData with DailyCounselCount as dictionary instead of struct field

- Additional improvements:
  * Create GameAssemblyProcessor utility
  * Enhance level infinite controller
  * Update server selector UI
  * Organize protocol message documentation
2025-10-07 21:30:27 -04:00

61 lines
1.9 KiB
C#

using EpinelPS.Database;
using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Inventory
{
[PacketPath("/inventory/allclearequipment")]
public class AllClearEquipment : LobbyMsgHandler
{
protected override async Task HandleAsync()
{
ReqAllClearEquipment req = await ReadData<ReqAllClearEquipment>();
User user = GetUser();
ResAllClearEquipment response = new()
{
Csn = req.Csn
};
foreach (ItemData item in user.Items.ToArray())
{
if (item.Csn == req.Csn)
{
// Check if the item being unequipped is T10
if (IsT10Equipment(item.ItemType))
{
response.Items.Add(NetUtils.ToNet(item));
continue;
}
item.Csn = 0;
item.Position = 0;
response.Items.Add(NetUtils.ToNet(item));
}
}
JsonDb.Save();
await WriteDataAsync(response);
}
private bool IsT10Equipment(int itemTypeId)
{
// Equipment ID format: 3 + Slot(1Head2Body3Arm4Leg) + Class(1Attacker2Defender3Supporter) + Rarity(01-09 T1-T9, 10 T10) + 01
// T10 equipment has rarity "10" in positions 3-4 (0-based indexing) for 7-digit IDs
string itemTypeStr = itemTypeId.ToString();
// Check if this is an equipment item (starts with 3) and has 7 digits
if (itemTypeStr.Length == 7 && itemTypeStr[0] == '3')
{
// Extract the rarity part (positions 3-4)
string rarityPart = itemTypeStr.Substring(3, 2);
return rarityPart == "10";
}
return false;
}
}
}