123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #pragma once
- #include <ReferenceCounter.h>
- #include <Text.h>
- #include "Entity.h"
- class ChatCommandParameter;
- class ChatCommand : public virtual Framework::ReferenceCounter
- {
- private:
- Framework::Text name;
- Framework::Text description;
- int securityLevel;
- Framework::RCArray<ChatCommandParameter> params;
- protected:
- void addParam(ChatCommandParameter* param);
- public:
- ChatCommand(
- Framework::Text name, Framework::Text description, int securityLevel);
- virtual void execute(
- Framework::RCArray<Framework::Text> params, Entity* zActor) const = 0;
- const Framework::RCArray<ChatCommandParameter>& getParams() const;
- Framework::Text getName() const;
- Framework::Text getHelp() const;
- virtual int getSecurityLevel(
- Framework::RCArray<Framework::Text> params) const;
- };
- class ChatCommandParameter : public virtual Framework::ReferenceCounter
- {
- private:
- Framework::Text name;
- Framework::Text description;
- bool optional;
- public:
- ChatCommandParameter(
- Framework::Text name, Framework::Text description, bool optional);
- virtual bool isLegalValue(Framework::Text value) const;
- virtual Framework::Text getDefaultValue(Entity* zActor) const;
- Framework::Text getName() const;
- Framework::Text getDescription() const;
- bool isOptional() const;
- };
- class PlayerNameParameter : public ChatCommandParameter
- {
- public:
- PlayerNameParameter();
- bool isLegalValue(Framework::Text value) const override;
- Framework::Text getDefaultValue(Entity* zActor) const override;
- };
- class IntegerParameter : public ChatCommandParameter
- {
- private:
- std::function<int(Entity* zEntity)> calculateDefault;
- public:
- IntegerParameter(Framework::Text name,
- Framework::Text description,
- bool optional,
- std::function<int(Entity* zEntity)> calculateDefault);
- bool isLegalValue(Framework::Text value) const override;
- Framework::Text getDefaultValue(Entity* zActor) const override;
- };
|