2017-08-18 17:29:36 +02:00
|
|
|
#ifndef _SCRIPTMANAGER_H_
|
|
|
|
#define _SCRIPTMANAGER_H_
|
|
|
|
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
#include <mutex>
|
|
|
|
#include <set>
|
|
|
|
|
2017-12-18 12:36:52 +01:00
|
|
|
#include <common/Common.h>
|
2017-12-08 15:38:25 +01:00
|
|
|
#include "Forwards.h"
|
2017-08-18 17:29:36 +02:00
|
|
|
|
|
|
|
namespace Core
|
|
|
|
{
|
|
|
|
namespace Scripting
|
|
|
|
{
|
|
|
|
|
|
|
|
class ScriptManager
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
2017-12-13 15:07:03 +11:00
|
|
|
boost::shared_ptr< NativeScriptManager > m_nativeScriptManager;
|
2017-08-18 17:29:36 +02:00
|
|
|
|
|
|
|
std::function< std::string( Entity::Player& ) > m_onFirstEnterWorld;
|
|
|
|
// auto fn = m_pChaiHandler->eval< std::function<const std::string( Entity::Player ) > >( "onFirstEnterWorld" );
|
|
|
|
|
2017-12-14 22:30:06 +11:00
|
|
|
bool m_firstScriptChangeNotificiation;
|
|
|
|
|
2017-08-18 17:29:36 +02:00
|
|
|
public:
|
|
|
|
ScriptManager();
|
|
|
|
~ScriptManager();
|
|
|
|
|
2017-12-10 23:51:06 +11:00
|
|
|
bool init();
|
2017-08-18 17:29:36 +02:00
|
|
|
void reload();
|
|
|
|
|
2017-12-14 22:30:06 +11:00
|
|
|
void update();
|
|
|
|
|
|
|
|
void watchDirectories();
|
|
|
|
|
2017-12-08 11:46:47 +01:00
|
|
|
void onPlayerFirstEnterWorld( Entity::Player& player );
|
2017-08-18 17:29:36 +02:00
|
|
|
|
|
|
|
static bool registerBnpcTemplate( std::string templateName, uint32_t bnpcBaseId, uint32_t bnpcNameId, uint32_t modelId, std::string aiName );
|
|
|
|
|
2017-12-08 11:46:47 +01:00
|
|
|
bool onTalk( Entity::Player& player, uint64_t actorId, uint32_t eventId );
|
|
|
|
bool onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 );
|
|
|
|
bool onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z );
|
|
|
|
bool onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z );
|
|
|
|
bool onEmote( Entity::Player& player, uint64_t actorId, uint32_t eventId, uint8_t emoteId );
|
|
|
|
bool onEventItem( Entity::Player& player, uint32_t eventItemId, uint32_t eventId, uint32_t castTime, uint64_t targetId );
|
2017-08-18 17:29:36 +02:00
|
|
|
|
2017-12-08 11:46:47 +01:00
|
|
|
bool onMobKill( Entity::Player& player, uint16_t nameId );
|
2017-08-18 17:29:36 +02:00
|
|
|
|
2017-12-08 11:46:47 +01:00
|
|
|
bool onCastFinish( Entity::Player& pPlayer, Entity::ActorPtr pTarget, uint32_t actionId );
|
2017-08-18 17:29:36 +02:00
|
|
|
|
|
|
|
bool onStatusReceive( Entity::ActorPtr pActor, uint32_t effectId );
|
|
|
|
bool onStatusTick( Entity::ActorPtr pActor, Core::StatusEffect::StatusEffect& effect );
|
|
|
|
bool onStatusTimeOut( Entity::ActorPtr pActor, uint32_t effectId );
|
|
|
|
|
|
|
|
bool onZoneInit( ZonePtr pZone );
|
2017-12-10 01:52:03 +11:00
|
|
|
|
2017-12-08 11:46:47 +01:00
|
|
|
bool onEventHandlerReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param1, uint16_t param2, uint16_t param3 );
|
|
|
|
bool onEventHandlerTradeReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param, uint32_t catalogId );
|
2017-12-10 01:52:03 +11:00
|
|
|
|
2018-02-09 02:34:43 +11:00
|
|
|
bool onInstanceInit( InstanceContent& instance );
|
|
|
|
bool onInstanceUpdate( InstanceContent& instance, uint32_t currTime );
|
2017-08-18 17:29:36 +02:00
|
|
|
|
2017-12-14 23:05:53 +11:00
|
|
|
void loadDir( const std::string& dirname, std::set<std::string> &files, const std::string& ext );
|
2017-08-18 17:29:36 +02:00
|
|
|
|
2017-12-13 15:07:03 +11:00
|
|
|
NativeScriptManager& getNativeScriptHandler();
|
2017-08-18 17:29:36 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|