diff --git a/Common/Database/Character/CharacterData.cs b/Common/Database/Character/CharacterData.cs index ec0608a..6eb42e0 100644 --- a/Common/Database/Character/CharacterData.cs +++ b/Common/Database/Character/CharacterData.cs @@ -24,6 +24,7 @@ public class CharacterInfo public uint WeaponUniqueId { get; set; } public uint SkinId { get; set; } public uint WeaponSkinId { get; set; } + public uint SupportTeamIndex { get; set; } = 1; public ItemFlagEnum Flag { get; set; } = ItemFlagEnum.FLAG_READED; public uint Expiration { get; set; } [SugarColumn(IsJson = true)] public List UnlockedSkin { get; set; } = []; @@ -58,6 +59,7 @@ public class CharacterInfo proto.Slots[(uint)ItemCardSlotTypeEnum.SLOT_WEAPON] = WeaponUniqueId; proto.Slots[(uint)ItemCardSlotTypeEnum.SLOT_SKIN] = SkinId; proto.Slots[(uint)ItemCardSlotTypeEnum.SLOT_WEAPON_SKIN] = WeaponSkinId; + proto.Slots[(uint)ItemCardSlotTypeEnum.SLOT_SUPPORTERINDEX] = SupportTeamIndex; foreach (var (slot, uid) in SupportSlots) proto.Slots[slot] = uid; diff --git a/GameServer/Server/CallGS/Handlers/Girl/RoleCard_SetSupporterTeamIndex.cs b/GameServer/Server/CallGS/Handlers/Girl/RoleCard_SetSupporterTeamIndex.cs new file mode 100644 index 0000000..e16bc28 --- /dev/null +++ b/GameServer/Server/CallGS/Handlers/Girl/RoleCard_SetSupporterTeamIndex.cs @@ -0,0 +1,37 @@ +using MikuSB.Proto; +using System.Text.Json; +using System.Text.Json.Nodes; +using System.Text.Json.Serialization; + +namespace MikuSB.GameServer.Server.CallGS.Handlers.Girl; + +[CallGSApi("RoleCard_SetSupporterTeamIndex")] +public class RoleCard_SetSupporterTeamIndex : ICallGSHandler +{ + public async Task Handle(Connection connection, string param, ushort seqNo) + { + var req = JsonSerializer.Deserialize(param); + if (req == null) + { + await CallGSRouter.SendScript(connection, "RoleCard_SetSupporterTeamIndex", "{\"err\":\"error.BadParam\"}"); + return; + } + var player = connection.Player!; + var cardData = player.CharacterManager.GetCharacterByGUID(req.CardId); + if (cardData == null) return; + + cardData.SupportTeamIndex = req.Index; + var sync = new NtfSyncPlayer + { + Items = { cardData.ToProto() } + }; + await CallGSRouter.SendScript(connection, "RoleCard_SetSupporterTeamIndex", "null", sync); + } +} + +internal sealed class SetSupporterTeamIndexParam +{ + [JsonPropertyName("Id")] + public uint CardId { get; set; } + public uint Index { get; set; } +} diff --git a/GameServer/Server/CallGS/Handlers/SupporterCard/SupporterCard_Equip.cs b/GameServer/Server/CallGS/Handlers/SupporterCard/SupporterCard_Equip.cs index 25277d1..30d0a00 100644 --- a/GameServer/Server/CallGS/Handlers/SupporterCard/SupporterCard_Equip.cs +++ b/GameServer/Server/CallGS/Handlers/SupporterCard/SupporterCard_Equip.cs @@ -25,7 +25,8 @@ public class SupporterCard_Equip : ICallGSHandler return; } - var slot = (uint)req.EqSlot; + var teamIndex = card.SupportTeamIndex; + var slot = GetTeamIndex((uint)req.EqSlot, teamIndex); // If an existing card is equipped in this slot and bForce is false, ask for confirmation if (!req.Force && req.CurrentEquippedUid != 0 && card.SupportSlots.TryGetValue(slot, out var existing) && existing != 0) @@ -46,6 +47,14 @@ public class SupporterCard_Equip : ICallGSHandler var responseApi = string.IsNullOrEmpty(req.Model) ? "Logistics_Change" : "Logistics_Equip"; await CallGSRouter.SendScript(connection, responseApi, "{}", sync); } + + private uint GetTeamIndex(uint slot, uint teamIndex) + { + if (teamIndex == 1) return slot; + if (teamIndex == 2) return slot + 7; + if (teamIndex == 3) return slot + 10; + return slot; + } } internal sealed class SupporterCardEquipParam