feat: grid fight orb & equipment

This commit is contained in:
Somebody
2025-11-16 12:36:14 +08:00
parent 29e4b574e1
commit aef3a94715
25 changed files with 1920 additions and 39 deletions

View File

@@ -70,4 +70,60 @@ public class CommandGrid : ICommand
await inst.GetComponent<GridFightBasicComponent>().UpdateGoldNum(gold);
await arg.SendMsg(I18NManager.Translate("Game.Command.Grid.UpdateGold", gold.ToString()));
}
[CommandMethod("equip")]
public async ValueTask AddEquipment(CommandArg arg)
{
if (arg.Target == null)
{
await arg.SendMsg(I18NManager.Translate("Game.Command.Notice.PlayerNotFound"));
return;
}
var inst = arg.Target.Player!.GridFightManager?.GridFightInstance;
if (inst == null)
{
await arg.SendMsg(I18NManager.Translate("Game.Command.Grid.NotInGame"));
return;
}
if (arg.BasicArgs.Count < 1)
{
await arg.SendMsg(I18NManager.Translate("Game.Command.Notice.InvalidArguments"));
return;
}
var equipmentId = (uint)arg.GetInt(0);
await inst.GetComponent<GridFightItemsComponent>().AddEquipment(equipmentId);
await arg.SendMsg(I18NManager.Translate("Game.Command.Grid.AddEquipment", equipmentId.ToString()));
}
[CommandMethod("orb")]
public async ValueTask AddOrb(CommandArg arg)
{
if (arg.Target == null)
{
await arg.SendMsg(I18NManager.Translate("Game.Command.Notice.PlayerNotFound"));
return;
}
var inst = arg.Target.Player!.GridFightManager?.GridFightInstance;
if (inst == null)
{
await arg.SendMsg(I18NManager.Translate("Game.Command.Grid.NotInGame"));
return;
}
if (arg.BasicArgs.Count < 1)
{
await arg.SendMsg(I18NManager.Translate("Game.Command.Notice.InvalidArguments"));
return;
}
var orbId = (uint)arg.GetInt(0);
await inst.GetComponent<GridFightOrbComponent>().AddOrb(orbId);
await arg.SendMsg(I18NManager.Translate("Game.Command.Grid.AddOrb", orbId.ToString()));
}
}

View File

