LifetimeChargeGift.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. LifetimeChargeGift = {}
  2. local function _rechargeType()
  3. return "7"
  4. end
  5. function LifetimeChargeGift.rechargeEvent(actor, cfg_recharge, count, amount, ext, outRewards)
  6. --职业
  7. -- local career = getbaseinfo(actor, "getbasecareer")
  8. -- 拥有终身礼包的额外奖励
  9. -- local rewardTable = string.toIntIntMap4Career(career, rechargeCfg['firstreward'], "#", "|")
  10. local cfg = ConfigDataManager.getById("cfg_Lifetimegiftbag", cfg_recharge["parameter"])
  11. gameDebug.assertNil(cfg, "cfg_Lifetimegiftbag表找不到配置:", cfg_recharge["parameter"])
  12. string.putIntIntMap(outRewards, cfg.rewards, "#", "|")
  13. end
  14. ---统一的请求消息处理
  15. function LifetimeChargeGift.reqAction(actor, type, action, reqParameter)
  16. if action == "panel" then
  17. LifetimeChargeGift.sendPanel(actor, type, action)
  18. end
  19. end
  20. function LifetimeChargeGift.sendPanel(actor, type, action)
  21. local data = {}
  22. local list = ConfigDataManager.getList("cfg_Lifetimegiftbag")
  23. for _, cfg in pairs(list) do
  24. local rechargeId = ConfigDataManager.getTableValue("cfg_recharge", "id", "parameter", cfg.id, "type", type)
  25. if not string.isNullOrEmpty(rechargeId) then
  26. table.insert(data, rechargeId)
  27. end
  28. end
  29. Recharge.resAction(actor, type, action, data)
  30. end
  31. -- 注册请求消息监听
  32. EventListerTable.registerType("终身礼包", _rechargeType())
  33. RechargeMessageEventListerTable:eventLister(_rechargeType(), "终身礼包", LifetimeChargeGift.reqAction)
  34. RechargeEventListerTable:eventLister(_rechargeType(), "终身礼包", LifetimeChargeGift.rechargeEvent)