Skip to content

Commit b2e4e11

Browse files
committed
Fix SelfBot PR review issues and localized action errors
1 parent 9342fbb commit b2e4e11

11 files changed

Lines changed: 185 additions & 5 deletions

Core/MultiBotComm.lua

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5406,6 +5406,31 @@ function Comm.HandleSelfActionAddonMessage(opcode, payload, state)
54065406

54075407
return true
54085408
end
5409+
5410+
function Comm.HandleSelfActionProtocolError(requestType, token, reason, state)
5411+
if requestType ~= "SELF_ACTION" then
5412+
return false
5413+
end
5414+
5415+
state = type(state) == "table" and state or ensureBridgeState()
5416+
token = trim(token)
5417+
local pending = state.selfActionCommands[token]
5418+
if type(pending) ~= "table" then
5419+
return true
5420+
end
5421+
5422+
state.selfActionCommands[token] = nil
5423+
local failureReason = reason or "PROTOCOL_ERROR"
5424+
state.lastError = "SELF_ACTION_" .. failureReason
5425+
if type(pending.callback) == "function" then
5426+
pending.callback({
5427+
status = "error",
5428+
action = pending.action,
5429+
reason = failureReason,
5430+
})
5431+
end
5432+
return true
5433+
end
54095434
-- MB_SELFBOT_ACTION_V1_END
54105435
-- MB_SELFBOT_STRATEGY_V1_RX_HELPER_BEGIN
54115436
function Comm.HandleSelfStrategyAddonMessage(opcode, payload, state)
@@ -5467,11 +5492,27 @@ function Comm.HandleSelfStrategyProtocolError(requestType, token, reason, state)
54675492
return true
54685493
end
54695494
-- MB_SELFBOT_STRATEGY_V1_RX_HELPER_END
5495+
function Comm.IsExpectedBridgeSender(sender)
5496+
local expectedSender = getPlayerName()
5497+
local senderName = trim(sender or "")
5498+
senderName = string.gsub(senderName, "%-.*$", "")
5499+
if not expectedSender or string.lower(senderName) ~= string.lower(expectedSender) then
5500+
debugPrint("ADDON:RX:DROP", "SENDER", sender or "")
5501+
return false
5502+
end
5503+
5504+
return true
5505+
end
5506+
54705507
function Comm.HandleAddonMessage(prefix, message, distribution, sender)
54715508
if prefix ~= Comm.prefix then
54725509
return false
54735510
end
54745511

5512+
if not Comm.IsExpectedBridgeSender(sender) then
5513+
return true
5514+
end
5515+
54755516
local state = ensureBridgeState()
54765517
local opcode, payload = splitOnce(message or "", "~")
54775518
opcode = string.upper(trim(opcode))
@@ -7710,6 +7751,8 @@ state.selfActionCapable = false
77107751
if requestType and isValidStateToken(token) and reason then
77117752
if Comm.HandleSelfBotProtocolError(requestType, token, reason, state) then
77127753
return true
7754+
elseif Comm.HandleSelfActionProtocolError(requestType, token, reason, state) then
7755+
return true
77137756
elseif Comm.HandleSelfStrategyProtocolError(requestType, token, reason, state) then
77147757
return true
77157758
elseif requestType == "GROUP_ROLL" and state.groupRollCommands[token] then

Core/MultiBotEngine.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,8 +720,8 @@ MultiBot.RequestUnitStrategyState = function(pTarget)
720720
and MultiBot.bridge.connected == true
721721
and MultiBot.Comm
722722
and type(MultiBot.Comm.RequestSelfStrategyState) == "function") then
723-
MultiBot.Comm.RequestSelfStrategyState()
724-
return true
723+
local request = MultiBot.Comm.RequestSelfStrategyState()
724+
return request ~= false and request ~= nil
725725
end
726726
return false
727727
end

Core/MultiBotEvery.lua

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
11
local showEveryMessage
22

