Module SpellMessages

Send messages to warn the party about party utilities being used.

Functions

PrepareSendChatMessage (message) Prepare the message to be sent to the relevent chat channel.
SpellMessage:new (spellId, itemId, sentMsg, startedMsg, interruptedMsg, stoppedMsg, succeededMsg, plural, target, group) Creates a new spell message object with the given parameters.
SpellMessage:soulstoneMessage (msgType, isAlive) Generates a message based on the given `msgType` and `isAlive` parameters.
SpellMessage:buildString (prefix, key) Builds a message based on the given `prefix` and `key` parameters as well as the fields of the object.
SpellMessage:queueMessages () Queues the messages to be sent to the chat channel.
SpellMessage:dequeueMessages () Dequeues the messages from the message queue.
PlayerCastSent (unit, spellId) This function is called when a player casts a spell and the cast is sent to the server.
PlayerCastInterrupted (unit, spellId) This function is called when a player casts a spell and the cast is interrupted.
PlayerCastSucceeded (unit, spellId) This function is called when a player casts a spell and the cast is successful.
NpcCastStart (unit, spellId) This function is called when an NPC casts a spell and the cast is started.
NpcCastSucceeded (unit, spellId) This function is called when an NPC casts a spell and the cast is successful.
SummonedGuardian (...) This function is called when an NPC casts a spell and the cast is interrupted.
InterruptedSpellCast (...) This function is called when an NPC casts a spell and the cast is interrupted.

Tables

spellMessageDb This table, `spellMessageDb`, stores the spell messages for various spells.


Functions

PrepareSendChatMessage (message)
Prepare the message to be sent to the relevent chat channel.

Parameters:

  • message (string) -- message to be sent

Usage:

    `SpellMessages:PrepareSendChatMessage("Hello, World!")`
SpellMessage:new (spellId, itemId, sentMsg, startedMsg, interruptedMsg, stoppedMsg, succeededMsg, plural, target, group)
Creates a new spell message object with the given parameters.

Parameters:

  • spellId number -- The ID of the spell associated with the message.
  • itemId number|boolean -- The ID of the item associated with the message. If no item is associated with the message, set this to `false`.
  • sentMsg string -- The message to be displayed when the spell is sent.
  • startedMsg string -- The message to be displayed when the spell is started.
  • interruptedMsg string -- The message to be displayed when the spell is interrupted.
  • stoppedMsg string -- The message to be displayed when the spell is stopped.
  • succeededMsg string -- The message to be displayed when the spell is successful.
  • plural boolean|nil -- (optional) Indicates whether the message should be pluralized.
  • target boolean|nil -- (optional) Indicates whether the message should include the target's name.
  • group boolean|nil -- (optional) Indicates whether the message should include the group's name.

Returns:

    table -- The new spell message object.

Usage:

    `SpellMessage(6201, 5512, "Making", "", "make", "", "made", true, false, true)` Note it is intended that empty strings will not generate a message.
SpellMessage:soulstoneMessage (msgType, isAlive)
Generates a message based on the given `msgType` and `isAlive` parameters.

Parameters:

  • msgType string The type of message. Defaults to "INTERRUPTED" if not provided.
  • isAlive boolean Indicates whether the player is alive. Defaults to `false` if not provided.

Returns:

    string The generated message based on the `msgType` and `isAlive` parameters.

Usage:

    `soulstoneMessage(key, isAlive)` Intended to be used in the `buildString` function of a `newSpellMessage` object.
SpellMessage:buildString (prefix, key)
Builds a message based on the given `prefix` and `key` parameters as well as the fields of the object.

Parameters:

  • prefix (string) -- The prefix to be used in the message.
  • key (string) -- The key to be used to retrieve the message from the `messages` table.

Returns:

    (string | nil) -- The generated message based on the `prefix` and `key` parameters. Returns `nil` if the message is empty.

Usage:

    `self:buildString(prefix, key)` Intended to be used in the `queueMessages` function of a `newSpellMessage` object.
SpellMessage:queueMessages ()
Queues the messages to be sent to the chat channel.

Usage:

    `self:queueMessages()` Intended to be used when a cast starts.
SpellMessage:dequeueMessages ()
Dequeues the messages from the message queue.

Usage:

    `self:dequeueMessages()` Intended to be used when the spell cast is interrupted or successful.
