AutoMoveEndCommand.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. local AutoMoveEndCommand = class('AutoMoveEndCommand', framework.SimpleCommand)
  2. function AutoMoveEndCommand:ctor()
  3. end
  4. function AutoMoveEndCommand:execute(notification)
  5. local data = notification:getBody()
  6. local facade = global.Facade
  7. local autoProxy = facade:retrieveProxy( global.ProxyTable.Auto )
  8. local inputProxy = facade:retrieveProxy( global.ProxyTable.PlayerInputProxy )
  9. local assistProxy = facade:retrieveProxy( global.ProxyTable.AssistProxy )
  10. print("---------------------- auto move end")
  11. -- 通知服务器
  12. local autoTarget = autoProxy:GetAutoTarget()
  13. if autoTarget.autoMoveType == global.MMO.AUTO_MOVE_TYPE_MINIMAP or autoTarget.autoMoveType == global.MMO.AUTO_MOVE_TYPE_SERVER then
  14. if autoProxy:IsMoveCompleted() and inputProxy:GetCurrPathPoint() == 0 then
  15. autoProxy:RequestAutoMoveNotify(global.MMO.AUTO_MOVE_FINISH)
  16. else
  17. autoProxy:RequestAutoMoveNotify(global.MMO.AUTO_MOVE_ABORT)
  18. end
  19. end
  20. -- reset assist state
  21. assistProxy:resetOfflineState()
  22. assistProxy:resetFindMapMonster()
  23. -- reset auto move state
  24. autoProxy:ClearAutoMove()
  25. -- clear current movint data
  26. if inputProxy:IsMoveDirty() or inputProxy:GetPathPointSize() > 0 then
  27. inputProxy:ClearMove()
  28. end
  29. local autoTarget = autoProxy:GetAutoTarget()
  30. -- tips
  31. SLBridge:onLUAEvent(LUA_EVENT_AUTOMOVE_TIPS_SHOW, false)
  32. SLBridge:onLUAEvent(LUA_EVENT_AUTOMOVEEND, {isMoveFail = autoTarget and autoTarget.isPauseAutoTarget})
  33. ssr.ssrBridge:OnAutoMoveEnd()
  34. -- set current auto target
  35. if autoTarget and autoTarget.targetType ~= global.MMO.ACTOR_NONE then
  36. -- clear current input target
  37. inputProxy:ClearTarget()
  38. if not autoProxy:GetAutoTargetInterruptFlag() then
  39. facade:sendNotification( global.NoticeTable.AutoFightBegin )
  40. ssr.ssrBridge:OnAutoFightBegin()
  41. end
  42. else
  43. -- auto move end, nothing todo, so clear auto target
  44. autoProxy:ClearAutoTarget()
  45. end
  46. end
  47. return AutoMoveEndCommand