@@ -5406,6 +5406,31 @@ function Comm.HandleSelfActionAddonMessage(opcode, payload, state)
54065406
54075407 return true
54085408end
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
54115436function Comm .HandleSelfStrategyAddonMessage (opcode , payload , state )
@@ -5467,11 +5492,27 @@ function Comm.HandleSelfStrategyProtocolError(requestType, token, reason, state)
54675492 return true
54685493end
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+
54705507function 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
0 commit comments