Weapon inventory (unlock all + switching)
This commit is contained in:
parent
e70c6aa946
commit
1bd1931807
9 changed files with 468 additions and 186 deletions
|
@ -16,7 +16,12 @@ public class ConfigManager
|
||||||
logger.LogInformation("Loaded {count} config collections", _collectionsByEnum.Count);
|
logger.LogInformation("Loaded {count} config collections", _collectionsByEnum.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigCollection GetCollection<TConfigType>()
|
public IEnumerable<TConfig> Enumerate<TConfig>() where TConfig : IConfig
|
||||||
|
{
|
||||||
|
return GetCollection<TConfig>().Enumerate<TConfig>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfigCollection GetCollection<TConfigType>() where TConfigType : IConfig
|
||||||
{
|
{
|
||||||
return _collectionsByType[typeof(TConfigType)];
|
return _collectionsByType[typeof(TConfigType)];
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
"ResonLevelLimit": 5,
|
"ResonLevelLimit": 5,
|
||||||
"FirstPropId": {
|
"FirstPropId": {
|
||||||
"Id": 7,
|
"Id": 7,
|
||||||
"Value": 54,
|
"Value": 47,
|
||||||
"IsRatio": false
|
"IsRatio": false
|
||||||
},
|
},
|
||||||
"FirstCurve": 1,
|
"FirstCurve": 1,
|
||||||
"SecondPropId": {
|
"SecondPropId": {
|
||||||
"Id": 11,
|
"Id": 10007,
|
||||||
"Value": 432,
|
"Value": 0.08100000023841858,
|
||||||
"IsRatio": false
|
"IsRatio": true
|
||||||
},
|
},
|
||||||
"SecondCurve": 2,
|
"SecondCurve": 2,
|
||||||
"ResonId": 21010015,
|
"ResonId": 21010015,
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
"Desc": "WeaponConf_21010015_Desc",
|
"Desc": "WeaponConf_21010015_Desc",
|
||||||
"DescParams": [
|
"DescParams": [
|
||||||
{
|
{
|
||||||
"ArrayString": [ "12%", "15%", "18%", "21%", "24%" ]
|
"ArrayString": [ "12.8%", "16%", "19.2%", "22.4%", "25.6%" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ArrayString": [ "8%", "10%", "12%", "14%", "16%" ]
|
"ArrayString": [ "8%", "10%", "12%", "14%", "16%" ]
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
"ArrayString": [ "2", "2", "2", "2", "2" ]
|
"ArrayString": [ "2", "2", "2", "2", "2" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ArrayString": [ "8", "8", "8", "8", "8" ]
|
"ArrayString": [ "12", "12", "12", "12", "12" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"TypeDescription": "WeaponConf_21010015_TypeDescription",
|
"TypeDescription": "WeaponConf_21010015_TypeDescription",
|
||||||
|
@ -84,16 +84,16 @@
|
||||||
"Desc": "WeaponConf_21020015_Desc",
|
"Desc": "WeaponConf_21020015_Desc",
|
||||||
"DescParams": [
|
"DescParams": [
|
||||||
{
|
{
|
||||||
"ArrayString": [ "16%", "20%", "24%", "28%", "32%" ]
|
"ArrayString": [ "12.8%", "16%", "19.2%", "22.4%", "25.6%" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ArrayString": [ "8%", "10%", "12%", "14%", "16%" ]
|
"ArrayString": [ "6%", "7.5%", "9%", "10.5%", "12%" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ArrayString": [ "2", "2", "2", "2", "2" ]
|
"ArrayString": [ "2", "2", "2", "2", "2" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ArrayString": [ "8", "8", "8", "8", "8" ]
|
"ArrayString": [ "10", "10", "10", "10", "10" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"TypeDescription": "WeaponConf_21020015_TypeDescription",
|
"TypeDescription": "WeaponConf_21020015_TypeDescription",
|
||||||
|
@ -142,16 +142,16 @@
|
||||||
"Desc": "WeaponConf_21030015_Desc",
|
"Desc": "WeaponConf_21030015_Desc",
|
||||||
"DescParams": [
|
"DescParams": [
|
||||||
{
|
{
|
||||||
"ArrayString": [ "12%", "15%", "18%", "21%", "24%" ]
|
"ArrayString": [ "12.8%", "16%", "19.2%", "22.4%", "25.6%" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ArrayString": [ "2.4%", "3%", "3.6%", "4.2%", "4.8%" ]
|
"ArrayString": [ "10%", "12.5%", "15%", "17.5%", "20%" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ArrayString": [ "5", "5", "5", "5", "5" ]
|
"ArrayString": [ "1", "1", "1", "1", "1" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ArrayString": [ "8", "8", "8", "8", "8" ]
|
"ArrayString": [ "14", "14", "14", "14", "14" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"TypeDescription": "WeaponConf_21030015_TypeDescription",
|
"TypeDescription": "WeaponConf_21030015_TypeDescription",
|
||||||
|
@ -189,9 +189,9 @@
|
||||||
},
|
},
|
||||||
"FirstCurve": 1,
|
"FirstCurve": 1,
|
||||||
"SecondPropId": {
|
"SecondPropId": {
|
||||||
"Id": 11,
|
"Id": 10007,
|
||||||
"Value": 864,
|
"Value": 0.08100000023841858,
|
||||||
"IsRatio": false
|
"IsRatio": true
|
||||||
},
|
},
|
||||||
"SecondCurve": 2,
|
"SecondCurve": 2,
|
||||||
"ResonId": 21040015,
|
"ResonId": 21040015,
|
||||||
|
@ -200,7 +200,7 @@
|
||||||
"Desc": "WeaponConf_21040015_Desc",
|
"Desc": "WeaponConf_21040015_Desc",
|
||||||
"DescParams": [
|
"DescParams": [
|
||||||
{
|
{
|
||||||
"ArrayString": [ "8%", "10%", "12%", "14%", "16%" ]
|
"ArrayString": [ "12.8%", "16%", "19.2%", "22.4%", "25.6%" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ArrayString": [ "10%", "12.5%", "15%", "17.5%", "20%" ]
|
"ArrayString": [ "10%", "12.5%", "15%", "17.5%", "20%" ]
|
||||||
|
@ -250,9 +250,9 @@
|
||||||
},
|
},
|
||||||
"FirstCurve": 1,
|
"FirstCurve": 1,
|
||||||
"SecondPropId": {
|
"SecondPropId": {
|
||||||
"Id": 11,
|
"Id": 10007,
|
||||||
"Value": 1280,
|
"Value": 0.11999999731779099,
|
||||||
"IsRatio": false
|
"IsRatio": true
|
||||||
},
|
},
|
||||||
"SecondCurve": 2,
|
"SecondCurve": 2,
|
||||||
"ResonId": 21050015,
|
"ResonId": 21050015,
|
||||||
|
@ -261,7 +261,7 @@
|
||||||
"Desc": "WeaponConf_21050015_Desc",
|
"Desc": "WeaponConf_21050015_Desc",
|
||||||
"DescParams": [
|
"DescParams": [
|
||||||
{
|
{
|
||||||
"ArrayString": [ "16%", "20%", "24%", "28%", "32%" ]
|
"ArrayString": [ "12.8%", "16%", "19.2%", "22.4%", "25.6%" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ArrayString": [ "3.2%", "4%", "4.8%", "5.6%", "6.4%" ]
|
"ArrayString": [ "3.2%", "4%", "4.8%", "5.6%", "6.4%" ]
|
||||||
|
@ -1670,13 +1670,13 @@
|
||||||
"ResonLevelLimit": 5,
|
"ResonLevelLimit": 5,
|
||||||
"FirstPropId": {
|
"FirstPropId": {
|
||||||
"Id": 7,
|
"Id": 7,
|
||||||
"Value": 31,
|
"Value": 27,
|
||||||
"IsRatio": false
|
"IsRatio": false
|
||||||
},
|
},
|
||||||
"FirstCurve": 1,
|
"FirstCurve": 1,
|
||||||
"SecondPropId": {
|
"SecondPropId": {
|
||||||
"Id": 10010,
|
"Id": 10010,
|
||||||
"Value": 0.10260000079870224,
|
"Value": 0.13680000603199005,
|
||||||
"IsRatio": true
|
"IsRatio": true
|
||||||
},
|
},
|
||||||
"SecondCurve": 2,
|
"SecondCurve": 2,
|
||||||
|
@ -1834,8 +1834,8 @@
|
||||||
},
|
},
|
||||||
"FirstCurve": 1,
|
"FirstCurve": 1,
|
||||||
"SecondPropId": {
|
"SecondPropId": {
|
||||||
"Id": 10007,
|
"Id": 10010,
|
||||||
"Value": 0.1080000028014183,
|
"Value": 0.13680000603199005,
|
||||||
"IsRatio": true
|
"IsRatio": true
|
||||||
},
|
},
|
||||||
"SecondCurve": 2,
|
"SecondCurve": 2,
|
||||||
|
@ -1886,7 +1886,7 @@
|
||||||
},
|
},
|
||||||
"FirstCurve": 1,
|
"FirstCurve": 1,
|
||||||
"SecondPropId": {
|
"SecondPropId": {
|
||||||
"Id": 10002,
|
"Id": 10007,
|
||||||
"Value": 0.08100000023841858,
|
"Value": 0.08100000023841858,
|
||||||
"IsRatio": true
|
"IsRatio": true
|
||||||
},
|
},
|
||||||
|
@ -2248,13 +2248,13 @@
|
||||||
"ResonLevelLimit": 5,
|
"ResonLevelLimit": 5,
|
||||||
"FirstPropId": {
|
"FirstPropId": {
|
||||||
"Id": 7,
|
"Id": 7,
|
||||||
"Value": 26,
|
"Value": 24,
|
||||||
"IsRatio": false
|
"IsRatio": false
|
||||||
},
|
},
|
||||||
"FirstCurve": 1,
|
"FirstCurve": 1,
|
||||||
"SecondPropId": {
|
"SecondPropId": {
|
||||||
"Id": 10010,
|
"Id": 10010,
|
||||||
"Value": 0.06840000301599503,
|
"Value": 0.08550000190734863,
|
||||||
"IsRatio": true
|
"IsRatio": true
|
||||||
},
|
},
|
||||||
"SecondCurve": 2,
|
"SecondCurve": 2,
|
||||||
|
@ -3128,7 +3128,7 @@
|
||||||
"ArrayString": [ "2", "2", "2", "2", "2" ]
|
"ArrayString": [ "2", "2", "2", "2", "2" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ArrayString": [ "10", "10", "10", "10", "10" ]
|
"ArrayString": [ "14", "14", "14", "14", "14" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"TypeDescription": "WeaponConf_21010016_TypeDescription",
|
"TypeDescription": "WeaponConf_21010016_TypeDescription",
|
||||||
|
@ -3180,13 +3180,16 @@
|
||||||
"ArrayString": [ "12%", "15%", "18%", "21%", "24%" ]
|
"ArrayString": [ "12%", "15%", "18%", "21%", "24%" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ArrayString": [ "20%", "25%", "30%", "35%", "40%" ]
|
"ArrayString": [ "12%", "15%", "18%", "21%", "24%" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ArrayString": [ "12%", "15%", "18%", "21%", "24%" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ArrayString": [ "2", "2", "2", "2", "2" ]
|
"ArrayString": [ "2", "2", "2", "2", "2" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ArrayString": [ "18", "18", "18", "18", "18" ]
|
"ArrayString": [ "5", "5", "5", "5", "5" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"TypeDescription": "WeaponConf_21050016_TypeDescription",
|
"TypeDescription": "WeaponConf_21050016_TypeDescription",
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
using GameServer.Controllers.Attributes;
|
using Core.Config;
|
||||||
|
using GameServer.Controllers.Attributes;
|
||||||
|
using GameServer.Models;
|
||||||
using GameServer.Network;
|
using GameServer.Network;
|
||||||
using GameServer.Network.Messages;
|
using GameServer.Systems.Entity;
|
||||||
|
using GameServer.Systems.Entity.Component;
|
||||||
|
using GameServer.Systems.Event;
|
||||||
using Protocol;
|
using Protocol;
|
||||||
|
|
||||||
namespace GameServer.Controllers;
|
namespace GameServer.Controllers;
|
||||||
|
@ -15,11 +19,71 @@ internal class InventoryController : Controller
|
||||||
public RpcResult OnNormalItemRequest() => Response(MessageId.NormalItemResponse, new NormalItemResponse());
|
public RpcResult OnNormalItemRequest() => Response(MessageId.NormalItemResponse, new NormalItemResponse());
|
||||||
|
|
||||||
[NetEvent(MessageId.WeaponItemRequest)]
|
[NetEvent(MessageId.WeaponItemRequest)]
|
||||||
public RpcResult OnWeaponItemRequest() => Response(MessageId.WeaponItemResponse, new WeaponItemResponse());
|
public RpcResult OnWeaponItemRequest(ModelManager modelManager) => Response(MessageId.WeaponItemResponse, new WeaponItemResponse
|
||||||
|
{
|
||||||
|
WeaponItemList =
|
||||||
|
{
|
||||||
|
modelManager.Inventory.WeaponList
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
[NetEvent(MessageId.PhantomItemRequest)]
|
[NetEvent(MessageId.PhantomItemRequest)]
|
||||||
public RpcResult OnPhantomItemRequest() => Response(MessageId.PhantomItemResponse, new PhantomItemResponse());
|
public RpcResult OnPhantomItemRequest() => Response(MessageId.PhantomItemResponse, new PhantomItemResponse());
|
||||||
|
|
||||||
[NetEvent(MessageId.ItemExchangeInfoRequest)]
|
[NetEvent(MessageId.ItemExchangeInfoRequest)]
|
||||||
public RpcResult OnItemExchangeInfoRequest() => Response(MessageId.ItemExchangeInfoResponse, new ItemExchangeInfoResponse());
|
public RpcResult OnItemExchangeInfoRequest() => Response(MessageId.ItemExchangeInfoResponse, new ItemExchangeInfoResponse());
|
||||||
|
|
||||||
|
[NetEvent(MessageId.EquipTakeOnRequest)]
|
||||||
|
public async Task<RpcResult> OnEquipTakeOnRequest(EquipTakeOnRequest request, ModelManager modelManager, CreatureController creatureController)
|
||||||
|
{
|
||||||
|
WeaponItem? weapon = modelManager.Inventory.GetWeaponById(request.Data.EquipIncId);
|
||||||
|
if (weapon == null) return Response(MessageId.EquipTakeOnResponse, new EquipTakeOnResponse
|
||||||
|
{
|
||||||
|
ErrorCode = (int)ErrorCode.ErrItemIdInvaild
|
||||||
|
});
|
||||||
|
|
||||||
|
PlayerEntity? entity = creatureController.GetPlayerEntityByRoleId(request.Data.RoleId);
|
||||||
|
if (entity != null)
|
||||||
|
{
|
||||||
|
EntityEquipComponent equipComponent = entity.ComponentSystem.Get<EntityEquipComponent>();
|
||||||
|
equipComponent.WeaponId = weapon.Id;
|
||||||
|
|
||||||
|
await Session.Push(MessageId.EntityEquipChangeNotify, new EntityEquipChangeNotify
|
||||||
|
{
|
||||||
|
EntityId = entity.Id,
|
||||||
|
EquipComponent = equipComponent.Pb.EquipComponent
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response(MessageId.EquipTakeOnResponse, new EquipTakeOnResponse
|
||||||
|
{
|
||||||
|
DataList =
|
||||||
|
{
|
||||||
|
new RoleLoadEquipData
|
||||||
|
{
|
||||||
|
RoleId = request.Data.RoleId,
|
||||||
|
Pos = request.Data.Pos,
|
||||||
|
EquipIncId = request.Data.EquipIncId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[GameEvent(GameEventType.EnterGame)]
|
||||||
|
public async Task OnEnterGame()
|
||||||
|
{
|
||||||
|
await Session.Push(MessageId.ItemPkgOpenNotify, new ItemPkgOpenNotify
|
||||||
|
{
|
||||||
|
OpenPkg = { 0, 2, 1, 3, 4, 5, 6, 7 }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[GameEvent(GameEventType.DebugUnlockAllWeapons)]
|
||||||
|
public void DebugUnlockAllWeapons(ConfigManager configManager, ModelManager modelManager)
|
||||||
|
{
|
||||||
|
foreach (WeaponConfig weaponConf in configManager.Enumerate<WeaponConfig>())
|
||||||
|
{
|
||||||
|
modelManager.Inventory.AddNewWeapon(weaponConf.ItemId);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,10 @@ internal class LoginController : Controller
|
||||||
{
|
{
|
||||||
await eventSystem.Emit(GameEventType.Login);
|
await eventSystem.Emit(GameEventType.Login);
|
||||||
|
|
||||||
|
// Debug
|
||||||
|
await eventSystem.Emit(GameEventType.DebugUnlockAllRoles);
|
||||||
|
await eventSystem.Emit(GameEventType.DebugUnlockAllWeapons);
|
||||||
|
|
||||||
return Response(MessageId.LoginResponse, new LoginResponse
|
return Response(MessageId.LoginResponse, new LoginResponse
|
||||||
{
|
{
|
||||||
Code = 0,
|
Code = 0,
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using GameServer.Controllers.Attributes;
|
using GameServer.Controllers.Attributes;
|
||||||
using GameServer.Models;
|
using GameServer.Models;
|
||||||
using GameServer.Network;
|
using GameServer.Network;
|
||||||
using GameServer.Network.Messages;
|
|
||||||
using GameServer.Systems.Event;
|
using GameServer.Systems.Event;
|
||||||
using Protocol;
|
using Protocol;
|
||||||
|
|
||||||
|
@ -14,23 +13,27 @@ internal class RoleController : Controller
|
||||||
// RoleController.
|
// RoleController.
|
||||||
}
|
}
|
||||||
|
|
||||||
[GameEvent(GameEventType.EnterGame)]
|
[GameEvent(GameEventType.DebugUnlockAllRoles)]
|
||||||
public async Task OnEnterGame(ModelManager modelManager, ConfigManager configManager)
|
public void UnlockAllRoles(ConfigManager configManager, ModelManager modelManager)
|
||||||
{
|
{
|
||||||
PlayerModel player = modelManager.Player;
|
foreach (RoleInfoConfig roleConfig in configManager.Enumerate<RoleInfoConfig>())
|
||||||
|
{
|
||||||
|
roleInfo role = modelManager.Roles.Create(roleConfig.Id);
|
||||||
|
role.BaseProp.AddRange(CreateBasePropList(configManager.GetConfig<BasePropertyConfig>(roleConfig.Id)));
|
||||||
|
|
||||||
|
WeaponItem weapon = modelManager.Inventory.AddNewWeapon(roleConfig.InitWeaponItemId);
|
||||||
|
weapon.RoleId = role.RoleId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[GameEvent(GameEventType.EnterGame)]
|
||||||
|
public async Task OnEnterGame(ModelManager modelManager)
|
||||||
|
{
|
||||||
await Session.Push(MessageId.PbGetRoleListNotify, new PbGetRoleListNotify
|
await Session.Push(MessageId.PbGetRoleListNotify, new PbGetRoleListNotify
|
||||||
{
|
{
|
||||||
RoleList =
|
RoleList =
|
||||||
{
|
{
|
||||||
configManager.GetCollection(ConfigType.RoleInfo)
|
modelManager.Roles.Roles
|
||||||
.Enumerate<RoleInfoConfig>()
|
|
||||||
.Select(config => new roleInfo
|
|
||||||
{
|
|
||||||
RoleId = config.Id,
|
|
||||||
Level = 1,
|
|
||||||
BaseProp = { CreateBasePropList(configManager.GetConfig<BasePropertyConfig>(config.Id)) }
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
29
GameServer/Models/InventoryModel.cs
Normal file
29
GameServer/Models/InventoryModel.cs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
using Core.Config;
|
||||||
|
using Protocol;
|
||||||
|
|
||||||
|
namespace GameServer.Models;
|
||||||
|
internal class InventoryModel
|
||||||
|
{
|
||||||
|
private int _itemIncrId;
|
||||||
|
|
||||||
|
public List<WeaponItem> WeaponList { get; } = [];
|
||||||
|
|
||||||
|
public WeaponItem? GetWeaponById(int incrId)
|
||||||
|
{
|
||||||
|
return WeaponList.SingleOrDefault(weapon => weapon.IncrId == incrId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public WeaponItem AddNewWeapon(int weaponId)
|
||||||
|
{
|
||||||
|
WeaponItem weapon = new()
|
||||||
|
{
|
||||||
|
Id = weaponId,
|
||||||
|
IncrId = ++_itemIncrId,
|
||||||
|
WeaponLevel = 1,
|
||||||
|
WeaponResonLevel = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
WeaponList.Add(weapon);
|
||||||
|
return weapon;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
using GameServer.Controllers.Attributes;
|
using Core.Config;
|
||||||
|
using GameServer.Controllers.Attributes;
|
||||||
using GameServer.Settings;
|
using GameServer.Settings;
|
||||||
using GameServer.Systems.Event;
|
using GameServer.Systems.Event;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
@ -7,13 +8,15 @@ namespace GameServer.Models;
|
||||||
internal class ModelManager
|
internal class ModelManager
|
||||||
{
|
{
|
||||||
private readonly IOptions<PlayerStartingValues> _playerStartingValues;
|
private readonly IOptions<PlayerStartingValues> _playerStartingValues;
|
||||||
|
private readonly ConfigManager _configManager;
|
||||||
|
|
||||||
private PlayerModel? _playerModel;
|
private PlayerModel? _playerModel;
|
||||||
private CreatureModel? _creatureModel;
|
private CreatureModel? _creatureModel;
|
||||||
|
|
||||||
public ModelManager(IOptions<PlayerStartingValues> playerStartingValues)
|
public ModelManager(IOptions<PlayerStartingValues> playerStartingValues, ConfigManager configManager)
|
||||||
{
|
{
|
||||||
_playerStartingValues = playerStartingValues;
|
_playerStartingValues = playerStartingValues;
|
||||||
|
_configManager = configManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
[GameEvent(GameEventType.Login)]
|
[GameEvent(GameEventType.Login)]
|
||||||
|
@ -29,6 +32,8 @@ internal class ModelManager
|
||||||
|
|
||||||
public CreatureModel Creature => _creatureModel ?? throw new InvalidOperationException($"Trying to access {nameof(CreatureModel)} instance before initialization!");
|
public CreatureModel Creature => _creatureModel ?? throw new InvalidOperationException($"Trying to access {nameof(CreatureModel)} instance before initialization!");
|
||||||
|
|
||||||
|
public RoleModel Roles { get; } = new();
|
||||||
public FormationModel Formation { get; } = new();
|
public FormationModel Formation { get; } = new();
|
||||||
|
public InventoryModel Inventory { get; } = new();
|
||||||
public ChatModel Chat { get; } = new();
|
public ChatModel Chat { get; } = new();
|
||||||
}
|
}
|
||||||
|
|
165
GameServer/Models/RoleModel.cs
Normal file
165
GameServer/Models/RoleModel.cs
Normal file
|
@ -0,0 +1,165 @@
|
||||||
|
using Core.Config;
|
||||||
|
using Protocol;
|
||||||
|
|
||||||
|
namespace GameServer.Models;
|
||||||
|
internal class RoleModel
|
||||||
|
{
|
||||||
|
public List<roleInfo> Roles { get; } = [];
|
||||||
|
|
||||||
|
public roleInfo Create(int id)
|
||||||
|
{
|
||||||
|
roleInfo info = new()
|
||||||
|
{
|
||||||
|
RoleId = id,
|
||||||
|
Level = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
Roles.Add(info);
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<ArrayIntInt> CreateBasePropList(BasePropertyConfig? config)
|
||||||
|
{
|
||||||
|
List<ArrayIntInt> baseProp = [];
|
||||||
|
if (config == null) return baseProp;
|
||||||
|
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.Lv, Value = config.Lv });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.LifeMax, Value = config.LifeMax });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.Life, Value = config.Life });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.Sheild, Value = config.Sheild });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.SheildDamageChange, Value = config.SheildDamageChange });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.SheildDamageReduce, Value = config.SheildDamageReduce });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.Atk, Value = config.Atk });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.Crit, Value = config.Crit });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.CritDamage, Value = config.CritDamage });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.Def, Value = config.Def });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.EnergyEfficiency, Value = config.EnergyEfficiency });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.CdReduse, Value = config.CdReduse });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionEfficiency, Value = config.ReactionEfficiency });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeNormalSkill, Value = config.DamageChangeNormalSkill });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageChange, Value = config.DamageChange });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageReduce, Value = config.DamageReduce });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeAuto, Value = config.DamageChangeAuto });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeCast, Value = config.DamageChangeCast });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeUltra, Value = config.DamageChangeUltra });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeQte, Value = config.DamageChangeQte });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangePhys, Value = config.DamageChangePhys });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeElement1, Value = config.DamageChangeElement1 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeElement2, Value = config.DamageChangeElement2 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeElement3, Value = config.DamageChangeElement3 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeElement4, Value = config.DamageChangeElement4 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeElement5, Value = config.DamageChangeElement5 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangeElement6, Value = config.DamageChangeElement6 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageResistancePhys, Value = config.DamageResistancePhys });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageResistanceElement1, Value = config.DamageResistanceElement1 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageResistanceElement2, Value = config.DamageResistanceElement2 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageResistanceElement3, Value = config.DamageResistanceElement3 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageResistanceElement4, Value = config.DamageResistanceElement4 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageResistanceElement5, Value = config.DamageResistanceElement5 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageResistanceElement6, Value = config.DamageResistanceElement6 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.HealChange, Value = config.HealChange });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.HealedChange, Value = config.HealedChange });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageReducePhys, Value = config.DamageReducePhys });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageReduceElement1, Value = config.DamageReduceElement1 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageReduceElement2, Value = config.DamageReduceElement2 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageReduceElement3, Value = config.DamageReduceElement3 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageReduceElement4, Value = config.DamageReduceElement4 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageReduceElement5, Value = config.DamageReduceElement5 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageReduceElement6, Value = config.DamageReduceElement6 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange1, Value = config.ReactionChange1 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange2, Value = config.ReactionChange2 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange3, Value = config.ReactionChange3 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange4, Value = config.ReactionChange4 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange5, Value = config.ReactionChange5 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange6, Value = config.ReactionChange6 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange7, Value = config.ReactionChange7 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange8, Value = config.ReactionChange8 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange9, Value = config.ReactionChange9 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange10, Value = config.ReactionChange10 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange11, Value = config.ReactionChange11 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange12, Value = config.ReactionChange12 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange13, Value = config.ReactionChange13 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange14, Value = config.ReactionChange14 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ReactionChange15, Value = config.ReactionChange15 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.EnergyMax, Value = config.EnergyMax });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.Energy, Value = config.Energy });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy1Max, Value = config.SpecialEnergy1Max });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy1, Value = config.SpecialEnergy1 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy2Max, Value = config.SpecialEnergy2Max });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy2, Value = config.SpecialEnergy2 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy3Max, Value = config.SpecialEnergy3Max });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy3, Value = config.SpecialEnergy3 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy4Max, Value = config.SpecialEnergy4Max });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.SpecialEnergy4, Value = config.SpecialEnergy4 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StrengthMax, Value = config.StrengthMax });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.Strength, Value = config.Strength });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StrengthRecover, Value = config.StrengthRecover });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StrengthPunishTime, Value = config.StrengthPunishTime });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StrengthRun, Value = config.StrengthRun });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StrengthSwim, Value = config.StrengthSwim });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StrengthFastSwim, Value = config.StrengthFastSwim });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StrengthClimb, Value = config.StrengthClimb });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StrengthFastClimb, Value = config.StrengthFastClimb });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.HardnessMax, Value = config.HardnessMax });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.Hardness, Value = config.Hardness });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.HardnessRecover, Value = config.HardnessRecover });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.HardnessPunishTime, Value = config.HardnessPunishTime });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.HardnessChange, Value = config.HardnessChange });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.HardnessReduce, Value = config.HardnessReduce });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.RageMax, Value = config.RageMax });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.Rage, Value = config.Rage });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.RageRecover, Value = config.RageRecover });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.RagePunishTime, Value = config.RagePunishTime });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.RageChange, Value = config.RageChange });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.RageReduce, Value = config.RageReduce });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ToughMax, Value = config.ToughMax });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.Tough, Value = config.Tough });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ToughRecover, Value = config.ToughRecover });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ToughChange, Value = config.ToughChange });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ToughReduce, Value = config.ToughReduce });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ToughRecoverDelayTime, Value = config.ToughRecoverDelayTime });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ElementPower1, Value = config.ElementPower1 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ElementPower2, Value = config.ElementPower2 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ElementPower3, Value = config.ElementPower3 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ElementPower4, Value = config.ElementPower4 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ElementPower5, Value = config.ElementPower5 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ElementPower6, Value = config.ElementPower6 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.SpecialDamageChange, Value = config.SpecialDamageChange });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StrengthFastClimbCost, Value = config.StrengthFastClimbCost });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ElementPropertyType, Value = config.ElementPropertyType });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.WeakTime, Value = config.WeakTime });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDefRate, Value = config.IgnoreDefRate });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDamageResistancePhys, Value = config.IgnoreDamageResistancePhys });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDamageResistanceElement1, Value = config.IgnoreDamageResistanceElement1 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDamageResistanceElement2, Value = config.IgnoreDamageResistanceElement2 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDamageResistanceElement3, Value = config.IgnoreDamageResistanceElement3 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDamageResistanceElement4, Value = config.IgnoreDamageResistanceElement4 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDamageResistanceElement5, Value = config.IgnoreDamageResistanceElement5 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.IgnoreDamageResistanceElement6, Value = config.IgnoreDamageResistanceElement6 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.SkillToughRatio, Value = config.SkillToughRatio });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StrengthClimbJump, Value = config.StrengthClimbJump });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StrengthGliding, Value = config.StrengthGliding });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.Mass, Value = config.Mass });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.BrakingFrictionFactor, Value = config.BrakingFrictionFactor });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.GravityScale, Value = config.GravityScale });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.SpeedRatio, Value = config.SpeedRatio });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.DamageChangePhantom, Value = config.DamageChangePhantom });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.AutoAttackSpeed, Value = config.AutoAttackSpeed });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.CastAttackSpeed, Value = config.CastAttackSpeed });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp1Max, Value = config.StatusBuildUp1Max });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp1, Value = config.StatusBuildUp1 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp2Max, Value = config.StatusBuildUp2Max });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp2, Value = config.StatusBuildUp2 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp3Max, Value = config.StatusBuildUp3Max });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp3, Value = config.StatusBuildUp3 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp4Max, Value = config.StatusBuildUp4Max });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp4, Value = config.StatusBuildUp4 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp5Max, Value = config.StatusBuildUp5Max });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.StatusBuildUp5, Value = config.StatusBuildUp5 });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ParalysisTimeMax, Value = config.ParalysisTimeMax });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ParalysisTime, Value = config.ParalysisTime });
|
||||||
|
baseProp.Add(new() { Key = (int)EAttributeType.ParalysisTimeRecover, Value = config.ParalysisTimeRecover });
|
||||||
|
|
||||||
|
return baseProp;
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,5 +7,9 @@ internal enum GameEventType
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
FormationUpdated,
|
FormationUpdated,
|
||||||
VisionSkillChanged
|
VisionSkillChanged,
|
||||||
|
|
||||||
|
// Debug
|
||||||
|
DebugUnlockAllRoles,
|
||||||
|
DebugUnlockAllWeapons
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue