NewFirstChargeLogic.lua 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  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. return human.db.newFirstCharge[nType].nSatus
  212. end
  213. -- 设置时间
  214. local function NewFirstCharge_SetTime(human, nType, nTime)
  215. if not human.db.newFirstCharge then
  216. NewFirstCharge_InitDBByType(human, nType)
  217. end
  218. human.db.newFirstCharge[nType].nBuyTime = nTime
  219. end
  220. -- 获取时间
  221. local function NewFirstCharge_GetTime(human, nType)
  222. if not human.db.newFirstCharge then
  223. NewFirstCharge_InitDBByType(human, nType)
  224. end
  225. return human.db.newFirstCharge[nType].nBuyTime
  226. end
  227. local function isOpenByType(human,giftType)
  228. if not human.db.newFirstCharge or not human.db.newFirstCharge[giftType] then
  229. return true
  230. end
  231. -- 未购买,显示
  232. if NEWFIRST_STATE_CANT_GET == human.db.newFirstCharge[giftType].nSatus then
  233. return true
  234. end
  235. -- 购买了
  236. for nDay = 1, NEWFIRST_DAY, 1 do
  237. local nDayStatus = NewFirstCharge_GetPrizeStauts(human, giftType, nDay)
  238. -- 只要没领取,都是开启的
  239. if NEWFIRST_STATE_HAD_GET ~= nDayStatus then
  240. return true
  241. end
  242. end
  243. return false
  244. end
  245. -- 根据类型判断是否有红点
  246. local function isRedByType(human, giftType)
  247. if not human.db.newFirstCharge or not human.db.newFirstCharge[giftType] then
  248. return false
  249. end
  250. -- 未购买
  251. if NEWFIRST_STATE_CANT_GET == human.db.newFirstCharge[giftType].nSatus then
  252. return false
  253. end
  254. for i = 1, NEWFIRST_DAY, 1 do
  255. local nDayStatus = NewFirstCharge_GetPrizeStauts(human, giftType, i)
  256. if NEWFIRST_STATE_CAT_GET == nDayStatus then
  257. return true
  258. end
  259. end
  260. return false
  261. end
  262. function isOpen(human,YYInfo,funcConfig)
  263. if not SceneHandler.canCharge(human) then
  264. print("[NewFirstCharge- isOpen] 不能充值返回")
  265. return false
  266. end
  267. if OPENNEWLV > human.db.lv then
  268. print("[NewFirstCharge- isOpen] 等级不足 不够 lv = "..human.db.lv)
  269. return false
  270. end
  271. -- for i = NEWFIRST_CHARGE_TYPE1, NEWFIRST_CHARGE_TYPE3, 1 do
  272. -- if true == isOpenByType(human,i) then
  273. -- print("[NewFirstCharge- isOpen] 满足条件 ")
  274. -- return true
  275. -- end
  276. -- end
  277. local startIdx, endIdx = getFinalOffset(human)
  278. for i = startIdx, endIdx, 1 do
  279. if true == isOpenByType(human,i) then
  280. print("[NewFirstCharge- isOpen] 满足条件 ")
  281. return true
  282. end
  283. end
  284. print("[NewFirstCharge- isOpen] 不满足条件 ")
  285. return false
  286. end
  287. function isRed(human,YYInfo,funcConfig)
  288. -- for i = NEWFIRST_CHARGE_TYPE1, NEWFIRST_CHARGE_TYPE3, 1 do
  289. -- if true == isRedByType(human,i) then
  290. -- return true
  291. -- end
  292. -- end
  293. local startIdx, endIdx = getFinalOffset(human)
  294. for i = startIdx, endIdx, 1 do
  295. if true == isRedByType(human,i) then
  296. return true
  297. end
  298. end
  299. return false
  300. end
  301. function NewFirstCharge_Query(human, nType)
  302. local bl = isUseNewCfg(human)
  303. local tAllConf, tItemConfByType = getNeedList(bl)
  304. local tTypeConf = nil
  305. local finalType = getFinalType(nType, bl)
  306. for _, v in pairs(tAllConf) do
  307. if v.nType == finalType then
  308. tTypeConf = v
  309. break
  310. end
  311. end
  312. if not tTypeConf then
  313. print("[NewFirstCharge_Query] 不存在对应类型的配置 nType = "..finalType)
  314. return
  315. end
  316. if not human.db.newFirstCharge then
  317. NewFirstCharge_CreateDB(human)
  318. end
  319. local tMsgData = Msg.gc.GC_NEW_FIRST_CHARGE_QUERY
  320. tMsgData.nType = nType
  321. tMsgData.nState = NewFirstCharge_GetBuyStatus(human, finalType)
  322. print("[NewFirstCharge_Query] 购买状态 nSatus = "..tMsgData.nState)
  323. tMsgData.nMoney = tTypeConf.nMoney
  324. tMsgData.tRed[0] = NEWFIRST_CHARGE_TYPE3
  325. local len = 0
  326. local startIdx, endIdx = getFinalOffset(human)
  327. for i = startIdx, endIdx, 1 do
  328. len = len + 1
  329. tMsgData.tRed[len] = 0
  330. if true == isRedByType(human, i) then
  331. tMsgData.tRed[len] = 1
  332. end
  333. end
  334. BuyLogic.fontBuyItem(human, tMsgData.buyItem, tTypeConf.nBuyID)
  335. tMsgData.list[0] = 0
  336. for i = 1, NEWFIRST_DAY, 1 do
  337. tMsgData.list[0] = tMsgData.list[0] + 1
  338. local tNodeData = tMsgData.list[tMsgData.list[0]]
  339. tNodeData.nState = NewFirstCharge_GetPrizeStauts(human, finalType, i)
  340. print("[NewFirstCharge_Query] 奖励天数状态 nSatus = "..tNodeData.nState.." i = "..i)
  341. tNodeData.nDay = i
  342. tNodeData.item[0] = 0
  343. local tItemConf = tItemConfByType[finalType][i]
  344. if not tItemConf then
  345. print("[NewFirstCharge_Query] 居然不存在对应的奖励配置")
  346. else
  347. for _, v in ipairs(tItemConf) do
  348. tNodeData.item[0] = tNodeData.item[0] + 1
  349. Grid.makeItem(tNodeData.item[tNodeData.item[0]], v[1], v[2])
  350. if v[3] then
  351. tNodeData.item[tNodeData.item[0]].rare = v[3]
  352. end
  353. end
  354. end
  355. end
  356. Msg.send(tMsgData, human.fd)
  357. -- print("[NewFirstCharge_Query] 发送数据成功\n")
  358. -- if human.db.nSpeed and _G.next(human.db.nSpeed) then
  359. -- table.print_lua_table(human.db.nSpeed)
  360. -- end
  361. end
  362. function NewFirstCharge_Get(human, nType)
  363. local bl = isUseNewCfg(human)
  364. local tAllConf, tItemConfByType = getNeedList(bl)
  365. local tTypeConf = nil
  366. local finalType = getFinalType(nType, bl)
  367. for _, v in pairs(tAllConf) do
  368. if v.nType == finalType then
  369. tTypeConf = v
  370. break
  371. end
  372. end
  373. if not tTypeConf or not tItemConfByType[finalType] then
  374. print("[NewFirstCharge_Get] 不存在对应类型的配置 nType = "..finalType)
  375. return
  376. end
  377. local nMoney = tTypeConf.nMoney
  378. local bChange = false
  379. local tItems = {}
  380. for nDay, value in pairs(tItemConfByType[finalType]) do
  381. local nStatus = NewFirstCharge_GetPrizeStauts(human, finalType, nDay)
  382. if NEWFIRST_STATE_CAT_GET == nStatus then
  383. for _, v in pairs(value) do
  384. table.insert(tItems, v)
  385. end
  386. if nDay == 1 then
  387. bChange = true
  388. local nIndex = tBuyID2Speed[nMoney]
  389. if not human.db.nSpeed then
  390. human.db.nSpeed = {}
  391. end
  392. human.db.nSpeed[nIndex] = 1
  393. end
  394. NewFirstCharge_SetPrizeStauts(human, finalType, nDay, NEWFIRST_STATE_HAD_GET)
  395. end
  396. end
  397. if nil ~= _G.next(tItems) then
  398. BagLogic.addItemList(human, tItems, "shouchong")
  399. for k, v in pairs(funcID) do
  400. YunYingLogic.updateIcon(YYInfo[k], human)
  401. YunYingLogic.sendGroupUpdate(YYInfo[k], human, PanelDefine.PANEL_ID_3302)
  402. break
  403. end
  404. -- 如果购买了老的首充且全部领完, 开启新加的首充
  405. if isUseNewCfg(human) then
  406. NewFirstCharge_CreateDB(human)
  407. NewFirstCharge_GetPrice(human)
  408. end
  409. NewFirstCharge_Query(human, nType)
  410. if true == bChange then
  411. ObjHuman.sendHumanInfo(human)
  412. end
  413. end
  414. end
  415. -- 获取所有礼包价格
  416. function NewFirstCharge_GetPrice(human)
  417. local bl = isUseNewCfg(human)
  418. local tAllConf = getNeedList(bl)
  419. local len = 0
  420. local tMsgData = Msg.gc.GC_NEW_FIRST_PRIZE_QUERY
  421. local tbl = {}
  422. for _,v in pairs(tAllConf) do
  423. len = len + 1
  424. tbl[len] = v.nMoney
  425. end
  426. tMsgData.priceList[0] = len
  427. table.sort(tbl)
  428. for k, v in ipairs(tbl) do
  429. tMsgData.priceList[k] = v
  430. end
  431. Msg.send(tMsgData, human.fd)
  432. end
  433. -- 充值回调
  434. function onCharge(human, nBuyID)
  435. -- print("[NewFirstChargeLogic-onCharge] nBuyID = "..nBuyID)
  436. local bl = isUseNewCfg(human)
  437. local tConfByBuyid = getNeedList(bl)
  438. local isChange = false
  439. if tConfByBuyid[nBuyID] then
  440. --print("[onCharge] nType = ".. tConfByBuyid[nBuyID].nType.." nBuyID = "..nBuyID)
  441. NewFirstCharge_SetBuyStatus(human, tConfByBuyid[nBuyID].nType)
  442. isChange = true
  443. -- 客户端只传1 ~3
  444. local targetType = tConfByBuyid[nBuyID].nType
  445. if bl then
  446. targetType = targetType - 3
  447. end
  448. -- NewFirstCharge_Query(human, tConfByBuyid[nBuyID].nType)
  449. NewFirstCharge_Query(human, targetType)
  450. if IsBuyAllgift(human) then
  451. local CombatPosLogic = require("combat.CombatPosLogic")
  452. CombatPosLogic.sendAllCombatPos(human)
  453. end
  454. else
  455. print("[NewFirstChargeLogic-onCharge] 不存在对应的礼包id nBuyID = "..nBuyID)
  456. return
  457. end
  458. if isChange then
  459. for k, v in pairs(funcID) do
  460. print("[NewFirstChargeLogic - onCharge], k = "..k)
  461. YunYingLogic.updateIcon(YYInfo[k], human)
  462. break
  463. end
  464. end
  465. end
  466. function updateDaily(human, funcID)
  467. if human.db.newFirstCharge then
  468. local nNowTime = os.time()
  469. -- for i = NEWFIRST_CHARGE_TYPE1, NEWFIRST_CHARGE_TYPE3, 1 do
  470. -- local nBuyStatus = NewFirstCharge_GetBuyStatus(human, i)
  471. -- local nLastTime = NewFirstCharge_GetTime(human, i)
  472. -- local bIsDay = Util.isSameDayByTimes(nNowTime, nLastTime)
  473. -- -- 遍历该类型全部天数
  474. -- if NEWFIRST_STATE_HAD_GET == nBuyStatus and true ~= bIsDay then
  475. -- for nDay = 1, NEWFIRST_DAY, 1 do
  476. -- local nDayStatus = NewFirstCharge_GetPrizeStauts(human, i, nDay)
  477. -- -- 当天奖励未领取
  478. -- if NEWFIRST_STATE_CANT_GET == nDayStatus then
  479. -- NewFirstCharge_SetPrizeStauts(human, i, nDay, NEWFIRST_STATE_CAT_GET)
  480. -- NewFirstCharge_SetTime(human, i, nNowTime)
  481. -- print("[NewFirstChargeLogic - updateDaily] 隔天刷新 奖励 nType = "..i.." nDay = "..nDay)
  482. -- break
  483. -- end
  484. -- end
  485. -- end
  486. -- end
  487. local startIdx, endIdx = getFinalOffset(human)
  488. for i = startIdx, endIdx do
  489. local nBuyStatus = NewFirstCharge_GetBuyStatus(human, i)
  490. local nLastTime = NewFirstCharge_GetTime(human, i)
  491. local bIsDay = Util.isSameDayByTimes(nNowTime, nLastTime)
  492. -- 遍历该类型全部天数
  493. if NEWFIRST_STATE_HAD_GET == nBuyStatus and true ~= bIsDay then
  494. for nDay = 1, NEWFIRST_DAY, 1 do
  495. local nDayStatus = NewFirstCharge_GetPrizeStauts(human, i, nDay)
  496. -- 当天奖励未领取
  497. if NEWFIRST_STATE_CANT_GET == nDayStatus then
  498. NewFirstCharge_SetPrizeStauts(human, i, nDay, NEWFIRST_STATE_CAT_GET)
  499. NewFirstCharge_SetTime(human, i, nNowTime)
  500. print("[NewFirstChargeLogic - updateDaily] 隔天刷新 奖励 nType = "..i.." nDay = "..nDay)
  501. break
  502. end
  503. end
  504. end
  505. end
  506. end
  507. end
  508. -- 是否已激活首充
  509. function isActive(human, YYInfo, funcConfig)
  510. return not isOpen(human, YYInfo, funcConfig)
  511. end
  512. -- 玩家整点
  513. function onZero(human, funcID)
  514. updateDaily(human, funcID)
  515. end
  516. -- GM 命令
  517. function NewFirstCharge_GMClear(human)
  518. human.db.newFirstCharge = nil
  519. print("[NewFirstCharge_GMClear] 清空完成")
  520. end
  521. -- 是否购买了所有的新首充礼包
  522. function IsBuyAllgift(human)
  523. local newFirstChargeData = human.db.newFirstCharge
  524. if not newFirstChargeData or not next(newFirstChargeData) then
  525. return false
  526. end
  527. local bl = true
  528. -- 旧礼包判断,1~3为旧礼包的类型
  529. for i=1, 3 do
  530. if not newFirstChargeData[i] or newFirstChargeData[i].nBuyTime <= 0 then
  531. bl = false
  532. break
  533. end
  534. end
  535. if bl then
  536. return true
  537. end
  538. -- 新礼包判断, 4~6为新礼包的类型
  539. bl = true
  540. for i=4, 6 do
  541. if not newFirstChargeData[i] or newFirstChargeData[i].nBuyTime <= 0 then
  542. bl = false
  543. break
  544. end
  545. end
  546. return bl
  547. end