Skip to content

Commit

Permalink
Replace the remaining enum usage with tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Foereaper committed Nov 14, 2024
1 parent 6b9c370 commit 9e3dd7c
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 103 deletions.
56 changes: 22 additions & 34 deletions methods/TrinityCore/GameObjectMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,11 @@ namespace LuaGameObject
* Returns the state of a [GameObject]
* Below are client side [GOState]s off of 3.3.5a
*
* <pre>
* enum GOState
* {
* GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open)
* GO_STATE_READY = 1, // show in world as ready (closed door close)
* GO_STATE_ACTIVE_ALTERNATIVE = 2 // show in world as used in alt way and not reset (closed door open by cannon fire)
* };
* </pre>
* @table
* @columns [GOState, ID, Comment]
* @values [GO_STATE_ACTIVE, 0, "show in world as used and not reset (closed door open)"]
* @values [GO_STATE_READY, 1, "show in world as ready (closed door close)"]
* @values [GO_STATE_ACTIVE_ALTERNATIVE, 2, "show in world as used in alt way and not reset (closed door open by cannon fire)"]
*
* @return [GOState] goState
*/
Expand All @@ -106,15 +103,12 @@ namespace LuaGameObject
* Returns the [LootState] of a [GameObject]
* Below are [LootState]s off of 3.3.5a
*
* <pre>
* enum LootState
* {
* GO_NOT_READY = 0,
* GO_READY, // can be ready but despawned, and then not possible activate until spawn
* GO_ACTIVATED,
* GO_JUST_DEACTIVATED
* };
* </pre>
* @table
* @columns [LootState, ID, Comment]
* @values [GO_NOT_READY, 0, ""]
* @values [GO_READY, 1, "can be ready but despawned, and then not possible activate until spawn"]
* @values [GO_ACTIVATED, 2, ""]
* @values [GO_JUST_DEACTIVATED, 3, ""]
*
* @return [LootState] lootState
*/
Expand Down Expand Up @@ -164,14 +158,11 @@ namespace LuaGameObject
/**
* Sets the state of a [GameObject]
*
* <pre>
* enum GOState
* {
* GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open)
* GO_STATE_READY = 1, // show in world as ready (closed door close)
* GO_STATE_ACTIVE_ALTERNATIVE = 2 // show in world as used in alt way and not reset (closed door open by cannon fire)
* };
* </pre>
* @table
* @columns [GOState, ID, Comment]
* @values [GO_STATE_ACTIVE, 0, "show in world as used and not reset (closed door open)"]
* @values [GO_STATE_READY, 1, "show in world as ready (closed door close)"]
* @values [GO_STATE_ACTIVE_ALTERNATIVE, 2, "show in world as used in alt way and not reset (closed door open by cannon fire)"]
*
* @param [GOState] state : all available go states can be seen above
*/
Expand All @@ -193,15 +184,12 @@ namespace LuaGameObject
* Sets the [LootState] of a [GameObject]
* Below are [LootState]s off of 3.3.5a
*
* <pre>
* enum LootState
* {
* GO_NOT_READY = 0,
* GO_READY, // can be ready but despawned, and then not possible activate until spawn
* GO_ACTIVATED,
* GO_JUST_DEACTIVATED
* };
* </pre>
* @table
* @columns [LootState, ID, Comment]
* @values [GO_NOT_READY, 0, ""]
* @values [GO_READY, 1, "can be ready but despawned, and then not possible activate until spawn"]
* @values [GO_ACTIVATED, 2, ""]
* @values [GO_JUST_DEACTIVATED, 3, ""]
*
* @param [LootState] state : all available loot states can be seen above
*/
Expand Down
42 changes: 16 additions & 26 deletions methods/TrinityCore/GroupMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,11 @@ namespace LuaGroup
/**
* Returns the [Group] members' flags
*
* <pre>
* enum GroupMemberFlags
* {
* MEMBER_FLAG_ASSISTANT = 1,
* MEMBER_FLAG_MAINTANK = 2,
* MEMBER_FLAG_MAINASSIST = 4
* };
* </pre>
* @table
* @columns [GroupMemberFlags, ID]
* @values [MEMBER_FLAG_ASSISTANT, 1]
* @values [MEMBER_FLAG_MAINTANK, 2]
* @values [MEMBER_FLAG_MAINASSIST, 4]
*
* @param ObjectGuid guid : guid of the player
* @return uint8 flags
Expand Down Expand Up @@ -315,15 +312,12 @@ namespace LuaGroup
*
* In multistate, this method is only available in the WORLD state
*
* <pre>
* enum RemoveMethod
* {
* GROUP_REMOVEMETHOD_DEFAULT = 0,
* GROUP_REMOVEMETHOD_KICK = 1,
* GROUP_REMOVEMETHOD_LEAVE = 2,
* GROUP_REMOVEMETHOD_KICK_LFG = 3
* };
* </pre>
* @table
* @columns [RemoveMethod, ID]
* @values [GROUP_REMOVEMETHOD_DEFAULT, 0]
* @values [GROUP_REMOVEMETHOD_KICK, 1]
* @values [GROUP_REMOVEMETHOD_LEAVE, 2]
* @values [GROUP_REMOVEMETHOD_KICK_LFG, 3]
*
* @param ObjectGuid guid : guid of the player to remove
* @param [RemoveMethod] method : method used to remove the player
Expand Down Expand Up @@ -414,7 +408,6 @@ namespace LuaGroup
* Converts the [Group] to a LFG group
*
* In multistate, this method is only available in the WORLD state
*
*/
int ConvertToLFG(Eluna* /*E*/, Group* group)
{
Expand All @@ -427,14 +420,11 @@ namespace LuaGroup
*
* In multistate, this method is only available in the WORLD state
*
* <pre>
* enum GroupMemberFlags
* {
* MEMBER_FLAG_ASSISTANT = 1,
* MEMBER_FLAG_MAINTANK = 2,
* MEMBER_FLAG_MAINASSIST = 4
* };
* </pre>
* @table
* @columns [GroupMemberFlags, ID]
* @values [MEMBER_FLAG_ASSISTANT, 1]
* @values [MEMBER_FLAG_MAINTANK, 2]
* @values [MEMBER_FLAG_MAINASSIST, 4]
*
* @param ObjectGuid target : GUID of the target
* @param bool apply : add the `flag` if `true`, remove the `flag` otherwise
Expand Down
25 changes: 11 additions & 14 deletions methods/TrinityCore/ItemMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,20 +232,17 @@ namespace LuaItem
/**
* Returns the chat link of the [Item]
*
* <pre>
* enum LocaleConstant
* {
* LOCALE_enUS = 0,
* LOCALE_koKR = 1,
* LOCALE_frFR = 2,
* LOCALE_deDE = 3,
* LOCALE_zhCN = 4,
* LOCALE_zhTW = 5,
* LOCALE_esES = 6,
* LOCALE_esMX = 7,
* LOCALE_ruRU = 8
* };
* </pre>
* @table
* @columns [Locale, ID]
* @values [LOCALE_enUS, 0]
* @values [LOCALE_koKR, 1]
* @values [LOCALE_frFR, 2]
* @values [LOCALE_deDE, 3]
* @values [LOCALE_zhCN, 4]
* @values [LOCALE_zhTW, 5]
* @values [LOCALE_esES, 6]
* @values [LOCALE_esMX, 7]
* @values [LOCALE_ruRU, 8]
*
* @param [LocaleConstant] locale = DEFAULT_LOCALE : locale to return the [Item]'s name in
* @return string itemLink
Expand Down
52 changes: 23 additions & 29 deletions methods/TrinityCore/QuestMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,29 @@ namespace LuaQuest
* Returns 'true' if the [Quest] has the specified flag, false otherwise.
* Below flags are based off of 3.3.5a. Subject to change.
*
* <pre>
* enum QuestFlags
* {
* // Flags used at server and sent to client
* QUEST_FLAGS_NONE = 0x0,
* QUEST_FLAGS_STAY_ALIVE = 0x1, // Not used currently
* QUEST_FLAGS_PARTY_ACCEPT = 0x2, // Not used currently. If player in party, all players that can accept this quest will receive confirmation box to accept quest CMSG_QUEST_CONFIRM_ACCEPT/SMSG_QUEST_CONFIRM_ACCEPT
* QUEST_FLAGS_EXPLORATION = 0x4, // Not used currently
* QUEST_FLAGS_SHARABLE = 0x8, // Can be shared: Player::CanShareQuest()
* QUEST_FLAGS_HAS_CONDITION = 0x10, // Not used currently
* QUEST_FLAGS_HIDE_REWARD_POI = 0x20, // Not used currently: Unsure of content
* QUEST_FLAGS_RAID = 0x40, // Not used currently
* QUEST_FLAGS_TBC = 0x80, // Not used currently: Available if TBC expansion enabled only
* QUEST_FLAGS_NO_MONEY_FROM_XP = 0x100, // Not used currently: Experience is not converted to gold at max level
* QUEST_FLAGS_HIDDEN_REWARDS = 0x200, // Items and money rewarded only sent in SMSG_QUESTGIVER_OFFER_REWARD (not in SMSG_QUESTGIVER_QUEST_DETAILS or in client quest log(SMSG_QUEST_QUERY_RESPONSE))
* QUEST_FLAGS_TRACKING = 0x400, // These quests are automatically rewarded on quest complete and they will never appear in quest log client side.
* QUEST_FLAGS_DEPRECATE_REPUTATION = 0x800, // Not used currently
* QUEST_FLAGS_DAILY = 0x1000, // Used to know quest is Daily one
* QUEST_FLAGS_FLAGS_PVP = 0x2000, // Having this quest in log forces PvP flag
* QUEST_FLAGS_UNAVAILABLE = 0x4000, // Used on quests that are not generically available
* QUEST_FLAGS_WEEKLY = 0x8000,
* QUEST_FLAGS_AUTOCOMPLETE = 0x10000, // auto complete
* QUEST_FLAGS_DISPLAY_ITEM_IN_TRACKER = 0x20000, // Displays usable item in quest tracker
* QUEST_FLAGS_OBJ_TEXT = 0x40000, // use Objective text as Complete text
* QUEST_FLAGS_AUTO_ACCEPT = 0x80000, // The client recognizes this flag as auto-accept. However, NONE of the current quests (3.3.5a) have this flag. Maybe blizz used to use it, or will use it in the future.
*
* // ... 4.x added flags up to 0x80000000 - all unknown for now
* };
* </pre>
* @table
* @columns [QuestFlags, ID, Comment]
* @values [QUEST_FLAGS_NONE, 0x0, ""]
* @values [QUEST_FLAGS_STAY_ALIVE, 0x1, "Not used currently"]
* @values [QUEST_FLAGS_PARTY_ACCEPT, 0x2, "Not used currently. If player in party, all players that can accept this quest will receive confirmation box to accept quest CMSG_QUEST_CONFIRM_ACCEPT/SMSG_QUEST_CONFIRM_ACCEPT"]
* @values [QUEST_FLAGS_EXPLORATION, 0x4, "Not used currently"]
* @values [QUEST_FLAGS_SHARABLE, 0x8, "Can be shared: Player::CanShareQuest()"]
* @values [QUEST_FLAGS_HAS_CONDITION, 0x10, "Not used currently"]
* @values [QUEST_FLAGS_HIDE_REWARD_POI, 0x20, "Not used currently: Unsure of content"]
* @values [QUEST_FLAGS_RAID, 0x40, "Not used currently"]
* @values [QUEST_FLAGS_TBC, 0x80, "Not used currently: Available if TBC expansion enabled only"]
* @values [QUEST_FLAGS_NO_MONEY_FROM_XP, 0x100, "Not used currently: Experience is not converted to gold at max level"]
* @values [QUEST_FLAGS_HIDDEN_REWARDS, 0x200, "Items and money rewarded only sent in SMSG_QUESTGIVER_OFFER_REWARD (not in SMSG_QUESTGIVER_QUEST_DETAILS or in client quest log(SMSG_QUEST_QUERY_RESPONSE))"]
* @values [QUEST_FLAGS_TRACKING, 0x400, "These quests are automatically rewarded on quest complete and they will never appear in quest log client side."]
* @values [QUEST_FLAGS_DEPRECATE_REPUTATION, 0x800, "Not used currently"]
* @values [QUEST_FLAGS_DAILY, 0x1000, "Used to know quest is Daily one"]
* @values [QUEST_FLAGS_FLAGS_PVP, 0x2000, "Having this quest in log forces PvP flag"]
* @values [QUEST_FLAGS_UNAVAILABLE, 0x4000, "Used on quests that are not generically available"]
* @values [QUEST_FLAGS_WEEKLY, 0x8000, ""]
* @values [QUEST_FLAGS_AUTOCOMPLETE, 0x10000, "auto complete"]
* @values [QUEST_FLAGS_DISPLAY_ITEM_IN_TRACKER, 0x20000, "Displays usable item in quest tracker"]
* @values [QUEST_FLAGS_OBJ_TEXT, 0x40000, "use Objective text as Complete text"]
* @values [QUEST_FLAGS_AUTO_ACCEPT, 0x80000, "The client recognizes this flag as auto-accept. However, NONE of the current quests (3.3.5a) have this flag. Maybe blizz used to use it, or will use it in the future."]
*
* @param [QuestFlags] flag : all available flags can be seen above
* @return bool hasFlag
Expand Down

0 comments on commit 9e3dd7c

Please sign in to comment.