|
@@ -96,25 +96,25 @@ end
|
|
|
function BusOneBuy_Buy(human, nID)
|
|
function BusOneBuy_Buy(human, nID)
|
|
|
local tConf = tBuyConf[nID]
|
|
local tConf = tBuyConf[nID]
|
|
|
if not tConf then
|
|
if not tConf then
|
|
|
- print("[BusOneBuy_Buy] 不存在对应的配置 返回 nID = "..nID)
|
|
|
|
|
|
|
+ -- print("[BusOneBuy_Buy] 不存在对应的配置 返回 nID = "..nID)
|
|
|
return
|
|
return
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
if tConf.nType == BUSONEBUY_TYPE_MONEY then
|
|
if tConf.nType == BUSONEBUY_TYPE_MONEY then
|
|
|
- print("[BusOneBuy_Buy] 配置对应的类型不正确 返回 nID = "..nID.." nType = "..tConf.nType)
|
|
|
|
|
|
|
+ -- print("[BusOneBuy_Buy] 配置对应的类型不正确 返回 nID = "..nID.." nType = "..tConf.nType)
|
|
|
return
|
|
return
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
local nNowBuyNum = BusOneBuy_GetBuyNum(human, nID)
|
|
local nNowBuyNum = BusOneBuy_GetBuyNum(human, nID)
|
|
|
if nNowBuyNum >= tConf.nBuyNum then
|
|
if nNowBuyNum >= tConf.nBuyNum then
|
|
|
- print("[BusOneBuy_Buy] 当前购买的次数大于可购买的次数 返回 nID = "..nID.." nType = "
|
|
|
|
|
- ..tConf.nType.." nNowBuyNum = "..nNowBuyNum)
|
|
|
|
|
|
|
+ -- print("[BusOneBuy_Buy] 当前购买的次数大于可购买的次数 返回 nID = "..nID.." nType = "
|
|
|
|
|
+ -- ..tConf.nType.." nNowBuyNum = "..nNowBuyNum)
|
|
|
return
|
|
return
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
if not ObjHuman.checkRMB(human, tConf.nPrize) then
|
|
if not ObjHuman.checkRMB(human, tConf.nPrize) then
|
|
|
- print("[BusOneBuy_Buy] 当前购买的金币不足 返回 nID = "..nID.." nType = "
|
|
|
|
|
- ..tConf.nType.." nNowBuyNum = "..nNowBuyNum)
|
|
|
|
|
|
|
+ -- print("[BusOneBuy_Buy] 当前购买的金币不足 返回 nID = "..nID.." nType = "
|
|
|
|
|
+ -- ..tConf.nType.." nNowBuyNum = "..nNowBuyNum)
|
|
|
return
|
|
return
|
|
|
end
|
|
end
|
|
|
|
|
|
|
@@ -128,7 +128,8 @@ function BusOneBuy_Buy(human, nID)
|
|
|
BusOneBuy_Query(human)
|
|
BusOneBuy_Query(human)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
-function BusOneBuy_Get(human)
|
|
|
|
|
|
|
+function BusOneBuy_Get(human, itemMul)
|
|
|
|
|
+ itemMul = itemMul or 1
|
|
|
local tItem = {}
|
|
local tItem = {}
|
|
|
for nID, v in pairs(tBuyConf) do
|
|
for nID, v in pairs(tBuyConf) do
|
|
|
local nStatus = BusOneBuy_GetBuyStatus(human, nID)
|
|
local nStatus = BusOneBuy_GetBuyStatus(human, nID)
|
|
@@ -138,7 +139,7 @@ function BusOneBuy_Get(human)
|
|
|
tItem[tData[1]] = 0
|
|
tItem[tData[1]] = 0
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- tItem[tData[1]] = tItem[tData[1]] + tData[2]
|
|
|
|
|
|
|
+ tItem[tData[1]] = tItem[tData[1]] + tData[2] * itemMul
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
local nNowBuyNum = BusOneBuy_GetBuyNum(human, nID)
|
|
local nNowBuyNum = BusOneBuy_GetBuyNum(human, nID)
|
|
@@ -164,14 +165,14 @@ end
|
|
|
|
|
|
|
|
-----------------------------------外部调用-----------------------------
|
|
-----------------------------------外部调用-----------------------------
|
|
|
function isOpen(human, YYInfo, funcConfig)
|
|
function isOpen(human, YYInfo, funcConfig)
|
|
|
- print("[BusOneActivityBuy_isOpen] 进入判断")
|
|
|
|
|
|
|
+ -- print("[BusOneActivityBuy_isOpen] 进入判断")
|
|
|
local state, endTime, startTime = AbsActLogic.isStarted(human, funcConfig and funcConfig.funcID or BUSONEBUYABSID)
|
|
local state, endTime, startTime = AbsActLogic.isStarted(human, funcConfig and funcConfig.funcID or BUSONEBUYABSID)
|
|
|
if not state then
|
|
if not state then
|
|
|
print("[BusOneActivityBuy_isOpen] 当前活动未开启")
|
|
print("[BusOneActivityBuy_isOpen] 当前活动未开启")
|
|
|
return
|
|
return
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- print("[BusOneActivityBuy_isOpen] 进入判断 endTime = "..endTime.." startTime = "..startTime)
|
|
|
|
|
|
|
+ -- print("[BusOneActivityBuy_isOpen] 进入判断 endTime = "..endTime.." startTime = "..startTime)
|
|
|
return true, endTime, startTime
|
|
return true, endTime, startTime
|
|
|
end
|
|
end
|
|
|
|
|
|
|
@@ -193,38 +194,40 @@ function isRed(human, YYInfo, absActConfig)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function onCharge(human, price, funcID, buyID, buyNum)
|
|
function onCharge(human, price, funcID, buyID, buyNum)
|
|
|
- print("[BusOneActivityBuy_onCharge] 进入购买 buyID = "..buyID)
|
|
|
|
|
|
|
+ -- print("[BusOneActivityBuy_onCharge] 进入购买 buyID = "..buyID)
|
|
|
local bRed = false
|
|
local bRed = false
|
|
|
for nID, v in pairs(tBuyConf) do
|
|
for nID, v in pairs(tBuyConf) do
|
|
|
if buyID == v.nBuyID then
|
|
if buyID == v.nBuyID then
|
|
|
local nStatus = BusOneBuy_GetBuyStatus(human, nID)
|
|
local nStatus = BusOneBuy_GetBuyStatus(human, nID)
|
|
|
if nStatus == CommonDefine.COMMON_PRIZE_STATE_NOGET then
|
|
if nStatus == CommonDefine.COMMON_PRIZE_STATE_NOGET then
|
|
|
BusOneBuy_SetBuyStatus(human, nID, CommonDefine.COMMON_PRIZE_STATE_CANGET)
|
|
BusOneBuy_SetBuyStatus(human, nID, CommonDefine.COMMON_PRIZE_STATE_CANGET)
|
|
|
- BusOneBuy_SetBuyNum(human, nID, 1)
|
|
|
|
|
|
|
+ -- BusOneBuy_SetBuyNum(human, nID, 1)
|
|
|
|
|
+ BusOneBuy_SetBuyNum(human, nID, buyNum)
|
|
|
bRed = true
|
|
bRed = true
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
if true == bRed then
|
|
if true == bRed then
|
|
|
- print("[BusOneActivityBuy_onCharge] 进入发送数据 buyID = "..buyID)
|
|
|
|
|
- BusOneBuy_Get(human)
|
|
|
|
|
|
|
+ -- print("[BusOneActivityBuy_onCharge] 进入发送数据 buyID = "..buyID)
|
|
|
|
|
+ BusOneBuy_Get(human, buyNum)
|
|
|
YunYingLogic.sendBanner(human)
|
|
YunYingLogic.sendBanner(human)
|
|
|
BusOneActivityTask.BusOneTask_SendRed(human)
|
|
BusOneActivityTask.BusOneTask_SendRed(human)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
--- function GetRemainNum(human, nBuyID)
|
|
|
|
|
--- for nID, v in pairs(tBuyConf) do
|
|
|
|
|
--- if nBuyID == v.nBuyID then
|
|
|
|
|
--- local nBuyNum = BusOneBuy_GetBuyNum(human, nID)
|
|
|
|
|
--- if v.nBuyNum > nBuyNum then
|
|
|
|
|
--- return 1
|
|
|
|
|
--- else
|
|
|
|
|
--- return 0
|
|
|
|
|
--- end
|
|
|
|
|
--- end
|
|
|
|
|
--- end
|
|
|
|
|
-
|
|
|
|
|
--- return 0
|
|
|
|
|
--- end
|
|
|
|
|
|
|
+function GetRemainNum(human, nBuyID)
|
|
|
|
|
+ for nID, v in pairs(tBuyConf) do
|
|
|
|
|
+ if nBuyID == v.nBuyID then
|
|
|
|
|
+ local nBuyNum = BusOneBuy_GetBuyNum(human, nID)
|
|
|
|
|
+ if v.nBuyNum > nBuyNum then
|
|
|
|
|
+ -- return 1
|
|
|
|
|
+ return v.nBuyNum - nBuyNum
|
|
|
|
|
+ else
|
|
|
|
|
+ return 0
|
|
|
|
|
+ end
|
|
|
|
|
+ end
|
|
|
|
|
+ end
|
|
|
|
|
+
|
|
|
|
|
+ return 0
|
|
|
|
|
+end
|