Unlimited energy option in gameplay.json (unlimited ultimate)

This commit is contained in:
xeon 2024-02-23 15:50:16 +03:00
parent 97bbbbeae9
commit 832f4ab3eb
4 changed files with 28 additions and 2 deletions

View file

@ -33,6 +33,16 @@ internal class CombatManager
_creatureController = creatureController; _creatureController = creatureController;
} }
[CombatRequest(CombatRequestData.MessageOneofCase.CreateBulletRequest)]
public CombatResponseData OnCreateBulletRequest(CombatRequestContext context)
{
return new CombatResponseData
{
CombatCommon = context.Request.CombatCommon,
CreateBulletResponse = new()
};
}
[CombatRequest(CombatRequestData.MessageOneofCase.DamageExecuteRequest)] [CombatRequest(CombatRequestData.MessageOneofCase.DamageExecuteRequest)]
public async Task<CombatResponseData> OnDamageExecuteRequest(CombatRequestContext context) public async Task<CombatResponseData> OnDamageExecuteRequest(CombatRequestContext context)
{ {

View file

@ -4,9 +4,11 @@ using GameServer.Extensions.Logic;
using GameServer.Models; using GameServer.Models;
using GameServer.Network; using GameServer.Network;
using GameServer.Network.Messages; using GameServer.Network.Messages;
using GameServer.Settings;
using GameServer.Systems.Entity; using GameServer.Systems.Entity;
using GameServer.Systems.Entity.Component; using GameServer.Systems.Entity.Component;
using GameServer.Systems.Event; using GameServer.Systems.Event;
using Microsoft.Extensions.Options;
using Protocol; using Protocol;
namespace GameServer.Controllers; namespace GameServer.Controllers;
@ -17,12 +19,15 @@ internal class CreatureController : Controller
private readonly ModelManager _modelManager; private readonly ModelManager _modelManager;
private readonly ConfigManager _configManager; private readonly ConfigManager _configManager;
public CreatureController(PlayerSession session, EntitySystem entitySystem, EntityFactory entityFactory, ModelManager modelManager, ConfigManager configManager) : base(session) private readonly GameplayFeatureSettings _gameplayFeatures;
public CreatureController(PlayerSession session, EntitySystem entitySystem, EntityFactory entityFactory, ModelManager modelManager, ConfigManager configManager, IOptions<GameplayFeatureSettings> gameplayFeatures) : base(session)
{ {
_entitySystem = entitySystem; _entitySystem = entitySystem;
_entityFactory = entityFactory; _entityFactory = entityFactory;
_modelManager = modelManager; _modelManager = modelManager;
_configManager = configManager; _configManager = configManager;
_gameplayFeatures = gameplayFeatures.Value;
} }
public async Task JoinScene(int instanceId) public async Task JoinScene(int instanceId)
@ -257,6 +262,15 @@ internal class CreatureController : Controller
entity.WeaponId = _modelManager.Inventory.GetEquippedWeapon(roleId)?.Id ?? 0; entity.WeaponId = _modelManager.Inventory.GetEquippedWeapon(roleId)?.Id ?? 0;
if (i == 0) _modelManager.Creature.PlayerEntityId = entity.Id; if (i == 0) _modelManager.Creature.PlayerEntityId = entity.Id;
if (_gameplayFeatures.UnlimitedEnergy)
{
EntityAttributeComponent attr = entity.ComponentSystem.Get<EntityAttributeComponent>();
attr.SetAttribute(EAttributeType.SpecialEnergy1Max, 0);
attr.SetAttribute(EAttributeType.SpecialEnergy2Max, 0);
attr.SetAttribute(EAttributeType.SpecialEnergy3Max, 0);
attr.SetAttribute(EAttributeType.SpecialEnergy4Max, 0);
}
} }
} }

View file

@ -2,4 +2,5 @@
internal class GameplayFeatureSettings internal class GameplayFeatureSettings
{ {
public bool TeleportByMapMark { get; set; } public bool TeleportByMapMark { get; set; }
public bool UnlimitedEnergy { get; set; }
} }

View file

@ -12,6 +12,7 @@
} }
}, },
"Features": { "Features": {
"TeleportByMapMark": true "TeleportByMapMark": true,
"UnlimitedEnergy": true
} }
} }