mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 09:43:59 +00:00
Compare commits
2 Commits
9b8fa5d7c8
...
e8bb77e90e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8bb77e90e | ||
|
|
5f173ce8d2 |
@@ -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<uint> 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;
|
||||
|
||||
|
||||
@@ -210,6 +210,7 @@ public class PlayerInstance(PlayerGameData data)
|
||||
Sex = Data.Gender,
|
||||
Vigor = Data.Vigor,
|
||||
Solutions = { LineupManager.LineupData.LineupInfo.Values.Select(x => x.ToProto()) },
|
||||
Badges = { InventoryManager.InventoryData.Items.Values.Where(x => x.ItemType == ItemTypeEnum.TYPE_BADGE).Select(x => (ulong)x.UniqueId) }
|
||||
};
|
||||
|
||||
foreach (var chara in CharacterManager.CharacterData.Characters) proto.Items.Add(chara.ToProto());
|
||||
|
||||
@@ -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<SetSupporterTeamIndexParam>(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; }
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using MikuSB.Enums.Player;
|
||||
using MikuSB.Proto;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace MikuSB.GameServer.Server.CallGS.Handlers.Misc;
|
||||
|
||||
[CallGSApi("PlayerSetting_SetShowBadge")]
|
||||
public class PlayerSetting_SetShowBadge : ICallGSHandler
|
||||
{
|
||||
public async Task Handle(Connection connection, string param, ushort seqNo)
|
||||
{
|
||||
var player = connection.Player!;
|
||||
var req = JsonSerializer.Deserialize<SetShowBadgeParam>(param);
|
||||
if (req == null)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "PlayerSetting_SetShowBadge", "{\"err\":\"error.BadParam\"}");
|
||||
return;
|
||||
}
|
||||
|
||||
var slots = new[]
|
||||
{
|
||||
ProfileShowItemTypeEnum.SHOWITEM_BADGE1,
|
||||
ProfileShowItemTypeEnum.SHOWITEM_BADGE2,
|
||||
ProfileShowItemTypeEnum.SHOWITEM_BADGE3
|
||||
};
|
||||
for (int i = 0; i < slots.Length; i++)
|
||||
{
|
||||
var uniqueId = i < req.Badges.Count ? req.Badges[i] : 0;
|
||||
player.SetShowItem((int)slots[i], uniqueId);
|
||||
}
|
||||
|
||||
var sync = new NtfSyncPlayer();
|
||||
sync.ShowItems.AddRange(player.Data.ShowItems);
|
||||
await CallGSRouter.SendScript(connection, "PlayerSetting_SetShowBadge", "null", sync);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class SetShowBadgeParam
|
||||
{
|
||||
[JsonPropertyName("tbBadge")]
|
||||
public List<uint> Badges { get; set; } = [];
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user