TopupLogic.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. -------------------------------------------------
  2. -- 充值
  3. -------------------------------------------------
  4. local BuyExcel = require("excel.buy")
  5. local Msg = require("core.Msg")
  6. local ObjHuman = require("core.ObjHuman")
  7. local BuyLogic = require("topup.BuyLogic")
  8. local SceneHandler = require("scene.Handler")
  9. local YunYingLogic = require("yunying.YunYingLogic")
  10. local LeichongHaoli = require("present.LeichongHaoli")
  11. local LeijiChongzhi = require("present.LeijiChongzhi")
  12. local DailyLeichong = require("present.DailyLeichong")
  13. local LoginSignLogic = require("loginSign.LoginSignLogic")
  14. local RoleSystemLogic = require("roleSystem.RoleSystemLogic")
  15. local RoleSystemDefine = require("roleSystem.RoleSystemDefine")
  16. -- 专属客服充值额度
  17. EXCLUSIVE_SERVER_9937 = 1000
  18. TOPUP_LIBAO_ID1 = 1 --盲盒礼包
  19. TOPUP_LIBAO_ID2 = 2 --铂金周卡
  20. TOPUP_LIBAO_ID3 = 3 --365王卡
  21. --封装直购基本信息
  22. local function wrapTopupItem(net, config, human)
  23. net.id = config.id
  24. BuyLogic.fontBuyItem(human, net.buyItem, config.buyID)
  25. end
  26. -- 充值列表
  27. function query(human)
  28. if SceneHandler.canCharge(human) ~= true then
  29. return
  30. end
  31. local msgRet = Msg.gc.GC_TOPUP_QUERY
  32. msgRet.list[0] = #BuyExcel.topup
  33. for i, config in ipairs(BuyExcel.topup) do
  34. local net = msgRet.list[i]
  35. wrapTopupItem(net, config, human)
  36. end
  37. Msg.send(msgRet,human.fd)
  38. end
  39. -- 直购回调
  40. function clacTopupAcount(human, price, buyID)
  41. if price < 0 then return end
  42. ObjHuman.updateDaily(human)
  43. human.db.topupAcountDaily = (human.db.topupAcountDaily or 0) + price
  44. human.db.topupAccountMonth = (human.db.topupAccountMonth or 0) + price
  45. human.db.topupAcount = (human.db.topupAcount or 0) + price
  46. checkKf(human)
  47. YunYingLogic.onCharge(human, price, buyID)
  48. DailyLeichong.charge(human, price)
  49. LeichongHaoli.onAddMoney(human, price)
  50. LeijiChongzhi.onAddMoney(human, price)
  51. LoginSignLogic.chargeAfter(human)
  52. end
  53. function checkKf(human)
  54. -- 激活专属客服
  55. if human.db.topupAcount ~= nil and human.db.topupAcount >= EXCLUSIVE_SERVER_9937 then
  56. Msg.send(Msg.gc.GC_EXCLUSIVE_SERVER,human.fd)
  57. end
  58. end