scripting

package
v0.0.0-...-6d2902c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlayerEventFirstLogin        = 30
	PlayerEventCharacterCreate   = 1 // OnCreate fires with the live Player*; Go has no player object at create time, so the engine never fires this event
	PlayerEventCharacterDelete   = 2
	PlayerEventLogin             = 3
	PlayerEventLogout            = 4
	PlayerEventDuelRequest       = 9
	PlayerEventDuelStart         = 10
	PlayerEventDuelEnd           = 11
	PlayerEventKillPlayer        = 6
	PlayerEventKillCreature      = 7
	PlayerEventKilledByCreature  = 8
	PlayerEventGiveXP            = 12
	PlayerEventLevelChange       = 13
	PlayerEventMoneyChange       = 14 // OnMoneyChanged fires from Player::ModifyMoney (Player.cpp:22826); Go has no central ModifyMoney — every money write is a direct field store across ~15 files, so the engine never fires this event
	PlayerEventReputationChange  = 15
	PlayerEventTalentChange      = 16 // OnTalentsChange fires from Player::SetFreeTalentPoints; Go has no talent system, so the engine never fires this event
	PlayerEventTalentReset       = 17 // OnTalentsReset fires from Player::ResetTalents; Go has no talent system, so the engine never fires this event
	PlayerEventChat              = 18
	PlayerEventWhisper           = 19
	PlayerEventGroupChat         = 20
	PlayerEventGuildChat         = 21
	PlayerEventChannelChat       = 22
	PlayerEventEmote             = 23
	PlayerEventTextEmote         = 24
	PlayerEventSave              = 25
	PlayerEventBindToInstance    = 26 // OnBindToInstance fires from Player::SetBoundInstance (ScriptMgr.cpp:2037); Go has no instance-bind model, so the engine never fires this event
	PlayerEventUpdateZone        = 27
	PlayerEventMapChange         = 28
	PlayerEventEquip             = 29
	PlayerEventCanUseItem        = 31
	PlayerEventLootItem          = 32
	PlayerEventEnterCombat       = 33 // OnPlayerEnterCombat fires from CombatManager::NotifyAICombat per new combat reference; Go's combat-enter sites are scattered unitFlagInCombat sets with no reference model, so no C++-exact fire site exists yet
	PlayerEventLeaveCombat       = 34 // OnPlayerLeaveCombat fires from CombatManager reference teardown (CombatManager.cpp:88-337); Go has no combat-reference model, so the engine never fires this event
	PlayerEventRepop             = 35
	PlayerEventResurrect         = 36
	PlayerEventLootMoney         = 37
	PlayerEventQuestAbandon      = 38
	PlayerEventLearnTalents      = 39 // OnLearnTalents fires from Player::LearnTalent; Go has no talent system, so the engine never fires this event
	PlayerEventQuestStatusChange = 40 // OnQuestStatusChange fires from Player::AddQuest/RewardQuest/SetQuestStatus/quest-abandon/EffectQuestClear (ScriptMgr.cpp:2194); Eluna PlayerEvents 40 = ON_QUEST_STATUS_CHANGE, (event, player, questId), void
	PlayerEventCommand           = 42
	MapEventOnPlayerEnter        = 21
)
View Source
const (
	GuildEventOnAddMember     = 1
	GuildEventOnRemoveMember  = 2
	GuildEventOnMotdChange    = 3
	GuildEventOnInfoChange    = 4
	GuildEventOnCreate        = 5
	GuildEventOnDisband       = 6
	GuildEventOnMoneyWithdraw = 7
	GuildEventOnMoneyDeposit  = 8
	GuildEventOnItemMove      = 9
	GuildEventOnEvent         = 10
	GuildEventOnBankEvent     = 11
)

Eluna GuildEvents contract for RegisterGuildEvent. Numbering is the TrinityCore LuaEngine numbering (LuaEngine/Hooks.h GuildEvents): 1-11 are all fired by Eluna::GuildHooks; only the events the engine fires carry Go constants.

View Source
const (
	GroupEventOnMemberAdd    = 1
	GroupEventOnMemberInvite = 2
	GroupEventOnMemberRemove = 3
	GroupEventOnLeaderChange = 4
	GroupEventOnDisband      = 5
	GroupEventOnCreate       = 6
)

Eluna GroupEvents contract for RegisterGroupEvent. Numbering is the TrinityCore LuaEngine numbering (LuaEngine/Hooks.h GroupEvents): GROUP_EVENT_ON_CREATE (6) has no fire site in this fork — Eluna::GroupHooks::OnCreate is never called from ScriptMgr or Group — so it is documented but never fired by the engine.

View Source
const (
	GameObjectEventOnAIUpdate      = 1
	GameObjectEventOnSpawn         = 2
	GameObjectEventOnDummyEffect   = 3
	GameObjectEventOnQuestAccept   = 4
	GameObjectEventOnQuestReward   = 5
	GameObjectEventOnDialogStatus  = 6
	GameObjectEventOnDestroyed     = 7
	GameObjectEventOnDamaged       = 8
	GameObjectEventOnLootState     = 9
	GameObjectEventOnGOStateChange = 10
	GameObjectEventOnAdd           = 12
	GameObjectEventOnRemove        = 13
	GameObjectEventOnUse           = 14
)

Eluna GameObjectEvents contract for RegisterGameObjectEvent. Numbering is the TrinityCore LuaEngine numbering (LuaEngine/Hooks.h GameObjectEvents): 11 is UNUSED in C++ and carries no Go constant; only the events the engine fires carry Go constants.

View Source
const (
	ItemEventOnDummyEffect = 1
	ItemEventOnUse         = 2
	ItemEventOnQuestAccept = 3
	ItemEventOnExpire      = 4
	ItemEventOnRemove      = 5
)

Eluna ItemEvents contract for RegisterItemEvent. Numbering is the TrinityCore LuaEngine numbering (LuaEngine/Hooks.h ItemEvents). The engine fires ON_USE (2), ON_QUEST_ACCEPT (3) and ON_EXPIRE (4); ON_DUMMY_EFFECT (1) and ON_REMOVE (5) carry constants but have no Go fire sites (documented in engine/world/item_hooks.go).

View Source
const (
	GossipEventOnHello  = 1
	GossipEventOnSelect = 2
)

Eluna GossipEvents contract shared by RegisterCreatureGossipEvent, RegisterGameObjectGossipEvent, RegisterItemGossipEvent and RegisterPlayerGossipEvent. Numbering is the TrinityCore LuaEngine numbering (LuaEngine/Hooks.h GossipEvents). The engine fires the item gossip arms (ON_HELLO, ON_SELECT) via TriggerItemGossipEvent; the creature arms fire inline in engine/world/gossip.go; the gameobject hello arm fires via TriggerGameObjectGossipEvent from handleGameObjectUse; the gameobject select arm fires via TriggerGameObjectGossipEvent from the gameobject branch of handleGossipSelectOption (gameobject_hooks.go), and the player select arm fires via TriggerPlayerGossipEvent from the player branch — both keyed like their Eluna bindings (HandleGossipSelectOptionOpcode, MiscHandler.cpp:138-227).

View Source
const (
	InstanceEventOnInitialize             = 1
	InstanceEventOnLoad                   = 2
	InstanceEventOnUpdate                 = 3
	InstanceEventOnPlayerEnter            = 4
	InstanceEventOnCreatureCreate         = 5
	InstanceEventOnGameObjectCreate       = 6
	InstanceEventOnCheckEncounterProgress = 7
)

Eluna InstanceEvents contract for RegisterMapEvent/RegisterInstanceEvent. Numbering is the TrinityCore LuaEngine numbering (LuaEngine/Hooks.h InstanceEvents). RegisterMapEvent binds a map ID (Go kind "map:<mapID>"); RegisterInstanceEvent binds an instance ID (Go kind "instance:<id>") — C++ fires both binding maps at every fire site (LuaEngine/InstanceHooks.cpp START_HOOK). The engine fires ON_UPDATE (3), ON_PLAYER_ENTER (4), ON_CREATURE_CREATE (5), ON_GAMEOBJECT_CREATE (6) and ON_CHECK_ENCOUNTER_IN_PROGRESS (7); ON_INITIALIZE (1) is #ifndef TRINITY-dead in C++ on this fork and ON_LOAD (2) has no Go instance-data load path (documented in engine/world/instance_hooks.go).

View Source
const (
	ServerEventAddonMessage = 30
	// ServerEventAreaTrigger is the Eluna TRIGGER_EVENT_ON_TRIGGER
	// (LuaEngine/Hooks.h:135 = 24, args (event, player, triggerId)):
	// ServerHooks.cpp:115-125 fires it from
	// WorldSession::HandleAreaTriggerOpcode (MiscHandler.cpp:678) after
	// the radius validation, and a boolean true return vetoes the rest
	// of the handler (CallAllFunctionsBool).
	ServerEventAreaTrigger = 24
)

Eluna ServerEvents contract for RegisterServerEvent. Numbering is the TrinityCore LuaEngine numbering (LuaEngine/Hooks.h ServerEvents); only the events the engine fires carry Go constants.

View Source
const (
	CreatureEventOnEnterCombat             = 1
	CreatureEventOnLeaveCombat             = 2
	CreatureEventOnTargetDied              = 3
	CreatureEventOnDied                    = 4
	CreatureEventOnSpawn                   = 5
	CreatureEventOnReachWP                 = 6
	CreatureEventOnAIUpdate                = 7
	CreatureEventOnReceiveEmote            = 8
	CreatureEventOnDamageTaken             = 9
	CreatureEventOnPreCombat               = 10
	CreatureEventOnOwnerAttacked           = 12
	CreatureEventOnOwnerAttackedAt         = 13
	CreatureEventOnHitBySpell              = 14
	CreatureEventOnSpellHitTarget          = 15
	CreatureEventOnJustSummonedCreature    = 19
	CreatureEventOnSummonedCreatureDespawn = 20
	CreatureEventOnSummonedCreatureDied    = 21
	CreatureEventOnSummoned                = 22
	CreatureEventOnReset                   = 23
	CreatureEventOnReachHome               = 24
	CreatureEventOnCorpseRemoved           = 26
	CreatureEventOnMoveInLOS               = 27
	CreatureEventOnDummyEffect             = 30
	CreatureEventOnQuestAccept             = 31
	CreatureEventOnQuestReward             = 34
	CreatureEventOnDialogStatus            = 35
	CreatureEventOnAdd                     = 36
	CreatureEventOnRemove                  = 37
)

Eluna CreatureEvents contract for RegisterCreatureEvent / RegisterUniqueCreatureEvent. The world engine fires these through TriggerCreatureEvent; scripts use the raw event numbers. Numbering is the TrinityCore LuaEngine numbering (LuaEngine/GlobalMethods.h CreatureEvents, hooks fired in LuaEngine/CreatureHooks.cpp): 11, 16-18, 25, 28-29, 32-33 are UNUSED in C++ and carry no Go constant.

Variables

This section is empty.

Functions

func GameObjectGossipKind

func GameObjectGossipKind(entry uint32) string

GameObjectGossipKind is the hook kind for RegisterGameObjectGossipEvent(entry, event, fn): "gameobject_gossip:<entry>", mirroring Eluna's GameObjectGossipBindings entry key (LuaEngine/GossipHooks.cpp).

func ItemGossipKind

func ItemGossipKind(entry uint32) string

ItemGossipKind is the hook kind for RegisterItemGossipEvent(entry, event, fn): "item_gossip:<entry>", mirroring Eluna's ItemGossipBindings entry key (LuaEngine/GossipHooks.cpp).

func PlayerGossipKind

func PlayerGossipKind(menuID uint32) string

PlayerGossipKind is the hook kind for RegisterPlayerGossipEvent(menuID, event, fn): "player_gossip:<menuID>", mirroring Eluna's PlayerGossipBindings menuId key (LuaEngine/GossipHooks.cpp:66).

func PushObject

func PushObject(state *lua.State, object *Object)

Types

type Config

type Config struct {
	Enabled        bool
	ScriptPath     string
	CoreName       string
	CoreVersion    string
	RealmID        uint32
	CoreExpansion  uint32
	PlayerProvider func() []*Object
	AuthDatabase   *sql.DB
	CharacterDB    *sql.DB
	WorldDatabase  *sql.DB
	Logger         *slog.Logger
}

type GroupLive

type GroupLive struct {
	Load    func() (GroupSnapshot, bool)
	Players func() []*Object
}

GroupLive carries the live-data callbacks behind a Lua Group object. Load re-reads the roster (Eluna methods read the live Group*); Players enumerates the online player objects for the GetMembers/GetLeader filters. Either may be nil.

type GroupMemberLive

type GroupMemberLive struct {
	GUID      uint64
	Name      string
	SubGroup  uint8
	Assistant bool
}

GroupMemberLive is one live group roster entry behind a Lua Group object.

type GroupSnapshot

type GroupSnapshot struct {
	LeaderGUID uint64
	Members    []GroupMemberLive
	IsRaid     bool
	IsBG       bool
}

GroupSnapshot is the live group roster behind a Lua Group object.

type GuildLive

type GuildLive struct {
	Load    func() (GuildSnapshot, bool)
	Players func() []*Object
}

GuildLive carries the live-data callbacks behind a Lua Guild object. Load re-reads the guild row (Eluna methods read the live Guild*, not a push-time copy); Players enumerates the online player objects for the GetLeader/GetMembers filters. Either may be nil.

type GuildSnapshot

type GuildSnapshot struct {
	Name        string
	LeaderGUID  uint64
	MemberCount uint32
	MOTD        string
	Info        string
}

GuildSnapshot is the live guild row behind a Lua Guild object: the fields Eluna's GuildMethods.h reads from the live Guild*.

type Hook

type Hook struct {
	Kind  string
	Event int
}

type Int64

type Int64 int64

type ItemLive

type ItemLive struct {
	LoadTemplate func() (ItemTemplateLive, bool)
}

ItemLive carries the template-data callback behind a Lua Item object. Load re-reads the item_template row (Eluna's methods read the live Item::GetTemplate()); a nil Load or a false return means the row is missing, and the template methods push nil — C++ would dereference a null template there, so Go takes the safe arm.

type ItemTemplateLive

type ItemTemplateLive struct {
	Name                              string
	Class, SubClass, DisplayInfoID    uint32
	Quality, ItemLevel, RequiredLevel uint32
	BuyPrice                          int32
	SellPrice, InventoryType          uint32
	AllowableClass, AllowableRace     uint32
	Stackable                         int32
	ContainerSlots, StatsCount        uint32
	SpellIDs                          [5]uint32
	SpellTriggers                     [5]uint32
}

ItemTemplateLive is the item_template row behind a Lua Item object: the fields Eluna's Item methods read through Item::GetTemplate(). The spell slots mirror MAX_ITEM_PROTO_SPELLS = 5 (ItemTemplate.h:597).

type MapLive

type MapLive struct {
	Load func() (MapSnapshot, bool)
}

MapLive carries the map-data callback behind a Lua Map object. Load re-reads the DBC entry; a nil Load or a false return means the entry is missing, and the DBC-backed methods push nil/false.

type MapSnapshot

type MapSnapshot struct {
	Name                                       string
	IsDungeon, IsRaid, IsArena, IsBattleground bool
}

MapSnapshot is the map DBC entry behind a Lua Map object: the fields Eluna's Map methods read through Map + sMapStore (MapMethods.h; MapEntry::IsDungeon/IsRaid/IsBattleArena/IsBattleground).

type Object

type Object struct {
	Type    string
	Methods map[string]ObjectMethod
	Fields  map[string]any
}

func NewGroupObject

func NewGroupObject(groupGUID uint64, live GroupLive) *Object

NewGroupObject builds the Lua Group object surface: the ID, GUID, LeaderGUID and member GUID fields plus the GetId/GetGUID/GetLeaderGUID/ GetMembers/GetMembersCount/IsLeader/IsFull/IsRaidGroup/IsBGGroup/IsMember/ IsAssistant/SameSubGroup/HasFreeSlotSubGroup/GetMemberGUID/GetMemberGroup methods (GroupMethods.h). GetMembers pushes the online Player objects for members with sessions, like the C++. It is the Go model of Eluna's Push(group) (LuaEngine/GroupHooks.cpp via ElunaTemplate), shared by the world engine's group event hooks. The mutating surface (AddMember/SetLeader/RemoveMember/Disband/ConvertToRaid/SetMembersGroup/ SetTargetIcon/SendPacket, GroupMethods.h) is attached by the world engine's attachGroupMutations, which re-resolves the live group per call. groupGUID is the protocol group GUID (0x1F50 high bits, as in world group.go's groupGUID).

func NewGuildObject

func NewGuildObject(guildID uint32, live GuildLive) *Object