@@ -0,0 +1,25 @@
using EggLink.DanhengServer.Enums.GridFight;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace EggLink.DanhengServer.Data.Excel;
[ResourceEntity("GridFightOrb.json")]
public class GridFightOrbExcel : ExcelResource
{
public uint BonusID { get; set; }
public uint OrbID { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
public GridFightOrbTypeEnum Type { get; set; }
public override int GetId()
{
return (int)OrbID;
}
public override void Loaded()
{
GameData.GridFightOrbData.TryAdd(OrbID, this);
}
}

View File

@@ -118,6 +118,7 @@ public static class GameData
public static Dictionary<uint, GridFightPlayerLevelExcel> GridFightPlayerLevelData { get; private set; } = [];
public static Dictionary<uint, GridFightMonsterExcel> GridFightMonsterData { get; private set; } = [];
public static Dictionary<uint, GridFightAugmentExcel> GridFightAugmentData { get; private set; } = [];
public static Dictionary<uint, GridFightOrbExcel> GridFightOrbData { get; private set; } = [];
public static Dictionary<uint, Dictionary<GridFightAugmentQualityEnum, GridFightAugmentMonsterExcel>> GridFightAugmentMonsterData { get; private set; } = [];
public static Dictionary<uint, GridFightPortalBuffExcel> GridFightPortalBuffData { get; private set; } = [];
public static Dictionary<uint, GridFightItemsExcel> GridFightItemsData { get; private set; } = [];

View File

@@ -0,0 +1,11 @@
namespace EggLink.DanhengServer.Enums.GridFight;
public enum GridFightOrbTypeEnum
{
White = 1,
Blue = 2,
Glod = 3, // lmao
Colorful = 4,
BigColorful = 5,
GoldenEgg = 6
}

View File

@@ -19,6 +19,7 @@ public class BattleGridFightOptions(GridFightGameSectionInfo curSection, GridFig
public GridFightBasicComponent BasicComponent { get; set; } = inst.GetComponent<GridFightBasicComponent>();
public GridFightAugmentComponent AugmentComponent { get; set; } = inst.GetComponent<GridFightAugmentComponent>();
public GridFightTraitComponent TraitComponent { get; set; } = inst.GetComponent<GridFightTraitComponent>();
public GridFightItemsComponent ItemsComponent { get; set; } = inst.GetComponent<GridFightItemsComponent>();
public GridFightGameSectionInfo CurSection { get; set; } = curSection;
public PlayerInstance Player { get; set; } = player;
@@ -66,7 +67,8 @@ public class BattleGridFightOptions(GridFightGameSectionInfo curSection, GridFig
{
BattleGridFightInfo = new SceneMonsterGridFightInfo
{
Tier = Math.Max(1, x.Tier)
Tier = Math.Max(1, x.Tier),
GridFightDropItemList = { x.DropItems }
}
}
})
@@ -90,7 +92,7 @@ public class BattleGridFightOptions(GridFightGameSectionInfo curSection, GridFig
{
GridGameAvatarList =
{
RoleComponent.Data.Roles.Where(x => x.Pos <= BasicComponent.GetFieldCount()).OrderBy(x => x.Pos).Select(x => x.ToBattleInfo())
RoleComponent.Data.Roles.Where(x => x.Pos <= BasicComponent.GetFieldCount()).OrderBy(x => x.Pos).Select(x => x.ToBattleInfo(ItemsComponent.Data))
},
GridFightCurLevel = BasicComponent.Data.CurLevel,
GridFightLineupHp = BasicComponent.Data.CurHp,

View File

@@ -17,7 +17,7 @@ public class GridFightBasicComponent(GridFightInstance inst) : BaseGridFightComp
CurHp = 100,
CurLevel = 3,
MaxAvatarNum = 3,
BuyLevelCost = 1,
BuyLevelCost = 4,
CurGold = 0
};
@@ -124,7 +124,6 @@ public class GridFightBasicComponent(GridFightInstance inst) : BaseGridFightComp
Data.CurLevel += level;
Data.BuyLevelCost = (uint)Math.Ceiling(Data.CurLevel / 2f);
Data.MaxAvatarNum = levelConf.AvatarMaxNumber;
if (sendPacket)

View File

@@ -0,0 +1,272 @@
using EggLink.DanhengServer.Data;
using EggLink.DanhengServer.GameServer.Game.GridFight.Sync;
using EggLink.DanhengServer.GameServer.Server.Packet.Send.GridFight;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Proto.ServerSide;
using System.Data.OscarClient;
using System.Threading;
namespace EggLink.DanhengServer.GameServer.Game.GridFight.Component;
public class GridFightItemsComponent(GridFightInstance inst) : BaseGridFightComponent(inst)
{
public GridFightItemsInfoPb Data { get; set; } = new();
public async ValueTask<(GridFightEquipmentItemPb?, List<BaseGridFightSyncData>)> AddEquipment(uint equipmentId, GridFightSrc src = GridFightSrc.KGridFightSrcNone, bool sendPacket = true, uint groupId = 0, params uint[] param)
{
if (!GameData.GridFightEquipmentData.ContainsKey(equipmentId))
return (null, []);
var roleComp = Inst.GetComponent<GridFightRoleComponent>();
var info = new GridFightEquipmentItemPb
{
ItemId = equipmentId,
UniqueId = ++roleComp.Data.CurUniqueId
};
Data.EquipmentItems.Add(info);
var syncData = new GridFightAddGameItemSyncData(src, [info], [], groupId, param);
if (sendPacket)
await Inst.Player.SendPacket(new PacketGridFightSyncUpdateResultScNotify(syncData));
return (info, [syncData]);
}
public async ValueTask<List<BaseGridFightSyncData>> UpdateConsumable(uint consumableId, int count, GridFightSrc src = GridFightSrc.KGridFightSrcNone, bool sendPacket = true, params uint[] param)
{
if (!GameData.GridFightConsumablesData.ContainsKey(consumableId) || count == 0)
return [];
var existingItem = Data.ConsumableItems.FirstOrDefault(x => x.ItemId == consumableId);
var isRemove = false;
if (existingItem != null)
{
if (count < 0)
{
count = (int)-Math.Min(existingItem.Count, -count);
existingItem.Count -= (uint)-count;
if (existingItem.Count == 0)
{
Data.ConsumableItems.Remove(existingItem);
}
isRemove = true;
}
else
{
existingItem.Count += (uint)count;
}
}
else
{
if (count < 0) return [];
var info = new GridFightConsumableItemPb
{
ItemId = consumableId,
Count = (uint)count // safe
};
Data.ConsumableItems.Add(info);
existingItem = info;
}
BaseGridFightSyncData syncData = isRemove
? new GridFightRemoveGameItemSyncData(src, [], [existingItem.ToUpdateInfo(count)], 0, param)
: new GridFightAddGameItemSyncData(src, [], [existingItem.ToUpdateInfo(count)], 0, param);
if (sendPacket)
await Inst.Player.SendPacket(new PacketGridFightSyncUpdateResultScNotify(syncData));
return [syncData];
}
public async ValueTask<List<BaseGridFightSyncData>> RemoveEquipment(uint uniqueId, GridFightSrc src = GridFightSrc.KGridFightSrcNone, bool sendPacket = true, params uint[] param)
{
var existingItem = Data.EquipmentItems.FirstOrDefault(x => x.UniqueId == uniqueId);
if (existingItem == null)
return [];
Data.EquipmentItems.Remove(existingItem);
List<BaseGridFightSyncData> syncDatas =
[
new GridFightRemoveGameItemSyncData(src, [existingItem], [], 0, param)
];
// if equipped
var roleComp = Inst.GetComponent<GridFightRoleComponent>();
foreach (var role in roleComp.Data.Roles)
{
if (!role.EquipmentIds.Contains(existingItem.ItemId)) continue;
role.EquipmentIds.Remove(existingItem.ItemId);
syncDatas.Add(new GridFightRoleUpdateSyncData(src, role.Clone(), 0, param));
}
if (sendPacket)
await Inst.Player.SendPacket(new PacketGridFightSyncUpdateResultScNotify(syncDatas));
return syncDatas;
}
public async ValueTask<List<BaseGridFightSyncData>> CraftEquipment(uint targetEquipId, List<uint> materials)
{
List<BaseGridFightSyncData> syncDatas = [];
// remove materials
foreach (var matId in materials)
{
syncDatas.AddRange(await RemoveEquipment(matId, GridFightSrc.KGridFightSrcCraftEquip, false));
}
// add crafted equipment
var addEquipDatas = await AddEquipment(targetEquipId, GridFightSrc.KGridFightSrcCraftEquip, false);
syncDatas.AddRange(addEquipDatas.Item2);
// if auto equip to a role
var roleComp = Inst.GetComponent<GridFightRoleComponent>();
var roleUnique =
(syncDatas.FirstOrDefault(x => x is GridFightRoleUpdateSyncData) as GridFightRoleUpdateSyncData)?.Role
.UniqueId ?? 0;
if (roleUnique != 0 && addEquipDatas.Item1 != null)
{
syncDatas.AddRange(await roleComp.DressRole(roleUnique, addEquipDatas.Item1.UniqueId, GridFightSrc.KGridFightSrcCraftEquip, false));
}
// sync
if (syncDatas.Count > 0)
await Inst.Player.SendPacket(new PacketGridFightSyncUpdateResultScNotify(syncDatas));
return syncDatas;
}
public async ValueTask<List<BaseGridFightSyncData>> TakeDrop(List<GridFightDropItemInfo> drops, bool sendPacket = false, GridFightSrc src = GridFightSrc.KGridFightSrcNone, uint groupId = 0, params uint[] param)
{
var syncs = new List<BaseGridFightSyncData>();
var basicComp = Inst.GetComponent<GridFightBasicComponent>();
var shopComp = Inst.GetComponent<GridFightShopComponent>();
var roleComp = Inst.GetComponent<GridFightRoleComponent>();
var orbComp = Inst.GetComponent<GridFightOrbComponent>();
foreach (var item in drops)
{
// take drop
switch (item.DropType)
{
case GridFightDropType.Coin:
{
await basicComp.UpdateGoldNum((int)item.Num, false);
syncs.Add(new GridFightGoldSyncData(src, basicComp.Data, groupId, param));
break;
}
case GridFightDropType.Exp:
{
await basicComp.AddLevelExp(item.Num, false);
syncs.Add(new GridFightPlayerLevelSyncData(src, basicComp.Data, groupId, param));
break;
}
case GridFightDropType.Refresh:
{
shopComp.Data.FreeRefreshCount += item.Num;
syncs.Add(new GridFightShopSyncData(src, shopComp.Data, basicComp.Data.CurLevel, groupId, param));
break;
}
case GridFightDropType.Role:
{
syncs.AddRange(await roleComp.AddAvatar(item.DropItemId, item.DisplayValue.Tier, false, true,
src, groupId, 0, param));
break;
}
case GridFightDropType.Item:
{
// consumable or equipment
if (GameData.GridFightConsumablesData.ContainsKey(item.DropItemId))
{
syncs.AddRange(await UpdateConsumable(item.DropItemId, (int)item.Num, src, false, param));
}
else if (GameData.GridFightEquipmentData.ContainsKey(item.DropItemId))
{
for (uint i = 0; i < item.Num; i++)
{
syncs.AddRange((await AddEquipment(item.DropItemId, src, false, groupId, param)).Item2);
}
}
break;
}
case GridFightDropType.Orb:
{
// add orbs
syncs.AddRange(await orbComp.AddOrb(item.DropItemId, src, false, groupId, param));
break;
}
}
}
if (sendPacket && syncs.Count > 0)
{
await Inst.Player.SendPacket(new PacketGridFightSyncUpdateResultScNotify(syncs));
}
return syncs;
}
public override GridFightGameInfo ToProto()
{
return new GridFightGameInfo
{
GridItemsInfo = new GridFightGameItemsInfo
{
GridFightEquipmentList = { Data.EquipmentItems.Select(x => x.ToProto()) },
GridFightConsumableList = { Data.ConsumableItems.Select(x => x.ToProto()) }
}
};
}
}
public static class GridFightItemsComponentExtensions
{
public static GridFightEquipmentInfo ToProto(this GridFightEquipmentItemPb equipment)
{
return new GridFightEquipmentInfo
{
GridFightEquipmentId = equipment.ItemId,
UniqueId = equipment.UniqueId
};
}
public static GridFightConsumableInfo ToProto(this GridFightConsumableItemPb consumable)
{
return new GridFightConsumableInfo
{
ItemId = consumable.ItemId,
Num = consumable.Count
};
}
public static GridFightConsumableUpdateInfo ToUpdateInfo(this GridFightConsumableItemPb consumable, int updateCount)
{
return new GridFightConsumableUpdateInfo
{
ItemId = consumable.ItemId,
Num = consumable.Count,
ItemStackCount = updateCount
};
}
public static BattleGridFightEquipmentInfo ToBattleInfo(this GridFightEquipmentItemPb equipment)
{
return new BattleGridFightEquipmentInfo
{
GridFightEquipmentId = equipment.ItemId,
UniqueId = equipment.UniqueId
};
}
}

View File

@@ -6,6 +6,7 @@ using EggLink.DanhengServer.GameServer.Game.GridFight.Sync;
using EggLink.DanhengServer.GameServer.Server.Packet.Send.GridFight;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Util;
using System.Collections.Generic;
namespace EggLink.DanhengServer.GameServer.Game.GridFight.Component;
@@ -18,6 +19,7 @@ public class GridFightLevelComponent : BaseGridFightComponent
public Dictionary<uint, List<GridFightGameSectionInfo>> Sections { get; } = [];
public GridFightGameSectionInfo CurrentSection => Sections[_curChapterId][(int)(_curSectionId - 1)];
public List<GridFightRoleDamageSttInfo> RoleDamageSttInfos { get; } = [];
public List<GridFightTraitDamageSttInfo> TraitDamageSttInfos { get; } = [];
public List<GridFightPortalBuffInfo> PortalBuffs { get; } = [];
#endregion
@@ -97,6 +99,39 @@ public class GridFightLevelComponent : BaseGridFightComponent
return (Retcode.RetSucc, res);
}
public async ValueTask<(Retcode, GridFightTraitDamageSttInfo?)> AddTraitDamageStt(uint traitId, double damage, bool sendPacket = true)
{
var info = TraitDamageSttInfos.FirstOrDefault(x => x.TraitId == traitId);
GridFightTraitDamageSttInfo res;
if (info == null)
{
res = info = new GridFightTraitDamageSttInfo
{
TraitId = traitId,
TotalDamage = damage
};
TraitDamageSttInfos.Add(info);
}
else
{
res = new GridFightTraitDamageSttInfo
{
TraitId = info.TraitId,
TotalDamage = damage
};
info.TotalDamage += damage;
}
if (sendPacket)
{
await Inst.Player.SendPacket(new PacketGridFightSyncUpdateResultScNotify(new GridFightRoleDamageSttSyncData(GridFightSrc.KGridFightSrcBattleEnd, this)));
}
return (Retcode.RetSucc, res);
}
#endregion
#region Actions
@@ -243,9 +278,12 @@ public class GridFightLevelComponent : BaseGridFightComponent
public GridFightDamageSttInfo ToDamageSttInfo()
{
var traitComp = Inst.GetComponent<GridFightTraitComponent>();
return new GridFightDamageSttInfo
{
RoleDamageSttList = { RoleDamageSttInfos.Select(x => x.ToProto()) }
RoleDamageSttList = { RoleDamageSttInfos.Select(x => x.ToProto()) },
TraitDamageSttList = { TraitDamageSttInfos.Select(x => x.ToProto(traitComp)) }
};
}
@@ -273,6 +311,22 @@ public class GridFightRoleDamageSttInfo
}
}
public class GridFightTraitDamageSttInfo
{
public uint TraitId { get; set; }
public double TotalDamage { get; set; }
public GridFightTraitDamageStt ToProto(GridFightTraitComponent trait)
{
return new GridFightTraitDamageStt
{
TraitId = TraitId,
Damage = TotalDamage,
TraitEffectLayer = trait.Data.Traits.FirstOrDefault(x => x.TraitId == TraitId)?.TraitLayer ?? 0
};
}
}
public class GridFightPortalBuffInfo
{
public uint PortalBuffId { get; set; }
@@ -333,7 +387,7 @@ public class GridFightGameSectionInfo
foreach (var diff in difficulties.OrderBy(_ => Guid.NewGuid()).Take(2))
{
Encounters.Add(new GridFightGameEncounterInfo(diff, diff, this));
Encounters.Add(new GridFightGameEncounterInfo(diff, diff, this, diff));
}
}
else
@@ -364,7 +418,7 @@ public class GridFightGameSectionInfo
public class GridFightGameEncounterInfo
{
public GridFightGameEncounterInfo(uint index, uint difficulty, GridFightGameSectionInfo section)
public GridFightGameEncounterInfo(uint index, uint difficulty, GridFightGameSectionInfo section, uint rewardLevel = 0)
{
EncounterIndex = index;
EncounterDifficulty = difficulty;
@@ -372,12 +426,126 @@ public class GridFightGameEncounterInfo
var waves = GridFightEncounterGenerateHelper.GenerateMonsterWaves(section);
MonsterWaves.AddRange(waves);
switch (rewardLevel)
{
case 0:
return;
// random 5 exp or 5 gold
case 1 when Random.Shared.Next(2) == 0:
DropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Exp,
Num = 5
});
break;
case 1:
DropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Coin,
Num = 5
});
break;
case 2:
{
// random 10 exp or 10 gold or 2 golden orb
var rand = Random.Shared.Next(3);
if (rand == 0)
{
DropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Exp,
Num = 10
});
}
else if (rand == 1)
{
DropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Coin,
Num = 10
});
}
else
{
for (var i = 0; i < 2; i++)
{
DropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Orb,
Num = 1,
DropItemId = GameData.GridFightOrbData.Values.Where(x => x.Type == GridFightOrbTypeEnum.Glod).ToList().RandomElement().OrbID
});
}
}
break;
}
case 3:
{
// random 15 exp or 15 gold or 2 colourful orb
var rand = Random.Shared.Next(3);
if (rand == 0)
{
DropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Exp,
Num = 15
});
}
else if (rand == 1)
{
DropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Coin,
Num = 15
});
}
else
{
for (var i = 0; i < 2; i++)
{
DropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Orb,
Num = 1,
DropItemId = GameData.GridFightOrbData.Values.Where(x => x.Type == GridFightOrbTypeEnum.Colorful).ToList().RandomElement().OrbID
});
}
}
break;
}
}
}
public uint EncounterIndex { get; set; }
public uint EncounterDifficulty { get; set; }
public GridFightGameSectionInfo ParentSection { get; }
public List<GridFightGameMonsterWaveInfo> MonsterWaves { get; } = [];
public List<GridFightDropItemInfo> DropItems { get; } = [];
public async ValueTask<(List<BaseGridFightSyncData>, List<GridFightDropItemInfo>)> TakeMonsterDrop(GridFightItemsComponent itemsComp)
{
List<BaseGridFightSyncData> syncs = [];
List<GridFightDropItemInfo> items = [];
foreach (var monster in MonsterWaves.SelectMany(x => x.Monsters))
{
syncs.AddRange(await itemsComp.TakeDrop(monster.DropItems, false, GridFightSrc.KGridFightSrcBattleEnd, 0,
ParentSection.ChapterId, ParentSection.SectionId));
items.AddRange(monster.DropItems);
}
return (syncs, items);
}
public async ValueTask<List<BaseGridFightSyncData>> TakeEncounterDrop(GridFightItemsComponent itemsComp)
{
return await itemsComp.TakeDrop(DropItems, false, GridFightSrc.KGridFightSrcEliteBranchBattleBonus, 0,
ParentSection.ChapterId, ParentSection.SectionId);
}
public GridFightEncounterInfo ToProto()
{
@@ -385,18 +553,46 @@ public class GridFightGameEncounterInfo
{
EncounterIndex = EncounterIndex,
EncounterExtraDifficultyLevel = EncounterDifficulty,
EncounterDropInfo = new GridFightDropInfo(),
EncounterDropInfo = new GridFightDropInfo
{
DropItemList = { DropItems }
},
MonsterWaveList = { MonsterWaves.Select(x => x.ToProto()) }
};
}
}
public class GridFightGameMonsterWaveInfo(uint wave, List<GridFightMonsterExcel> monsters, uint campId)
public class GridFightGameMonsterWaveInfo
{
public uint Wave { get; set; } = wave;
public GridFightGameMonsterWaveInfo(uint wave, List<GridFightMonsterExcel> monsters, uint campId,
uint addOrbNum = 0)
{
Wave = wave;
public List<GridFightGameMonsterInfo> Monsters { get; } = monsters
.Select(x => new GridFightGameMonsterInfo(x, campId, (uint)Random.Shared.Next(1, (int)(x.MonsterTier + 1)))).ToList();
foreach (var monsterInfo in monsters.Select(monster => new GridFightGameMonsterInfo(monster, campId,
(uint)Random.Shared.Next(1, (int)(monster.MonsterTier + 1)))))
{
if (addOrbNum > 0)
{
monsterInfo.DropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Orb,
Num = 1,
DropItemId = GameData.GridFightOrbData.Values
.Where(x => x.Type is GridFightOrbTypeEnum.White or GridFightOrbTypeEnum.Blue).ToList()
.RandomElement().OrbID
});
addOrbNum--;
}
Monsters.Add(monsterInfo);
}
}
public uint Wave { get; set; }
public List<GridFightGameMonsterInfo> Monsters { get; } = [];
public GridEncounterMonsterWave ToProto()
{
@@ -416,6 +612,7 @@ public class GridFightGameMonsterInfo(GridFightMonsterExcel monsters, uint campI
public uint CampId { get; set; } = campId;
public GridFightMonsterExcel Monster { get; } = monsters;
public uint Tier { get; } = tier;
public List<GridFightDropItemInfo> DropItems { get; } = [];
public GridFightMonsterInfo ToProto()
{
@@ -472,7 +669,7 @@ public static class GridFightEncounterGenerateHelper
targets.Add(monsters.RandomElement());
}
waves.Add(new GridFightGameMonsterWaveInfo(1, targets, section.MonsterCamp.ID));
waves.Add(new GridFightGameMonsterWaveInfo(1, targets, section.MonsterCamp.ID, 3));
return waves;
}

View File

@@ -0,0 +1,300 @@
using EggLink.DanhengServer.Data;
using EggLink.DanhengServer.Enums.GridFight;
using EggLink.DanhengServer.GameServer.Game.GridFight.Sync;
using EggLink.DanhengServer.GameServer.Server.Packet.Send.GridFight;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Proto.ServerSide;
using EggLink.DanhengServer.Util;
namespace EggLink.DanhengServer.GameServer.Game.GridFight.Component;
public class GridFightOrbComponent(GridFightInstance inst) : BaseGridFightComponent(inst)
{
public GridFightOrbInfoPb Data { get; set; } = new();
public async ValueTask<List<BaseGridFightSyncData>> AddOrb(uint orbItemId, GridFightSrc src = GridFightSrc.KGridFightSrcNone, bool sendPacket = true, uint groupId = 0, params uint[] param)
{
if (!GameData.GridFightOrbData.ContainsKey(orbItemId)) // sanity check
return [];
var roleComp = Inst.GetComponent<GridFightRoleComponent>();
var info = new GridFightGameOrbPb
{
OrbItemId = orbItemId,
UniqueId = ++roleComp.Data.CurUniqueId
};
Data.Orbs.Add(info);
var syncData = new GridFightOrbSyncData(src, info, groupId, param);
if (sendPacket)
await Inst.Player.SendPacket(new PacketGridFightSyncUpdateResultScNotify(syncData));
return [syncData];
}
public async ValueTask UseOrb(List<uint> uniqueIds)
{
List<BaseGridFightSyncData> syncDatas = [];
foreach (var uniqueId in uniqueIds)
{
var orb = Data.Orbs.FirstOrDefault(x => x.UniqueId == uniqueId);
if (orb == null) continue;
if (!GameData.GridFightOrbData.TryGetValue(orb.OrbItemId, out var excel)) continue;
Data.Orbs.Remove(orb);
syncDatas.Add(new GridFightRemoveOrbSyncData(GridFightSrc.KGridFightSrcUseOrb, orb, uniqueId, uniqueId, orb.OrbItemId));
// open orb effect
var res = await TakeOrbEffect(excel.Type, uniqueId);
syncDatas.AddRange(res.Item1);
await Inst.Player.SendPacket(new PacketGridFightUseOrbNotify(uniqueId, res.Item2));
}
if (syncDatas.Count > 0)
await Inst.Player.SendPacket(new PacketGridFightSyncUpdateResultScNotify(syncDatas));
}
private async ValueTask<(List<BaseGridFightSyncData>, List<GridFightDropItemInfo>)> TakeOrbEffect(GridFightOrbTypeEnum type, uint groupId)
{
List<BaseGridFightSyncData> syncDatas = [];
List<GridFightDropItemInfo> dropItems = [];
var basicComp = Inst.GetComponent<GridFightBasicComponent>();
var itemsComp = Inst.GetComponent<GridFightItemsComponent>();
var roleComp = Inst.GetComponent<GridFightRoleComponent>();
switch (type)
{
case GridFightOrbTypeEnum.White:
{
// 2 coin or 3 exp
if (Random.Shared.Next(2) == 0)
{
await basicComp.UpdateGoldNum(2, false, GridFightSrc.KGridFightSrcUseOrb);
syncDatas.Add(new GridFightGoldSyncData(GridFightSrc.KGridFightSrcUseOrb, basicComp.Data.Clone(),
groupId));
dropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Coin,
Num = 2
});
}
else
{
await basicComp.AddLevelExp(3, false);
syncDatas.Add(new GridFightPlayerLevelSyncData(GridFightSrc.KGridFightSrcUseOrb,
basicComp.Data.Clone(), groupId));
dropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Exp,
Num = 3
});
}
break;
}
case GridFightOrbTypeEnum.Blue:
{
// 1*1-tier 1~2-rarity role or 1*equipment
if (Random.Shared.Next(2) == 0)
{
var role = GameData.GridFightRoleBasicInfoData.Values.Where(x => x.Rarity <= 2).ToList()
.RandomElement();
// add role
syncDatas.AddRange(await roleComp.AddAvatar(role.ID, 1, false, true,
GridFightSrc.KGridFightSrcUseOrb, groupId));
dropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Role,
Num = 1,
DisplayValue = new GridDropItemDisplayInfo
{
Tier = 1
},
DropItemId = role.ID
});
}
else
{
// random equipment
var basicEquipment = GameData.GridFightEquipmentData.Values.Where(x =>
x.EquipCategory == GridFightEquipCategoryEnum.Basic).ToList().RandomElement();
// add equipment
syncDatas.AddRange((await itemsComp.AddEquipment(basicEquipment.ID,
GridFightSrc.KGridFightSrcUseOrb, false, groupId)).Item2);
dropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Item,
Num = 1,
DropItemId = basicEquipment.ID
});
}
break;
}
case GridFightOrbTypeEnum.Glod:
{
// 1*1~2-tier 3~4-rarity role or 2*equipment
if (Random.Shared.Next(2) == 0)
{
var role = GameData.GridFightRoleBasicInfoData.Values.Where(x => x.Rarity is >= 3 and <= 4).ToList()
.RandomElement();
// add role
var tier = (uint)Random.Shared.Next(1, 3);
syncDatas.AddRange(await roleComp.AddAvatar(role.ID, tier, false, true,
GridFightSrc.KGridFightSrcUseOrb, groupId));
dropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Role,
Num = 1,
DisplayValue = new GridDropItemDisplayInfo
{
Tier = tier
},
DropItemId = role.ID
});
}
else
{
// random 2 equipment
var basicEquipment = GameData.GridFightEquipmentData.Values.Where(x =>
x.EquipCategory == GridFightEquipCategoryEnum.Basic).ToList();
for (var i = 0; i < 2; i++)
{
// add equipment
var equip = basicEquipment.RandomElement();
syncDatas.AddRange((await itemsComp.AddEquipment(equip.ID,
GridFightSrc.KGridFightSrcUseOrb, false, groupId)).Item2);
dropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Item,
Num = 1,
DropItemId = equip.ID
});
}
}
break;
}
case GridFightOrbTypeEnum.Colorful:
{
// 1*2-tier 4-rarity role
var role = GameData.GridFightRoleBasicInfoData.Values.Where(x => x.Rarity == 4).ToList()
.RandomElement();
// add role
syncDatas.AddRange(await roleComp.AddAvatar(role.ID, 2, false, true,
GridFightSrc.KGridFightSrcUseOrb, groupId));
dropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Role,
Num = 1,
DisplayValue = new GridDropItemDisplayInfo
{
Tier = 2
},
DropItemId = role.ID
});
break;
}
case GridFightOrbTypeEnum.BigColorful:
{
// 1*2-tier 5-rarity role
var role = GameData.GridFightRoleBasicInfoData.Values.Where(x => x.Rarity == 5).ToList()
.RandomElement();
// add role
syncDatas.AddRange(await roleComp.AddAvatar(role.ID, 2, false, true, GridFightSrc.KGridFightSrcUseOrb,
groupId));
dropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Role,
Num = 1,
DisplayValue = new GridDropItemDisplayInfo
{
Tier = 2
},
DropItemId = role.ID
});
break;
}
case GridFightOrbTypeEnum.GoldenEgg:
{
// 1*3-tier 5-rarity role
var role = GameData.GridFightRoleBasicInfoData.Values.Where(x => x.Rarity == 5).ToList()
.RandomElement();
// add role
syncDatas.AddRange(await roleComp.AddAvatar(role.ID, 3, false, true,
GridFightSrc.KGridFightSrcUseOrb, groupId));
dropItems.Add(new GridFightDropItemInfo
{
DropType = GridFightDropType.Role,
Num = 1,
DisplayValue = new GridDropItemDisplayInfo
{
Tier = 3
},
DropItemId = role.ID
});
break;
}
}
return (syncDatas, dropItems);
}
public override GridFightGameInfo ToProto()
{
return new GridFightGameInfo
{
GridOrbInfo = new GridFightGameOrbInfo
{
GridGameOrbList = { Data.Orbs.Select(x => x.ToProto()) }
}
};
}
}
public static class GridFightOrbComponentExtensions
{
public static GridGameOrbInfo ToProto(this GridFightGameOrbPb orb)
{
return new GridGameOrbInfo
{
OrbItemId = orb.OrbItemId,
UniqueId = orb.UniqueId
};
}
public static GridFightOrbSyncInfo ToSyncInfo(this GridFightGameOrbPb orb)
{
return new GridFightOrbSyncInfo
{
OrbItemId = orb.OrbItemId,
UniqueId = orb.UniqueId
};
}
}