PlayerCastSent (unit, spellId)
This function is called when a player casts a spell and the cast is sent to the server. It retrieves the spell message associated with the spell ID and queues the messages. It then prepares and sends a chat message using the prepared message queue.

Parameters:

  • unit string The unit that casted the spell.
  • spellId number The ID of the spell that was casted.

Usage:

    `SpellMessages:PlayerCastSent("player", 12345)`
PlayerCastInterrupted (unit, spellId)
This function is called when a player casts a spell and the cast is interrupted. It retrieves the spell message associated with the spell ID and dequeues the messages. It then prepares and sends a chat message using the prepared message queue.

Parameters:

  • unit string The unit that casted the spell.
  • spellId number The ID of the spell that was casted.

Usage:

    `SpellMessages:PlayerCastInterrupted("player", 12345)`
PlayerCastSucceeded (unit, spellId)
This function is called when a player casts a spell and the cast is successful. It retrieves the spell message associated with the spell ID and dequeues the messages. It then prepares and sends a chat message using the prepared message queue.

Parameters:

  • unit string The unit that casted the spell.
  • spellId number The ID of the spell that was casted.

Usage:

    SpellMessages:PlayerCastSucceeded("player", 12345)
NpcCastStart (unit, spellId)
This function is called when an NPC casts a spell and the cast is started. It retrieves the spell message associated with the spell ID and queues the messages. It then prepares and sends a chat message using the prepared message queue.

Parameters:

  • unit any -- The unit that casted the spell.
  • spellId any -- The ID of the spell that was casted.
NpcCastSucceeded (unit, spellId)
This function is called when an NPC casts a spell and the cast is successful. It retrieves the spell message associated with the spell ID and dequeues the messages. It then prepares and sends a chat message using the prepared message queue.

Parameters:

  • unit string -- The unit that casted the spell.
  • spellId integer -- The ID of the spell that was casted.

Usage:

    `SpellMessages:NpcCastSucceeded("target", _, 12345)`
SummonedGuardian (...)
This function is called when an NPC casts a spell and the cast is interrupted. It retrieves the spell message associated with the spell ID and dequeues the messages. It then prepares and sends a chat message using the prepared message queue.

Parameters:

  • ... any -- The arguments passed to the function.

Usage:

    `SpellMessages:NpcCastInterrupted(...)`
InterruptedSpellCast (...)
This function is called when an NPC casts a spell and the cast is interrupted. It retrieves the spell message associated with the spell ID and dequeues the messages. It then prepares and sends a chat message using the prepared message queue.

Parameters:

  • ... any -- The arguments passed to the function.

Usage:

    `SpellMessages:InterruptedSpellCast(...)`

Tables

spellMessageDb
This table, `spellMessageDb`, stores the spell messages for various spells. Each entry in the table represents a spell and its associated messages. The key of each entry is the spellId, and the value is an instance of the newSpellMessage function. The newSpellMessage function takes several parameters to define the spell message entry. The messages can be customized for different spells and items. The messages are used to display information to the player when certain events related to the spell occur. The messages can be queued in the messageQueue using the queueMessages function. The dynamic data, such as the target's state, is added in the buildString function of the object.

Fields:

  • -- [6201] = SpellMessage(6201, 5512, "Making", "", "make", "", "made", true, false, true), -- Create Healthstone, Healthstone Reaves Module Create Soulwell, Healthstone
  • [698] Ritual of Summoning, No Item
  • [20707] Soulstone, No Item => messages are decided in spellMessageToString
  • [187748] Brazier of Awakening, Brazier of Awakening
  • [67826] Jeeves, Jeeves
  • [256153] Deployable Attire Rearranger, Deployable Attire Rearranger
  • [384908] Portable Tinker's Workbench, Portable Tinker's Workbench
  • [299127] Encrypted Black Market Radio, Encrypted Black Market Radio
  • [126459] Blingtron 4000, Blingtron 4000
  • [161414] Blingtron 5000, Blingtron 5000
  • [200218] Blingtron 6000, No Item
  • [298926] Blingtron 7000, Blingtron 7000
  • [200205] Repair Mode, Auto-Hammer

Returns:

    Example entries
generated by LDoc 1.5.0 Last updated 2024-09-08 12:01:35