blob: 974c44c5739d0bfeddcd2e65917494aefdb50bb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
using System.Linq;
using DSACore.Auxiliary;
using DSACore.DSA_Game.Save;
namespace DSACore.Commands
{
public class Help
{
//public static List<CommandInfo> Commands { get; } = new List<CommandInfo>();
public static string Get_Specific_Help(string command)
{
// return command specific help
var com = Properties.CommandInfos
.OrderBy(x => SpellCorrect.CompareEasy(x.Name, command.ToLower())).First(); // get best fit command
return com.GetDescription();
}
public static string Get_Generic_Help()
{
var res = "";
foreach (var com in Properties.CommandInfos)
{
var first_column_width = 8;
res += ("!" + com.Name + ": ").AddSpaces(first_column_width) + com.Brief;
if (com.Description.Length > 1)
res += "\n" + "".AddSpaces(first_column_width) + "(\"!man " + com.Name +
"\" gibt genauere Informationen)";
res += "\n\n";
}
return res;
}
public static string ShowHelp(params string[] commandList)
{
var command = "";
if (commandList.Length > 0) command = commandList.Aggregate((s, c) => s + " " + c);
if (command.Equals(string.Empty)) // return generic Help
{
var res = Get_Generic_Help();
return res;
}
return Get_Specific_Help(command);
}
}
}
|