Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. f = require("proxy.player.mail.PlayerMail")
  2. Define = require("proxy.mail.Define")
  3. data_pattern = Define.data_pattern
  4. _, old_local_on_login = debug.getupvalue(f.on_login, 1)
  5.  
  6. _, add_action = debug.getupvalue(f.list, 6)
  7. _, action_rearrange = debug.getupvalue(f.list, 7)
  8. _, action_list = debug.getupvalue(f.list, 8)
  9.  
  10. check_error_mail=function(player)
  11. if not player then return end
  12.  
  13. local mail_act = player.mail_act
  14. if not mail_act then return end
  15.  
  16. local on_done = function(list, err)
  17.  
  18. local error_mail_uid = {}
  19. for _, mail in pairs(list) do
  20. local attachments = mail[data_pattern.attachments]
  21. if attachments[data_pattern.role] then
  22. local role_data = attachments[data_pattern.role]
  23. if role_data["1"] ~= nil and role_data["1"] == 5004 then
  24. table.insert(error_mail_uid, mail[data_pattern.mail_uid])
  25. end
  26. end
  27. end
  28.  
  29. for _,mail_uid in pairs(error_mail_uid) do
  30. f.delete(player, 0, mail_uid)
  31. end
  32.  
  33. end
  34.  
  35. local rearrange_done = function(success, err)
  36. end
  37.  
  38. add_action(mail_act, action_rearrange, rearrange_done, player)
  39. add_action(mail_act, action_list, on_done)
  40. end
  41.  
  42.  
  43. new_on_login = function(player)
  44. old_local_on_login(player)
  45. check_error_mail(player)
  46. end
  47.  
  48.  
  49. debug.setupvalue(f.on_login, 1, new_on_login)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement