Terraria ModLoader  0.10.1.5
A framework for Terraria mods
Terraria.ModLoader.CommandManager Class Reference

This serves as the central class from which ModCommand functions are supported and carried out. More...

+ Collaboration diagram for Terraria.ModLoader.CommandManager:

Static Public Member Functions

static List< Tuple< string, string > > GetHelp (CommandType type)
 
static bool Matches (CommandType commandType, CommandType callerType)
 

Detailed Description

This serves as the central class from which ModCommand functions are supported and carried out.

Definition at line 12 of file CommandManager.cs.

Member Function Documentation

static List<Tuple<string, string> > Terraria.ModLoader.CommandManager.GetHelp ( CommandType  type)
static

Definition at line 114 of file CommandManager.cs.

References Terraria.ModLoader.ModCommand.Command.

114  {
115  var list = new List<Tuple<string, string>>();
116  foreach (var entry in Commands) {
117  var cmdList = entry.Value.Where(mc => Matches(mc.Type, type)).ToList();
118  foreach (var mc in cmdList) {
119  string cmd = mc.Command;
120  if (cmdList.Count > 1)
121  cmd = mc.mod.Name + ":" + cmd;
122 
123  list.Add(Tuple.Create(cmd, mc.Description));
124  }
125  }
126  return list;
127  }
static bool Matches(CommandType commandType, CommandType callerType)
static bool Terraria.ModLoader.CommandManager.Matches ( CommandType  commandType,
CommandType  callerType 
)
static

Definition at line 16 of file CommandManager.cs.

References Terraria.ModLoader.ModCommand.Action(), Terraria.ModLoader.ModCommand.Command, Terraria.ModLoader.CommandCaller.CommandType, Terraria.ModLoader.ModLoader.GetMod(), and Terraria.ModLoader.CommandCaller.Reply().

16  {
17  if ((commandType & CommandType.World) != 0)
18  if (Main.netMode == 2)
19  commandType |= CommandType.Server;
20  else if (Main.netMode == 0)
21  commandType |= CommandType.Chat;
22 
23  return (callerType & commandType) != 0;
24  }
CommandType
A flag enum representing context where this command operates.
Definition: ModCommand.cs:9

+ Here is the call graph for this function: