Added fixed attributes, added Invulnerability command, fixed compilation issue, more translations
This commit is contained in:
parent
06a5dcdf01
commit
33b096de32
@ -37,11 +37,37 @@ using System.Linq;
|
||||
using System.Text;
|
||||
//Blizzless Project 2022
|
||||
using System.Threading.Tasks;
|
||||
using DiIiS_NA.GameServer.GSSystem.ObjectsSystem;
|
||||
using DiIiS_NA.LoginServer.AccountsSystem;
|
||||
//Blizzless Project 2022
|
||||
using static DiIiS_NA.Core.MPQ.FileFormats.GameBalance;
|
||||
|
||||
namespace DiIiS_NA.GameServer.CommandManager
|
||||
{
|
||||
[CommandGroup("Invulnerable", "Makes you invulnerable")]
|
||||
public class InvulnerableCommand : CommandGroup
|
||||
{
|
||||
[DefaultCommand]
|
||||
public string Invulnerable(string[] @params, BattleClient invokerClient)
|
||||
{
|
||||
if (invokerClient?.InGameClient?.Player is not { } player)
|
||||
return "You can not invoke this command from console.";
|
||||
|
||||
if (player.Attributes.FixedMap.Contains(FixedAttribute.Invulnerable))
|
||||
{
|
||||
player.Attributes.FixedMap.Remove(FixedAttribute.Invulnerable);
|
||||
player.Attributes[GameAttribute.Invulnerable] = false;
|
||||
player.Attributes.BroadcastChangedIfRevealed();
|
||||
return "You are no longer invulnerable.";
|
||||
}
|
||||
|
||||
player.Attributes.FixedMap.Add(FixedAttribute.Invulnerable,
|
||||
attributes => { attributes[GameAttribute.Invulnerable] = true; });
|
||||
player.Attributes.BroadcastChangedIfRevealed();
|
||||
return "You are now invulnerable.";
|
||||
}
|
||||
}
|
||||
|
||||
[CommandGroup("spawn", "Spawns a mob.\nUsage: spawn [actorSNO] [amount]")]
|
||||
public class SpawnCommand : CommandGroup
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
//Blizzless Project 2022
|
||||
//Blizzless Project 2022
|
||||
using DiIiS_NA.Core.Logging;
|
||||
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
|
||||
//Blizzless Project 2022
|
||||
@ -682,18 +682,19 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
||||
UnitAniimStartTime = 0,
|
||||
tAnim = new PlayAnimationMessageSpec[]
|
||||
{
|
||||
new()
|
||||
new PlayAnimationMessageSpec
|
||||
{
|
||||
Duration = -2,
|
||||
AnimationSNO = animationSNO,
|
||||
AnimationSNO = (int)animationSNO,
|
||||
PermutationIndex = 0x0,
|
||||
AnimationTag = 0,
|
||||
Speed = 1.0f,
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayAnimation(int animationType, int animationSNO, float speed = 1.0f, int? ticksToPlay = null, int type2 = 0)
|
||||
{
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DiIiS_NA.Core.Logging;
|
||||
|
||||
namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem
|
||||
{
|
||||
public enum FixedAttribute
|
||||
{
|
||||
Invulnerable,
|
||||
Speed
|
||||
}
|
||||
|
||||
public class FixedMap
|
||||
{
|
||||
private static readonly Logger _logger = LogManager.CreateLogger(nameof(FixedMap));
|
||||
private readonly Dictionary<FixedAttribute, Action<GameAttributeMap>> _attributeMap = new();
|
||||
|
||||
public void Add(FixedAttribute name, Action<GameAttributeMap> action)
|
||||
{
|
||||
if (Contains(name))
|
||||
{
|
||||
_attributeMap[name] += action;
|
||||
_logger.Warn($"Fixed attribute {name} already exists. Action will be added.");
|
||||
return;
|
||||
}
|
||||
_attributeMap.Add(name, action);
|
||||
}
|
||||
|
||||
public void Remove(FixedAttribute name) => _attributeMap.Remove(name);
|
||||
public void Clear() => _attributeMap.Clear();
|
||||
public bool Contains(FixedAttribute name) => _attributeMap.ContainsKey(name);
|
||||
public void Apply(GameAttributeMap map)
|
||||
{
|
||||
foreach (var action in _attributeMap.Values)
|
||||
action(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -29,9 +29,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem
|
||||
{
|
||||
|
||||
public class GameAttributeMap
|
||||
{
|
||||
private static Logger Logger = LogManager.CreateLogger();
|
||||
public FixedMap FixedMap { get; } = new();
|
||||
|
||||
public struct KeyId
|
||||
{
|
||||
@ -233,6 +235,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem
|
||||
/// </summary>
|
||||
public void BroadcastIfRevealed()
|
||||
{
|
||||
FixedMap.Apply(this);
|
||||
if (_parent.World != null)
|
||||
SendMessage(_parent.World.Players.Values
|
||||
.Where(@player => @player.RevealedObjects.ContainsKey(_parent.GlobalID))
|
||||
@ -244,6 +247,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem
|
||||
/// </summary>
|
||||
public void BroadcastChangedIfRevealed()
|
||||
{
|
||||
FixedMap.Apply(this);
|
||||
if (_parent.World != null)
|
||||
SendChangedMessage(_parent.World.Players.Values
|
||||
.Where(@player => @player.RevealedObjects.ContainsKey(_parent.GlobalID))
|
||||
|
||||
@ -266,7 +266,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
||||
//Пчелы
|
||||
case ActorSno._sandwasp_a:
|
||||
case ActorSno._fleshpitflyer_leoric_inferno:
|
||||
Target.PlayAnimation(11, 8535, 1f);
|
||||
Target.PlayAnimation(11, AnimationSno.fleshpitflyer_death, 1f);
|
||||
break;
|
||||
//X1_LR_Boss_Angel_Corrupt_A
|
||||
case ActorSno._x1_lr_boss_angel_corrupt_a: Target.PlayAnimation(11, 142005, 1f); break;
|
||||
@ -277,7 +277,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
||||
Target.PlayAnimation(11, FindBestDeathAnimationSNO(), 1f);
|
||||
else
|
||||
{
|
||||
Logger.Warn("Анимация смерти не обнаружена: ActorSNOId = {0}", Target.SNO);
|
||||
Logger.Warn("Death animation not found: ActorSNOId = {0}", Target.SNO);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
user.block.title