Forráskód Böngészése

已购买的月卡也设置打开

SCFC 1 éve
szülő
commit
b38583fa60

+ 5 - 2
script/module/present/MonthCard.lua

@@ -187,14 +187,17 @@ function isActive(human, YYInfo, funcConfig)
 end
 
 function isRed(human, YYInfo, funcConfig)
-    local monthCardDB = checkDB(human,1)
+    local monthCardDB = checkDB(human,2)
     if getState(monthCardDB) == MONTH_CARD_STATE_1 then
+        --print("[MonthCard-isRed] 存在红点 name = "..human.db.name)
+        TreasureChestLogic.TreasureChestLogic_BuyOpenAuto(human)
         return true
     end
 
-    local monthCardDB = checkDB(human,2)
+    monthCardDB = checkDB(human,1)
     if getState(monthCardDB) == MONTH_CARD_STATE_1 then
         return true
     end
+    
     return
 end

+ 13 - 2
script/module/treasurechest/TreasureChestLogic.lua

@@ -222,17 +222,23 @@ end
 
 -- 获取当前打开的钻石宝箱数量
 local function TreasureChestLogic_GetAutoOpenNum(human)
+    if not human.db.TreasureChest then
+        TreasureChestLogic_CreateDB(human)
+    end
+
     return human.db.TreasureChest.nOpenNum
 end
 
 -- 记录打开钻石宝箱数量
 local function TreasureChestLogic_AddAutoNum(human, nType, nNum)
     if TREASURECHEST_OPEN_AUTO_TYPE ~= nType then
+        print("[TreasureChestLogic_AddAutoNum] 类型不正确返回")
         return
     end
 
     local nNowNum = TreasureChestLogic_GetAutoOpenNum(human)
     if TREASURECHEST_OPEN_AUTO_NUM <= nNowNum then
+        print("[TreasureChestLogic_AddAutoNum] 数量已经足够 nNowNum = "..nNowNum)
         return
     end
 
@@ -252,9 +258,10 @@ function TreasureChestLogic_Query(human)
 
     TreasureChestLogic_UpdatePointPrize(human)
 
-    --table.print_lua_table(human.db.TreasureChest)
-    --print("\n")
+    -- table.print_lua_table(human.db.TreasureChest)
+    -- print("\n")
 
+    --local nOpenNum = TreasureChestLogic_GetAutoOpenNum(human)
     local tMsgData = Msg.gc.GC_TEEASURECHEST_QUERY
     tMsgData.nNowPoint = TreasureChestLogic_GetDBPoint(human)
     tMsgData.nAuto = TreasureChestLogic_GetAutoOpenNum(human) >= TREASURECHEST_OPEN_AUTO_NUM and 1 or 0
@@ -264,6 +271,8 @@ function TreasureChestLogic_Query(human)
     local tBoxPointConf = TreasureChestLogic_GetPointConf() 
     local tBoxTypeConf = TreasureChestLogic_GetBoxTypeConf()
 
+    --print("[TreasureChestLogic_Query] nAuto = "..tMsgData.nAuto.." num = "..nOpenNum)
+
     -- 下一阶段需要的积分信息
     for nID, v in ipairs(tBoxPointConf) do
         local nState = TreasureChestLogic_GetDBPointPrize(human, nID)
@@ -484,5 +493,7 @@ end
 
 -- 购买终身月卡解锁自动开宝箱
 function TreasureChestLogic_BuyOpenAuto(human)
+    --local nOpenNum = TreasureChestLogic_GetAutoOpenNum(human)
+    --print("[TreasureChestLogic_BuyOpenAuto] nOpenNum = "..nOpenNum)
     TreasureChestLogic_AddAutoNum(human, TREASURECHEST_OPEN_AUTO_TYPE, TREASURECHEST_OPEN_AUTO_NUM)
 end