You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3coop/apps/openmw-mp/Script/Functions/Spells.hpp

94 lines
3.6 KiB
C++

#ifndef OPENMW_SPELLAPI_HPP
#define OPENMW_SPELLAPI_HPP
#include <Script/Platform.hpp>
#define SPELLAPI \
{"ClearSpellbookChanges", SpellFunctions::ClearSpellbookChanges},\
\
{"GetSpellbookChangesSize", SpellFunctions::GetSpellbookChangesSize},\
{"GetSpellbookChangesAction", SpellFunctions::GetSpellbookChangesAction},\
\
{"SetSpellbookChangesAction", SpellFunctions::SetSpellbookChangesAction},\
{"AddSpell", SpellFunctions::AddSpell},\
\
{"GetSpellId", SpellFunctions::GetSpellId},\
\
{"SendSpellbookChanges", SpellFunctions::SendSpellbookChanges},\
\
{"InitializeSpellbookChanges", SpellFunctions::InitializeSpellbookChanges}
namespace SpellFunctions
{
/**
* \brief Clear the last recorded spellbook changes for a player.
*
* This is used to initialize the sending of new PlayerSpellbook packets.
*
* \param pid The player ID whose spellbook changes should be used.
* \return void
*/
EXPORT_APIFUNCTION void CDECL ClearSpellbookChanges(unsigned short pid) noexcept;
/**
* \brief Get the number of indexes in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \return The number of indexes.
*/
EXPORT_APIFUNCTION unsigned int CDECL GetSpellbookChangesSize(unsigned short pid) noexcept;
/**
* \brief Get the action type used in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \return The action type (0 for SET, 1 for ADD, 2 for REMOVE).
*/
EXPORT_APIFUNCTION unsigned int CDECL GetSpellbookChangesAction(unsigned short pid) noexcept;
/**
* \brief Set the action type in a player's spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param action The action (0 for SET, 1 for ADD, 2 for REMOVE).
* \return void
*/
EXPORT_APIFUNCTION void CDECL SetSpellbookChangesAction(unsigned short pid, unsigned char action) noexcept;
/**
* \brief Add a new spell to the spellbook changes for a player.
*
* \param pid The player ID whose spellbook changes should be used.
* \param spellId The spellId of the spell.
* \return void
*/
EXPORT_APIFUNCTION void CDECL AddSpell(unsigned short pid, const char* spellId) noexcept;
/**
* \brief Get the spellId at a certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param index The index of the spell.
* \return The spellId.
*/
EXPORT_APIFUNCTION const char *CDECL GetSpellId(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Send a PlayerSpellbook packet with a player's recorded spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param sendToOtherPlayers Whether this packet should be sent to players other than the
* player attached to the packet (false by default).
* \param skipAttachedPlayer Whether the packet should skip being sent to the player attached
* to the packet (false by default).
* \return void
*/
EXPORT_APIFUNCTION void CDECL SendSpellbookChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
// All methods below are deprecated versions of methods from above
EXPORT_APIFUNCTION void CDECL InitializeSpellbookChanges(unsigned short pid) noexcept;
}
#endif //OPENMW_SPELLAPI_HPP