3+
local function selfActionReasonText(reason)
4+
local reasonCode = tostring(reason or "UNKNOWN")
5+
if reasonCode == "RATE_LIMIT" then
6+
return MultiBot.L("selfaction.reason.RATE_LIMIT")
7+
end
8+
return reasonCode
9+
end
10+
311
local function runEverySelfAction(action, argument)
412
local comm = MultiBot and MultiBot.Comm or nil
513
if not (comm and type(comm.RunSelfAction) == "function") then
614
if showEveryMessage then
7-
showEveryMessage("Bridge unavailable: SelfBot action was not sent.")
15+
showEveryMessage(MultiBot.L("selfaction.bridge_unavailable"))
816
end
917
return false
1018
end
1119

1220
local token = comm.RunSelfAction(action, argument or "", function(result)
1321
if type(result) == "table" and result.status ~= "ok" and showEveryMessage then
14-
showEveryMessage("SelfBot action failed: " .. tostring(result.reason or "UNKNOWN"))
22+
local reasonText = selfActionReasonText(result.reason)
23+
showEveryMessage(string.format(MultiBot.L("selfaction.failed"), reasonText))
1524
end
1625
end)
1726
if not token and showEveryMessage then
1827
local reason = MultiBot and MultiBot.bridge and MultiBot.bridge.lastError or "UNAVAILABLE"
19-
showEveryMessage("SelfBot action was not sent: " .. tostring(reason))
28+
showEveryMessage(string.format(MultiBot.L("selfaction.send_failed"), selfActionReasonText(reason)))
2029
end
2130
return token and true or false
2231
end

Locales/MultiBotAceLocale-deDE.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ if type(register) ~= "function" then
44
end
55

66
local deDEValues = {
7+
-- MB_SELFACTION_I18N_V1_BEGIN
8+
["selfaction.bridge_unavailable"] = "Die Bridge ist nicht verfügbar: Die SelfBot-Aktion wurde nicht gesendet.",
9+
["selfaction.failed"] = "SelfBot-Aktion fehlgeschlagen: %s",
10+
["selfaction.send_failed"] = "Die SelfBot-Aktion konnte nicht gesendet werden: %s",
11+
["selfaction.reason.RATE_LIMIT"] = "Zu viele SelfBot-Anfragen. Bitte in einigen Sekunden erneut versuchen.",
12+
-- MB_SELFACTION_I18N_V1_END
713
["lootmaster.title"] = "MultiBot Plündermeister",
814
["lootmaster.refresh"] = "Aktualisieren",
915
["lootmaster.assign_to"] = "Zuweisen an:",
@@ -1185,6 +1191,16 @@ local deDEValues = {
11851191
["strategy.reason.PARTIAL"] = "Der Strategiebefehl wurde nur teilweise angewendet.",
11861192
["strategy.reason.FAILED"] = "Der Strategiebefehl ist fehlgeschlagen.",
11871193
["strategy.reason.ACK_TOO_LONG"] = "Die Strategiebestätigung ist zu groß.",
1194+
["strategy.reason.SELF_STRATEGY_BRIDGE_UNAVAILABLE"] = "Die Bridge-Unterstützung für SelfBot-Strategien ist nicht verfügbar.",
1195+
["strategy.reason.SELF_STRATEGY_NOT_CONNECTED"] = "Die Bridge ist nicht verbunden.",
1196+
["strategy.reason.SELF_BOT_CAPABILITY_UNAVAILABLE"] = "SelfBot-Unterstützung ist auf der Bridge nicht verfügbar.",
1197+
["strategy.reason.SELF_STRATEGY_CAPABILITY_UNAVAILABLE"] = "SelfBot-Strategieunterstützung ist auf der Bridge nicht verfügbar.",
1198+
["strategy.reason.SELF_STRATEGY_NOT_ACTIVE"] = "SelfBot ist nicht aktiv.",
1199+
["strategy.reason.SELF_STRATEGY_CLIENT_UNAVAILABLE"] = "Das Addon kann keine SelfBot-Strategiebefehle senden.",
1200+
["strategy.reason.SELF_STRATEGY_UNAVAILABLE"] = "Die SelfBot-Strategiesteuerung ist nicht verfügbar.",
1201+
["strategy.reason.SELF_STRATEGY_INVALID_RESULT"] = "Die Bridge hat ein ungültiges SelfBot-Strategieergebnis zurückgegeben.",
1202+
["strategy.reason.SELF_STRATEGY_SEND_FAILED"] = "Der SelfBot-Strategiebefehl konnte nicht gesendet werden.",
1203+
["strategy.reason.SELF_STRATEGY_REJECTED"] = "Der SelfBot-Strategiebefehl wurde abgelehnt.",
11881204
["strategy.reason.UNKNOWN"] = "Der Strategiebefehl ist aus unbekanntem Grund fehlgeschlagen.",
11891205
["info.outfits.feedback_equip"] = "Outfit „%s“ ausgerüstet.",
11901206
["info.outfits.feedback_replace"] = "Outfit „%s“ ersetzt.",

Locales/MultiBotAceLocale-enGB.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ if type(register) ~= "function" then
44
end
55

66
local enGBValues = {
7+
-- MB_SELFACTION_I18N_V1_BEGIN
8+
["selfaction.bridge_unavailable"] = "The bridge is unavailable: the SelfBot action was not sent.",
9+
["selfaction.failed"] = "SelfBot action failed: %s",
10+
["selfaction.send_failed"] = "The SelfBot action could not be sent: %s",
11+
["selfaction.reason.RATE_LIMIT"] = "Too many SelfBot requests. Try again in a few seconds.",
12+
-- MB_SELFACTION_I18N_V1_END
713
["lootmaster.title"] = "MultiBot Loot Master",
814
["lootmaster.refresh"] = "Refresh",
915
["lootmaster.assign_to"] = "Assign to:",
@@ -1188,6 +1194,16 @@ local enGBValues = {
11881194
["strategy.reason.PARTIAL"] = "The strategy command was only partially applied.",
11891195
["strategy.reason.FAILED"] = "The strategy command failed.",
11901196
["strategy.reason.ACK_TOO_LONG"] = "The strategy acknowledgement was too large.",
1197+
["strategy.reason.SELF_STRATEGY_BRIDGE_UNAVAILABLE"] = "Bridge support for SelfBot strategies is unavailable.",
1198+
["strategy.reason.SELF_STRATEGY_NOT_CONNECTED"] = "The bridge is not connected.",
1199+
["strategy.reason.SELF_BOT_CAPABILITY_UNAVAILABLE"] = "SelfBot support is unavailable on the bridge.",
1200+
["strategy.reason.SELF_STRATEGY_CAPABILITY_UNAVAILABLE"] = "SelfBot strategy support is unavailable on the bridge.",
1201+
["strategy.reason.SELF_STRATEGY_NOT_ACTIVE"] = "SelfBot is not active.",
1202+
["strategy.reason.SELF_STRATEGY_CLIENT_UNAVAILABLE"] = "The addon cannot send SelfBot strategy commands.",
1203+
["strategy.reason.SELF_STRATEGY_UNAVAILABLE"] = "SelfBot strategy control is unavailable.",
1204+
["strategy.reason.SELF_STRATEGY_INVALID_RESULT"] = "The bridge returned an invalid SelfBot strategy result.",
1205+
["strategy.reason.SELF_STRATEGY_SEND_FAILED"] = "The SelfBot strategy command could not be sent.",
1206+
["strategy.reason.SELF_STRATEGY_REJECTED"] = "The SelfBot strategy command was rejected.",
11911207
["strategy.reason.UNKNOWN"] = "The strategy command failed for an unknown reason.",
11921208
["info.outfits.feedback_equip"] = "Outfit \"%s\" equipped.",
11931209
["info.outfits.feedback_replace"] = "Outfit \"%s\" replaced.",

Locales/MultiBotAceLocale-enUS.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ if type(register) ~= "function" then
44
end
55

66
local enUSValues = {
7+
-- MB_SELFACTION_I18N_V1_BEGIN
8+
["selfaction.bridge_unavailable"] = "The bridge is unavailable: the SelfBot action was not sent.",
9+
["selfaction.failed"] = "SelfBot action failed: %s",
10+
["selfaction.send_failed"] = "The SelfBot action could not be sent: %s",
11+
["selfaction.reason.RATE_LIMIT"] = "Too many SelfBot requests. Try again in a few seconds.",
12+
-- MB_SELFACTION_I18N_V1_END
713
["lootmaster.title"] = "MultiBot Loot Master",
814
["lootmaster.refresh"] = "Refresh",
915
["lootmaster.assign_to"] = "Assign to:",
@@ -1188,6 +1194,16 @@ local enUSValues = {
11881194
["strategy.reason.PARTIAL"] = "The strategy command was only partially applied.",
11891195
["strategy.reason.FAILED"] = "The strategy command failed.",
11901196
["strategy.reason.ACK_TOO_LONG"] = "The strategy acknowledgement was too large.",
1197+
["strategy.reason.SELF_STRATEGY_BRIDGE_UNAVAILABLE"] = "Bridge support for SelfBot strategies is unavailable.",
1198+
["strategy.reason.SELF_STRATEGY_NOT_CONNECTED"] = "The bridge is not connected.",
1199+
["strategy.reason.SELF_BOT_CAPABILITY_UNAVAILABLE"] = "SelfBot support is unavailable on the bridge.",
1200+
["strategy.reason.SELF_STRATEGY_CAPABILITY_UNAVAILABLE"] = "SelfBot strategy support is unavailable on the bridge.",
1201+
["strategy.reason.SELF_STRATEGY_NOT_ACTIVE"] = "SelfBot is not active.",
1202+
["strategy.reason.SELF_STRATEGY_CLIENT_UNAVAILABLE"] = "The addon cannot send SelfBot strategy commands.",
1203+
["strategy.reason.SELF_STRATEGY_UNAVAILABLE"] = "SelfBot strategy control is unavailable.",
1204+
["strategy.reason.SELF_STRATEGY_INVALID_RESULT"] = "The bridge returned an invalid SelfBot strategy result.",
1205+
["strategy.reason.SELF_STRATEGY_SEND_FAILED"] = "The SelfBot strategy command could not be sent.",
1206+
["strategy.reason.SELF_STRATEGY_REJECTED"] = "The SelfBot strategy command was rejected.",
11911207
["strategy.reason.UNKNOWN"] = "The strategy command failed for an unknown reason.",
11921208
["info.outfits.feedback_equip"] = "Outfit \"%s\" equipped.",
11931209
["info.outfits.feedback_replace"] = "Outfit \"%s\" replaced.",

Locales/MultiBotAceLocale-esES.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ if type(register) ~= "function" then
44
end
55

66
local esESValues = {
7+
-- MB_SELFACTION_I18N_V1_BEGIN
8+
["selfaction.bridge_unavailable"] = "El bridge no está disponible: la acción de SelfBot no se ha enviado.",
9+
["selfaction.failed"] = "La acción de SelfBot ha fallado: %s",
10+
["selfaction.send_failed"] = "No se ha podido enviar la acción de SelfBot: %s",
11+
["selfaction.reason.RATE_LIMIT"] = "Demasiadas solicitudes de SelfBot. Vuelve a intentarlo en unos segundos.",
12+
-- MB_SELFACTION_I18N_V1_END
713
["lootmaster.title"] = "MultiBot Maestro despojador",
814
["lootmaster.refresh"] = "Actualizar",
915
["lootmaster.assign_to"] = "Asignar a:",
@@ -1186,6 +1192,16 @@ local esESValues = {
11861192
["strategy.reason.PARTIAL"] = "La orden de estrategia solo se aplicó parcialmente.",
11871193
["strategy.reason.FAILED"] = "La orden de estrategia falló.",
11881194
["strategy.reason.ACK_TOO_LONG"] = "La confirmación de estrategia es demasiado grande.",
1195+
["strategy.reason.SELF_STRATEGY_BRIDGE_UNAVAILABLE"] = "La compatibilidad del puente con las estrategias de SelfBot no está disponible.",
1196+
["strategy.reason.SELF_STRATEGY_NOT_CONNECTED"] = "El puente no está conectado.",
1197+
["strategy.reason.SELF_BOT_CAPABILITY_UNAVAILABLE"] = "La compatibilidad con SelfBot no está disponible en el puente.",
1198+
["strategy.reason.SELF_STRATEGY_CAPABILITY_UNAVAILABLE"] = "La compatibilidad con estrategias de SelfBot no está disponible en el puente.",
1199+
["strategy.reason.SELF_STRATEGY_NOT_ACTIVE"] = "SelfBot no está activo.",
1200+
["strategy.reason.SELF_STRATEGY_CLIENT_UNAVAILABLE"] = "El addon no puede enviar comandos de estrategia de SelfBot.",
1201+
["strategy.reason.SELF_STRATEGY_UNAVAILABLE"] = "El control de estrategias de SelfBot no está disponible.",
1202+
["strategy.reason.SELF_STRATEGY_INVALID_RESULT"] = "El puente devolvió un resultado de estrategia de SelfBot no válido.",
1203+
["strategy.reason.SELF_STRATEGY_SEND_FAILED"] = "No se pudo enviar el comando de estrategia de SelfBot.",
1204+
["strategy.reason.SELF_STRATEGY_REJECTED"] = "El comando de estrategia de SelfBot fue rechazado.",
11891205
["strategy.reason.UNKNOWN"] = "La orden de estrategia falló por un motivo desconocido.",
11901206
["info.outfits.feedback_equip"] = "Conjunto «%s» equipado.",
11911207
["info.outfits.feedback_replace"] = "Conjunto «%s» reemplazado.",

Locales/MultiBotAceLocale-frFR.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ if type(register) ~= "function" then
44
end
55

66
local frFRValues = {
7+
-- MB_SELFACTION_I18N_V1_BEGIN
8+
["selfaction.bridge_unavailable"] = "Le bridge est indisponible : l'action SelfBot n'a pas été envoyée.",
9+
["selfaction.failed"] = "Échec de l'action SelfBot : %s",
10+
["selfaction.send_failed"] = "L'action SelfBot n'a pas pu être envoyée : %s",
11+
["selfaction.reason.RATE_LIMIT"] = "Trop de demandes SelfBot. Réessayez dans quelques secondes.",
12+
-- MB_SELFACTION_I18N_V1_END
713
["lootmaster.title"] = "MultiBot Responsable du butin",
814
["lootmaster.refresh"] = "Rafraîchir",
915
["lootmaster.assign_to"] = "Attribuer à :",
@@ -1185,6 +1191,16 @@ local frFRValues = {
11851191
["strategy.reason.PARTIAL"] = "La commande de stratégie n'a été appliquée que partiellement.",
11861192
["strategy.reason.FAILED"] = "La commande de stratégie a échoué.",
11871193
["strategy.reason.ACK_TOO_LONG"] = "L'accusé de réception de stratégie est trop volumineux.",
1194+
["strategy.reason.SELF_STRATEGY_BRIDGE_UNAVAILABLE"] = "Le bridge SelfBot pour les stratégies est indisponible.",
1195+
["strategy.reason.SELF_STRATEGY_NOT_CONNECTED"] = "Le bridge n'est pas connecté.",
1196+
["strategy.reason.SELF_BOT_CAPABILITY_UNAVAILABLE"] = "La prise en charge SelfBot est indisponible sur le bridge.",
1197+
["strategy.reason.SELF_STRATEGY_CAPABILITY_UNAVAILABLE"] = "La prise en charge des stratégies SelfBot est indisponible sur le bridge.",
1198+
["strategy.reason.SELF_STRATEGY_NOT_ACTIVE"] = "SelfBot n'est pas actif.",
1199+
["strategy.reason.SELF_STRATEGY_CLIENT_UNAVAILABLE"] = "L'addon ne peut pas envoyer de commandes de stratégie SelfBot.",
1200+
["strategy.reason.SELF_STRATEGY_UNAVAILABLE"] = "Le contrôle des stratégies SelfBot est indisponible.",
1201+
["strategy.reason.SELF_STRATEGY_INVALID_RESULT"] = "Le bridge a renvoyé un résultat de stratégie SelfBot invalide.",
1202+
["strategy.reason.SELF_STRATEGY_SEND_FAILED"] = "La commande de stratégie SelfBot n'a pas pu être envoyée.",
1203+
["strategy.reason.SELF_STRATEGY_REJECTED"] = "La commande de stratégie SelfBot a été refusée.",
11881204
["strategy.reason.UNKNOWN"] = "La commande de stratégie a échoué pour une raison inconnue.",
11891205
["info.outfits.feedback_equip"] = "Tenue « %s » équipée.",
11901206
["info.outfits.feedback_replace"] = "Tenue « %s » remplacée.",

Locales/MultiBotAceLocale-koKR.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ if type(register) ~= "function" then
44
end
55

66
local koKRValues = {
7+
-- MB_SELFACTION_I18N_V1_BEGIN
8+
["selfaction.bridge_unavailable"] = "브리지를 사용할 수 없어 SelfBot 동작을 보내지 못했습니다.",
9+
["selfaction.failed"] = "SelfBot 동작 실패: %s",
10+
["selfaction.send_failed"] = "SelfBot 동작을 보내지 못했습니다: %s",
11+
["selfaction.reason.RATE_LIMIT"] = "SelfBot 요청이 너무 많습니다. 몇 초 후 다시 시도하세요.",
12+
-- MB_SELFACTION_I18N_V1_END
713
["lootmaster.title"] = "MultiBot 전리품 담당자",
814
["lootmaster.refresh"] = "새로 고침",
915
["lootmaster.assign_to"] = "할당 대상:",
@@ -1177,6 +1183,16 @@ local koKRValues = {
11771183
["strategy.reason.PARTIAL"] = "전략 명령이 일부만 적용되었습니다.",
11781184
["strategy.reason.FAILED"] = "전략 명령이 실패했습니다.",
11791185
["strategy.reason.ACK_TOO_LONG"] = "전략 응답이 너무 큽니다.",
1186+
["strategy.reason.SELF_STRATEGY_BRIDGE_UNAVAILABLE"] = "브리지의 SelfBot 전략 지원을 사용할 수 없습니다.",
1187+
["strategy.reason.SELF_STRATEGY_NOT_CONNECTED"] = "브리지가 연결되어 있지 않습니다.",
1188+
["strategy.reason.SELF_BOT_CAPABILITY_UNAVAILABLE"] = "브리지에서 SelfBot 지원을 사용할 수 없습니다.",
1189+
["strategy.reason.SELF_STRATEGY_CAPABILITY_UNAVAILABLE"] = "브리지에서 SelfBot 전략 지원을 사용할 수 없습니다.",
1190+
["strategy.reason.SELF_STRATEGY_NOT_ACTIVE"] = "SelfBot이 활성화되어 있지 않습니다.",
1191+
["strategy.reason.SELF_STRATEGY_CLIENT_UNAVAILABLE"] = "애드온이 SelfBot 전략 명령을 보낼 수 없습니다.",
1192+
["strategy.reason.SELF_STRATEGY_UNAVAILABLE"] = "SelfBot 전략 제어를 사용할 수 없습니다.",
1193+
["strategy.reason.SELF_STRATEGY_INVALID_RESULT"] = "브리지가 잘못된 SelfBot 전략 결과를 반환했습니다.",
1194+
["strategy.reason.SELF_STRATEGY_SEND_FAILED"] = "SelfBot 전략 명령을 보낼 수 없습니다.",
1195+
["strategy.reason.SELF_STRATEGY_REJECTED"] = "SelfBot 전략 명령이 거부되었습니다.",
11801196
["strategy.reason.UNKNOWN"] = "알 수 없는 이유로 전략 명령이 실패했습니다.",
11811197
["info.outfits.feedback_equip"] = "장비 세트 \"%s\": 장착 완료.",
11821198
["info.outfits.feedback_replace"] = "장비 세트 \"%s\": 교체 완료.",

0 commit comments

Comments
 (0)