|
|
@@ -18,6 +18,7 @@ local HeroGrowUp = require("absAct.HeroGrowUp")
|
|
|
local MengxinLogic = require("present.MengxinLogic")
|
|
|
local AbsZhanbuLunpanLogic = require("absAct.AbsZhanbuLunpanLogic")
|
|
|
local YunYingLogic = require("yunying.YunYingLogic")
|
|
|
+local TalismanLogic = require("talisman.TalismanLogic")
|
|
|
--[[
|
|
|
pool ����
|
|
|
hand ����
|
|
|
@@ -50,14 +51,22 @@ function initAfterStart()
|
|
|
end
|
|
|
end
|
|
|
|
|
|
+--获取最大占卜积分的加成值
|
|
|
+local function getMaxPointsAdd(human)
|
|
|
+ local maxPointsAdd = TalismanLogic.getTalismanAdd(human, TalismanLogic.OTHER_EFFECT_TBL.ZHANBU_MAX_POINTS) or 0
|
|
|
+ return maxPointsAdd
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
local function initDB(human)
|
|
|
if human.db.zhanbu == nil then
|
|
|
+ local maxPointsAdd = getMaxPointsAdd(human)
|
|
|
human.db.zhanbu = {}
|
|
|
local zhanbu = human.db.zhanbu
|
|
|
zhanbu.hand = {}
|
|
|
zhanbu.handCnt = 0
|
|
|
zhanbu.handMaxCnt = 4 -- ���������Ϊ4��
|
|
|
- zhanbu.money = AUTO_GET_MONEY_MAX
|
|
|
+ zhanbu.money = AUTO_GET_MONEY_MAX + maxPointsAdd
|
|
|
zhanbu.lv = 1
|
|
|
zhanbu.isGuide = 1
|
|
|
zhanbu.refreshCnt = 0
|
|
|
@@ -177,23 +186,26 @@ function zhanbuQuery(human)
|
|
|
end
|
|
|
msgRet.hand[0] = len
|
|
|
|
|
|
+ local maxPointsAdd = getMaxPointsAdd(human)
|
|
|
msgRet.cardRate = Util.copyTable(ZhanbuExcel.poolLv[human.db.zhanbu.lv].weight)
|
|
|
msgRet.cardRate[0] = 3
|
|
|
|
|
|
msgRet.lv = human.db.zhanbu.lv
|
|
|
|
|
|
msgRet.money = human.db.zhanbu.money
|
|
|
- msgRet.moneyMax = AUTO_GET_MONEY_MAX
|
|
|
+ msgRet.moneyMax = AUTO_GET_MONEY_MAX + maxPointsAdd
|
|
|
msgRet.moneyCost = 1
|
|
|
msgRet.nextRecover = AUTO_GET_MONEY_TS
|
|
|
msgRet.recoverTs = AUTO_GET_MONEY_TS
|
|
|
if human.db.zhanbu.ts then
|
|
|
local now = os.time()
|
|
|
msgRet.nextRecover = human.db.zhanbu.ts + AUTO_GET_MONEY_TS - now
|
|
|
+ if msgRet.nextRecover < 0 then
|
|
|
+ msgRet.nextRecover = 0
|
|
|
+ end
|
|
|
end
|
|
|
|
|
|
msgRet.hasRed = xinyiDot(human) and 1 or 0
|
|
|
-
|
|
|
Msg.send(msgRet,human.fd)
|
|
|
end
|
|
|
|
|
|
@@ -227,13 +239,14 @@ function buyCard(human,index,heroID)
|
|
|
local msgRet = Msg.gc.GC_ZHANBU_BUY_CARD
|
|
|
|
|
|
-- �ɺϳ���Ƭ
|
|
|
+ local maxPointsAdd = getMaxPointsAdd(human)
|
|
|
if sameCnt >= 2 then
|
|
|
-- �۳�����
|
|
|
human.db.zhanbu.money = human.db.zhanbu.money - config.price
|
|
|
RoleSystemLogic.onDot(human,RoleSystemDefine.ROLE_SYS_ID_502)
|
|
|
|
|
|
-- �Զ��ظ���ʱ
|
|
|
- if human.db.zhanbu.money < AUTO_GET_MONEY_MAX then
|
|
|
+ if human.db.zhanbu.money < AUTO_GET_MONEY_MAX + maxPointsAdd then
|
|
|
human.db.zhanbu.ts = human.db.zhanbu.ts or os.time()
|
|
|
end
|
|
|
|
|
|
@@ -279,7 +292,7 @@ function buyCard(human,index,heroID)
|
|
|
RoleSystemLogic.onDot(human,RoleSystemDefine.ROLE_SYS_ID_502)
|
|
|
|
|
|
-- �Զ��ظ���ʱ
|
|
|
- if human.db.zhanbu.money < AUTO_GET_MONEY_MAX then
|
|
|
+ if human.db.zhanbu.money < AUTO_GET_MONEY_MAX + maxPointsAdd then
|
|
|
human.db.zhanbu.ts = human.db.zhanbu.ts or os.time()
|
|
|
end
|
|
|
|
|
|
@@ -329,7 +342,8 @@ function sellCard(human,index,heroID)
|
|
|
RoleSystemLogic.onDot(human,RoleSystemDefine.ROLE_SYS_ID_502)
|
|
|
|
|
|
-- �Զ��ظ���ʱ
|
|
|
- if human.db.zhanbu.money >= AUTO_GET_MONEY_MAX then
|
|
|
+ local maxPointsAdd = getMaxPointsAdd(human)
|
|
|
+ if human.db.zhanbu.money >= AUTO_GET_MONEY_MAX + maxPointsAdd then
|
|
|
human.db.zhanbu.ts = nil
|
|
|
end
|
|
|
|
|
|
@@ -396,7 +410,8 @@ function refreshCardPool(human)
|
|
|
RoleSystemLogic.onDot(human,RoleSystemDefine.ROLE_SYS_ID_502)
|
|
|
|
|
|
-- �Զ��ظ���ʱ
|
|
|
- if human.db.zhanbu.money < AUTO_GET_MONEY_MAX then
|
|
|
+ local maxPointsAdd = getMaxPointsAdd(human)
|
|
|
+ if human.db.zhanbu.money < AUTO_GET_MONEY_MAX + maxPointsAdd then
|
|
|
human.db.zhanbu.ts = human.db.zhanbu.ts or os.time()
|
|
|
end
|
|
|
|
|
|
@@ -503,17 +518,19 @@ function checkRecover()
|
|
|
local now = os.time()
|
|
|
for _,human in pairs(ObjHuman.onlineUuid) do
|
|
|
if human.db.zhanbu and human.db.zhanbu.ts then
|
|
|
+ local maxPointsAdd = getMaxPointsAdd(human)
|
|
|
+ local finalMaxPoints = maxPointsAdd + AUTO_GET_MONEY_MAX
|
|
|
local ts = now - human.db.zhanbu.ts
|
|
|
local cnt = math.floor(ts/AUTO_GET_MONEY_TS)
|
|
|
- if cnt >= 1 and human.db.zhanbu.money < AUTO_GET_MONEY_MAX then
|
|
|
+ if cnt >= 1 and human.db.zhanbu.money < finalMaxPoints then
|
|
|
human.db.zhanbu.money = human.db.zhanbu.money + cnt
|
|
|
human.db.zhanbu.ts = human.db.zhanbu.ts + AUTO_GET_MONEY_TS * cnt
|
|
|
- if human.db.zhanbu.money >= AUTO_GET_MONEY_MAX then
|
|
|
+ if human.db.zhanbu.money >= finalMaxPoints then
|
|
|
human.db.zhanbu.ts = nil
|
|
|
- human.db.zhanbu.money = AUTO_GET_MONEY_MAX
|
|
|
+ human.db.zhanbu.money = finalMaxPoints
|
|
|
end
|
|
|
RoleSystemLogic.onDot(human,RoleSystemDefine.ROLE_SYS_ID_502)
|
|
|
- elseif human.db.zhanbu.money >= AUTO_GET_MONEY_MAX then
|
|
|
+ elseif human.db.zhanbu.money >= finalMaxPoints then
|
|
|
human.db.zhanbu.ts = nil
|
|
|
end
|
|
|
end
|
|
|
@@ -542,8 +559,29 @@ function updateDaily(human)
|
|
|
end
|
|
|
human.db.zhanbu.lv = 1
|
|
|
human.db.zhanbu.refreshCnt = 0
|
|
|
+
|
|
|
+ if human.db.zhanbu and human.db.zhanbu.money then
|
|
|
+ local ts = human.db.zhanbu.ts
|
|
|
+ local maxPointsAdd = getMaxPointsAdd(human)
|
|
|
+ if not ts and human.db.zhanbu.money < AUTO_GET_MONEY_MAX + maxPointsAdd then
|
|
|
+ human.db.zhanbu.ts = os.time()
|
|
|
+ end
|
|
|
+ end
|
|
|
end
|
|
|
|
|
|
+function onLogin(human)
|
|
|
+ --处理mone达到老的上限值后, human.db.zhanbu.ts为nil,导致后面获得秘宝时,无法获得秘宝加成情况
|
|
|
+ if human.db.zhanbu and human.db.zhanbu.money then
|
|
|
+ local ts = human.db.zhanbu.ts
|
|
|
+ local maxPointsAdd = getMaxPointsAdd(human)
|
|
|
+ if not ts and human.db.zhanbu.money < AUTO_GET_MONEY_MAX + maxPointsAdd then
|
|
|
+ human.db.zhanbu.ts = os.time()
|
|
|
+ end
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
function addZhanbuItem(human,cnt)
|
|
|
-- ��ʼ������
|
|
|
initDB(human)
|