View File

@@ -162,6 +162,36 @@ public class GridFightRoleComponent(GridFightInstance inst) : BaseGridFightCompo
return syncs;
}
public async ValueTask<List<BaseGridFightSyncData>> DressRole(uint uniqueId, uint equipmentUniqueId,
GridFightSrc src = GridFightSrc.KGridFightSrcDressEquip,
bool sendPacket = true, params uint[] param)
{
var role = Data.Roles.FirstOrDefault(x => x.UniqueId == uniqueId);
if (role == null)
{
return [];
}
// check if equipment exists & not already dressed
var itemComp = Inst.GetComponent<GridFightItemsComponent>();
var equipment = itemComp.Data.EquipmentItems.FirstOrDefault(x => x.UniqueId == equipmentUniqueId);
if (equipment == null ||
Data.Roles.Any(x => x.EquipmentIds.Contains(equipmentUniqueId))) // already dressed or not exist
{
return [];
}
role.EquipmentIds.Add(equipmentUniqueId); // ensure no duplicates
var syncData = new GridFightRoleUpdateSyncData(src, role, 0, param);
if (sendPacket)
{
await Inst.Player.SendPacket(new PacketGridFightSyncUpdateResultScNotify(syncData));
}
return [syncData];
}
public List<BaseAvatarInfo> GetForegroundAvatarInfos()
{
var foreground = Data.Roles.Where(x => x.Pos <= 4).OrderBy(x => x.Pos).ToList();
@@ -275,7 +305,7 @@ public static class GridFightRoleInfoPbExtensions
};
}
public static BattleGridFightRoleInfo ToBattleInfo(this GridFightRoleInfoPb info)
public static BattleGridFightRoleInfo ToBattleInfo(this GridFightRoleInfoPb info, GridFightItemsInfoPb item)
{
return new BattleGridFightRoleInfo
{
@@ -284,7 +314,10 @@ public static class GridFightRoleInfoPbExtensions
Tier = info.Tier,
Pos = info.Pos,
AvatarId = GameData.GridFightRoleBasicInfoData[info.RoleId].AvatarID,
RoleEquipmentList = { },
RoleEquipmentList =
{
item.EquipmentItems.Where(x => info.EquipmentIds.Contains(x.UniqueId)).Select(x => x.ToBattleInfo())
},
GameSavedValueMap = { info.SavedValues }
};
}

