2017-12-10 01:52:03 +11:00
|
|
|
#ifndef NATIVE_SCRIPT_API
|
|
|
|
#define NATIVE_SCRIPT_API
|
|
|
|
|
|
|
|
#include <string>
|
2017-12-10 02:49:22 +11:00
|
|
|
#include <Actor/Actor.h>
|
|
|
|
#include <Actor/Player.h>
|
|
|
|
#include <StatusEffect/StatusEffect.h>
|
2017-12-10 01:52:03 +11:00
|
|
|
|
|
|
|
#define EXPORT_SCRIPTOBJECT( type, base ) \
|
2017-12-10 03:01:21 +11:00
|
|
|
extern "C" __declspec( dllexport ) base* get##base() \
|
2017-12-10 01:52:03 +11:00
|
|
|
{ return static_cast< base* >( new type ); }
|
|
|
|
|
|
|
|
#define EXPORT_STATUSEFFECTSCRIPT( type ) EXPORT_SCRIPTOBJECT( type, StatusEffectScript )
|
|
|
|
#define EXPORT_ABILITYSCRIPT( type ) EXPORT_SCRIPTOBJECT( type, AbilityScript )
|
|
|
|
#define EXPORT_QUESTSCRIPT( type ) EXPORT_SCRIPTOBJECT( type, QuestScript )
|
|
|
|
#define EXPORT_BATTLENPCSCRIPT( type ) EXPORT_SCRIPTOBJECT( type, BattleNpcScript )
|
|
|
|
#define EXPORT_ZONESCRIPT( type ) EXPORT_SCRIPTOBJECT( type, ZoneScript )
|
|
|
|
|
|
|
|
class ScriptObject
|
|
|
|
{
|
|
|
|
protected:
|
2017-12-10 02:13:54 +11:00
|
|
|
const std::string m_scriptName;
|
2017-12-10 01:52:03 +11:00
|
|
|
|
|
|
|
public:
|
2017-12-10 02:13:54 +11:00
|
|
|
ScriptObject( std::string name ) :
|
|
|
|
m_scriptName( name )
|
|
|
|
{ }
|
|
|
|
|
|
|
|
const std::string getName()
|
|
|
|
{
|
|
|
|
return m_scriptName;
|
|
|
|
}
|
2017-12-10 01:52:03 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-12-10 03:01:21 +11:00
|
|
|
class StatusEffectScript : public ScriptObject
|
2017-12-10 01:52:03 +11:00
|
|
|
{
|
|
|
|
protected:
|
|
|
|
const uint32_t m_effectId;
|
2017-12-10 02:13:54 +11:00
|
|
|
|
2017-12-10 01:52:03 +11:00
|
|
|
public:
|
2017-12-10 02:13:54 +11:00
|
|
|
StatusEffectScript( std::string name, uint32_t effectId ) :
|
|
|
|
ScriptObject( name ),
|
|
|
|
m_effectId( effectId )
|
|
|
|
{ }
|
|
|
|
|
|
|
|
const uint32_t getEffectId( )
|
|
|
|
{
|
|
|
|
return m_effectId;
|
|
|
|
}
|
|
|
|
|
2017-12-10 03:01:21 +11:00
|
|
|
virtual void onTick( Core::Entity::ActorPtr actor ) { }
|
|
|
|
virtual void onApply( Core::Entity::ActorPtr actor ) { }
|
|
|
|
virtual void onRemove( Core::Entity::ActorPtr actor ) { }
|
2017-12-10 02:13:54 +11:00
|
|
|
virtual void onExpire(Core::Entity::ActorPtr actor) { }
|
2017-12-10 03:01:21 +11:00
|
|
|
virtual void onPlayerCollision( Core::Entity::ActorPtr actor, Core::Entity::ActorPtr actorHit ) { }
|
|
|
|
virtual void onPlayerFinishCast( Core::Entity::ActorPtr actor ) { }
|
|
|
|
virtual void onPlayerDamaged( Core::Entity::ActorPtr actor ) { }
|
|
|
|
virtual void onPlayerDeath( Core::Entity::ActorPtr actor ) { }
|
2017-12-10 01:52:03 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-12-10 03:01:21 +11:00
|
|
|
class AbilityScript : public ScriptObject
|
2017-12-10 01:52:03 +11:00
|
|
|
{
|
|
|
|
protected:
|
2017-12-10 02:13:54 +11:00
|
|
|
const uint32_t m_abilityId;
|
2017-12-10 01:52:03 +11:00
|
|
|
|
|
|
|
public:
|
2017-12-10 02:13:54 +11:00
|
|
|
AbilityScript( std::string name, uint32_t abilityId ) :
|
|
|
|
ScriptObject( name ),
|
|
|
|
m_abilityId( abilityId )
|
|
|
|
{ }
|
|
|
|
|
|
|
|
const uint32_t GetAbilityId( )
|
|
|
|
{
|
|
|
|
return m_abilityId;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void onStart( Core::Entity::Actor sourceActor, Core::Entity::Actor targetActor ) { }
|
2017-12-10 03:01:21 +11:00
|
|
|
virtual void onCastFinish(Core::Entity::Player player, Core::Entity::ActorPtr targetActor) { }
|
2017-12-10 02:13:54 +11:00
|
|
|
virtual void onInterrupt( Core::Entity::Actor sourceActor/*, Core::Entity::Actor targetActor*/ ) { }
|
2017-12-10 01:52:03 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-12-10 03:01:21 +11:00
|
|
|
class QuestScript : public ScriptObject
|
2017-12-10 01:52:03 +11:00
|
|
|
{
|
|
|
|
protected:
|
2017-12-10 02:13:54 +11:00
|
|
|
const uint32_t m_questId;
|
|
|
|
|
2017-12-10 01:52:03 +11:00
|
|
|
public:
|
2017-12-10 02:13:54 +11:00
|
|
|
QuestScript( std::string name, uint32_t questId ) :
|
|
|
|
ScriptObject( name ),
|
|
|
|
m_questId( questId )
|
|
|
|
{ }
|
|
|
|
|
|
|
|
const uint32_t getQuestId()
|
|
|
|
{
|
|
|
|
return m_questId;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void onTalk(uint32_t eventId, Core::Entity::Player player, uint64_t actorId) { }
|
|
|
|
virtual void onNpcKill( uint32_t npcId, Core::Entity::Player player ) { }
|
|
|
|
virtual void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Core::Entity::Player player ) { }
|
2017-12-10 01:52:03 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-12-10 03:01:21 +11:00
|
|
|
class BattleNpcScript : public ScriptObject
|
2017-12-10 01:52:03 +11:00
|
|
|
{
|
2017-12-10 02:13:54 +11:00
|
|
|
protected:
|
|
|
|
const uint32_t m_npcId;
|
|
|
|
|
2017-12-10 01:52:03 +11:00
|
|
|
public:
|
2017-12-10 02:13:54 +11:00
|
|
|
BattleNpcScript( std::string name, uint32_t npcId ) :
|
|
|
|
ScriptObject( name ),
|
|
|
|
m_npcId( npcId )
|
|
|
|
{ }
|
|
|
|
|
|
|
|
const uint32_t getNpcId()
|
|
|
|
{
|
|
|
|
return m_npcId;
|
|
|
|
}
|
2017-12-10 01:52:03 +11:00
|
|
|
};
|
|
|
|
|
2017-12-10 03:01:21 +11:00
|
|
|
class ZoneScript : public ScriptObject
|
2017-12-10 01:52:03 +11:00
|
|
|
{
|
2017-12-10 02:13:54 +11:00
|
|
|
protected:
|
|
|
|
const uint32_t m_zoneId;
|
|
|
|
|
2017-12-10 01:52:03 +11:00
|
|
|
public:
|
2017-12-10 02:13:54 +11:00
|
|
|
ZoneScript( std::string name, uint32_t zoneId ) :
|
|
|
|
ScriptObject( name ),
|
|
|
|
m_zoneId( zoneId )
|
|
|
|
{ }
|
|
|
|
|
2017-12-10 01:52:03 +11:00
|
|
|
|
2017-12-10 02:13:54 +11:00
|
|
|
virtual void onZoneInit() { }
|
|
|
|
virtual void onEnterZone( Core::Entity::Player pPlayer, uint32_t eventId, uint16_t param1, uint16_t param2 ) { }
|
2017-12-10 01:52:03 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|