diff --git a/src/servers/sapphire_zone/Script/NativeScriptApi.h b/src/servers/sapphire_zone/Script/NativeScriptApi.h index 77a8f3d6..cf6393cb 100644 --- a/src/servers/sapphire_zone/Script/NativeScriptApi.h +++ b/src/servers/sapphire_zone/Script/NativeScriptApi.h @@ -15,12 +15,13 @@ using namespace Core; +// todo: this is shit // constant script ids for certain events #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 + * @brief The base class that any script should inherit from and set the type param accordingly */ class ScriptObject { @@ -39,7 +40,8 @@ public: { } /*! - * Gets the ID set for this script + * @brief Gets the ID set for this script + * * @return The allocated ID of the script set during object construction */ virtual uint32_t getId() const @@ -48,7 +50,8 @@ public: } /*! - * Gets the unique identifier (hash_code) of the script + * @brief Gets the unique identifier (hash_code) of the script + * * @return The hash_code of the script */ virtual std::size_t getType() const @@ -59,7 +62,7 @@ public: /*! - * The base class for any scripts that implement behaviour related to status effects. + * @brief The base class for any scripts that implement behaviour related to status effects. */ class StatusEffectScript : public ScriptObject { @@ -70,49 +73,57 @@ public: /*! * @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 + * @brief 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 + * @brief 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 + * @brief Called when the status effect owner dies + * * @param actor The actor that died */ virtual void onPlayerDeath( Entity::Chara& actor ) { } @@ -120,7 +131,7 @@ public: /*! - * The base class for any scripts that implement behaviour related to actions + * @brief The base class for any scripts that implement behaviour related to actions */ class ActionScript : public ScriptObject { @@ -136,7 +147,7 @@ public: /*! - * The base class for any scripts that implement behaviour related to the event system. + * @brief 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 @@ -165,7 +176,7 @@ public: /*! - * The base class for any scripts that implement behaviour related to BattleNPCs + * @brief The base class for any scripts that implement behaviour related to BattleNPCs */ class BattleNpcScript : public ScriptObject { @@ -176,7 +187,7 @@ public: }; /*! - * The base class for any scripts that implement behaviour related to zones + * @brief The base class for any scripts that implement behaviour related to zones */ class ZoneScript : public ScriptObject { @@ -189,7 +200,7 @@ public: }; /*! - * The base class for any scripts that implement behaviour related to instance content zones + * @brief The base class for any scripts that implement behaviour related to instance content zones */ class InstanceContentScript : public ScriptObject { diff --git a/src/servers/sapphire_zone/Script/NativeScriptMgr.h b/src/servers/sapphire_zone/Script/NativeScriptMgr.h index 04436a31..aabc5292 100644 --- a/src/servers/sapphire_zone/Script/NativeScriptMgr.h +++ b/src/servers/sapphire_zone/Script/NativeScriptMgr.h @@ -33,7 +33,10 @@ namespace Scripting { std::queue< std::string > m_scriptLoadQueue; /*! + * @brief Used to unload a script + * * Used to unload a script, clears m_scripts of any scripts assoicated with a ScriptInfo and then unloads that module + * * @param info A pointer to the ScriptInfo object that is to be erased * @return true if successful, false if not */ @@ -54,6 +57,7 @@ namespace Scripting { /*! * @brief Unloads a script + * * @param name The module name of the script to unload * @return true if successful */ @@ -71,31 +75,35 @@ namespace Scripting { /*! * @brief 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 ); /*! - * Called on a regular interval, allows for scripts to be loaded from the internal load queue. + * @brief Called on a regular interval, allows for scripts to be loaded from the internal load queue. */ void processLoadQueue(); /*! - * Gets the module file extention for the current platform (windows, linux, osx) + * @brief Gets the module file extention for the current platform (windows, linux, osx) + * * @return The file extension for the current platform */ const std::string getModuleExtension(); /*! - * Checks to see if a module with the specified name exists + * @brief 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( const std::string& name ); /*! - * Get a specific script from the internal table + * @brief Get a specific script from the internal table + * * @tparam T The type of the script to search for * @param scriptId The ID of the script to search for * @return T* if successful, nullptr if the script doesn't exist @@ -115,7 +123,8 @@ namespace Scripting { /*! - * Creates an instance of NativeScriptMgr + * @brief Creates an instance of NativeScriptMgr + * * @return a boost::shared_ptr to NativeScriptMgr */ boost::shared_ptr< NativeScriptMgr > createNativeScriptMgr(); diff --git a/src/servers/sapphire_zone/Script/ScriptInfo.h b/src/servers/sapphire_zone/Script/ScriptInfo.h index 3523d16b..91bc902a 100644 --- a/src/servers/sapphire_zone/Script/ScriptInfo.h +++ b/src/servers/sapphire_zone/Script/ScriptInfo.h @@ -17,7 +17,8 @@ namespace Core { namespace Scripting { /*! - * An internal class used to track information about loaded modules and their scripts. + * @brief An internal class used to track information about loaded modules and their scripts. + * * The main purpose of this is to maintain easy access to the module handle and the pointers to scripts that are loaded. * Furthermore, allows for quick and easy cross platform access to the module paths associated with the runtime module cache and its original path. */ @@ -36,12 +37,12 @@ namespace Scripting { std::string library_name; /*! - * The path to the module currently loaded in memory from the cached location. + * @brief The path to the module currently loaded in memory from the cached location. */ std::string cache_path; /*! - * The original path of the module before it was copied to the cache location. + * @brief The original path of the module before it was copied to the cache location. */ std::string library_path; @@ -53,7 +54,7 @@ namespace Scripting { ModuleHandle handle; /*! - * @An internal list of all the pointers to each ScriptObject + * @brief An internal list of all the pointers to each ScriptObject * * This is tracked so when we unload this module we can call delete on each ScriptObject and correctly free it from memory. */ diff --git a/src/servers/sapphire_zone/Script/ScriptLoader.h b/src/servers/sapphire_zone/Script/ScriptLoader.h index a3bc2a2c..5acbb431 100644 --- a/src/servers/sapphire_zone/Script/ScriptLoader.h +++ b/src/servers/sapphire_zone/Script/ScriptLoader.h @@ -21,18 +21,19 @@ namespace Core { namespace Scripting { /*! - * Provides low level functionality for loading modules on different platforms along with managing those loaded modules. + * @brief 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. + * @brief 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 + * @brief Unload a loaded module from it's ModuleHandle + * * @return true if the unload was successful, false if not */ bool unloadModule( ModuleHandle ); @@ -41,7 +42,8 @@ namespace Scripting { ScriptLoader() = default; /*! - * Gets the module file extention for the current platform (windows, linux, osx) + * @brief Gets the module file extention for the current platform (windows, linux, osx) + * * @return The file extension for the current platform */ const std::string getModuleExtension(); @@ -56,40 +58,46 @@ namespace Scripting { ScriptInfo* loadModule( const std::string& ); /*! - * Unload a script from it's ScriptInfo object + * @brief 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 + * @brief 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 + * @brief 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 + * @brief 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 + * @brief 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 + * @brief Case-insensitive search for modules, useful for debug commands + * * @param scripts a set of ScriptInfo ptrs * @param search the search term */ diff --git a/src/servers/sapphire_zone/Script/ScriptMgr.h b/src/servers/sapphire_zone/Script/ScriptMgr.h index adffb510..e165c517 100644 --- a/src/servers/sapphire_zone/Script/ScriptMgr.h +++ b/src/servers/sapphire_zone/Script/ScriptMgr.h @@ -17,14 +17,14 @@ namespace Core { private: /*! - * A shared ptr to NativeScriptMgr, used for accessing and managing the native script system. + * @brief A shared ptr to NativeScriptMgr, used for accessing and managing the native script system. */ boost::shared_ptr< NativeScriptMgr > m_nativeScriptMgr; std::function< std::string( Entity::Player& ) > m_onFirstEnterWorld; /*! - * Used to ignore the first change notification that Watchdog emits. + * @brief Used to ignore the first change notification that Watchdog emits. * Because reasons, it likes to emit an initial notification with all the files that match the filter, we don't want that so we ignore it. */ bool m_firstScriptChangeNotificiation; @@ -44,12 +44,12 @@ namespace Core bool init(); /*! - * Called on each tick or at a regular interval. Allows for the NativeScriptMgr to process module loading and reloading. + * @brief Called on each tick or at a regular interval. Allows for the NativeScriptMgr to process module loading and reloading. */ void update(); /*! - * Registers a directory watcher which allows for script modules to be reloaded when changes to the modules occur + * @brief Registers a directory watcher which allows for script modules to be reloaded when changes to the modules occur */ void watchDirectories();