View File

@@ -138,7 +138,7 @@ public static class GridFightTraitInfoPbExtensions
return new GridFightTraitEffectInfo
{
EffectId = info.EffectId,
EffectDnaNum = info.Param
TraitEffectLevelExp = info.Param
};
}

View File

@@ -6,6 +6,8 @@ using EggLink.DanhengServer.GameServer.Game.GridFight.Sync;
using EggLink.DanhengServer.GameServer.Game.Player;
using EggLink.DanhengServer.GameServer.Server.Packet.Send.GridFight;
using EggLink.DanhengServer.Proto;
using System.Collections.Generic;
using EggLink.DanhengServer.Util;
namespace EggLink.DanhengServer.GameServer.Game.GridFight;
@@ -33,9 +35,11 @@ public class GridFightInstance(PlayerInstance player, uint season, uint division
var basicComp = GetComponent<GridFightBasicComponent>();
var levelComp = GetComponent<GridFightLevelComponent>();
var itemsComponent = GetComponent<GridFightItemsComponent>();
var prevData = basicComp.Data.Clone();
var curEncounter = levelComp.CurrentSection.Encounters[(int)(levelComp.CurrentSection.BranchId - 1)];
var expNum = 5u;
var expNum = 2u;
var baseCoin = levelComp.CurrentSection.Excel.BasicGoldRewardNum;
var interestCoin = basicComp.Data.CurGold / 10;
@@ -70,11 +74,24 @@ public class GridFightInstance(PlayerInstance player, uint season, uint division
sttList.Add(res.Item2);
}
var curData = basicComp.Data.Clone();
await Player.SendPacket(new PacketGridFightEndBattleStageNotify(this, expNum, prevData, curData,
sttList, battle.BattleEndStatus == BattleEndStatus.BattleEndWin, baseCoin, interestCoin,
comboCoin));
List<GridFightTraitDamageSttInfo> traitSttList = [];
foreach (var traitBattleStt in req.Stt.GridFightBattleStt.TraitBattleStt)
{
var res = await levelComp.AddTraitDamageStt(traitBattleStt.TraitId, traitBattleStt.Damage, false);
if (res.Item2 != null)
traitSttList.Add(res.Item2);
}
var curData = basicComp.Data.Clone();
// if any drop
var drops = await curEncounter.TakeMonsterDrop(itemsComponent);
await Player.SendPacket(new PacketGridFightEndBattleStageNotify(this, expNum, prevData, curData,
sttList, traitSttList, battle.BattleEndStatus == BattleEndStatus.BattleEndWin, baseCoin, interestCoin,
comboCoin, drops.Item2));
syncs.AddRange(drops.Item1);
syncs.Add(new GridFightGoldSyncData(GridFightSrc.KGridFightSrcBattleEnd, basicComp.Data, 0, levelComp.CurrentSection.ChapterId, levelComp.CurrentSection.SectionId));
syncs.Add(new GridFightPlayerLevelSyncData(GridFightSrc.KGridFightSrcBattleEnd, basicComp.Data));
@@ -83,6 +100,9 @@ public class GridFightInstance(PlayerInstance player, uint season, uint division
syncs.Add(new GridFightRoleDamageSttSyncData(GridFightSrc.KGridFightSrcBattleEnd, levelComp));
syncs.AddRange(await levelComp.EnterNextSection(false));
// encounter drop
syncs.AddRange(await curEncounter.TakeEncounterDrop(itemsComponent));
await Player.SendPacket(new PacketGridFightSyncUpdateResultScNotify(syncs));
}
@@ -94,8 +114,9 @@ public class GridFightInstance(PlayerInstance player, uint season, uint division
Components.Add(new GridFightRoleComponent(this));
Components.Add(new GridFightAugmentComponent(this));
Components.Add(new GridFightTraitComponent(this));
Components.Add(new GridFightItemsComponent(this));
Components.Add(new GridFightOrbComponent(this));
_ = GetComponent<GridFightRoleComponent>().AddAvatar(1414, 3, false);
_ = GetComponent<GridFightShopComponent>().RefreshShop(true, false);
_ = CreatePendingAction<GridFightPortalBuffPendingAction>(sendPacket:false);
@@ -192,6 +213,7 @@ public class GridFightInstance(PlayerInstance player, uint season, uint division
{
var basicComp = GetComponent<GridFightBasicComponent>();
var levelComp = GetComponent<GridFightLevelComponent>();
var roleComp = GetComponent<GridFightRoleComponent>();
var curAction = GetCurAction();
@@ -206,11 +228,19 @@ public class GridFightInstance(PlayerInstance player, uint season, uint division
case GridFightHandlePendingActionCsReq.GridFightActionTypeOneofCase.PortalBuffAction:
src = GridFightSrc.KGridFightSrcSelectPortalBuff;
syncs.AddRange(await GetComponent<GridFightLevelComponent>().AddPortalBuff(req.PortalBuffAction.SelectPortalBuffId, false, src));
syncs.AddRange(await levelComp.AddPortalBuff(req.PortalBuffAction.SelectPortalBuffId, false, src));
// initial supply
await basicComp.UpdateGoldNum(5, false, GridFightSrc.KGridFightSrcInitialSupplySelect);
syncs.Add(new GridFightGoldSyncData(GridFightSrc.KGridFightSrcInitialSupplySelect, basicComp.Data));
var rolePool = GameData.GridFightRoleBasicInfoData.Values.Where(x => x.Rarity == 1).ToList();
for (var i = 0; i < 2; i++)
{
syncs.AddRange(await roleComp.AddAvatar(rolePool.RandomElement().ID, 1, false, true,
GridFightSrc.KGridFightSrcInitialSupplySelect));
}
break;
case GridFightHandlePendingActionCsReq.GridFightActionTypeOneofCase.PortalBuffRerollAction:
if (curAction is GridFightPortalBuffPendingAction portalBuffAction)

View File

@@ -0,0 +1,23 @@
using EggLink.DanhengServer.GameServer.Game.GridFight.Component;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Proto.ServerSide;
namespace EggLink.DanhengServer.GameServer.Game.GridFight.Sync;
public class GridFightAddGameItemSyncData(GridFightSrc src, List<GridFightEquipmentItemPb> equipment, List<GridFightConsumableUpdateInfo> consumables, uint groupId = 0, params uint[] syncParams) : BaseGridFightSyncData(src, groupId, syncParams)
{
public List<GridFightEquipmentItemPb> Equipment { get; } = equipment;
public List<GridFightConsumableUpdateInfo> Consumables { get; } = consumables;
public override GridFightSyncData ToProto()
{
return new GridFightSyncData
{
AddGameItemInfo = new GridFightGameItemSyncInfo
{
GridFightEquipmentList = { Equipment.Select(x => x.ToProto()) },
UpdateGridFightConsumableList = { Consumables }
}
};
}
}

View File

@@ -0,0 +1,16 @@
using EggLink.DanhengServer.GameServer.Game.GridFight.Component;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Proto.ServerSide;
namespace EggLink.DanhengServer.GameServer.Game.GridFight.Sync;
public class GridFightOrbSyncData(GridFightSrc src, GridFightGameOrbPb orb, uint groupId = 0, params uint[] syncParams) : BaseGridFightSyncData(src, groupId, syncParams)
{
public override GridFightSyncData ToProto()
{
return new GridFightSyncData
{
OrbSyncInfo = orb.ToSyncInfo()
};
}
}

View File

@@ -0,0 +1,23 @@
using EggLink.DanhengServer.GameServer.Game.GridFight.Component;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Proto.ServerSide;
namespace EggLink.DanhengServer.GameServer.Game.GridFight.Sync;
public class GridFightRemoveGameItemSyncData(GridFightSrc src, List<GridFightEquipmentItemPb> equipment, List<GridFightConsumableUpdateInfo> consumables, uint groupId = 0, params uint[] syncParams) : BaseGridFightSyncData(src, groupId, syncParams)
{
public List<GridFightEquipmentItemPb> Equipment { get; } = equipment;
public List<GridFightConsumableUpdateInfo> Consumables { get; } = consumables;
public override GridFightSyncData ToProto()
{
return new GridFightSyncData
{
RemoveGameItemInfo = new GridFightGameItemSyncInfo
{
GridFightEquipmentList = { Equipment.Select(x => x.ToProto()) },
UpdateGridFightConsumableList = { Consumables }
}
};
}
}

View File

@@ -0,0 +1,15 @@
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Proto.ServerSide;
namespace EggLink.DanhengServer.GameServer.Game.GridFight.Sync;
public class GridFightRemoveOrbSyncData(GridFightSrc src, GridFightGameOrbPb orb, uint groupId = 0, params uint[] syncParams) : BaseGridFightSyncData(src, groupId, syncParams)
{
public override GridFightSyncData ToProto()
{
return new GridFightSyncData
{
RemoveOrbUniqueId = orb.UniqueId
};
}
}

View File

@@ -6,11 +6,13 @@ namespace EggLink.DanhengServer.GameServer.Game.GridFight.Sync;
public class GridFightRoleUpdateSyncData(GridFightSrc src, GridFightRoleInfoPb role, uint groupId = 0, params uint[] param) : BaseGridFightSyncData(src, groupId, param)
{
public GridFightRoleInfoPb Role { get; set; } = role;
public override GridFightSyncData ToProto()
{
return new GridFightSyncData
{
UpdateRoleInfo = role.ToProto()
UpdateRoleInfo = Role.ToProto()
};
}
}

View File

@@ -0,0 +1,28 @@
using EggLink.DanhengServer.GameServer.Game.GridFight.Component;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Proto.ServerSide;
namespace EggLink.DanhengServer.GameServer.Game.GridFight.Sync;
public class GridFightUpdateGameItemSyncData(
GridFightSrc src,
List<GridFightEquipmentItemPb> equipment,
List<GridFightConsumableUpdateInfo> consumables,
uint groupId = 0,
params uint[] syncParams) : BaseGridFightSyncData(src, groupId, syncParams)
{
public List<GridFightEquipmentItemPb> Equipment { get; } = equipment;
public List<GridFightConsumableUpdateInfo> Consumables { get; } = consumables;
public override GridFightSyncData ToProto()
{
return new GridFightSyncData
{
UpdateGameItemInfo = new GridFightGameItemSyncInfo
{
GridFightEquipmentList = { Equipment.Select(x => x.ToProto()) },
UpdateGridFightConsumableList = { Consumables }
}
};
}
}

View File

@@ -0,0 +1,26 @@
using EggLink.DanhengServer.GameServer.Game.GridFight.Component;
using EggLink.DanhengServer.Kcp;
using EggLink.DanhengServer.Proto;
namespace EggLink.DanhengServer.GameServer.Server.Packet.Recv.GridFight;
[Opcode(CmdIds.GridFightEquipCraftCsReq)]
public class HandlerGridFightEquipCraftCsReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
var req = GridFightEquipCraftCsReq.Parser.ParseFrom(data);
var inst = connection.Player!.GridFightManager!.GridFightInstance;
if (inst == null)
{
await connection.SendPacket(CmdIds.GridFightEquipCraftScRsp);
return;
}
var component = inst.GetComponent<GridFightItemsComponent>();
await component.CraftEquipment(req.CraftEquipId, req.CraftMaterials.ToList());
await connection.SendPacket(CmdIds.GridFightEquipCraftScRsp);
}
}

View File

@@ -0,0 +1,26 @@
using EggLink.DanhengServer.GameServer.Game.GridFight.Component;
using EggLink.DanhengServer.Kcp;
using EggLink.DanhengServer.Proto;
namespace EggLink.DanhengServer.GameServer.Server.Packet.Recv.GridFight;
[Opcode(CmdIds.GridFightEquipDressCsReq)]
public class HandlerGridFightEquipDressCsReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
var req = GridFightEquipDressCsReq.Parser.ParseFrom(data);
var inst = connection.Player!.GridFightManager!.GridFightInstance;
if (inst == null)
{
await connection.SendPacket(CmdIds.GridFightEquipDressScRsp);
return;
}
var component = inst.GetComponent<GridFightRoleComponent>();
await component.DressRole(req.DressRoleUniqueId, req.DressEquipmentUniqueId, GridFightSrc.KGridFightSrcDressEquip, true, 1);
await connection.SendPacket(CmdIds.GridFightEquipDressScRsp);
}
}

View File

@@ -0,0 +1,26 @@
using EggLink.DanhengServer.GameServer.Game.GridFight.Component;
using EggLink.DanhengServer.Kcp;
using EggLink.DanhengServer.Proto;
namespace EggLink.DanhengServer.GameServer.Server.Packet.Recv.GridFight;
[Opcode(CmdIds.GridFightUseOrbCsReq)]
public class HandlerGridFightUseOrbCsReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
var req = GridFightUseOrbCsReq.Parser.ParseFrom(data);
var inst = connection.Player!.GridFightManager!.GridFightInstance;
if (inst == null)
{
await connection.SendPacket(CmdIds.GridFightUseOrbScRsp);
return;
}
var component = inst.GetComponent<GridFightOrbComponent>();
await component.UseOrb(req.TargetOrbUniqueIdList.ToList());
await connection.SendPacket(CmdIds.GridFightUseOrbScRsp);
}
}

