mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 06:47:45 +00:00
doxygen doco generation + some documentation for script system
This commit is contained in:
parent
a3b934463d
commit
5fab7c1242
8 changed files with 2626 additions and 6 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -121,3 +121,6 @@ cotire/
|
||||||
|
|
||||||
*objects.txt
|
*objects.txt
|
||||||
*exports.def
|
*exports.def
|
||||||
|
|
||||||
|
# doxygen output folder
|
||||||
|
doxygen/generated/
|
2494
doxygen/Doxyfile
Normal file
2494
doxygen/Doxyfile
Normal file
File diff suppressed because it is too large
Load diff
0
doxygen/extra_stylesheet.css
Normal file
0
doxygen/extra_stylesheet.css
Normal file
BIN
doxygen/logo.png
Normal file
BIN
doxygen/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
|
@ -17,7 +17,12 @@ namespace Core {
|
||||||
|
|
||||||
enum ActorControlType : uint16_t
|
enum ActorControlType : uint16_t
|
||||||
{
|
{
|
||||||
|
/*! Toggles weapon status -> Sheathed/UnSheathed
|
||||||
|
\param param1 status 0|1 */
|
||||||
ToggleWeapon = 0x00,
|
ToggleWeapon = 0x00,
|
||||||
|
/*! Toggles Autoattack status on/off
|
||||||
|
\param param1 status 0|1 */
|
||||||
|
AutoAttack = 0x01,
|
||||||
SetStatus = 0x02,
|
SetStatus = 0x02,
|
||||||
CastStart = 0x03,
|
CastStart = 0x03,
|
||||||
ToggleAggro = 0x04,
|
ToggleAggro = 0x04,
|
||||||
|
|
|
@ -19,6 +19,9 @@ using namespace Core;
|
||||||
#define EVENTSCRIPT_AETHERYTE_ID 0x50000
|
#define EVENTSCRIPT_AETHERYTE_ID 0x50000
|
||||||
#define EVENTSCRIPT_AETHERNET_ID 0x50001
|
#define EVENTSCRIPT_AETHERNET_ID 0x50001
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* The base class that any script should inherit from and set the type param accordingly
|
||||||
|
*/
|
||||||
class ScriptObject
|
class ScriptObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
@ -26,16 +29,28 @@ protected:
|
||||||
std::size_t m_type;
|
std::size_t m_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/*!
|
||||||
|
* @param id an ID which uniquely identifies this script in relation to it's type
|
||||||
|
* @param type The RTTI hash code of the implementing type to uniquely identify it
|
||||||
|
*/
|
||||||
ScriptObject( uint32_t id, std::size_t type ) :
|
ScriptObject( uint32_t id, std::size_t type ) :
|
||||||
m_id( id ),
|
m_id( id ),
|
||||||
m_type( type )
|
m_type( type )
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Gets the ID set for this script
|
||||||
|
* @return The allocated ID of the script set during object construction
|
||||||
|
*/
|
||||||
virtual uint32_t getId() const
|
virtual uint32_t getId() const
|
||||||
{
|
{
|
||||||
return m_id;
|
return m_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Gets the unique identifier (hash_code) of the script
|
||||||
|
* @return The hash_code of the script
|
||||||
|
*/
|
||||||
virtual std::size_t getType() const
|
virtual std::size_t getType() const
|
||||||
{
|
{
|
||||||
return m_type;
|
return m_type;
|
||||||
|
@ -43,6 +58,9 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* The base class for any scripts that implement behaviour related to status effects.
|
||||||
|
*/
|
||||||
class StatusEffectScript : public ScriptObject
|
class StatusEffectScript : public ScriptObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -50,17 +68,60 @@ public:
|
||||||
ScriptObject( effectId, typeid( StatusEffectScript ).hash_code() )
|
ScriptObject( effectId, typeid( StatusEffectScript ).hash_code() )
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Called on each tick that a status effect is active on an actor
|
||||||
|
* @param actor the actor the status effect is ticking on
|
||||||
|
*/
|
||||||
virtual void onTick( Entity::Chara& actor ) { }
|
virtual void onTick( Entity::Chara& actor ) { }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Called when the status effect is applied to an actor
|
||||||
|
* @param actor the actor on which the status effect was applied to
|
||||||
|
*/
|
||||||
virtual void onApply( Entity::Chara& actor ) { }
|
virtual void onApply( Entity::Chara& actor ) { }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Called when the actor (usually a player) removes the status effect by right clicking it
|
||||||
|
* @param actor The actor on which the effect was removed from
|
||||||
|
*/
|
||||||
virtual void onRemove( Entity::Chara& actor ) { }
|
virtual void onRemove( Entity::Chara& actor ) { }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Called when the status effect expires
|
||||||
|
* @param actor The actor on which the efect expired on
|
||||||
|
*/
|
||||||
virtual void onExpire( Entity::Chara& actor ) { }
|
virtual void onExpire( Entity::Chara& actor ) { }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Called when the player with the status effect collides with another player, eg. hot potato
|
||||||
|
* @param actor The actor which has status effect
|
||||||
|
* @param actorHit The actor who collided with the status effect owner
|
||||||
|
*/
|
||||||
virtual void onPlayerCollision( Entity::Chara& actor, Entity::Chara& actorHit ) { }
|
virtual void onPlayerCollision( Entity::Chara& actor, Entity::Chara& actorHit ) { }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Called when the owner finishes a cast
|
||||||
|
* @param actor The actor who finished a cast
|
||||||
|
*/
|
||||||
virtual void onPlayerFinishCast( Entity::Chara& actor ) { }
|
virtual void onPlayerFinishCast( Entity::Chara& actor ) { }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Called when the status effect owner was damaged
|
||||||
|
* @param actor The actor that was damaged
|
||||||
|
*/
|
||||||
virtual void onPlayerDamaged( Entity::Chara& actor ) { }
|
virtual void onPlayerDamaged( Entity::Chara& actor ) { }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Called when the status effect owner dies
|
||||||
|
* @param actor The actor that died
|
||||||
|
*/
|
||||||
virtual void onPlayerDeath( Entity::Chara& actor ) { }
|
virtual void onPlayerDeath( Entity::Chara& actor ) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* The base class for any scripts that implement behaviour related to actions
|
||||||
|
*/
|
||||||
class ActionScript : public ScriptObject
|
class ActionScript : public ScriptObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -74,6 +135,10 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* The base class for any scripts that implement behaviour related to the event system.
|
||||||
|
* This includes but is not limited to: NPCs, shops, some world objects
|
||||||
|
*/
|
||||||
class EventScript : public ScriptObject
|
class EventScript : public ScriptObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
@ -99,6 +164,9 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* The base class for any scripts that implement behaviour related to BattleNPCs
|
||||||
|
*/
|
||||||
class BattleNpcScript : public ScriptObject
|
class BattleNpcScript : public ScriptObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -107,6 +175,9 @@ public:
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* The base class for any scripts that implement behaviour related to zones
|
||||||
|
*/
|
||||||
class ZoneScript : public ScriptObject
|
class ZoneScript : public ScriptObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -117,6 +188,9 @@ public:
|
||||||
virtual void onZoneInit() { }
|
virtual void onZoneInit() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* The base class for any scripts that implement behaviour related to instance content zones
|
||||||
|
*/
|
||||||
class InstanceContentScript : public ScriptObject
|
class InstanceContentScript : public ScriptObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -14,9 +14,6 @@ extern Core::Framework g_fw;
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
|
|
||||||
Core::Scripting::ScriptLoader::ScriptLoader()
|
|
||||||
{}
|
|
||||||
|
|
||||||
const std::string Core::Scripting::ScriptLoader::getModuleExtension()
|
const std::string Core::Scripting::ScriptLoader::getModuleExtension()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef CORE_SCRIPTLOADER_H
|
#ifndef CORE_SCRIPTLOADER_H
|
||||||
#define CORE_SCRIPTLOADER_H
|
#define CORE_SCRIPTLOADER_H
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
@ -21,28 +20,76 @@ using ModuleHandle = void*;
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Scripting {
|
namespace Scripting {
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Provides low level functionality for loading modules on different platforms along with managing those loaded modules.
|
||||||
|
*/
|
||||||
class ScriptLoader
|
class ScriptLoader
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
/*!
|
||||||
|
* The internal list of all modules that are loaded.
|
||||||
|
*/
|
||||||
std::unordered_map< std::string, ScriptInfo* > m_scriptMap;
|
std::unordered_map< std::string, ScriptInfo* > m_scriptMap;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Unload a loaded module from it's ModuleHandle
|
||||||
|
* @return true if the unload was successful, false if not
|
||||||
|
*/
|
||||||
bool unloadModule( ModuleHandle );
|
bool unloadModule( ModuleHandle );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScriptLoader();
|
ScriptLoader() = default;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Gets the module file extention for the current platform (windows, linux, osx)
|
||||||
|
* @return The file extension for the current platform
|
||||||
|
*/
|
||||||
const std::string getModuleExtension();
|
const std::string getModuleExtension();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Load a module from a path
|
||||||
|
* @return A pointer to ScriptInfo if the load was successful, nullptr if it failed
|
||||||
|
*/
|
||||||
ScriptInfo* loadModule( const std::string& );
|
ScriptInfo* loadModule( const std::string& );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Unload a script from it's ScriptInfo object
|
||||||
|
* @return true if successful, false if not
|
||||||
|
*/
|
||||||
bool unloadScript( ScriptInfo* );
|
bool unloadScript( ScriptInfo* );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Unload a script via it's module handle
|
||||||
|
* @return true if successful, false if not
|
||||||
|
*/
|
||||||
bool unloadScript( ModuleHandle );
|
bool unloadScript( ModuleHandle );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Look up a ScriptInfo* by a module name
|
||||||
|
* @param name The exact module name to search for, case-sensitive
|
||||||
|
* @return The ScriptInfo ptr if successful, nullptr if it wasn't found
|
||||||
|
*/
|
||||||
ScriptInfo* getScriptInfo( std::string name );
|
ScriptInfo* getScriptInfo( std::string name );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Get all scripts assoicated with a module
|
||||||
|
* @param handle The handle to the module
|
||||||
|
* @return An array of unknown size ending with nullptr if success, nullptr if not
|
||||||
|
*/
|
||||||
ScriptObject** getScripts( ModuleHandle handle );
|
ScriptObject** getScripts( ModuleHandle handle );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Checks to see if a module with the specified name exists
|
||||||
|
* @param name The module name to lookup
|
||||||
|
* @return true if loaded, false if not
|
||||||
|
*/
|
||||||
bool isModuleLoaded( std::string name );
|
bool isModuleLoaded( std::string name );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Case-insensitive search for modules, useful for debug commands
|
||||||
|
* @param scripts a set of ScriptInfo ptrs
|
||||||
|
* @param search the search term
|
||||||
|
*/
|
||||||
void findScripts( std::set< Core::Scripting::ScriptInfo* >& scripts, const std::string& search );
|
void findScripts( std::set< Core::Scripting::ScriptInfo* >& scripts, const std::string& search );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue