From a7262d8197911c412cca92e1e769ab88a97e4ac3 Mon Sep 17 00:00:00 2001 From: Slivo Date: Mon, 17 May 2021 16:14:21 +0200 Subject: [PATCH 01/13] Adds raid market symbol to chat tranq announces --- README.md | 1 - TranqRotate.toc | 1 + src/events.lua | 4 ++-- src/raidIcons.lua | 46 +++++++++++++++++++++++++++++++++++++++++++++ src/tranqRotate.lua | 11 ++++++----- 5 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 src/raidIcons.lua diff --git a/README.md b/README.md index eb3f392..1202227 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,6 @@ Here is a list of feature I want to implement at some point, no specific order i - Automatic handling of death and disconnection of hunters on the rotation group (swap with a backup, send an alert about it) - Use raid symbols to mark hunters that need to tranq, or that need to backup a failed tranqshot - Automatic reset of rotation when raid wipe -- Adds raid markers to tranq announces if target has one ## Download diff --git a/TranqRotate.toc b/TranqRotate.toc index 4fb4613..65eb96e 100644 --- a/TranqRotate.toc +++ b/TranqRotate.toc @@ -36,3 +36,4 @@ src\settings.lua src\utils.lua src\debuff.lua src\migration.lua +src\raidIcons.lua diff --git a/src/events.lua b/src/events.lua index 91495ca..bf1b757 100644 --- a/src/events.lua +++ b/src/events.lua @@ -43,13 +43,13 @@ function TranqRotate:COMBAT_LOG_EVENT_UNFILTERED() TranqRotate:sendSyncTranq(hunter, false, timestamp) TranqRotate:rotate(hunter) if (sourceGUID == UnitGUID("player")) then - TranqRotate:sendAnnounceMessage(TranqRotate.db.profile.announceSuccessMessage, destName) + TranqRotate:sendAnnounceMessage(TranqRotate.db.profile.announceSuccessMessage, destName, destRaidFlags) end elseif (event == "SPELL_MISSED" or event == "SPELL_DISPEL_FAILED") then TranqRotate:sendSyncTranq(hunter, true, timestamp, event) TranqRotate:handleFailTranq(hunter, event) if (sourceGUID == UnitGUID("player")) then - TranqRotate:sendAnnounceMessage(TranqRotate.db.profile.announceFailMessage, destName) + TranqRotate:sendAnnounceMessage(TranqRotate.db.profile.announceFailMessage, destName, destRaidFlags) end end end diff --git a/src/raidIcons.lua b/src/raidIcons.lua new file mode 100644 index 0000000..2ea192e --- /dev/null +++ b/src/raidIcons.lua @@ -0,0 +1,46 @@ +TranqRotate.iconTypeChat = "chat" +TranqRotate.iconTypePrint = "print" + +TranqRotate.raidIconMaskToIcon = { + [COMBATLOG_OBJECT_RAIDTARGET1] = { + [TranqRotate.iconTypeChat] = "{rt1}", + [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_1.blp:0|t" + }, + [COMBATLOG_OBJECT_RAIDTARGET2] = { + [TranqRotate.iconTypeChat] = "{rt2}", + [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_2.blp:0|t" + }, + [COMBATLOG_OBJECT_RAIDTARGET3] = { + [TranqRotate.iconTypeChat] = "{rt3}", + [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_3.blp:0|t" + }, + [COMBATLOG_OBJECT_RAIDTARGET4] = { + [TranqRotate.iconTypeChat] = "{rt4}", + [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_4.blp:0|t" + }, + [COMBATLOG_OBJECT_RAIDTARGET5] = { + [TranqRotate.iconTypeChat] = "{rt5}", + [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_5.blp:0|t" + }, + [COMBATLOG_OBJECT_RAIDTARGET6] = { + [TranqRotate.iconTypeChat] = "{rt6}", + [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_6.blp:0|t" + }, + [COMBATLOG_OBJECT_RAIDTARGET7] = { + [TranqRotate.iconTypeChat] = "{rt7}", + [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_7.blp:0|t" + }, + [COMBATLOG_OBJECT_RAIDTARGET8] = { + [TranqRotate.iconTypeChat] = "{rt8}", + [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_8.blp:0|t" + }, +} + +function TranqRotate:getRaidTargetIcon(flags, type) + local raidIconMask = bit.band(flags, COMBATLOG_OBJECT_RAIDTARGET_MASK) + if (TranqRotate.raidIconMaskToIcon[raidIconMask]) then + return TranqRotate.raidIconMaskToIcon[raidIconMask][type] + end + + return "" +end diff --git a/src/tranqRotate.lua b/src/tranqRotate.lua index 8ba40d7..45a04e8 100644 --- a/src/tranqRotate.lua +++ b/src/tranqRotate.lua @@ -69,7 +69,7 @@ function TranqRotate:printPrefixedMessage(msg) end -- Send a tranq announce message to a given channel -function TranqRotate:sendAnnounceMessage(message, targetName) +function TranqRotate:sendAnnounceMessage(message, targetName, raidIconFlags) -- Prints instead to avoid lua error in open world with say and yell if ( @@ -77,14 +77,15 @@ function TranqRotate:sendAnnounceMessage(message, targetName) TranqRotate.db.profile.channelType == "SAY" or TranqRotate.db.profile.channelType == "YELL" ) ) then + targetName = TranqRotate:getRaidTargetIconPrint(raidIconFlags, TranqRotate.iconTypePrint) .. targetName TranqRotate:printPrefixedMessage(string.format(message, targetName) .. " " .. L["YELL_SAY_DISABLED_OPEN_WORLD"]) return end if TranqRotate.db.profile.enableAnnounces then + targetName = TranqRotate:getRaidTargetIconChat(raidIconFlags, TranqRotate.iconTypeChat) .. targetName TranqRotate:sendMessage( - message, - targetName, + string.format(message, targetName), TranqRotate.db.profile.channelType, TranqRotate.db.profile.targetChannel ) @@ -104,12 +105,12 @@ function TranqRotate:sendRotationSetupBroadcastMessage(message) end -- Send a message to a given channel -function TranqRotate:sendMessage(message, targetName, channelType, targetChannel) +function TranqRotate:sendMessage(message, channelType, targetChannel) local channelNumber if channelType == "CHANNEL" then channelNumber = GetChannelName(targetChannel) end - SendChatMessage(string.format(message, targetName), channelType, nil, channelNumber or targetChannel) + SendChatMessage(message, channelType, nil, channelNumber or targetChannel) end SLASH_TRANQROTATE1 = "/tranq" From 40ce20b940e574b34eb09f550f591289a59d8c95 Mon Sep 17 00:00:00 2001 From: Slivo Date: Mon, 17 May 2021 16:40:23 +0200 Subject: [PATCH 02/13] Improve raid icon code --- src/raidIcons.lua | 53 +++++++++++++++------------------------------ src/tranqRotate.lua | 4 ++-- 2 files changed, 20 insertions(+), 37 deletions(-) diff --git a/src/raidIcons.lua b/src/raidIcons.lua index 2ea192e..1a6d18a 100644 --- a/src/raidIcons.lua +++ b/src/raidIcons.lua @@ -1,45 +1,28 @@ TranqRotate.iconTypeChat = "chat" TranqRotate.iconTypePrint = "print" -TranqRotate.raidIconMaskToIcon = { - [COMBATLOG_OBJECT_RAIDTARGET1] = { - [TranqRotate.iconTypeChat] = "{rt1}", - [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_1.blp:0|t" - }, - [COMBATLOG_OBJECT_RAIDTARGET2] = { - [TranqRotate.iconTypeChat] = "{rt2}", - [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_2.blp:0|t" - }, - [COMBATLOG_OBJECT_RAIDTARGET3] = { - [TranqRotate.iconTypeChat] = "{rt3}", - [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_3.blp:0|t" - }, - [COMBATLOG_OBJECT_RAIDTARGET4] = { - [TranqRotate.iconTypeChat] = "{rt4}", - [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_4.blp:0|t" - }, - [COMBATLOG_OBJECT_RAIDTARGET5] = { - [TranqRotate.iconTypeChat] = "{rt5}", - [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_5.blp:0|t" - }, - [COMBATLOG_OBJECT_RAIDTARGET6] = { - [TranqRotate.iconTypeChat] = "{rt6}", - [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_6.blp:0|t" - }, - [COMBATLOG_OBJECT_RAIDTARGET7] = { - [TranqRotate.iconTypeChat] = "{rt7}", - [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_7.blp:0|t" - }, - [COMBATLOG_OBJECT_RAIDTARGET8] = { - [TranqRotate.iconTypeChat] = "{rt8}", - [TranqRotate.iconTypePrint] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_8.blp:0|t" - }, +TranqRotate.raidIconMaskToIndex = { + [COMBATLOG_OBJECT_RAIDTARGET1] = 1, + [COMBATLOG_OBJECT_RAIDTARGET2] = 2, + [COMBATLOG_OBJECT_RAIDTARGET3] = 3, + [COMBATLOG_OBJECT_RAIDTARGET4] = 4, + [COMBATLOG_OBJECT_RAIDTARGET5] = 5, + [COMBATLOG_OBJECT_RAIDTARGET6] = 6, + [COMBATLOG_OBJECT_RAIDTARGET7] = 7, + [COMBATLOG_OBJECT_RAIDTARGET8] = 8, } +TranqRotate.chatIconString = "{rt%d}" +TranqRotate.printIconString = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_%d.blp:0|t" + function TranqRotate:getRaidTargetIcon(flags, type) local raidIconMask = bit.band(flags, COMBATLOG_OBJECT_RAIDTARGET_MASK) - if (TranqRotate.raidIconMaskToIcon[raidIconMask]) then - return TranqRotate.raidIconMaskToIcon[raidIconMask][type] + if (TranqRotate.raidIconMaskToIndex[raidIconMask]) then + if (type == TranqRotate.iconTypeChat) then + return string.format(TranqRotate.chatIconString, TranqRotate.raidIconMaskToIndex[raidIconMask]) + elseif (type == TranqRotate.iconTypePrint) then + return string.format(TranqRotate.printIconString, TranqRotate.raidIconMaskToIndex[raidIconMask]) + end end return "" diff --git a/src/tranqRotate.lua b/src/tranqRotate.lua index 45a04e8..be4c67e 100644 --- a/src/tranqRotate.lua +++ b/src/tranqRotate.lua @@ -77,13 +77,13 @@ function TranqRotate:sendAnnounceMessage(message, targetName, raidIconFlags) TranqRotate.db.profile.channelType == "SAY" or TranqRotate.db.profile.channelType == "YELL" ) ) then - targetName = TranqRotate:getRaidTargetIconPrint(raidIconFlags, TranqRotate.iconTypePrint) .. targetName + targetName = TranqRotate:getRaidTargetIcon(raidIconFlags, TranqRotate.iconTypePrint) .. targetName TranqRotate:printPrefixedMessage(string.format(message, targetName) .. " " .. L["YELL_SAY_DISABLED_OPEN_WORLD"]) return end if TranqRotate.db.profile.enableAnnounces then - targetName = TranqRotate:getRaidTargetIconChat(raidIconFlags, TranqRotate.iconTypeChat) .. targetName + targetName = TranqRotate:getRaidTargetIcon(raidIconFlags, TranqRotate.iconTypeChat) .. targetName TranqRotate:sendMessage( string.format(message, targetName), TranqRotate.db.profile.channelType, From 2ba50295436eb0326c81e815fcea8f05388f224c Mon Sep 17 00:00:00 2001 From: Slivo Date: Tue, 18 May 2021 23:18:57 +0200 Subject: [PATCH 03/13] Rework tranq announces, adds separate trash/boss messages --- locales/enUS.lua | 6 ++++-- locales/frFR.lua | 6 ++++-- locales/ruRU.lua | 6 ++++-- locales/zhCN.lua | 6 ++++-- locales/zhTW.lua | 6 ++++-- src/defaults.lua | 3 ++- src/events.lua | 10 ++++++++-- src/migration.lua | 5 +++++ src/raidIcons.lua | 14 +++----------- src/rotation.lua | 29 +++++++++++++++++++++++++++++ src/settings.lua | 16 +++++++++++----- src/tranqRotate.lua | 27 +++++++++++---------------- 12 files changed, 89 insertions(+), 45 deletions(-) diff --git a/locales/enUS.lua b/locales/enUS.lua index 0e93418..d76f3e9 100644 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -68,12 +68,14 @@ local L = { ---- Messages ["ANNOUNCES_MESSAGE_HEADER"] = "Announce messages", - ["SUCCESS_MESSAGE_LABEL"] = "Successful announce message", + ["BOSS_SUCCESS_MESSAGE_LABEL"] = "Successful announce message on boss (%s will be replaced by next hunter name)", + ["TRASH_SUCCESS_MESSAGE_LABEL"] = "Successful announce message on trash (%s will be replaced by target name)", ["FAIL_MESSAGE_LABEL"] = "Fail announce message", ["FAIL_WHISPER_LABEL"] = "Fail whisper message", ["UNABLE_TO_TRANQ_MESSAGE_LABEL"] = "Message whispered when you cannot tranq or call for backup", - ['DEFAULT_SUCCESS_ANNOUNCE_MESSAGE'] = "Tranqshot done on %s", + ['DEFAULT_BOSS_SUCCESS_ANNOUNCE_MESSAGE'] = "Tranqshot done, %s is next!", + ['DEFAULT_TRASH_SUCCESS_ANNOUNCE_MESSAGE'] = "Tranqshot done on %s", ['DEFAULT_FAIL_ANNOUNCE_MESSAGE'] = "!!! TRANQSHOT FAILED ON %s !!!", ['DEFAULT_FAIL_WHISPER_MESSAGE'] = "TRANQSHOT MISSED ! TRANQ NOW !", ['DEFAULT_UNABLE_TO_TRANQ_MESSAGE'] = "I'M UNABLE TO TRANQ ! TRANQ NOW !", diff --git a/locales/frFR.lua b/locales/frFR.lua index 14290c2..b41c4dd 100644 --- a/locales/frFR.lua +++ b/locales/frFR.lua @@ -70,12 +70,14 @@ local L = { ---- Messages ["ANNOUNCES_MESSAGE_HEADER"] = "Annonces de tir tranquilisant", - ["SUCCESS_MESSAGE_LABEL"] = "Message de réussite", + ["BOSS_SUCCESS_MESSAGE_LABEL"] = "Message de réussite sur boss (%s est le nom du prochain chasseur)", + ["TRASH_SUCCESS_MESSAGE_LABEL"] = "Message de réussite sur trash (%s est le nom de la cible)", ["FAIL_MESSAGE_LABEL"] = "Message d'échec", ["FAIL_WHISPER_LABEL"] = "Message d'échec chuchoté", ["UNABLE_TO_TRANQ_MESSAGE_LABEL"] = "Message chuchoté quand vous ne pouvez pas tranq ou que vous demandez un backup", - ['DEFAULT_SUCCESS_ANNOUNCE_MESSAGE'] = "Tir tranquillisant fait sur %s", + ['DEFAULT_BOSS_SUCCESS_ANNOUNCE_MESSAGE'] = "Tir tranquillisant fait, %s est le suivant!", + ['DEFAULT_TRASH_SUCCESS_ANNOUNCE_MESSAGE'] = "Tir tranquillisant fait sur %s", ['DEFAULT_FAIL_ANNOUNCE_MESSAGE'] = "!!! TIR TRANQUILLISANT RATE SUR %s !!!", ['DEFAULT_FAIL_WHISPER_MESSAGE'] = "TIR TRANQUILISANT RATE ! TRANQ MAINTENANT !", ['DEFAULT_UNABLE_TO_TRANQ_MESSAGE'] = "JE NE PEUX PAS TRANQ ! TRANQ MAINTENANT !", diff --git a/locales/ruRU.lua b/locales/ruRU.lua index e838c48..21cd52e 100644 --- a/locales/ruRU.lua +++ b/locales/ruRU.lua @@ -70,12 +70,14 @@ local L = { ---- Messages ["ANNOUNCES_MESSAGE_HEADER"] = "Сообщения оповещений", - ["SUCCESS_MESSAGE_LABEL"] = "При успехе сообщить", + ["BOSS_SUCCESS_MESSAGE_LABEL"] = "Successful announce message on boss (%s will be replaced by next hunter name)", + ["TRASH_SUCCESS_MESSAGE_LABEL"] = "Successful announce message on trash (%s will be replaced by target name)", ["FAIL_MESSAGE_LABEL"] = "При промахе сообщить", ["FAIL_WHISPER_LABEL"] = "При промахе шепнуть запасным", ["UNABLE_TO_TRANQ_MESSAGE_LABEL"] = "Сообщение шепота, когда вы не можете произвести усирение или оповестить запасных", - ['DEFAULT_SUCCESS_ANNOUNCE_MESSAGE'] = "Усмиряющий выстрел в %s", + ['DEFAULT_BOSS_SUCCESS_ANNOUNCE_MESSAGE'] = "Tranqshot done, %s is next!", + ['DEFAULT_TRASH_SUCCESS_ANNOUNCE_MESSAGE'] = "Tranqshot done on %s", ['DEFAULT_FAIL_ANNOUNCE_MESSAGE'] = "!!! Усмиряющий выстрел промахнулся в %s !!!", ['DEFAULT_FAIL_WHISPER_MESSAGE'] = "!!! Усмиряющий выстрел промахнулся !!! ! УСМИРЯЙ СЕЙЧАС !", ['DEFAULT_UNABLE_TO_TRANQ_MESSAGE'] = "Я НЕ МОГУ УСМИРИТЬ ! УСМИРЯЙ СЕЙЧАС !", diff --git a/locales/zhCN.lua b/locales/zhCN.lua index bcf5361..df2f113 100644 --- a/locales/zhCN.lua +++ b/locales/zhCN.lua @@ -70,12 +70,14 @@ local L = { ---- Messages ["ANNOUNCES_MESSAGE_HEADER"] = "通告信息", - ["SUCCESS_MESSAGE_LABEL"] = "施放成功通告信息", + ["BOSS_SUCCESS_MESSAGE_LABEL"] = "Successful announce message on boss (%s will be replaced by next hunter name)", + ["TRASH_SUCCESS_MESSAGE_LABEL"] = "Successful announce message on trash (%s will be replaced by target name)", ["FAIL_MESSAGE_LABEL"] = "施放失败通告信息", ["FAIL_WHISPER_LABEL"] = "施放失败私聊信息", ["UNABLE_TO_TRANQ_MESSAGE_LABEL"] = "当你无法宁神或呼叫替补时,这条信息就会低声传来", - ['DEFAULT_SUCCESS_ANNOUNCE_MESSAGE'] = "已对 %s 施放了宁神射击!", + ['DEFAULT_BOSS_SUCCESS_ANNOUNCE_MESSAGE'] = "Tranqshot done, %s is next!", + ['DEFAULT_TRASH_SUCCESS_ANNOUNCE_MESSAGE'] = "Tranqshot done on %s", ['DEFAULT_FAIL_ANNOUNCE_MESSAGE'] = "!!! 对 %s 宁神失败!!!", ['DEFAULT_FAIL_WHISPER_MESSAGE'] = "宁神失败 !! 赶紧补宁神!!", ['DEFAULT_UNABLE_TO_TRANQ_MESSAGE'] = "我无法宁神射击 ! 请现在宁神 !", diff --git a/locales/zhTW.lua b/locales/zhTW.lua index c37b83e..ddd413a 100644 --- a/locales/zhTW.lua +++ b/locales/zhTW.lua @@ -70,12 +70,14 @@ local L = { ---- Messages ["ANNOUNCES_MESSAGE_HEADER"] = "通告資訊", - ["SUCCESS_MESSAGE_LABEL"] = "施放成功通告資訊", + ["BOSS_SUCCESS_MESSAGE_LABEL"] = "Successful announce message on boss (%s will be replaced by next hunter name)", + ["TRASH_SUCCESS_MESSAGE_LABEL"] = "Successful announce message on trash (%s will be replaced by target name)", ["FAIL_MESSAGE_LABEL"] = "施放失敗通告資訊", ["FAIL_WHISPER_LABEL"] = "施放失敗私聊資訊", ["UNABLE_TO_TRANQ_MESSAGE_LABEL"] = "Message whispered when you cannot tranq or call for backup", - ['DEFAULT_SUCCESS_ANNOUNCE_MESSAGE'] = "已對 %s 施放了寧神射擊!", + ['DEFAULT_BOSS_SUCCESS_ANNOUNCE_MESSAGE'] = "Tranqshot done, %s is next!", + ['DEFAULT_TRASH_SUCCESS_ANNOUNCE_MESSAGE'] = "Tranqshot done on %s", ['DEFAULT_FAIL_ANNOUNCE_MESSAGE'] = "!!! 對 %s 寧神失敗!!!", ['DEFAULT_FAIL_WHISPER_MESSAGE'] = "寧神失敗 !! 趕緊補寧神!!", ['DEFAULT_UNABLE_TO_TRANQ_MESSAGE'] = "I'M UNABLE TO TRANQ ! TRANQ NOW !", diff --git a/src/defaults.lua b/src/defaults.lua index 559ce6c..d69010d 100644 --- a/src/defaults.lua +++ b/src/defaults.lua @@ -7,7 +7,8 @@ function TranqRotate:LoadDefaults() channelType = "YELL", rotationReportChannelType = "RAID", useMultilineRotationReport = false, - announceSuccessMessage = L["DEFAULT_SUCCESS_ANNOUNCE_MESSAGE"], + announceBossSuccessMessage = L["DEFAULT_BOSS_SUCCESS_ANNOUNCE_MESSAGE"], + announceTrashSuccessMessage = L["DEFAULT_TRASH_SUCCESS_ANNOUNCE_MESSAGE"], announceFailMessage = L["DEFAULT_FAIL_ANNOUNCE_MESSAGE"], whisperFailMessage = L["DEFAULT_FAIL_WHISPER_MESSAGE"], unableToTranqMessage = L["DEFAULT_UNABLE_TO_TRANQ_MESSAGE"], diff --git a/src/events.lua b/src/events.lua index bf1b757..fe18473 100644 --- a/src/events.lua +++ b/src/events.lua @@ -43,13 +43,19 @@ function TranqRotate:COMBAT_LOG_EVENT_UNFILTERED() TranqRotate:sendSyncTranq(hunter, false, timestamp) TranqRotate:rotate(hunter) if (sourceGUID == UnitGUID("player")) then - TranqRotate:sendAnnounceMessage(TranqRotate.db.profile.announceSuccessMessage, destName, destRaidFlags) + TranqRotate:sendAnnounceMessage( + TranqRotate:getTranqSuccessMessage( + TranqRotate:isTranqableBoss(destGUID), + destName, + destRaidFlags + ) + ) end elseif (event == "SPELL_MISSED" or event == "SPELL_DISPEL_FAILED") then TranqRotate:sendSyncTranq(hunter, true, timestamp, event) TranqRotate:handleFailTranq(hunter, event) if (sourceGUID == UnitGUID("player")) then - TranqRotate:sendAnnounceMessage(TranqRotate.db.profile.announceFailMessage, destName, destRaidFlags) + TranqRotate:sendAnnounceMessage(TranqRotate:getTranqFailMessage(destName, destRaidFlags)) end end end diff --git a/src/migration.lua b/src/migration.lua index e78114c..d097d6f 100644 --- a/src/migration.lua +++ b/src/migration.lua @@ -20,4 +20,9 @@ TranqRotate.migrations = { TranqRotate.db.profile.enableTimedBackupAlertValue = nil TranqRotate.db.profile.timedBackupAlertValueDelay = nil end, + -- 1.8.0 + function() + -- This is an old key + TranqRotate.db.profile.announceSuccessMessage = nil + end, } diff --git a/src/raidIcons.lua b/src/raidIcons.lua index 1a6d18a..170fde7 100644 --- a/src/raidIcons.lua +++ b/src/raidIcons.lua @@ -1,5 +1,4 @@ -TranqRotate.iconTypeChat = "chat" -TranqRotate.iconTypePrint = "print" +TranqRotate.chatIconString = "{rt%d}" TranqRotate.raidIconMaskToIndex = { [COMBATLOG_OBJECT_RAIDTARGET1] = 1, @@ -12,17 +11,10 @@ TranqRotate.raidIconMaskToIndex = { [COMBATLOG_OBJECT_RAIDTARGET8] = 8, } -TranqRotate.chatIconString = "{rt%d}" -TranqRotate.printIconString = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_%d.blp:0|t" - -function TranqRotate:getRaidTargetIcon(flags, type) +function TranqRotate:getRaidTargetIcon(flags) local raidIconMask = bit.band(flags, COMBATLOG_OBJECT_RAIDTARGET_MASK) if (TranqRotate.raidIconMaskToIndex[raidIconMask]) then - if (type == TranqRotate.iconTypeChat) then - return string.format(TranqRotate.chatIconString, TranqRotate.raidIconMaskToIndex[raidIconMask]) - elseif (type == TranqRotate.iconTypePrint) then - return string.format(TranqRotate.printIconString, TranqRotate.raidIconMaskToIndex[raidIconMask]) - end + return string.format(TranqRotate.chatIconString, TranqRotate.raidIconMaskToIndex[raidIconMask]) end return "" diff --git a/src/rotation.lua b/src/rotation.lua index 88ef101..86a2799 100644 --- a/src/rotation.lua +++ b/src/rotation.lua @@ -523,3 +523,32 @@ function TranqRotate:getHighlightedHunter() return nil end + +function TranqRotate:getTranqSuccessMessage(isBossTranq, targetName, raidIconFlags) + + local message = "" + if (isBossTranq) then + message = TranqRotate.db.profile.announceBossSuccessMessage + local hunter = TranqRotate:getHighlightedHunter() + message = string.format(message, hunter.name) + else + message = TranqRotate.db.profile.announceTrashSuccessMessage + message = string.format( + message, + TranqRotate:getRaidTargetIcon(raidIconFlags) .. targetName + ) + end + + return message +end + +function TranqRotate:getTranqFailMessage(targetName, raidIconFlags) + + local message = TranqRotate.db.profile.announceFailMessage + message = string.format( + message, + TranqRotate:getRaidTargetIcon(raidIconFlags) .. targetName + ) + + return message +end diff --git a/src/settings.lua b/src/settings.lua index 814ba1b..9a4dbc1 100644 --- a/src/settings.lua +++ b/src/settings.lua @@ -214,28 +214,34 @@ function TranqRotate:CreateConfig() width = "normal", order = 22, }, - announceSuccessMessage = { - name = L["SUCCESS_MESSAGE_LABEL"], + announceBossSuccessMessage = { + name = L["BOSS_SUCCESS_MESSAGE_LABEL"], type = "input", order = 23, width = "double", }, + announceTrashSuccessMessage = { + name = L["TRASH_SUCCESS_MESSAGE_LABEL"], + type = "input", + order = 24, + width = "double", + }, announceFailMessage = { name = L["FAIL_MESSAGE_LABEL"], type = "input", - order = 24, + order = 25, width = "double", }, whisperFailMessage = { name = L["FAIL_WHISPER_LABEL"], type = "input", - order = 25, + order = 26, width = "double", }, unableToTranqMessage = { name = L["UNABLE_TO_TRANQ_MESSAGE_LABEL"], type = "input", - order = 26, + order = 27, width = "double", }, setupBroadcastHeader = { diff --git a/src/tranqRotate.lua b/src/tranqRotate.lua index be4c67e..161cfae 100644 --- a/src/tranqRotate.lua +++ b/src/tranqRotate.lua @@ -69,23 +69,19 @@ function TranqRotate:printPrefixedMessage(msg) end -- Send a tranq announce message to a given channel -function TranqRotate:sendAnnounceMessage(message, targetName, raidIconFlags) - - -- Prints instead to avoid lua error in open world with say and yell - if ( - not IsInInstance() and ( - TranqRotate.db.profile.channelType == "SAY" or TranqRotate.db.profile.channelType == "YELL" - ) - ) then - targetName = TranqRotate:getRaidTargetIcon(raidIconFlags, TranqRotate.iconTypePrint) .. targetName - TranqRotate:printPrefixedMessage(string.format(message, targetName) .. " " .. L["YELL_SAY_DISABLED_OPEN_WORLD"]) - return - end - +function TranqRotate:sendAnnounceMessage(chatMessage) if TranqRotate.db.profile.enableAnnounces then - targetName = TranqRotate:getRaidTargetIcon(raidIconFlags, TranqRotate.iconTypeChat) .. targetName + -- Prints instead to avoid lua error in open world with say and yell + if ( + not IsInInstance() and + (TranqRotate.db.profile.channelType == "SAY" or TranqRotate.db.profile.channelType == "YELL") + ) then + TranqRotate:printPrefixedMessage(chatMessage .. " " .. L["YELL_SAY_DISABLED_OPEN_WORLD"]) + return + end + TranqRotate:sendMessage( - string.format(message, targetName), + chatMessage, TranqRotate.db.profile.channelType, TranqRotate.db.profile.targetChannel ) @@ -97,7 +93,6 @@ function TranqRotate:sendRotationSetupBroadcastMessage(message) if TranqRotate.db.profile.enableAnnounces then TranqRotate:sendMessage( message, - nil, TranqRotate.db.profile.rotationReportChannelType, TranqRotate.db.profile.setupBroadcastTargetChannel ) From 29e62e87d72ee2a2d423269111d570a563b24340 Mon Sep 17 00:00:00 2001 From: Slivo Date: Wed, 19 May 2021 13:36:53 +0200 Subject: [PATCH 04/13] Fix rotation chat print being disabled by enable announce setting --- src/tranqRotate.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/tranqRotate.lua b/src/tranqRotate.lua index 161cfae..b4dcf88 100644 --- a/src/tranqRotate.lua +++ b/src/tranqRotate.lua @@ -90,13 +90,11 @@ end -- Send a rotation broadcast message function TranqRotate:sendRotationSetupBroadcastMessage(message) - if TranqRotate.db.profile.enableAnnounces then - TranqRotate:sendMessage( - message, - TranqRotate.db.profile.rotationReportChannelType, - TranqRotate.db.profile.setupBroadcastTargetChannel - ) - end + TranqRotate:sendMessage( + message, + TranqRotate.db.profile.rotationReportChannelType, + TranqRotate.db.profile.setupBroadcastTargetChannel + ) end -- Send a message to a given channel From 4eea6b9a04a7ea4684d9d2c2e0cff32a1429be05 Mon Sep 17 00:00:00 2001 From: Slivo Date: Mon, 24 May 2021 01:27:06 +0200 Subject: [PATCH 05/13] Removes server name from hunter name on connected realms --- src/frames.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frames.lua b/src/frames.lua index d6e2ee3..5ecae4c 100644 --- a/src/frames.lua +++ b/src/frames.lua @@ -153,7 +153,7 @@ function TranqRotate:createHunterFrame(hunter, parentFrame) hunter.frame.text = hunter.frame:CreateFontString(nil, "ARTWORK") hunter.frame.text:SetFont(TranqRotate:getPlayerNameFont(), 12) hunter.frame.text:SetPoint("LEFT",5,0) - hunter.frame.text:SetText(hunter.name) + hunter.frame.text:SetText(strsplit("-", hunter.name)) TranqRotate:createCooldownFrame(hunter) TranqRotate:createBlindIconFrame(hunter) From 5d57b66540591c52a3c43cafa6fee709e5480cd0 Mon Sep 17 00:00:00 2001 From: Slivo Date: Mon, 24 May 2021 11:40:17 +0200 Subject: [PATCH 06/13] 1.8.0 changelog --- changelog.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/changelog.md b/changelog.md index 14bb4de..345dd42 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ ## TranqRotate Changelog +#### v1.8.0 + +- Adds different announces messages for boss and trash (Boss announces can call next player, trash announces can call target) +- Adds raid market symbol to chat tranq announces +- Removes server suffix from hunter names on era connected realms + #### v1.7.0 - Adds an icon on hunter not using the addon (You can disable it in the settings) From da78d6036558f44dd79e2cd0e4a7f835ed161881 Mon Sep 17 00:00:00 2001 From: Slivo Date: Mon, 24 May 2021 11:41:19 +0200 Subject: [PATCH 07/13] Update readme --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 1202227..469470c 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,8 @@ The `/tranq check` command allows you to list version or TranqRotate used by oth Here is a list of feature I want to implement at some point, no specific order is decided yet. -- Automatic handling of death and disconnection of hunters on the rotation group (swap with a backup, send an alert about it) -- Use raid symbols to mark hunters that need to tranq, or that need to backup a failed tranqshot - Automatic reset of rotation when raid wipe +- Customization of the tranq window, size, textures, colors, fonts... ## Download From 727cc87bddceb06323e46b7ee32bd643e6914be5 Mon Sep 17 00:00:00 2001 From: Slivo Date: Mon, 24 May 2021 11:41:36 +0200 Subject: [PATCH 08/13] Increase toc version --- TranqRotate.toc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TranqRotate.toc b/TranqRotate.toc index 65eb96e..a48dabf 100644 --- a/TranqRotate.toc +++ b/TranqRotate.toc @@ -1,8 +1,8 @@ ## Interface: 11307 -## Title: TranqRotate |cff00aa001.7.0|r +## Title: TranqRotate |cff00aa001.8.0|r ## Notes: A tranqshot rotation assistant ## Author: Slivo -## Version: 1.7.0 +## Version: 1.8.0 ## SavedVariables: TranqRotateDb ## OptionalDeps: Ace3 From 0c37ac18a8215439136e32309fd4d06cb9c62e1a Mon Sep 17 00:00:00 2001 From: Slivo Date: Thu, 27 May 2021 08:38:18 +0200 Subject: [PATCH 09/13] Refactor getHunter to prepare for breaking changes --- src/events.lua | 2 +- src/rotation.lua | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/events.lua b/src/events.lua index fe18473..764a4e9 100644 --- a/src/events.lua +++ b/src/events.lua @@ -37,7 +37,7 @@ function TranqRotate:COMBAT_LOG_EVENT_UNFILTERED() local spellId, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand = select(12, CombatLogGetCurrentEventInfo()) if (spellName == tranqShot or (TranqRotate.testMode and spellName == arcaneShot)) then - local hunter = TranqRotate:getHunter(nil, sourceGUID) + local hunter = TranqRotate:getHunter(sourceGUID) if (hunter) then if (event == "SPELL_CAST_SUCCESS") then TranqRotate:sendSyncTranq(hunter, false, timestamp) diff --git a/src/rotation.lua b/src/rotation.lua index 86a2799..37e7972 100644 --- a/src/rotation.lua +++ b/src/rotation.lua @@ -145,7 +145,7 @@ function TranqRotate:isPlayerNextTranq() return false end - local player = TranqRotate:getHunter(nil, UnitGUID("player")) + local player = TranqRotate:getHunter(UnitGUID("player")) if (not player.nextTranq) then @@ -250,10 +250,10 @@ function TranqRotate:testRotation() end -- Return our hunter object from name or GUID -function TranqRotate:getHunter(name, GUID) +function TranqRotate:getHunter(searchTerm) - for key,hunter in pairs(TranqRotate.hunterTable) do - if ((GUID ~= nil and hunter.GUID == GUID) or (name ~= nil and hunter.name == name)) then + for _, hunter in pairs(TranqRotate.hunterTable) do + if (searchTerm ~= nil and (hunter.GUID == searchTerm or hunter.name == searchTerm)) then return hunter end end @@ -293,7 +293,7 @@ function TranqRotate:updateRaidStatus() -- Players name might be nil at loading if (name ~= nil) then if(TranqRotate:isHunter(name)) then - local hunter = TranqRotate:getHunter(nil, UnitGUID(name)) + local hunter = TranqRotate:getHunter(UnitGUID(name)) if (hunter == nil and not InCombatLockdown()) then hunter = TranqRotate:registerHunter(name) @@ -447,8 +447,8 @@ function TranqRotate:applyRotationConfiguration(rotationsTables) group = 'BACKUP' end - for index, hunterName in pairs(rotationTable) do - local hunter = TranqRotate:getHunter(hunterName) + for index, GUID in pairs(rotationTable) do + local hunter = TranqRotate:getHunter(GUID) if (hunter) then TranqRotate:moveHunter(hunter, group, index) end From 79a4b89c67a61829bb2a2010588419f271fab5de Mon Sep 17 00:00:00 2001 From: Slivo Date: Thu, 27 May 2021 09:59:38 +0200 Subject: [PATCH 10/13] Adds update available text notifications --- locales/enUS.lua | 4 +++ locales/frFR.lua | 4 +++ locales/ruRU.lua | 4 +++ locales/zhCN.lua | 4 +++ locales/zhTW.lua | 4 +++ src/tranqRotate.lua | 59 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 79 insertions(+) diff --git a/locales/enUS.lua b/locales/enUS.lua index d76f3e9..2ab2422 100644 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -105,6 +105,10 @@ local L = { ["TOOLTIP_PLAYER_WITHOUT_ADDON"] = "This player does not use TranqRotate", ["TOOLTIP_MAY_RUN_OUDATED_VERSION"] = "Or runs an outdated version below 1.6.0", ["TOOLTIP_DISABLE_SETTINGS"] = "(You can disable this icon and/or this tooltip in the settings)", + + --- Available update + ["UPDATE_AVAILABLE"] = "A new TranqRotate version is available, update to get latest features", + ["BREAKING_UPDATE_AVAILABLE"] = "A new BREAKING TranqRotate update is available, you MUST update AS SOON AS possible! TranqRotate may not work properly with up-to-date version users.", } TranqRotate.L = L diff --git a/locales/frFR.lua b/locales/frFR.lua index b41c4dd..5cb04ad 100644 --- a/locales/frFR.lua +++ b/locales/frFR.lua @@ -107,6 +107,10 @@ local L = { ["TOOLTIP_PLAYER_WITHOUT_ADDON"] = "Ce joueur n'utilise pas TranqRotate", ["TOOLTIP_MAY_RUN_OUDATED_VERSION"] = "Ou possède une version obsolète inférieure à 1.6.0", ["TOOLTIP_DISABLE_SETTINGS"] = "(Il est possible de désactiver l'icone et/ou l'infobulle dans les options)", + + --- Available update + ["UPDATE_AVAILABLE"] = "Une nouvelle version est disponible, faites la mise à jour pour profiter des derniers ajouts", + ["BREAKING_UPDATE_AVAILABLE"] = "Une nouvelle version MAJEURE est disponible, vous DEVEZ faire la mise à jour le plus rapidement possible! Votre version pourrait ne pas fonctionner correctement avec celle des utilisateurs disposant de la mise à jour.", } TranqRotate.L = L diff --git a/locales/ruRU.lua b/locales/ruRU.lua index 21cd52e..9d7b33e 100644 --- a/locales/ruRU.lua +++ b/locales/ruRU.lua @@ -107,6 +107,10 @@ local L = { ["TOOLTIP_PLAYER_WITHOUT_ADDON"] = "Этот игрок не использует TranqRotate", ["TOOLTIP_MAY_RUN_OUDATED_VERSION"] = "Или используется версия ниже 1.6.0", ["TOOLTIP_DISABLE_SETTINGS"] = "(Вы можете отключить этот значок и/или эту подсказку в настройках)", + + --- Available update + ["UPDATE_AVAILABLE"] = "A new TranqRotate version is available, update to get latest features", + ["BREAKING_UPDATE_AVAILABLE"] = "A new BREAKING TranqRotate update is available, you MUST update AS SOON AS possible! TranqRotate may not work properly with up-to-date version users.", } TranqRotate.L = L diff --git a/locales/zhCN.lua b/locales/zhCN.lua index df2f113..95c19de 100644 --- a/locales/zhCN.lua +++ b/locales/zhCN.lua @@ -107,6 +107,10 @@ local L = { ["TOOLTIP_PLAYER_WITHOUT_ADDON"] = "此玩家没有使用TranqRotate插件", ["TOOLTIP_MAY_RUN_OUDATED_VERSION"] = "或者运行低于1.6.0的过时版本", ["TOOLTIP_DISABLE_SETTINGS"] = "(您可以在设置中禁用此图标或此工具提示)", + + --- Available update + ["UPDATE_AVAILABLE"] = "A new TranqRotate version is available, update to get latest features", + ["BREAKING_UPDATE_AVAILABLE"] = "A new BREAKING TranqRotate update is available, you MUST update AS SOON AS possible! TranqRotate may not work properly with up-to-date version users.", } TranqRotate.L = L diff --git a/locales/zhTW.lua b/locales/zhTW.lua index ddd413a..973b902 100644 --- a/locales/zhTW.lua +++ b/locales/zhTW.lua @@ -107,6 +107,10 @@ local L = { ["TOOLTIP_PLAYER_WITHOUT_ADDON"] = "This player does not use TranqRotate", ["TOOLTIP_MAY_RUN_OUDATED_VERSION"] = "Or runs an outdated version below 1.6.0", ["TOOLTIP_DISABLE_SETTINGS"] = "(You can disable this icon and/or this tooltip in the settings)", + + --- Available update + ["UPDATE_AVAILABLE"] = "A new TranqRotate version is available, update to get latest features", + ["BREAKING_UPDATE_AVAILABLE"] = "A new BREAKING TranqRotate update is available, you MUST update AS SOON AS possible! TranqRotate may not work properly with up-to-date version users.", } TranqRotate.L = L diff --git a/src/tranqRotate.lua b/src/tranqRotate.lua index b4dcf88..d8bdbcd 100644 --- a/src/tranqRotate.lua +++ b/src/tranqRotate.lua @@ -242,6 +242,11 @@ function TranqRotate:updatePlayerAddonVersion(player, version) if (hunter) then TranqRotate:updateBlindIcon(hunter) end + + local updateRequired, breakingUpdate = TranqRotate:isUpdateRequired(version) + if (updateRequired) then + TranqRotate:notifyUserAboutAvailableUpdate(breakingUpdate) + end end -- Prints to the chat the addon version of every hunter and addon users @@ -304,3 +309,57 @@ function TranqRotate:runDemo() 5 ) end + +-- Parse version string +-- @return major, minor, fix, isStable +function TranqRotate:parseVersionString(versionString) + + local version, type = strsplit("-", versionString) + local major, minor, fix = strsplit( ".", version) + + return tonumber(major), tonumber(minor), tonumber(fix), type == nil +end + +-- Check if the given version would require updating +-- @return requireUpdate, breakingUpdate +function TranqRotate:isUpdateRequired(versionString) + + local remoteMajor, remoteMinor, remoteFix, isRemoteStable = self:parseVersionString(versionString) + local localMajor, localMinor, localFix, isLocalStable = self:parseVersionString(TranqRotate.version) + + if (isRemoteStable) then + + if (remoteMajor > localMajor) then + return true, true + elseif (remoteMajor < localMajor) then + return false, false + end + + if (remoteMinor > localMinor) then + return true, false + elseif (remoteMinor < localMinor) then + return false, false + end + + if (remoteFix > localFix) then + return true, false + end + end + + return false, false +end + +-- Notify user about a new version available +function TranqRotate:notifyUserAboutAvailableUpdate(isBreakingUpdate) + if (isBreakingUpdate) then + if (TranqRotate.notifiedBreakingUpdate ~= true) then + TranqRotate:printPrefixedMessage('|cffff3d3d' .. L['BREAKING_UPDATE_AVAILABLE'] .. '|r') + TranqRotate.notifiedBreakingUpdate = true + end + else + if (TranqRotate.notifiedUpdate ~= true and TranqRotate.notifiedBreakingUpdate ~= true) then + TranqRotate:printPrefixedMessage(L['UPDATE_AVAILABLE']) + TranqRotate.notifiedUpdate = true + end + end +end \ No newline at end of file From 24df93835da608338b35128d824328094b53f714 Mon Sep 17 00:00:00 2001 From: Slivo Date: Thu, 27 May 2021 10:00:44 +0200 Subject: [PATCH 11/13] Update changelog --- changelog.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 345dd42..3a8a151 100644 --- a/changelog.md +++ b/changelog.md @@ -3,8 +3,9 @@ #### v1.8.0 - Adds different announces messages for boss and trash (Boss announces can call next player, trash announces can call target) -- Adds raid market symbol to chat tranq announces +- Adds raid marker symbol to chat tranq announces - Removes server suffix from hunter names on era connected realms +- Adds "available update" chat notifications #### v1.7.0 From d41ec0ba1ee304cb49bc5f7a92c5419b7944b9e4 Mon Sep 17 00:00:00 2001 From: Slivo Date: Thu, 27 May 2021 11:08:56 +0200 Subject: [PATCH 12/13] Update message after rotation reception message --- src/comms.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/comms.lua b/src/comms.lua index 562f55c..a311db3 100644 --- a/src/comms.lua +++ b/src/comms.lua @@ -148,7 +148,6 @@ end function TranqRotate:receiveSyncOrder(prefix, message, channel, sender) TranqRotate:updateRaidStatus() - TranqRotate:updatePlayerAddonVersion(sender, message.addonVersion) if (TranqRotate:isVersionEligible(message.version, sender)) then TranqRotate.syncVersion = (message.version) @@ -158,6 +157,8 @@ function TranqRotate:receiveSyncOrder(prefix, message, channel, sender) TranqRotate:printPrefixedMessage('Received new rotation configuration from ' .. sender) TranqRotate:applyRotationConfiguration(message.rotation) end + + TranqRotate:updatePlayerAddonVersion(sender, message.addonVersion) end -- Request to send current roration configuration received From b6c39faea667ecbd56b312f83d9160daf4d6a67a Mon Sep 17 00:00:00 2001 From: Slivo Date: Thu, 27 May 2021 11:09:29 +0200 Subject: [PATCH 13/13] Update changelog --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 3a8a151..adf728e 100644 --- a/changelog.md +++ b/changelog.md @@ -4,8 +4,8 @@ - Adds different announces messages for boss and trash (Boss announces can call next player, trash announces can call target) - Adds raid marker symbol to chat tranq announces -- Removes server suffix from hunter names on era connected realms - Adds "available update" chat notifications +- Removes server suffix from hunter names on era connected realms #### v1.7.0