From aad24ca1e47ce5b2ebfdab2a1d92df151a0a332e Mon Sep 17 00:00:00 2001 From: Emagi Date: Tue, 6 May 2025 12:21:14 -0400 Subject: [PATCH] Some of the LUA functions doc completed --- docs/lua_functions/AddCharacterTitle.md | 15 +++--- docs/lua_functions/AddCoin.md | 15 +++--- docs/lua_functions/AddControlEffect.md | 22 ++++----- docs/lua_functions/AddConversationOption.md | 26 ++++++++-- docs/lua_functions/AddHate.md | 17 ++++--- docs/lua_functions/AddIconValue.md | 13 +++-- docs/lua_functions/AddImmunitySpell.md | 19 ++++---- docs/lua_functions/AddItem.md | 16 +++---- docs/lua_functions/AddLanguage.md | 17 +++---- docs/lua_functions/AddLootCoin.md | 12 ++--- docs/lua_functions/AddLootItem.md | 14 +++--- docs/lua_functions/AddMasterTitle.md | 14 +++--- docs/lua_functions/AddMultiFloorLift.md | 12 ++--- docs/lua_functions/AddOptionWindowOption.md | 47 ++++++++++++++----- docs/lua_functions/AddPlayerMail.md | 37 +++++++-------- docs/lua_functions/AddPlayerMailByCharID.md | 36 +++++++------- docs/lua_functions/AddPrimaryEntityCommand.md | 35 +++++++++----- .../AddPrimaryEntityCommandAllSpawns.md | 37 +++++++++------ docs/lua_functions/AddProc.md | 33 ++++++++----- docs/lua_functions/AddProcExt.md | 45 +++++++++++------- 20 files changed, 275 insertions(+), 207 deletions(-) diff --git a/docs/lua_functions/AddCharacterTitle.md b/docs/lua_functions/AddCharacterTitle.md index 52c7bf9..c1027f6 100644 --- a/docs/lua_functions/AddCharacterTitle.md +++ b/docs/lua_functions/AddCharacterTitle.md @@ -1,20 +1,17 @@ -### Function: AddCharacterTitle(param1, param2, param3, param4, param5) +### Function: AddCharacterTitle(Spawn, TitleName) **Description:** -Placeholder description. +Provides the Spawn (Player Character) a new title they can apply from their Profile. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: unknown - Unknown type. -- `param5`: string - String value. +- `Player`: Spawn - The Spawn (Player only) to provide the new title. +- `TitleName`: String - Title to set to the Spawn. -**Returns:** None. +**Returns:** SInt32 -1 if invalid, otherwise provides Title database ID. **Example:** ```lua -- Example usage -AddCharacterTitle(..., ..., ..., ..., ...) +AddCharacterTitle(Player, "My New Title!") ``` diff --git a/docs/lua_functions/AddCoin.md b/docs/lua_functions/AddCoin.md index aaf821e..2abd819 100644 --- a/docs/lua_functions/AddCoin.md +++ b/docs/lua_functions/AddCoin.md @@ -1,20 +1,17 @@ -### Function: AddCoin(param1, param2, param3, param4, param5) +### Function: AddCoin(Player, Amount) **Description:** -Placeholder description. +Provide the Amount of coin provided in copper which will translate the value into copper, silver, gold, platinum respectively to the Player. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: unknown - Unknown type. -- `param5`: int32 - Integer value. +- `Player`: Spawn - The Spawn (Player) to provide the coin. +- `Amount`: UInt32 - Amount in copper to provide Player. **Returns:** None. **Example:** ```lua --- Example usage -AddCoin(..., ..., ..., ..., ...) +-- Example usage, provide 5 copper to Player. 50 copper = 5 silver, 500 copper = 5 gold, 5000 copper = 5 platinum. +AddCoin(Player, 5) ``` diff --git a/docs/lua_functions/AddControlEffect.md b/docs/lua_functions/AddControlEffect.md index 8bb4df6..6acb036 100644 --- a/docs/lua_functions/AddControlEffect.md +++ b/docs/lua_functions/AddControlEffect.md @@ -1,23 +1,21 @@ -### Function: AddControlEffect(param1, param2, param3, param4, param5, param6, param7, param8) +### Function: AddControlEffect(Spawn, Type, OnlyAddSpawn) **Description:** -Placeholder description. +Apply a Control Effect to a Spawn, this includes Mesmerize, Stun, Root, so on. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: unknown - Unknown type. -- `param5`: unknown - Unknown type. -- `param6`: unknown - Unknown type. -- `param7`: int32 - Integer value. -- `param8`: int8 - Small integer or boolean flag. +- `Spawn`: Spawn - The spawn or entity involved. +- `Type`: UInt8 - Control Effect Type +- `OnlyAddSpawn`: Boolean (Optional) - False by default, set to True will only apply Control Effect to Spawn. Otherwise if Spell all Spawn Targets will apply control effect. **Returns:** None. +**Notes:** +- See CONTROL_EFFECT_TYPE defines for more details. + **Example:** ```lua --- Example usage -AddControlEffect(..., ..., ..., ..., ..., ..., ..., ...) +-- Example usage: Will apply Control Effect to Spawn, or if in a Spell Script all Spell Targets, Type 1 is Mesmerize. +AddControlEffect(Spawn, 1) ``` diff --git a/docs/lua_functions/AddConversationOption.md b/docs/lua_functions/AddConversationOption.md index 2f4d4a6..7089e64 100644 --- a/docs/lua_functions/AddConversationOption.md +++ b/docs/lua_functions/AddConversationOption.md @@ -4,15 +4,33 @@ Placeholder description. **Parameters:** -- `param1`: ConversationOption[] - List of conversation options. -- `param2`: string - String value. -- `param3`: string - String value. +- `param1`: ConversationOption - Conversation Option object to apply the new text and function call. +- `Message`: string - String value option to display the player when StartConversation is called. +- `FunctionName`: string - Function name that will be called if Player selects the option. **Returns:** None. +**Notes:** +- Must call CreateConversation() to instantiate the ConversationOption object before AddConversationOption can be used. + **Example:** ```lua -- Example usage -AddConversationOption(..., ..., ...) + +function hailed(NPC, Spawn) + FaceTarget(NPC, Spawn) + conversation = CreateConversation() + AddConversationOption(conversation, "Yes!", "yes_cookie") + AddConversationOption(conversation, "No!", "no_cookie") + StartConversation(conversation, NPC, Spawn, "Greetings traveler, would you like a cookie today?") +end + +function yes_cookie(NPC, Spawn) + -- do whatever you like to give the player a cookie! +end + +function no_cookie(NPC, Spawn) + -- do whatever you like to scorn them for rejecting your cookie! +end ``` diff --git a/docs/lua_functions/AddHate.md b/docs/lua_functions/AddHate.md index ef75d65..f9e64d0 100644 --- a/docs/lua_functions/AddHate.md +++ b/docs/lua_functions/AddHate.md @@ -1,20 +1,19 @@ -### Function: AddHate(param1, param2, param3, param4, param5) +### Function: AddHate(Spawn, NPC, Amount, SendPacket) **Description:** -Placeholder description. +Add or Remove hate from a Spawn or Spell Targets if in a LUA Spell. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: Spawn - The spawn or entity involved. -- `param4`: unknown - Unknown type. -- `param5`: int8 - Small integer or boolean flag. +- `Spawn`: Spawn - The target involved for the hate to be added. +- `NPC`: Spawn - NPC related to the hate list we want to update. +- `Amount`: SInt32 - The amount of hate to add or subtract (negative to remove hate). +- `SendPacket`: UInt8 - Default is false, if set to 1 then we will send the threat packet to the client if in a lua spell. **Returns:** None. **Example:** ```lua --- Example usage -AddHate(..., ..., ..., ..., ...) +-- Example usage: Adds 100 hate to the Spawn on the NPC's hate list. +AddHate(Spawn, NPC, 100) ``` diff --git a/docs/lua_functions/AddIconValue.md b/docs/lua_functions/AddIconValue.md index 7a55669..8e928e3 100644 --- a/docs/lua_functions/AddIconValue.md +++ b/docs/lua_functions/AddIconValue.md @@ -1,18 +1,17 @@ -### Function: AddIconValue(param1, param2, param3) +### Function: AddIconValue(Spawn, Value) **Description:** -Placeholder description. +Add an icon value to the Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: int32 - Integer value. +- `Spawn`: Spawn - The spawn or entity involved. +- `Value`: UInt32 - icon value to be added. -**Returns:** None. +**Returns:** Boolean: True if successful, otherwise False.. **Example:** ```lua -- Example usage -AddIconValue(..., ..., ...) +AddIconValue(Spawn, Value) ``` diff --git a/docs/lua_functions/AddImmunitySpell.md b/docs/lua_functions/AddImmunitySpell.md index d48d0f5..33c676c 100644 --- a/docs/lua_functions/AddImmunitySpell.md +++ b/docs/lua_functions/AddImmunitySpell.md @@ -1,20 +1,21 @@ -### Function: AddImmunitySpell(param1, param2, param3, param4, param5) +### Function: AddImmunitySpell(ImmunityType, Spawn) **Description:** -Placeholder description. +Add an Immunity to the Spawn by the Immunity Type. **Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: int8 - Small integer or boolean flag. -- `param3`: unknown - Unknown type. -- `param4`: unknown - Unknown type. -- `param5`: Spawn - The spawn or entity involved. +- `ImmunityType`: UInt8 - Immunity Type to add. +- `Spawn`: Spawn - Spawn to apply immunity. **Returns:** None. +**Notes:** +- See IMMUNITY_TYPE defines for more details. +- If Spawn is specified only the Spawn receives the Immunity, otherwise if it is in a Spell Script we will apply to all Spell Targets. + **Example:** ```lua --- Example usage -AddImmunitySpell(..., ..., ..., ..., ...) +-- Example usage: Immunity Type 7 makes NPC immune to AOE spells. +AddImmunitySpell(7, NPC) ``` diff --git a/docs/lua_functions/AddItem.md b/docs/lua_functions/AddItem.md index f8bff70..16dbd95 100644 --- a/docs/lua_functions/AddItem.md +++ b/docs/lua_functions/AddItem.md @@ -1,18 +1,18 @@ -### Function: AddItem(param1, param2, param3) +### Function: AddItem(Spawn, ItemID, Quantity) **Description:** -Placeholder description. +Add an Item to a Spawn/Player with the defined Item ID and Quantity. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. -- `param3`: int32 - Integer value. +- `Spawn`: Spawn - The spawn or entity involved. +- `ItemID`: UInt32 - Item id to assign to Spawn. +- `Quantity`: UInt32 - Quantity of item to assign to Spawn (default 1). -**Returns:** None. +**Returns:** Boolean: True if successfully assigned the item, otherwise return's False. **Example:** ```lua --- Example usage -AddItem(..., ..., ...) +-- Example usage: Assigns Spawn the ItemID 1696 (a fishman scale amulet) with Quantity of 1. +AddItem(Spawn, 1696) ``` diff --git a/docs/lua_functions/AddLanguage.md b/docs/lua_functions/AddLanguage.md index 3cda12b..56a2293 100644 --- a/docs/lua_functions/AddLanguage.md +++ b/docs/lua_functions/AddLanguage.md @@ -1,19 +1,20 @@ -### Function: AddLanguage(param1, param2, param3, param4) +### Function: AddLanguage(Player, LanguageID) **Description:** -Placeholder description. +Add a Language to a Player by the Language ID in the Database (within the languages table). **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: int32 - Integer value. +- `Player`: Spawn - The spawn or entity involved. +- `LanguageID`: int32 - Integer value. **Returns:** None. +**Notes:** +- See the languages table for the LanguageID. + **Example:** ```lua --- Example usage -AddLanguage(..., ..., ..., ...) +-- Example usage: Adds Halasian Language (1) to Player. +AddLanguage(Player, 1) ``` diff --git a/docs/lua_functions/AddLootCoin.md b/docs/lua_functions/AddLootCoin.md index c3a7cd4..cda535e 100644 --- a/docs/lua_functions/AddLootCoin.md +++ b/docs/lua_functions/AddLootCoin.md @@ -1,17 +1,17 @@ -### Function: AddLootCoin(param1, param2) +### Function: AddLootCoin(Spawn, Amount) **Description:** -Placeholder description. +Adds coin to the Spawn's loot table for the current instance when they die. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. +- `Spawn`: Spawn - The spawn or entity to add loot coin. +- `Amount`: int32 - Amount in copper. **Returns:** None. **Example:** ```lua --- Example usage -AddLootCoin(..., ...) +-- Example usage: Add 50 copper to Spawn's loot table for when it dies. +AddLootCoin(Spawn, 50) ``` diff --git a/docs/lua_functions/AddLootItem.md b/docs/lua_functions/AddLootItem.md index 0a6affe..b61806c 100644 --- a/docs/lua_functions/AddLootItem.md +++ b/docs/lua_functions/AddLootItem.md @@ -1,18 +1,18 @@ -### Function: AddLootItem(param1, param2, param3) +### Function: AddLootItem(Spawn, ItemID, Charges) **Description:** -Placeholder description. +Add an item and its charges (quantity) to a Spawn's loot table for this instance. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: int32 - Integer value. -- `param3`: int16 - Short integer value. +- `Spawn`: Spawn - The spawn or entity to add the loot item. +- `ItemID`: int32 - ItemID from the items table. +- `Charges`: int16 - Amount of charges for the item (or quantity), default is 1. **Returns:** None. **Example:** ```lua --- Example usage -AddLootItem(..., ..., ...) +-- Example usage: Add to Spawn ItemID 1696 (a fishman scale amulet) with Quantity of 1. +AddLootItem(Spawn, 1696) ``` diff --git a/docs/lua_functions/AddMasterTitle.md b/docs/lua_functions/AddMasterTitle.md index 5b747f9..19dfd7d 100644 --- a/docs/lua_functions/AddMasterTitle.md +++ b/docs/lua_functions/AddMasterTitle.md @@ -1,17 +1,17 @@ -### Function: AddMasterTitle(param1, param2) +### Function: AddMasterTitle(TitleName, IsPrefix) **Description:** -Placeholder description. +Creates a new Title to be used for Characters/Players with AddCharacterTitle **Parameters:** -- `param1`: string - String value. -- `param2`: int8 - Small integer or boolean flag. +- `TitleName`: string - String value of the new master title to be used for characters/players. +- `IsPrefix`: int8 - If this title is a prefix or not, default is 0. -**Returns:** None. +**Returns:** The Database ID of the new Title that is created. **Example:** ```lua --- Example usage -AddMasterTitle(..., ...) +-- Example usage: Create a new title called "My New Title!" the dbID retrieved can be used to assign to a character with AddCharacterTitle +local dbID = AddMasterTitle("My New Title!") ``` diff --git a/docs/lua_functions/AddMultiFloorLift.md b/docs/lua_functions/AddMultiFloorLift.md index 9da779e..e754e53 100644 --- a/docs/lua_functions/AddMultiFloorLift.md +++ b/docs/lua_functions/AddMultiFloorLift.md @@ -1,18 +1,16 @@ -### Function: AddMultiFloorLift(param1, param2, param3) +### Function: AddMultiFloorLift(Spawn) **Description:** -Placeholder description. +Makes the Spawn (Required to be Widget) a multi-floor widget like an elevator. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. +- `Spawn`: Spawn - The Spawn (Widget) to be set to multi-floor. **Returns:** None. **Example:** ```lua --- Example usage -AddMultiFloorLift(..., ..., ...) +-- Example usage: Spawn becomes a multi-floor lift +AddMultiFloorLift(Spawn) ``` diff --git a/docs/lua_functions/AddOptionWindowOption.md b/docs/lua_functions/AddOptionWindowOption.md index 6a09817..18bd55e 100644 --- a/docs/lua_functions/AddOptionWindowOption.md +++ b/docs/lua_functions/AddOptionWindowOption.md @@ -1,22 +1,47 @@ -### Function: AddOptionWindowOption(param1, param2, param3, param4, param5, param6, param7) +### Function: AddOptionWindowOption(OptionWindow, OptionName, OptionDescription, OptionIconSheet, OptionIconID, OptionCommand, OptionConfirmTitle) **Description:** -Placeholder description. +Adds a new option to the option window screen. **Parameters:** -- `param1`: unknown - Unknown type. -- `param2`: string - String value. -- `param3`: string - String value. -- `param4`: int32 - Integer value. -- `param5`: int16 - Short integer value. -- `param6`: string - String value. -- `param7`: string - String value. +- `OptionWindow`: OptionWindow - OptionWindow object made with CreateOptionWindow(). +- `OptionName`: string - String value. +- `OptionDescription`: string - String value. +- `OptionIconSheet`: int32 - Integer value. +- `OptionIconID`: int16 - Short integer value. +- `OptionCommand`: string - String value. +- `OptionConfirmTitle`: string - String value. **Returns:** None. +**Notes:** +- Must call CreateOptionWindow to instantiate the OptionWindow before AddOptionWindowOption can be used. + **Example:** ```lua --- Example usage -AddOptionWindowOption(..., ..., ..., ..., ..., ..., ...) +-- Example usage: Create an option window to select a profession, Craftsman, Outfitter or Scholar, function outputs are select_*professionname*. +function SendOptionWindow(NPC, Spawn) + window = CreateOptionWindow() + AddOptionWindowOption(window, "Craftsman", "Craftsmen become carpenters, provisioners, or woodworkers. They make furniture and strong boxes, food, drink, bows, arrows, totems, wooden weapons, and wooden shields.", 1, 420, "select_craftsman") + AddOptionWindowOption(window, "Outfitter", "Outfitters become armorers, tailors, or weaponsmiths. They make plate and chainmail armor, heavy shields, cloth and leather armor, casual clothing, backpacks, hex dolls, and metal weapons.", 1, 411, "select_outfitter") + AddOptionWindowOption(window, "Scholar", "Scholars become alchemists, jewelers, and sages. They make spell and combat art upgrades for adventurers, potions, poisons, and jewelry.", 1, 396, "select_scholar") + SendOptionWindow(window, Spawn, "Select A Profession") +end + +function select_craftsman(NPC, Spawn) + SetTradeskillClass(Spawn, CRAFTSMAN) + SetTradeskillLevel(Spawn, 10) +end + +function select_outfitter(NPC, Spawn) + SetTradeskillClass(Spawn, OUTFITTER) + SetTradeskillLevel(Spawn, 10) +end + +function select_scholar(NPC, Spawn) + SetTradeskillClass(Spawn, SCHOLAR) + SetTradeskillLevel(Spawn, 10) +end + ``` diff --git a/docs/lua_functions/AddPlayerMail.md b/docs/lua_functions/AddPlayerMail.md index 7495d0d..c8e3fbb 100644 --- a/docs/lua_functions/AddPlayerMail.md +++ b/docs/lua_functions/AddPlayerMail.md @@ -1,29 +1,28 @@ -### Function: AddPlayerMail(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14) +### Function: AddPlayerMail(Spawn, FromName, SubjectName, MailBody, MailType, Copper, Silver, Gold, Platinum, ItemID, StackSize, ExpireTime, SentTime) **Description:** -Placeholder description. +Sends a mail message to the Spawn. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: string - String value. -- `param4`: string - String value. -- `param5`: string - String value. -- `param6`: int8 - Small integer or boolean flag. -- `param7`: int32 - Integer value. -- `param8`: int32 - Integer value. -- `param9`: int32 - Integer value. -- `param10`: int32 - Integer value. -- `param11`: int32 - Integer value. -- `param12`: int32 - Integer value. -- `param13`: int32 - Integer value. -- `param14`: int32 - Integer value. +- `Spawn`: Spawn - The Spawn (Player) to send the mail. +- `FromName`: string - From header name. +- `SubjectName`: string - Subject header name. +- `MailBody`: string - Body value. +- `MailType`: UInt8 - Type of mail, 0 = Regular, 1 = Spam, 2 = GM. +- `Copper`: UInt32 - Amount of copper included in the mail. +- `Silver`: UInt32 - Amount of silver included in the mail. +- `Gold`: UInt32 - Amount of gold included in the mail. +- `Platinum`: UInt32 - Amount of platinum included in the mail. +- `ItemID`: UInt32 - ItemID to provide to the Spawn in the mail. +- `StackSize`: UInt16 - StackSize (Quantity) of the item. +- `ExpireTime`: UInt32 - Unix Timestamp Expiration (defaults to 30 days after the sent time). Not active? +- `SentTime`: UInt32 - Unix Timestamp of when the mail was sent (optional defaults to current time). -**Returns:** None. +**Returns:** Boolean: True if successful adding mail, otherwise False. **Example:** ```lua --- Example usage -AddPlayerMail(..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ...) +-- Example usage: Sends Spawn a message from "Bob" with 1 Platinum and ItemID 1696 (a fishman scale amulet) +AddPlayerMail(Spawn, "Bob", "Mail for you", "What do you need, but some amulet?", 0, 0, 0, 0, 1, 1696) ``` diff --git a/docs/lua_functions/AddPlayerMailByCharID.md b/docs/lua_functions/AddPlayerMailByCharID.md index c5fecd9..1e96a29 100644 --- a/docs/lua_functions/AddPlayerMailByCharID.md +++ b/docs/lua_functions/AddPlayerMailByCharID.md @@ -1,28 +1,28 @@ -### Function: AddPlayerMailByCharID(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13) +### Function: AddPlayerMailByCharID(CharacterID, FromName, SubjectName, MailBody, MailType, Copper, Silver, Gold, Platinum, ItemID, StackSize, ExpireTime, SentTime) **Description:** -Placeholder description. +Sends a mail message to the Player represented by the CharacterID. **Parameters:** -- `param1`: int32 - Integer value. -- `param2`: string - String value. -- `param3`: string - String value. -- `param4`: string - String value. -- `param5`: int8 - Small integer or boolean flag. -- `param6`: int32 - Integer value. -- `param7`: int32 - Integer value. -- `param8`: int32 - Integer value. -- `param9`: int32 - Integer value. -- `param10`: int32 - Integer value. -- `param11`: int32 - Integer value. -- `param12`: int32 - Integer value. -- `param13`: int32 - Integer value. +- `CharacterID`: int32 - Integer value. +- `FromName`: string - From header name. +- `SubjectName`: string - Subject header name. +- `MailBody`: string - Body value. +- `MailType`: UInt8 - Type of mail, 0 = Regular, 1 = Spam, 2 = GM. +- `Copper`: UInt32 - Amount of copper included in the mail. +- `Silver`: UInt32 - Amount of silver included in the mail. +- `Gold`: UInt32 - Amount of gold included in the mail. +- `Platinum`: UInt32 - Amount of platinum included in the mail. +- `ItemID`: UInt32 - ItemID to provide to the Spawn in the mail. +- `StackSize`: UInt16 - StackSize (Quantity) of the item. +- `ExpireTime`: UInt32 - Unix Timestamp Expiration (defaults to 30 days after the sent time). Not active? +- `SentTime`: UInt32 - Unix Timestamp of when the mail was sent (optional defaults to current time). -**Returns:** None. +**Returns:** Boolean: True is always returned. **Example:** ```lua --- Example usage -AddPlayerMailByCharID(..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ...) +-- Example usage: Sends character id 123 (if it exists) a message from "Bob" with 1 Platinum and ItemID 1696 (a fishman scale amulet) +AddPlayerMail(123, "Bob", "Mail for you", "What do you need, but some amulet?", 0, 0, 0, 0, 1, 1696) ``` diff --git a/docs/lua_functions/AddPrimaryEntityCommand.md b/docs/lua_functions/AddPrimaryEntityCommand.md index cb01fb9..828c90d 100644 --- a/docs/lua_functions/AddPrimaryEntityCommand.md +++ b/docs/lua_functions/AddPrimaryEntityCommand.md @@ -1,24 +1,33 @@ -### Function: AddPrimaryEntityCommand(param1, param2, param3, param4, param5, param6, param7, param8, param9) +### Function: AddPrimaryEntityCommand(Player, Spawn, Name, Distance, Command, ErrorText, CastTime, SpellVisual, DenyListDefault) **Description:** -Placeholder description. +Puts a context menu (right click) entity command on the Spawn for the Player (or all to access if Player is nil). **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: Spawn - The spawn or entity involved. -- `param3`: string - String value. -- `param4`: float - Floating point value. -- `param5`: string - String value. -- `param6`: string - String value. -- `param7`: int16 - Short integer value. -- `param8`: int32 - Integer value. -- `param9`: int8 - Small integer or boolean flag. +- `Player`: Spawn - The Player that can access the entity command. Optionally set to nil to allow all access. +- `Spawn`: Spawn - The spawn to add the entity command. +- `Name`: string - Text display of the entity command. +- `Distance`: float - Distance the player can access the command otherwise it is gray. +- `Command`: string - Command function to call when used by Player. +- `ErrorText`: string - Error text displayed when cannot use. +- `CastTime`: UInt16 - Time in /10 of a second to complete the command after clicking it. +- `SpellVisual`: UInt32 - Optional spell visual when using the entity command. +- `DenyListDefault`: UInt8 - Default is 0, add to allow, set to 1 to put on deny list. **Returns:** None. **Example:** ```lua --- Example usage -AddPrimaryEntityCommand(..., ..., ..., ..., ..., ..., ..., ..., ...) +-- Example usage: On Hail add Destroy command to Spawn. + +function hail(NPC, Spawn) + AddPrimaryEntityCommand(Spawn, NPC, "Destroy", 5) +end + +function casted_on(NPC, Spawn, SpellName) + if SpellName == 'Destroy' then + -- perform action + end +end ``` diff --git a/docs/lua_functions/AddPrimaryEntityCommandAllSpawns.md b/docs/lua_functions/AddPrimaryEntityCommandAllSpawns.md index 5da86bb..1983726 100644 --- a/docs/lua_functions/AddPrimaryEntityCommandAllSpawns.md +++ b/docs/lua_functions/AddPrimaryEntityCommandAllSpawns.md @@ -1,24 +1,33 @@ -### Function: AddPrimaryEntityCommandAllSpawns(param1, param2, param3, param4, param5, param6, param7, param8, param9) +### Function: AddPrimaryEntityCommandAllSpawns(Player, SpawnID, Name, Distance, Command, ErrorText, CastTime, SpellVisual, DenyListDefault) **Description:** -Placeholder description. +Puts a context menu (right click) entity command on all the Spawn's by the Spawn ID in the zone for the Player. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: int32 - Integer value. -- `param4`: string - String value. -- `param5`: float - Floating point value. -- `param6`: string - String value. -- `param7`: string - String value. -- `param8`: int16 - Short integer value. -- `param9`: int32 - Integer value. +- `Player`: Spawn - The Player that can access the entity command. Optionally set to nil to allow all access. +- `SpawnID`: UInt32 - The spawn id of all related Spawns to add the entity command. +- `Name`: string - Text display of the entity command. +- `Distance`: float - Distance the player can access the command otherwise it is gray. +- `Command`: string - Command function to call when used by Player. +- `ErrorText`: string - Error text displayed when cannot use. +- `CastTime`: UInt16 - Time in /10 of a second to complete the command after clicking it. +- `SpellVisual`: UInt32 - Optional spell visual when using the entity command. +- `DenyListDefault`: UInt8 - Default is 0, add to allow, set to 1 to put on deny list. **Returns:** None. **Example:** ```lua --- Example usage -AddPrimaryEntityCommandAllSpawns(..., ..., ..., ..., ..., ..., ..., ..., ...) -``` +-- Example usage: On Hail add context command to Spawn's with Spawn ID 123. + +function hail(NPC, Spawn) + AddPrimaryEntityCommandAllSpawns(Spawn, 123, "Destroy", 5) +end + +function casted_on(NPC, Spawn, SpellName) + if SpellName == 'Destroy' then + -- perform action + end +end +``` \ No newline at end of file diff --git a/docs/lua_functions/AddProc.md b/docs/lua_functions/AddProc.md index 1fc2828..f5df130 100644 --- a/docs/lua_functions/AddProc.md +++ b/docs/lua_functions/AddProc.md @@ -1,24 +1,31 @@ -### Function: AddProc(param1, param2, param3, param4, param5, param6, param7, param8, param9) +### Function: AddProc(Spawn, Type, Chance, Item, UseAllSpellTargets) **Description:** -Placeholder description. +Add's a proc for a Spell and calls function proc when proc succeeds. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: unknown - Unknown type. -- `param5`: unknown - Unknown type. -- `param6`: int8 - Small integer or boolean flag. -- `param7`: float - Floating point value. -- `param8`: Item - An item reference. -- `param9`: int8 - Small integer or boolean flag. +- `Spawn`: Spawn - The spawn or entity involved. +- `Type`: int8 - See PROC_TYPE defines. +- `Chance`: float - Chance of proc 1-100. +- `Item`: Item - An item reference. +- `UseAllSpellTargets`: int8 - Default is 0, when set to 1 all spell targets will apply the proc not the Spawn **Returns:** None. **Example:** ```lua --- Example usage -AddProc(..., ..., ..., ..., ..., ..., ..., ..., ...) +-- Example usage: Example Spell Script, when casted Target has 10% chance to trigger proc on type 15 (PROC_TYPE_DAMAGED) when damaged. + +function cast(Caster, Target) + -- 10% chance to dispel when target takes damage + AddProc(Target, 15, 10.0) +end + +function proc(Caster, Target, Type) + if Type == 15 then + CancelSpell() + end +end + ``` diff --git a/docs/lua_functions/AddProcExt.md b/docs/lua_functions/AddProcExt.md index 4b9b12b..a19140b 100644 --- a/docs/lua_functions/AddProcExt.md +++ b/docs/lua_functions/AddProcExt.md @@ -1,28 +1,39 @@ -### Function: AddProcExt(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13) +### Function: AddProcExt(Spawn, ProcType, DamageType, Chance, HPRatio, BelowHealth, TargetHealth, Item, UseAllSpellTargets) **Description:** -Placeholder description. +Add's a proc for a Spell and calls function proc_ext when proc succeeds. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: unknown - Unknown type. -- `param5`: unknown - Unknown type. -- `param6`: int8 - Small integer or boolean flag. -- `param7`: int8 - Small integer or boolean flag. -- `param8`: float - Floating point value. -- `param9`: int8 - Small integer or boolean flag. -- `param10`: bool - Boolean value (true/false). -- `param11`: bool - Boolean value (true/false). -- `param12`: Item - An item reference. -- `param13`: int8 - Small integer or boolean flag. +- `Spawn`: Spawn - The spawn or entity involved. +- `ProcType`: int8 - See ProcType options +- `DamageType`: int8 - See DamageType options +- `Chance`: float - Floating point value. +- `HPRatio`: int8 - Small integer or boolean flag. +- `BelowHealth`: bool - Use HPRatio against health lower than if false (default). Otherwise if health is higher when true. +- `TargetHealth`: bool - Use Target's Health for formula, default is false (use self Spawn health). Otherwise when true use Target's health. +- `Item`: Item - An item reference. +- `UseAllSpellTargets`: int8 - By default 0 (false) use just Spawn, otherwise use all Spell Targets. **Returns:** None. **Example:** ```lua --- Example usage -AddProcExt(..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ...) +-- Example usage: Spell Script when on cast there is a AddProcExt called for when player is going to die Type 13 PROC_TYPE_DEATH + - then proc_ext is called, which in turn casts the RedemptionReactiveSpell and the RemoveProc(Target) is called to remove spell from Target. +local RedemptionReactiveSpell = 2550537 + +function cast(Caster, Target, HealAmt, MaxHealthAmt) + AddProcExt(Target, 13, 255, 100.0) +end + +function proc_ext(Caster, Target, Type, DamageType, InitialCaster, HealAmt, MaxHealthAmt) + CastSpell(Caster, RedemptionReactiveSpell, GetSpellTier(), InitialCaster) + SetSpellTriggerCount(1, 1) + RemoveProc(Target) +end + +function remove(Caster, Target) + RemoveProc(Target) +end ```