mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 14:37:44 +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
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -120,4 +120,7 @@ cotire/
|
|||
*_cotire.cmake
|
||||
|
||||
*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
|
||||
{
|
||||
/*! Toggles weapon status -> Sheathed/UnSheathed
|
||||
\param param1 status 0|1 */
|
||||
ToggleWeapon = 0x00,
|
||||
/*! Toggles Autoattack status on/off
|
||||
\param param1 status 0|1 */
|
||||
AutoAttack = 0x01,
|
||||
SetStatus = 0x02,
|
||||
CastStart = 0x03,
|
||||
ToggleAggro = 0x04,
|
||||
|
|
|
@ -19,6 +19,9 @@ using namespace Core;
|
|||
#define EVENTSCRIPT_AETHERYTE_ID 0x50000
|
||||
#define EVENTSCRIPT_AETHERNET_ID 0x50001
|
||||
|
||||
/*!
|
||||
* The base class that any script should inherit from and set the type param accordingly
|
||||
*/
|
||||
class ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
@ -26,16 +29,28 @@ protected:
|
|||
std::size_t m_type;
|
||||
|
||||
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 ) :
|
||||
m_id( id ),
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
public:
|
||||
|
@ -50,17 +68,60 @@ public:
|
|||
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 ) { }
|
||||
|
||||
/*!
|
||||
* @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 ) { }
|
||||
|
||||
/*!
|
||||
* @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 ) { }
|
||||
|
||||
/*!
|
||||
* @brief Called when the status effect expires
|
||||
* @param actor The actor on which the efect expired on
|
||||
*/
|
||||
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 ) { }
|
||||
|
||||
/*!
|
||||
* Called when the owner finishes a cast
|
||||
* @param actor The actor who finished a cast
|
||||
*/
|
||||
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 ) { }
|
||||
|
||||
/*!
|
||||
* Called when the status effect owner dies
|
||||
* @param actor The actor that died
|
||||
*/
|
||||
virtual void onPlayerDeath( Entity::Chara& actor ) { }
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* The base class for any scripts that implement behaviour related to actions
|
||||
*/
|
||||
class ActionScript : public ScriptObject
|
||||
{
|
||||
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
|
||||
{
|
||||
protected:
|
||||
|
@ -99,6 +164,9 @@ public:
|
|||
};
|
||||
|
||||
|
||||
/*!
|
||||
* The base class for any scripts that implement behaviour related to BattleNPCs
|
||||
*/
|
||||
class BattleNpcScript : public ScriptObject
|
||||
{
|
||||
public:
|
||||
|
@ -107,6 +175,9 @@ public:
|
|||
{ }
|
||||
};
|
||||
|
||||
/*!
|
||||
* The base class for any scripts that implement behaviour related to zones
|
||||
*/
|
||||
class ZoneScript : public ScriptObject
|
||||
{
|
||||
public:
|
||||
|
@ -117,6 +188,9 @@ public:
|
|||
virtual void onZoneInit() { }
|
||||
};
|
||||
|
||||
/*!
|
||||
* The base class for any scripts that implement behaviour related to instance content zones
|
||||
*/
|
||||
class InstanceContentScript : public ScriptObject
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -14,9 +14,6 @@ extern Core::Framework g_fw;
|
|||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
Core::Scripting::ScriptLoader::ScriptLoader()
|
||||
{}
|
||||
|
||||
const std::string Core::Scripting::ScriptLoader::getModuleExtension()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef CORE_SCRIPTLOADER_H
|
||||
#define CORE_SCRIPTLOADER_H
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <set>
|
||||
|
||||
|
@ -21,28 +20,76 @@ using ModuleHandle = void*;
|
|||
namespace Core {
|
||||
namespace Scripting {
|
||||
|
||||
/*!
|
||||
* Provides low level functionality for loading modules on different platforms along with managing those loaded modules.
|
||||
*/
|
||||
class ScriptLoader
|
||||
{
|
||||
protected:
|
||||
/*!
|
||||
* The internal list of all modules that are loaded.
|
||||
*/
|
||||
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 );
|
||||
|
||||
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();
|
||||
|
||||
/*!
|
||||
* 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& );
|
||||
|
||||
/*!
|
||||
* Unload a script from it's ScriptInfo object
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
bool unloadScript( ScriptInfo* );
|
||||
|
||||
/*!
|
||||
* Unload a script via it's module handle
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
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 );
|
||||
|
||||
/*!
|
||||
* 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 );
|
||||
|
||||
/*!
|
||||
* 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 );
|
||||
|
||||
/*!
|
||||
* 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 );
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue