Spellforce-Spell-framework
Loading...
Searching...
No Matches
sf_spell_functions.h
Go to the documentation of this file.
1#pragma once
2#include <stdint.h>
3#include <stdbool.h>
5
6typedef struct __attribute__((packed))
7{
8 uint16_t spell_id;
9 uint16_t spell_line_id;
10 uint8_t skill_requirements[12];
11 uint16_t mana_cost;
12 uint32_t cast_time;
13 uint32_t recast_time;
14 uint16_t min_range;
15 uint16_t max_range;
16 uint8_t cast_type1;
17 uint8_t cast_type2;
18 uint32_t params[10];
19 uint16_t effect_power;
20 uint16_t effect_range;
22
23typedef struct __attribute__ ((packed))
24{
25 uint16_t spellline_id;
26 uint16_t text_id;
27 uint8_t flags;
28 uint8_t magic_type;
29 uint8_t min_level;
30 uint8_t max_level;
31 uint8_t availability;
32 char ui_handle[64];
35
36// Declare the function pointers for the SpellFunctions group
37DECLARE_FUNCTION(void, setXData, SF_CGdSpell *_this, uint16_t spell_id,
38 uint8_t xdatakey, uint32_t value);
40 uint16_t spell_id, SpellDataKey key);
41DECLARE_FUNCTION(void, setEffectDone, SF_CGdSpell *_this, uint16_t spell_id,
42 uint16_t param_2);
43DECLARE_FUNCTION(uint32_t, addToXData, SF_CGdSpell *_this, uint16_t spell_id,
44 SpellDataKey key, uint32_t value);
45DECLARE_FUNCTION(uint32_t, getChanceToResistSpell, void *autoclass34,
46 uint16_t source, uint16_t target,
47 uint16_t spell_index);
48DECLARE_FUNCTION(uint16_t, getRandom, void *autoclass14, uint16_t max_value);
49DECLARE_FUNCTION(void, addVisualEffect, SF_CGdSpell *_this, uint16_t spell_id,
50 CGdEffectType effect_id, void *unused,
51 SF_CGdTargetData *target, uint32_t tick_start,
52 uint16_t tick_count, void *corner_coords);
53DECLARE_FUNCTION(void, figureAggro, SF_CGdSpell *_this, uint16_t spell_id,
54 uint16_t target_index);
55DECLARE_FUNCTION(SF_CGdResourceSpell *, getResourceSpellData, void *,
56 SF_CGdResourceSpell *spellData, uint16_t index);
57DECLARE_FUNCTION(uint32_t, getXData, SF_CGdSpell *_this, uint16_t spell_id,
59DECLARE_FUNCTION(SF_Rectangle *, getTargetsRectangle, SF_CGdSpell *_this,
60 SF_Rectangle *output, uint16_t spell_id, uint16_t radius,
61 SF_Coord *center_maybe);
62DECLARE_FUNCTION(void, removeDLLNode, SF_CGdSpell *_this, uint16_t param_1);
64 uint16_t spell_id, SpellFlagKey key);
65DECLARE_FUNCTION(void, onSpellRemove, SF_CGdSpell *_this, uint16_t spell_id);
66DECLARE_FUNCTION(uint16_t, addSpell, SF_CGdSpell *_this, uint16_t spell_id,
67 uint16_t param2, SF_CGdTargetData *source,
68 SF_CGdTargetData *target, uint16_t param5);
69DECLARE_FUNCTION(uint16_t, getSpellLine, SF_CGdSpell *_this, uint16_t spell_id);
70DECLARE_FUNCTION(void, figClrChkSplBfrChkBattle, SF_CGdSpell *_this,
71 uint16_t spell_id, uint16_t figure_id);
72DECLARE_FUNCTION(void, figTryClrCHkSPlBfrJob2, SF_CGdSpell *_this,
73 uint16_t spell_id);
74DECLARE_FUNCTION(void, figTryUnfreeze, SF_CGdSpell *_this, uint16_t spell_id,
75 uint16_t figure_id);
76DECLARE_FUNCTION(uint16_t, getSpellID, SF_CGdSpell *_this,
77 uint16_t spell_index);
78DECLARE_FUNCTION(uint16_t, getSpellTags, uint16_t spell_index);
79DECLARE_FUNCTION(bool, hasSpellTag, uint16_t spell_line_id, SpellTag tag);
80DECLARE_FUNCTION(int, checkCanApply, SF_CGdSpell *_this, uint16_t index);
81DECLARE_FUNCTION(void, spellEffectCallback, SF_CGdSpell *_this, uint16_t source_index, uint16_t spell_index,
82 bool (*conditionPtr)(SF_CGdSpell *, uint16_t, uint16_t),
83 void (*callbackPtr)(SF_CGdSpell *, uint16_t, uint16_t, uint16_t));
84DECLARE_FUNCTION(uint16_t, getLeveledSpellID, void *CGdResource, uint16_t source_spell_id, uint16_t spell_level);
85DECLARE_FUNCTION(void, tryClearCheckSpellsBeforeJob, SF_CGdSpell *_this, uint16_t spell_index, uint16_t figure_index);
86
87
88//TODO export spelljobs structure
void __thiscall spellEffectCallback(SF_CGdSpell *_this, uint16_t source_index, uint16_t spell_index, bool(*condition)(SF_CGdSpell *_this, uint16_t source_index, uint16_t spell_index), void(*callback)(SF_CGdSpell *_this, uint16_t source_index, uint16_t spell_index))
bool __thiscall hasSpellTag(uint16_t spell_id, SpellTag tag)
void __thiscall spellClearFigureFlag(SF_CGdSpell *_this, uint16_t spell_id, SpellFlagKey key)
void __thiscall tryClearCheckSpellsBeforeJob(SF_CGdSpell *_this, uint16_t spell_index, uint16_t figure_index)
#define DECLARE_FUNCTION(type, name,...)
Declares a function with the specified return type, name, and arguments.
uint16_t __thiscall getSpellTags(uint16_t spell_line_id)
void(__thiscall * removeDLLNode_ptr)(SF_CGdSpell *_this, uint16_t param_1)
void(__thiscall * initializeSpellData_ptr)(SF_CGdSpell *_this, uint16_t spell_id, SpellDataKey key)
uint16_t(__thiscall * getSpellID_ptr)(SF_CGdSpell *_this, uint16_t spell_index)
bool(__thiscall * hasSpellTag_ptr)(uint16_t spell_line_id, SpellTag tag)
void(__thiscall * spellEffectCallback_ptr)(SF_CGdSpell *_this, uint16_t source_index, uint16_t spell_index, bool(*conditionPtr)(SF_CGdSpell *, uint16_t, uint16_t), void(*callbackPtr)(SF_CGdSpell *, uint16_t, uint16_t, uint16_t))
void(__thiscall * tryClearCheckSpellsBeforeJob_ptr)(SF_CGdSpell *_this, uint16_t spell_index, uint16_t figure_index)
uint16_t(__thiscall * getLeveledSpellID_ptr)(void *CGdResource, uint16_t source_spell_id, uint16_t spell_level)
void(__thiscall * figureAggro_ptr)(SF_CGdSpell *_this, uint16_t spell_id, uint16_t target_index)
uint32_t(__thiscall * addToXData_ptr)(SF_CGdSpell *_this, uint16_t spell_id, SpellDataKey key, uint32_t value)
uint16_t(__thiscall * addSpell_ptr)(SF_CGdSpell *_this, uint16_t spell_id, uint16_t param2, SF_CGdTargetData *source, SF_CGdTargetData *target, uint16_t param5)
void(__thiscall * figTryUnfreeze_ptr)(SF_CGdSpell *_this, uint16_t spell_id, uint16_t figure_id)
void(__thiscall * spellClearFigureFlag_ptr)(SF_CGdSpell *_this, uint16_t spell_id, SpellFlagKey key)
void(__thiscall * onSpellRemove_ptr)(SF_CGdSpell *_this, uint16_t spell_id)
uint16_t(__thiscall * getSpellTags_ptr)(uint16_t spell_index)
void(__thiscall * setXData_ptr)(SF_CGdSpell *_this, uint16_t spell_id, uint8_t xdatakey, uint32_t value)
SF_Rectangle *(__thiscall * getTargetsRectangle_ptr)(SF_CGdSpell *_this, SF_Rectangle *output, uint16_t spell_id, uint16_t radius, SF_Coord *center_maybe)
uint32_t(__thiscall * getXData_ptr)(SF_CGdSpell *_this, uint16_t spell_id, SpellDataKey key)
void(__thiscall * setEffectDone_ptr)(SF_CGdSpell *_this, uint16_t spell_id, uint16_t param_2)
void(__thiscall * addVisualEffect_ptr)(SF_CGdSpell *_this, uint16_t spell_id, CGdEffectType effect_id, void *unused, SF_CGdTargetData *target, uint32_t tick_start, uint16_t tick_count, void *corner_coords)
void(__thiscall * figTryClrCHkSPlBfrJob2_ptr)(SF_CGdSpell *_this, uint16_t spell_id)
uint16_t(__thiscall * getSpellLine_ptr)(SF_CGdSpell *_this, uint16_t spell_id)
uint32_t(__thiscall * getChanceToResistSpell_ptr)(void *autoclass34, uint16_t source, uint16_t target, uint16_t spell_index)
uint16_t(__thiscall * getRandom_ptr)(void *autoclass14, uint16_t max_value)
void(__thiscall * figClrChkSplBfrChkBattle_ptr)(SF_CGdSpell *_this, uint16_t spell_id, uint16_t figure_id)
SF_CGdResourceSpell *(__thiscall * getResourceSpellData_ptr)(void *, SF_CGdResourceSpell *spellData, uint16_t index)
int(__thiscall * checkCanApply_ptr)(SF_CGdSpell *_this, uint16_t index)
void __thiscall initializeSpellData(SF_CGdSpell *_this, uint16_t spell_id, SpellDataKey key)
Represents a collection of function pointers for managing spell-related operations.
getRandom_ptr getRandom
Generates a random value up to the specified maximum value.
getChanceToResistSpell_ptr getChanceToResistSpell
Returns target's resistance to a primary magic school that a specified spell belongs in....
spellClearFigureFlag_ptr spellClearFigureFlag
Clears a specific flag on the spell object.
getTargetsRectangle_ptr getTargetsRectangle
This function is used to calculate area of effect for a spell.
addToXData_ptr addToXData
Adds a value to a specific XData entry for the given spell.
spellEffectCallback_ptr spellEffectCallback
callback that iterates through spells on a target, checks a condition then executes the callback.
getResourceSpellData_ptr getResourceSpellData
checkCanApply_ptr checkCanApply
Calls the Refresh handler for a specified spell type.
setEffectDone_ptr setEffectDone
Stops a spell effect handler for a given spell.
getSpellTags_ptr getSpellTags
Retrieves the tags associated with a spell.
tryClearCheckSpellsBeforeJob_ptr tryClearCheckSpellsBeforeJob
getXData_ptr getXData
Retrieves the XData value for a specific spell.
addSpell_ptr addSpell
Creates a new spell of a given spell type.
getSpellLine_ptr getSpellLine
Retrieves the spell type ID of a given spell.
initializeSpellData_ptr initializeSpellData
Initializes spell-related data for a given entity.
addVisualEffect_ptr addVisualEffect
spawn a visual effect.
onSpellRemove_ptr onSpellRemove
This function is triggered when a spell stops.
figTryClrCHkSPlBfrJob2_ptr figTryClrCHkSPlBfrJob2
clears the CHECK_SPELLS_BEFORE_JOB2 flag
hasSpellTag_ptr hasSpellTag
Checks if a spell has a specific tag.
getLeveledSpellID_ptr getLeveledSpellID
removeDLLNode_ptr removeDLLNode
Used to remove a spell from the list of active spells over the target.
figureAggro_ptr figureAggro
Used to trigger aggressive behavior for a figure.
figTryUnfreeze_ptr figTryUnfreeze
clears the UNFREEZE flag
getSpellID_ptr getSpellID
Retrieves the Spell Effect ID for a given spell index. The spell effect ID can be used to obtain spel...
setXData_ptr setXData
This function is used to assign specific value to an XData key of a given spell.
figClrChkSplBfrChkBattle_ptr figClrChkSplBfrChkBattle
Clears the CHECK_SPELLS_BEFORE_CHECK_BATTLE flag.