/
NLObP
/
AAEmu
Обзор
Документация
Войти
/
NLObP
/
AAEmu
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
AAEmu.Game/Scripts/Commands/Appellation.cs
52 строки
1 KB
Roger Barreto
Adding Dictionary, Cleaning all warnings (#1109)
10 дек 2024, 19:51
Не верифицирован
10 дек 2024, 19:51
7605fdd
Код
Авторство
О чём код?
using AAEmu.Game.Core.Managers; using AAEmu.Game.Core.Managers.UnitManagers; using AAEmu.Game.Models.Game; using AAEmu.Game.Models.Game.Char; using AAEmu.Game.Utils.Scripts; namespace AAEmu.Game.Scripts.Commands; public class Appellation : ICommand { public string[] CommandNames { get; set; } = ["title", "addtitle", "add_title", "appellation"]; public void OnLoad() { CommandManager.Instance.Register(CommandNames, this); } public string GetCommandLineHelp() { return "<titleId>"; } public string GetCommandHelpText() { return "Adds title using <titleId>"; } public void Execute(Character character, string[] args, IMessageOutput messageOutput) { if (args.Length == 0) { CommandManager.SendDefaultHelpText(this, messageOutput); return; } if (uint.TryParse(args[0], out var id)) { if (CharacterManager.Instance.GetAppellationsTemplate(id) == null) { CommandManager.SendErrorText(this, messageOutput, $"<titleId> {id} does not exist in the database"); } else { character.Appellations.Add(id); } } else { CommandManager.SendErrorText(this, messageOutput, "Error parsing <titleId> !"); } } }