#include "ChatCommand.h" ChatCommand::ChatCommand( Framework::Text name, Framework::Text description, int securityLevel) : Framework::ReferenceCounter(), name(name), description(description), securityLevel(securityLevel) {} void ChatCommand::addParam(ChatCommandParameter* param) { params.add(param); } const Framework::RCArray& ChatCommand::getParams() const { return params; } Framework::Text ChatCommand::getName() const { return name; } Framework::Text ChatCommand::getHelp() const { Framework::Text result = "/"; result += name; for (ChatCommandParameter* param : params) { result += " "; if (param->isOptional()) result += "["; result += param->getName(); if (param->isOptional()) result += "]"; } if (description.getLength() > 0) { result += "\n "; result += description; } for (ChatCommandParameter* param : params) { if (param->getDescription().getLength() > 0) { result += "\n "; if (param->isOptional()) result += "["; result += param->getName(); if (param->isOptional()) result += "]"; result += " - "; result += param->getDescription(); } } return result; } int ChatCommand::getSecurityLevel() const { return securityLevel; } ChatCommandParameter::ChatCommandParameter( Framework::Text name, Framework::Text description, bool optional) : ReferenceCounter(), name(name), description(description), optional(optional) {} bool ChatCommandParameter::isLegalValue(Framework::Text value) const { return 1; } Framework::Text ChatCommandParameter::getDefaultValue(Entity* zActor) const { return ""; } Framework::Text ChatCommandParameter::getName() const { return name; } Framework::Text ChatCommandParameter::getDescription() const { return description; } bool ChatCommandParameter::isOptional() const { return optional; }