mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 06:47:45 +00:00
copy scripts to a cache before loading, update config, implement all scriptmanager functionality
This commit is contained in:
parent
53ff4b9330
commit
3656f15d75
20 changed files with 425 additions and 177 deletions
|
@ -6,6 +6,20 @@
|
||||||
<ListenIp>127.0.0.1</ListenIp>
|
<ListenIp>127.0.0.1</ListenIp>
|
||||||
<!-- Path of FFXIV dat files -->
|
<!-- Path of FFXIV dat files -->
|
||||||
<DataPath>H:\\SteamLibrary\\steamapps\\common\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv</DataPath>
|
<DataPath>H:\\SteamLibrary\\steamapps\\common\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv</DataPath>
|
||||||
|
|
||||||
|
<Scripts>
|
||||||
|
<!-- where compiled scripts are placed -->
|
||||||
|
<Path>./compiledscripts/</Path>
|
||||||
|
<!-- path relative to the path above, stores where scripts are when loaded -->
|
||||||
|
<CachePath>./cache/</CachePath>
|
||||||
|
|
||||||
|
<HotSwap>
|
||||||
|
<Enabled>1</Enabled>
|
||||||
|
<BuildDir>../cmake-build-debug/</BuildDir>
|
||||||
|
<BuildCmd>nmake %1%</BuildCmd>
|
||||||
|
</HotSwap>
|
||||||
|
</Scripts>
|
||||||
|
|
||||||
<!-- Path of Chai script files -->
|
<!-- Path of Chai script files -->
|
||||||
<ScriptPath>./compiledscripts/</ScriptPath>
|
<ScriptPath>./compiledscripts/</ScriptPath>
|
||||||
<!-- Connection settings for the mysql db -->
|
<!-- Connection settings for the mysql db -->
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
cmake_minimum_required(VERSION 3.2)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
project(Sapphire_Script)
|
project(Sapphire_Script)
|
||||||
|
|
||||||
file(GLOB SCRIPT_INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
|
file(GLOB SCRIPT_INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
|
||||||
file(GLOB_RECURSE SCRIPT_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
|
file(GLOB_RECURSE SCRIPT_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
|
||||||
|
|
||||||
include_directories("../../src/servers/")
|
include_directories("${CMAKE_SOURCE_DIR}/src/servers/")
|
||||||
include_directories("../../src/servers/Server_Zone/")
|
include_directories("${CMAKE_SOURCE_DIR}/src/servers/Server_Zone/")
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Yc${CMAKE_CURRENT_SOURCE_DIR}/ScriptObject.h /FI${CMAKE_CURRENT_SOURCE_DIR}/ScriptObject.h")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Yc${CMAKE_CURRENT_SOURCE_DIR}/ScriptObject.h /FI${CMAKE_CURRENT_SOURCE_DIR}/ScriptObject.h")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(_sourcefile ${SCRIPT_FILES})
|
foreach(_sourcefile ${SCRIPT_FILES})
|
||||||
|
@ -27,14 +27,17 @@ foreach(_sourcefile ${SCRIPT_FILES})
|
||||||
CXX_STANDARD 14
|
CXX_STANDARD 14
|
||||||
CXX_STANDARD_REQUIRED ON
|
CXX_STANDARD_REQUIRED ON
|
||||||
CXX_EXTENSIONS ON
|
CXX_EXTENSIONS ON
|
||||||
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/compiledscripts/"
|
LIBRARY_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}/compiledscripts/"
|
||||||
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/compiledscripts/"
|
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${EXECUTABLE_OUTPUT_PATH}/compiledscripts/"
|
||||||
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/compiledscripts/"
|
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${EXECUTABLE_OUTPUT_PATH}/compiledscripts/"
|
||||||
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/compiledscripts/"
|
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${EXECUTABLE_OUTPUT_PATH}/compiledscripts/"
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${EXECUTABLE_OUTPUT_PATH}/compiledscripts/"
|
||||||
|
ARCHIVE_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}/compiledscripts/"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(TARGET "${_file}" POST_BUILD
|
add_custom_command(TARGET "${_file}" POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/${_file}.exp"
|
COMMAND ${CMAKE_COMMAND} -E remove "${EXECUTABLE_OUTPUT_PATH}/compiledscripts/${_file}.exp"
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/${_file}.lib"
|
COMMAND ${CMAKE_COMMAND} -E remove "${EXECUTABLE_OUTPUT_PATH}/compiledscripts/${_file}.lib"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove "${EXECUTABLE_OUTPUT_PATH}/compiledscripts/${_file}.ilk"
|
||||||
)
|
)
|
||||||
endforeach(_sourcefile ${SCRIPT_FILES})
|
endforeach(_sourcefile ${SCRIPT_FILES})
|
38
scripts/native/CmnDef/CmnDefCutSceneReplay.cpp
Normal file
38
scripts/native/CmnDef/CmnDefCutSceneReplay.cpp
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#include "../ScriptObject.h"
|
||||||
|
|
||||||
|
class CmnDefCutSceneReplay : public EventScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CmnDefCutSceneReplay() : EventScript( "CmnDefCutSceneReplay", 721028 )
|
||||||
|
{}
|
||||||
|
|
||||||
|
void Scene00000( Entity::Player& player )
|
||||||
|
{
|
||||||
|
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||||
|
{
|
||||||
|
if( param2 != 0 )
|
||||||
|
{
|
||||||
|
Scene00001( player, param2 );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
player.eventPlay( getId(), 0, 0x2000, 0, 1, callback );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00001( Entity::Player& player, uint16_t returnScene )
|
||||||
|
{
|
||||||
|
auto callback = []( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||||
|
{
|
||||||
|
// todo: this is fucked
|
||||||
|
};
|
||||||
|
|
||||||
|
player.eventPlay( getId(), 1, 0xFB2EC8F8, 0, 1, returnScene, callback );
|
||||||
|
}
|
||||||
|
|
||||||
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
|
{
|
||||||
|
Scene00000( player );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPORT_SCRIPTOBJECT( CmnDefCutSceneReplay )
|
58
scripts/native/CmnDef/CmnDefInnBed.cpp
Normal file
58
scripts/native/CmnDef/CmnDefInnBed.cpp
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
#include "../ScriptObject.h"
|
||||||
|
|
||||||
|
class CmnDefInnBed : public EventScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CmnDefInnBed() : EventScript( "CmnDefInnBed", 720916 )
|
||||||
|
{}
|
||||||
|
|
||||||
|
// menu
|
||||||
|
void Scene00000( Entity::Player& player )
|
||||||
|
{
|
||||||
|
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||||
|
{
|
||||||
|
if( param2 > 0 )
|
||||||
|
Scene00001( player, param2 );
|
||||||
|
};
|
||||||
|
|
||||||
|
player.eventPlay( getId(), 0, 0x2000, 0, 1, callback );
|
||||||
|
}
|
||||||
|
|
||||||
|
// lay down
|
||||||
|
void Scene00001( Entity::Player& player, uint16_t param )
|
||||||
|
{
|
||||||
|
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||||
|
{
|
||||||
|
Scene00002( player, param2 );
|
||||||
|
};
|
||||||
|
|
||||||
|
player.eventPlay( getId(), 1, 0xF32E48F8, 0, 1, param, callback );
|
||||||
|
}
|
||||||
|
|
||||||
|
// logout
|
||||||
|
void Scene00002( Entity::Player& player, uint16_t param )
|
||||||
|
{
|
||||||
|
player.eventPlay( getId(), 2, 0xF32E48F8, 0, 1, param, nullptr );
|
||||||
|
}
|
||||||
|
|
||||||
|
// wake up
|
||||||
|
void Scene00100( Entity::Player& player )
|
||||||
|
{
|
||||||
|
auto callback = []( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||||
|
{};
|
||||||
|
|
||||||
|
player.eventPlay( getId(), 100, 0x800, 0, 0, callback );
|
||||||
|
}
|
||||||
|
|
||||||
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
|
{
|
||||||
|
Scene00000( player );
|
||||||
|
}
|
||||||
|
|
||||||
|
void onEnterZone( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||||
|
{
|
||||||
|
Scene00100( player );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPORT_SCRIPTOBJECT( CmnDefInnBed )
|
60
scripts/native/CmnDef/CmnDefLinkShell.cpp
Normal file
60
scripts/native/CmnDef/CmnDefLinkShell.cpp
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
#include "../ScriptObject.h"
|
||||||
|
|
||||||
|
#define ACTION_CREATE 2
|
||||||
|
#define ACTION_RENAME 3
|
||||||
|
#define ACTION_REMOVE 4
|
||||||
|
|
||||||
|
class CmnDefLinkShell : public EventScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CmnDefLinkShell() : EventScript( "CmnDefLinkShell", 0xB0006 )
|
||||||
|
{}
|
||||||
|
|
||||||
|
void Scene00001( Entity::Player& player )
|
||||||
|
{
|
||||||
|
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||||
|
{
|
||||||
|
switch( param2 )
|
||||||
|
{
|
||||||
|
case ACTION_CREATE:
|
||||||
|
Scene00002( player );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ACTION_RENAME:
|
||||||
|
Scene00003( player );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ACTION_REMOVE:
|
||||||
|
Scene00004( player );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
player.eventPlay( getId(), 1, 0, 0, 0, callback );
|
||||||
|
}
|
||||||
|
|
||||||
|
// create linkshell
|
||||||
|
void Scene00002( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.eventPlay( getId(), 2, 0, 0, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// rename linkshell
|
||||||
|
void Scene00003( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.eventPlay( getId(), 3, 0, 0, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove linkshell
|
||||||
|
void Scene00004( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.eventPlay( getId(), 4, 0, 0, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
|
{
|
||||||
|
Scene00001( player );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPORT_SCRIPTOBJECT( CmnDefLinkShell )
|
20
scripts/native/CmnDef/HouFurOrchestrion.cpp
Normal file
20
scripts/native/CmnDef/HouFurOrchestrion.cpp
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#include "../ScriptObject.h"
|
||||||
|
|
||||||
|
class HouFurOrchestrionDef : public EventScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HouFurOrchestrionDef() : EventScript( "HouFurOrchestrionDef", 721226 )
|
||||||
|
{}
|
||||||
|
|
||||||
|
void Scene00000( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.eventPlay( getId(), 0, 0x2000, 0, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
|
{
|
||||||
|
Scene00000( player );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPORT_SCRIPTOBJECT( HouFurOrchestrionDef )
|
15
scripts/native/action/ActionSprint3.cpp
Normal file
15
scripts/native/action/ActionSprint3.cpp
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#include "../ScriptObject.h"
|
||||||
|
|
||||||
|
class ActionSprint3 : public ActionScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ActionSprint3() : ActionScript( "ActionSprint3", 3 )
|
||||||
|
{}
|
||||||
|
|
||||||
|
void onCastFinish( Core::Entity::Player& player, Core::Entity::Actor& targetActor ) override
|
||||||
|
{
|
||||||
|
player.addStatusEffectByIdIfNotExist( 50, 20000, player, 30 );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPORT_SCRIPTOBJECT( ActionSprint3 )
|
|
@ -9,13 +9,13 @@
|
||||||
#define AETHERYTE_MENU_FAVORITE_POINT 4
|
#define AETHERYTE_MENU_FAVORITE_POINT 4
|
||||||
#define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5
|
#define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5
|
||||||
|
|
||||||
class Aethernet : public QuestScript
|
class Aethernet : public EventScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Aethernet() : QuestScript( "Aethernet", EVENTSCRIPT_AETHERNET_ID )
|
Aethernet() : EventScript( "Aethernet", EVENTSCRIPT_AETHERNET_ID )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId )
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
if( player.isAetheryteRegistered( eventId & 0xFFFF ) )
|
if( player.isAetheryteRegistered( eventId & 0xFFFF ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,13 +10,13 @@
|
||||||
#define AETHERYTE_MENU_FAVORITE_POINT 4
|
#define AETHERYTE_MENU_FAVORITE_POINT 4
|
||||||
#define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5
|
#define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5
|
||||||
|
|
||||||
class Aetheryte : public QuestScript
|
class Aetheryte : public EventScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Aetheryte() : QuestScript( "Aetheryte", EVENTSCRIPT_AETHERYTE_ID )
|
Aetheryte() : EventScript( "Aetheryte", EVENTSCRIPT_AETHERYTE_ID )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId )
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
if( player.isAetheryteRegistered( eventId & 0xFFFF ) )
|
if( player.isAetheryteRegistered( eventId & 0xFFFF ) )
|
||||||
{
|
{
|
||||||
|
|
91
scripts/native/opening/OpeningGridania.cpp
Normal file
91
scripts/native/opening/OpeningGridania.cpp
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
#include "../ScriptObject.h"
|
||||||
|
|
||||||
|
#define ERANGE_HOWTO_ANN_AND_QUEST 2117539
|
||||||
|
#define ERANGE_HOWTO_QUEST_REWARD 2366417
|
||||||
|
#define ERANGE_SEQ_1_CLOSED_1 2351918
|
||||||
|
#define POS_SEQ_1_CLOSED_RETURN_1 2351921
|
||||||
|
#define ERANGE_SEQ_1_CLOSED_2 2351919
|
||||||
|
#define POS_SEQ_1_CLOSED_RETURN_2 2351921
|
||||||
|
#define ERANGE_ALWAYS_CLOSED_1 2280846
|
||||||
|
#define POS_ALWAYS_CLOSED_RETURN_1 2320804
|
||||||
|
#define ENPC_ALWAYS_CLOSED_1 2367988
|
||||||
|
#define ERANGE_ALWAYS_CLOSED_3 2280851
|
||||||
|
#define POS_ALWAYS_CLOSED_RETURN_3 2320811
|
||||||
|
#define ENPC_ALWAYS_CLOSED_3 2563491
|
||||||
|
#define BGM_MUSIC_ZONE_FST_TWN 1003
|
||||||
|
#define NCUT_FST_1 3
|
||||||
|
#define NCUT_FST_2 53
|
||||||
|
#define NCUT_FST_3 226
|
||||||
|
#define ENPC_QUEST_OFFER 1985150
|
||||||
|
#define NCUT_LIGHT_ALL 2
|
||||||
|
#define NCUT_LIGHT_FST_1 147
|
||||||
|
#define NCUT_LIGHT_FST_2 146
|
||||||
|
|
||||||
|
class OpeningGridania : public EventScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OpeningGridania() : EventScript( "OpeningGridania", 1245186 )
|
||||||
|
{}
|
||||||
|
|
||||||
|
void Scene00000( Entity::Player& player )
|
||||||
|
{
|
||||||
|
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||||
|
{
|
||||||
|
player.setOpeningSequence( 1 );
|
||||||
|
Scene00001( player );
|
||||||
|
};
|
||||||
|
|
||||||
|
player.eventPlay( getId(), 0, 0x04AC05, 0, 1, callback );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00001( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.eventPlay( getId(), 1, 0x2001, 1, 0x32 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00020( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.eventPlay( getId(), 20, 0x2001, 0, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00030( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.eventPlay( getId(), 30, 0x2001, 0, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00040( Entity::Player& player )
|
||||||
|
{
|
||||||
|
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||||
|
{
|
||||||
|
if( player.getOpeningSequence() == 2 )
|
||||||
|
{
|
||||||
|
// update the instance boundaries
|
||||||
|
Scene00030( player );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////
|
||||||
|
|
||||||
|
void onEnterZone( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||||
|
{
|
||||||
|
if( player.getOpeningSequence() == 0 )
|
||||||
|
{
|
||||||
|
Scene00000( player );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Scene00040( player );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ) override
|
||||||
|
{
|
||||||
|
if( param1 == ERANGE_SEQ_1_CLOSED_1 || param1 == ERANGE_SEQ_1_CLOSED_2 )
|
||||||
|
{
|
||||||
|
Scene00020( player );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPORT_SCRIPTOBJECT( OpeningGridania )
|
0
scripts/native/opening/OpeningLimsa.cpp
Normal file
0
scripts/native/opening/OpeningLimsa.cpp
Normal file
0
scripts/native/opening/OpeningUldah.cpp
Normal file
0
scripts/native/opening/OpeningUldah.cpp
Normal file
|
@ -1,15 +0,0 @@
|
||||||
#include "../ScriptObject.h"
|
|
||||||
|
|
||||||
class ActionSprint : public ActionScript
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ActionSprint() : ActionScript( "ActionSprint", 3 )
|
|
||||||
{}
|
|
||||||
|
|
||||||
virtual void onCastFinish( Core::Entity::Player& player, Core::Entity::Actor& targetActor )
|
|
||||||
{
|
|
||||||
player.addStatusEffectByIdIfNotExist( 50, 20000, player, 30 );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EXPORT_SCRIPTOBJECT( ActionSprint )
|
|
|
@ -1,29 +0,0 @@
|
||||||
#include "../ScriptObject.h"
|
|
||||||
|
|
||||||
class StatusSprint : public StatusEffectScript
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
StatusSprint() : StatusEffectScript( "StatusSprint", 50 )
|
|
||||||
{}
|
|
||||||
|
|
||||||
virtual void onTick( Entity::Actor& actor ) override
|
|
||||||
{
|
|
||||||
if( actor.isPlayer() )
|
|
||||||
actor.getAsPlayer()->sendDebug( "tick tock bitch" );
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void onApply( Entity::Actor& actor ) override
|
|
||||||
{
|
|
||||||
if( actor.isPlayer() )
|
|
||||||
actor.getAsPlayer()->sendDebug( "status50 applied" );
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void onExpire( Entity::Actor& actor ) override
|
|
||||||
{
|
|
||||||
if( actor.isPlayer() )
|
|
||||||
actor.getAsPlayer()->sendDebug( "status50 timed out" );
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
EXPORT_SCRIPTOBJECT( StatusSprint )
|
|
|
@ -93,16 +93,21 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class QuestScript : public ScriptObject
|
class EventScript : public ScriptObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QuestScript( std::string name, uint32_t questId ) :
|
EventScript( std::string name, uint32_t questId ) :
|
||||||
ScriptObject( name, questId, ScriptType::Quest )
|
ScriptObject( name, questId, ScriptType::Quest )
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) { }
|
virtual void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) { }
|
||||||
virtual void onNpcKill( uint32_t npcId, Entity::Player& player ) { }
|
virtual void onNpcKill( uint32_t npcId, Entity::Player& player ) { }
|
||||||
virtual void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) { }
|
virtual void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) { }
|
||||||
|
virtual void onEnterZone( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) { }
|
||||||
|
virtual void onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ) { }
|
||||||
|
virtual void onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ) { }
|
||||||
|
virtual void onEventItem( Entity::Player& player, uint32_t eventItemId, uint32_t eventId, uint32_t castTime, uint64_t targetId ) { }
|
||||||
|
virtual void onEventHandlerTradeReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param, uint32_t catalogId ) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,7 +127,6 @@ public:
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual void onZoneInit() { }
|
virtual void onZoneInit() { }
|
||||||
virtual void onEnterZone( Entity::Player& pPlayer, uint32_t eventId, uint16_t param1, uint16_t param2 ) { }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -24,10 +24,10 @@ namespace Core {
|
||||||
return script->second;
|
return script->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
QuestScript* NativeScriptManager::getQuestScript( uint32_t questId )
|
EventScript* NativeScriptManager::getEventScript( uint32_t questId )
|
||||||
{
|
{
|
||||||
auto script = m_questScripts.find( questId );
|
auto script = m_eventScripts.find( questId );
|
||||||
if( script == m_questScripts.end() )
|
if( script == m_eventScripts.end() )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return script->second;
|
return script->second;
|
||||||
|
@ -59,7 +59,10 @@ namespace Core {
|
||||||
|
|
||||||
auto script = m_loader.getScriptObject( module->handle );
|
auto script = m_loader.getScriptObject( module->handle );
|
||||||
if( !script )
|
if( !script )
|
||||||
|
{
|
||||||
|
m_loader.unloadScript( module );
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
module->script = script;
|
module->script = script;
|
||||||
module->script_name = script->getName();
|
module->script_name = script->getName();
|
||||||
|
@ -74,7 +77,7 @@ namespace Core {
|
||||||
m_actionScripts[ script->getId() ] = dynamic_cast< ActionScript* >( script );
|
m_actionScripts[ script->getId() ] = dynamic_cast< ActionScript* >( script );
|
||||||
break;
|
break;
|
||||||
case ScriptType::Quest:
|
case ScriptType::Quest:
|
||||||
m_questScripts[ script->getId() ] = dynamic_cast< QuestScript* >( script );
|
m_eventScripts[ script->getId() ] = dynamic_cast< EventScript* >( script );
|
||||||
break;
|
break;
|
||||||
case ScriptType::BattleNpc:
|
case ScriptType::BattleNpc:
|
||||||
m_battleNpcScripts[ script->getId() ] = dynamic_cast< BattleNpcScript* >( script );
|
m_battleNpcScripts[ script->getId() ] = dynamic_cast< BattleNpcScript* >( script );
|
||||||
|
@ -113,7 +116,7 @@ namespace Core {
|
||||||
removeValueFromMap< uint32_t, ActionScript* >( ptr, m_actionScripts );
|
removeValueFromMap< uint32_t, ActionScript* >( ptr, m_actionScripts );
|
||||||
break;
|
break;
|
||||||
case ScriptType::Quest:
|
case ScriptType::Quest:
|
||||||
removeValueFromMap< uint32_t, QuestScript* >( ptr, m_questScripts );
|
removeValueFromMap< uint32_t, EventScript* >( ptr, m_eventScripts );
|
||||||
break;
|
break;
|
||||||
case ScriptType::BattleNpc:
|
case ScriptType::BattleNpc:
|
||||||
removeValueFromMap< uint32_t, BattleNpcScript* >( ptr, m_battleNpcScripts );
|
removeValueFromMap< uint32_t, BattleNpcScript* >( ptr, m_battleNpcScripts );
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace Scripting {
|
||||||
protected:
|
protected:
|
||||||
std::unordered_map< uint32_t, StatusEffectScript* > m_statusEffectScripts;
|
std::unordered_map< uint32_t, StatusEffectScript* > m_statusEffectScripts;
|
||||||
std::unordered_map< uint32_t, ActionScript* > m_actionScripts;
|
std::unordered_map< uint32_t, ActionScript* > m_actionScripts;
|
||||||
std::unordered_map< uint32_t, QuestScript* > m_questScripts;
|
std::unordered_map< uint32_t, EventScript* > m_eventScripts;
|
||||||
std::unordered_map< uint32_t, BattleNpcScript* > m_battleNpcScripts;
|
std::unordered_map< uint32_t, BattleNpcScript* > m_battleNpcScripts;
|
||||||
std::unordered_map< uint32_t, ZoneScript* > m_zoneScripts;
|
std::unordered_map< uint32_t, ZoneScript* > m_zoneScripts;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ namespace Scripting {
|
||||||
|
|
||||||
StatusEffectScript* getStatusEffectScript( uint32_t statusId );
|
StatusEffectScript* getStatusEffectScript( uint32_t statusId );
|
||||||
ActionScript* getActionScript( uint32_t actionId );
|
ActionScript* getActionScript( uint32_t actionId );
|
||||||
QuestScript* getQuestScript( uint32_t questId );
|
EventScript* getEventScript( uint32_t questId );
|
||||||
BattleNpcScript* getBattleNpcScript( uint32_t npcId );
|
BattleNpcScript* getBattleNpcScript( uint32_t npcId );
|
||||||
ZoneScript* getZoneScript( uint32_t zoneId );
|
ZoneScript* getZoneScript( uint32_t zoneId );
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@ namespace Scripting {
|
||||||
ScriptInfo() = default;
|
ScriptInfo() = default;
|
||||||
|
|
||||||
std::string library_name;
|
std::string library_name;
|
||||||
|
std::string library_path;
|
||||||
|
|
||||||
std::string script_name;
|
std::string script_name;
|
||||||
ModuleHandle handle;
|
ModuleHandle handle;
|
||||||
ScriptObject* script;
|
ScriptObject* script;
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
#include "ScriptLoader.h"
|
#include "ScriptLoader.h"
|
||||||
|
|
||||||
#include <Server_Common/Logging/Logger.h>
|
#include <Server_Common/Logging/Logger.h>
|
||||||
|
#include <Server_Common/Config/XMLConfig.h>
|
||||||
|
#include "ServerZone.h"
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
|
|
||||||
extern Core::Logger g_log;
|
extern Core::Logger g_log;
|
||||||
|
extern Core::ServerZone g_serverZone;
|
||||||
|
|
||||||
Core::Scripting::ScriptLoader::ScriptLoader()
|
Core::Scripting::ScriptLoader::ScriptLoader()
|
||||||
{}
|
{}
|
||||||
|
@ -51,11 +55,16 @@ Core::Scripting::ScriptInfo* Core::Scripting::ScriptLoader::loadModule( const st
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// copy to temp dir
|
||||||
|
boost::filesystem::path cacheDir( f.parent_path() /= g_serverZone.getConfig()->getValue< std::string >( "Settings.General.Scripts.CachePath", "./cache/" ) );
|
||||||
|
boost::filesystem::create_directories( cacheDir );
|
||||||
|
boost::filesystem::path dest( cacheDir /= f.filename().string() );
|
||||||
|
boost::filesystem::copy_file( f, dest, boost::filesystem::copy_option::overwrite_if_exists );
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ModuleHandle handle = LoadLibrary( path.c_str() );
|
ModuleHandle handle = LoadLibrary( dest.string().c_str() );
|
||||||
#else
|
#else
|
||||||
ModuleHandle handle = dlopen( path.c_str(), RTLD_LAZY );
|
ModuleHandle handle = dlopen( dest.string().c_str(), RTLD_LAZY );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( !handle )
|
if( !handle )
|
||||||
|
@ -70,6 +79,7 @@ Core::Scripting::ScriptInfo* Core::Scripting::ScriptLoader::loadModule( const st
|
||||||
auto info = new ScriptInfo;
|
auto info = new ScriptInfo;
|
||||||
info->handle = handle;
|
info->handle = handle;
|
||||||
info->library_name = f.stem().string();
|
info->library_name = f.stem().string();
|
||||||
|
info->library_path = dest.string();
|
||||||
|
|
||||||
m_scriptMap.insert( std::make_pair( f.stem().string(), info ) );
|
m_scriptMap.insert( std::make_pair( f.stem().string(), info ) );
|
||||||
|
|
||||||
|
@ -110,10 +120,18 @@ bool Core::Scripting::ScriptLoader::unloadScript( ModuleHandle handle )
|
||||||
{
|
{
|
||||||
if( it->second->handle == handle )
|
if( it->second->handle == handle )
|
||||||
{
|
{
|
||||||
delete it->second;
|
auto info = it->second;
|
||||||
m_scriptMap.erase( it );
|
m_scriptMap.erase( it );
|
||||||
|
|
||||||
return unloadModule( handle );
|
if( unloadModule( handle ) )
|
||||||
|
{
|
||||||
|
// remove cached file
|
||||||
|
boost::filesystem::remove( info->library_path );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,15 +39,13 @@ bool Core::Scripting::ScriptManager::init()
|
||||||
{
|
{
|
||||||
std::set< std::string > files;
|
std::set< std::string > files;
|
||||||
|
|
||||||
loadDir( g_serverZone.getConfig()->getValue< std::string >( "Settings.General.ScriptPath", "./compiledscripts/" ),
|
loadDir( g_serverZone.getConfig()->getValue< std::string >( "Settings.General.Scripts.Path", "./compiledscripts/" ),
|
||||||
files, m_nativeScriptManager->getModuleExtension() );
|
files, m_nativeScriptManager->getModuleExtension() );
|
||||||
|
|
||||||
for( auto itr = files.begin(); itr != files.end(); ++itr )
|
for( auto itr = files.begin(); itr != files.end(); ++itr )
|
||||||
{
|
{
|
||||||
auto& path = *itr;
|
auto& path = *itr;
|
||||||
|
|
||||||
g_log.debug( "got module: " + path );
|
|
||||||
|
|
||||||
m_nativeScriptManager->loadScript( path );
|
m_nativeScriptManager->loadScript( path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +122,7 @@ bool Core::Scripting::ScriptManager::onTalk( Entity::Player& player, uint64_t ac
|
||||||
scriptId = EVENTSCRIPT_AETHERNET_ID;
|
scriptId = EVENTSCRIPT_AETHERNET_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto script = m_nativeScriptManager->getQuestScript( scriptId );
|
auto script = m_nativeScriptManager->getEventScript( scriptId );
|
||||||
if( script )
|
if( script )
|
||||||
{
|
{
|
||||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||||
|
@ -159,11 +157,11 @@ bool Core::Scripting::ScriptManager::onEnterTerritory( Entity::Player& player, u
|
||||||
std::string eventName = "onEnterTerritory";
|
std::string eventName = "onEnterTerritory";
|
||||||
std::string objName = Event::getEventName( eventId );
|
std::string objName = Event::getEventName( eventId );
|
||||||
|
|
||||||
auto script = m_nativeScriptManager->getZoneScript( player.getZoneId() );
|
player.sendDebug( "Calling: " + objName + "." + eventName + " - " + std::to_string( eventId ) );
|
||||||
|
|
||||||
|
auto script = m_nativeScriptManager->getEventScript( eventId );
|
||||||
if( script )
|
if( script )
|
||||||
{
|
{
|
||||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
|
||||||
|
|
||||||
player.eventStart( player.getId(), eventId, Event::Event::EnterTerritory, 0, player.getZoneId() );
|
player.eventStart( player.getId(), eventId, Event::Event::EnterTerritory, 0, player.getZoneId() );
|
||||||
|
|
||||||
script->onEnterZone( player, eventId, param1, param2 );
|
script->onEnterZone( player, eventId, param1, param2 );
|
||||||
|
@ -179,30 +177,22 @@ bool Core::Scripting::ScriptManager::onEnterTerritory( Entity::Player& player, u
|
||||||
bool Core::Scripting::ScriptManager::onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1,
|
bool Core::Scripting::ScriptManager::onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1,
|
||||||
float x, float y, float z )
|
float x, float y, float z )
|
||||||
{
|
{
|
||||||
// std::string eventName = "onWithinRange";
|
|
||||||
// std::string objName = Event::getEventName( eventId );
|
std::string eventName = "onWithinRange";
|
||||||
//
|
std::string objName = Event::getEventName( eventId );
|
||||||
// try
|
player.sendDebug( "Calling: " + objName + "." + eventName + " - " + std::to_string( eventId ) + " p1: " + std::to_string( param1 ) );
|
||||||
// {
|
|
||||||
// // Get object from engine
|
auto script = m_nativeScriptManager->getEventScript( eventId );
|
||||||
// auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
|
if( script )
|
||||||
//
|
{
|
||||||
// player.sendDebug( "Calling: " + objName + "." + eventName );
|
player.eventStart( player.getId(), eventId, Event::Event::WithinRange, 1, param1 );
|
||||||
//
|
|
||||||
// player.eventStart( player.getId(), eventId, Event::Event::WithinRange, 1, param1 );
|
script->onWithinRange( player, eventId, param1, x, y, z );
|
||||||
//
|
|
||||||
// auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, uint32_t, Entity::Player&, uint32_t,
|
player.checkEvent( eventId );
|
||||||
// float, float, float ) > >( eventName );
|
|
||||||
// fn( obj, eventId, player, param1, x, y, z );
|
return true;
|
||||||
//
|
}
|
||||||
// player.checkEvent( eventId );
|
|
||||||
// }
|
|
||||||
// catch( std::exception& e )
|
|
||||||
// {
|
|
||||||
// player.sendDebug( e.what() );
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -210,30 +200,21 @@ bool Core::Scripting::ScriptManager::onWithinRange( Entity::Player& player, uint
|
||||||
bool Core::Scripting::ScriptManager::onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1,
|
bool Core::Scripting::ScriptManager::onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1,
|
||||||
float x, float y, float z )
|
float x, float y, float z )
|
||||||
{
|
{
|
||||||
// std::string eventName = "onOutsideRange";
|
std::string eventName = "onOutsideRange";
|
||||||
// std::string objName = Event::getEventName( eventId );
|
std::string objName = Event::getEventName( eventId );
|
||||||
//
|
player.sendDebug( "Calling: " + objName + "." + eventName + " - " + std::to_string( eventId ) );
|
||||||
// try
|
|
||||||
// {
|
auto script = m_nativeScriptManager->getEventScript( eventId );
|
||||||
// // Get object from engine
|
if( script )
|
||||||
// auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
|
{
|
||||||
//
|
player.eventStart( player.getId(), eventId, Event::Event::WithinRange, 1, param1 );
|
||||||
// player.sendDebug( "Calling: " + objName + "." + eventName );
|
|
||||||
//
|
script->onOutsideRange( player, eventId, param1, x, y, z );
|
||||||
// player.eventStart( player.getId(), eventId, Event::Event::OutsideRange, 1, param1 );
|
|
||||||
//
|
player.checkEvent( eventId );
|
||||||
// auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, uint32_t, Entity::Player&, uint32_t,
|
|
||||||
// float, float, float ) > >( eventName );
|
return true;
|
||||||
// fn( obj, eventId, player, param1, x, y, z );
|
}
|
||||||
//
|
|
||||||
// player.checkEvent( eventId );
|
|
||||||
// }
|
|
||||||
// catch( std::exception& e )
|
|
||||||
// {
|
|
||||||
// player.sendDebug( e.what() );
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -244,7 +225,7 @@ bool Core::Scripting::ScriptManager::onEmote( Entity::Player& player, uint64_t a
|
||||||
std::string eventName = "onEmote";
|
std::string eventName = "onEmote";
|
||||||
std::string objName = Event::getEventName( eventId );
|
std::string objName = Event::getEventName( eventId );
|
||||||
|
|
||||||
auto script = m_nativeScriptManager->getQuestScript( eventId );
|
auto script = m_nativeScriptManager->getEventScript( eventId );
|
||||||
if( script )
|
if( script )
|
||||||
{
|
{
|
||||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||||
|
@ -321,20 +302,13 @@ bool Core::Scripting::ScriptManager::onEventHandlerReturn( Entity::Player& playe
|
||||||
bool Core::Scripting::ScriptManager::onEventHandlerTradeReturn( Entity::Player& player, uint32_t eventId,
|
bool Core::Scripting::ScriptManager::onEventHandlerTradeReturn( Entity::Player& player, uint32_t eventId,
|
||||||
uint16_t subEvent, uint16_t param, uint32_t catalogId )
|
uint16_t subEvent, uint16_t param, uint32_t catalogId )
|
||||||
{
|
{
|
||||||
// std::string eventName = Event::getEventName( eventId ) + "_TRADE";
|
auto script = m_nativeScriptManager->getEventScript( eventId );
|
||||||
//
|
if( script )
|
||||||
// try
|
{
|
||||||
// {
|
script->onEventHandlerTradeReturn( player, eventId, subEvent, param, catalogId );
|
||||||
// auto fn = m_pChaiHandler->eval< std::function< void( Entity::Player&, uint32_t,
|
|
||||||
// uint16_t, uint16_t, uint32_t ) > >( eventName );
|
return true;
|
||||||
// fn( player, eventId, subEvent, param, catalogId );
|
}
|
||||||
// }
|
|
||||||
// catch( ... )
|
|
||||||
// {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return true;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -342,28 +316,20 @@ bool Core::Scripting::ScriptManager::onEventHandlerTradeReturn( Entity::Player&
|
||||||
bool Core::Scripting::ScriptManager::onEventItem( Entity::Player& player, uint32_t eventItemId,
|
bool Core::Scripting::ScriptManager::onEventItem( Entity::Player& player, uint32_t eventItemId,
|
||||||
uint32_t eventId, uint32_t castTime, uint64_t targetId )
|
uint32_t eventId, uint32_t castTime, uint64_t targetId )
|
||||||
{
|
{
|
||||||
// std::string eventName = "onEventItem";
|
std::string eventName = "onEventItem";
|
||||||
// std::string objName = Event::getEventName( eventId );
|
std::string objName = Event::getEventName( eventId );
|
||||||
//
|
player.sendDebug( "Calling: " + objName + "." + eventName + " - " + std::to_string( eventId ) );
|
||||||
// try
|
|
||||||
// {
|
auto script = m_nativeScriptManager->getEventScript( eventId );
|
||||||
// auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
|
if( script )
|
||||||
//
|
{
|
||||||
// player.sendDebug( "Calling: " + objName + "." + eventName );
|
player.eventStart( targetId, eventId, Event::Event::Item, 0, 0 );
|
||||||
//
|
|
||||||
// player.eventStart( targetId, eventId, Event::Event::Item, 0, 0 );
|
script->onEventItem( player, eventItemId, eventId, castTime, targetId );
|
||||||
//
|
|
||||||
// auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, uint32_t, Entity::Player&,
|
return true;
|
||||||
// uint32_t, uint32_t, uint64_t ) > >( eventName );
|
}
|
||||||
// fn( obj, eventId, player, eventItemId, castTime, targetId );
|
|
||||||
// }
|
|
||||||
// catch( std::exception& e )
|
|
||||||
// {
|
|
||||||
// player.sendNotice( e.what() );
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +347,7 @@ bool Core::Scripting::ScriptManager::onMobKill( Entity::Player& player, uint16_t
|
||||||
|
|
||||||
uint16_t questId = activeQuests->c.questId;
|
uint16_t questId = activeQuests->c.questId;
|
||||||
|
|
||||||
auto script = m_nativeScriptManager->getQuestScript( questId );
|
auto script = m_nativeScriptManager->getEventScript( questId );
|
||||||
if( script )
|
if( script )
|
||||||
{
|
{
|
||||||
std::string objName = Event::getEventName( 0x00010000 | questId );
|
std::string objName = Event::getEventName( 0x00010000 | questId );
|
||||||
|
|
Loading…
Add table
Reference in a new issue