NewFirstChargeLogic.lua 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. -----------------------------------------------------------------
  2. -- 文件名 : NewFirstChargeLogic.lua
  3. -- 文件说明 : 新首充
  4. -- 创建时间 : 2025/1/22
  5. -- 创建人 : FC
  6. -----------------------------------------------------------
  7. local Msg = require("core.Msg")
  8. local Util = require("common.Util")
  9. local PresentExcel = require("excel.present")
  10. local Grid = require("bag.Grid")
  11. local BagLogic = require("bag.BagLogic")
  12. local Broadcast = require("broadcast.Broadcast")
  13. local PanelDefine = require("broadcast.PanelDefine")
  14. local ChatPaoMaLogic = require("chat.ChatPaoMaLogic")
  15. local YunYingLogic = require("yunying.YunYingLogic")
  16. local SceneHandler = require("scene.Handler")
  17. local ObjHuman = require("core.ObjHuman")
  18. local BuyLogic = require("topup.BuyLogic")
  19. local CommonDefine = require("common.CommonDefine")
  20. local NEWFIRST_CHARGE_TYPE1 = 1 -- 1元
  21. local NEWFIRST_CHARGE_TYPE2 = 2 -- 8元
  22. local NEWFIRST_CHARGE_TYPE3 = 3 -- 18元
  23. local tMoneyToType =
  24. {
  25. [1] = NEWFIRST_CHARGE_TYPE1,
  26. [8] = NEWFIRST_CHARGE_TYPE2,
  27. [18] = NEWFIRST_CHARGE_TYPE3,
  28. }
  29. local tBuyID2Speed =
  30. {
  31. [1] = 1,
  32. [8] = 2,
  33. [18] = 3,
  34. [6] = 1,
  35. [68] = 2,
  36. [98] = 3,
  37. }
  38. local NEWFIRST_DAY = 3 -- 奖励天数,策划也没配置,直接写死吧
  39. local OPENNEWLV = 12 -- 等级9开
  40. -- 状态
  41. NEWFIRST_STATE_CANT_GET = 0 -- 不可领
  42. NEWFIRST_STATE_CAT_GET = 1 -- 可领
  43. NEWFIRST_STATE_HAD_GET = 2 -- 已领
  44. -- local tNewFirstChargeCof = nil -- 配置 Key = nBuyID
  45. -- local tPrizeDataByTypeDay = nil -- 具体奖励配置 [nType] = {[nDay] = v}
  46. local itemID2Type = {
  47. [92001] = 1,
  48. [92002] = 2,
  49. [92003] = 3,
  50. [92004] = 4,
  51. [92005] = 5,
  52. [92006] = 6,
  53. }
  54. -- 是否是正确的渠道
  55. local function isCorrectChanel(human)
  56. if not human then
  57. return false
  58. end
  59. return true
  60. -- if human.phpChanelID == CommonDefine.CHANNEL_TAG_MUZI or human.phpChanelID == CommonDefine.CHANNEL_TAG_SANLI_QQ then
  61. -- return true
  62. -- end
  63. -- return false
  64. end
  65. -- 是否使用新加的首充配置
  66. local function isUseNewCfg(human)
  67. if not isCorrectChanel(human) then
  68. return false
  69. end
  70. local newFirstChargeData = human.db.newFirstCharge
  71. -- 如果原来的首充礼包一个都没购买, 就只能购买新的首充礼包
  72. if not newFirstChargeData or not next(newFirstChargeData) then
  73. return true
  74. end
  75. local subNum = 0
  76. -- 如果购买了老的首充, 必须全部购买且领完, 才能开启下新夹首充礼包
  77. for i=NEWFIRST_CHARGE_TYPE1, NEWFIRST_CHARGE_TYPE3 do
  78. local data = newFirstChargeData[i]
  79. if data then
  80. for k = 1, NEWFIRST_DAY do
  81. if data.tDayStatus[k] ~= NEWFIRST_STATE_HAD_GET then
  82. return false
  83. end
  84. end
  85. subNum = subNum + 1
  86. end
  87. if i == NEWFIRST_CHARGE_TYPE3 and subNum > 0 and subNum < NEWFIRST_CHARGE_TYPE3 then
  88. return false
  89. end
  90. end
  91. return true
  92. end
  93. local function getFinalOffset(human)
  94. local startIdx, endIdx = NEWFIRST_CHARGE_TYPE1, NEWFIRST_CHARGE_TYPE3
  95. if isUseNewCfg(human) then
  96. startIdx = 4
  97. endIdx = 6
  98. end
  99. return startIdx, endIdx
  100. end
  101. local function getFinalType(nType, isUseNew)
  102. if isUseNew then
  103. nType = nType + 3
  104. end
  105. return nType
  106. end
  107. local function getNeedList(isNew)
  108. local startIdx, endIdx = 1, 3
  109. if isNew then
  110. startIdx, endIdx = 11, 13
  111. end
  112. local tNewFirstChargeCof = {}
  113. local tPrizeDataByTypeDay = {}
  114. -- for nID, tPrize in pairs(PresentExcel.newfirstcharge) do
  115. -- if type(tPrize) == "table" then
  116. -- --table.print_lua_table(tPrize)
  117. -- local nBuyID = tPrize.nBuyID
  118. -- tNewFirstChargeCof[nBuyID] = tPrize
  119. -- if tMoneyToType[tPrize.nMoney] then
  120. -- tNewFirstChargeCof[nBuyID].nType = tMoneyToType[tPrize.nMoney]
  121. -- else
  122. -- print("[getNeedList] 配置了不正确的金额 nMoney = "..tPrize.nMoney.." nID = "..nID)
  123. -- end
  124. -- else
  125. -- print("[getNeedList] tType = \n"..type(tPrize))
  126. -- end
  127. -- end
  128. for i = startIdx, endIdx do
  129. local singleCfg = PresentExcel.newfirstcharge[i]
  130. local nBuyID = singleCfg.nBuyID
  131. tNewFirstChargeCof[nBuyID] = singleCfg
  132. tNewFirstChargeCof[nBuyID].nType = itemID2Type[singleCfg.nBuyID]
  133. end
  134. for nID, tPrize in pairs(tNewFirstChargeCof) do
  135. local nType = tPrize.nType
  136. tPrizeDataByTypeDay[nType] = {}
  137. for i = 1, NEWFIRST_DAY, 1 do
  138. local tItem = i == 1 and tPrize.tPrize1 or ( i == 2 and tPrize.tPrize2 or tPrize.tPrize3)
  139. tPrizeDataByTypeDay[nType][i] = tItem
  140. end
  141. end
  142. return tNewFirstChargeCof, tPrizeDataByTypeDay
  143. end
  144. -- 初始化对应类型的DB类型数据
  145. local function NewFirstCharge_InitDBByType(human, nType)
  146. if not human.db.newFirstCharge then
  147. human.db.newFirstCharge = {}
  148. end
  149. human.db.newFirstCharge[nType] =
  150. {
  151. nBuyTime = 0,
  152. nSatus = NEWFIRST_STATE_CANT_GET,
  153. tDayStatus = {},
  154. }
  155. for i = 1, NEWFIRST_DAY, 1 do
  156. human.db.newFirstCharge[nType].tDayStatus[i] = NEWFIRST_STATE_CANT_GET
  157. end
  158. end
  159. -- 创建DB数据
  160. local function NewFirstCharge_CreateDB(human)
  161. if not human then
  162. return
  163. end
  164. if not human.db.newFirstCharge then
  165. human.db.newFirstCharge = {}
  166. end
  167. -- for i = NEWFIRST_CHARGE_TYPE1, NEWFIRST_CHARGE_TYPE3, 1 do
  168. -- if not human.db.newFirstCharge[i] then
  169. -- NewFirstCharge_InitDBByType(human, i)
  170. -- end
  171. -- end
  172. local startIdx, endIdx = getFinalOffset(human)
  173. for i = startIdx, endIdx do
  174. if not human.db.newFirstCharge[i] then
  175. NewFirstCharge_InitDBByType(human, i)
  176. end
  177. end
  178. --table.print_lua_table(human.db.newFirstCharge)
  179. print("[NewFirstCharge_CreateDB] \n")
  180. end
  181. -- 设置对应天数领取了奖励
  182. local function NewFirstCharge_SetPrizeStauts(human, nType, nDay, nValue)
  183. if not human.db.newFirstCharge or not human.db.newFirstCharge[nType] then
  184. return
  185. end
  186. human.db.newFirstCharge[nType].tDayStatus[nDay] = nValue
  187. end
  188. -- 获取对应类型对应天数奖励状态
  189. local function NewFirstCharge_GetPrizeStauts(human, nType, nDay)
  190. if not human.db.newFirstCharge or not human.db.newFirstCharge[nType] then
  191. return NEWFIRST_STATE_CANT_GET
  192. end
  193. --table.print_lua_table(human.db.newFirstCharge[nType])
  194. --print("\n")
  195. return human.db.newFirstCharge[nType].tDayStatus[nDay]
  196. end
  197. -- 设置购买状态
  198. local function NewFirstCharge_SetBuyStatus(human, nType)
  199. if not human.db.newFirstCharge then
  200. NewFirstCharge_InitDBByType(human, nType)
  201. end
  202. human.db.newFirstCharge[nType].nBuyTime = os.time()
  203. human.db.newFirstCharge[nType].nSatus = NEWFIRST_STATE_HAD_GET
  204. NewFirstCharge_SetPrizeStauts(human, nType, 1, NEWFIRST_STATE_CAT_GET)
  205. end
  206. -- 获取购买状态
  207. local function NewFirstCharge_GetBuyStatus(human, nType)
  208. if not human.db.newFirstCharge then
  209. NewFirstCharge_InitDBByType(human, nType)
  210. end
  211. if not human.db.newFirstCharge[nType] then
  212. NewFirstCharge_InitDBByType(human, nType)
  213. end
  214. return human.db.newFirstCharge[nType].nSatus
  215. end
  216. -- 设置时间
  217. local function NewFirstCharge_SetTime(human, nType, nTime)
  218. if not human.db.newFirstCharge then
  219. NewFirstCharge_InitDBByType(human, nType)
  220. end
  221. human.db.newFirstCharge[nType].nBuyTime = nTime
  222. end
  223. -- 获取时间
  224. local function NewFirstCharge_GetTime(human, nType)
  225. if not human.db.newFirstCharge then
  226. NewFirstCharge_InitDBByType(human, nType)
  227. end
  228. return human.db.newFirstCharge[nType].nBuyTime
  229. end
  230. local function isOpenByType(human,giftType)
  231. if not human.db.newFirstCharge or not human.db.newFirstCharge[giftType] then
  232. return true
  233. end
  234. -- 未购买,显示
  235. if NEWFIRST_STATE_CANT_GET == human.db.newFirstCharge[giftType].nSatus then
  236. return true
  237. end
  238. -- 购买了
  239. for nDay = 1, NEWFIRST_DAY, 1 do
  240. local nDayStatus = NewFirstCharge_GetPrizeStauts(human, giftType, nDay)
  241. -- 只要没领取,都是开启的
  242. if NEWFIRST_STATE_HAD_GET ~= nDayStatus then
  243. return true
  244. end
  245. end
  246. return false
  247. end
  248. -- 根据类型判断是否有红点
  249. local function isRedByType(human, giftType)
  250. if not human.db.newFirstCharge or not human.db.newFirstCharge[giftType] then
  251. return false
  252. end
  253. -- 未购买
  254. if NEWFIRST_STATE_CANT_GET == human.db.newFirstCharge[giftType].nSatus then
  255. return false
  256. end
  257. for i = 1, NEWFIRST_DAY, 1 do
  258. local nDayStatus = NewFirstCharge_GetPrizeStauts(human, giftType, i)
  259. if NEWFIRST_STATE_CAT_GET == nDayStatus then
  260. return true
  261. end
  262. end
  263. return false
  264. end
  265. function isOpen(human,YYInfo,funcConfig)
  266. if not SceneHandler.canCharge(human) then
  267. print("[NewFirstCharge- isOpen] 不能充值返回")
  268. return false
  269. end
  270. if OPENNEWLV > human.db.lv then
  271. print("[NewFirstCharge- isOpen] 等级不足 不够 lv = "..human.db.lv)
  272. return false
  273. end
  274. -- for i = NEWFIRST_CHARGE_TYPE1, NEWFIRST_CHARGE_TYPE3, 1 do
  275. -- if true == isOpenByType(human,i) then
  276. -- print("[NewFirstCharge- isOpen] 满足条件 ")
  277. -- return true
  278. -- end
  279. -- end
  280. local startIdx, endIdx = getFinalOffset(human)
  281. for i = startIdx, endIdx, 1 do
  282. if true == isOpenByType(human,i) then
  283. print("[NewFirstCharge- isOpen] 满足条件 ")
  284. return true
  285. end
  286. end
  287. print("[NewFirstCharge- isOpen] 不满足条件 ")
  288. return false
  289. end
  290. function isRed(human,YYInfo,funcConfig)
  291. -- for i = NEWFIRST_CHARGE_TYPE1, NEWFIRST_CHARGE_TYPE3, 1 do
  292. -- if true == isRedByType(human,i) then
  293. -- return true
  294. -- end
  295. -- end
  296. local startIdx, endIdx = getFinalOffset(human)
  297. for i = startIdx, endIdx, 1 do
  298. if true == isRedByType(human,i) then
  299. return true
  300. end
  301. end
  302. return false
  303. end
  304. function NewFirstCharge_Query(human, nType)
  305. local bl = isUseNewCfg(human)
  306. local tAllConf, tItemConfByType = getNeedList(bl)
  307. local tTypeConf = nil
  308. local finalType = getFinalType(nType, bl)
  309. for _, v in pairs(tAllConf) do
  310. if v.nType == finalType then
  311. tTypeConf = v
  312. break
  313. end
  314. end
  315. if not tTypeConf then
  316. print("[NewFirstCharge_Query] 不存在对应类型的配置 nType = "..finalType)
  317. return
  318. end
  319. if not human.db.newFirstCharge then
  320. NewFirstCharge_CreateDB(human)
  321. end
  322. local tMsgData = Msg.gc.GC_NEW_FIRST_CHARGE_QUERY
  323. tMsgData.nType = nType
  324. tMsgData.nState = NewFirstCharge_GetBuyStatus(human, finalType)
  325. print("[NewFirstCharge_Query] 购买状态 nSatus = "..tMsgData.nState)
  326. tMsgData.nMoney = tTypeConf.nMoney
  327. tMsgData.tRed[0] = NEWFIRST_CHARGE_TYPE3
  328. local len = 0
  329. local startIdx, endIdx = getFinalOffset(human)
  330. for i = startIdx, endIdx, 1 do
  331. len = len + 1
  332. tMsgData.tRed[len] = 0
  333. if true == isRedByType(human, i) then
  334. tMsgData.tRed[len] = 1
  335. end
  336. end
  337. BuyLogic.fontBuyItem(human, tMsgData.buyItem, tTypeConf.nBuyID)
  338. tMsgData.list[0] = 0
  339. for i = 1, NEWFIRST_DAY, 1 do
  340. tMsgData.list[0] = tMsgData.list[0] + 1
  341. local tNodeData = tMsgData.list[tMsgData.list[0]]
  342. tNodeData.nState = NewFirstCharge_GetPrizeStauts(human, finalType, i)
  343. print("[NewFirstCharge_Query] 奖励天数状态 nSatus = "..tNodeData.nState.." i = "..i)
  344. tNodeData.nDay = i
  345. tNodeData.item[0] = 0
  346. local tItemConf = tItemConfByType[finalType][i]
  347. if not tItemConf then
  348. print("[NewFirstCharge_Query] 居然不存在对应的奖励配置")
  349. else
  350. for _, v in ipairs(tItemConf) do
  351. tNodeData.item[0] = tNodeData.item[0] + 1
  352. Grid.makeItem(tNodeData.item[tNodeData.item[0]], v[1], v[2])
  353. if v[3] then
  354. tNodeData.item[tNodeData.item[0]].rare = v[3]
  355. end
  356. end
  357. end
  358. end
  359. Msg.send(tMsgData, human.fd)
  360. -- print("[NewFirstCharge_Query] 发送数据成功\n")
  361. -- if human.db.nSpeed and _G.next(human.db.nSpeed) then
  362. -- table.print_lua_table(human.db.nSpeed)
  363. -- end
  364. end
  365. function NewFirstCharge_Get(human, nType)
  366. local bl = isUseNewCfg(human)
  367. local tAllConf, tItemConfByType = getNeedList(bl)
  368. local tTypeConf = nil
  369. local finalType = getFinalType(nType, bl)
  370. for _, v in pairs(tAllConf) do
  371. if v.nType == finalType then
  372. tTypeConf = v
  373. break
  374. end
  375. end
  376. if not tTypeConf or not tItemConfByType[finalType] then
  377. print("[NewFirstCharge_Get] 不存在对应类型的配置 nType = "..finalType)
  378. return
  379. end
  380. local nMoney = tTypeConf.nMoney
  381. local bChange = false
  382. local tItems = {}
  383. for nDay, value in pairs(tItemConfByType[finalType]) do
  384. local nStatus = NewFirstCharge_GetPrizeStauts(human, finalType, nDay)
  385. if NEWFIRST_STATE_CAT_GET == nStatus then
  386. for _, v in pairs(value) do
  387. table.insert(tItems, v)
  388. end
  389. if nDay == 1 then
  390. bChange = true
  391. local nIndex = tBuyID2Speed[nMoney]
  392. if not human.db.nSpeed then
  393. human.db.nSpeed = {}
  394. end
  395. human.db.nSpeed[nIndex] = 1
  396. end
  397. NewFirstCharge_SetPrizeStauts(human, finalType, nDay, NEWFIRST_STATE_HAD_GET)
  398. end
  399. end
  400. if nil ~= _G.next(tItems) then
  401. BagLogic.addItemList(human, tItems, "shouchong")
  402. for k, v in pairs(funcID) do
  403. YunYingLogic.updateIcon(YYInfo[k], human)
  404. YunYingLogic.sendGroupUpdate(YYInfo[k], human, PanelDefine.PANEL_ID_3302)
  405. break
  406. end
  407. -- 如果购买了老的首充且全部领完, 开启新加的首充
  408. if isUseNewCfg(human) then
  409. NewFirstCharge_CreateDB(human)
  410. NewFirstCharge_GetPrice(human)
  411. end
  412. NewFirstCharge_Query(human, nType)
  413. if true == bChange then
  414. ObjHuman.sendHumanInfo(human)
  415. end
  416. end
  417. end
  418. -- 获取所有礼包价格
  419. function NewFirstCharge_GetPrice(human)
  420. local bl = isUseNewCfg(human)
  421. local tAllConf = getNeedList(bl)
  422. local len = 0
  423. local tMsgData = Msg.gc.GC_NEW_FIRST_PRIZE_QUERY
  424. local tbl = {}
  425. for _,v in pairs(tAllConf) do
  426. len = len + 1
  427. tbl[len] = v.nMoney
  428. end
  429. tMsgData.priceList[0] = len
  430. table.sort(tbl)
  431. for k, v in ipairs(tbl) do
  432. tMsgData.priceList[k] = v
  433. end
  434. Msg.send(tMsgData, human.fd)
  435. end
  436. -- 充值回调
  437. function onCharge(human, nBuyID)
  438. -- print("[NewFirstChargeLogic-onCharge] nBuyID = "..nBuyID)
  439. local bl = isUseNewCfg(human)
  440. local tConfByBuyid = getNeedList(bl)
  441. local isChange = false
  442. if tConfByBuyid[nBuyID] then
  443. --print("[onCharge] nType = ".. tConfByBuyid[nBuyID].nType.." nBuyID = "..nBuyID)
  444. NewFirstCharge_SetBuyStatus(human, tConfByBuyid[nBuyID].nType)
  445. isChange = true
  446. -- 客户端只传1 ~3
  447. local targetType = tConfByBuyid[nBuyID].nType
  448. if bl then
  449. targetType = targetType - 3
  450. end
  451. -- NewFirstCharge_Query(human, tConfByBuyid[nBuyID].nType)
  452. NewFirstCharge_Query(human, targetType)
  453. if IsBuyAllgift(human) then
  454. local CombatPosLogic = require("combat.CombatPosLogic")
  455. CombatPosLogic.sendAllCombatPos(human)
  456. end
  457. else
  458. print("[NewFirstChargeLogic-onCharge] 不存在对应的礼包id nBuyID = "..nBuyID)
  459. return
  460. end
  461. if isChange then
  462. for k, v in pairs(funcID) do
  463. print("[NewFirstChargeLogic - onCharge], k = "..k)
  464. YunYingLogic.updateIcon(YYInfo[k], human)
  465. break
  466. end
  467. end
  468. end
  469. function updateDaily(human, funcID)
  470. if human.db.newFirstCharge then
  471. local nNowTime = os.time()
  472. -- for i = NEWFIRST_CHARGE_TYPE1, NEWFIRST_CHARGE_TYPE3, 1 do
  473. -- local nBuyStatus = NewFirstCharge_GetBuyStatus(human, i)
  474. -- local nLastTime = NewFirstCharge_GetTime(human, i)
  475. -- local bIsDay = Util.isSameDayByTimes(nNowTime, nLastTime)
  476. -- -- 遍历该类型全部天数
  477. -- if NEWFIRST_STATE_HAD_GET == nBuyStatus and true ~= bIsDay then
  478. -- for nDay = 1, NEWFIRST_DAY, 1 do
  479. -- local nDayStatus = NewFirstCharge_GetPrizeStauts(human, i, nDay)
  480. -- -- 当天奖励未领取
  481. -- if NEWFIRST_STATE_CANT_GET == nDayStatus then
  482. -- NewFirstCharge_SetPrizeStauts(human, i, nDay, NEWFIRST_STATE_CAT_GET)
  483. -- NewFirstCharge_SetTime(human, i, nNowTime)
  484. -- print("[NewFirstChargeLogic - updateDaily] 隔天刷新 奖励 nType = "..i.." nDay = "..nDay)
  485. -- break
  486. -- end
  487. -- end
  488. -- end
  489. -- end
  490. local startIdx, endIdx = getFinalOffset(human)
  491. for i = startIdx, endIdx do
  492. local nBuyStatus = NewFirstCharge_GetBuyStatus(human, i)
  493. local nLastTime = NewFirstCharge_GetTime(human, i)
  494. local bIsDay = Util.isSameDayByTimes(nNowTime, nLastTime)
  495. -- 遍历该类型全部天数
  496. if NEWFIRST_STATE_HAD_GET == nBuyStatus and true ~= bIsDay then
  497. for nDay = 1, NEWFIRST_DAY, 1 do
  498. local nDayStatus = NewFirstCharge_GetPrizeStauts(human, i, nDay)
  499. -- 当天奖励未领取
  500. if NEWFIRST_STATE_CANT_GET == nDayStatus then
  501. NewFirstCharge_SetPrizeStauts(human, i, nDay, NEWFIRST_STATE_CAT_GET)
  502. NewFirstCharge_SetTime(human, i, nNowTime)
  503. print("[NewFirstChargeLogic - updateDaily] 隔天刷新 奖励 nType = "..i.." nDay = "..nDay)
  504. break
  505. end
  506. end
  507. end
  508. end
  509. end
  510. end
  511. -- 是否已激活首充
  512. function isActive(human, YYInfo, funcConfig)
  513. return not isOpen(human, YYInfo, funcConfig)
  514. end
  515. -- 玩家整点
  516. function onZero(human, funcID)
  517. updateDaily(human, funcID)
  518. end
  519. -- GM 命令
  520. function NewFirstCharge_GMClear(human)
  521. human.db.newFirstCharge = nil
  522. print("[NewFirstCharge_GMClear] 清空完成")
  523. end
  524. -- 是否购买了所有的新首充礼包
  525. function IsBuyAllgift(human)
  526. local newFirstChargeData = human.db.newFirstCharge
  527. if not newFirstChargeData or not next(newFirstChargeData) then
  528. return false
  529. end
  530. local bl = true
  531. -- 旧礼包判断,1~3为旧礼包的类型
  532. for i=1, 3 do
  533. if not newFirstChargeData[i] or newFirstChargeData[i].nBuyTime <= 0 then
  534. bl = false
  535. break
  536. end
  537. end
  538. if bl then
  539. return true
  540. end
  541. -- 新礼包判断, 4~6为新礼包的类型
  542. bl = true
  543. for i=4, 6 do
  544. if not newFirstChargeData[i] or newFirstChargeData[i].nBuyTime <= 0 then
  545. bl = false
  546. break
  547. end
  548. end
  549. return bl
  550. end