mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-04-30 17:49:20 +02:00
85 lines
2.3 KiB
C++
85 lines
2.3 KiB
C++
/**
|
|
* Tibia GIMUD Server - a free and open-source MMORPG server emulator
|
|
* Copyright (C) 2019 Sabrehaven and Mark Samman <mark.samman@gmail.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*/
|
|
|
|
#ifndef FS_TALKACTION_H_E6AABAC0F89843469526ADF310F3131C
|
|
#define FS_TALKACTION_H_E6AABAC0F89843469526ADF310F3131C
|
|
|
|
#include "luascript.h"
|
|
#include "baseevents.h"
|
|
#include "const.h"
|
|
|
|
enum TalkActionResult_t {
|
|
TALKACTION_CONTINUE,
|
|
TALKACTION_BREAK,
|
|
TALKACTION_FAILED,
|
|
};
|
|
|
|
class TalkAction;
|
|
|
|
class TalkActions : public BaseEvents
|
|
{
|
|
public:
|
|
TalkActions();
|
|
~TalkActions();
|
|
|
|
// non-copyable
|
|
TalkActions(const TalkActions&) = delete;
|
|
TalkActions& operator=(const TalkActions&) = delete;
|
|
|
|
TalkActionResult_t playerSaySpell(Player* player, SpeakClasses type, const std::string& words) const;
|
|
|
|
protected:
|
|
LuaScriptInterface& getScriptInterface() final;
|
|
std::string getScriptBaseName() const final;
|
|
Event* getEvent(const std::string& nodeName) final;
|
|
bool registerEvent(Event* event, const pugi::xml_node& node) final;
|
|
void clear() final;
|
|
|
|
std::forward_list<TalkAction> talkActions;
|
|
|
|
LuaScriptInterface scriptInterface;
|
|
};
|
|
|
|
class TalkAction : public Event
|
|
{
|
|
public:
|
|
explicit TalkAction(LuaScriptInterface* interface) : Event(interface) {}
|
|
|
|
bool configureEvent(const pugi::xml_node& node) override;
|
|
|
|
const std::string& getWords() const {
|
|
return words;
|
|
}
|
|
char getSeparator() const {
|
|
return separator;
|
|
}
|
|
|
|
//scripting
|
|
bool executeSay(Player* player, const std::string& param, SpeakClasses type) const;
|
|
//
|
|
|
|
protected:
|
|
std::string getScriptEventName() const override;
|
|
|
|
std::string words;
|
|
char separator = '"';
|
|
};
|
|
|
|
#endif
|