<commit_before>﻿using Hybrasyl.Creatures;
using Hybrasyl.Enums;
using Hybrasyl.Nations;
using Hybrasyl.Objects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hybrasyl.Messaging
{
    class HpCommand : ChatCommand
    {
        public new static string Command = "hp";
        public new static string ArgumentText = "<uint hp>";
        public new static string HelpText = "Set current HP to the specified uint value.";
        public new static bool Privileged = false;

        public new static ChatCommandResult Run(User user, params string[] args)
        {
            if (uint.TryParse(args[0], out uint hp))
            {
                user.Stats.Hp = hp;
                user.UpdateAttributes(StatUpdateFlags.Full);
                return Success($"HP now {hp}");
            }
            return Fail("The value you specified could not be parsed (uint).");
        }
    }

    class BaseHpCommand : ChatCommand
    {
        public new static string Command = "basehp";
        public new static string ArgumentText = "<uint hp>";
        public new static string HelpText = "Set base HP to the specified uint value.";
        public new static bool Privileged = false;

        public new static ChatCommandResult Run(User user, params string[] args)
        {
            if (uint.TryParse(args[0], out uint hp))
            {
                user.Stats.BaseHp = hp;
                user.UpdateAttributes(StatUpdateFlags.Full);
                return Success($"Base HP now {hp}");
            }
            return Fail("The value you specified could not be parsed (uint)");
        }
    }

    class MpCommand : ChatCommand
    {
        public new static string Command = "mp";
        public new static string ArgumentText = "<uint mp>";
        public new static string HelpText = "Set current HP to the specified uint value.";
        public new static bool Privileged = false;

        public new static ChatCommandResult Run(User user, params string[] args)
        {
            if (uint.TryParse(args[0], out uint mp))
            {
                user.Stats.Mp = mp;
                user.UpdateAttributes(StatUpdateFlags.Full);
                return Success($"MP now {mp}");
            }
            return Fail("The value you specified could not be parsed (uint).");
        }
    }

    class BaseMpCommand : ChatCommand
    {
        public new static string Command = "basemp";
        public new static string ArgumentText = "<uint mp>";
        public new static string HelpText = "Set base HP to the specified uint value.";
        public new static bool Privileged = false;

        public new static ChatCommandResult Run(User user, params string[] args)
        {
            if (uint.TryParse(args[0], out uint mp))
            {
                user.Stats.BaseMp = mp;
                user.UpdateAttributes(StatUpdateFlags.Full);
                return Success($"Base HP now {mp}");
            }
            return Fail("The value you specified could not be parsed (uint)");
        }
    }

    class AttrCommand : ChatCommand
    {
        public new static string Command = "attr";
        public new static string ArgumentText = "<string attribute (str|wis|int|con|dex)> <byte value>";
        public new static string HelpText = "Set a specified attribute to the given byte value.";
        public new static bool Privileged = false;

        public new static ChatCommandResult Run(User user, params string[] args)
        {

            if (!Byte.TryParse(args[1], out byte newStat))
            {
                return Fail($"The value you specified for attribute {args[0]} could not be parsed (byte)");
            }

            switch (args[0].ToLower())
            {
                case "str":
                    user.Stats.BaseStr = newStat;
                    break;
                case "con":
                    user.Stats.BaseCon = newStat;
                    break;
                case "dex":
                    user.Stats.BaseDex = newStat;
                    break;
                case "wis":
                    user.Stats.BaseWis = newStat;
                    break;
                case "int":
                    user.Stats.BaseInt = newStat;
                    break;
                default:
                    return Fail($"Unknown attribute {args[0].ToLower()}");
            }
            user.UpdateAttributes(StatUpdateFlags.Stats);<commit_msg>fix attr<commit_after>﻿using Hybrasyl.Creatures;
using Hybrasyl.Enums;
using Hybrasyl.Nations;
using Hybrasyl.Objects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hybrasyl.Messaging
{
    class HpCommand : ChatCommand
    {
        public new static string Command = "hp";
        public new static string ArgumentText = "<uint hp>";
        public new static string HelpText = "Set current HP to the specified uint value.";
        public new static bool Privileged = false;

        public new static ChatCommandResult Run(User user, params string[] args)
        {
            if (uint.TryParse(args[0], out uint hp))
            {
                user.Stats.Hp = hp;
                user.UpdateAttributes(StatUpdateFlags.Full);
                return Success($"HP now {hp}");
            }
            return Fail("The value you specified could not be parsed (uint).");
        }
    }

    class BaseHpCommand : ChatCommand
    {
        public new static string Command = "basehp";
        public new static string ArgumentText = "<uint hp>";
        public new static string HelpText = "Set base HP to the specified uint value.";
        public new static bool Privileged = false;

        public new static ChatCommandResult Run(User user, params string[] args)
        {
            if (uint.TryParse(args[0], out uint hp))
            {
                user.Stats.BaseHp = hp;
                user.UpdateAttributes(StatUpdateFlags.Full);
                return Success($"Base HP now {hp}");
            }
            return Fail("The value you specified could not be parsed (uint)");
        }
    }

    class MpCommand : ChatCommand
    {
        public new static string Command = "mp";
        public new static string ArgumentText = "<uint mp>";
        public new static string HelpText = "Set current HP to the specified uint value.";
        public new static bool Privileged = false;

        public new static ChatCommandResult Run(User user, params string[] args)
        {
            if (uint.TryParse(args[0], out uint mp))
            {
                user.Stats.Mp = mp;
                user.UpdateAttributes(StatUpdateFlags.Full);
                return Success($"MP now {mp}");
            }
            return Fail("The value you specified could not be parsed (uint).");
        }
    }

    class BaseMpCommand : ChatCommand
    {
        public new static string Command = "basemp";
        public new static string ArgumentText = "<uint mp>";
        public new static string HelpText = "Set base HP to the specified uint value.";
        public new static bool Privileged = false;

        public new static ChatCommandResult Run(User user, params string[] args)
        {
            if (uint.TryParse(args[0], out uint mp))
            {
                user.Stats.BaseMp = mp;
                user.UpdateAttributes(StatUpdateFlags.Full);
                return Success($"Base HP now {mp}");
            }
            return Fail("The value you specified could not be parsed (uint)");
        }
    }

    class AttrCommand : ChatCommand
    {
        public new static string Command = "attr";
        public new static string ArgumentText = "<string attribute> <byte value>";
        public new static string HelpText = "Set a specified attribute (str/con etc) to the given byte value.";
        public new static bool Privileged = false;

        public new static ChatCommandResult Run(User user, params string[] args)
        {

            if (!Byte.TryParse(args[1], out byte newStat))
            {
                return Fail($"The value you specified for attribute {args[0]} could not be parsed (byte)");
            }

            switch (args[0].ToLower())
            {
                case "str":
                    user.Stats.BaseStr = newStat;
                    break;
                case "con":
                    user.Stats.BaseCon = newStat;
                    break;
                case "dex":
                    user.Stats.BaseDex = newStat;
                    break;
                case "wis":
                    user.Stats.BaseWis = newStat;
                    break;
                case "int":
                    user.Stats.BaseInt = newStat;
                    break;
                default:
                    return Fail($"Unknown attribute {args[0].ToLower()}");
            }
            user.UpdateAttributes(StatUpdateFlags.Stats);
{'fraction_non_alphanumeric': 0.08735708735708736, 'fraction_numerical': 0.001776001776001776, 'mean_word_length': 1.7402676399026764, 'pattern_counts': {'":': 10, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '330506', 'n_tokens_mistral': 2269, 'n_tokens_neox': 2206, 'n_words': 771}