View File

@@ -10,10 +10,11 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.GridFight;
public class PacketGridFightEndBattleStageNotify : BasePacket
{
public PacketGridFightEndBattleStageNotify(GridFightInstance inst, uint expAddNum, GridFightBasicInfoPb prev,
GridFightBasicInfoPb cur, List<GridFightRoleDamageSttInfo> stt, bool win, uint baseCoin, uint interestCoin,
uint comboCoin) : base(CmdIds.GridFightEndBattleStageNotify)
GridFightBasicInfoPb cur, List<GridFightRoleDamageSttInfo> stt, List<GridFightTraitDamageSttInfo> traitStt, bool win, uint baseCoin, uint interestCoin,
uint comboCoin, List<GridFightDropItemInfo> drops) : base(CmdIds.GridFightEndBattleStageNotify)
{
var levelComp = inst.GetComponent<GridFightLevelComponent>();
var traitComp = inst.GetComponent<GridFightTraitComponent>();
var curSec = levelComp.CurrentSection;
var proto = new GridFightEndBattleStageNotify
@@ -23,7 +24,8 @@ public class PacketGridFightEndBattleStageNotify : BasePacket
ChapterId = curSec.ChapterId,
GridFightDamageSttInfo = new GridFightDamageSttInfo
{
RoleDamageSttList = { stt.Select(x => x.ToProto()) }
RoleDamageSttList = { stt.Select(x => x.ToProto()) },
TraitDamageSttList = { traitStt.Select(x => x.ToProto(traitComp)) }
},
GridFightLevelUpdateInfo = new GridFightLevelUpdateInfo
{
@@ -48,7 +50,16 @@ public class PacketGridFightEndBattleStageNotify : BasePacket
GridFightCoinInterestNum = interestCoin,
GridFightCoinComboNum = comboCoin,
GridFightCurLineupHp = cur.CurHp,
GridFightMaxLineupHp = GridFightBasicComponent.MaxHp
GridFightMaxLineupHp = GridFightBasicComponent.MaxHp,
GridFightDropItemMap =
{
{
2, new GridFightDropInfo
{
DropItemList = { drops }
}
}
}
};
SetData(proto);

View File

@@ -0,0 +1,21 @@
using EggLink.DanhengServer.Kcp;
using EggLink.DanhengServer.Proto;
namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.GridFight;
public class PacketGridFightUseOrbNotify : BasePacket
{
public PacketGridFightUseOrbNotify(uint uniqueId, List<GridFightDropItemInfo> drops) : base(CmdIds.GridFightUseOrbNotify)
{
var proto = new GridFightUseOrbNotify
{
DropItemList = new GridFightDropInfo
{
DropItemList = { drops }
},
OrbUniqueId = uniqueId
};
SetData(proto);
}
}

View File

@@ -58,15 +58,22 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
"aWdodEdhbWVUcmFpdFBiEg8KB1RyYWl0SWQYASABKA0SLAoHRWZmZWN0cxgC",
"IAMoCzIbLkdyaWRGaWdodEdhbWVUcmFpdEVmZmVjdFBiEhIKClRyYWl0TGF5",
"ZXIYAyABKA0iPQoUR3JpZEZpZ2h0VHJhaXRJbmZvUGISJQoGVHJhaXRzGAEg",
"AygLMhUuR3JpZEZpZ2h0R2FtZVRyYWl0UGIirwIKFEdyaWRGaWdodENvbXBv",
"bmVudFBiEigKCFNob3BJbmZvGAEgASgLMhQuR3JpZEZpZ2h0U2hvcEluZm9Q",
"YkgAEioKCUJhc2ljSW5mbxgCIAEoCzIVLkdyaWRGaWdodEJhc2ljSW5mb1Bi",
"SAASLAoKQXZhdGFySW5mbxgDIAEoCzIWLkdyaWRGaWdodEF2YXRhckluZm9Q",
"YkgAEiYKB09yYkluZm8YBCABKAsyEy5HcmlkRmlnaHRPcmJJbmZvUGJIABIu",
"CgtBdWdtZW50SW5mbxgFIAEoCzIXLkdyaWRGaWdodEF1Z21lbnRJbmZvUGJI",
"ABIqCglUcmFpdEluZm8YBiABKAsyFS5HcmlkRmlnaHRUcmFpdEluZm9QYkgA",
"Qg8KDUNvbXBvbmVudFR5cGVCKaoCJkVnZ0xpbmsuRGFuaGVuZ1NlcnZlci5Q",
"cm90by5TZXJ2ZXJTaWRlYgZwcm90bzM="));
"AygLMhUuR3JpZEZpZ2h0R2FtZVRyYWl0UGIiPAoYR3JpZEZpZ2h0RXF1aXBt",
"ZW50SXRlbVBiEg4KBkl0ZW1JZBgBIAEoDRIQCghVbmlxdWVJZBgCIAEoDSI6",
"ChlHcmlkRmlnaHRDb25zdW1hYmxlSXRlbVBiEg4KBkl0ZW1JZBgBIAEoDRIN",
"CgVDb3VudBgCIAEoDSJ+ChRHcmlkRmlnaHRJdGVtc0luZm9QYhIxCg5FcXVp",
"cG1lbnRJdGVtcxgBIAMoCzIZLkdyaWRGaWdodEVxdWlwbWVudEl0ZW1QYhIz",
"Cg9Db25zdW1hYmxlSXRlbXMYAiADKAsyGi5HcmlkRmlnaHRDb25zdW1hYmxl",
"SXRlbVBiItsCChRHcmlkRmlnaHRDb21wb25lbnRQYhIoCghTaG9wSW5mbxgB",
"IAEoCzIULkdyaWRGaWdodFNob3BJbmZvUGJIABIqCglCYXNpY0luZm8YAiAB",
"KAsyFS5HcmlkRmlnaHRCYXNpY0luZm9QYkgAEiwKCkF2YXRhckluZm8YAyAB",
"KAsyFi5HcmlkRmlnaHRBdmF0YXJJbmZvUGJIABImCgdPcmJJbmZvGAQgASgL",
"MhMuR3JpZEZpZ2h0T3JiSW5mb1BiSAASLgoLQXVnbWVudEluZm8YBSABKAsy",
"Fy5HcmlkRmlnaHRBdWdtZW50SW5mb1BiSAASKgoJVHJhaXRJbmZvGAYgASgL",
"MhUuR3JpZEZpZ2h0VHJhaXRJbmZvUGJIABIqCglJdGVtc0luZm8YByABKAsy",
"FS5HcmlkRmlnaHRJdGVtc0luZm9QYkgAQg8KDUNvbXBvbmVudFR5cGVCKaoC",
"JkVnZ0xpbmsuRGFuaGVuZ1NlcnZlci5Qcm90by5TZXJ2ZXJTaWRlYgZwcm90",
"bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
@@ -84,7 +91,10 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightGameTraitEffectPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightGameTraitEffectPb.Parser, new[]{ "TraitId", "EffectId", "Param" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightGameTraitPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightGameTraitPb.Parser, new[]{ "TraitId", "Effects", "TraitLayer" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightTraitInfoPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightTraitInfoPb.Parser, new[]{ "Traits" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightComponentPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightComponentPb.Parser, new[]{ "ShopInfo", "BasicInfo", "AvatarInfo", "OrbInfo", "AugmentInfo", "TraitInfo" }, new[]{ "ComponentType" }, null, null, null)
new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightEquipmentItemPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightEquipmentItemPb.Parser, new[]{ "ItemId", "UniqueId" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightConsumableItemPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightConsumableItemPb.Parser, new[]{ "ItemId", "Count" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightItemsInfoPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightItemsInfoPb.Parser, new[]{ "EquipmentItems", "ConsumableItems" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightComponentPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightComponentPb.Parser, new[]{ "ShopInfo", "BasicInfo", "AvatarInfo", "OrbInfo", "AugmentInfo", "TraitInfo", "ItemsInfo" }, new[]{ "ComponentType" }, null, null, null)
}));
}
#endregion
@@ -3796,6 +3806,665 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
}
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class GridFightEquipmentItemPb : pb::IMessage<GridFightEquipmentItemPb>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<GridFightEquipmentItemPb> _parser = new pb::MessageParser<GridFightEquipmentItemPb>(() => new GridFightEquipmentItemPb());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<GridFightEquipmentItemPb> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::EggLink.DanhengServer.Proto.ServerSide.GridFightDataReflection.Descriptor.MessageTypes[14]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public GridFightEquipmentItemPb() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public GridFightEquipmentItemPb(GridFightEquipmentItemPb other) : this() {
itemId_ = other.itemId_;
uniqueId_ = other.uniqueId_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public GridFightEquipmentItemPb Clone() {
return new GridFightEquipmentItemPb(this);
}
/// <summary>Field number for the "ItemId" field.</summary>
public const int ItemIdFieldNumber = 1;
private uint itemId_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public uint ItemId {
get { return itemId_; }
set {
itemId_ = value;
}
}
/// <summary>Field number for the "UniqueId" field.</summary>
public const int UniqueIdFieldNumber = 2;
private uint uniqueId_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public uint UniqueId {
get { return uniqueId_; }
set {
uniqueId_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as GridFightEquipmentItemPb);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(GridFightEquipmentItemPb other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (ItemId != other.ItemId) return false;
if (UniqueId != other.UniqueId) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (ItemId != 0) hash ^= ItemId.GetHashCode();
if (UniqueId != 0) hash ^= UniqueId.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (ItemId != 0) {
output.WriteRawTag(8);
output.WriteUInt32(ItemId);
}
if (UniqueId != 0) {
output.WriteRawTag(16);
output.WriteUInt32(UniqueId);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (ItemId != 0) {
output.WriteRawTag(8);
output.WriteUInt32(ItemId);
}
if (UniqueId != 0) {
output.WriteRawTag(16);
output.WriteUInt32(UniqueId);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (ItemId != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(ItemId);
}
if (UniqueId != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(UniqueId);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(GridFightEquipmentItemPb other) {
if (other == null) {
return;
}
if (other.ItemId != 0) {
ItemId = other.ItemId;
}
if (other.UniqueId != 0) {
UniqueId = other.UniqueId;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
ItemId = input.ReadUInt32();
break;
}
case 16: {
UniqueId = input.ReadUInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
ItemId = input.ReadUInt32();
break;
}
case 16: {
UniqueId = input.ReadUInt32();
break;
}
}
}
}
#endif
}
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class GridFightConsumableItemPb : pb::IMessage<GridFightConsumableItemPb>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<GridFightConsumableItemPb> _parser = new pb::MessageParser<GridFightConsumableItemPb>(() => new GridFightConsumableItemPb());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<GridFightConsumableItemPb> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::EggLink.DanhengServer.Proto.ServerSide.GridFightDataReflection.Descriptor.MessageTypes[15]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public GridFightConsumableItemPb() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public GridFightConsumableItemPb(GridFightConsumableItemPb other) : this() {
itemId_ = other.itemId_;
count_ = other.count_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public GridFightConsumableItemPb Clone() {
return new GridFightConsumableItemPb(this);
}
/// <summary>Field number for the "ItemId" field.</summary>
public const int ItemIdFieldNumber = 1;
private uint itemId_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public uint ItemId {
get { return itemId_; }
set {
itemId_ = value;
}
}
/// <summary>Field number for the "Count" field.</summary>
public const int CountFieldNumber = 2;
private uint count_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public uint Count {
get { return count_; }
set {
count_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as GridFightConsumableItemPb);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(GridFightConsumableItemPb other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (ItemId != other.ItemId) return false;
if (Count != other.Count) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (ItemId != 0) hash ^= ItemId.GetHashCode();
if (Count != 0) hash ^= Count.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (ItemId != 0) {
output.WriteRawTag(8);
output.WriteUInt32(ItemId);
}
if (Count != 0) {
output.WriteRawTag(16);
output.WriteUInt32(Count);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (ItemId != 0) {
output.WriteRawTag(8);
output.WriteUInt32(ItemId);
}
if (Count != 0) {
output.WriteRawTag(16);
output.WriteUInt32(Count);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (ItemId != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(ItemId);
}
if (Count != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Count);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(GridFightConsumableItemPb other) {
if (other == null) {
return;
}
if (other.ItemId != 0) {
ItemId = other.ItemId;
}
if (other.Count != 0) {
Count = other.Count;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
ItemId = input.ReadUInt32();
break;
}
case 16: {
Count = input.ReadUInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
ItemId = input.ReadUInt32();
break;
}
case 16: {
Count = input.ReadUInt32();
break;
}
}
}
}
#endif
}
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class GridFightItemsInfoPb : pb::IMessage<GridFightItemsInfoPb>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<GridFightItemsInfoPb> _parser = new pb::MessageParser<GridFightItemsInfoPb>(() => new GridFightItemsInfoPb());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<GridFightItemsInfoPb> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::EggLink.DanhengServer.Proto.ServerSide.GridFightDataReflection.Descriptor.MessageTypes[16]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public GridFightItemsInfoPb() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public GridFightItemsInfoPb(GridFightItemsInfoPb other) : this() {
equipmentItems_ = other.equipmentItems_.Clone();
consumableItems_ = other.consumableItems_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public GridFightItemsInfoPb Clone() {
return new GridFightItemsInfoPb(this);
}
/// <summary>Field number for the "EquipmentItems" field.</summary>
public const int EquipmentItemsFieldNumber = 1;
private static readonly pb::FieldCodec<global::EggLink.DanhengServer.Proto.ServerSide.GridFightEquipmentItemPb> _repeated_equipmentItems_codec
= pb::FieldCodec.ForMessage(10, global::EggLink.DanhengServer.Proto.ServerSide.GridFightEquipmentItemPb.Parser);
private readonly pbc::RepeatedField<global::EggLink.DanhengServer.Proto.ServerSide.GridFightEquipmentItemPb> equipmentItems_ = new pbc::RepeatedField<global::EggLink.DanhengServer.Proto.ServerSide.GridFightEquipmentItemPb>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::EggLink.DanhengServer.Proto.ServerSide.GridFightEquipmentItemPb> EquipmentItems {
get { return equipmentItems_; }
}
/// <summary>Field number for the "ConsumableItems" field.</summary>
public const int ConsumableItemsFieldNumber = 2;
private static readonly pb::FieldCodec<global::EggLink.DanhengServer.Proto.ServerSide.GridFightConsumableItemPb> _repeated_consumableItems_codec
= pb::FieldCodec.ForMessage(18, global::EggLink.DanhengServer.Proto.ServerSide.GridFightConsumableItemPb.Parser);
private readonly pbc::RepeatedField<global::EggLink.DanhengServer.Proto.ServerSide.GridFightConsumableItemPb> consumableItems_ = new pbc::RepeatedField<global::EggLink.DanhengServer.Proto.ServerSide.GridFightConsumableItemPb>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::EggLink.DanhengServer.Proto.ServerSide.GridFightConsumableItemPb> ConsumableItems {
get { return consumableItems_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as GridFightItemsInfoPb);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(GridFightItemsInfoPb other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if(!equipmentItems_.Equals(other.equipmentItems_)) return false;
if(!consumableItems_.Equals(other.consumableItems_)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
hash ^= equipmentItems_.GetHashCode();
hash ^= consumableItems_.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
equipmentItems_.WriteTo(output, _repeated_equipmentItems_codec);
consumableItems_.WriteTo(output, _repeated_consumableItems_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
equipmentItems_.WriteTo(ref output, _repeated_equipmentItems_codec);
consumableItems_.WriteTo(ref output, _repeated_consumableItems_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
size += equipmentItems_.CalculateSize(_repeated_equipmentItems_codec);
size += consumableItems_.CalculateSize(_repeated_consumableItems_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(GridFightItemsInfoPb other) {
if (other == null) {
return;
}
equipmentItems_.Add(other.equipmentItems_);
consumableItems_.Add(other.consumableItems_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
equipmentItems_.AddEntriesFrom(input, _repeated_equipmentItems_codec);
break;
}
case 18: {
consumableItems_.AddEntriesFrom(input, _repeated_consumableItems_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
equipmentItems_.AddEntriesFrom(ref input, _repeated_equipmentItems_codec);
break;
}
case 18: {
consumableItems_.AddEntriesFrom(ref input, _repeated_consumableItems_codec);
break;
}
}
}
}
#endif
}
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class GridFightComponentPb : pb::IMessage<GridFightComponentPb>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
@@ -3811,7 +4480,7 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::EggLink.DanhengServer.Proto.ServerSide.GridFightDataReflection.Descriptor.MessageTypes[14]; }
get { return global::EggLink.DanhengServer.Proto.ServerSide.GridFightDataReflection.Descriptor.MessageTypes[17]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3850,6 +4519,9 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
case ComponentTypeOneofCase.TraitInfo:
TraitInfo = other.TraitInfo.Clone();
break;
case ComponentTypeOneofCase.ItemsInfo:
ItemsInfo = other.ItemsInfo.Clone();
break;
}
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
@@ -3933,6 +4605,18 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
}
}
/// <summary>Field number for the "ItemsInfo" field.</summary>
public const int ItemsInfoFieldNumber = 7;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::EggLink.DanhengServer.Proto.ServerSide.GridFightItemsInfoPb ItemsInfo {
get { return componentTypeCase_ == ComponentTypeOneofCase.ItemsInfo ? (global::EggLink.DanhengServer.Proto.ServerSide.GridFightItemsInfoPb) componentType_ : null; }
set {
componentType_ = value;
componentTypeCase_ = value == null ? ComponentTypeOneofCase.None : ComponentTypeOneofCase.ItemsInfo;
}
}
private object componentType_;
/// <summary>Enum of possible cases for the "ComponentType" oneof.</summary>
public enum ComponentTypeOneofCase {
@@ -3943,6 +4627,7 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
OrbInfo = 4,
AugmentInfo = 5,
TraitInfo = 6,
ItemsInfo = 7,
}
private ComponentTypeOneofCase componentTypeCase_ = ComponentTypeOneofCase.None;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3979,6 +4664,7 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
if (!object.Equals(OrbInfo, other.OrbInfo)) return false;
if (!object.Equals(AugmentInfo, other.AugmentInfo)) return false;
if (!object.Equals(TraitInfo, other.TraitInfo)) return false;
if (!object.Equals(ItemsInfo, other.ItemsInfo)) return false;
if (ComponentTypeCase != other.ComponentTypeCase) return false;
return Equals(_unknownFields, other._unknownFields);
}
@@ -3993,6 +4679,7 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
if (componentTypeCase_ == ComponentTypeOneofCase.OrbInfo) hash ^= OrbInfo.GetHashCode();
if (componentTypeCase_ == ComponentTypeOneofCase.AugmentInfo) hash ^= AugmentInfo.GetHashCode();
if (componentTypeCase_ == ComponentTypeOneofCase.TraitInfo) hash ^= TraitInfo.GetHashCode();
if (componentTypeCase_ == ComponentTypeOneofCase.ItemsInfo) hash ^= ItemsInfo.GetHashCode();
hash ^= (int) componentTypeCase_;
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
@@ -4036,6 +4723,10 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
output.WriteRawTag(50);
output.WriteMessage(TraitInfo);
}
if (componentTypeCase_ == ComponentTypeOneofCase.ItemsInfo) {
output.WriteRawTag(58);
output.WriteMessage(ItemsInfo);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
@@ -4070,6 +4761,10 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
output.WriteRawTag(50);
output.WriteMessage(TraitInfo);
}
if (componentTypeCase_ == ComponentTypeOneofCase.ItemsInfo) {
output.WriteRawTag(58);
output.WriteMessage(ItemsInfo);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
@@ -4098,6 +4793,9 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
if (componentTypeCase_ == ComponentTypeOneofCase.TraitInfo) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(TraitInfo);
}
if (componentTypeCase_ == ComponentTypeOneofCase.ItemsInfo) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(ItemsInfo);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
@@ -4147,6 +4845,12 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
}
TraitInfo.MergeFrom(other.TraitInfo);
break;
case ComponentTypeOneofCase.ItemsInfo:
if (ItemsInfo == null) {
ItemsInfo = new global::EggLink.DanhengServer.Proto.ServerSide.GridFightItemsInfoPb();
}
ItemsInfo.MergeFrom(other.ItemsInfo);
break;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
@@ -4218,6 +4922,15 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
TraitInfo = subBuilder;
break;
}
case 58: {
global::EggLink.DanhengServer.Proto.ServerSide.GridFightItemsInfoPb subBuilder = new global::EggLink.DanhengServer.Proto.ServerSide.GridFightItemsInfoPb();
if (componentTypeCase_ == ComponentTypeOneofCase.ItemsInfo) {
subBuilder.MergeFrom(ItemsInfo);
}
input.ReadMessage(subBuilder);
ItemsInfo = subBuilder;
break;
}
}
}
#endif
@@ -4287,6 +5000,15 @@ namespace EggLink.DanhengServer.Proto.ServerSide {
TraitInfo = subBuilder;
break;
}
case 58: {
global::EggLink.DanhengServer.Proto.ServerSide.GridFightItemsInfoPb subBuilder = new global::EggLink.DanhengServer.Proto.ServerSide.GridFightItemsInfoPb();
if (componentTypeCase_ == ComponentTypeOneofCase.ItemsInfo) {
subBuilder.MergeFrom(ItemsInfo);
}
input.ReadMessage(subBuilder);
ItemsInfo = subBuilder;
break;
}
}
}
}

View File

@@ -90,6 +90,21 @@ message GridFightTraitInfoPb {
repeated GridFightGameTraitPb Traits = 1;
}
message GridFightEquipmentItemPb {
uint32 ItemId = 1;
uint32 UniqueId = 2;
}
message GridFightConsumableItemPb {
uint32 ItemId = 1;
uint32 Count = 2;
}
message GridFightItemsInfoPb {
repeated GridFightEquipmentItemPb EquipmentItems = 1;
repeated GridFightConsumableItemPb ConsumableItems = 2;
}
message GridFightComponentPb {
oneof ComponentType {
GridFightShopInfoPb ShopInfo = 1;
@@ -98,5 +113,6 @@ message GridFightComponentPb {
GridFightOrbInfoPb OrbInfo = 4;
GridFightAugmentInfoPb AugmentInfo = 5;
GridFightTraitInfoPb TraitInfo = 6;
GridFightItemsInfoPb ItemsInfo = 7;
}
}