Character weapons implemented
This commit is contained in:
parent
ac6b50fa6a
commit
5b927b99a8
8 changed files with 3478 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
namespace Core.Config;
|
||||
public enum ConfigType
|
||||
{
|
||||
RoleInfo
|
||||
RoleInfo,
|
||||
Weapon
|
||||
}
|
||||
|
|
7
Core/Config/Types/PropConfig.cs
Normal file
7
Core/Config/Types/PropConfig.cs
Normal file
|
@ -0,0 +1,7 @@
|
|||
namespace Core.Config.Types;
|
||||
public class PropConfig
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public float Value { get; set; }
|
||||
public bool IsRatio { get; set; }
|
||||
}
|
47
Core/Config/WeaponConfig.cs
Normal file
47
Core/Config/WeaponConfig.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
using Core.Config.Attributes;
|
||||
using Core.Config.Types;
|
||||
|
||||
namespace Core.Config;
|
||||
|
||||
[ConfigCollection("weapon/weaponconf.json")]
|
||||
public class WeaponConfig : IConfig
|
||||
{
|
||||
public ConfigType Type => ConfigType.Weapon;
|
||||
|
||||
public int Identifier => ItemId;
|
||||
|
||||
public int ItemId { get; set; }
|
||||
public string WeaponName { get; set; } = string.Empty;
|
||||
public int QualityId { get; set; }
|
||||
public int WeaponType { get; set; }
|
||||
public int ModelId { get; set; }
|
||||
public int TransformId { get; set; }
|
||||
public List<int> Models { get; set; } = [];
|
||||
public int ResonLevelLimit { get; set; }
|
||||
public PropConfig? FirstPropId { get; set; }
|
||||
public int FirstCurve { get; set; }
|
||||
public PropConfig? SecondPropId { get; set; }
|
||||
public int SecondCurve { get; set; }
|
||||
public int ResonId { get; set; }
|
||||
public int LevelId { get; set; }
|
||||
public int BreachId { get; set; }
|
||||
public string Desc { get; set; } = string.Empty;
|
||||
public string TypeDescription { get; set; } = string.Empty;
|
||||
public string AttributesDescription { get; set; } = string.Empty;
|
||||
public string BgDescription { get; set; } = string.Empty;
|
||||
public string Icon { get; set; } = string.Empty;
|
||||
public string IconMiddle { get; set; } = string.Empty;
|
||||
public string IconSmall { get; set; } = string.Empty;
|
||||
public string Mesh { get; set; } = string.Empty;
|
||||
public int MaxCapcity { get; set; }
|
||||
public List<object> ItemAccess { get; set; } = [];
|
||||
public int ObtainedShow { get; set; }
|
||||
public string ObtainedShowDescription { get; set; } = string.Empty;
|
||||
public int NumLimit { get; set; }
|
||||
public bool ShowInBag { get; set; }
|
||||
public int SortIndex { get; set; }
|
||||
public string ResonanceIcon { get; set; } = string.Empty;
|
||||
public int HiddenTime { get; set; }
|
||||
public bool Destructible { get; set; }
|
||||
public int RedDotDisableRule { get; set; }
|
||||
}
|
|
@ -12,6 +12,10 @@
|
|||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="data\config\weapon\weaponconf.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
|
3379
Core/data/config/weapon/weaponconf.json
Normal file
3379
Core/data/config/weapon/weaponconf.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,5 @@
|
|||
using System.Security.Principal;
|
||||
using Core.Config;
|
||||
using GameServer.Controllers.Attributes;
|
||||
using GameServer.Models;
|
||||
using GameServer.Network;
|
||||
|
@ -14,12 +15,14 @@ internal class CreatureController : Controller
|
|||
private readonly EntitySystem _entitySystem;
|
||||
private readonly EntityFactory _entityFactory;
|
||||
private readonly ModelManager _modelManager;
|
||||
private readonly ConfigManager _configManager;
|
||||
|
||||
public CreatureController(PlayerSession session, EntitySystem entitySystem, EntityFactory entityFactory, ModelManager modelManager) : base(session)
|
||||
public CreatureController(PlayerSession session, EntitySystem entitySystem, EntityFactory entityFactory, ModelManager modelManager, ConfigManager configManager) : base(session)
|
||||
{
|
||||
_entitySystem = entitySystem;
|
||||
_entityFactory = entityFactory;
|
||||
_modelManager = modelManager;
|
||||
_configManager = configManager;
|
||||
}
|
||||
|
||||
public async Task JoinScene(int instanceId)
|
||||
|
@ -234,6 +237,11 @@ internal class CreatureController : Controller
|
|||
|
||||
_entitySystem.Create(entity);
|
||||
|
||||
// Give weapon to entity
|
||||
RoleInfoConfig roleConfig = _configManager.GetConfig<RoleInfoConfig>(entity.ConfigId)!;
|
||||
WeaponConfig weaponConfig = _configManager.GetCollection<WeaponConfig>().Enumerate<WeaponConfig>().First(weapon => weapon.WeaponType == roleConfig.WeaponType);
|
||||
entity.WeaponId = weaponConfig.ItemId;
|
||||
|
||||
if (i == 0) _modelManager.Creature.PlayerEntityId = entity.Id;
|
||||
}
|
||||
}
|
||||
|
|
22
GameServer/Systems/Entity/Component/EntityEquipComponent.cs
Normal file
22
GameServer/Systems/Entity/Component/EntityEquipComponent.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using Protocol;
|
||||
|
||||
namespace GameServer.Systems.Entity.Component;
|
||||
internal class EntityEquipComponent : EntityComponentBase
|
||||
{
|
||||
public int WeaponId { get; set; }
|
||||
|
||||
public EntityEquipComponent()
|
||||
{
|
||||
// EntityEquipComponent.
|
||||
}
|
||||
|
||||
public override EntityComponentType Type => EntityComponentType.Equip;
|
||||
|
||||
public override EntityComponentPb Pb => new()
|
||||
{
|
||||
EquipComponent = new EquipComponentPb
|
||||
{
|
||||
WeaponId = WeaponId
|
||||
}
|
||||
};
|
||||
}
|
|
@ -15,6 +15,12 @@ internal class PlayerEntity : EntityBase
|
|||
|
||||
public bool IsCurrentRole { get; set; }
|
||||
|
||||
public int WeaponId
|
||||
{
|
||||
get => ComponentSystem.Get<EntityEquipComponent>().WeaponId;
|
||||
set => ComponentSystem.Get<EntityEquipComponent>().WeaponId = value;
|
||||
}
|
||||
|
||||
public override void OnCreate()
|
||||
{
|
||||
base.OnCreate();
|
||||
|
@ -25,6 +31,8 @@ internal class PlayerEntity : EntityBase
|
|||
|
||||
EntityVisionSkillComponent visionSkillComponent = ComponentSystem.Create<EntityVisionSkillComponent>();
|
||||
visionSkillComponent.SetExploreTool(1001);
|
||||
|
||||
_ = ComponentSystem.Create<EntityEquipComponent>();
|
||||
}
|
||||
|
||||
public override void Activate()
|
||||
|
|
Loading…
Reference in a new issue