255 lines
10 KiB
Go
255 lines
10 KiB
Go
package functions
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"eq2emu/internal/events"
|
|
)
|
|
|
|
// RegisterAllEQ2Functions registers all EQ2 event functions with a handler
|
|
func RegisterAllEQ2Functions(handler *events.EventHandler) error {
|
|
functions := map[string]events.EventFunction{
|
|
// Health Functions
|
|
"SetCurrentHP": SetCurrentHP,
|
|
"SetMaxHP": SetMaxHP,
|
|
"SetMaxHPBase": SetMaxHPBase,
|
|
"SetCurrentPower": SetCurrentPower,
|
|
"SetMaxPower": SetMaxPower,
|
|
"SetMaxPowerBase": SetMaxPowerBase,
|
|
"ModifyMaxHP": ModifyMaxHP,
|
|
"ModifyMaxPower": ModifyMaxPower,
|
|
"ModifyPower": ModifyPower,
|
|
"ModifyHP": ModifyHP,
|
|
"ModifyTotalHP": ModifyTotalHP,
|
|
"ModifyTotalPower": ModifyTotalPower,
|
|
"GetCurrentHP": GetCurrentHP,
|
|
"GetMaxHP": GetMaxHP,
|
|
"GetMaxHPBase": GetMaxHPBase,
|
|
"GetCurrentPower": GetCurrentPower,
|
|
"GetMaxPower": GetMaxPower,
|
|
"GetMaxPowerBase": GetMaxPowerBase,
|
|
"GetPCTOfHP": GetPCTOfHP,
|
|
"GetPCTOfPower": GetPCTOfPower,
|
|
"SpellHeal": SpellHeal,
|
|
"SpellHealPct": SpellHealPct,
|
|
"IsAlive": IsAlive,
|
|
|
|
// Attributes Functions
|
|
"SetInt": SetInt,
|
|
"SetWis": SetWis,
|
|
"SetSta": SetSta,
|
|
"SetStr": SetStr,
|
|
"SetAgi": SetAgi,
|
|
"SetIntBase": SetIntBase,
|
|
"SetWisBase": SetWisBase,
|
|
"SetStaBase": SetStaBase,
|
|
"SetStrBase": SetStrBase,
|
|
"SetAgiBase": SetAgiBase,
|
|
"GetInt": GetInt,
|
|
"GetWis": GetWis,
|
|
"GetSta": GetSta,
|
|
"GetStr": GetStr,
|
|
"GetAgi": GetAgi,
|
|
"GetIntBase": GetIntBase,
|
|
"GetWisBase": GetWisBase,
|
|
"GetStaBase": GetStaBase,
|
|
"GetStrBase": GetStrBase,
|
|
"GetAgiBase": GetAgiBase,
|
|
"GetLevel": GetLevel,
|
|
"SetLevel": SetLevel,
|
|
"SetPlayerLevel": SetPlayerLevel,
|
|
"GetDifficulty": GetDifficulty,
|
|
"AddSpellBonus": AddSpellBonus,
|
|
"RemoveSpellBonus": RemoveSpellBonus,
|
|
"AddSkillBonus": AddSkillBonus,
|
|
"RemoveSkillBonus": RemoveSkillBonus,
|
|
"GetClass": GetClass,
|
|
"SetClass": SetClass,
|
|
"SetAdventureClass": SetAdventureClass,
|
|
"GetTradeskillClass": GetTradeskillClass,
|
|
"SetTradeskillClass": SetTradeskillClass,
|
|
"GetTradeskillLevel": GetTradeskillLevel,
|
|
"SetTradeskillLevel": SetTradeskillLevel,
|
|
"GetRace": GetRace,
|
|
"GetGender": GetGender,
|
|
"GetModelType": GetModelType,
|
|
"SetModelType": SetModelType,
|
|
"GetDeity": GetDeity,
|
|
"SetDeity": SetDeity,
|
|
"GetAlignment": GetAlignment,
|
|
"SetAlignment": SetAlignment,
|
|
|
|
// Movement Functions
|
|
"SetPosition": SetPosition,
|
|
"GetPosition": GetPosition,
|
|
"GetX": GetX,
|
|
"GetY": GetY,
|
|
"GetZ": GetZ,
|
|
"GetHeading": GetHeading,
|
|
"SetHeading": SetHeading,
|
|
"GetOrigX": GetOrigX,
|
|
"GetOrigY": GetOrigY,
|
|
"GetOrigZ": GetOrigZ,
|
|
"GetDistance": GetDistance,
|
|
"FaceTarget": FaceTarget,
|
|
"GetSpeed": GetSpeed,
|
|
"SetSpeed": SetSpeed,
|
|
"SetSpeedMultiplier": SetSpeedMultiplier,
|
|
"HasMoved": HasMoved,
|
|
"IsRunning": IsRunning,
|
|
"MoveToLocation": MoveToLocation,
|
|
"ClearRunningLocations": ClearRunningLocations,
|
|
"SpawnMove": SpawnMove,
|
|
"MovementLoopAdd": MovementLoopAdd,
|
|
"PauseMovement": PauseMovement,
|
|
"StopMovement": StopMovement,
|
|
"SetMount": SetMount,
|
|
"GetMount": GetMount,
|
|
"SetMountColor": SetMountColor,
|
|
"StartAutoMount": StartAutoMount,
|
|
"EndAutoMount": EndAutoMount,
|
|
"IsOnAutoMount": IsOnAutoMount,
|
|
"AddWaypoint": AddWaypoint,
|
|
"RemoveWaypoint": RemoveWaypoint,
|
|
"SendWaypoints": SendWaypoints,
|
|
"Evac": Evac,
|
|
"Bind": Bind,
|
|
"Gate": Gate,
|
|
|
|
// Combat Functions
|
|
"Attack": Attack,
|
|
"AddHate": AddHate,
|
|
"ClearHate": ClearHate,
|
|
"GetMostHated": GetMostHated,
|
|
"SetTarget": SetTarget,
|
|
"GetTarget": GetTarget,
|
|
"IsInCombat": IsInCombat,
|
|
"SetInCombat": SetInCombat,
|
|
"SpellDamage": SpellDamage,
|
|
"SpellDamageExt": SpellDamageExt,
|
|
"DamageSpawn": DamageSpawn,
|
|
"ProcDamage": ProcDamage,
|
|
"ProcHate": ProcHate,
|
|
"Knockback": Knockback,
|
|
"Interrupt": Interrupt,
|
|
"IsCasting": IsCasting,
|
|
"HasRecovered": HasRecovered,
|
|
"ProcessMelee": ProcessMelee,
|
|
"ProcessSpell": ProcessSpell,
|
|
"LastSpellAttackHit": LastSpellAttackHit,
|
|
"IsBehind": IsBehind,
|
|
"IsFlanking": IsFlanking,
|
|
"InFront": InFront,
|
|
"GetEncounterSize": GetEncounterSize,
|
|
"GetEncounter": GetEncounter,
|
|
"GetHateList": GetHateList,
|
|
"ClearEncounter": ClearEncounter,
|
|
"ClearRunback": ClearRunback,
|
|
"Runback": Runback,
|
|
"GetRunbackDistance": GetRunbackDistance,
|
|
"CompareSpawns": CompareSpawns,
|
|
"KillSpawn": KillSpawn,
|
|
"KillSpawnByDistance": KillSpawnByDistance,
|
|
"Resurrect": Resurrect,
|
|
"IsInvulnerable": IsInvulnerable,
|
|
"SetInvulnerable": SetInvulnerable,
|
|
"SetAttackable": SetAttackable,
|
|
|
|
// Miscellaneous Functions
|
|
"SendMessage": SendMessage,
|
|
"LogMessage": LogMessage,
|
|
"MakeRandomInt": MakeRandomInt,
|
|
"MakeRandomFloat": MakeRandomFloat,
|
|
"ParseInt": ParseInt,
|
|
"GetName": GetName,
|
|
"GetID": GetID,
|
|
"GetSpawnID": GetSpawnID,
|
|
"IsPlayer": IsPlayer,
|
|
"IsNPC": IsNPC,
|
|
"IsEntity": IsEntity,
|
|
"IsDead": IsDead,
|
|
"GetCharacterID": GetCharacterID,
|
|
"Despawn": Despawn,
|
|
"Spawn": Spawn,
|
|
"SpawnByLocationID": SpawnByLocationID,
|
|
"SpawnGroupByID": SpawnGroupByID,
|
|
"DespawnByLocationID": DespawnByLocationID,
|
|
"GetSpawnByLocationID": GetSpawnByLocationID,
|
|
"GetSpawnByGroupID": GetSpawnByGroupID,
|
|
"GetSpawnGroupID": GetSpawnGroupID,
|
|
"SetSpawnGroupID": SetSpawnGroupID,
|
|
"GetSpawnLocationID": GetSpawnLocationID,
|
|
"GetSpawnLocationPlacementID": GetSpawnLocationPlacementID,
|
|
"SetGridID": SetGridID,
|
|
"SpawnSet": SpawnSet,
|
|
"SpawnSetByDistance": SpawnSetByDistance,
|
|
"IsSpawnGroupAlive": IsSpawnGroupAlive,
|
|
"AddSpawnToGroup": AddSpawnToGroup,
|
|
"GetVariableValue": GetVariableValue,
|
|
"SetServerVariable": SetServerVariable,
|
|
"GetServerVariable": GetServerVariable,
|
|
"SetTempVariable": SetTempVariable,
|
|
"GetTempVariable": GetTempVariable,
|
|
"CheckLOS": CheckLOS,
|
|
"CheckLOSByCoordinates": CheckLOSByCoordinates,
|
|
}
|
|
|
|
for name, fn := range functions {
|
|
if err := handler.Register(name, fn); err != nil {
|
|
return fmt.Errorf("failed to register event %s: %w", name, err)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// GetFunctionsByDomain returns functions organized by domain
|
|
func GetFunctionsByDomain() map[string][]string {
|
|
return map[string][]string{
|
|
"health": {
|
|
"SetCurrentHP", "SetMaxHP", "SetMaxHPBase", "SetCurrentPower", "SetMaxPower",
|
|
"SetMaxPowerBase", "ModifyMaxHP", "ModifyMaxPower", "ModifyPower", "ModifyHP",
|
|
"ModifyTotalHP", "ModifyTotalPower", "GetCurrentHP", "GetMaxHP", "GetMaxHPBase",
|
|
"GetCurrentPower", "GetMaxPower", "GetMaxPowerBase", "GetPCTOfHP", "GetPCTOfPower",
|
|
"SpellHeal", "SpellHealPct", "IsAlive",
|
|
},
|
|
"attributes": {
|
|
"SetInt", "SetWis", "SetSta", "SetStr", "SetAgi", "SetIntBase", "SetWisBase",
|
|
"SetStaBase", "SetStrBase", "SetAgiBase", "GetInt", "GetWis", "GetSta", "GetStr",
|
|
"GetAgi", "GetIntBase", "GetWisBase", "GetStaBase", "GetStrBase", "GetAgiBase",
|
|
"GetLevel", "SetLevel", "SetPlayerLevel", "GetDifficulty", "AddSpellBonus",
|
|
"RemoveSpellBonus", "AddSkillBonus", "RemoveSkillBonus", "GetClass", "SetClass",
|
|
"SetAdventureClass", "GetTradeskillClass", "SetTradeskillClass", "GetTradeskillLevel",
|
|
"SetTradeskillLevel", "GetRace", "GetGender", "GetModelType", "SetModelType",
|
|
"GetDeity", "SetDeity", "GetAlignment", "SetAlignment",
|
|
},
|
|
"movement": {
|
|
"SetPosition", "GetPosition", "GetX", "GetY", "GetZ", "GetHeading", "SetHeading",
|
|
"GetOrigX", "GetOrigY", "GetOrigZ", "GetDistance", "FaceTarget", "GetSpeed",
|
|
"SetSpeed", "SetSpeedMultiplier", "HasMoved", "IsRunning", "MoveToLocation",
|
|
"ClearRunningLocations", "SpawnMove", "MovementLoopAdd", "PauseMovement",
|
|
"StopMovement", "SetMount", "GetMount", "SetMountColor", "StartAutoMount",
|
|
"EndAutoMount", "IsOnAutoMount", "AddWaypoint", "RemoveWaypoint", "SendWaypoints",
|
|
"Evac", "Bind", "Gate",
|
|
},
|
|
"combat": {
|
|
"Attack", "AddHate", "ClearHate", "GetMostHated", "SetTarget", "GetTarget",
|
|
"IsInCombat", "SetInCombat", "SpellDamage", "SpellDamageExt", "DamageSpawn",
|
|
"ProcDamage", "ProcHate", "Knockback", "Interrupt", "IsCasting", "HasRecovered",
|
|
"ProcessMelee", "ProcessSpell", "LastSpellAttackHit", "IsBehind", "IsFlanking",
|
|
"InFront", "GetEncounterSize", "GetEncounter", "GetHateList", "ClearEncounter",
|
|
"ClearRunback", "Runback", "GetRunbackDistance", "CompareSpawns", "KillSpawn",
|
|
"KillSpawnByDistance", "Resurrect", "IsInvulnerable", "SetInvulnerable", "SetAttackable",
|
|
},
|
|
"misc": {
|
|
"SendMessage", "LogMessage", "MakeRandomInt", "MakeRandomFloat", "ParseInt",
|
|
"GetName", "GetID", "GetSpawnID", "IsPlayer", "IsNPC", "IsEntity", "IsDead",
|
|
"GetCharacterID", "Despawn", "Spawn", "SpawnByLocationID", "SpawnGroupByID",
|
|
"DespawnByLocationID", "GetSpawnByLocationID", "GetSpawnByGroupID", "GetSpawnGroupID",
|
|
"SetSpawnGroupID", "GetSpawnLocationID", "GetSpawnLocationPlacementID", "SetGridID",
|
|
"SpawnSet", "SpawnSetByDistance", "IsSpawnGroupAlive", "AddSpawnToGroup",
|
|
"GetVariableValue", "SetServerVariable", "GetServerVariable", "SetTempVariable",
|
|
"GetTempVariable", "CheckLOS", "CheckLOSByCoordinates",
|
|
},
|
|
}
|
|
} |