TakeOffEquipToHeroBagRequestCommand.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. local TakeOffEquipToHeroBagRequestCommand = class('TakeOffEquipToHeroBagRequestCommand', framework.SimpleCommand)
  2. function TakeOffEquipToHeroBagRequestCommand:ctor()
  3. end
  4. function TakeOffEquipToHeroBagRequestCommand:execute(notification) ---脱装备
  5. local equipProxy = global.Facade:retrieveProxy(global.ProxyTable.Equip)
  6. local data = notification:getBody()
  7. local bagProxy = global.Facade:retrieveProxy(global.ProxyTable.Bag)
  8. if bagProxy:GetBagCollimator() then --有准星操作
  9. return
  10. end
  11. -- is bag full?
  12. if bagProxy:isToBeFull() then
  13. global.Facade:sendNotification(global.NoticeTable.SystemTips, GET_STRING(800050))
  14. local data = {
  15. MakeIndex = data.MakeIndex,
  16. state = 1
  17. }
  18. global.Facade:sendNotification(global.NoticeTable.Layer_Player_Equip_State_Change, data)
  19. SLBridge:onLUAEvent(LUA_EVENT_PLAYER_EQUIP_STATE_CHANGE, data)
  20. return false
  21. end
  22. local name = data.Name
  23. local pos = data.Where
  24. local MakeIndex = data.MakeIndex
  25. local AutoUseItemProxy = global.Facade:retrieveProxy(global.ProxyTable.AutoUseItemProxy)
  26. AutoUseItemProxy:AddEquipOffMakeIndex(MakeIndex)
  27. LuaSendMsg(global.MsgType.MSG_CS_HUM_TAKEOFF_TO_HEROBAG, MakeIndex, pos, 0, 0, name, string.len(name))
  28. end
  29. return TakeOffEquipToHeroBagRequestCommand