ItemUpdateCommand.lua 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. local ItemUpdateCommand = class("ItemUpdateCommand", framework.SimpleCommand)
  2. function ItemUpdateCommand:ctor()
  3. end
  4. function ItemUpdateCommand:execute(notification)
  5. local updateData = notification:getBody()
  6. local from = updateData.from
  7. local item = updateData.item
  8. local stdModes = { 0, 1, 2, 3, 4, 31, 40, 42, 44, 45, 46, 47, 49, 200 }
  9. local function isStdMode(sm)
  10. for _, v in pairs(stdModes) do
  11. if v == sm then
  12. return true
  13. end
  14. end
  15. return false
  16. end
  17. -- 持久提醒
  18. if CHECK_SETTING(50) == 1 and item.OverLap <= 1 and (item.StdMode ~= 2 or (item.Shape ~= 1 and item.Shape ~= 2)) and not isStdMode(item.StdMode) then
  19. if item.StdMode == 96 and item.Shape > 0 then --祝福罐 根据最大持久度判断
  20. local isShowSystemChat = false
  21. local duraValue = tonumber(SL:GetMetaValue("GAME_DATA","chijiuts"))
  22. if not duraValue and item.DuraMax and item.DuraMax < 2000 then
  23. isShowSystemChat = true
  24. elseif duraValue and item.Dura and item.DuraMax and (item.Dura / item.DuraMax) * 100 <= duraValue then
  25. isShowSystemChat = true
  26. end
  27. if isShowSystemChat then
  28. if SL:GetMetaValue("SERVER_OPTIONS", global.MMO.SERVER_DISPOSE_ITEM_FRM_CHIJIU) then
  29. ShowSystemChat(string.format(GET_STRING(30001076), item.Name), 251, 249)
  30. else
  31. ShowSystemChat(string.format(GET_STRING(30001070), item.Name), 251, 249)
  32. end
  33. end
  34. else
  35. local isShowSystemChat = false
  36. local duraValue = tonumber(SL:GetMetaValue("GAME_DATA","chijiuts"))
  37. if not duraValue and item.Dura and item.Dura < 1000 then
  38. isShowSystemChat = true
  39. elseif duraValue and item.Dura and item.DuraMax and (item.Dura / item.DuraMax) * 100 <= duraValue then
  40. isShowSystemChat = true
  41. end
  42. if isShowSystemChat then
  43. if SL:GetMetaValue("SERVER_OPTIONS", global.MMO.SERVER_DISPOSE_ITEM_FRM_CHIJIU) then
  44. ShowSystemChat(string.format(GET_STRING(30001076), item.Name), 251, 249)
  45. else
  46. ShowSystemChat(string.format(GET_STRING(30001070), item.Name), 251, 249)
  47. end
  48. end
  49. end
  50. end
  51. end
  52. return ItemUpdateCommand