|
|
@@ -20,9 +20,6 @@ local HeroLogic = require("hero.HeroLogic")
|
|
|
local BagLogic = require("bag.BagLogic")
|
|
|
local HeroGrid = require("hero.HeroGrid")
|
|
|
local DrawCardExcel = require("excel.drawCard").drawCard
|
|
|
-local DrawCardV2Excel = require("excel.drawCard").drawCardV2
|
|
|
-local DrawLevelExcel = require("excel.drawCard").drawLevel
|
|
|
-local CampWeightExcel = require("excel.drawCard").campWeight
|
|
|
local DrawCardActivityExcel = require("excel.drawCard").activity
|
|
|
local DailyTaskLogic = require("dailyTask.DailyTaskLogic")
|
|
|
local ChengjiuLogic = require("chengjiu.ChengjiuLogic")
|
|
|
@@ -31,7 +28,7 @@ local HeroExcel = require("excel.hero").hero
|
|
|
local MailExcel = require("excel.mail")
|
|
|
local MailManager = require("mail.MailManager")
|
|
|
local ChatPaoMaLogic = require("chat.ChatPaoMaLogic")
|
|
|
-local MonthSummon = require("monthAct.MonthSummon")
|
|
|
+local MonthSummon = require("monthAct.MonthSummon")
|
|
|
local HeroBook = require("hero.HeroBook")
|
|
|
local RoleDefine = require("role.RoleDefine")
|
|
|
local RoleSystemLogic = require("roleSystem.RoleSystemLogic")
|
|
|
@@ -53,38 +50,45 @@ local VipLogic = require("vip.VipLogic")
|
|
|
local MengxinLogic = require("present.MengxinLogic")
|
|
|
local LimitPerpleHeroLogic = require("present.LimitPerpleHeroLogic")
|
|
|
local HeroComeLogic = require("absAct.HeroComeLogic")
|
|
|
-local Log = require("common.Log")
|
|
|
+local NewHeroLogic = require("absAct.NewHeroLogic")
|
|
|
Json = Json or require("common.Json")
|
|
|
|
|
|
-DRAWCARD_ID0 = 0 -- 积分召唤
|
|
|
-DRAWCARD_ID1 = 1 -- 基础召唤
|
|
|
-DRAWCARD_ID2 = 2 -- 高级召唤
|
|
|
-DRAWCARD_ID3 = 3 -- 友情召唤
|
|
|
-DRAWCARD_ID4 = 4 -- 积分召唤权重
|
|
|
-DRAWCARD_ID5 = 5 -- 高级召唤十连抽必出
|
|
|
-DRAWCARD_ID6 = 6 -- 高级召唤单抽
|
|
|
-DRAWCARD_ID7 = 7 -- 40高抽必出SSR
|
|
|
-
|
|
|
-DRAWCARD_OP_1 = 1 -- 召唤1次
|
|
|
-DRAWCARD_OP_2 = 2 -- 召唤10次
|
|
|
+DRAWCARD_ID0 = 0 -- 积分召唤
|
|
|
+DRAWCARD_ID1 = 1 -- 基础召唤
|
|
|
+DRAWCARD_ID2 = 2 -- 高级召唤
|
|
|
+DRAWCARD_ID3 = 3 -- 友情召唤
|
|
|
+DRAWCARD_ID4 = 4 -- 积分召唤权重
|
|
|
+DRAWCARD_ID5 = 5 -- 高级召唤十连抽必出
|
|
|
+DRAWCARD_ID6 = 6 -- 高级召唤单抽
|
|
|
+DRAWCARD_ID7 = 7 -- 40高抽必出SSR
|
|
|
+DRAWCARD_ID8 = 8 -- 新英雄活动抽卡
|
|
|
+DRAWCARD_ID9 = 9 -- 100高抽必出新英雄
|
|
|
+DRAWCARD_ID10 = 10 -- 新英雄活动十抽
|
|
|
+DRAWCARD_ID11 = 11 -- 新英雄活动40抽必出
|
|
|
+
|
|
|
+DRAWCARD_OP_1 = 1 -- 召唤1次
|
|
|
+DRAWCARD_OP_2 = 2 -- 召唤10次
|
|
|
|
|
|
DRAWCARD_JIFEN_NEED_VIPLV = 3
|
|
|
DRAWCARD_JIFEN_SHOW_ITEM = 801005
|
|
|
|
|
|
MAX_JIFEN = 3000
|
|
|
|
|
|
-DRAWCARD_40 = 40 -- 40连抽,必得SSR
|
|
|
-
|
|
|
-AD_RESET_FREECNT = 4
|
|
|
+DRAWCARD_40 = 40 -- 40连抽,必得SSR
|
|
|
+DRAWCARD_100 = 100 -- 新英雄抽卡活动期间100抽必得
|
|
|
|
|
|
-- 积分
|
|
|
function getJifen(human)
|
|
|
- return human.db.drawCard.jifen
|
|
|
+ return human.db.drawCard.jifen
|
|
|
end
|
|
|
|
|
|
function updateJifen(human, d)
|
|
|
- human.db.drawCard.jifen = human.db.drawCard.jifen or 0
|
|
|
- human.db.drawCard.jifen = human.db.drawCard.jifen + d
|
|
|
+ human.db.drawCard.jifen = human.db.drawCard.jifen or 0
|
|
|
+ human.db.drawCard.jifen = human.db.drawCard.jifen + d
|
|
|
+end
|
|
|
+
|
|
|
+function addJifen(human,val)
|
|
|
+ human.db.drawCard.jifen = human.db.drawCard.jifen + val
|
|
|
end
|
|
|
|
|
|
-- 根据抽奖id获取相关信息
|
|
|
@@ -95,19 +99,19 @@ end
|
|
|
-- 免费CD
|
|
|
function getFreeInfo(human, id)
|
|
|
if id ~= DRAWCARD_ID1 and id ~= DRAWCARD_ID2 then
|
|
|
- return 0, 0 --只有普通和高抽可以免费
|
|
|
+ return 0, 0 --只有普通和高抽可以免费
|
|
|
end
|
|
|
|
|
|
local info = getDrawInfo(human, id)
|
|
|
local config = DrawCardExcel[id]
|
|
|
local leftCnt = 1
|
|
|
local leftTime = 0
|
|
|
- if not info.time then
|
|
|
+ if not info.time then
|
|
|
return leftCnt, leftTime
|
|
|
end
|
|
|
leftTime = math.max(info.time - os.time(), 0)
|
|
|
if leftTime > 1 then
|
|
|
- leftCnt = 0
|
|
|
+ leftCnt = 0
|
|
|
end
|
|
|
return leftCnt, leftTime
|
|
|
end
|
|
|
@@ -115,7 +119,7 @@ end
|
|
|
-- 设置免费冷却CD
|
|
|
function setUseFree(human, id)
|
|
|
local info = getDrawInfo(human, id)
|
|
|
- if not info then return end
|
|
|
+ if not info then return end
|
|
|
local config = DrawCardExcel[id]
|
|
|
info.time = Util.getDayStartTime(os.time()) + 86400
|
|
|
end
|
|
|
@@ -138,7 +142,7 @@ end
|
|
|
|
|
|
function addDraw2Cnt(human, id, cnt)
|
|
|
local info = getDrawInfo(human, id)
|
|
|
- if not info then return end
|
|
|
+ if not info then return end
|
|
|
info.cntHero2 = (info.cntHero2 or 0) + cnt
|
|
|
end
|
|
|
|
|
|
@@ -151,65 +155,10 @@ end
|
|
|
|
|
|
function addDrawCnt(human, id, cnt)
|
|
|
local info = getDrawInfo(human, id)
|
|
|
- if not info then return end
|
|
|
+ if not info then return end
|
|
|
info.cntHero = (info.cntHero or 0) + cnt
|
|
|
end
|
|
|
|
|
|
-function getDrawLv(human, id)
|
|
|
- local info = getDrawInfo(human, id)
|
|
|
- if not info then return 0 end
|
|
|
- return info.drawLV or 0
|
|
|
-end
|
|
|
-
|
|
|
-function getDrawCurCnt(human, id)
|
|
|
- local info = getDrawInfo(human, id)
|
|
|
- if not info then return 0 end
|
|
|
-
|
|
|
- info.drawLV = info.drawLV or 0
|
|
|
- info.cntHero3 = info.cntHero3 or 0
|
|
|
-
|
|
|
- if info.cntHero3 == 0 then return 0 end
|
|
|
-
|
|
|
- local drawCurCnt = 0
|
|
|
- local drawNextLvCnt = DrawLevelExcel[info.drawLV]
|
|
|
- if not drawNextLvCnt then
|
|
|
- drawCurCnt = (info.cntHero3 - 0)
|
|
|
- else
|
|
|
- drawCurCnt = (info.cntHero3 - drawNextLvCnt.need)
|
|
|
- end
|
|
|
- return drawCurCnt
|
|
|
-end
|
|
|
-
|
|
|
-function addDrawLv(human, id, cnt)
|
|
|
- local info = getDrawInfo(human, id)
|
|
|
-
|
|
|
- if not info then return end
|
|
|
-
|
|
|
- info.drawLV = info.drawLV or 0
|
|
|
- info.cntHero3 = (info.cntHero3 or 0) + cnt
|
|
|
-
|
|
|
- if info.drawLV >= 15 then return end
|
|
|
-
|
|
|
- for lv, val in ipairs(DrawLevelExcel) do
|
|
|
- if info.cntHero3 >= val.need then
|
|
|
- info.drawLV = lv
|
|
|
- end
|
|
|
- end
|
|
|
-end
|
|
|
-
|
|
|
-function getDrawNextLvCnt(human, id)
|
|
|
- local info = getDrawInfo(human, id)
|
|
|
-
|
|
|
- if not info then return end
|
|
|
-
|
|
|
- info.drawLV = info.drawLV or 0
|
|
|
-
|
|
|
- local drawLevelNeed = DrawLevelExcel[info.drawLV + 1]
|
|
|
- if not drawLevelNeed then return end
|
|
|
-
|
|
|
- return drawLevelNeed.need or 0
|
|
|
-end
|
|
|
-
|
|
|
function setSkip(human, id, skip)
|
|
|
human.db.drawCard.skip = skip or 0
|
|
|
end
|
|
|
@@ -223,7 +172,7 @@ end
|
|
|
|
|
|
function addDrawNoGoodCnt(human, id, cnt)
|
|
|
local info = getDrawInfo(human, id)
|
|
|
- if not info then return end
|
|
|
+ if not info then return end
|
|
|
|
|
|
info.chengjiuCnt = (info.chengjiuCnt or 0) + cnt
|
|
|
end
|
|
|
@@ -249,10 +198,31 @@ function clearDrawNoSSRCnt(human, id)
|
|
|
info.leftSSRCnt = nil
|
|
|
end
|
|
|
|
|
|
-function clearDrawNoGoodCnt(human, id)
|
|
|
+function getDrawNewSSRCnt(human, id)
|
|
|
local info = getDrawInfo(human, id)
|
|
|
+ if not info then return 0 end
|
|
|
+
|
|
|
+ return info.leftNewSRRCnt or 0
|
|
|
+end
|
|
|
+
|
|
|
+function addDrawNewSSRCnt(human, id, cnt)
|
|
|
+ local info = getDrawInfo(human, id, cnt)
|
|
|
if not info then return end
|
|
|
|
|
|
+ info.leftNewSRRCnt = (info.leftNewSRRCnt or 0) + cnt
|
|
|
+end
|
|
|
+
|
|
|
+function clearDrawNewSSRCnt(human, id)
|
|
|
+ local info = getDrawInfo(human, id)
|
|
|
+ if not info then return end
|
|
|
+
|
|
|
+ info.leftNewSRRCnt = nil
|
|
|
+end
|
|
|
+
|
|
|
+function clearDrawNoGoodCnt(human, id)
|
|
|
+ local info = getDrawInfo(human, id)
|
|
|
+ if not info then return end
|
|
|
+
|
|
|
info.chengjiuCnt = nil
|
|
|
end
|
|
|
|
|
|
@@ -272,15 +242,15 @@ function fontDrawCardNet(net, id, human)
|
|
|
net.items[0] = net.items[0] + 1
|
|
|
Grid.makeItem(net.items[net.items[0]], config.item1[1], config.item1[2])
|
|
|
end
|
|
|
-
|
|
|
+
|
|
|
local vipArg = 100
|
|
|
if id == DRAWCARD_ID2 then
|
|
|
vipArg = VipLogic.getPowerArgs(human, VipLogic.VIP_POWER21)
|
|
|
end
|
|
|
|
|
|
if config.item2[1] and config.item2[2] then
|
|
|
- net.items[0] = net.items[0] + 1
|
|
|
- Grid.makeItem(net.items[net.items[0]], config.item2[1], math.floor(config.item2[2] * vipArg / 100))
|
|
|
+ net.items[0] = net.items[0] + 1
|
|
|
+ Grid.makeItem(net.items[net.items[0]], config.item2[1], math.floor(config.item2[2] * vipArg / 100 ) )
|
|
|
end
|
|
|
|
|
|
vipArg = 0
|
|
|
@@ -295,44 +265,36 @@ function fontDrawCardNet(net, id, human)
|
|
|
net.canBuy = ItemExcel.buy[config.item1[1]] and 1 or 0
|
|
|
end
|
|
|
|
|
|
--- 三个抽奖列表
|
|
|
+-- 抽奖列表
|
|
|
function query(human)
|
|
|
local msgRet = Msg.gc.GC_DRAWCARD_QUERY
|
|
|
msgRet.jifen = getJifen(human)
|
|
|
msgRet.left = getDrawNoSSRCnt(human, DRAWCARD_ID2)
|
|
|
msgRet.leftNoSRRCnt = DRAWCARD_40 - getDrawNoSSRCnt(human, DRAWCARD_ID2)
|
|
|
+ msgRet.leftNewSRRCnt = getDrawNewSSRCnt(human, DRAWCARD_ID8)
|
|
|
+ msgRet.leftNewSRR40Cnt = DRAWCARD_40 - getDrawNoSSRCnt(human, DRAWCARD_ID8)
|
|
|
msgRet.list[0] = 0
|
|
|
- for id = DRAWCARD_ID1, DRAWCARD_ID3 do
|
|
|
+
|
|
|
+ local ids = {DRAWCARD_ID1, DRAWCARD_ID2, DRAWCARD_ID3, DRAWCARD_ID8}
|
|
|
+ for i = 1, #ids do
|
|
|
msgRet.list[0] = msgRet.list[0] + 1
|
|
|
local net = msgRet.list[msgRet.list[0]]
|
|
|
- fontDrawCardNet(net, id, human)
|
|
|
+ fontDrawCardNet(net, ids[i], human)
|
|
|
end
|
|
|
|
|
|
local needItemID = ItemDefine.ITEM_XIANZHI_BAOZHU_ID
|
|
|
Grid.makeItem(msgRet.qiyuan, needItemID, 1)
|
|
|
msgRet.skip = human.db.drawCard.skip or 0
|
|
|
- -- 高级召唤v2需要返回
|
|
|
- msgRet.drawCurCnt = getDrawCurCnt(human, DRAWCARD_ID2)
|
|
|
- msgRet.drawLv = getDrawLv(human, DRAWCARD_ID2)
|
|
|
- msgRet.drawNextLvCnt = getDrawNextLvCnt(human, DRAWCARD_ID2)
|
|
|
- msgRet.drawAdCnt = getResetAdCnt(human)
|
|
|
Msg.send(msgRet, human.fd)
|
|
|
end
|
|
|
|
|
|
--- 获取剩余广告观看次数
|
|
|
-function getResetAdCnt(human)
|
|
|
- local adRewardCnt = human.db.adRewardCnt or 0
|
|
|
- -- if adRewardCnt > 3 then
|
|
|
- -- human.db.adRewardCnt = 0
|
|
|
- -- end
|
|
|
- return math.max(AD_RESET_FREECNT - adRewardCnt, 0)
|
|
|
-end
|
|
|
-
|
|
|
-- 抽奖结果
|
|
|
-function sendDrawOp(human, id, op, heroList, items, heroNewList, heroIndexList, isAct)
|
|
|
+function sendDrawOp(human, id, op, heroList, items, heroNewList, heroIndexList,isAct)
|
|
|
local msgRet = Msg.gc.GC_DRAWCARD_OP
|
|
|
msgRet.isAct = isAct or 0
|
|
|
msgRet.leftNoSRRCnt = DRAWCARD_40 - getDrawNoSSRCnt(human, DRAWCARD_ID2)
|
|
|
+ msgRet.leftNewSRRCnt = getDrawNewSSRCnt(human, DRAWCARD_ID8)
|
|
|
+ msgRet.leftNewSRR40Cnt = DRAWCARD_40 - getDrawNoSSRCnt(human, DRAWCARD_ID8)
|
|
|
local dataNet = msgRet.data
|
|
|
dataNet.jifen = getJifen(human)
|
|
|
dataNet.id = id
|
|
|
@@ -342,7 +304,7 @@ function sendDrawOp(human, id, op, heroList, items, heroNewList, heroIndexList,
|
|
|
local heroID = heroList[i]
|
|
|
local isNew = heroNewList and heroNewList[i]
|
|
|
local index = heroIndexList and heroIndexList[i]
|
|
|
- HeroGrid.makeHeroNice(dataNet.heros[i], heroID, nil, isNew, index,human)
|
|
|
+ HeroGrid.makeHeroNice(dataNet.heros[i], heroID, nil, isNew, index, human)
|
|
|
end
|
|
|
dataNet.items[0] = 0
|
|
|
if items and type(items) == "table" then
|
|
|
@@ -352,12 +314,6 @@ function sendDrawOp(human, id, op, heroList, items, heroNewList, heroIndexList,
|
|
|
end
|
|
|
end
|
|
|
fontDrawCardNet(msgRet.drawData, id, human)
|
|
|
-
|
|
|
- -- 高级召唤v2需要返回
|
|
|
- msgRet.drawCurCnt = getDrawCurCnt(human, DRAWCARD_ID2)
|
|
|
- msgRet.drawLv = getDrawLv(human, DRAWCARD_ID2)
|
|
|
- msgRet.drawNextLvCnt = getDrawNextLvCnt(human, DRAWCARD_ID2)
|
|
|
- msgRet.drawAdCnt = getResetAdCnt(human)
|
|
|
Msg.send(msgRet, human.fd)
|
|
|
end
|
|
|
|
|
|
@@ -375,22 +331,21 @@ local function jifenDraw(human, isAct)
|
|
|
if HeroLogic.getEmptyCnt(human) < 1 then
|
|
|
return Broadcast.sendErr(human, Lang.HERO_BAG_FULL)
|
|
|
end
|
|
|
-
|
|
|
+
|
|
|
local heroID = randHeroID(human, DRAWCARD_ID4, DRAWCARD_OP_1, config)
|
|
|
|
|
|
- updateJifen(human, -MAX_JIFEN)
|
|
|
-
|
|
|
+ updateJifen(human, -MAX_JIFEN)
|
|
|
+
|
|
|
local heroConfig = HeroExcel[heroID]
|
|
|
- ChatPaoMaLogic.broadcast(human, ChatPaoMaLogic.PAOMA_TYPE_BROAD_TYPE4, heroConfig.grade, heroID)
|
|
|
+ ChatPaoMaLogic.broadcast(human, ChatPaoMaLogic.PAOMA_TYPE_BROAD_TYPE4, heroConfig.grade, heroID)
|
|
|
local isNew = not HeroBook.isGet(human, heroConfig.id, heroConfig.star)
|
|
|
- local heroIndex, fenjielist = HeroLogic.addHero(human, heroID, nil, 1, "draw_card")
|
|
|
- Log.write(Log.LOGID_OSS_DRAWCARD, human.db._id, human.db.account, human.db.name, human.db.lv, DRAWCARD_ID4, heroID, 0,
|
|
|
- 0, 0, db.jifen)
|
|
|
- sendDrawOp(human, DRAWCARD_ID4, 0, { heroID }, fenjielist, { isNew }, { heroIndex }, isAct)
|
|
|
+ local heroIndex, fenjielist = HeroLogic.addHero(human, heroID,nil, 1, "draw_card")
|
|
|
+ Log.write(Log.LOGID_OSS_DRAWCARD, human.db._id, human.db.account, human.db.name, human.db.lv, DRAWCARD_ID4, heroID, 0, 0, 0, db.jifen)
|
|
|
+ sendDrawOp(human, DRAWCARD_ID4, 0, {heroID}, fenjielist, {isNew}, {heroIndex}, isAct)
|
|
|
end
|
|
|
|
|
|
-- 检查道具+扣道具
|
|
|
-function checkUseItem(human, id, op, config, isAct)
|
|
|
+function checkUseItem(human, id, op, config,isAct)
|
|
|
local item = config["item" .. op]
|
|
|
local zuanshi = config["zuanshi" .. op]
|
|
|
if not item or not zuanshi then return end
|
|
|
@@ -401,17 +356,16 @@ function checkUseItem(human, id, op, config, isAct)
|
|
|
if id == DRAWCARD_ID2 and op == DRAWCARD_OP_2 then
|
|
|
local vipArg = 100
|
|
|
vipArg = VipLogic.getPowerArgs(human, VipLogic.VIP_POWER21)
|
|
|
- print(" checkUseItem vipArg ", vipArg, " , old : ", itemCnt, " , new : ",
|
|
|
- math.floor(itemCnt * vipArg / 100))
|
|
|
- itemCnt = math.floor(itemCnt * vipArg / 100)
|
|
|
- end
|
|
|
+ print(" checkUseItem vipArg ", vipArg, " , old : " ,itemCnt , " , new : ", math.floor(itemCnt * vipArg / 100 ) )
|
|
|
+ itemCnt = math.floor(itemCnt * vipArg / 100 )
|
|
|
+ end
|
|
|
print(" checkUseItem itemID itemCnt ", itemID, itemCnt)
|
|
|
-- 活动只扣道具
|
|
|
if isAct == AbsActDefine.ABS_ACT_TYPE_4 then
|
|
|
- local state, id = AbsActLogic.isStartedByType(human, AbsActDefine.ABS_ACT_TYPE_4)
|
|
|
+ local state,id = AbsActLogic.isStartedByType(human, AbsActDefine.ABS_ACT_TYPE_4)
|
|
|
if not state then
|
|
|
return
|
|
|
- end
|
|
|
+ end
|
|
|
local config = PerpleHeroLogic.getConfigByActID(id)
|
|
|
itemID = config["item" .. op][1]
|
|
|
itemCnt = config["item" .. op][2]
|
|
|
@@ -422,10 +376,10 @@ function checkUseItem(human, id, op, config, isAct)
|
|
|
return
|
|
|
end
|
|
|
elseif isAct == AbsActDefine.ABS_ACT_TYPE_19 then
|
|
|
- local state, id = AbsActLogic.isStartedByType(human, AbsActDefine.ABS_ACT_TYPE_19)
|
|
|
+ local state,id = AbsActLogic.isStartedByType(human, AbsActDefine.ABS_ACT_TYPE_19)
|
|
|
if not state then
|
|
|
return
|
|
|
- end
|
|
|
+ end
|
|
|
local config = HeroComeLogic.getConfigByActID(id)
|
|
|
itemID = config["item" .. op][1]
|
|
|
itemCnt = config["item" .. op][2]
|
|
|
@@ -438,7 +392,7 @@ function checkUseItem(human, id, op, config, isAct)
|
|
|
elseif isAct == AbsActDefine.OA_ACT_TYPE_501 then
|
|
|
local limitState = LimitPerpleHeroLogic.checkOpen()
|
|
|
if not limitState then
|
|
|
- return
|
|
|
+ return
|
|
|
end
|
|
|
local config = LimitPerpleHeroLogic.getConfigByActID()
|
|
|
itemID = config["item" .. op][1]
|
|
|
@@ -455,7 +409,7 @@ function checkUseItem(human, id, op, config, isAct)
|
|
|
setUseFree(human, id)
|
|
|
return true
|
|
|
elseif BagLogic.getItemCnt(human, itemID) >= itemCnt then -- 扣道具
|
|
|
- BagLogic.delItem(human, itemID, itemCnt, "draw_card")
|
|
|
+ BagLogic.delItem(human, itemID, itemCnt, "draw_card")
|
|
|
return true
|
|
|
elseif zuanshi > 0 then -- 扣钻石
|
|
|
-- 抵扣道具
|
|
|
@@ -466,28 +420,27 @@ function checkUseItem(human, id, op, config, isAct)
|
|
|
vipArg = VipLogic.getPowerArgs(human, VipLogic.VIP_POWER22)
|
|
|
end
|
|
|
zuanshi = zuanshi + vipArg
|
|
|
- if haveCnt > 0 then
|
|
|
- zuanshi = zuanshi - math.floor(zuanshi * haveCnt / itemCnt)
|
|
|
+ if haveCnt > 0 then
|
|
|
+ zuanshi = zuanshi - math.floor(zuanshi * haveCnt / itemCnt)
|
|
|
zuanshi = zuanshi > 0 and zuanshi or 0
|
|
|
- end
|
|
|
+ end
|
|
|
|
|
|
if not ObjHuman.checkRMB(human, zuanshi) then
|
|
|
- return
|
|
|
+ return
|
|
|
end
|
|
|
-
|
|
|
if haveCnt > 0 then
|
|
|
- BagLogic.delItem(human, itemID, haveCnt, "draw_card")
|
|
|
+ BagLogic.delItem(human, itemID, haveCnt, "draw_card")
|
|
|
end
|
|
|
ObjHuman.decZuanshi(human, -zuanshi, "draw_card")
|
|
|
return true
|
|
|
end
|
|
|
|
|
|
if zuanshi <= 0 then
|
|
|
- Broadcast.sendErr(human, Util.format(Lang.DRAWCARD_ERR_NOITEM, ItemDefine.getValue(itemID, "name")))
|
|
|
+ Broadcast.sendErr(human, Util.format(Lang.DRAWCARD_ERR_NOITEM, ItemDefine.getValue(itemID, "name")))
|
|
|
end
|
|
|
end
|
|
|
|
|
|
---
|
|
|
+--
|
|
|
function randHeroID(human, id, op, config, actConfig, randomIndex, isAct)
|
|
|
if isAct == 0 then
|
|
|
if id == DRAWCARD_ID1 and op == DRAWCARD_OP_1 and getDrawCnt(human, id) == 0 then
|
|
|
@@ -497,34 +450,34 @@ function randHeroID(human, id, op, config, actConfig, randomIndex, isAct)
|
|
|
return SysParameter.getSysParameter(SysParameter.PARAMETER_7)
|
|
|
end
|
|
|
end
|
|
|
-
|
|
|
+
|
|
|
if randomIndex and isAct == 0 then
|
|
|
if id == DRAWCARD_ID2 and op == DRAWCARD_OP_2 then
|
|
|
- local sysHeroList = nil
|
|
|
- local draw2Cnt = getDraw2Cnt(human, id)
|
|
|
- draw2Cnt = math.floor(draw2Cnt / 10)
|
|
|
- if draw2Cnt == 0 then
|
|
|
- sysHeroList = SysParameter.getSysParameterTb(SysParameter.PARAMETER_11)
|
|
|
- elseif draw2Cnt == 1 then
|
|
|
- sysHeroList = SysParameter.getSysParameterTb(SysParameter.PARAMETER_12)
|
|
|
- elseif draw2Cnt == 2 then
|
|
|
- sysHeroList = SysParameter.getSysParameterTb(SysParameter.PARAMETER_13)
|
|
|
- end
|
|
|
-
|
|
|
- if sysHeroList then
|
|
|
- local totoalWeight = 0
|
|
|
- for i = 1, #sysHeroList do
|
|
|
- totoalWeight = totoalWeight + sysHeroList[i][2]
|
|
|
- end
|
|
|
-
|
|
|
- local r = math.random(1, totoalWeight)
|
|
|
- for i = 1, #sysHeroList do
|
|
|
- if r <= sysHeroList[i][2] then
|
|
|
- return sysHeroList[i][1]
|
|
|
- end
|
|
|
- r = r - sysHeroList[i][2]
|
|
|
- end
|
|
|
- end
|
|
|
+ local sysHeroList = nil
|
|
|
+ local draw2Cnt = getDraw2Cnt(human, id)
|
|
|
+ draw2Cnt = math.floor(draw2Cnt/10)
|
|
|
+ if draw2Cnt == 0 then
|
|
|
+ sysHeroList = SysParameter.getSysParameterTb(SysParameter.PARAMETER_11)
|
|
|
+ elseif draw2Cnt == 1 then
|
|
|
+ sysHeroList = SysParameter.getSysParameterTb(SysParameter.PARAMETER_12)
|
|
|
+ elseif draw2Cnt == 2 then
|
|
|
+ sysHeroList = SysParameter.getSysParameterTb(SysParameter.PARAMETER_13)
|
|
|
+ end
|
|
|
+
|
|
|
+ if sysHeroList then
|
|
|
+ local totoalWeight = 0
|
|
|
+ for i=1, #sysHeroList do
|
|
|
+ totoalWeight = totoalWeight + sysHeroList[i][2]
|
|
|
+ end
|
|
|
+
|
|
|
+ local r = math.random(1, totoalWeight)
|
|
|
+ for i=1, #sysHeroList do
|
|
|
+ if r <= sysHeroList[i][2] then
|
|
|
+ return sysHeroList[i][1]
|
|
|
+ end
|
|
|
+ r = r - sysHeroList[i][2]
|
|
|
+ end
|
|
|
+ end
|
|
|
end
|
|
|
end
|
|
|
|
|
|
@@ -541,54 +494,23 @@ function randHeroID(human, id, op, config, actConfig, randomIndex, isAct)
|
|
|
end
|
|
|
|
|
|
heroID = heroID or HeroDefine.getRandHeroByWeightLv(weightLv)
|
|
|
- local actHeroID = AbsActLogic.getLuckDraw(human, luckDraw, randomIndex, isAct, op)
|
|
|
+ local actHeroID = AbsActLogic.getLuckDraw(human,luckDraw,randomIndex,isAct,op)
|
|
|
if actHeroID then
|
|
|
heroID = actHeroID
|
|
|
end
|
|
|
return heroID
|
|
|
end
|
|
|
|
|
|
-function randHeroIDV2(human, id, op, config, isAct)
|
|
|
- if isAct == 0 then
|
|
|
- if id == DRAWCARD_ID2 and op == DRAWCARD_OP_1 and getDrawCnt(human, id) == 0 then
|
|
|
- -- 首次普通单抽
|
|
|
- return SysParameter.getSysParameter(SysParameter.PARAMETER_6)
|
|
|
- elseif id == DRAWCARD_ID2 and op == DRAWCARD_OP_1 and getDrawCnt(human, id) == 1 then
|
|
|
- return SysParameter.getSysParameter(SysParameter.PARAMETER_7)
|
|
|
- end
|
|
|
- end
|
|
|
-
|
|
|
- local heroID = nil
|
|
|
- local rindex = RandomLogic.getRandom1(config.weight, nil, 2)
|
|
|
-
|
|
|
- local rconf = config.weight[rindex]
|
|
|
- local grade = rconf[1]
|
|
|
-
|
|
|
- local campWeightConfig = CampWeightExcel[id]
|
|
|
- if not campWeightConfig then return end
|
|
|
-
|
|
|
- local rindex2 = RandomLogic.getRandom1(campWeightConfig.weight, nil, 2)
|
|
|
- local rconf2 = campWeightConfig.weight[rindex2]
|
|
|
- local camp = rconf2[1]
|
|
|
-
|
|
|
- if grade < 0 or camp < 0 then
|
|
|
- return heroID
|
|
|
- end
|
|
|
-
|
|
|
- heroID = heroID or HeroDefine.getRandHeroByGradeAndCamp(grade, camp)
|
|
|
- return heroID
|
|
|
-end
|
|
|
-
|
|
|
-- 基础,高级,友情召唤,活动召唤
|
|
|
-local function draw(human, id, op, actConfig, skip, isAct)
|
|
|
+local function draw(human, id, op, actConfig, skip,isAct)
|
|
|
if isAct == AbsActDefine.ABS_ACT_TYPE_4 then
|
|
|
- PerpleHeroLogic.onDrawCardActive(human, id, op, actConfig, skip, isAct)
|
|
|
+ PerpleHeroLogic.onDrawCardActive(human, id, op, actConfig, skip,isAct)
|
|
|
return
|
|
|
elseif isAct == AbsActDefine.OA_ACT_TYPE_501 then
|
|
|
- LimitPerpleHeroLogic.onDrawCardActive(human, id, op, actConfig, skip, isAct)
|
|
|
+ LimitPerpleHeroLogic.onDrawCardActive(human, id, op, actConfig, skip,isAct)
|
|
|
return
|
|
|
elseif isAct == AbsActDefine.ABS_ACT_TYPE_19 then
|
|
|
- HeroComeLogic.onDrawCardActive(human, id, op, actConfig, skip, isAct)
|
|
|
+ HeroComeLogic.onDrawCardActive(human, id, op, actConfig, skip,isAct)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
@@ -604,11 +526,18 @@ local function draw(human, id, op, actConfig, skip, isAct)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
+ local state, endTime, starTime = AbsActLogic.isStarted(human, NewHeroLogic.ABS_ACT_ID)
|
|
|
+
|
|
|
+ if id == DRAWCARD_ID8 and not state then
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
if HeroLogic.getEmptyCnt(human) < heroCnt then
|
|
|
return Broadcast.sendErr(human, Lang.HERO_BAG_FULL)
|
|
|
end
|
|
|
|
|
|
- if not checkUseItem(human, id, op, config, isAct) then
|
|
|
+ if not checkUseItem(human, id, op, config,isAct) then
|
|
|
+ print("checkUseItem false")
|
|
|
return
|
|
|
end
|
|
|
|
|
|
@@ -622,6 +551,7 @@ local function draw(human, id, op, actConfig, skip, isAct)
|
|
|
local heroIDs = nil
|
|
|
|
|
|
local randomMin = math.random(1, heroCnt)
|
|
|
+
|
|
|
for i = 1, heroCnt do
|
|
|
config = DrawCardExcel[id]
|
|
|
if id == DRAWCARD_ID2 and op == DRAWCARD_OP_2 and i == randomMin and getDraw2Cnt(human, id) > 3 then
|
|
|
@@ -630,18 +560,31 @@ local function draw(human, id, op, actConfig, skip, isAct)
|
|
|
config = DrawCardExcel[DRAWCARD_ID6]
|
|
|
end
|
|
|
|
|
|
+
|
|
|
+ if id == DRAWCARD_ID8 and op == DRAWCARD_OP_2 and i == randomMin then
|
|
|
+ config = DrawCardExcel[DRAWCARD_ID10]
|
|
|
+ end
|
|
|
+
|
|
|
-- 第40抽必出SSR
|
|
|
if id == DRAWCARD_ID2 and getDrawNoSSRCnt(human, id) >= DRAWCARD_40 - 1 then
|
|
|
config = DrawCardExcel[DRAWCARD_ID7]
|
|
|
end
|
|
|
|
|
|
+ if id == DRAWCARD_ID8 and getDrawNoSSRCnt(human, id) >= DRAWCARD_40 - 1 then
|
|
|
+ config = DrawCardExcel[DRAWCARD_ID11]
|
|
|
+ end
|
|
|
+
|
|
|
+ if id == DRAWCARD_ID8 and getDrawNewSSRCnt(human, id) >= DRAWCARD_100 - 1 then
|
|
|
+ config = DrawCardExcel[DRAWCARD_ID9]
|
|
|
+ end
|
|
|
+
|
|
|
local heroID = randHeroID(human, id, op, config, actConfig, i == randomMin, isAct)
|
|
|
local heroConfig = HeroExcel[heroID]
|
|
|
local star = heroConfig.star
|
|
|
- local name = heroConfig.name
|
|
|
+ local name = heroConfig.name
|
|
|
local grade = heroConfig.grade
|
|
|
local isNew = not HeroBook.isGet(human, heroConfig.id, heroConfig.star)
|
|
|
- local heroIndex, fjlist = HeroLogic.addHero(human, heroID, nil, 1, "draw_card")
|
|
|
+ local heroIndex, fjlist = HeroLogic.addHero(human, heroID,nil, 1, "draw_card")
|
|
|
heroLen = heroLen + 1
|
|
|
heroList[heroLen] = heroID
|
|
|
heroNewList[heroLen] = isNew
|
|
|
@@ -670,6 +613,12 @@ local function draw(human, id, op, actConfig, skip, isAct)
|
|
|
clearDrawNoGoodCnt(human, id)
|
|
|
end
|
|
|
|
|
|
+ if heroID == NewHeroLogic.getNewHeroID(human) then
|
|
|
+ clearDrawNewSSRCnt(human, id)
|
|
|
+ elseif state then
|
|
|
+ addDrawNewSSRCnt(human, id, 1)
|
|
|
+ end
|
|
|
+
|
|
|
if getDrawCnt(human, id) > 0 or getDraw2Cnt(human, id) > 0 then
|
|
|
if id == DRAWCARD_ID1 then
|
|
|
ChatPaoMaLogic.broadcast(human, ChatPaoMaLogic.PAOMA_TYPE_BROAD_TYPE3, grade, heroID)
|
|
|
@@ -689,165 +638,38 @@ local function draw(human, id, op, actConfig, skip, isAct)
|
|
|
end
|
|
|
|
|
|
if id == DRAWCARD_ID1 then
|
|
|
- LiLianLogic.onCallback(human, LiLianLogic.LILIAN_OUTID26, 1, star)
|
|
|
+ LiLianLogic.onCallback(human,LiLianLogic.LILIAN_OUTID26,1,star)
|
|
|
elseif id == DRAWCARD_ID2 then
|
|
|
- LiLianLogic.onCallback(human, LiLianLogic.LILIAN_OUTID27, 1, star)
|
|
|
+ LiLianLogic.onCallback(human,LiLianLogic.LILIAN_OUTID27,1,star)
|
|
|
end
|
|
|
end
|
|
|
|
|
|
- updateJifen(human, config.jifen * heroCnt)
|
|
|
- if id == DRAWCARD_ID2 then
|
|
|
- ChengjiuLogic.onCallback(human, ChengjiuDefine.CJ_TASK_TYPE_2, heroCnt)
|
|
|
- MengxinLogic.onCallBack(human, MengxinLogic.MX_TASK_TYPE_12, heroCnt)
|
|
|
- YunYingLogic.onCallBack(human, "onDrawCard", heroCnt,nil, id)
|
|
|
- end
|
|
|
-
|
|
|
- sendDrawOp(human, id, op, heroList, fenjielist, heroNewList, heroIndexList, isAct)
|
|
|
- RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_401)
|
|
|
- Log.write(Log.LOGID_OSS_DRAWCARD, human.db._id, human.db.account, human.db.name, human.db.lv, id, heroIDs,
|
|
|
- itemID or 0, cnt or 0, zuanshi or 0, getJifen(human))
|
|
|
-
|
|
|
- DailyTaskLogic.recordDailyTaskFinishCnt(human, DailyTaskLogic.DAILY_TASK_ID_3, heroCnt)
|
|
|
-
|
|
|
- GuideLogic.setDoSpecialGuide(human, GuideLogic.SKIPTYPE_JUMP_DRAW)
|
|
|
-end
|
|
|
-
|
|
|
--- 高级召唤 新版本
|
|
|
-local function drawV2(human, id, op, actConfig, skip, isAct)
|
|
|
- if isAct == AbsActDefine.ABS_ACT_TYPE_4 then
|
|
|
- PerpleHeroLogic.onDrawCardActive(human, id, op, actConfig, skip, isAct)
|
|
|
- return
|
|
|
- elseif isAct == AbsActDefine.OA_ACT_TYPE_501 then
|
|
|
- LimitPerpleHeroLogic.onDrawCardActive(human, id, op, actConfig, skip, isAct)
|
|
|
- return
|
|
|
- elseif isAct == AbsActDefine.ABS_ACT_TYPE_19 then
|
|
|
- HeroComeLogic.onDrawCardActive(human, id, op, actConfig, skip, isAct)
|
|
|
- return
|
|
|
- end
|
|
|
-
|
|
|
- local config = DrawCardExcel[id]
|
|
|
-
|
|
|
- if not config then return end
|
|
|
-
|
|
|
- local weightConf = DrawCardV2Excel[getDrawLv(human, id)]
|
|
|
-
|
|
|
- if not weightConf then return end
|
|
|
-
|
|
|
- local heroCnt = nil
|
|
|
- if op == DRAWCARD_OP_1 then
|
|
|
- heroCnt = 1
|
|
|
- elseif op == DRAWCARD_OP_2 then
|
|
|
- heroCnt = 10
|
|
|
- else
|
|
|
- return
|
|
|
- end
|
|
|
-
|
|
|
- if HeroLogic.getEmptyCnt(human) < heroCnt then
|
|
|
- return Broadcast.sendErr(human, Lang.HERO_BAG_FULL)
|
|
|
- end
|
|
|
-
|
|
|
- if not checkUseItem(human, id, op, config, isAct) then
|
|
|
- return
|
|
|
- end
|
|
|
-
|
|
|
- setSkip(human, id, skip)
|
|
|
-
|
|
|
- local heroLen = 0
|
|
|
- local heroList = {}
|
|
|
- local heroNewList = {}
|
|
|
- local heroIndexList = {}
|
|
|
- local fenjielist = {}
|
|
|
- local heroIDs = nil
|
|
|
-
|
|
|
- local randomMin = math.random(1, heroCnt)
|
|
|
- for i = 1, heroCnt do
|
|
|
- config = DrawCardExcel[id]
|
|
|
- weightConf = DrawCardV2Excel[getDrawLv(human, id)]
|
|
|
-
|
|
|
- local heroID = randHeroIDV2(human, id, op, weightConf, isAct)
|
|
|
- local heroConfig = HeroExcel[heroID]
|
|
|
- local star = heroConfig.star
|
|
|
- local name = heroConfig.name
|
|
|
- local grade = heroConfig.grade
|
|
|
- local isNew = not HeroBook.isGet(human, heroConfig.id, heroConfig.star)
|
|
|
- local heroIndex, fjlist = HeroLogic.addHero(human, heroID, nil, 1, "draw_card")
|
|
|
-
|
|
|
- heroLen = heroLen + 1
|
|
|
- heroList[heroLen] = heroID
|
|
|
- heroNewList[heroLen] = isNew
|
|
|
- heroIndexList[heroLen] = heroIndex
|
|
|
- if fjlist and type(fjlist) == "table" then
|
|
|
- for fjItemID, fjItemCnt in pairs(fjlist) do
|
|
|
- fenjielist[fjItemID] = (fenjielist[fjItemID] or 0) + fjItemCnt
|
|
|
- end
|
|
|
- end
|
|
|
-
|
|
|
- if not heroIDs then
|
|
|
- heroIDs = heroID
|
|
|
- else
|
|
|
- heroIDs = heroIDs .. "|" .. heroID
|
|
|
- end
|
|
|
-
|
|
|
- -- 判断召唤出来的英雄是否为ssr
|
|
|
- if grade < 4 then
|
|
|
- addDrawNoSSRCnt(human, id, 1)
|
|
|
- else
|
|
|
- clearDrawNoSSRCnt(human, id)
|
|
|
- end
|
|
|
-
|
|
|
- if star < 5 then
|
|
|
- addDrawNoGoodCnt(human, id, 1)
|
|
|
- else
|
|
|
- clearDrawNoGoodCnt(human, id)
|
|
|
- end
|
|
|
-
|
|
|
- if getDrawCnt(human, id) > 0 or getDraw2Cnt(human, id) > 0 then
|
|
|
- ChatPaoMaLogic.broadcast(human, ChatPaoMaLogic.PAOMA_TYPE_BROAD_TYPE1, grade, heroID)
|
|
|
- end
|
|
|
-
|
|
|
- if op == DRAWCARD_OP_1 then
|
|
|
- addDrawCnt(human, id, 1)
|
|
|
- elseif op == DRAWCARD_OP_2 then
|
|
|
- addDraw2Cnt(human, id, 1)
|
|
|
- end
|
|
|
-
|
|
|
- --更新抽卡等级
|
|
|
- addDrawLv(human, id, 1)
|
|
|
-
|
|
|
- LiLianLogic.onCallback(human, LiLianLogic.LILIAN_OUTID27, 1, star)
|
|
|
+ if id ~= DRAWCARD_ID8 then
|
|
|
+ updateJifen(human, config.jifen * heroCnt)
|
|
|
end
|
|
|
-
|
|
|
- updateJifen(human, config.jifen * heroCnt)
|
|
|
if id == DRAWCARD_ID2 then
|
|
|
- ChengjiuLogic.onCallback(human, ChengjiuDefine.CJ_TASK_TYPE_2, heroCnt)
|
|
|
- MengxinLogic.onCallBack(human, MengxinLogic.MX_TASK_TYPE_12, heroCnt)
|
|
|
- YunYingLogic.onCallBack(human, "onDrawCard", heroCnt, id)
|
|
|
+ ChengjiuLogic.onCallback(human,ChengjiuDefine.CJ_TASK_TYPE_2,heroCnt)
|
|
|
+ MengxinLogic.onCallBack(human,MengxinLogic.MX_TASK_TYPE_12,heroCnt)
|
|
|
+ YunYingLogic.onCallBack(human, "onDrawCard", heroCnt,nil, id)
|
|
|
end
|
|
|
|
|
|
- sendDrawOp(human, id, op, heroList, fenjielist, heroNewList, heroIndexList, isAct)
|
|
|
+ sendDrawOp(human, id, op, heroList, fenjielist, heroNewList,heroIndexList,isAct)
|
|
|
RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_401)
|
|
|
- Log.write(Log.LOGID_OSS_DRAWCARD, human.db._id, human.db.account, human.db.name, human.db.lv, id, heroIDs,
|
|
|
- itemID or 0, cnt or 0, zuanshi or 0, getJifen(human))
|
|
|
+ Log.write(Log.LOGID_OSS_DRAWCARD, human.db._id, human.db.account, human.db.name, human.db.lv, id, heroIDs, itemID or 0, cnt or 0, zuanshi or 0, getJifen(human))
|
|
|
|
|
|
DailyTaskLogic.recordDailyTaskFinishCnt(human, DailyTaskLogic.DAILY_TASK_ID_3, heroCnt)
|
|
|
|
|
|
GuideLogic.setDoSpecialGuide(human, GuideLogic.SKIPTYPE_JUMP_DRAW)
|
|
|
end
|
|
|
|
|
|
-function op(human, id, op, skip, isAct)
|
|
|
+function op(human, id, op, skip,isAct)
|
|
|
if id == DRAWCARD_ID0 then
|
|
|
jifenDraw(human, isAct)
|
|
|
return
|
|
|
- end
|
|
|
+ end
|
|
|
|
|
|
- -- 高级召唤走新逻辑
|
|
|
- if id == DRAWCARD_ID2 then
|
|
|
- --drawV2(human, id, op, nil, skip, isAct)
|
|
|
- --return
|
|
|
- end
|
|
|
-
|
|
|
- if id == DRAWCARD_ID1 or id == DRAWCARD_ID2 or id == DRAWCARD_ID3 or id == DRAWCARD_ID6 then
|
|
|
- draw(human, id, op, nil, skip, isAct)
|
|
|
+ if id == DRAWCARD_ID1 or id == DRAWCARD_ID2 or id == DRAWCARD_ID3 or id == DRAWCARD_ID6 or id == DRAWCARD_ID8 then
|
|
|
+ draw(human, id, op, nil, skip,isAct)
|
|
|
return
|
|
|
end
|
|
|
end
|
|
|
@@ -864,15 +686,15 @@ end
|
|
|
|
|
|
function isDot(human)
|
|
|
if human.db.lv < 9 then
|
|
|
- return false
|
|
|
+ return false
|
|
|
end
|
|
|
|
|
|
if isFree(human, DRAWCARD_ID1, DRAWCARD_OP_1) then
|
|
|
- return true
|
|
|
- end
|
|
|
+ return true
|
|
|
+ end
|
|
|
if isFree(human, DRAWCARD_ID2, DRAWCARD_OP_1) then
|
|
|
- return true
|
|
|
- end
|
|
|
+ return true
|
|
|
+ end
|
|
|
if BagLogic.getItemCnt(human, ItemDefine.ITEM_DRAWCARD_GAOCHOU_ID) >= 10 then
|
|
|
return true
|
|
|
end
|