Concomitants partial support
This commit is contained in:
parent
d733766909
commit
ea0c2f95e6
2 changed files with 53 additions and 0 deletions
|
@ -249,6 +249,8 @@ internal class CreatureController : Controller
|
||||||
_entitySystem.Create(entity);
|
_entitySystem.Create(entity);
|
||||||
entity.InitProps(_configManager.GetConfig<BasePropertyConfig>(entity.ConfigId)!);
|
entity.InitProps(_configManager.GetConfig<BasePropertyConfig>(entity.ConfigId)!);
|
||||||
|
|
||||||
|
CreateConcomitants(entity);
|
||||||
|
|
||||||
// Give weapon to entity
|
// Give weapon to entity
|
||||||
RoleInfoConfig roleConfig = _configManager.GetConfig<RoleInfoConfig>(entity.ConfigId)!;
|
RoleInfoConfig roleConfig = _configManager.GetConfig<RoleInfoConfig>(entity.ConfigId)!;
|
||||||
WeaponConfig weaponConfig = _configManager.GetConfig<WeaponConfig>(roleConfig.InitWeaponItemId)!;
|
WeaponConfig weaponConfig = _configManager.GetConfig<WeaponConfig>(roleConfig.InitWeaponItemId)!;
|
||||||
|
@ -258,6 +260,32 @@ internal class CreatureController : Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CreateConcomitants(PlayerEntity entity)
|
||||||
|
{
|
||||||
|
(int roleId, int summonConfigId) = entity.ConfigId switch
|
||||||
|
{
|
||||||
|
1302 => (5002, 10070301),
|
||||||
|
_ => (-1, -1)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (roleId != -1)
|
||||||
|
{
|
||||||
|
PlayerEntity concomitant = _entityFactory.CreatePlayer(roleId, 0);
|
||||||
|
_entitySystem.Create(concomitant);
|
||||||
|
|
||||||
|
EntityConcomitantsComponent concomitants = entity.ComponentSystem.Get<EntityConcomitantsComponent>();
|
||||||
|
concomitants.CustomEntityIds.Clear();
|
||||||
|
concomitants.CustomEntityIds.Add(concomitant.Id);
|
||||||
|
|
||||||
|
EntitySummonerComponent summoner = concomitant.ComponentSystem.Create<EntitySummonerComponent>();
|
||||||
|
summoner.SummonerId = entity.Id;
|
||||||
|
summoner.SummonConfigId = summonConfigId;
|
||||||
|
summoner.SummonType = ESummonType.ConcomitantCustom;
|
||||||
|
summoner.PlayerId = _modelManager.Player.Id;
|
||||||
|
concomitant.InitProps(_configManager.GetConfig<BasePropertyConfig>(roleId)!);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CreateWorldEntities()
|
private void CreateWorldEntities()
|
||||||
{
|
{
|
||||||
Vector playerPos = _modelManager.Player.Position;
|
Vector playerPos = _modelManager.Player.Position;
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
using Protocol;
|
||||||
|
|
||||||
|
namespace GameServer.Systems.Entity.Component;
|
||||||
|
internal class EntitySummonerComponent : EntityComponentBase
|
||||||
|
{
|
||||||
|
public int SummonConfigId { get; set; }
|
||||||
|
public ESummonType SummonType { get; set; }
|
||||||
|
public long SummonerId { get; set; }
|
||||||
|
public int PlayerId { get; set; }
|
||||||
|
public int SummonSkillId { get; set; }
|
||||||
|
|
||||||
|
public override EntityComponentType Type => EntityComponentType.Summoner;
|
||||||
|
|
||||||
|
public override EntityComponentPb Pb => new()
|
||||||
|
{
|
||||||
|
SummonerComponent = new()
|
||||||
|
{
|
||||||
|
SummonCfgId = SummonConfigId,
|
||||||
|
Type = (int)SummonType,
|
||||||
|
SummonerId = SummonerId,
|
||||||
|
PlayerId = PlayerId,
|
||||||
|
SummonSkillId = SummonSkillId
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue