Something went wrong. Try again.
Oxidized Massive Network Game Object Server
rust wow-emulation wow mangos
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947//! The `Script` trait — what a plugin implements.//!//! Implement only the events you care about; every method has a default. **Implementing a method//! is how you register for its event** — the `#[plugin]` attribute macro reads the impl block and//! derives the registration list, so there is no separate `register` list to keep in sync.//!//! Commands are not methods on this trait: each verb is its own inherent method tagged//! `#[command("verb")]`, which the macro discovers and routes. See `docs/design/plugins.md`.//!//! `on_install`/`InstallCtx` (the declarative installer) join this trait when the lifecycle//! interface lands (section E).
use crate::ctx::{EventCtx, GossipCtx};use crate::install::InstallCtx;use crate::mangos::scripting::game_types::{ AddonChannel, AuctionAction, ChatKind, DeathCause, DuelEndType, HonorSource, MoneySource, QuestStatusChange, ReputationSource, ResurrectMethod, SkillSource, TradeStage, XpSource,};
/// A plugin: a stateful (`&mut self`) handler whose implemented methods register for events.////// The boolean-returning events follow the **AND-combinator**: returning `false` suppresses the/// core/native default for that event; it never blocks another plugin.pub trait Script: Default + 'static { /// Install hook: declare the plugin's content (creature templates, spawns, tables) through /// `ctx`. `from` is `None` on a fresh install, `Some(version)` on an upgrade. Default: no-op. /// /// # Errors /// Return `Err(message)` to abort the install; the host rolls back the ledger diff. fn on_install(&mut self, ctx: &mut InstallCtx, from: Option<String>) -> Result<(), String> { let _ = (ctx, from); Ok(()) }
/// Uninstall hook. The host reverts everything in the ownership ledger automatically; override /// only to clean up `execute_sql` side effects the ledger can't track. Default: no-op. /// /// # Errors /// Return `Err(message)` to report a cleanup failure (the host still removes owned resources). fn on_uninstall(&mut self, ctx: &mut InstallCtx) -> Result<(), String> { let _ = ctx; Ok(()) }
/// A player logged in. Default: `true` (never suppress the login default). fn on_login(&mut self, ctx: &mut EventCtx) -> bool { let _ = ctx; true }
/// A player is logging out (still on the map). upstream Eluna: `PLAYER_EVENT_ON_LOGOUT`. /// Default: no-op. fn on_logout(&mut self, ctx: &mut EventCtx) { let _ = ctx; }
/// The player's level changed; `old_level` is the level before (read the new one via /// `ctx.player().level()`). upstream Eluna: `PLAYER_EVENT_ON_LEVEL_CHANGE`. Default: no-op. fn on_level_change(&mut self, ctx: &mut EventCtx, old_level: u32) { let _ = (ctx, old_level); }
/// The player performed a text emote (`text_emote` id, `emote` number, `target` guid — 0 if /// none). upstream Eluna: `PLAYER_EVENT_ON_TEXT_EMOTE`. Default: no-op. fn on_text_emote(&mut self, ctx: &mut EventCtx, text_emote: u32, emote: u32, target: u64) { let _ = (ctx, text_emote, emote, target); }
/// The player entered a new zone (`new_zone`). upstream Eluna: /// `PLAYER_EVENT_ON_UPDATE_ZONE`. Default: no-op. fn on_update_zone(&mut self, ctx: &mut EventCtx, new_zone: u32) { let _ = (ctx, new_zone); }
/// The player killed a creature (`creature_entry`/`creature_guid`). upstream Eluna: /// `PLAYER_EVENT_ON_KILL_CREATURE`. Dispatched just after the kill resolves. Default: no-op. fn on_kill_creature(&mut self, ctx: &mut EventCtx, creature_entry: u32, creature_guid: u64) { let _ = (ctx, creature_entry, creature_guid); }
/// The player (`ctx.player()` = the killer) killed another player `killed_guid` (PvP). upstream /// Eluna: `PLAYER_EVENT_ON_KILL_PLAYER`. Default: no-op. fn on_kill_player(&mut self, ctx: &mut EventCtx, killed_guid: u64) { let _ = (ctx, killed_guid); }
/// The player (`ctx.player()` = the victim) was killed by a creature /// (`creature_entry`/`creature_guid`). upstream Eluna: `PLAYER_EVENT_ON_KILLED_BY_CREATURE`. /// Default: no-op. fn on_killed_by_creature( &mut self, ctx: &mut EventCtx, creature_entry: u32, creature_guid: u64, ) { let _ = (ctx, creature_entry, creature_guid); }
/// The player entered combat. `enemy_guid` is a unit it's engaged with (0 if not determinable). /// upstream Eluna: `PLAYER_EVENT_ON_ENTER_COMBAT`. Default: no-op. fn on_enter_combat(&mut self, ctx: &mut EventCtx, enemy_guid: u64) { let _ = (ctx, enemy_guid); }
/// The player left combat. upstream Eluna: `PLAYER_EVENT_ON_LEAVE_COMBAT`. Default: no-op. fn on_leave_combat(&mut self, ctx: &mut EventCtx) { let _ = ctx; }
/// The player returned to life (any resurrect path). upstream Eluna: /// `PLAYER_EVENT_ON_RESURRECT`. Default: no-op. fn on_resurrect(&mut self, ctx: &mut EventCtx) { let _ = ctx; }
/// The player released its spirit (became a ghost). upstream Eluna: `PLAYER_EVENT_ON_REPOP`. /// Default: no-op. fn on_repop(&mut self, ctx: &mut EventCtx) { let _ = ctx; }
/// The player was added to this map (a fresh login or a teleport-in); fires for every map add, /// after the player is placed. upstream Eluna: `MAP_EVENT_ON_PLAYER_ENTER`. Default: no-op. fn on_map_player_enter(&mut self, ctx: &mut EventCtx) { let _ = ctx; }
/// The player was removed from this map (logout, teleport-out, or a battleground port); fires /// for every map removal. The handle is valid only for its guid here — live field accessors /// return `Stale`, as the player has just left the map. upstream Eluna: /// `MAP_EVENT_ON_PLAYER_LEAVE`. Default: no-op. fn on_map_player_leave(&mut self, ctx: &mut EventCtx) { let _ = ctx; }
/// The player's state was persisted (periodic save / logout). upstream Eluna: /// `PLAYER_EVENT_ON_SAVE`. Default: no-op. fn on_save(&mut self, ctx: &mut EventCtx) { let _ = ctx; }
/// The player looted `count` of item `item` into their bags. upstream Eluna: /// `PLAYER_EVENT_ON_LOOT_ITEM`. Default: no-op. fn on_loot_item(&mut self, ctx: &mut EventCtx, item: u32, count: u32) { let _ = (ctx, item, count); }
/// The player looted `amount` copper (their share of the purse). upstream Eluna: /// `PLAYER_EVENT_ON_LOOT_MONEY`. Default: no-op. fn on_loot_money(&mut self, ctx: &mut EventCtx, amount: u32) { let _ = (ctx, amount); }
/// The player equipped item `item` into equipment slot `slot` of container `bag`. upstream /// Eluna: `PLAYER_EVENT_ON_EQUIP`. Default: no-op. fn on_equip(&mut self, ctx: &mut EventCtx, item: u32, bag: u32, slot: u32) { let _ = (ctx, item, bag, slot); }
/// The player abandoned quest `quest` from their log. upstream Eluna: /// `PLAYER_EVENT_ON_QUEST_ABANDON`. Default: no-op. fn on_quest_abandon(&mut self, ctx: &mut EventCtx, quest: u32) { let _ = (ctx, quest); }
/// Quest `quest`'s status changed for the player (`change`): accepted, objectives completed, /// or rewarded. An engine-built aggregate over the accept / complete / reward funnels. /// Default: no-op. fn on_quest_status_changed( &mut self, ctx: &mut EventCtx, quest: u32, change: QuestStatusChange, ) { let _ = (ctx, quest, change); }
/// The player (`ctx.player()` = the challenged target) was challenged to a duel by `challenger`. /// upstream Eluna: `PLAYER_EVENT_ON_DUEL_REQUEST`. Default: no-op. fn on_duel_request(&mut self, ctx: &mut EventCtx, challenger: u64) { let _ = (ctx, challenger); }
/// The duel countdown elapsed; the duel is live (`ctx.player()` = initiator, `opponent`). /// upstream Eluna: `PLAYER_EVENT_ON_DUEL_START`. Default: no-op. fn on_duel_start(&mut self, ctx: &mut EventCtx, opponent: u64) { let _ = (ctx, opponent); }
/// The duel ended: `ctx.player()` is the winner (initiator on an interruption), `opponent` the /// loser, `kind` how it ended. upstream Eluna: `PLAYER_EVENT_ON_DUEL_END`. Default: no-op. fn on_duel_end(&mut self, ctx: &mut EventCtx, opponent: u64, kind: DuelEndType) { let _ = (ctx, opponent, kind); }
/// The player discovered a new map `area` by exploring into it. upstream Eluna: /// `PLAYER_EVENT_ON_DISCOVER_AREA`. Default: no-op. fn on_discover_area(&mut self, ctx: &mut EventCtx, area: u32) { let _ = (ctx, area); }
/// The player (`ctx.player()` = sender) whispered `message` to the character named `receiver`. /// Return `false` to suppress delivery. upstream Eluna: `PLAYER_EVENT_ON_WHISPER` (`OnChat` /// whisper). Default: `true` (deliver). fn on_whisper(&mut self, ctx: &mut EventCtx, receiver: &str, message: &str) -> bool { let _ = (ctx, receiver, message); true }
/// The player (`ctx.player()` = sender) sent `message` to their party (`raid` = false) or raid /// (`raid` = true). Return `false` to suppress delivery. upstream Eluna: /// `PLAYER_EVENT_ON_GROUP_CHAT`. Default: `true` (deliver). fn on_group_chat(&mut self, ctx: &mut EventCtx, raid: bool, message: &str) -> bool { let _ = (ctx, raid, message); true }
/// The player (`ctx.player()` = sender) sent `message` to guild (`officer` = false) or officer /// (`officer` = true) chat. Return `false` to suppress delivery. upstream Eluna: /// `PLAYER_EVENT_ON_GUILD_CHAT`. Default: `true` (deliver). fn on_guild_chat(&mut self, ctx: &mut EventCtx, officer: bool, message: &str) -> bool { let _ = (ctx, officer, message); true }
/// The player (`ctx.player()` = sender) sent `message` to the chat channel named `channel`. /// Return `false` to suppress delivery. upstream Eluna: `PLAYER_EVENT_ON_CHANNEL_CHAT`. /// Default: `true` (deliver). fn on_channel_chat(&mut self, ctx: &mut EventCtx, channel: &str, message: &str) -> bool { let _ = (ctx, channel, message); true }
/// The player logged in for the very first time (the character's first session). Fires once, /// ever, in addition to the normal `on_login`. upstream Eluna: `PLAYER_EVENT_ON_FIRST_LOGIN`. /// Default: no-op. fn on_first_login(&mut self, ctx: &mut EventCtx) { let _ = ctx; }
/// Gate before the player uses item `item` from their bags (after the core's class/race/level/ /// skill checks). Return `false` to block the use. upstream Eluna: /// `PLAYER_EVENT_ON_CAN_USE_ITEM`. Default: `true` (allow). fn on_can_use_item(&mut self, ctx: &mut EventCtx, item: u32) -> bool { let _ = (ctx, item); true }
/// The player's reputation with `faction` changed to `standing` (the new total, base + earned). /// upstream Eluna: `PLAYER_EVENT_ON_REPUTATION_CHANGE`. Default: no-op. fn on_reputation_change(&mut self, ctx: &mut EventCtx, faction: u32, standing: i32) { let _ = (ctx, faction, standing); }
/// The player's `skill` changed to the new `value`. upstream Eluna: /// `PLAYER_EVENT_ON_SKILL_CHANGE`. Default: no-op. fn on_skill_change(&mut self, ctx: &mut EventCtx, skill: u32, value: u32) { let _ = (ctx, skill, value); }
/// The player learned talent rank `rank` of talent spell `spell`. upstream Eluna: /// `PLAYER_EVENT_ON_TALENTS_CHANGE`. Default: no-op. fn on_talents_change(&mut self, ctx: &mut EventCtx, spell: u32, rank: u32) { let _ = (ctx, spell, rank); }
/// The player reset their talents (`cost` copper charged, 0 for a free wipe). upstream Eluna: /// `PLAYER_EVENT_ON_TALENTS_RESET`. Default: no-op. fn on_talents_reset(&mut self, ctx: &mut EventCtx, cost: u32) { let _ = (ctx, cost); }
/// The player's carried money changed; `amount` is the new total copper. upstream Eluna: /// `PLAYER_EVENT_ON_MONEY_CHANGE`. Default: no-op. fn on_money_change(&mut self, ctx: &mut EventCtx, amount: u32) { let _ = (ctx, amount); }
/// The player spoke a `kind` (say/yell/emote) line `message`. Return `false` to suppress the /// core fan-out to nearby players. upstream Eluna: `PLAYER_EVENT_ON_CHAT`. Default: `true`. fn on_chat(&mut self, ctx: &mut EventCtx, kind: ChatKind, message: &str) -> bool { let _ = (ctx, kind, message); true }
/// The player sent mail to `receiver`, attaching `money` copper (0 if none). upstream Eluna: /// `PLAYER_EVENT_ON_SEND_MAIL`. Default: no-op. fn on_send_mail(&mut self, ctx: &mut EventCtx, receiver: &str, money: u32) { let _ = (ctx, receiver, money); }
/// The player opened a trade with `partner`. upstream Eluna: `PLAYER_EVENT_ON_TRADE_INIT`. /// Default: no-op. fn on_trade_init(&mut self, ctx: &mut EventCtx, partner: u64) { let _ = (ctx, partner); }
/// The player clicked Accept on its trade with `partner`. upstream Eluna: /// `PLAYER_EVENT_ON_TRADE_ACCEPT`. Default: no-op. fn on_trade_accept(&mut self, ctx: &mut EventCtx, partner: u64) { let _ = (ctx, partner); }
/// A creature this plugin registered (via `#[plugin(creature = <entry>)]`) died. `guid` is the /// creature, `killer` the unit that landed the blow (0 if none). upstream Eluna: /// `CREATURE_EVENT_ON_DIED`. Default: no-op. fn on_creature_death(&mut self, guid: u64, killer: u64) { let _ = (guid, killer); }
/// A creature this plugin registered (by entry) entered combat. `guid` is the creature, `target` /// the unit it engaged (0 if undetermined). upstream Eluna: `CREATURE_EVENT_ON_ENTER_COMBAT`. /// Default: no-op. fn on_creature_enter_combat(&mut self, guid: u64, target: u64) { let _ = (guid, target); }
/// A creature this plugin registered (by entry) left combat. `guid` is the creature. upstream /// Eluna: `CREATURE_EVENT_ON_LEAVE_COMBAT`. Default: no-op. fn on_creature_leave_combat(&mut self, guid: u64) { let _ = guid; }
/// A creature this plugin registered (by entry) was spawned or respawned onto the map. `guid` /// is the creature. upstream Eluna: `CREATURE_EVENT_ON_SPAWN`. Default: no-op. fn on_creature_spawn(&mut self, guid: u64) { let _ = guid; }
/// A creature this plugin registered (by entry) reset its AI: on a fresh spawn/respawn and when /// it leaves combat and returns home (evade). `guid` is the creature. upstream Eluna: /// `CREATURE_EVENT_ON_RESET`. Default: no-op. fn on_creature_reset(&mut self, guid: u64) { let _ = guid; }
/// A creature this plugin registered (by entry) reached its home position after evading. The /// server commits the home position synchronously during evade, so this fires as the creature /// leaves combat, ahead of the client's run-home animation. `guid` is the creature. upstream /// Eluna: `CREATURE_EVENT_ON_REACH_HOME`. Default: no-op. fn on_creature_reach_home(&mut self, guid: u64) { let _ = guid; }
/// A creature this plugin registered (by entry, the summoner) summoned another creature. /// `summon` is the summoned creature's guid, `summon_entry` its template entry. Fires only when /// the summoner is a creature. upstream Eluna: `CREATURE_EVENT_ON_JUST_SUMMONED_CREATURE`. /// Default: no-op. fn on_creature_just_summoned(&mut self, summon: u64, summon_entry: u32) { let _ = (summon, summon_entry); }
/// A creature this plugin registered (by entry, the summoner) had one of its summoned creatures /// despawn. `summon` is the summoned creature's guid, `summon_entry` its template entry. /// upstream Eluna: `CREATURE_EVENT_ON_SUMMONED_CREATURE_DESPAWN`. Default: no-op. fn on_creature_summoned_despawn(&mut self, summon: u64, summon_entry: u32) { let _ = (summon, summon_entry); }
/// A creature this plugin registered (by entry, the summoner) had one of its summoned creatures /// die. `summon` is the summoned creature's guid, `summon_entry` its template entry. upstream /// Eluna: `CREATURE_EVENT_ON_SUMMONED_CREATURE_DIED`. Default: no-op. fn on_creature_summoned_died(&mut self, summon: u64, summon_entry: u32) { let _ = (summon, summon_entry); }
/// A creature this plugin registered (by entry) reached a waypoint on its native movement path. /// `guid` is the creature, `point` the 0-based waypoint index. upstream Eluna: /// `CREATURE_EVENT_ON_WAYPOINT_REACHED`. Default: no-op. fn on_creature_reach_wp(&mut self, guid: u64, point: u32) { let _ = (guid, point); }
/// A creature this plugin registered (by entry) received a targeted text-emote from a player. /// `guid` is the creature, `player` the emoting player, `text_emote` the TextEmotes.dbc id. /// upstream Eluna: `CREATURE_EVENT_ON_RECEIVE_EMOTE`. Default: no-op. fn on_creature_receive_emote(&mut self, guid: u64, player: u64, text_emote: u32) { let _ = (guid, player, text_emote); }
/// A player accepted `quest` from a creature questgiver this plugin registered (by entry). /// `guid` is the questgiver creature, `player` the accepting player. upstream Eluna: /// `CREATURE_EVENT_ON_QUEST_ACCEPT`. Default: no-op. fn on_creature_quest_accept(&mut self, guid: u64, player: u64, quest: u32) { let _ = (guid, player, quest); }
/// A player turned in `quest` for its reward at a creature questgiver this plugin registered /// (by entry). `guid` is the questgiver creature, `player` the player. upstream Eluna: /// `CREATURE_EVENT_ON_QUEST_REWARD`. Default: no-op. fn on_creature_quest_reward(&mut self, guid: u64, player: u64, quest: u32) { let _ = (guid, player, quest); }
/// A creature this plugin registered (by entry) took damage. `guid` is the creature, `attacker` /// the dealing unit, `damage` the post-absorb amount applied. upstream Eluna: /// `CREATURE_EVENT_ON_DAMAGE_TAKEN`. Default: no-op. fn on_creature_damage_taken(&mut self, guid: u64, attacker: u64, damage: u32) { let _ = (guid, attacker, damage); }
/// A creature this plugin registered (by entry) had its corpse removed from the map (decay /// before respawn). `guid` is the creature. upstream Eluna: `CREATURE_EVENT_ON_CORPSE_REMOVED`. /// Default: no-op. fn on_creature_corpse_removed(&mut self, guid: u64) { let _ = guid; }
/// A creature this plugin registered (by entry, the caster) landed a spell on a target. `guid` /// is the casting creature, `target` the struck unit, `spell` the spell id (once per struck /// target). upstream Eluna: `CREATURE_EVENT_ON_SPELL_HIT_TARGET`. Default: no-op. fn on_creature_spell_hit_target(&mut self, guid: u64, target: u64, spell: u32) { let _ = (guid, target, spell); }
/// A creature this plugin registered (by entry, the victim) was hit by a spell. `guid` is the /// struck creature, `caster` the casting unit, `spell` the spell id. upstream Eluna: /// `CREATURE_EVENT_ON_SPELL_HIT` / `ON_HIT_BY_SPELL`. Default: no-op. fn on_creature_hit_by_spell(&mut self, guid: u64, caster: u64, spell: u32) { let _ = (guid, caster, spell); }
/// A `SPELL_EFFECT_DUMMY` / `SPELL_EFFECT_SCRIPT_EFFECT` was applied to a creature this plugin /// registered (by entry). `guid` is the target creature, `caster` the casting unit, `spell` the /// spell id, `effect_index` the 0-based effect slot. upstream Eluna: /// `CREATURE_EVENT_ON_DUMMY_EFFECT`. Default: no-op. fn on_creature_dummy_effect(&mut self, guid: u64, caster: u64, spell: u32, effect_index: u32) { let _ = (guid, caster, spell, effect_index); }
/// A creature this plugin registered (by entry) was summoned onto the map. `guid` is the /// summoned creature, `summoner` the unit that summoned it. Fires from the summon's perspective. /// upstream Eluna: `CREATURE_EVENT_ON_SUMMONED`. Default: no-op. fn on_creature_summoned(&mut self, guid: u64, summoner: u64) { let _ = (guid, summoner); }
/// A player queried the questgiver status of a creature this plugin registered (by entry). /// `guid` is the creature, `player` the querying player, `status` the computed status byte. /// upstream Eluna: `CREATURE_EVENT_ON_DIALOG_STATUS`. Default: no-op. fn on_creature_dialog_status(&mut self, guid: u64, player: u64, status: u8) { let _ = (guid, player, status); }
/// A creature this plugin registered (by entry) was removed from the world while alive (a /// scripted despawn or temp-summon removal). `guid` is the creature. upstream Eluna: /// `CREATURE_EVENT_ON_REMOVE`. Default: no-op. fn on_creature_remove(&mut self, guid: u64) { let _ = guid; }
/// A per-tick AI update for a creature this plugin registered (by entry). `guid` is the /// creature, `diff` the milliseconds since the last tick. Fires every map tick for each live /// creature of a registered entry. upstream Eluna: `CREATURE_EVENT_ON_AIUPDATE`. Default: no-op. fn on_creature_ai_update(&mut self, guid: u64, diff: u32) { let _ = (guid, diff); }
/// A creature this plugin registered (by entry) had its combat target die. `guid` is the /// creature, `victim` the unit that died. upstream Eluna: `CREATURE_EVENT_ON_TARGET_DIED`. /// Default: no-op. fn on_creature_target_died(&mut self, guid: u64, victim: u64) { let _ = (guid, victim); }
/// A gameobject this plugin registered (via `#[plugin(gameobject = <entry>)]`) was used by a /// player. `guid` is the gameobject, `user` the player. upstream Eluna: /// `GAMEOBJECT_EVENT_ON_USE`. Default: no-op. fn on_gameobject_use(&mut self, guid: u64, user: u64) { let _ = (guid, user); }
/// A gameobject this plugin registered (by entry) was spawned onto the map. `guid` is the /// gameobject. upstream Eluna: `GAMEOBJECT_EVENT_ON_SPAWN`. Default: no-op. fn on_gameobject_spawn(&mut self, guid: u64) { let _ = guid; }
/// A player accepted `quest` from a gameobject questgiver this plugin registered (by entry). /// `guid` is the gameobject, `player` the accepting player. upstream Eluna: /// `GAMEOBJECT_EVENT_ON_QUEST_ACCEPT`. Default: no-op. fn on_gameobject_quest_accept(&mut self, guid: u64, player: u64, quest: u32) { let _ = (guid, player, quest); }
/// A player queried the questgiver status of a gameobject this plugin registered (by entry). /// `guid` is the gameobject, `player` the querying player, `status` the computed status byte. /// upstream Eluna: `GAMEOBJECT_EVENT_ON_DIALOG_STATUS`. Default: no-op. fn on_gameobject_dialog_status(&mut self, guid: u64, player: u64, status: u8) { let _ = (guid, player, status); }
/// An item this plugin registered (via `#[plugin(item = <entry>)]`) was used by a player. /// `item` is the item guid, `user` the player. upstream Eluna: `ITEM_EVENT_ON_USE`. /// Default: no-op. fn on_item_use(&mut self, item: u64, user: u64) { let _ = (item, user); }
/// A spell this plugin registered (via `#[plugin(spell = <id>)]`) was cast. `caster` is the /// casting unit, `spell` the spell id. upstream Eluna: `SPELL_EVENT_ON_CAST` (keyed by spell id; /// distinct from the player-event `on_spell_cast`). Default: no-op. fn on_cast_spell(&mut self, caster: u64, spell: u32) { let _ = (caster, spell); }
/// A spell this plugin registered (by id) landed on a target. `caster` is the casting unit, /// `target` the struck unit, `spell` the spell id. upstream Eluna: `SPELL_EVENT_ON_HIT`. /// Default: no-op. fn on_hit_spell(&mut self, caster: u64, target: u64, spell: u32) { let _ = (caster, target, spell); }
/// An aura from a spell this plugin registered (by id) was applied to a target. `caster` is the /// applying unit, `target` the unit gaining the aura, `spell` the spell id. upstream Eluna: /// `SPELL_EVENT_ON_AURA_APPLICATION`. Default: no-op. fn on_aura_application_spell(&mut self, caster: u64, target: u64, spell: u32) { let _ = (caster, target, spell); }
/// A periodic aura from a spell this plugin registered (by id) ticked. `holder` carries the /// aura, `caster` is the aura's caster, `spell` the spell id. upstream Eluna: /// `SPELL_EVENT_ON_PERIODIC_TICK`. Default: no-op. fn on_periodic_tick_spell(&mut self, holder: u64, caster: u64, spell: u32) { let _ = (holder, caster, spell); }
/// A proc aura from a spell this plugin registered (by id) fired. `proccer` carries the proc /// aura, `target` is the counterparty, `spell` the proc aura's spell id. upstream Eluna: /// `SPELL_EVENT_ON_PROC`. Default: no-op. fn on_proc_spell(&mut self, proccer: u64, target: u64, spell: u32) { let _ = (proccer, target, spell); }
/// A proc aura from a spell this plugin registered (by id) applied one of its effects to a /// target. `caster` is the caster, `target` the struck unit, `spell` the spell id, /// `effect_index` the 0-based effect slot. upstream Eluna: `SPELL_EVENT_ON_EFFECT_HIT_TARGET`. /// Default: no-op. fn on_effect_hit_target_spell( &mut self, caster: u64, target: u64, spell: u32, effect_index: u32, ) { let _ = (caster, target, spell, effect_index); }
/// An item this plugin registered (by entry) was equipped (moved into an equipment slot). /// `item` is the item guid, `player` the wearer, `slot` the equipment slot. upstream Eluna: /// `ITEM_EVENT_ON_EQUIP`. Default: no-op. fn on_item_equip(&mut self, item: u64, player: u64, slot: u32) { let _ = (item, player, slot); }
/// An item this plugin registered (by entry) was unequipped (moved out of an equipment slot). /// `item` is the item guid, `player` the wearer, `slot` the equipment slot it left. upstream /// Eluna: `ITEM_EVENT_ON_UNEQUIP`. Default: no-op. fn on_item_unequip(&mut self, item: u64, player: u64, slot: u32) { let _ = (item, player, slot); }
/// A time-limited item this plugin registered (by entry) reached its duration and was destroyed. /// `item` is the item guid, `owner` the holding player. upstream Eluna: `ITEM_EVENT_ON_EXPIRE`. /// Default: no-op. fn on_item_expire(&mut self, item: u64, owner: u64) { let _ = (item, owner); }
/// An item this plugin registered (by entry) was removed from a player's bags (a full destroy /// through the destroy chokepoint). `item` is the item guid, `owner` the player. upstream Eluna: /// `ITEM_EVENT_ON_REMOVE`. Default: no-op. fn on_item_remove(&mut self, item: u64, owner: u64) { let _ = (item, owner); }
/// The player started casting `spell` (any cast: instant, timed, or item). upstream Eluna: /// `PLAYER_EVENT_ON_SPELL_CAST`. Default: no-op. fn on_spell_cast(&mut self, ctx: &mut EventCtx, spell: u32) { let _ = (ctx, spell); }
/// The player is about to be awarded `amount` experience from `source`. **Return the amount to /// grant** — return `amount` unchanged for no effect. /// /// Several plugins implementing this CHAIN in load order: each sees the previous one's result, so /// two plugins that each double an award produce four times the base rather than one quietly /// winning. `amount` already carries the server's `Rate.XP.*`; the rested bonus is drawn from /// what you return, and a hunter pet's share derives from it, so both follow your change. /// /// upstream Eluna: `PLAYER_EVENT_ON_GIVE_XP` (its amount-returning form). Default: `amount`. fn on_give_xp(&mut self, ctx: &mut EventCtx, amount: u32, source: XpSource) -> u32 { let _ = (ctx, source); amount }
/// The player is about to be paid `amount` copper by `source`. **Return the amount to pay.** /// Chains in load order. /// /// Only rewards are routed here — a vendor purchase, a repair, a completed trade and coin taken /// out of a mail are not, so you cannot accidentally change what a player spends or already had. /// /// upstream Eluna: `PLAYER_EVENT_ON_MONEY_CHANGE` (its amount-returning form). Default: `amount`. fn on_modify_money(&mut self, ctx: &mut EventCtx, amount: u32, source: MoneySource) -> u32 { let _ = (ctx, source); amount }
/// A skill-up for `skill` succeeded and is worth `gain` points. **Return the points to apply** — /// `0` swallows the skill-up; the core still clamps the result to the skill's current maximum. /// /// This fires only on a *successful* roll, so it scales what a skill-up is worth, not how often /// one happens. Default: `gain`. fn on_modify_skill_gain( &mut self, ctx: &mut EventCtx, skill: u32, gain: u32, source: SkillSource, ) -> u32 { let _ = (ctx, skill, source); gain }
/// `delta` standing is about to be applied to `faction`, before it spills over to related /// factions. **Return the delta to apply.** Chains in load order. /// /// Distinct from [`Script::on_reputation_change`], which reports the new total after the fact. /// An absolute set (a GM's `.modify rep`, your own `set_reputations`) never reaches this hook. /// /// upstream Eluna: `PLAYER_EVENT_ON_REPUTATION_CHANGE` (its amount-returning form). /// Default: `delta`. fn on_modify_reputation( &mut self, ctx: &mut EventCtx, faction: u32, delta: i32, source: ReputationSource, ) -> i32 { let _ = (ctx, faction, source); delta }
/// `honor` contribution points are about to be awarded. **Return the amount to award.** Chains in /// load order. Default: `honor`. fn on_modify_honor(&mut self, ctx: &mut EventCtx, honor: f32, source: HonorSource) -> f32 { let _ = (ctx, source); honor }
/// The player died. `killer` is the unit that landed the blow (`0` for an environmental death) /// and `killer_name` its name (empty if unknown). /// /// Fires once per death, on the live-to-dead transition only — a corpse taking further damage /// raises nothing. The player is dead but has not released their spirit yet. Default: no-op. fn on_death(&mut self, ctx: &mut EventCtx, killer: u64, killer_name: &str, cause: DeathCause) { let _ = (ctx, killer, killer_name, cause); }
/// Gate on a trade between this player and `partner`. Return `false` to refuse. /// /// Fired for **both** participants — once per side when the window opens, and again on the Accept /// click — so refusing for one character blocks the trade whichever side opened it, and a trade /// opened before your state changed cannot still complete. Default: `true` (allow). fn on_can_trade(&mut self, ctx: &mut EventCtx, partner: u64, stage: TradeStage) -> bool { let _ = (ctx, partner, stage); true }
/// Gate before a mail is validated and posted. Return `false` to refuse. /// /// `receiver_guid` is the resolved recipient (`0` if no such character), so you can refuse by /// either party's state; `money` and `item` are the attachments (`item` is `0` when there is /// none), so a plain letter can be let through. Fires *before* the point of no return, unlike /// [`Script::on_send_mail`], which only reports a send that already happened. /// /// Default: `true` (allow). fn on_can_send_mail( &mut self, ctx: &mut EventCtx, receiver: &str, receiver_guid: u64, money: u32, item: u32, ) -> bool { let _ = (ctx, receiver, receiver_guid, money, item); true }
/// Gate before the player takes an attachment out of a mail. Return `false` to leave it in the /// mailbox. /// /// The companion to [`Script::on_can_send_mail`]: gating only the send would let anyone hand an /// item to a character whose rules forbid receiving one. `sender_guid` is `0` for server mail. /// Default: `true` (allow). fn on_can_take_mail_item(&mut self, ctx: &mut EventCtx, sender_guid: u64, item: u32) -> bool { let _ = (ctx, sender_guid, item); true }
/// Gate on an auction-house interaction. Return `false` to refuse `action`. /// /// Every action is gated separately, not just opening the window: a modified client can send a /// sell or a bid without ever asking for one. Default: `true` (allow). fn on_can_auction(&mut self, ctx: &mut EventCtx, action: AuctionAction) -> bool { let _ = (ctx, action); true }
/// Gate before the player returns to life by `method`. Return `false` to leave them dead. /// /// One refusal covers every route back: the spirit healer, reclaiming a corpse, another player's /// Resurrection, a soulstone, a battleground spirit guide, a dungeon portal, and a GM's /// `.revive`. Releasing the spirit to a graveyard is *not* a resurrect and is never gated, so a /// refused player still becomes a ghost. Default: `true` (allow). fn on_can_resurrect(&mut self, ctx: &mut EventCtx, method: ResurrectMethod) -> bool { let _ = (ctx, method); true }
/// The player's client sent an addon frame: `prefix` and `body` are the two halves of the /// client's `"PREFIX\tBODY"`, split on the first tab. Return `false` to **consume** it, so the /// core does not also route it as ordinary chat. /// /// Only frames on the addon language reach this hook. Default: `true` (not ours — keep routing). fn on_addon_message( &mut self, ctx: &mut EventCtx, prefix: &str, body: &str, channel: AddonChannel, ) -> bool { let _ = (ctx, prefix, body, channel); true }
/// The player died to environmental damage (fall, lava, slime, drowning, …). upstream Eluna: /// `PLAYER_EVENT_ON_ENVIRONMENTAL_DEATH`. Default: no-op. fn on_environmental_death(&mut self, ctx: &mut EventCtx) { let _ = ctx; }
/// The map ticked; `diff` is the elapsed milliseconds since the last tick. A broadcast server /// event with no subject (fires once per map per tick). upstream Eluna: /// `SERVER_EVENT_ON_UPDATE`. Default: no-op. fn on_world_update(&mut self, diff: u32) { let _ = diff; }
/// A map task started: `map` is the map id, `instance` the instance id (0 for a continent). /// A broadcast server event with no subject (fires once, after the map's spawns load, before /// its first tick). upstream Eluna: `MAP_EVENT_ON_CREATE`. Default: no-op. fn on_map_create(&mut self, map: u32, instance: u32) { let _ = (map, instance); }
/// A map task is shutting down (all handles dropped): `map` is the map id, `instance` the /// instance id. A broadcast server event with no subject (fires once, after the final tick). /// upstream Eluna: `MAP_EVENT_ON_DESTROY`. Default: no-op. fn on_map_destroy(&mut self, map: u32, instance: u32) { let _ = (map, instance); }
/// A new character was created at character-select. `guid` is the new character's guid, /// `account` the owning account, `name` the name, `race`/`class`/`gender` the basics. A /// world-scoped event (no map, no live player), fired from the dedicated world plugin host. /// upstream Eluna: `PLAYER_EVENT_ON_CHARACTER_CREATE`. Default: no-op. fn on_character_create( &mut self, guid: u64, account: u32, name: String, race: u8, class: u8, gender: u8, ) { let _ = (guid, account, name, race, class, gender); }
/// A character was deleted at character-select. `guid` is the deleted character's guid, /// `account` the owning account. A world-scoped event (no map, no live player), fired from the /// dedicated world plugin host. upstream Eluna: `PLAYER_EVENT_ON_CHARACTER_DELETE`. Default: /// no-op. fn on_character_delete(&mut self, guid: u64, account: u32) { let _ = (guid, account); }
/// The server configuration was loaded. `reload` is `false` on the initial startup load (this /// server has no runtime reload, so it always fires once with `false`). A world-scoped event /// from the world plugin host. upstream Eluna: `SERVER_EVENT_ON_CONFIG_LOAD`. Default: no-op. fn on_config_load(&mut self, reload: bool) { let _ = reload; }
/// The world is up and accepting connections (fires once at startup). A world-scoped event from /// the world plugin host. upstream Eluna: `SERVER_EVENT_ON_STARTUP`. Default: no-op. fn on_world_startup(&mut self) {}
/// The server is shutting down (fires once, best-effort, before the listeners drain). A /// world-scoped event from the world plugin host. upstream Eluna: `SERVER_EVENT_ON_SHUTDOWN`. /// Default: no-op. fn on_world_shutdown(&mut self) {}
/// A battleground match went live (warmup ended, doors opened). `map` is the battleground map /// id, `instance` the match instance. upstream Eluna: `BG_EVENT_ON_START`. Default: no-op. fn on_bg_start(&mut self, map: u32, instance: u32) { let _ = (map, instance); }
/// A battleground match ended. `map` is the battleground map id, `instance` the match instance, /// `winner` the winning team (0 = Alliance, 1 = Horde). upstream Eluna: `BG_EVENT_ON_END`. /// Default: no-op. fn on_bg_end(&mut self, map: u32, instance: u32, winner: u8) { let _ = (map, instance, winner); }
/// The weather in a zone changed. `zone` is the area id, `weather_type` the kind (0 fine, 1 /// rain, 2 snow, 3 storm), `grade` the intensity. upstream Eluna: `SERVER_EVENT_ON_WEATHER_CHANGE`. /// Default: no-op. fn on_weather_change(&mut self, zone: u32, weather_type: u32, grade: f32) { let _ = (zone, weather_type, grade); }
/// A game event was activated. `event` is the game-event id. upstream Eluna: /// `SERVER_EVENT_ON_GAME_EVENT_START`. Default: no-op. fn on_game_event_start(&mut self, event: u32) { let _ = event; }
/// A game event was deactivated. `event` is the game-event id. upstream Eluna: /// `SERVER_EVENT_ON_GAME_EVENT_STOP`. Default: no-op. fn on_game_event_stop(&mut self, event: u32) { let _ = event; }
/// A player entered an area-trigger volume. `player` is the player guid, `trigger` the /// AreaTrigger.dbc id. upstream Eluna: the area-trigger server hook. Default: no-op. fn on_area_trigger(&mut self, player: u64, trigger: u32) { let _ = (player, trigger); }
/// A guild was created. `guild` is its id, `leader` the founder, `name` the guild name. A /// world-scoped event from the world plugin host. upstream Eluna: `GUILD_EVENT_ON_CREATE`. /// Default: no-op. fn on_guild_create(&mut self, guild: u32, leader: u64, name: String) { let _ = (guild, leader, name); }
/// A player joined a guild. `guild` is the guild id, `player` the new member. upstream Eluna: /// `GUILD_EVENT_ON_ADD_MEMBER`. Default: no-op. fn on_guild_add_member(&mut self, guild: u32, player: u64) { let _ = (guild, player); }
/// A player left or was removed from a guild. `guild` is the guild id, `player` the member. /// upstream Eluna: `GUILD_EVENT_ON_REMOVE_MEMBER`. Default: no-op. fn on_guild_remove_member(&mut self, guild: u32, player: u64) { let _ = (guild, player); }
/// A guild was disbanded. `guild` is the (now gone) guild id. upstream Eluna: /// `GUILD_EVENT_ON_DISBAND`. Default: no-op. fn on_guild_disband(&mut self, guild: u32) { let _ = guild; }
/// A group (party/raid) was formed. `group` is its id, `leader` the leader. upstream Eluna: /// `GROUP_EVENT_ON_CREATE`. Default: no-op. fn on_group_create(&mut self, group: u32, leader: u64) { let _ = (group, leader); }
/// A player joined a group. `group` is the group id, `player` the new member. upstream Eluna: /// `GROUP_EVENT_ON_MEMBER_ADD`. Default: no-op. fn on_group_member_add(&mut self, group: u32, player: u64) { let _ = (group, player); }
/// A player left or was removed from a group. `group` is the group id, `player` the member. /// upstream Eluna: `GROUP_EVENT_ON_MEMBER_REMOVE`. Default: no-op. fn on_group_member_remove(&mut self, group: u32, player: u64) { let _ = (group, player); }
/// A group was disbanded (dropped below two members). `group` is the (now gone) group id. /// upstream Eluna: `GROUP_EVENT_ON_DISBAND`. Default: no-op. fn on_group_disband(&mut self, group: u32) { let _ = group; }
/// A new auction was listed. `auction` is the id, `owner` the seller, `item` the item entry, /// `start_bid`/`buyout` the prices. A world-scoped event from the world plugin host. upstream /// Eluna: `SERVER_EVENT_ON_AUCTION_ADD`. Default: no-op. fn on_auction_add(&mut self, auction: u32, owner: u64, item: u32, start_bid: u32, buyout: u32) { let _ = (auction, owner, item, start_bid, buyout); }
/// An auction was cancelled by its owner. upstream Eluna: `SERVER_EVENT_ON_AUCTION_REMOVE`. /// Default: no-op. fn on_auction_remove(&mut self, auction: u32, owner: u64, item: u32) { let _ = (auction, owner, item); }
/// An auction sold (buyout or a winning bid at expiry). `bidder` is the winner, `price` the /// winning amount. upstream Eluna: `SERVER_EVENT_ON_AUCTION_SUCCESSFUL`. Default: no-op. fn on_auction_successful( &mut self, auction: u32, owner: u64, bidder: u64, item: u32, price: u32, ) { let _ = (auction, owner, bidder, item, price); }
/// An auction expired with no buyer. upstream Eluna: `SERVER_EVENT_ON_AUCTION_EXPIRE`. Default: /// no-op. fn on_auction_expire(&mut self, auction: u32, owner: u64, item: u32) { let _ = (auction, owner, item); }
/// The player learned `spell` (from a trainer). upstream Eluna: `PLAYER_EVENT_ON_LEARN_SPELL`. /// Return `false` to suppress the core default. Default: `true`. fn on_learn_spell(&mut self, ctx: &mut EventCtx, spell: u32) -> bool { let _ = (ctx, spell); true }
/// The player opened a gossip menu this plugin owns. Default: no-op. fn on_gossip_hello(&mut self, ctx: &mut GossipCtx) { let _ = ctx; }
/// The player selected a gossip row. `sender`/`action` identify the row; `code` is the typed /// input for a code-box row. Default: no-op. fn on_gossip_select( &mut self, ctx: &mut GossipCtx, sender: u32, action: u32, code: Option<String>, ) { let _ = (ctx, sender, action, code); }}