93 lines
3.5 KiB
C#
93 lines
3.5 KiB
C#
|
|
|
|
using ServerCore; using ServerBase;
|
|
using ServerCommon;
|
|
|
|
|
|
namespace GameServer;
|
|
|
|
|
|
//attributechangeall [적용할 속성값]
|
|
[ChatCommandAttribute("attributechangeall", typeof(ChatCommandAttributeChangeAll), AuthAdminLevelType.Developer, AuthAdminLevelType.GmNormal, AuthAdminLevelType.GmSuper)]
|
|
internal class ChatCommandAttributeChangeAll : ChatCommandBase
|
|
{
|
|
public override async Task invoke(Player player, string token, string[] args)
|
|
{
|
|
Log.getLogger().info($"Call attributechangeall !!! - {player.toBasicString()}");
|
|
|
|
var result = new Result();
|
|
var err_msg = string.Empty;
|
|
|
|
if (args.Length < 1)
|
|
{
|
|
err_msg = $"Not enough argument !!! : argCount:{args.Length} == 2 - {player.toBasicString()}";
|
|
Log.getLogger().error(err_msg);
|
|
return;
|
|
}
|
|
|
|
if (false == int.TryParse(args[0], out var to_change_all_value))
|
|
{
|
|
Log.getLogger().error($"to_change_all_value param parsing Error arg 1 : {args[0]}");
|
|
return;
|
|
}
|
|
|
|
if (0 >= to_change_all_value)
|
|
{
|
|
Log.getLogger().error($"Invalid to change Attribute All value of arg 1 !!! : 0 < toChangeValue:{to_change_all_value} - {player.toBasicString()}");
|
|
return;
|
|
}
|
|
|
|
var ability_action = player.getEntityAction<AbilityAction>();
|
|
NullReferenceCheckHelper.throwIfNull(ability_action, () => $"ability_action is null !!! - {player.toBasicString()}");
|
|
|
|
ability_action.forceSetAbilityAll(to_change_all_value);
|
|
|
|
var ntf_msg = new ClientToGameMessage.Types.GS2C_NTF_ATTRIBUTE_UPDATE();
|
|
ntf_msg.OwnerEntityType = OwnerEntityType.User;
|
|
ntf_msg.OwnerGuid = player.getUserGuid();
|
|
ntf_msg.AttributeInfo = ability_action.toAbilityInfo();
|
|
|
|
ClientToGame clientToGame = new ClientToGame();
|
|
clientToGame.Message = new ClientToGameMessage();
|
|
clientToGame.Message.NtfAttributeUpdate = ntf_msg;
|
|
GameServerApp.getServerLogic().onSendPacket(player, clientToGame);
|
|
|
|
await Task.CompletedTask;
|
|
}
|
|
}
|
|
|
|
|
|
//attributeresetall
|
|
[ChatCommandAttribute("attributeresetall", typeof(ChatCommandAttributeResetAll), AuthAdminLevelType.Developer, AuthAdminLevelType.GmNormal, AuthAdminLevelType.GmSuper)]
|
|
internal class ChatCommandAttributeResetAll : ChatCommandBase
|
|
{
|
|
public override async Task invoke(Player player, string token, string[] args)
|
|
{
|
|
Log.getLogger().info($"Call attributeresetall !!! - {player.toBasicString()}");
|
|
|
|
var result = new Result();
|
|
var err_msg = string.Empty;
|
|
|
|
|
|
var ability_action = player.getEntityAction<AbilityAction>();
|
|
NullReferenceCheckHelper.throwIfNull(ability_action, () => $"ability_action is null !!! - {player.toBasicString()}");
|
|
|
|
result = await ability_action.forceResetAll();
|
|
if (result.isFail())
|
|
{
|
|
Log.getLogger().error($"Invalid to forceResetAll() !!! : {result.toBasicString()} - {player.toBasicString()}");
|
|
return;
|
|
}
|
|
|
|
var ntf_msg = new ClientToGameMessage.Types.GS2C_NTF_ATTRIBUTE_UPDATE();
|
|
ntf_msg.OwnerEntityType = OwnerEntityType.User;
|
|
ntf_msg.OwnerGuid = player.getUserGuid();
|
|
ntf_msg.AttributeInfo = ability_action.toAbilityInfo();
|
|
|
|
ClientToGame clientToGame = new ClientToGame();
|
|
clientToGame.Message = new ClientToGameMessage();
|
|
clientToGame.Message.NtfAttributeUpdate = ntf_msg;
|
|
GameServerApp.getServerLogic().onSendPacket(player, clientToGame);
|
|
}
|
|
}
|