NewGuildObject builds the Lua Guild object surface: the ID, Name, LeaderGUID, MemberCount, MOTD and Info fields plus the GetId/GetName/ GetLeaderGUID/GetMemberCount/GetMOTD/GetInfo/GetLeader/GetMembers methods. It is the Go model of Eluna's Push(guild) (LuaEngine/GuildHooks.cpp via ElunaTemplate), shared by the GetGuildBy* globals and the world engine's guild event hooks. The mutating surface (SetLeader/SetBankTabText/ SendPacket/SendPacketToRanked/Disband/AddMember/DeleteMember/SetMemberRank, GuildMethods.h) is attached by the world engine's attachGuildMutations, which re-resolves the live guild per call; snapshot-only objects (the globals) carry the read surface only.

func NewItemObject

func NewItemObject(guid uint64, entry, count uint32, live ItemLive) *Object

NewItemObject builds the Lua Item object surface for hooks that hand scripts a live item (Eluna's Push(Item*) via ElunaTemplate): the GUID, Entry and Count fields plus the template-read methods GetName, GetQuality, GetClass, GetSubClass, GetDisplayId, GetItemLevel, GetRequiredLevel, GetBuyPrice, GetSellPrice, GetInventoryType, GetAllowableClass, GetAllowableRace, GetMaxStackCount, GetBagSize, GetStatsCount, IsBag, GetSpellId and GetSpellTrigger (ItemMethods.h). The generic object methods supply GetEntry/GetGUID/GetGUIDLow/GetTypeId (object.go). The instance-bound surface (GetOwner, GetSlot, GetBagSlot, IsEquipped, IsBroken) and the mutating surface (SetOwner, SetBinding, SetCount, SetEnchantment, ClearEnchantment, SaveToDB) have no Go live-item model behind them and stay unbridged.

func NewMapObject

func NewMapObject(mapID, instanceID uint32, live MapLive) *Object

NewMapObject builds the Lua Map object surface for the MAP_EVENT_* and INSTANCE_EVENT_* hooks: GetMapId/GetInstanceId ride the generic object methods (object.go) and the DBC-backed GetName/IsDungeon/IsRaid/IsArena/ IsBattleground come from the live MapLive (MapMethods.h). The remaining Map surface (GetHeight/GetDifficulty/GetPlayerCount/GetAreaId(x,y,z)/ GetWorldObject/SetWeather/GetInstanceData/SaveInstanceData/GetPlayers) needs a live Map* with grid/difficulty state and stays unbridged.

type ObjectMethod

type ObjectMethod func(context.Context, []any) ([]any, error)

type Packet

type Packet struct {
	Opcode  uint32
	Data    []byte
	ReadPos int
}

type Query

type Query struct {
	// contains filtered or unexported fields
}

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

func NewRuntime

func NewRuntime(c Config) *Runtime

func (*Runtime) HasHook

func (r *Runtime) HasHook(kind string, event int) bool

HasHook reports whether at least one non-cancelled hook is registered for the given kind and event — the Go model of Eluna's Bindings::HasBindingsFor, which the START_HOOK macros consult before running hook prologues such as PlayerTalkClass::ClearMenus().

func (*Runtime) Hooks

func (r *Runtime) Hooks() []Hook

func (*Runtime) Load

func (r *Runtime) Load(ctx context.Context) error

func (*Runtime) LoadFailures

func (r *Runtime) LoadFailures() []error

func (*Runtime) LoadString

func (r *Runtime) LoadString(source string) error

func (*Runtime) LoadedFiles

func (r *Runtime) LoadedFiles() []string

func (*Runtime) SetPlayerProvider

func (r *Runtime) SetPlayerProvider(provider func() []*Object)

func (*Runtime) Tick

func (r *Runtime) Tick(ctx context.Context, elapsed int64) error

func (*Runtime) Trigger

func (r *Runtime) Trigger(ctx context.Context, kind string, event int, args ...any) ([]any, error)

func (*Runtime) TriggerCreatureEvent

func (r *Runtime) TriggerCreatureEvent(ctx context.Context, entry uint32, event int, args ...any) ([]any, error)

TriggerCreatureEvent fires hooks registered with RegisterCreatureEvent(entry, event, fn) for the given creature entry.

func (*Runtime) TriggerCreatureEvent2

func (r *Runtime) TriggerCreatureEvent2(ctx context.Context, entry uint32, event int, args ...any) ([][]any, error)

TriggerCreatureEvent2 fires hooks registered with RegisterCreatureEvent(entry, event, fn) for the given creature entry, capturing two return values per handler. It exists for Eluna hooks whose C++ call sites consume a second return via CallOneFunction(n, args, 2): CREATURE_EVENT_ON_DAMAGE_TAKEN (9) rewrites damage, and CREATURE_EVENT_ON_CORPSE_REMOVED (26) rewrites respawnDelay. Each inner slice is [firstReturn, secondReturn] in handler call order.

func (*Runtime) TriggerCreatureEvent2Updated

func (r *Runtime) TriggerCreatureEvent2Updated(ctx context.Context, entry uint32, event int, args []any, update func(returns []any)) ([][]any, error)

TriggerCreatureEvent2Updated is TriggerCreatureEvent2 with per-handler argument chaining: after each handler's returns are captured, update may mutate args for the subsequent handlers, mirroring Eluna's ReplaceArgument. Used by CREATURE_EVENT_ON_DAMAGE_TAKEN (9), whose C++ loop rewrites the damage argument each handler sees.

func (*Runtime) TriggerGameObjectEvent

func (r *Runtime) TriggerGameObjectEvent(ctx context.Context, entry uint32, event int, args ...any) ([]any, error)

TriggerGameObjectEvent fires hooks registered with RegisterGameObjectEvent(entry, event, fn) for the given gameobject entry. C++ Eluna gameobject hooks pass (event, go, ...) (LuaEngine/ GameObjectHooks.cpp), so the event number is prepended like TriggerGuildEvent.

func (*Runtime) TriggerGameObjectGossipEvent

func (r *Runtime) TriggerGameObjectGossipEvent(ctx context.Context, entry uint32, event int, args ...any) ([]any, error)

TriggerGameObjectGossipEvent fires hooks registered with RegisterGameObjectGossipEvent(entry, event, fn) for the given gameobject entry. C++ Eluna gossip hooks pass (event, player, go, ...) (LuaEngine/GossipHooks.cpp), so the event number is prepended like TriggerItemGossipEvent. Callers pass the C++ argument order without the leading event.

func (*Runtime) TriggerGroupEvent

func (r *Runtime) TriggerGroupEvent(ctx context.Context, event int, args ...any) ([]any, error)

TriggerGroupEvent fires hooks registered with RegisterGroupEvent(event, fn). C++ Eluna group hooks pass (event, group, ...) (LuaEngine/ GroupHooks.cpp), so the event number is prepended like TriggerGuildEvent.

func (*Runtime) TriggerGuildEvent

func (r *Runtime) TriggerGuildEvent(ctx context.Context, event int, args ...any) ([]any, error)

TriggerGuildEvent fires hooks registered with RegisterGuildEvent(event, fn). C++ Eluna guild hooks pass (event, guild, ...) (LuaEngine/ GuildHooks.cpp), so the event number is prepended like TriggerServerEvent.

func (*Runtime) TriggerGuildEventUpdated

func (r *Runtime) TriggerGuildEventUpdated(ctx context.Context, event int, args []any, update func(returns []any)) ([][]any, error)

TriggerGuildEventUpdated is TriggerGuildEvent with per-handler argument chaining: after each handler's returns are captured, update may mutate args for the subsequent handlers, mirroring Eluna's ReplaceArgument. Used by GUILD_EVENT_ON_MONEY_WITHDRAW (7) and GUILD_EVENT_ON_MONEY_DEPOSIT (8), whose C++ call sites (GuildHooks.cpp OnMemberWitdrawMoney / OnMemberDepositMoney) consume one numeric return per handler as the new amount and rewrite the argument each handler sees (CallOneFunction(n, args, 1), so nresults is 1).

func (*Runtime) TriggerInstanceEvent

func (r *Runtime) TriggerInstanceEvent(ctx context.Context, mapID, instanceID uint32, event int, args ...any) ([]any, error)

TriggerInstanceEvent fires hooks registered with RegisterMapEvent(mapID, event, fn) (kind "map:<mapID>") and RegisterInstanceEvent(instanceID, event, fn) (kind "instance:<instanceID>"), mirroring Eluna::InstanceHooks (LuaEngine/InstanceHooks.cpp), whose START_HOOK macro calls CallAllFunctions over both the map-level and instance-level binding maps at every fire site. C++ instance hooks pass (event, instance_data, map, ...) (LuaEngine/InstanceHooks.cpp), so the event number is prepended like TriggerMapEvent. Callers pass the C++ argument order without the leading event.

func (*Runtime) TriggerItemEvent

func (r *Runtime) TriggerItemEvent(ctx context.Context, entry uint32, event int, args ...any) ([]any, error)

TriggerItemEvent fires hooks registered with RegisterItemEvent(entry, event, fn) for the given item entry. C++ Eluna item hooks pass (event, player, item, ...) (LuaEngine/ ItemHooks.cpp), so the event number is prepended like TriggerGameObjectEvent. Callers pass the C++ argument order without the leading event.

func (*Runtime) TriggerItemGossipEvent

func (r *Runtime) TriggerItemGossipEvent(ctx context.Context, entry uint32, event int, args ...any) ([]any, error)

TriggerItemGossipEvent fires hooks registered with RegisterItemGossipEvent(entry, event, fn) for the given item entry. C++ Eluna gossip hooks pass (event, player, item, ...) (LuaEngine/ GossipHooks.cpp), so the event number is prepended like TriggerItemEvent. Callers pass the C++ argument order without the leading event.

func (*Runtime) TriggerMapEvent

func (r *Runtime) TriggerMapEvent(ctx context.Context, mapID uint32, event int, args ...any) ([]any, error)

func (*Runtime) TriggerPacketEvent

func (r *Runtime) TriggerPacketEvent(ctx context.Context, opcode, event int, args ...any) ([]any, error)

func (*Runtime) TriggerPlayerEvent

func (r *Runtime) TriggerPlayerEvent(ctx context.Context, event int, args ...any) ([]any, error)

func (*Runtime) TriggerPlayerEventUpdated

func (r *Runtime) TriggerPlayerEventUpdated(ctx context.Context, event int, args []any, update func(returns []any)) ([][]any, error)

TriggerPlayerEventUpdated is the chained-argument player-event trigger, mirroring Eluna's ReplaceArgument semantics (LuaEngine/PlayerHooks.cpp): hooks whose C++ call sites consume a numeric return (PLAYER_EVENT_ON_GIVE_XP rewrites amount, PLAYER_EVENT_ON_MONEY_CHANGE rewrites amount, PLAYER_EVENT_ON_REPUTATION_CHANGE rewrites standing) pass each handler the rewritten argument, so update mutates args between handler invocations.

func (*Runtime) TriggerPlayerGossipEvent

func (r *Runtime) TriggerPlayerGossipEvent(ctx context.Context, menuID uint32, event int, args ...any) ([]any, error)

TriggerPlayerGossipEvent fires hooks registered with RegisterPlayerGossipEvent(menuID, event, fn) for the given gossip menu. C++ Eluna gossip hooks pass (event, player, ...) (LuaEngine/GossipHooks.cpp), so the event number is prepended like TriggerGameObjectGossipEvent. The player select arm passes (event, player, player, sender, action, code-or-nil) with no cancel semantics (CallAllFunctions, GossipHooks.cpp:78).

func (*Runtime) TriggerServerEvent

func (r *Runtime) TriggerServerEvent(ctx context.Context, event int, args ...any) ([]any, error)

func (*Runtime) TriggerUniqueCreatureEvent

func (r *Runtime) TriggerUniqueCreatureEvent(ctx context.Context, guid uint64, instanceID uint32, event int, args ...any) ([]any, error)

TriggerUniqueCreatureEvent fires hooks registered with RegisterUniqueCreatureEvent(guid, instanceID, event, fn).

func (*Runtime) TriggerUniqueCreatureEvent2Updated

func (r *Runtime) TriggerUniqueCreatureEvent2Updated(ctx context.Context, guid uint64, instanceID uint32, event int, args []any, update func(returns []any)) ([][]any, error)

TriggerUniqueCreatureEvent2Updated is the two-return, chained-argument variant of TriggerUniqueCreatureEvent. Eluna creature hooks consume both the entry bindings and the unique bindings (SetupStack merges CreatureEventBindings then CreatureUniqueBindings), so callers run the entry pass first and then this pass, threading the same args/update through both to mirror ReplaceArgument chaining across families.

type UInt64

type UInt64 uint64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL