소스 검색

增加主线闯关小游戏

gitxsm 1 년 전
부모
커밋
fef737ccbb
3개의 변경된 파일34개의 추가작업 그리고 31개의 파일을 삭제
  1. 23 25
      script/module/battle/BattleLogic.lua
  2. 5 0
      script/module/battle/Handler.lua
  3. 6 6
      script/module/battle/Proto.lua

+ 23 - 25
script/module/battle/BattleLogic.lua

@@ -780,6 +780,20 @@ function initAfterStart()
 end
 
 function onLogin(human)
+    --处理老号已经在小游戏玩法上线前已经推过图没有获得小游戏次数
+    if not human.db.battleGameTimes then
+        local gameTimes = 0
+        local battleID = human.db.battleID
+        local allCfg = BattleExcel.node
+        for i=1, battleID-1 do
+            local cfg = allCfg[i]
+            if cfg and cfg and type(cfg.gameType) == "number" and cfg.gameType == 1 then
+                gameTimes = gameTimes + 1
+            end
+        end
+        human.db.battleGameTimes = gameTimes
+    end
+
     if human.db.lv >= BATTLE_LOGIN_LEV_TIPS then
         return
     end
@@ -799,22 +813,6 @@ function onLogin(human)
         print("[BattleLogic_onLogin] 获取不到奖励数据 id = "
                     ..human.db._id.. "account = "..human.db.account.." name = "..human.db.name)
     end
-
-    --处理老号已经在小游戏玩法上线前已经推过图没有获得小游戏次数
-    -- if not human.db.battleGameTimes then
-    --     local gameTimes = 0
-    --     local battleID = human.db.battleID
-    --     local allCfg = BattleExcel.node
-    --     for i=1, battleID-1 do
-    --         local cfg = allCfg[i]
-    --         if cfg and cfg and type(cfg.gameType) == "number" and cfg.gameType == 1 then
-    --             gameTimes = gameTimes + 1
-    --         end
-    --     end
-    --     human.db.battleGameTimes = gameTimes
-    -- end
-
-
 end
 
 -- 是否领取
@@ -2476,11 +2474,11 @@ function onFightEnd(human, result, fightTypeID, param1, combatInfo)
     BattleLogic_SetBattleBattleID(human, nextBattleID)
 
     --增加小游戏次数
-    -- if EliteDefine.COPY_ELITE_NORMAL == nBattleType then
-    --     if config and type(config.gameType) == "number" and config.gameType == 1 then
-    --         human.db.battleGameTimes = (human.db.battleGameTimes or 0) + 1
-    --     end
-    -- end
+    if EliteDefine.COPY_ELITE_NORMAL == nBattleType then
+        if config and type(config.gameType) == "number" and config.gameType == 1 then
+            human.db.battleGameTimes = (human.db.battleGameTimes or 0) + 1
+        end
+    end
 
     -- human.db.battleID = battleID + 1
     -- 通过第10关,默认开启二倍速
@@ -3484,7 +3482,7 @@ end
 
 -- 获取未领取奖励
 local function BattleLogic_GetNorewardReceived(human, nBattleType, cIndex)
-    print("1:[BattleLogic_GetNorewardReceived] id = "..human.db._id.." nBattleType = "..nBattleType)
+    --print("1:[BattleLogic_GetNorewardReceived] id = "..human.db._id.." nBattleType = "..nBattleType)
 
     local nBattleID = BattleLogic_GetBattleIDByType(human, nBattleType)
     local tBattleConfig = BattleLogic_GetBattleConfigByType(nBattleType)
@@ -3512,7 +3510,7 @@ local function BattleLogic_GetNorewardReceived(human, nBattleType, cIndex)
     local battleNumber = #tBattleConfig.node
 
     -- local nGuajiID = human.db.guajiID or 0
-    print("[BattleLogic_GetNorewardReceived] nGuajiID = "..nGuaJiID.. " nBattleID = "..nBattleID)
+    --print("[BattleLogic_GetNorewardReceived] nGuajiID = "..nGuaJiID.. " nBattleID = "..nBattleID)
 
     -- 判断ID得用战斗ID-1, 因为挂机ID可以设置
     local nJudeNum = nGuaJiID
@@ -3524,7 +3522,7 @@ local function BattleLogic_GetNorewardReceived(human, nBattleType, cIndex)
         nJudeNum = nBattleID - 1
     end
 
-    print("[BattleLogic_GetNorewardReceived] nJudeNum = "..nJudeNum)
+    --print("[BattleLogic_GetNorewardReceived] nJudeNum = "..nJudeNum)
 
     for k,v in ipairs(tBattleConfig.node) do
         if #v.tongguan ~= 0 then
@@ -3557,7 +3555,7 @@ local function BattleLogic_GetNorewardReceived(human, nBattleType, cIndex)
                             HeroGrid.makeHeroSimpleByID(net.heroReward[1], cf[1][1], nil, other, human)
                             HeroGrid.makeHeroSimpleByGeneral(net.heroReward[1], cf[1][1])
 
-                            local tHeroInfo = Util.printTable(net.heroReward)
+                            -- local tHeroInfo = Util.printTable(net.heroReward)
                             -- print("[BattleLogic_GetNorewardReceived] 英雄数据 k = "..k.." 获取的数据 = "..tHeroInfo)
                         else
                             net.reward[0] = 1

+ 5 - 0
script/module/battle/Handler.lua

@@ -85,4 +85,9 @@ end
 
 function CG_BATTLE_TONGGUAN_REWARD_GET_COPY(human,msg)
     BattleLogic.CG_BATTLE_TONGGUAN_REWARD_GET_COPY(human,msg.index)
+end
+
+--获得小游戏奖励
+function CG_BATTLE_GETGAMEREWARD(human,msg)
+    BattleLogic.GetGameReward(human,msg.indexStr)
 end

+ 6 - 6
script/module/battle/Proto.lua

@@ -341,10 +341,10 @@ GC_BATTLE_QUERY_ALL = {
 }
 
 
--- CG_BATTLE_GETGAMEREWARD = {
--- 	{"indexStr",	1,	    "string"},	            --图案id,格式: 101|102|103
--- }
+CG_BATTLE_GETGAMEREWARD = {
+	{"indexStr",	1,	    "string"},	            --图案id,格式: 101|102|103
+}
 
--- GC_BATTLE_GETGAMEREWARD = {
--- 	{"battleGameTimes",	1,	    "byte"},	            -- 普通闯关获得的游戏次数
--- }
+GC_BATTLE_GETGAMEREWARD = {
+	{"battleGameTimes",	1,	    "byte"},	            -- 普通闯关获得的游戏次数
+}