mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 14:23:58 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bf7554c53 | ||
|
|
e8bb77e90e | ||
|
|
5f173ce8d2 | ||
|
|
9b8fa5d7c8 | ||
|
|
1969c1ec89 | ||
|
|
e32319aa50 | ||
|
|
846139347a | ||
|
|
d1102b444c |
@@ -60,6 +60,7 @@ public class ServerOption
|
||||
public string FallbackLanguage { get; set; } = "EN";
|
||||
public string[] DefaultPermissions { get; set; } = ["Admin"];
|
||||
public ServerProfile ServerProfile { get; set; } = new();
|
||||
public bool EnableGmMenu { get; set; } = true;
|
||||
public bool AutoCreateUser { get; set; } = true;
|
||||
public bool SavePersonalDebugFile { get; set; } = false;
|
||||
public bool AutoSendResponseWhenNoHandler { get; set; } = true;
|
||||
|
||||
34
Common/Data/Excel/BreakExcel.cs
Normal file
34
Common/Data/Excel/BreakExcel.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MikuSB.Data.Excel;
|
||||
|
||||
[ResourceEntity("break.json")]
|
||||
public class BreakExcel : ExcelResource
|
||||
{
|
||||
[JsonProperty("ID")] public int Id { get; set; }
|
||||
|
||||
[JsonProperty("Items1")] public List<List<int>> Items1 { get; set; } = [];
|
||||
[JsonProperty("Items2")] public List<List<int>> Items2 { get; set; } = [];
|
||||
[JsonProperty("Items3")] public List<List<int>> Items3 { get; set; } = [];
|
||||
[JsonProperty("Items4")] public List<List<int>> Items4 { get; set; } = [];
|
||||
[JsonProperty("Items5")] public List<List<int>> Items5 { get; set; } = [];
|
||||
[JsonProperty("Items6")] public List<List<int>> Items6 { get; set; } = [];
|
||||
|
||||
public List<List<int>> GetItems(uint breakLevel) => breakLevel switch
|
||||
{
|
||||
1 => Items1,
|
||||
2 => Items2,
|
||||
3 => Items3,
|
||||
4 => Items4,
|
||||
5 => Items5,
|
||||
6 => Items6,
|
||||
_ => []
|
||||
};
|
||||
|
||||
public override uint GetId() => (uint)Id;
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.BreakData[Id] = this;
|
||||
}
|
||||
}
|
||||
22
Common/Data/Excel/ProfileExcel.cs
Normal file
22
Common/Data/Excel/ProfileExcel.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace MikuSB.Data.Excel;
|
||||
|
||||
[ResourceEntity("profile.json")]
|
||||
public class ProfileExcel : ExcelResource
|
||||
{
|
||||
public uint Genre { get; set; }
|
||||
public uint Detail { get; set; }
|
||||
public uint Particular { get; set; }
|
||||
public uint Level { get; set; }
|
||||
public string I18n { get; set; } = "";
|
||||
public string LuaType { get; set; } = "";
|
||||
|
||||
public override uint GetId()
|
||||
{
|
||||
return (uint)I18n.GetHashCode();
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.ProfileData.Add(GetId(), this);
|
||||
}
|
||||
}
|
||||
@@ -16,12 +16,13 @@ public static class GameData
|
||||
public static Dictionary<uint, ArItemExcel> ArItemData { get; private set; } = [];
|
||||
public static Dictionary<uint, ManifestationExcel> ManifestationData { get; private set; } = [];
|
||||
public static Dictionary<uint, Rogue3DDifficultExcel> Rogue3DDifficultData { get; private set; } = [];
|
||||
public static Dictionary<int, BreakExcel> BreakData { get; private set; } = [];
|
||||
public static Dictionary<uint, SpineExcel> SpineData { get; private set; } = [];
|
||||
public static Dictionary<uint, NodeConditionExcel> NodeConditionData { get; private set; } = [];
|
||||
public static List<SupportCardExcel> SupportCardData { get; private set; } = [];
|
||||
public static Dictionary<uint, WeaponSkinExcel> WeaponSkinData { get; private set; } = [];
|
||||
public static Dictionary<uint, DailyLevelExcel> DailyLevelData { get; private set; } = [];
|
||||
|
||||
public static Dictionary<uint, ProfileExcel> ProfileData { get; private set; } = [];
|
||||
}
|
||||
|
||||
public static class GameResourceTemplateId
|
||||
|
||||
@@ -24,13 +24,13 @@ 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; } = [];
|
||||
[SugarColumn(IsJson = true)] public List<uint> Spines { get; set; } = [];
|
||||
[SugarColumn(IsJson = true)] public List<uint> Affixs { get; set; } = [];
|
||||
// Key = EqSlot (= support card Detail), Value = support card UniqueId
|
||||
[SugarColumn(IsJson = true)] public Dictionary<uint, uint> SupportSlots { get; set; } = [];
|
||||
[SugarColumn(IsJson = true)] public Dictionary<uint, uint> SupportSlots { get; set; } = []; // Key = EqSlot (= support card Detail), Value = support card UniqueId
|
||||
public long Timestamp { get; set; }
|
||||
public uint Count { get; set; } = 1;
|
||||
|
||||
@@ -56,9 +56,10 @@ public class CharacterInfo
|
||||
proto.Enhance.Spines.AddRange(Spines.Select(x => (ulong)x));
|
||||
proto.Enhance.Affixs.AddRange(Affixs);
|
||||
|
||||
proto.Slots[4] = WeaponUniqueId;
|
||||
proto.Slots[5] = SkinId;
|
||||
proto.Slots[6] = WeaponSkinId;
|
||||
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;
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ public abstract class GrowableItemInfo : BaseGameItemInfo
|
||||
public new uint Level { get; set; }
|
||||
public new uint Exp { get; set; }
|
||||
public uint Break { get; set; }
|
||||
public uint Evolue { get; set; }
|
||||
public uint EquipAvatarId { get; set; }
|
||||
}
|
||||
|
||||
@@ -73,7 +74,8 @@ public class GameWeaponInfo : GrowableItemInfo
|
||||
{
|
||||
Level = Level,
|
||||
Exp = Exp,
|
||||
Break = Break
|
||||
Break = Break,
|
||||
Evolue = Evolue
|
||||
}
|
||||
};
|
||||
return proto;
|
||||
@@ -91,7 +93,7 @@ public class GameSkinInfo : BaseGameItemInfo
|
||||
Count = ItemCount,
|
||||
Flag = (uint)Flag,
|
||||
};
|
||||
proto.Slots[11] = Math.Min(SkinType, 1);
|
||||
proto.Slots[(uint)ItemSkinSlotTypeEnum.SLOT_CARD_SKIL_TYPE] = Math.Min(SkinType, 1);
|
||||
return proto;
|
||||
}
|
||||
}
|
||||
@@ -114,7 +116,7 @@ public class GameSupportCardInfo : BaseGameItemInfo
|
||||
Exp = Exp
|
||||
}
|
||||
};
|
||||
proto.Slots[1] = AffixId;
|
||||
proto.Slots[(uint)ItemSupportCardSlotTypeEnum.SLOT_AFFIXINDEX] = AffixId;
|
||||
return proto;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace MikuSB.Enums.Item;
|
||||
|
||||
public enum ItemFlagEnum
|
||||
{
|
||||
FLAG_USE = 1,// 使用中
|
||||
FLAG_LOCK = 2,// 锁定中
|
||||
FLAG_READED = 4,// 道具已查看
|
||||
FLAG_LEAVE = 8,// 角色大招后离场
|
||||
FLAG_WEAPON_DEFAULT = 16,// 武器显示原始样式
|
||||
FLAG_WEAPON_AUDIO = 32,// 武器消音器音效
|
||||
FLAG_ROLE_LIKE = 64,// 心选角色
|
||||
}
|
||||
|
||||
@@ -26,3 +26,55 @@ public enum ItemTypeEnum
|
||||
TYPE_AR = 24, //AR道具
|
||||
TYPE_CALL = 25, //电话陪伴道具
|
||||
}
|
||||
|
||||
public enum ItemCardSlotTypeEnum
|
||||
{
|
||||
SLOT_SUPPORTERCARD1 = 1, // 后勤卡
|
||||
SLOT_SUPPORTERCARD2 = 2, // 后勤卡
|
||||
SLOT_SUPPORTERCARD3 = 3, // 后勤卡
|
||||
SLOT_WEAPON = 4, // 武器
|
||||
SLOT_SKIN = 5, // 时装
|
||||
SLOT_WEAPON_SKIN = 6, // 武器时装
|
||||
SLOT_SUPPORTERINDEX = 7, // 当前使用的后勤组
|
||||
SLOT_SUPPORTERCARD4 = 8, // 后勤卡
|
||||
SLOT_SUPPORTERCARD5 = 9, // 后勤卡
|
||||
SLOT_SUPPORTERCARD6 = 10, // 后勤卡
|
||||
SLOT_SUPPORTERCARD7 = 11, // 后勤卡
|
||||
SLOT_SUPPORTERCARD8 = 12, // 后勤卡
|
||||
SLOT_SUPPORTERCARD9 = 13, // 后勤卡
|
||||
}
|
||||
|
||||
public enum ItemSkinPartSlotTypeEnum
|
||||
{
|
||||
SLOT_SkinPartSlot1 = 1,
|
||||
SLOT_SkinPartSlot2 = 2,
|
||||
SLOT_SkinPartSlot3 = 3,
|
||||
SLOT_SkinPartSlot4 = 4,
|
||||
SLOT_SkinPartSlot5 = 5,
|
||||
SLOT_SkinPartSlot6 = 6,
|
||||
SLOT_SkinPartSlot7 = 7,
|
||||
SLOT_SkinPartSlot8 = 8,
|
||||
SLOT_SkinPartSlot9 = 9,
|
||||
SLOT_SkinPartSlot10 = 10,
|
||||
}
|
||||
|
||||
public enum ItemSkinSlotTypeEnum
|
||||
{
|
||||
SLOT_CARD_SKIL_TYPE = 11
|
||||
}
|
||||
|
||||
public enum ItemSupportCardSlotTypeEnum
|
||||
{
|
||||
SLOT_AFFIXINDEX = 1 // 可洗练的初始词缀索引
|
||||
}
|
||||
|
||||
public enum ItemFlagEnum
|
||||
{
|
||||
FLAG_USE = 1, // 使用中
|
||||
FLAG_LOCK = 2, // 锁定中
|
||||
FLAG_READED = 4, // 道具已查看
|
||||
FLAG_LEAVE = 8, // 角色大招后离场
|
||||
FLAG_WEAPON_DEFAULT = 16, // 武器显示原始样式
|
||||
FLAG_WEAPON_AUDIO = 32, // 武器消音器音效
|
||||
FLAG_ROLE_LIKE = 64, // 心选角色
|
||||
}
|
||||
24
Common/Enums/Player/ProfileTypeEnum.cs
Normal file
24
Common/Enums/Player/ProfileTypeEnum.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace MikuSB.Enums.Player;
|
||||
|
||||
public enum ProfileShowItemTypeEnum
|
||||
{
|
||||
SHOWITEM_CARD1 = 1, //第1个展示卡
|
||||
SHOWITEM_CARD2 = 2, //第2个展示卡
|
||||
SHOWITEM_CARD3 = 3, //第3个展示卡
|
||||
SHOWITEM_GIRL = 4, //看板娘
|
||||
SHOWITEM_FACE = 5, //头像
|
||||
SHOWITEM_FRAME = 6, //头像框
|
||||
SHOWITEM_CARD4 = 7, //第4个展示卡
|
||||
SHOWITEM_CARD5 = 8, //第5个展示卡
|
||||
SHOWITEM_SKIN1 = 9, //第1个展示皮肤
|
||||
SHOWITEM_SKIN2 = 10, //第2个展示皮肤
|
||||
SHOWITEM_SKIN3 = 11, //第3个展示皮肤
|
||||
SHOWITEM_SKIN4 = 12, //第4个展示皮肤
|
||||
SHOWITEM_SKIN5 = 13, //第5个展示皮肤
|
||||
SHOWITEM_BADGE1 = 14, //第一个展示勋章
|
||||
SHOWITEM_BADGE2 = 15, //第二个展示勋章
|
||||
SHOWITEM_BADGE3 = 16, //第三个展示勋章
|
||||
SHOWITEM_COVER = 17, //展示封面
|
||||
SHOWITEM_NAMECARD = 18, //展示名片
|
||||
SHOWITEM_BUBBLE = 19, //聊天气泡
|
||||
}
|
||||
@@ -35,6 +35,7 @@ public class ServerTextCHS
|
||||
/// </summary>
|
||||
public class WordTextCHS
|
||||
{
|
||||
public string Profile => "个人资料";
|
||||
public string WeaponSkin => "武器皮肤";
|
||||
public string SupportCard => "支援卡";
|
||||
public string Weapon => "武器";
|
||||
@@ -240,7 +241,8 @@ public class GiveAllTextCHS
|
||||
"注意:-1 表示全部";
|
||||
public string Usage => "用法:/giveall weapon <detail/-1> -p<特定> -l<等級>\n" +
|
||||
"用法:/giveall weaponskin <detail/-1> -p<特定>\n" +
|
||||
"用法:/giveall card <detail/-1> -p<特定> -l<等級>";
|
||||
"用法:/giveall card <detail/-1> -p<特定> -l<等級>" +
|
||||
"用法:/giveall profile <detail/-1> -g<类型> -p<特定> -l<等级>";
|
||||
public string NotFound => "未找到 {0}!";
|
||||
public string GiveAllItems => "已向玩家添加 {0} 个 {1}!";
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public class ServerTextCHT
|
||||
/// </summary>
|
||||
public class WordTextCHT
|
||||
{
|
||||
public string Profile => "個人資料";
|
||||
public string WeaponSkin => "武器外觀";
|
||||
public string SupportCard => "支援卡";
|
||||
public string Weapon => "武器";
|
||||
@@ -240,7 +241,8 @@ public class GiveAllTextCHT
|
||||
"注意:-1 表示全部";
|
||||
public string Usage => "用法:/giveall weapon <detail/-1> -p<特定> -l<等級>\n" +
|
||||
"用法:/giveall weaponskin <detail/-1> -p<特定>\n" +
|
||||
"用法:/giveall card <detail/-1> -p<特定> -l<等級>";
|
||||
"用法:/giveall card <detail/-1> -p<特定> -l<等級>" +
|
||||
"用法:/giveall profile <detail/-1> -g<類型> -p<特定> -l<等級>";
|
||||
public string NotFound => "未找到 {0}!";
|
||||
public string GiveAllItems => "已向玩家添加 {0} 個 {1}!";
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public class ServerTextEN
|
||||
/// </summary>
|
||||
public class WordTextEN
|
||||
{
|
||||
public string Profile => "Profile";
|
||||
public string WeaponSkin => "Weapon Skin";
|
||||
public string Valk => "Valkyrie";
|
||||
public string Material => "Material";
|
||||
@@ -206,7 +207,8 @@ public class GiveAllTextEN
|
||||
"Note: -1 means all";
|
||||
public string Usage => "Usage: /giveall weapon <detail/-1> -p<particular> -l<level>\n" +
|
||||
"Usage: /giveall weaponskin <detail/-1> -p<particular>\n" +
|
||||
"Usage: /giveall card <detail/-1> -p<particular> -l<level>";
|
||||
"Usage: /giveall card <detail/-1> -p<particular> -l<level>" +
|
||||
"Usage: /giveall profile <detail/-1> -g<genre> -p<particular> -l<level>";
|
||||
public string NotFound => "{0} not found!";
|
||||
public string GiveAllItems => "Added {0} {1} to player!";
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class CommandGiveAll : ICommands
|
||||
foreach (var config in GameData.WeaponSkinData.Values)
|
||||
{
|
||||
var weaponSkin = await player.InventoryManager!
|
||||
.AddWeaponSkinItem((ItemTypeEnum)config.Genre, config.Detail, config.Particular, 1, false);
|
||||
.AddWeaponSkinItem((ItemTypeEnum)config.Genre, config.Detail, config.Particular, config.Level, false);
|
||||
if (weaponSkin != null) weaponSkins.Add(weaponSkin);
|
||||
}
|
||||
}
|
||||
@@ -114,4 +114,40 @@ public class CommandGiveAll : ICommands
|
||||
await arg.SendMsg(I18NManager.Translate("Game.Command.GiveAll.GiveAllItems",
|
||||
I18NManager.Translate("Word.WeaponSkin"), weaponSkins.Count.ToString()));
|
||||
}
|
||||
|
||||
[CommandMethod("profile")]
|
||||
public async ValueTask GiveAllProfile(CommandArg arg)
|
||||
{
|
||||
if (!await arg.CheckOnlineTarget()) return;
|
||||
if (await arg.GetOption('p') is not int particular) return;
|
||||
if (await arg.GetOption('l') is not int level) return;
|
||||
if (await arg.GetOption('g') is not int genre) return;
|
||||
|
||||
var detail = arg.GetInt(0);
|
||||
var player = arg.Target!.Player!;
|
||||
List<BaseGameItemInfo> profileItems = [];
|
||||
if (detail == -1)
|
||||
{
|
||||
// add all
|
||||
foreach (var config in GameData.ProfileData.Values)
|
||||
{
|
||||
var profile = await player.InventoryManager!
|
||||
.AddProfileItem((ItemTypeEnum)config.Genre, config.Detail, config.Particular, config.Level, false);
|
||||
if (profile != null) profileItems.Add(profile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var profile = await player.InventoryManager!.AddProfileItem((ItemTypeEnum)genre, (uint)detail, (uint)particular, (uint)level, false);
|
||||
if (profile == null)
|
||||
{
|
||||
await arg.SendMsg(I18NManager.Translate("Game.Command.GiveAll.NotFound", I18NManager.Translate("Word.Profile")));
|
||||
return;
|
||||
}
|
||||
profileItems.Add(profile);
|
||||
}
|
||||
if (profileItems.Count > 0) await player.SendPacket(new PacketNtfCallScript(profileItems));
|
||||
await arg.SendMsg(I18NManager.Translate("Game.Command.GiveAll.GiveAllItems",
|
||||
I18NManager.Translate("Word.Profile"), profileItems.Count.ToString()));
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
UniqueId = InventoryData.NextUniqueUid++,
|
||||
Level = weaponLevel,
|
||||
Break = GetWeaponBreak(weaponLevel),
|
||||
ItemType = ItemTypeEnum.TYPE_WEAPON,
|
||||
ItemType = genre,
|
||||
ItemCount = 1
|
||||
};
|
||||
InventoryData.Weapons[weaponInfo.UniqueId] = weaponInfo;
|
||||
@@ -67,13 +67,13 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
if (genre != ItemTypeEnum.TYPE_CARD_SKIN) return null;
|
||||
var skinData = GameData.CardSkinData.Values.FirstOrDefault(x => x.Genre == (int)genre && x.Detail == detail && x.Particular == particular && x.Level == level);
|
||||
if (skinData == null) return null;
|
||||
|
||||
var templateId = GameResourceTemplateId.FromGdpl((uint)genre,detail,particular,level);
|
||||
if (InventoryData.Items.Values.Any(x => x.TemplateId == templateId)) return null;
|
||||
var skinInfo = new GameSkinInfo
|
||||
{
|
||||
TemplateId = templateId,
|
||||
UniqueId = InventoryData.NextUniqueUid++,
|
||||
ItemType = ItemTypeEnum.TYPE_CARD_SKIN,
|
||||
ItemType = genre,
|
||||
ItemCount = 1
|
||||
};
|
||||
InventoryData.Skins[skinInfo.UniqueId] = skinInfo;
|
||||
@@ -111,7 +111,7 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
TemplateId = templateId,
|
||||
UniqueId = InventoryData.NextUniqueUid++,
|
||||
ItemType = ItemTypeEnum.TYPE_AR,
|
||||
ItemType = genre,
|
||||
ItemCount = 1
|
||||
};
|
||||
InventoryData.Items[arInfo.UniqueId] = arInfo;
|
||||
@@ -171,7 +171,7 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
TemplateId = templateId,
|
||||
UniqueId = InventoryData.NextUniqueUid++,
|
||||
ItemType = ItemTypeEnum.TYPE_MANIFESTATION,
|
||||
ItemType = genre,
|
||||
ItemCount = 1
|
||||
};
|
||||
InventoryData.Items[manifestInfo.UniqueId] = manifestInfo;
|
||||
@@ -240,7 +240,7 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
TemplateId = templateId,
|
||||
UniqueId = InventoryData.NextUniqueUid++,
|
||||
ItemType = ItemTypeEnum.TYPE_WEAPON_SKIN,
|
||||
ItemType = genre,
|
||||
ItemCount = 1
|
||||
};
|
||||
InventoryData.Items[skinInfo.UniqueId] = skinInfo;
|
||||
@@ -249,4 +249,25 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
|
||||
return skinInfo;
|
||||
}
|
||||
|
||||
public async ValueTask<BaseGameItemInfo?> AddProfileItem(ItemTypeEnum genre, uint detail, uint particular, uint level = 1, bool sendPacket = true)
|
||||
{
|
||||
if (genre < ItemTypeEnum.TYPE_PROFILE || genre > ItemTypeEnum.TYPE_ANALYST) return null;
|
||||
var profileData = GameData.ProfileData.Values.FirstOrDefault(x => x.Genre == (int)genre && x.Detail == detail && x.Particular == particular && x.Level == level);
|
||||
if (profileData == null) return null;
|
||||
var templateId = GameResourceTemplateId.FromGdpl((uint)genre, detail, particular, level);
|
||||
if (InventoryData.Items.Values.Any(x => x.TemplateId == templateId)) return null;
|
||||
var profileInfo = new BaseGameItemInfo
|
||||
{
|
||||
TemplateId = templateId,
|
||||
UniqueId = InventoryData.NextUniqueUid++,
|
||||
ItemType = genre,
|
||||
ItemCount = 1
|
||||
};
|
||||
InventoryData.Items[profileInfo.UniqueId] = profileInfo;
|
||||
|
||||
if (sendPacket) await Player.SendPacket(new PacketNtfCallScript([profileInfo]));
|
||||
|
||||
return profileInfo;
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
|
||||
@@ -11,7 +11,7 @@ public class Daily_SetSelectSuit : ICallGSHandler
|
||||
var req = JsonSerializer.Deserialize<GirlWeaponSkinParam>(param);
|
||||
if (req == null)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "GirlWeaponSkin_Change", "{}");
|
||||
await CallGSRouter.SendScript(connection, "Daily_SetSelectSuit", "{}");
|
||||
return;
|
||||
}
|
||||
var rsp = $"{{\"SuitId\":{req.Suit}}}";
|
||||
|
||||
@@ -12,11 +12,19 @@ public class EnterGirlRoom : ICallGSHandler
|
||||
var req = JsonSerializer.Deserialize<EnterGirlRoomParam>(param);
|
||||
var response = new JsonObject
|
||||
{
|
||||
["nCardId"] = req?.CardId ?? 1,
|
||||
["nSkinId"] = req?.SkinId ?? 0,
|
||||
["bOpen"] = true
|
||||
["nCardId"] = 0,
|
||||
["nSkinId"] = 0,
|
||||
["bOpen"] = false
|
||||
};
|
||||
if (req == null)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "EnterGirlRoom", response.ToJsonString());
|
||||
return;
|
||||
}
|
||||
|
||||
response["nCardId"] = req.CardId;
|
||||
response["nSkinId"] = req.SkinId;
|
||||
response["bOpen"] = true;
|
||||
await CallGSRouter.SendScript(connection, "EnterGirlRoom", response.ToJsonString());
|
||||
}
|
||||
}
|
||||
@@ -26,6 +34,6 @@ internal sealed class EnterGirlRoomParam
|
||||
[JsonPropertyName("nSkinId")]
|
||||
public int SkinId { get; set; }
|
||||
|
||||
[JsonPropertyName("nCardID")]
|
||||
[JsonPropertyName("nCardId")]
|
||||
public uint CardId { get; set; }
|
||||
}
|
||||
@@ -13,7 +13,7 @@ public class GirlWeaponSkin_Change : ICallGSHandler
|
||||
var req = JsonSerializer.Deserialize<GirlWeaponSkinParam>(param);
|
||||
if (req == null)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "GirlWeaponSkin_Change", "{}");
|
||||
await CallGSRouter.SendScript(connection, "GirlWeaponSkin_Change", "{\"err\":\"error.BadParam\"}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class GirlWeaponSkin_Change : ICallGSHandler
|
||||
Items = { cardData.ToProto() }
|
||||
};
|
||||
|
||||
await CallGSRouter.SendScript(connection, "GirlWeaponSkin_Change", "{}", sync);
|
||||
await CallGSRouter.SendScript(connection, "GirlWeaponSkin_Change", "null", sync);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using MikuSB.Database;
|
||||
using MikuSB.Enums.Player;
|
||||
using MikuSB.Proto;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
@@ -8,8 +8,6 @@ namespace MikuSB.GameServer.Server.CallGS.Handlers.Misc;
|
||||
[CallGSApi("PlayerSetting_ChangeShowCard")]
|
||||
public class PlayerSetting_ChangeShowCard : ICallGSHandler
|
||||
{
|
||||
private const int ShowItemGirlIndex = 4;
|
||||
|
||||
public async Task Handle(Connection connection, string param, ushort seqNo)
|
||||
{
|
||||
var player = connection.Player!;
|
||||
@@ -23,13 +21,9 @@ public class PlayerSetting_ChangeShowCard : ICallGSHandler
|
||||
await CallGSRouter.SendScript(connection, "PlayerSetting_ChangeShowCard", "{}");
|
||||
return;
|
||||
}
|
||||
|
||||
player.SetShowItem(ShowItemGirlIndex, card.Guid);
|
||||
DatabaseHelper.SaveDatabaseType(player.Data);
|
||||
|
||||
player.SetShowItem((int)ProfileShowItemTypeEnum.SHOWITEM_GIRL, card.Guid);
|
||||
var sync = new NtfSyncPlayer();
|
||||
sync.ShowItems.AddRange(player.Data.ShowItems);
|
||||
|
||||
await CallGSRouter.SendScript(connection, "PlayerSetting_ChangeShowCard", "{}", sync);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
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_SetProfileFace")]
|
||||
public class PlayerSetting_SetProfileFace : ICallGSHandler
|
||||
{
|
||||
public async Task Handle(Connection connection, string param, ushort seqNo)
|
||||
{
|
||||
var player = connection.Player!;
|
||||
var req = JsonSerializer.Deserialize<SetProfileFaceParam>(param);
|
||||
if (req == null)
|
||||
return;
|
||||
|
||||
if (req.HeadItemId > 0)
|
||||
{
|
||||
var item = player.InventoryManager.GetNormalItem(req.HeadItemId);
|
||||
if (item == null)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "PlayerSetting_SetProfileFace", "{\"err\":\"error.BadParam\"}");
|
||||
return;
|
||||
}
|
||||
player.SetShowItem((int)ProfileShowItemTypeEnum.SHOWITEM_FACE, item.UniqueId);
|
||||
}
|
||||
if (req.FrameItemId > 0)
|
||||
{
|
||||
var item = player.InventoryManager.GetNormalItem(req.FrameItemId);
|
||||
if (item == null)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "PlayerSetting_SetProfileFace", "{\"err\":\"error.BadParam\"}");
|
||||
return;
|
||||
}
|
||||
player.SetShowItem((int)ProfileShowItemTypeEnum.SHOWITEM_FRAME, item.UniqueId);
|
||||
}
|
||||
|
||||
var sync = new NtfSyncPlayer();
|
||||
sync.ShowItems.AddRange(player.Data.ShowItems);
|
||||
await CallGSRouter.SendScript(connection, "PlayerSetting_SetProfileFace", "null", sync);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class SetProfileFaceParam
|
||||
{
|
||||
[JsonPropertyName("nHeadItemID")] public uint HeadItemId { get; set; }
|
||||
[JsonPropertyName("nFrameItemID")] public uint FrameItemId { 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; } = [];
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
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_SetShowBubble")]
|
||||
public class PlayerSetting_SetShowBubble : ICallGSHandler
|
||||
{
|
||||
public async Task Handle(Connection connection, string param, ushort seqNo)
|
||||
{
|
||||
var player = connection.Player!;
|
||||
var req = JsonSerializer.Deserialize<SetShowBubbleParam>(param);
|
||||
if (req == null)
|
||||
return;
|
||||
|
||||
var item = player.InventoryManager.GetNormalItem(req.Id);
|
||||
if (item == null)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "PlayerSetting_SetShowBubble", "{\"err\":\"error.BadParam\"}");
|
||||
return;
|
||||
}
|
||||
|
||||
player.SetShowItem((int)ProfileShowItemTypeEnum.SHOWITEM_BUBBLE, item.UniqueId);
|
||||
var sync = new NtfSyncPlayer();
|
||||
sync.ShowItems.AddRange(player.Data.ShowItems);
|
||||
await CallGSRouter.SendScript(connection, "PlayerSetting_SetShowBubble", "null", sync);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class SetShowBubbleParam
|
||||
{
|
||||
[JsonPropertyName("nID")]
|
||||
public uint Id { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
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_SetShowCover")]
|
||||
public class PlayerSetting_SetShowCover : ICallGSHandler
|
||||
{
|
||||
public async Task Handle(Connection connection, string param, ushort seqNo)
|
||||
{
|
||||
var player = connection.Player!;
|
||||
var req = JsonSerializer.Deserialize<SetShowCoverParam>(param);
|
||||
if (req == null)
|
||||
return;
|
||||
|
||||
var item = player.InventoryManager.GetNormalItem(req.Id);
|
||||
if (item == null)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "PlayerSetting_SetShowCover", "{\"err\":\"error.BadParam\"}");
|
||||
return;
|
||||
}
|
||||
|
||||
player.SetShowItem((int)ProfileShowItemTypeEnum.SHOWITEM_COVER, item.UniqueId);
|
||||
var sync = new NtfSyncPlayer();
|
||||
sync.ShowItems.AddRange(player.Data.ShowItems);
|
||||
await CallGSRouter.SendScript(connection, "PlayerSetting_SetShowCover", "null", sync);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class SetShowCoverParam
|
||||
{
|
||||
[JsonPropertyName("nID")]
|
||||
public uint Id { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
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_SetShowNameCard")]
|
||||
public class PlayerSetting_SetShowNameCard : ICallGSHandler
|
||||
{
|
||||
public async Task Handle(Connection connection, string param, ushort seqNo)
|
||||
{
|
||||
var player = connection.Player!;
|
||||
var req = JsonSerializer.Deserialize<SetShowNameCardParam>(param);
|
||||
if (req == null)
|
||||
return;
|
||||
|
||||
var item = player.InventoryManager.GetNormalItem(req.Id);
|
||||
if (item == null)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "PlayerSetting_SetShowNameCard", "{\"err\":\"error.BadParam\"}");
|
||||
return;
|
||||
}
|
||||
|
||||
player.SetShowItem((int)ProfileShowItemTypeEnum.SHOWITEM_NAMECARD, item.UniqueId);
|
||||
var sync = new NtfSyncPlayer();
|
||||
sync.ShowItems.AddRange(player.Data.ShowItems);
|
||||
await CallGSRouter.SendScript(connection, "PlayerSetting_SetShowNameCard", "null", sync);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class SetShowNameCardParam
|
||||
{
|
||||
[JsonPropertyName("nID")]
|
||||
public uint Id { 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
|
||||
|
||||
98
GameServer/Server/CallGS/Handlers/Weapon/Weapon_Break.cs
Normal file
98
GameServer/Server/CallGS/Handlers/Weapon/Weapon_Break.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
using MikuSB.Data;
|
||||
using MikuSB.Database;
|
||||
using MikuSB.Proto;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace MikuSB.GameServer.Server.CallGS.Handlers.Weapon;
|
||||
|
||||
// s2c: function(sErr) — send "null" on success (json.decode("null") = nil = falsy in Lua)
|
||||
[CallGSApi("Weapon_Break")]
|
||||
public class Weapon_Break : ICallGSHandler
|
||||
{
|
||||
private const uint MaxBreak = 6;
|
||||
|
||||
public async Task Handle(Connection connection, string param, ushort seqNo)
|
||||
{
|
||||
var player = connection.Player!;
|
||||
var req = JsonSerializer.Deserialize<WeaponBreakParam>(param);
|
||||
if (req == null || req.WeaponId == 0)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "Weapon_Break", "\"error.BadParam\"");
|
||||
return;
|
||||
}
|
||||
|
||||
var weapon = player.InventoryManager.InventoryData.Weapons.GetValueOrDefault((uint)req.WeaponId);
|
||||
if (weapon == null)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "Weapon_Break", "\"error.BadParam\"");
|
||||
return;
|
||||
}
|
||||
|
||||
if (weapon.Break >= MaxBreak)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "Weapon_Break", "\"tip.already_max_break\"");
|
||||
return;
|
||||
}
|
||||
|
||||
var nextBreak = weapon.Break + 1;
|
||||
|
||||
// Look up break cost from WeaponExcel → BreakExcel
|
||||
var weaponExcel = GameData.WeaponData.Values.FirstOrDefault(x =>
|
||||
GameResourceTemplateId.FromGdpl(x.Genre, x.Detail, x.Particular, x.Level) == weapon.TemplateId);
|
||||
|
||||
var requestedMaterials = new Dictionary<ulong, uint>();
|
||||
if (weaponExcel != null && GameData.BreakData.TryGetValue(weaponExcel.BreakMatID, out var breakExcel))
|
||||
{
|
||||
foreach (var row in breakExcel.GetItems(nextBreak))
|
||||
{
|
||||
if (row.Count < 5) continue;
|
||||
var tid = GameResourceTemplateId.FromGdpl(
|
||||
(uint)row[0], (uint)row[1], (uint)row[2], (uint)row[3]);
|
||||
requestedMaterials[tid] = requestedMaterials.GetValueOrDefault(tid) + (uint)row[4];
|
||||
}
|
||||
}
|
||||
|
||||
// Validate materials
|
||||
foreach (var (tid, count) in requestedMaterials)
|
||||
{
|
||||
var item = player.InventoryManager.InventoryData.Items.Values.FirstOrDefault(x => x.TemplateId == tid);
|
||||
if (item == null || item.ItemCount < count)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "Weapon_Break", "\"tip.not_material_for_break\"");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Consume materials
|
||||
var syncItems = new List<Item>();
|
||||
foreach (var (tid, count) in requestedMaterials)
|
||||
{
|
||||
var item = player.InventoryManager.InventoryData.Items.Values.First(x => x.TemplateId == tid);
|
||||
item.ItemCount -= count;
|
||||
var proto = item.ToProto();
|
||||
if (item.ItemCount == 0)
|
||||
{
|
||||
player.InventoryManager.InventoryData.Items.Remove(item.UniqueId);
|
||||
proto.Count = 0;
|
||||
}
|
||||
syncItems.Add(proto);
|
||||
}
|
||||
|
||||
weapon.Break = nextBreak;
|
||||
syncItems.Add(weapon.ToProto());
|
||||
|
||||
DatabaseHelper.SaveDatabaseType(player.InventoryManager.InventoryData);
|
||||
|
||||
var sync = new NtfSyncPlayer();
|
||||
sync.Items.AddRange(syncItems);
|
||||
|
||||
await CallGSRouter.SendScript(connection, "Weapon_Break", "null", sync);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class WeaponBreakParam
|
||||
{
|
||||
[JsonPropertyName("Id")]
|
||||
public int WeaponId { get; set; }
|
||||
}
|
||||
77
GameServer/Server/CallGS/Handlers/Weapon/Weapon_Evolution.cs
Normal file
77
GameServer/Server/CallGS/Handlers/Weapon/Weapon_Evolution.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using MikuSB.Database;
|
||||
using MikuSB.Proto;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace MikuSB.GameServer.Server.CallGS.Handlers.Weapon;
|
||||
|
||||
// s2c: function(sErr) — send "null" on success
|
||||
// Id = target weapon UniqueId
|
||||
// nItemId = material item UniqueId (weapon or supply item to consume)
|
||||
[CallGSApi("Weapon_Evolution")]
|
||||
public class Weapon_Evolution : ICallGSHandler
|
||||
{
|
||||
public async Task Handle(Connection connection, string param, ushort seqNo)
|
||||
{
|
||||
var player = connection.Player!;
|
||||
var req = JsonSerializer.Deserialize<WeaponEvolutionParam>(param);
|
||||
if (req == null || req.WeaponId == 0 || req.MaterialId == 0)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "Weapon_Evolution", "\"error.BadParam\"");
|
||||
return;
|
||||
}
|
||||
|
||||
var weapon = player.InventoryManager.InventoryData.Weapons.GetValueOrDefault((uint)req.WeaponId);
|
||||
if (weapon == null)
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "Weapon_Evolution", "\"error.BadParam\"");
|
||||
return;
|
||||
}
|
||||
|
||||
var syncItems = new List<Item>();
|
||||
|
||||
// Material can be a weapon or a regular item
|
||||
if (player.InventoryManager.InventoryData.Weapons.TryGetValue((uint)req.MaterialId, out var matWeapon))
|
||||
{
|
||||
player.InventoryManager.InventoryData.Weapons.Remove((uint)req.MaterialId);
|
||||
var removed = matWeapon.ToProto();
|
||||
removed.Count = 0;
|
||||
syncItems.Add(removed);
|
||||
}
|
||||
else if (player.InventoryManager.InventoryData.Items.TryGetValue((uint)req.MaterialId, out var matItem))
|
||||
{
|
||||
matItem.ItemCount--;
|
||||
var proto = matItem.ToProto();
|
||||
if (matItem.ItemCount == 0)
|
||||
{
|
||||
player.InventoryManager.InventoryData.Items.Remove(matItem.UniqueId);
|
||||
proto.Count = 0;
|
||||
}
|
||||
syncItems.Add(proto);
|
||||
}
|
||||
else
|
||||
{
|
||||
await CallGSRouter.SendScript(connection, "Weapon_Evolution", "\"tip.not_material\"");
|
||||
return;
|
||||
}
|
||||
|
||||
weapon.Evolue++;
|
||||
syncItems.Add(weapon.ToProto());
|
||||
|
||||
DatabaseHelper.SaveDatabaseType(player.InventoryManager.InventoryData);
|
||||
|
||||
var sync = new NtfSyncPlayer();
|
||||
sync.Items.AddRange(syncItems);
|
||||
|
||||
await CallGSRouter.SendScript(connection, "Weapon_Evolution", "null", sync);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class WeaponEvolutionParam
|
||||
{
|
||||
[JsonPropertyName("Id")]
|
||||
public int WeaponId { get; set; }
|
||||
|
||||
[JsonPropertyName("nItemId")]
|
||||
public int MaterialId { get; set; }
|
||||
}
|
||||
@@ -53,6 +53,7 @@ public class HandlerReqLogin : Handler
|
||||
await connection.Player.OnEnterGame();
|
||||
connection.Player.Connection = connection;
|
||||
await connection.SendPacket(new PacketRspLogin(connection.Player!));
|
||||
await SendDebugLoginState(connection);
|
||||
|
||||
await connection.Player.OnHeartBeat();
|
||||
await connection.SendPacket(new PacketNtfUpdateFriend(connection.Player!));
|
||||
@@ -118,4 +119,14 @@ public class HandlerReqLogin : Handler
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task SendDebugLoginState(Connection connection)
|
||||
{
|
||||
var response = new JsonObject
|
||||
{
|
||||
["IsDebug"] = ConfigManager.Config.ServerOption.EnableGmMenu
|
||||
};
|
||||
|
||||
await CallGSRouter.SendScript(connection, "gm.notifylogin", response.ToJsonString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
v=1.3
|
||||
v=1.5
|
||||
Reference in New Issue
Block a user