diff --git a/docs/ElunaDoc/parser.py b/docs/ElunaDoc/parser.py
index b2a2ccfc1b..de7a3838ff 100644
--- a/docs/ElunaDoc/parser.py
+++ b/docs/ElunaDoc/parser.py
@@ -85,7 +85,15 @@ def __init__(self, name, description, tables, prototypes, parameters, returned):
md_table += '| ' + ' | '.join(['---'] * len(table['columns'])) + ' |\n' # Separator
for row in table['values']:
- md_table += '| ' + ' | '.join(row) + ' |\n' # Rows
+ md_row = '| '
+ for value in row:
+ if isinstance(value, dict):
+ # If the value is a dictionary, format the values and preserve the type in the documentation
+ md_row += self._format_dict_values(value)
+ else:
+ md_row += value
+ md_row += ' | '
+ md_table += md_row + '\n'
# Convert the generated Markdown table to HTML
html_table = markdown.markdown(md_table, extensions=['tables'])
@@ -103,6 +111,17 @@ def __init__(self, name, description, tables, prototypes, parameters, returned):
# If it has a description, it is "documented".
self.documented = self.description != ''
+ """Helper function to parse table dictionaries. Only used in Register methods for now."""
+ def _format_dict_values(self, d):
+ html_str = ""
+ html_parts = []
+
+ for key, value in d.items():
+ html_parts.append(f'{key}')
+
+ html_str = ', '.join(html_parts)
+ return html_str
+
class MangosClassDoc(object):
"""The documentation of a MaNGOS class that has Lua methods."""
@@ -150,7 +169,7 @@ class ClassParser(object):
# Regular expressions for parsing a table.
table_regex = re.compile(r"\s*\*\s@table")
table_columns_regex = re.compile(r"\s*\*\s@columns\s*\[(.+)\]")
- table_values_regex = re.compile(r"\s*\*\s@values\s*\[(.+)\]")
+ table_values_regex = re.compile(r"\s*\*\s@values\s*\[(.+?)\]")
param_regex = re.compile(r"""\s*\*\s@param\s # The @param tag starts with opt. whitespace followed by "* @param ".
([^\s]+)\s(\w+)? # The data type, a space, and the name of the param.
@@ -212,11 +231,27 @@ def handle_table(self, line):
def handle_table_columns(self, match):
if self.tables:
self.tables[-1]["columns"] = match.group(1).split(", ")
-
+
def handle_table_values(self, match):
if self.tables:
- values = re.findall(r'(?:[^,"]|"(?:\\.|[^"])*")+', match.group(1))
- self.tables[-1]["values"].append([v.strip(' "') for v in values])
+ values = re.findall(r'(?:[^,<>"]|"(?:\\.|[^"])*"|<[^>]*>)+', match.group(1))
+ processed_values = []
+
+ for value in values:
+ stripped_value = value.strip(' "')
+ # Parse the content inside < >
+ if stripped_value.startswith("<") and stripped_value.endswith(">"):
+ # Remove prefix and suffix
+ inner_content = stripped_value[1:-1]
+
+ # Convert inner key-value pairs to a dict
+ pair_regex = re.compile(r"(\w+):\s*([\w\s]+)")
+ stripped_value = dict(pair_regex.findall(inner_content))
+
+ processed_values.append(stripped_value)
+
+ # Append the processed values to the last table
+ self.tables[-1]["values"].append(processed_values)
def handle_param(self, match):
data_type, name, default, description = match.group(1), match.group(2), match.group(3), match.group(4)
diff --git a/methods/TrinityCore/GlobalMethods.h b/methods/TrinityCore/GlobalMethods.h
index 042fa0c779..dffbc5ffaa 100644
--- a/methods/TrinityCore/GlobalMethods.h
+++ b/methods/TrinityCore/GlobalMethods.h
@@ -669,56 +669,56 @@ namespace LuaGlobalFunctions
*
* @table
* @columns [ID, Event, State, Parameters, Comment]
- * @values [1, ON_CHARACTER_CREATE, "WORLD", "event, player", ""]
- * @values [2, ON_CHARACTER_DELETE, "WORLD", "event, guid", ""]
- * @values [3, ON_LOGIN, "WORLD", "event, player", ""]
- * @values [4, ON_LOGOUT, "WORLD", "event, player", ""]
- * @values [5, ON_SPELL_CAST, "MAP", "event, player, spell, skipCheck", ""]
- * @values [6, ON_KILL_PLAYER, "MAP", "event, killer, killed", ""]
- * @values [7, ON_KILL_CREATURE, "MAP", "event, killer, killed", ""]
- * @values [8, ON_KILLED_BY_CREATURE, "MAP", "event, killer, killed", ""]
- * @values [9, ON_DUEL_REQUEST, "MAP", "event, target, challenger", ""]
- * @values [10, ON_DUEL_START, "MAP", "event, player1, player2", ""]
- * @values [11, ON_DUEL_END, "MAP", "event, winner, loser, type", ""]
- * @values [12, ON_GIVE_XP, "MAP", "event, player, amount, victim", "Can return new XP amount"]
- * @values [13, ON_LEVEL_CHANGE, "MAP", "event, player, oldLevel", ""]
- * @values [14, ON_MONEY_CHANGE, "MAP", "event, player, amount", "Can return new money amount"]
- * @values [15, ON_REPUTATION_CHANGE, "MAP", "event, player, factionId, standing, incremental", "Can return new standing"]
- * @values [16, ON_TALENTS_CHANGE, "MAP", "event, player, points", ""]
- * @values [17, ON_TALENTS_RESET, "MAP", "event, player, noCost", ""]
- * @values [18, ON_CHAT, "WORLD", "event, player, msg, Type, lang", "Can return false, newMessage"]
- * @values [19, ON_WHISPER, "WORLD", "event, player, msg, Type, lang, receiver", "Can return false, newMessage"]
- * @values [20, ON_GROUP_CHAT, "WORLD", "event, player, msg, Type, lang, group", "Can return false, newMessage"]
- * @values [21, ON_GUILD_CHAT, "WORLD", "event, player, msg, Type, lang, guild", "Can return false, newMessage"]
- * @values [22, ON_CHANNEL_CHAT, "WORLD", "event, player, msg, Type, lang, channel", "Can return false, newMessage"]
- * @values [23, ON_EMOTE, "MAP", "event, player, emote", "Not triggered on any known emote"]
- * @values [24, ON_TEXT_EMOTE, "MAP", "event, player, textEmote, emoteNum, guid", ""]
- * @values [25, ON_SAVE, "MAP", "event, player", ""]
- * @values [26, ON_BIND_TO_INSTANCE, "MAP", "event, player, difficulty, mapid, permanent", ""]
- * @values [27, ON_UPDATE_ZONE, "MAP", "event, player, newZone, newArea", ""]
- * @values [28, ON_MAP_CHANGE, "MAP", "event, player", ""]
- * @values [29, ON_EQUIP, "MAP", "event, player, item, bag, slot", ""]
- * @values [30, ON_FIRST_LOGIN, "WORLD", "event, player", ""]
- * @values [31, ON_CAN_USE_ITEM, "MAP", "event, player, itemEntry", "Can return InventoryResult enum value"]
- * @values [32, ON_LOOT_ITEM, "MAP", "event, player, item, count", ""]
- * @values [33, ON_ENTER_COMBAT, "MAP", "event, player, enemy", ""]
- * @values [34, ON_LEAVE_COMBAT, "MAP", "event, player", ""]
- * @values [35, ON_REPOP, "MAP", "event, player", ""]
- * @values [36, ON_RESURRECT, "MAP", "event, player", ""]
- * @values [37, ON_LOOT_MONEY, "MAP", "event, player, amount", ""]
- * @values [38, ON_QUEST_ABANDON, "MAP", "event, player, questId", ""]
- * @values [39, ON_LEARN_TALENTS, "MAP", "event, player, talentId, talentRank, spellid", ""]
- * @values [40, ON_ENVIRONMENTAL_DEATH, "MAP", "event, player, environmentalDamageType", ""]
- * @values [41, ON_TRADE_ACCEPT, "MAP", "event, player, target", "Can return false to interrupt trade"]
- * @values [42, ON_COMMAND, "MAP", "event, player, command", "Player is nil if command used from console. Can return false"]
- * @values [43, ON_SKILL_CHANGE, "MAP", "event, player, skillId, skillValue", "Returns new skill level value"]
- * @values [44, ON_LEARN_SPELL, "MAP", "event, player, spellId", ""]
- * @values [45, ON_ACHIEVEMENT_COMPLETE, "MAP", "event, player, achievementId", ""]
- * @values [46, ON_DISCOVER_AREA, "MAP", "event, player, area", ""]
- * @values [47, ON_UPDATE_AREA, "MAP", "event, player, oldArea, newArea", ""]
- * @values [48, ON_TRADE_INIT, "MAP", "event, player, target", "Can return false to interrupt trade"]
- * @values [49, ON_SEND_MAIL, "MAP", "event, player, recipientGuid", "Can return false to interrupt sending"]
- * @values [54, ON_QUEST_STATUS_CHANGED, "MAP", "event, player, questId, status", ""]
+ * @values [1, ON_CHARACTER_CREATE, "WORLD", , ""] -
+ * @values [2, ON_CHARACTER_DELETE, "WORLD", , ""] -
+ * @values [3, ON_LOGIN, "WORLD", , ""] -
+ * @values [4, ON_LOGOUT, "WORLD", , ""] -
+ * @values [5, ON_SPELL_CAST, "MAP", , ""] -
+ * @values [6, ON_KILL_PLAYER, "MAP", , ""] -
+ * @values [7, ON_KILL_CREATURE, "MAP", , ""] -
+ * @values [8, ON_KILLED_BY_CREATURE, "MAP", , ""] -
+ * @values [9, ON_DUEL_REQUEST, "MAP", , ""]-
+ * @values [10, ON_DUEL_START, "MAP", , ""] -
+ * @values [11, ON_DUEL_END, "MAP", , ""] -
+ * @values [12, ON_GIVE_XP, "MAP", , "Can return new XP amount"] -
+ * @values [13, ON_LEVEL_CHANGE, "MAP", , ""] -
+ * @values [14, ON_MONEY_CHANGE, "MAP", , "Can return new money amount"]
+ * @values [15, ON_REPUTATION_CHANGE, "MAP", , "Can return new standing"]
+ * @values [16, ON_TALENTS_CHANGE, "MAP", , ""]
+ * @values [17, ON_TALENTS_RESET, "MAP", , ""]
+ * @values [18, ON_CHAT, "WORLD", , "Can return false, newMessage"]
+ * @values [19, ON_WHISPER, "WORLD", , "Can return false, newMessage"]
+ * @values [20, ON_GROUP_CHAT, "WORLD", , "Can return false, newMessage"]
+ * @values [21, ON_GUILD_CHAT, "WORLD", , "Can return false, newMessage"]
+ * @values [22, ON_CHANNEL_CHAT, "WORLD", , "Can return false, newMessage"]
+ * @values [23, ON_EMOTE, "MAP", , "Not triggered on any known emote"]
+ * @values [24, ON_TEXT_EMOTE, "MAP", , ""]
+ * @values [25, ON_SAVE, "MAP", , ""] -
+ * @values [26, ON_BIND_TO_INSTANCE, "MAP", , ""]
+ * @values [27, ON_UPDATE_ZONE, "MAP", , ""]
+ * @values [28, ON_MAP_CHANGE, "MAP", , ""] -
+ * @values [29, ON_EQUIP, "MAP", , ""]
+ * @values [30, ON_FIRST_LOGIN, "WORLD", , ""] -
+ * @values [31, ON_CAN_USE_ITEM, "MAP", , "Can return InventoryResult enum value"]
+ * @values [32, ON_LOOT_ITEM, "MAP", , ""]
+ * @values [33, ON_ENTER_COMBAT, "MAP", , ""]
+ * @values [34, ON_LEAVE_COMBAT, "MAP", , ""] -
+ * @values [35, ON_REPOP, "MAP", , ""] -
+ * @values [36, ON_RESURRECT, "MAP", , ""] -
+ * @values [37, ON_LOOT_MONEY, "MAP", , ""]
+ * @values [38, ON_QUEST_ABANDON, "MAP", , ""]
+ * @values [39, ON_LEARN_TALENTS, "MAP", , ""]
+ * @values [40, ON_ENVIRONMENTAL_DEATH, "MAP", , ""]
+ * @values [41, ON_TRADE_ACCEPT, "MAP", , "Can return false to interrupt trade"]
+ * @values [42, ON_COMMAND, "MAP", , "Player is nil if command used from console. Can return false"]
+ * @values [43, ON_SKILL_CHANGE, "MAP", , "Returns new skill level value"]
+ * @values [44, ON_LEARN_SPELL, "MAP", , ""]
+ * @values [45, ON_ACHIEVEMENT_COMPLETE, "MAP", , ""]
+ * @values [46, ON_DISCOVER_AREA, "MAP", , ""]
+ * @values [47, ON_UPDATE_AREA, "MAP", , ""]
+ * @values [48, ON_TRADE_INIT, "MAP", , "Can return false to interrupt trade"]
+ * @values [49, ON_SEND_MAIL, "MAP", , "Can return false to interrupt sending"]
+ * @values [54, ON_QUEST_STATUS_CHANGED, "MAP", , ""] -
*
* @proto cancel = (event, function)
* @proto cancel = (event, function, shots)