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
12
13typedef enum
14{
94 kGdSpellLineBerserk = 85, // FAKE BERSERK
251
252typedef struct __attribute__((packed))
253{
254 uint16_t spell_id;
256 uint8_t skill_requirements[12];
257 uint16_t mana_cost;
258 uint32_t cast_time;
259 uint32_t recast_time;
260 uint16_t min_range;
261 uint16_t max_range;
262 uint8_t cast_type1;
263 uint8_t cast_type2;
264 uint32_t params[10];
265 uint16_t effect_power;
266 uint16_t effect_range;
268
269// Declare the function pointers for the SpellFunctions group
270DECLARE_FUNCTION(void, setXData, SF_CGdSpell *_this, uint16_t spell_id,
271 uint8_t xdatakey, uint32_t value);
273 uint16_t spell_id, SpellDataKey key);
274DECLARE_FUNCTION(void, setEffectDone, SF_CGdSpell *_this, uint16_t spell_id,
275 uint16_t param_2);
276DECLARE_FUNCTION(uint32_t, addToXData, SF_CGdSpell *_this, uint16_t spell_id,
277 SpellDataKey key, uint32_t value);
278DECLARE_FUNCTION(uint32_t, getChanceToResistSpell, void *autoclass34,
279 uint16_t source, uint16_t target,
280 SF_SpellEffectInfo effect_info);
281DECLARE_FUNCTION(uint16_t, getRandom, void *autoclass14, uint16_t max_value);
282DECLARE_FUNCTION(void, addVisualEffect, SF_CGdSpell *_this, uint16_t spell_id,
283 CGdEffectType effect_id, void *unused,
284 SF_CGdTargetData *target, uint32_t tick_start,
285 uint16_t tick_count, void *corner_coords);
286DECLARE_FUNCTION(void, figureAggro, SF_CGdSpell *_this, uint16_t spell_id,
287 uint16_t target_index);
288DECLARE_FUNCTION(SF_CGdResourceSpell *, getResourceSpellData, void *,
289 SF_CGdResourceSpell *spellData, uint16_t index);
290DECLARE_FUNCTION(uint32_t, getXData, SF_CGdSpell *_this, uint16_t spell_id,
292DECLARE_FUNCTION(SF_Rectangle *, getTargetsRectangle, SF_CGdSpell *_this,
293 SF_Rectangle *output, uint16_t spell_id, uint16_t radius,
294 SF_Coord *center_maybe);
295DECLARE_FUNCTION(void, removeDLLNode, SF_CGdSpell *_this, uint16_t param_1);
297 uint16_t spell_id, SpellFlagKey key);
298DECLARE_FUNCTION(void, onSpellRemove, SF_CGdSpell *_this, uint16_t spell_id);
299DECLARE_FUNCTION(uint16_t, addSpell, SF_CGdSpell *_this, uint16_t spell_id,
300 uint16_t param2, SF_CGdTargetData *source,
301 SF_CGdTargetData *target, uint16_t param5);
302DECLARE_FUNCTION(uint16_t, getSpellLine, SF_CGdSpell *_this, uint16_t spell_id);
303DECLARE_FUNCTION(void, figClrChkSplBfrChkBattle, SF_CGdSpell *_this,
304 uint16_t spell_id, uint16_t unk1);
305DECLARE_FUNCTION(void, figTryClrCHkSPlBfrJob2, SF_CGdSpell *_this,
306 uint16_t spell_id);
307DECLARE_FUNCTION(void, figTryUnfreeze, SF_CGdSpell *_this, uint16_t spell_id,
308 uint16_t unk1);
309DECLARE_FUNCTION(uint16_t, getSpellID, SF_CGdSpell *_this,
310 uint16_t spell_index);
311DECLARE_FUNCTION(uint16_t, getSpellTags, uint16_t spell_index);
312DECLARE_FUNCTION(bool, hasSpellTag, uint16_t spell_id, SpellTag tag);
313DECLARE_FUNCTION(int, checkCanApply, SF_CGdSpell *_this, uint16_t index);
315 uint16_t source_index, uint16_t spell_index,
316 bool (*conditionPtr)(SF_CGdSpell *, uint16_t, uint16_t),
317 void (*callbackPtr)(SF_CGdSpell *, uint16_t, uint16_t,
318 uint16_t));
319
320//typedef uint16_t (__thiscall *get_leveled_spell_ptr)(void *CGdResource, uint16_t source_spell_id, uint16_t spell_level);
321DECLARE_FUNCTION(uint16_t, getLeveledSpellID, void *CGdResource, uint16_t source_spell_id, uint16_t spell_level);
322
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)
Group of Structures and Enums used throught SFSF.
#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)
void(__thiscall * figTryUnfreeze_ptr)(SF_CGdSpell *_this, uint16_t spell_id, uint16_t unk1)
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))
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 * spellClearFigureFlag_ptr)(SF_CGdSpell *_this, uint16_t spell_id, SpellFlagKey key)
bool(__thiscall * hasSpellTag_ptr)(uint16_t spell_id, SpellTag tag)
uint32_t(__thiscall * getChanceToResistSpell_ptr)(void *autoclass34, uint16_t source, uint16_t target, SF_SpellEffectInfo effect_info)
void(__thiscall * onSpellRemove_ptr)(SF_CGdSpell *_this, uint16_t spell_id)
uint16_t(__thiscall * getSpellTags_ptr)(uint16_t spell_index)
SpellFlagKey
@ CHECK_SPELLS_BEFORE_JOB2
@ UNFREEZE
@ CHECK_SPELLS_BEFORE_CHECK_BATTLE
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)
@ kGdSpellLineInflexibility
@ kGdSpellLineShockChained
@ kGdSpellLineAuraSiegeElf
@ kGdSpellLineAmok
@ kGdSpellLineRegenerate
@ kGdSpellLineRoots
@ kGdSpellLineDetectMagic
@ kGdSpellLineAbilityTrueShot
@ kGdSpellLineAbilitySteelSkin
@ kGdSpellLineGreaterHealing
@ kGdSpellLineAbilityDurability
@ kGdSpellLineAuraHypnotization
@ kGdSpellLineManaTap
@ kGdSpellLineWaveOfIce
@ kGdSpellLineArrow
@ kGdSpellLineSummonDemon
@ kGdSpellLineAuraManaTap
@ kGdSpellLineAbilityPatronize
@ kGdSpellLineDarknessArea
@ kGdSpellLineObjectIllusion
@ kGdSpellLineShock
@ kGdSpellLineManaTapChained
@ kGdSpellLineCharm
@ kGdSpellLineAuraRegeneration
@ kGdSpellLineWeaken
@ kGdSpellLinePainArea
@ kGdSpellLineCharmAnimal
@ kGdSpellLineEnlightenment
@ kGdSpellLineDispelWhiteAura
@ kGdSpellLinePoison
@ kGdSpellLineChainFireburst
@ kGdSpellLineInvisibility
@ kGdSpellLineSummonGoblin
@ kGdSpellLineSlowness
@ kGdSpellLineStoneTower
@ kGdSpellLineForget
@ kGdSpellLineAuraSlowFighting
@ kGdSpellLineDisenchant
@ kGdSpellLineExtinct
@ kGdSpellLineChillResistance
@ kGdSpellLineFireBallEffect
@ kGdSpellLineSummonBear
@ kGdSpellLinePain
@ kGdSpellLineAuraSiegeOrc
@ kGdSpellLineLifeTap
@ kGdSpellLineDeath
@ kGdSpellLineSuffocation
@ kGdSpellLineRockBullet
@ kGdSpellLineMeditation
@ kGdSpellLineAcidCloud
@ kGdSpellLineIceShieldStun
@ kGdSpellLineSlowFighting
@ kGdSpellLinePestilence
@ kGdSpellLineIlluminate
@ kGdSpellLinePainTower
@ kGdSpellLineAuraDexterity
@ kGdSpellLineBrilliance
@ kGdSpellLineAuraInflexibility
@ kGdSpellLineIceBurst
@ kGdSpellLineInability
@ kGdSpellLineFeignDeath
@ kGdSpellLineEternity
@ kGdSpellLineAuraSiegeHuman
@ kGdSpellLineQuickness
@ kGdSpellLineDetectMetal
@ kGdSpellLineSummonChanneler
@ kGdSpellLineAbilityShelter
@ kGdSpellLineHypnotizeArea
@ kGdSpellLineAlmightinessMental
@ kGdSpellLineRevenge
@ kGdSpellLineCannibalize
@ kGdSpellLineCharmChained
@ kGdSpellLineChainHallow
@ kGdSpellLineFireBlockEffect
@ kGdSpellLineIceBurstChained
@ kGdSpellLineArrowTower
@ kGdSpellLineFireShield
@ kGdSpellLineMirrorImage
@ kGdSpellLineIceArrowEffect
@ kGdSpellLineRemoveCurse
@ kGdSpellLineIceburstTower
@ kGdSpellLineStoneRain
@ kGdSpellLineBerserk
@ kGdSpellLineDominateAnimal
@ kGdSpellLineAuraEternity
@ kGdSpellLineHypnotizeTower
@ kGdSpellLineHallow
@ kGdSpellLineSpark
@ kGdSpellLineAuraHealing
@ kGdSpellLineRetention
@ kGdSpellLineHypnotize
@ kGdSpellLineDoNotTouchMe
@ kGdSpellLineManaTapAura
@ kGdSpellLineSentinelHealing
@ kGdSpellLineAlmightinessElementalEffect
@ kGdSpellLineChainShock
@ kGdSpellLinePetrify
@ kGdSpellLineRemediless
@ kGdSpellLinePlagueArea
@ kGdSpellLineSummonSpectre
@ kGdSpellLineChainRockBullet
@ kGdSpellLineWallOfRocks
@ kGdSpellLineAbilityCriticalHits
@ kGdSpellLineConfuseArea
@ kGdSpellLineFireBallChained
@ kGdSpellLineThornShieldDamage
@ kGdSpellLineSacrificeMana
@ kGdSpellLineAuraWeakness
@ kGdSpellLineInvulnerability
@ kGdSpellLineSuicideHeal
@ kGdSpellLineAbilityWarCry
@ kGdSpellLineRockBulletChained
@ kGdSpellLineLifeTapAura
@ kGdSpellLineStone
@ kGdSpellLineFireBurstChained
@ kGdSpellLineGuard
@ kGdSpellLineFireShieldDamage
@ kGdSpellLineDecayArea
@ kGdSpellLineEssenceWhite
@ kGdSpellLineSummonEarthGolem
@ kGdSpellLineSummonSkeleton
@ kGdSpellLineAbilityBenefactions
@ kGdSpellLineReinforcement
@ kGdSpellLineDexterity
@ kGdSpellLineFlexibilityArea
@ kGdSpellLineChainPain
@ kGdSpellLineIceBlockEffect
@ kGdSpellLineFakeSpellOneFigure
@ kGdSpellLineChainMutation
@ kGdSpellLineAuraSiegeDarkElf
@ kGdSpellLineAbilitySalvo
@ kGdSpellLineAbilityBlessing
@ kGdSpellLineSummonFireGolem
@ kGdSpellLineEarthElemental
@ kGdSpellLineFear
@ kGdSpellLineMutation
@ kGdSpellLineStrengthen
@ kGdSpellLineLifeTapChained
@ kGdSpellLineChainIceburst
@ kGdSpellLineHypnotizeTwo
@ kGdSpellLineAuraSuffocation
@ kGdSpellLineAssistance
@ kGdSpellLineAuraSiegeTroll
@ kGdSpellLineEssenceMental
@ kGdSpellLineFeetClay
@ kGdSpellLineFireElemental
@ kGdSpellLineDecay
@ kGdSpellLineVoodoo
@ kGdSpellLineMutationChained
@ kGdSpellLineSummonTreeWraith
@ kGdSpellLineHealingTower
@ kGdSpellLineTorture
@ kGdSpellLineShockwave
@ kGdSpellLineHolyMight
@ kGdSpellLineHealing
@ kGdSpellLineFog
@ kGdSpellLineRainOfFire
@ kGdSpellLineExtinctTower
@ kGdSpellLineProtectionBlack
@ kGdSpellLineCharisma
@ kGdSpellLineEssenceBlack
@ kGdSpellLineAuraSlowWalking
@ kGdSpellLineFireBurst
@ kGdSpellLinePainChained
@ kGdSpellLineHealingArea
@ kGdSpellLineSuicideDeath
@ kGdSpellLineRingOfRocks
@ kGdSpellLineRaiseDead
@ kGdSpellLineFireBall
@ kGdSpellLineFlexibility
@ kGdSpellLineHealingAura
@ kGdSpellLineRootsArea
@ kGdSpellLineAlmightinessElemental
@ kGdSpellLineAuraLifeTap
@ kGdSpellLineDisrupt
@ kGdSpellLineBlizzard
@ kGdSpellLineCureDisease
@ kGdSpellLineShiftMana
@ kGdSpellLineAbilityRiposte
@ kGdSpellLineDarkBanishing
@ kGdSpellLineManaShield
@ kGdSpellLineDispelBlackAura
@ kGdSpellLineMeltResistance
@ kGdSpellLineInflexibilityArea
@ kGdSpellLineEndurance
@ kGdSpellLineAuraFlexibility
@ kGdSpellLineSummonIceGolem
@ kGdSpellLineSelfIllusion
@ kGdSpellLineQuicknessArea
@ kGdSpellLineEssenceElementalEffect
@ kGdSpellLineFreezeArea
@ kGdSpellLineSlownessArea
@ kGdSpellLineDarkMight
@ kGdSpellLineBefriend
@ kGdSpellLineDeathGrasp
@ kGdSpellLineFastFighting
@ kGdSpellLineFireResistance
@ kGdSpellLineAuraBrilliance
@ kGdSpellLineThornShield
@ kGdSpellLineSummonBlade
@ kGdSpellLineConservation
@ kGdSpellLineAlmightinessWhite
@ kGdSpellLineAbilityBerserk
@ kGdSpellLineAuraFastFighting
@ kGdSpellLineManaDrain
@ kGdSpellLineHolyTouch
@ kGdSpellLineDominate
@ kGdSpellLineAuraStrength
@ kGdSpellLineWaveOfRocks
@ kGdSpellLineDemoralization
@ kGdSpellLineAuraLight
@ kGdSpellLineAbilityShiftLife
@ kGdSpellLineConfuse
@ kGdSpellLineIceElemental
@ kGdSpellLineSummonWolf
@ kGdSpellLineFireBurstTower
@ kGdSpellLineChainLifetap
@ kGdSpellLineChainFireball
@ kGdSpellLineAlmightinessBlack
@ kGdSpellLineAuraInability
@ kGdSpellLineDistract
@ kGdSpellLineIceShield
@ kGdSpellLineAuraEndurance
@ kGdSpellLineHallowChained
@ kGdSpellLineEssenceElemental
@ kGdSpellLineFreeze
@ kGdSpellLineDominateUndead
@ kGdSpellLineAbilityEndurance
@ kGdSpellLineWaveOfFire
@ kGdSpellLineChainManatap
@ kGdSpellLineWeakenArea
@ kGdSpellLineAuraFastWalking
@ kGdSpellLineChainCharm
@ kGdSpellLineCurePoison
@ kGdSpellLineStrengthenArea
uint16_t(__thiscall * getSpellLine_ptr)(SF_CGdSpell *_this, uint16_t spell_id)
void(__thiscall * figClrChkSplBfrChkBattle_ptr)(SF_CGdSpell *_this, uint16_t spell_id, uint16_t unk1)
uint16_t(__thiscall * getRandom_ptr)(void *autoclass14, uint16_t max_value)
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.
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.