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

Merge branch '360test' of https://gitee.com/wangwenfan/congkong into 360test

# Conflicts:
#	script/common/ProtoID.lua
pig flower 3 hónapja
szülő
commit
39dce1c807
44 módosított fájl, 1962 hozzáadás és 268 törlés
  1. 3 0
      script/common/CommonDefine.lua
  2. 1 1
      script/common/InnerHandler.lua
  3. 4 2
      script/common/InnerProto.lua
  4. 10 1
      script/common/Lang.lua
  5. 2 1
      script/common/LogDefine.lua
  6. 22 3
      script/common/ProtoID.lua
  7. 8 2
      script/core/ObjHuman.lua
  8. 66 39
      script/merge/MergeServerDefine.lua
  9. 2 2
      script/merge/MergeServerLogic.lua
  10. 1 1
      script/module/absAct/Proto.lua
  11. 20 3
      script/module/bag/Grid.lua
  12. 2 0
      script/module/bag/Proto.lua
  13. 15 0
      script/module/battle/BattleLogic.lua
  14. 455 0
      script/module/battle/BreakThroughTheme.lua
  15. 29 1
      script/module/battle/Handler.lua
  16. 57 0
      script/module/battle/Proto.lua
  17. 3 2
      script/module/chat/Handler.lua
  18. 3 3
      script/module/combat/BeSkill.lua
  19. 29 23
      script/module/combat/CombatBuff.lua
  20. 193 0
      script/module/combat/CombatCalc.lua
  21. 10 2
      script/module/combat/CombatLogic.lua
  22. 8 0
      script/module/combat/CombatPosLogic.lua
  23. 1 7
      script/module/combat/JibanLogic.lua
  24. 9 4
      script/module/elf/ElfLogic.lua
  25. 16 0
      script/module/hero/Handler.lua
  26. 41 1
      script/module/hero/HeroLogic.lua
  27. 406 0
      script/module/hero/HeroTianYuan.lua
  28. 36 1
      script/module/hero/Proto.lua
  29. 8 0
      script/module/present/DailyLibaoLogic.lua
  30. 8 0
      script/module/present/RichangLibaoLogic.lua
  31. 2 0
      script/module/role/RoleAttr.lua
  32. 1 1
      script/module/roleSystem/Proto.lua
  33. 1 0
      script/module/roleSystem/RoleSystemDefine.lua
  34. 10 2
      script/module/serverCommerce/Handler.lua
  35. 11 6
      script/module/serverCommerce/Proto.lua
  36. 84 34
      script/module/serverCommerce/ServerCommerceActBattleGroundCS.lua
  37. 321 116
      script/module/serverCommerce/ServerCommerceActBattleGroundNS.lua
  38. 4 2
      script/module/serverCommerce/ServerCommerceActDefine.lua
  39. 5 0
      script/module/serverCommerce/ServerCommerceManager.lua
  40. 16 2
      script/module/talisman/TalismanLogic.lua
  41. 10 0
      script/module/topup/BuyLogic.lua
  42. 3 1
      script/module/topup/TopupLogic.lua
  43. 3 3
      script/module/voucher/VoucherShopLogic.lua
  44. 23 2
      script/module/winnerRelic/WinnerRelicLogic.lua

+ 3 - 0
script/common/CommonDefine.lua

@@ -11,6 +11,9 @@ CHANNEL_TAG_SANLI_H5_4399 = 6    -- 三狸H5-4399
 CHANNEL_TAG_WX = 11              -- 微信小程序,抖音游戏, 圣扬IOS
 
 
+CHANNEL_TAG_FT = 18             -- 繁体
+
+
 
 SEA_CHANNEL_ARR = {13}  -- 海外渠道
 

+ 1 - 1
script/common/InnerHandler.lua

@@ -679,7 +679,7 @@ function LW_BATTLEGROUND_CHALLENGE_END(fd, msg)
 end
 
 function WL_BATTLEGROUND_NOTIFY_PLAYER(fd, msg)
-    ServerCommerceActBattleGroundNS.BG_C2N_RankReduce(msg)
+    ServerCommerceActBattleGroundNS.BG_C2N_RankUpdate(msg)
 end
 
 function LW_BATTLEGROUND_LINEUP_UPDATE(fd, msg)

+ 4 - 2
script/common/InnerProto.lua

@@ -1080,7 +1080,7 @@ WL_BATTLEGROUND_RANKLIST_QUERY = {
 LW_BATTLEGROUND_CHALLENGE_QUERY = {
   {"sourceServerId",          "int"},        -- 请求服服务器Id
   {"playerUuid",              "string"},     -- 玩家uuid
-  {"rank",                    "int"},        -- 排名数组
+  {"rank",                    "int"},        -- 排名
 }
 WL_BATTLEGROUND_CHALLENGE_QUERY = {
   {"errCode",                 "int"},        -- 错误码
@@ -1098,14 +1098,16 @@ LW_BATTLEGROUND_CHALLENGE_END = {
   {"playerShowData",          "table"},      -- 挑战方玩家展示信息
 }
 
--- 通知玩家排名降低了
+-- 通知玩家更新数据
 WL_BATTLEGROUND_NOTIFY_PLAYER = {
   {"playerUuid",              "string"},     -- 玩家uuid
   {"newRank",                 "int"},        -- 最新排名
   {"atkeServerId",            "int"},        -- 挑战方服务器Id
   {"atkName",                 "string"},     -- 挑战者名字
+  {"updateType",              "int"},        -- 更新类型, 1-排名上升, 2-排名下降
 }
 
+
 -- 玩家更新阵容
 LW_BATTLEGROUND_LINEUP_UPDATE = {
   {"sourceServerId",          "int"},        -- 请求服服务器Id

+ 10 - 1
script/common/Lang.lua

@@ -859,4 +859,13 @@ LOST_HAS_ONECLICKSWEEP = [[已经一键扫荡过]]
 --------------------------巅峰战场-------------------------
 BG_MATCHLIST_ERR = [[匹配列表中未找到该对手]]
 BG_COMBAT_TYPE_ERR = [[战斗类型错误]]
-BG_CONDITION_ERR = [[挑战次数或挑战券不足]]
+BG_CONDITION_ERR = [[挑战次数或挑战券不足]]
+BG_FREECNT_NOT_ENOUGH = [[免费次数不足]]
+
+
+--------------------------英雄天元系统-------------------------
+HERO_TY_POINT_MAX = [[已点亮所有天元点, 请先提升天元重数]]
+
+HERO_TY_POINT_NOT_ENOUGH = [[请先点亮天元点]]
+
+HERO_TY_STAGE_MAX = [[天元重数已达最高]]

+ 2 - 1
script/common/LogDefine.lua

@@ -315,7 +315,8 @@ DEFINE = {
 	anotherWorldBattleTreasure = 777,		-- 异界寻宝
 	AnotherWorldBattleNS 	= 778,			-- 异界之战
 	ServerCommerceActBattleGround 	= 779,  -- 巅峰战场
-
+	HeroTianYuan 			= 780,  		-- 英雄天元系统
+	BreakThroughTheme 		= 781,  		-- 闯关主题
 
 	errHandle				= 99999,		-- 异常处理
 }

+ 22 - 3
script/common/ProtoID.lua

@@ -1736,7 +1736,6 @@ _ENV[1776]="GC_ZHUANPAN_ONCE_REWARD_QUERY"
 _ENV[1777]="CG_ZHUANPAN_ONCE_REWARD_GET"
 _ENV[1778]="CG_ALL_HERO_BOOK_QUERY"
 _ENV[1779]="GC_ALL_HERO_BOOK_QUERY"
-
 _ENV[1781]="CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_MAINPAGE_QUERY"
 _ENV[1782]="GC_SERVEERCOMMERCE_ACT_BATTLEGROUND_MAINPAGE_QUERY"
 _ENV[1783]="CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_MATCHLIST_QUERY"
@@ -1749,10 +1748,30 @@ _ENV[1789]="CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_RANK_QUERY"
 _ENV[1790]="GC_SERVEERCOMMERCE_ACT_BATTLEGROUND_RANK_QUERY"
 _ENV[1791]="CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_RANKAWARD_QUERY"
 _ENV[1792]="GC_SERVEERCOMMERCE_ACT_BATTLEGROUND_RANKAWARD_QUERY"
-_ENV[1793]="CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_ATKLINEUP_UPDATE"
-
+_ENV[1793]="CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_UPDATE_MATCHLIST"
+_ENV[1794]="CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_ONECLICK_SWEEP"
 _ENV[1795]="GC_AB_TIPS"
 
+
 _ENV[1896]="CG_ZHUANPAN_SUBSCRIBE_REWARD_QUERY"
 _ENV[1897]="GC_ZHUANPAN_SUBSCRIBE_REWARD_QUERY"
 _ENV[1898]="CG_ZHUANPAN_SUBSCRIBE_REWARD_GET"
+
+_ENV[1796]="CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_ALREAFY_KNOW"
+
+_ENV[1797]="CG_HEROTY_QUERY"
+_ENV[1798]="GC_HEROTY_QUERY"
+_ENV[1799]="CG_HEROTY_POINT_UPGRADE"
+_ENV[1800]="CG_HEROTY_STAGE_UPGRADE"
+
+_ENV[1801]="CG_BREATHROUGHTHEME_LINEUP_QUERY"
+_ENV[1802]="GC_BREATHROUGHTHEME_LINEUP_QUERY"
+_ENV[1803]="CG_BREATHROUGHTHEME_BREAKTHROUGHREWARD_QUERY"
+_ENV[1804]="GC_BREATHROUGHTHEME_BREAKTHROUGHREWARD_QUERY"
+_ENV[1805]="CG_BREATHROUGHTHEME_ADVANCEDREWARD_QUERY"
+_ENV[1806]="GC_BREATHROUGHTHEME_ADVANCEDREWARD_QUERY"
+_ENV[1807]="CG_BREATHROUGHTHEME_GET_REWARD"
+_ENV[1808]="GC_BREATHROUGHTHEME_REDDOT"
+_ENV[1809]="CG_BREATHROUGHTHEME_SHOW_TIPS"
+_ENV[1810]="GC_BREATHROUGHTHEME_SHOW_TIPS"
+

+ 8 - 2
script/core/ObjHuman.lua

@@ -104,11 +104,14 @@ local WinnerRelicLogic = require("winnerRelic.WinnerRelicLogic")
 local commonOperate = require("core.commonOperate")
 local AnotherWorldBattleNS = require("anotherWorldBattle.AnotherWorldBattleNS")
 local RoleStorageBox = require("roleSystem.RoleStorageBox")
+local BreakThroughTheme = require("battle.BreakThroughTheme")
 
 
 local Json = require("common.Json")
 
 local UnionLogic
+local GodsAreaNS
+local DataCache
 
 
 fds				= fds or {}				-- fd->obj_id,包括创角中+游戏中
@@ -453,6 +456,7 @@ function onLvUpCB(human, oldLv, newLv)
 	TuiSongLiBao.tuiSongLiBaoOnTask(human,TuiSongLiBao.TUISONGLIBAOTASK_LV, newLv, oldLv)
 	CombatPosLogic.onLvUp(human, oldLv, newLv)
 	ChengjiuLogic.onLvUp(human)
+	BreakThroughTheme.onLvUp(human)
 
 	-- 更新等级排名数据
     if BRoleLogic.updateData(BillboardDefine.TYPE_LV, human.db) then	
@@ -490,11 +494,11 @@ function onLvUpCB(human, oldLv, newLv)
 	TriggerLogic.PublishEvent(TriggerDefine.HUMAN_LV_UP, human.db._id, 1, newLv)
 	
 
-	local GodsAreaNS = require("godsArea.GodsAreaNS")
+	GodsAreaNS = GodsAreaNS or require("godsArea.GodsAreaNS")
 	GodsAreaNS.UpdateShowData(human, 2)
 
 
-	local DataCache = require("core.DataCache")
+	DataCache = DataCache or require("core.DataCache")
 	DataCache.Update_PlayerLv(human.db._id, human.db.lv)
 
 	commonOperate.LvChange(human, oldLv, newLv)
@@ -824,6 +828,7 @@ function onLogin(human, isNew)
 	commonOperate.onLogin(human)
 	AnotherWorldBattleNS.onLogin(human)
 	RoleStorageBox.onLogin(human)
+	BreakThroughTheme.onLogin(human)
 
     HeroLogLogic.finishTaskCB(human,HeroLogLogic.HERO_LOG_TYPE_1,1)
 	-- 红点 检测   需要放在通用的onLogin 后面  保持数据的正确性 再检测红点
@@ -913,6 +918,7 @@ function updateDaily(human, isGm)
 	RacialTrialLogic.updateDaily(human)
 	OnlineAwardLogic.NewUpdateDaily(human)
 	ClutterDataLogic.updateDaily(human)
+	BreakThroughTheme.updateDaily(human)
 	QQBigShot.updateDaily(human)
 	-- 红点 发送  理论放最后
 	RoleSystemLogic.onLogin(human)

+ 66 - 39
script/merge/MergeServerDefine.lua

@@ -101,34 +101,53 @@ CHANNEL_2_DBNUMBER = {
 }
 
 -- 要进行合并的数据库所属渠道ID, 用于检测合错数据库的情况, 与下面的 MERGE_DB_TB 的值一一对应
--- 格式: 渠道Id, 区服Id, 标识(0-宿主服, 1-被合服, 2-被合服, 且被合并到另外一个跨服)
+-- 格式: 渠道Id, 区服Id, 标识(0-宿主服, 1-被合服, 2-被合服, 且被合并到另外一个跨服/渠道)
 MERGE_CHECK_TB = {
     -- 木子/Tap
     [CHANNEL_ID_TAP] = {
-        { {CHANNEL_ID_TAP, 71, 0},  {CHANNEL_ID_TAP, 72, 1} },
-        { {CHANNEL_ID_TAP, 73, 0},  {CHANNEL_ID_TAP, 74, 1} },
-        { {CHANNEL_ID_TAP, 75, 0},  {CHANNEL_ID_TAP, 76, 1} },
-        { {CHANNEL_ID_TAP, 77, 0},  {CHANNEL_ID_TAP, 78, 1} },
-        { {CHANNEL_ID_TAP, 79, 0},  {CHANNEL_ID_TAP, 80, 1} },
-        { {CHANNEL_ID_TAP, 81, 0},  {CHANNEL_ID_TAP, 82, 1} },
-        { {CHANNEL_ID_TAP, 83, 0},  {CHANNEL_ID_TAP, 84, 1} },
-        { {CHANNEL_ID_TAP, 85, 0},  {CHANNEL_ID_TAP, 86, 1} },
-        { {CHANNEL_ID_TAP, 87, 0},  {CHANNEL_ID_TAP, 88, 1} },
-        { {CHANNEL_ID_TAP, 89, 0},  {CHANNEL_ID_TAP, 90, 1} },
+        { {CHANNEL_ID_TAP, 101, 0},  {CHANNEL_ID_TAP, 111, 1} },
+        { {CHANNEL_ID_TAP, 103, 0},  {CHANNEL_ID_TAP, 113, 1} },
+        { {CHANNEL_ID_TAP, 105, 0},  {CHANNEL_ID_TAP, 115, 1} },
+        { {CHANNEL_ID_TAP, 107, 0},  {CHANNEL_ID_TAP, 117, 1} },
+        { {CHANNEL_ID_TAP, 109, 0},  {CHANNEL_ID_TAP, 119, 1} },
+
+        { {CHANNEL_ID_TAP, 121, 0},  {CHANNEL_ID_TAP, 131, 1} },
+        { {CHANNEL_ID_TAP, 123, 0},  {CHANNEL_ID_TAP, 133, 1} },
+        { {CHANNEL_ID_TAP, 125, 0},  {CHANNEL_ID_TAP, 135, 1} },
+        { {CHANNEL_ID_TAP, 127, 0},  {CHANNEL_ID_TAP, 137, 1} },
+        { {CHANNEL_ID_TAP, 129, 0},  {CHANNEL_ID_TAP, 139, 1} },
+
+        { {CHANNEL_ID_TAP, 141, 0},  {CHANNEL_ID_TAP, 151, 1} },
+        { {CHANNEL_ID_TAP, 143, 0},  {CHANNEL_ID_TAP, 153, 1} },
+        { {CHANNEL_ID_TAP, 145, 0},  {CHANNEL_ID_TAP, 155, 1} },
+        { {CHANNEL_ID_TAP, 147, 0},  {CHANNEL_ID_TAP, 157, 1} },
+        { {CHANNEL_ID_TAP, 149, 0},  {CHANNEL_ID_TAP, 159, 1} },
+
+        { {CHANNEL_ID_TAP, 201, 0},  {CHANNEL_ID_TAP, 202, 1} },
+        { {CHANNEL_ID_TAP, 203, 0},  {CHANNEL_ID_TAP, 204, 1} },
+        { {CHANNEL_ID_TAP, 205, 0},  {CHANNEL_ID_TAP, 206, 1} },
+        { {CHANNEL_ID_TAP, 207, 0},  {CHANNEL_ID_TAP, 208, 1} },
+        { {CHANNEL_ID_TAP, 209, 0},  {CHANNEL_ID_TAP, 210, 1} },
+
     },
 
     -- 三狸功夫
     [CHANNEL_ID_SANLI_ANDOIRD] = {
-        { {CHANNEL_ID_SANLI_ANDOIRD, 81, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 82, 1} },
-        { {CHANNEL_ID_SANLI_ANDOIRD, 83, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 84, 1} },
-        { {CHANNEL_ID_SANLI_ANDOIRD, 85, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 86, 1} },
-        { {CHANNEL_ID_SANLI_ANDOIRD, 87, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 88, 1} },
-        { {CHANNEL_ID_SANLI_ANDOIRD, 89, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 90, 1} },
-        { {CHANNEL_ID_SANLI_ANDOIRD, 91, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 92, 1} },
-        { {CHANNEL_ID_SANLI_ANDOIRD, 93, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 94, 1} },
-        { {CHANNEL_ID_SANLI_ANDOIRD, 95, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 96, 1} },
-        { {CHANNEL_ID_SANLI_ANDOIRD, 97, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 98, 1} },
-        { {CHANNEL_ID_SANLI_ANDOIRD, 99, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 100, 1} },
+        { {CHANNEL_ID_SANLI_ANDOIRD, 121, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 123, 1} },
+        { {CHANNEL_ID_SANLI_ANDOIRD, 125, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 127, 1}, {CHANNEL_ID_SANLI_ANDOIRD, 129, 1} },
+
+        { {CHANNEL_ID_SANLI_ANDOIRD, 131, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 133, 1} },
+        { {CHANNEL_ID_SANLI_ANDOIRD, 135, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 137, 1}, {CHANNEL_ID_SANLI_ANDOIRD, 139, 1} },
+
+        { {CHANNEL_ID_SANLI_ANDOIRD, 141, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 143, 1} },
+        { {CHANNEL_ID_SANLI_ANDOIRD, 145, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 147, 1}, {CHANNEL_ID_SANLI_ANDOIRD, 149, 1} },
+
+        { {CHANNEL_ID_SANLI_ANDOIRD, 191, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 192, 1} },
+        { {CHANNEL_ID_SANLI_ANDOIRD, 193, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 194, 1} },
+        { {CHANNEL_ID_SANLI_ANDOIRD, 195, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 196, 1} },
+        { {CHANNEL_ID_SANLI_ANDOIRD, 197, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 198, 1} },
+        { {CHANNEL_ID_SANLI_ANDOIRD, 199, 0}, {CHANNEL_ID_SANLI_ANDOIRD, 200, 1} },
+        
     },
 
 
@@ -141,30 +160,38 @@ MERGE_CHECK_TB = {
     --     { {CHANNEL_ID_SANLI_ANDOIRD, 49, 0},  {CHANNEL_ID_SANLI_H5, 39, 2}, {CHANNEL_ID_SANLI_H5, 40, 2} },
     -- },
 
-
-    -- 三狸QQ
+    
     -- [CHANNEL_ID_SANLI_QQ] = {
-    --     { {CHANNEL_ID_SANLI_QQ, 51, 0},  {CHANNEL_ID_SANLI_QQ, 52, 1} },
-    --     { {CHANNEL_ID_SANLI_QQ, 53, 0},  {CHANNEL_ID_SANLI_QQ, 54, 1} },
-    --     { {CHANNEL_ID_SANLI_QQ, 55, 0},  {CHANNEL_ID_SANLI_QQ, 56, 1} },
-    --     { {CHANNEL_ID_SANLI_QQ, 57, 0},  {CHANNEL_ID_SANLI_QQ, 58, 1} },
-    --     { {CHANNEL_ID_SANLI_QQ, 59, 0},  {CHANNEL_ID_SANLI_QQ, 60, 1} },
-    --     { {CHANNEL_ID_SANLI_QQ, 61, 0},  {CHANNEL_ID_SANLI_QQ, 62, 1} },
-    --     { {CHANNEL_ID_SANLI_QQ, 63, 0},  {CHANNEL_ID_SANLI_QQ, 64, 1} },
-    --     { {CHANNEL_ID_SANLI_QQ, 65, 0},  {CHANNEL_ID_SANLI_QQ, 66, 1} },
-    --     { {CHANNEL_ID_SANLI_QQ, 67, 0},  {CHANNEL_ID_SANLI_QQ, 68, 1} },
-    --     { {CHANNEL_ID_SANLI_QQ, 69, 0},  {CHANNEL_ID_SANLI_QQ, 70, 1} },
+    --     { {CHANNEL_ID_SANLI_QQ, 151, 0},  {CHANNEL_ID_SANLI_QQ, 152, 1}, {CHANNEL_ID_SANLI_QQ, 153, 1}, {CHANNEL_ID_SANLI_QQ, 154, 1}, {CHANNEL_ID_SANLI_QQ, 155, 1}},
+    --     { {CHANNEL_ID_SANLI_QQ, 156, 0},  {CHANNEL_ID_SANLI_QQ, 157, 1}, {CHANNEL_ID_SANLI_QQ, 158, 1}, {CHANNEL_ID_SANLI_QQ, 159, 1}, {CHANNEL_ID_SANLI_QQ, 160, 1}},
+
+    --     { {CHANNEL_ID_SANLI_QQ, 161, 0},  {CHANNEL_ID_SANLI_QQ, 162, 1}, {CHANNEL_ID_SANLI_QQ, 163, 1}, {CHANNEL_ID_SANLI_QQ, 164, 1}, {CHANNEL_ID_SANLI_QQ, 165, 1}},
+    --     { {CHANNEL_ID_SANLI_QQ, 166, 0},  {CHANNEL_ID_SANLI_QQ, 167, 1}, {CHANNEL_ID_SANLI_QQ, 168, 1}, {CHANNEL_ID_SANLI_QQ, 169, 1}, {CHANNEL_ID_SANLI_QQ, 170, 1}},
     -- },
 
+
     -- 三狸视游
     [CHANNEL_ID_SANLI_SHIYOU] = {
-        { {CHANNEL_ID_SANLI_SHIYOU, 1, 0},  {CHANNEL_ID_SANLI_SHIYOU, 2, 1} },
-        { {CHANNEL_ID_SANLI_SHIYOU, 3, 0},  {CHANNEL_ID_SANLI_SHIYOU, 4, 1} },
-        { {CHANNEL_ID_SANLI_SHIYOU, 5, 0},  {CHANNEL_ID_SANLI_SHIYOU, 6, 1} },
-        { {CHANNEL_ID_SANLI_SHIYOU, 7, 0},  {CHANNEL_ID_SANLI_SHIYOU, 8, 1} },
-        { {CHANNEL_ID_SANLI_SHIYOU, 9, 0},  {CHANNEL_ID_SANLI_SHIYOU, 10, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 1, 0},  {CHANNEL_ID_SANLI_SHIYOU, 3, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 5, 0},  {CHANNEL_ID_SANLI_SHIYOU, 7, 1}, {CHANNEL_ID_SANLI_SHIYOU, 9, 1} },
+
+        { {CHANNEL_ID_SANLI_SHIYOU, 11, 0},  {CHANNEL_ID_SANLI_SHIYOU, 12, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 13, 0},  {CHANNEL_ID_SANLI_SHIYOU, 14, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 15, 0},  {CHANNEL_ID_SANLI_SHIYOU, 16, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 17, 0},  {CHANNEL_ID_SANLI_SHIYOU, 18, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 19, 0},  {CHANNEL_ID_SANLI_SHIYOU, 20, 1} },
+
+        { {CHANNEL_ID_SANLI_SHIYOU, 81, 0},  {CHANNEL_ID_SANLI_SHIYOU, 82, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 83, 0},  {CHANNEL_ID_SANLI_SHIYOU, 84, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 85, 0},  {CHANNEL_ID_SANLI_SHIYOU, 86, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 87, 0},  {CHANNEL_ID_SANLI_SHIYOU, 88, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 89, 0},  {CHANNEL_ID_SANLI_SHIYOU, 90, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 91, 0},  {CHANNEL_ID_SANLI_SHIYOU, 92, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 93, 0},  {CHANNEL_ID_SANLI_SHIYOU, 94, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 95, 0},  {CHANNEL_ID_SANLI_SHIYOU, 96, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 97, 0},  {CHANNEL_ID_SANLI_SHIYOU, 98, 1} },
+        { {CHANNEL_ID_SANLI_SHIYOU, 99, 0},  {CHANNEL_ID_SANLI_SHIYOU, 100, 1} },
     },
-
 }
 
 

+ 2 - 2
script/merge/MergeServerLogic.lua

@@ -1,7 +1,7 @@
 --合服逻辑
 
 --[=[
-    0.一般在跨服上进行合服, 所以需要把merge目录下所有文件更新到跨服上
+    0.一般在跨服上进行合服, 所以需要把merge目录下用到文件更新到跨服上
 
     1.更新MergeServerDefine.MERGE_DB_TB中要合并的数据库, 并备份数据库, 方法见 MergeServerDefine
 
@@ -14,7 +14,7 @@
 
     5.查看日志oss_merge, 是否有报错, 如果有报错则还原数据, 恢复见方法见 MergeServerDefine
 
-    6.修改mysql区服列表的 port, dbName, megre_server字段, 被合服的 port 和 dbname 要改为目标服一样, 被合服的 megre_server字段更新为1
+    6.修改mysql区服列表的 port, dbName, megre_server字段, 被合服的 port 和 dbname 要改为目标服一样, 被合服的 megre_server字段更新为宿主服的sid
         sql见sdk数据库下查询中的updateMergeServerData(需要修改数据库范围)
 
     7.修改linux上被合服的bin*文件名, 防止 start.sh 启动时会把被合服也启动起来。脚本见/server/changebinName.sh  (需要修改脚本中范围)

+ 1 - 1
script/module/absAct/Proto.lua

@@ -1509,7 +1509,7 @@ CG_NEW_BUSTHREEACT_DISQUERY = {}
 
 --查询返回协议
 GC_NEW_BUSTHREEACT_DISQUERY = {
-    {"titemData",                         20,       ITEM_INFO},         --所有商品数据
+    {"titemData",                         25,       ITEM_INFO},         --所有商品数据
 }
 
 --购买请求协议

+ 20 - 3
script/module/bag/Grid.lua

@@ -13,7 +13,7 @@ local RoleAttr = require("role.RoleAttr")
 local EquipLogic = require("equip.EquipLogic")
 
 -- 填充装备,道具信息 
-function makeItem(net, itemID, itemCnt, shuijingAttrID, itemGrid, itemIndex, opFlag, equipQuality, gemBonus, sourceType)
+function makeItem(net, itemID, itemCnt, shuijingAttrID, itemGrid, itemIndex, opFlag, equipQuality, gemBonus, sourceType, isShowEquipBaseAttrArea)
 	local itemConfig = ItemDefine.getConfig(itemID)
 	net.id = itemConfig and itemID or 0 
 	net.cnt = itemConfig and itemCnt or 0
@@ -52,7 +52,7 @@ function makeItem(net, itemID, itemCnt, shuijingAttrID, itemGrid, itemIndex, opF
 
     makeItemSuipian(net, itemConfig)
     makeItemFuwen(net, itemID, itemConfig, itemGrid, itemIndex)
-    makeItemEquip(net, itemConfig, itemGrid, itemIndex, shuijingAttrID, equipQuality, gemBonus)
+    makeItemEquip(net, itemConfig, itemGrid, itemIndex, shuijingAttrID, equipQuality, gemBonus, isShowEquipBaseAttrArea)
 end
 
 function makeFuwenSkill(net, skillID, skillLockList)
@@ -143,7 +143,7 @@ function makeItemFuwen(net, itemID, itemConfig, fuwenGrid, fuwenIndex)
 	end
 end
 
-function makeItemEquip(net, itemConfig, equipGrid, equipIndex, shuijingAttrID, equipQuality, gemBonus)
+function makeItemEquip(net, itemConfig, equipGrid, equipIndex, shuijingAttrID, equipQuality, gemBonus, isShowEquipBaseAttrArea)
 	if itemConfig.mainType ~= ItemDefine.MAINTYPE_EQUIP then
 		return
 	end
@@ -163,6 +163,9 @@ function makeItemEquip(net, itemConfig, equipGrid, equipIndex, shuijingAttrID, e
     local maxQuality = EquipLogic.getEquipMaxQuality(itemConfig)
 	net.rare  = equipGrid and equipGrid.quality or equipQuality or maxQuality
 	
+	local baseAttrMulMin = itemConfig.baserandom[1][1] or 1
+	local baseAttrMulMax = itemConfig.baserandom[1][2] or 1
+
 	-- 装备基础属性
 	if itemConfig.subType == ItemDefine.EQUIP_SUBTYPE_SHUIJIN then 
 		-- 水晶属性
@@ -235,12 +238,26 @@ function makeItemEquip(net, itemConfig, equipGrid, equipIndex, shuijingAttrID, e
         -- 基础属性
 		net.equip[1].baseAttr = {}
 		net.equip[1].baseAttr[0] = #baseAttrInfo
+		-- net.equip[1].baseAttrMin[0] = 0
+		-- net.equip[1].baseAttrMax[0] = 0
 
 		for i=1, net.equip[1].baseAttr[0] do
 			net.equip[1].baseAttr[i] = net.equip[1].baseAttr[i] or {}
 			net.equip[1].baseAttr[i].key = baseAttrInfo[i][1]
 			net.equip[1].baseAttr[i].value = math.floor(baseAttrInfo[i][2] * baseRate * baseAttrRandVal)
 
+			-- 基础属性范围
+			-- if isShowEquipBaseAttrArea then
+			-- 	net.equip[1].baseAttrMin[0] = i
+			-- 	net.equip[1].baseAttrMin[i].key = baseAttrInfo[i][1]
+			-- 	net.equip[1].baseAttrMin[i].value = math.floor(baseAttrInfo[i][2] * baseRate * baseAttrMulMin)
+
+			-- 	net.equip[1].baseAttrMax[0] = i
+			-- 	net.equip[1].baseAttrMax[i].key = baseAttrInfo[i][1]
+			-- 	net.equip[1].baseAttrMax[i].value = math.floor(baseAttrInfo[i][2] * baseRate * baseAttrMulMax)
+			-- end
+
+
 
 			if gemBonus then
 				net.equip[1].gemBaseAttr[i].key = baseAttrInfo[i][1]

+ 2 - 0
script/module/bag/Proto.lua

@@ -57,6 +57,8 @@ Equip = {
 	{"effects",	   		3,		EQUIP_EFFCECT_DATA},-- 特效(戒指、护符专属)
 	{"heroExclusive",	1,		"string"},			-- 英雄专属(戒指、护符专属)
 	{"suitID",       	1,   	"int"},     		-- 套装编号
+	-- {"baseAttrMin",   	4,       Attr},    	 		-- 基础性能最小值
+	-- {"baseAttrMax",   	4,       Attr},    	 		-- 基础性能最大值
 }
 
 FuwenSkillInfo = {

+ 15 - 0
script/module/battle/BattleLogic.lua

@@ -74,6 +74,7 @@ local battleRougeCfg = require("excel.battleRouge").Sheet1
 local WeekTaskLogic = require("dailyTask.WeekTaskLogic")
 local TreasureChestLogic = require("treasurechest.TreasureChestLogic")
 
+local BreakThroughTheme
 
 BATTLE_HANG_EXP_OUT_PERIOD = 60 -- 经验产出时间间隔
 BATTLE_HANG_ITEM_OUT_PERIOD = 300 -- 战利品道具产出时间间隔
@@ -3053,6 +3054,9 @@ function onFightEnd(human, result, fightTypeID, param1, combatInfo)
         guajiID - 2
         )
 
+        BreakThroughTheme = BreakThroughTheme or require("battle.BreakThroughTheme")
+        BreakThroughTheme.EntranceRedDotUpdate(human)
+
         ChengjiuLogic.onCallback(human, ChengjiuDefine.CJ_TASK_TYPE_1, nextGuajiID)
         MengxinLogic.onCallBack(human, MengxinLogic.MX_TASK_TYPE_1, nextGuajiID)
         
@@ -3189,6 +3193,10 @@ function setBattleID(human, guajiID)
     -- 刷新排行榜
     human.db.maxBattleTime = os.time()
     BRoleLogic.updateData(BillboardDefine.TYPE_BATTLE, human.db)
+
+
+    BreakThroughTheme = BreakThroughTheme or require("battle.BreakThroughTheme")
+    BreakThroughTheme.EntranceRedDotUpdate(human)
 end
 
 -- GM
@@ -3241,6 +3249,8 @@ function setBattleByGm(human, val, maxBattleID)
     --human.db.battleID = val
     BattleLogic_QueryDifficulty(human)
 
+    BreakThroughTheme = BreakThroughTheme or require("battle.BreakThroughTheme")
+    BreakThroughTheme.EntranceRedDotUpdate(human)
 
     RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_1105)
 end
@@ -3813,6 +3823,11 @@ function getBattleID(human)
     return num
 end
 
+-- 根据类型获取已经通关的最大关卡Id
+function GetBattleIdByType(human, battleType)
+    return BattleLogic_GetBattleGuaJiIDByType(human, battleType)
+end
+
 --------------------------------------------- combat ----------------------------------------------
 function getCombatMonsterOutID(human, side)
     if side ~= CombatDefine.DEFEND_SIDE then

+ 455 - 0
script/module/battle/BreakThroughTheme.lua

@@ -0,0 +1,455 @@
+-- 闯关主题
+--db
+--[=[
+    human.db.breakThroughData = {
+        breakThroughGetList = { -- 闯关奖励领取记录列表
+            [cfgIdx1] = true,
+            [cfgIdx2] = true,
+        },
+
+        advanceRewardGetList = { --进阶奖励领取记录表
+            [day1] = true,
+            [day2] = true,
+        },
+
+        isBuy = nil, -- 购买指定项后,值为true
+        loginDays = nil, 购买指定项后才统计的登录天数
+        isShowTips = nil, 用来记录客户端是否弹出过提示, 弹出过后为true
+    }
+]=]--
+
+
+local Msg = require("core.Msg")
+local Grid = require("bag.Grid")
+local BagLogic = require("bag.BagLogic")
+local Lang = require("common.Lang")
+local Broadcast = require("broadcast.Broadcast")
+local HeroGrid = require("hero.HeroGrid")
+local BreakThroughThemeConfig = require("excel.breakThroughTheme")
+local BattleLogic = require("battle.BattleLogic")
+local EliteDefine = require("battle.EliteDefine")
+local BuyLogic = require("topup.BuyLogic")
+local RoleSystemLogic = require("roleSystem.RoleSystemLogic")
+local RoleSystemDefine = require("roleSystem.RoleSystemDefine")
+local RoleSystemConfig = require("excel.roleSystem").roleSystem
+
+
+local LOGTYPE = "BreakThroughTheme"
+
+
+local function getData(human)
+    return human.db.breakThroughData
+end
+
+local function updateBreakThroughGetList(human, getIdx)
+    human.db.breakThroughData = human.db.breakThroughData or {}
+    human.db.breakThroughData.breakThroughGetList = human.db.breakThroughData.breakThroughGetList or {}
+    human.db.breakThroughData.breakThroughGetList[getIdx] = true
+end
+
+local function updateAdvanceRewardGetList(human, getIdx)
+    human.db.breakThroughData = human.db.breakThroughData or {}
+    human.db.breakThroughData.advanceRewardGetList = human.db.breakThroughData.advanceRewardGetList or {}
+    human.db.breakThroughData.advanceRewardGetList[getIdx] = true
+end
+
+local function updateBuyState(human, state)
+    human.db.breakThroughData = human.db.breakThroughData or {}
+    human.db.breakThroughData.isBuy = state
+end
+
+local function addLoginDays(human)
+    human.db.breakThroughData = human.db.breakThroughData or {}
+    human.db.breakThroughData.loginDays = (human.db.breakThroughData.loginDays or 0) + 1
+end
+
+local function updateShowTipsState(human, state)
+    human.db.breakThroughData = human.db.breakThroughData or {}
+    human.db.breakThroughData.isShowTips = state
+end
+
+
+
+local function isBuy(human)
+    local breakThroughData = getData(human)
+    if breakThroughData and breakThroughData.isBuy then
+        return true
+    end
+
+    return false
+end
+
+-- 获取所有闯关奖励
+local function getAllBreakThroughReward(human)
+    if not isBuy(human) then
+        return
+    end
+
+    local breakThroughData = getData(human)
+    local breakThroughGetList = breakThroughData and breakThroughData.breakThroughGetList
+    local passStageId = BattleLogic.GetBattleIdByType(human, EliteDefine.COPY_ELITE_NORMAL)
+
+    local itemList, getIdArr
+
+    for k,v in ipairs(BreakThroughThemeConfig.breakThroughReward) do
+        if v.rewardCondStage <= passStageId and (not breakThroughGetList or not breakThroughGetList[k]) then
+            getIdArr = getIdArr or {}
+            getIdArr[#getIdArr+1] = k
+
+            itemList = itemList or {}
+            for _, itemInfo in ipairs(v.reward) do
+                local itemId, itemCnt = itemInfo[1], itemInfo[2]
+                itemList[itemId] = (itemList[itemId] or 0) + itemCnt
+            end
+        end
+    end
+
+    return itemList, getIdArr
+end
+
+-- 取所有进阶奖励
+local function getAllAdvancedReward(human)
+    if not isBuy(human) then
+        return
+    end
+
+    local breakThroughData = getData(human)
+    local advanceRewardGetList = breakThroughData.advanceRewardGetList
+    local loginDays = breakThroughData.loginDays or 0
+
+    local itemList, getIdArr
+
+    for k,v in ipairs(BreakThroughThemeConfig.advancedReward) do
+        if v.condDay <= loginDays and (not advanceRewardGetList or not advanceRewardGetList[k]) then
+            getIdArr = getIdArr or {}
+            getIdArr[#getIdArr+1] = k
+
+            itemList = itemList or {}
+            local itemId, itemCnt = v.reward[1], v.reward[2]
+            itemList[itemId] = (itemList[itemId] or 0) + itemCnt
+        end
+    end
+
+    return itemList, getIdArr
+end
+
+-- 填充推荐阵容协议数据
+local function populateLineupMsg(net, heroArr)
+    if not net or not heroArr then
+        return
+    end
+
+    local grid = { id =  0}
+    net[0] = #heroArr
+
+    for i, heroId in ipairs(heroArr) do
+        grid.id = heroId
+        HeroGrid.makeHeroSimple(net[i], grid)
+    end
+end
+
+-- 入口红点刷新
+function EntranceRedDotUpdate(human)
+    RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_112)
+end
+
+-- 标签红点刷新
+local function lableRedDotUpdate(human)
+    local msgRet = Msg.gc.GC_BREATHROUGHTHEME_REDDOT
+    msgRet.page1RedDotState = 0
+    msgRet.page2RedDotState = 0
+
+    if isBuy(human) then
+        local itemList = getAllBreakThroughReward(human)
+        if itemList then
+            msgRet.page1RedDotState = 1
+        end
+
+        itemList = getAllAdvancedReward(human)
+        if itemList then
+            msgRet.page2RedDotState = 1
+        end
+    end
+
+    Msg.send(msgRet, human.fd)
+end
+
+-- 所有红点刷新
+local function redDotUpdate(human)
+    EntranceRedDotUpdate(human)
+    lableRedDotUpdate(human)
+end
+
+-- 入口关闭检查
+local function entranceCloseCheck(human)
+    RoleSystemLogic.isClose(human, RoleSystemDefine.ROLE_SYS_ID_112)
+end
+
+-- 领取所有闯关奖励
+local function getBreakThroughReward(human)
+    local itemList, getIdArr = getAllBreakThroughReward(human)
+    if not itemList then
+        return Broadcast.sendErr(human, Lang.SHARE_GROUP_GET_ERR_CNT)
+    end
+
+    for _, getIdx in ipairs(getIdArr or {}) do
+        updateBreakThroughGetList(human, getIdx)
+    end
+    BagLogic.addItemList(human, itemList, LOGTYPE)
+
+    redDotUpdate(human)
+
+    BreakThrough_BreakThroughReward_Query(human)
+
+    entranceCloseCheck(human)
+end
+
+-- 领取所有进阶奖励
+local function getAdvancedReward(human)
+    local itemList, getIdArr = getAllAdvancedReward(human)
+    if not itemList then
+        return Broadcast.sendErr(human, Lang.SHARE_GROUP_GET_ERR_CNT)
+    end
+
+    for _, getIdx in ipairs(getIdArr or {}) do
+        updateAdvanceRewardGetList(human, getIdx)
+    end
+    BagLogic.addItemList(human, itemList, LOGTYPE)
+
+    redDotUpdate(human)
+
+    BreakThrough_AdvancedReward_Query(human)
+
+    entranceCloseCheck(human)
+end
+
+-- 通知客户端弹出提示
+local function showTips(human)
+    local systemCfg = RoleSystemConfig[RoleSystemDefine.ROLE_SYS_ID_112]
+    if human.db.lv < systemCfg.lv then
+        return
+    end
+
+    local breakThroughData = getData(human)
+    if breakThroughData and breakThroughData.isShowTips then
+        return
+    end
+
+    local msgRet = Msg.gc.GC_BREATHROUGHTHEME_SHOW_TIPS
+    msgRet.tipState = 1
+    Msg.send(msgRet, human.fd)
+end
+
+
+
+-- 外部调用, 是否显示入口, 领取完所有免费/付费奖励, 入口才关闭
+function ModuleisOpen(human)
+    local breakThroughData = getData(human)
+    if not breakThroughData or not breakThroughData.isBuy then
+        return true
+    end
+
+    if not breakThroughData.breakThroughGetList or not breakThroughData.advanceRewardGetList then
+        return true
+    end
+
+    local breakThroughGetList = breakThroughData.breakThroughGetList
+    for k in ipairs(BreakThroughThemeConfig.breakThroughReward) do
+        if not breakThroughGetList[k] then
+            return true
+        end
+    end
+
+    local advanceRewardGetList = breakThroughData.advanceRewardGetList
+    for k in ipairs(BreakThroughThemeConfig.advancedReward) do
+        if not advanceRewardGetList[k] then
+            return true
+        end
+    end
+
+    return false
+end
+
+-- 外部调用, 入口处是否有红点
+function isDot(human)
+    if not isBuy(human) then
+        return false
+    end
+
+    local itemList = getAllBreakThroughReward(human)
+    if itemList then
+        return true
+    end
+
+    itemList = getAllAdvancedReward(human)
+    if itemList then
+        return true
+    end
+
+    return false
+end
+
+-- 外部调用,跨天
+function updateDaily(human)
+    if not isBuy(human) then
+        return
+    end
+
+    addLoginDays(human)
+
+    -- 刷新红点
+    if ModuleisOpen(human) then
+        redDotUpdate(human)
+    end
+end
+
+-- 外部调用, 登录
+function onLogin(human)
+    showTips(human)
+end
+
+-- 外部调用,充值
+function charge(human, nAllPrice, buyID)
+    local var = BreakThroughThemeConfig.var[1]
+    if var.buyId ~= buyID then
+        return
+    end
+
+    if isBuy(human) then
+        return
+    end
+
+    updateBuyState(human, true)
+    addLoginDays(human)
+
+    -- 红点
+    redDotUpdate(human)
+
+    BreakThrough_AdvancedReward_Query(human)
+end
+
+-- 外部调用,升级
+function onLvUp(human)
+    showTips(human)
+end
+
+
+-- 闯关阵容查询
+function BreakThrough_Lineup_Query(human)
+    local msgRet = Msg.gc.GC_BREATHROUGHTHEME_LINEUP_QUERY
+
+    local lineupCfg1 = BreakThroughThemeConfig.recommendedLineup[1]
+    populateLineupMsg(msgRet.lineup1, lineupCfg1.heroIdArr)
+
+    local lineupCfg2 = BreakThroughThemeConfig.recommendedLineup[2]
+    populateLineupMsg(msgRet.lineup2, lineupCfg2.heroIdArr)
+
+    local lineupCfg3 = BreakThroughThemeConfig.recommendedLineup[3]
+    populateLineupMsg(msgRet.lineup3, lineupCfg3.heroIdArr)
+
+    Msg.send(msgRet, human.fd)
+
+    lableRedDotUpdate(human)
+end
+
+-- 闯关奖励查询
+function BreakThrough_BreakThroughReward_Query(human)
+    local msgRet = Msg.gc.GC_BREATHROUGHTHEME_BREAKTHROUGHREWARD_QUERY
+    msgRet.list[0] = 0
+    msgRet.isEnd = 0
+    msgRet.buyState = isBuy(human) and 1 or 0
+
+    local breakThroughData = getData(human)
+    local breakThroughGetList = breakThroughData and breakThroughData.breakThroughGetList
+    local passStageId = BattleLogic.GetBattleIdByType(human, EliteDefine.COPY_ELITE_NORMAL)
+
+    local len = 0
+    local msgOnceLen = 5
+    local rewardCnt = #BreakThroughThemeConfig.breakThroughReward
+
+    for k,v in ipairs(BreakThroughThemeConfig.breakThroughReward) do
+        len = len + 1
+        msgRet.list[0] = len
+        msgRet.list[len].condStage = v.rewardCondStage
+        msgRet.list[len].reallyIdx = k
+        msgRet.list[len].rewardStage = 0
+        msgRet.list[len].rewardArr[0] = 0
+
+        if breakThroughGetList and breakThroughGetList[k] then
+            msgRet.list[len].rewardStage = 2
+        else
+            if breakThroughData and breakThroughData.isBuy and passStageId >= v.rewardCondStage then
+                msgRet.list[len].rewardStage = 1
+            end
+        end
+
+        msgRet.list[len].rewardArr[0] = #v.reward
+        for i, itemInfo in ipairs(v.reward) do
+            Grid.makeItem(msgRet.list[len].rewardArr[i], itemInfo[1], itemInfo[2])
+        end
+
+        if len >= msgOnceLen then
+            rewardCnt = rewardCnt - len
+            if rewardCnt <= 0 then
+                msgRet.isEnd = 1
+                return Msg.send(msgRet, human.fd)
+            end
+
+            Msg.send(msgRet, human.fd)
+            len = 0
+        end
+    end
+
+    if len >= 0 then
+        msgRet.isEnd = 1
+        Msg.send(msgRet, human.fd)
+    end
+end
+
+-- 进阶奖励查询
+function BreakThrough_AdvancedReward_Query(human)
+    local var = BreakThroughThemeConfig.var[1]
+    local advancedRewardCfg = BreakThroughThemeConfig.advancedReward
+
+    local msgRet = Msg.gc.GC_BREATHROUGHTHEME_ADVANCEDREWARD_QUERY
+    msgRet.list[0] = 0
+    BuyLogic.fontBuyItem(human, msgRet.buyItem, var.buyId)
+    msgRet.buyState = 0
+
+    local breakThroughData = getData(human)
+    local advanceRewardGetList = breakThroughData and breakThroughData.advanceRewardGetList
+    if breakThroughData and breakThroughData.isBuy then
+        msgRet.buyState = 1
+    end
+
+    msgRet.list[0] = #advancedRewardCfg
+    for k, v in ipairs(advancedRewardCfg) do
+        msgRet.list[k].rewardStage = 0
+        msgRet.list[k].condDays = v.condDay
+        Grid.makeItem(msgRet.list[k].reward, v.reward[1], v.reward[2])
+
+        if advanceRewardGetList and advanceRewardGetList[k] then
+            msgRet.list[k].rewardStage = 2
+        else
+            if msgRet.buyState == 1 and (breakThroughData and breakThroughData.loginDays or 0) >= v.condDay then
+                msgRet.list[k].rewardStage = 1
+            end
+        end
+    end
+
+    Msg.send(msgRet, human.fd)
+end
+
+-- 领奖
+function BreakThrough_GetReward(human, rewardType)
+    if rewardType == 1 then
+        getBreakThroughReward(human)
+    elseif rewardType == 2 then
+        getAdvancedReward(human)
+    end
+end
+
+-- 客户端通知服务器已经弹出过提示了
+function BreakThrough_UpdateShowTipsState(human)
+    updateShowTipsState(human, true)
+end

+ 29 - 1
script/module/battle/Handler.lua

@@ -1,4 +1,5 @@
 local BattleLogic = require("battle.BattleLogic")
+local BreakThroughTheme = require("battle.BreakThroughTheme")
 
 function CG_BATTLE_QUERY(human)
     --print("[CG_BATTLE_QUERY] 战役主界面查询开始")
@@ -117,4 +118,31 @@ end
 ------------------------------------------多队伍战斗------------------------------------------
 function CG_BATTLE_TEAM_COUNT(human,msg)
     BattleLogic.QueryLevelTeamCnt(human)
-end
+end
+
+
+
+
+------------------------------闯关主题-----------------------------------------------------
+
+function CG_BREATHROUGHTHEME_LINEUP_QUERY(human,msg)
+    BreakThroughTheme.BreakThrough_Lineup_Query(human)
+end
+
+
+function CG_BREATHROUGHTHEME_BREAKTHROUGHREWARD_QUERY(human,msg)
+    BreakThroughTheme.BreakThrough_BreakThroughReward_Query(human)
+end
+
+function CG_BREATHROUGHTHEME_ADVANCEDREWARD_QUERY(human,msg)
+    BreakThroughTheme.BreakThrough_AdvancedReward_Query(human)
+end
+
+
+function CG_BREATHROUGHTHEME_GET_REWARD(human,msg)
+    BreakThroughTheme.BreakThrough_GetReward(human, msg.rewardType)
+end
+
+function CG_BREATHROUGHTHEME_SHOW_TIPS(human,msg)
+    BreakThroughTheme.BreakThrough_UpdateShowTipsState(human, msg.rewardType)
+end

+ 57 - 0
script/module/battle/Proto.lua

@@ -3,6 +3,7 @@ local HeroSimple = require("hero.Proto").HeroSimple
 local RoleBase = require("role.Proto").RoleBase 
 local CombatSkillConf = require("combat.Proto").CombatSkillConf
 local Attr = require("role.Proto").Attr
+local BuyItem = require("topup.Proto").BuyItem
 
 -- 进入战役界面的查询
 CG_BATTLE_QUERY = {}
@@ -415,3 +416,59 @@ CG_BATTLE_TEAM_COUNT = {
 GC_BATTLE_TEAM_COUNT = {
 	{"teamCnt",		   	1,	    "byte"},	       		-- 队伍数量
 }
+
+
+--------------------------------------------------------闯关主题--------------------------------------------
+BREAKTHROUGHREWARD_INFO = {
+	{"rewardArr",		   	4,	    ItemData},	      -- 奖励列表
+	{"rewardStage",		   	1,	    "byte"},	      -- 奖励状态, 0-不可领取, 1-可领, 2-已领
+	{"reallyIdx",		   	1,	    "short"},	      -- 奖励索引
+	{"condStage",		   	1,	    "int"},	      	  -- 领取奖励所需关卡
+}
+
+ADVANCEDREWARD_INFO = {
+	{"reward",		   		1,	    ItemData},	  -- 奖励列表
+	{"rewardStage",		   	1,	    "byte"},	  -- 奖励状态, 0-不可领取, 1-可领, 2-已领
+	{"condDays",		   	1,	    "int"},	      -- 领取奖励所需登录天数
+}
+
+-- 闯关阵容查询
+CG_BREATHROUGHTHEME_LINEUP_QUERY = {}
+GC_BREATHROUGHTHEME_LINEUP_QUERY = {
+	{"lineup1",		   	5,	    HeroSimple},	       		-- 初级阵容
+	{"lineup2",		   	5,	    HeroSimple},	       		-- 中级阵容
+	{"lineup3",		   	5,	    HeroSimple},	       		-- 豪华阵容
+}
+
+-- 闯关奖励查询
+CG_BREATHROUGHTHEME_BREAKTHROUGHREWARD_QUERY = {}
+GC_BREATHROUGHTHEME_BREAKTHROUGHREWARD_QUERY = {
+	{"list",		   	5,	    BREAKTHROUGHREWARD_INFO},
+	{"isEnd",		   	1,	    "byte"},	      -- 数据发完标识, 0-没有, 1-已发完
+	{"buyState",     	1,      "byte"},           -- 购买状态, 0-未购买, 1-已购买
+}
+
+-- 进阶奖励查询
+CG_BREATHROUGHTHEME_ADVANCEDREWARD_QUERY = {}
+GC_BREATHROUGHTHEME_ADVANCEDREWARD_QUERY = {
+	{"list",		   		7,	    ADVANCEDREWARD_INFO},
+	{"buyItem",     		1,      BuyItem},           -- 购买信息
+	{"buyState",     		1,      "byte"},           -- 购买状态, 0-未购买, 1-已购买
+}
+
+-- 领奖
+CG_BREATHROUGHTHEME_GET_REWARD = {
+	{"rewardType",     		1,      "byte"},           -- 奖励类型, 1-闯关奖励, 2-进阶奖励	
+}
+
+-- 红点
+GC_BREATHROUGHTHEME_REDDOT = {
+	{"page1RedDotState",     		1,      "byte"},           -- 闯关奖励标签红点状态, 0-不显示红点, 1-显示红点
+	{"page2RedDotState",     		1,      "byte"},           -- 进阶奖励标签红点状态, 0-不显示红点, 1-显示红点
+}
+
+-- 弹提示
+CG_BREATHROUGHTHEME_SHOW_TIPS = {}
+GC_BREATHROUGHTHEME_SHOW_TIPS = {
+	{"tipState",     		1,      "byte"},           -- 1-服务器通知客户端弹出提示
+}

+ 3 - 2
script/module/chat/Handler.lua

@@ -33,13 +33,14 @@ CHAT_UNION_FIGHT    = 1         -- 公会战
 CHAT_UNION_ECTYPE   = 2         -- 公会副本
 CHAT_UNION_RED_BAG  = 3         -- 公会红包
 CHAT_UNION_ZHAOMU   = 4         -- 公会招募
-CHAT_UNION_AB_HATHER  = 8		-- 公会异界之战集结
+CHAT_UNION_AB_HATHER  = 8		-- 公会异界之战集结50
+
 CHAT_HERO_SHARE     = 5         -- 英雄聊天分享
 CHAT_FIGHT_SHARE    = 6         -- 战斗记录聊天分享
 CHAT_ITEM_SHARE     = 7         -- 道具聊天分享
                       
 CHAT_SHARE_TYPE     = 1         -- 战报分享
-CHAT_LV_NEED_WORLD        = 11	    -- 开放聊天等级
+CHAT_LV_NEED_WORLD        = 25	    -- 开放聊天等级
 CHAT_LV_NEED_MIDDLE        = 70	    -- 开放聊天等级
 CHAT_LV_NEED_FRIEND        = 30	    -- 开放聊天等级
 CHAT_LV_NEED_WARZONE 	   	= 50	-- 开放聊天等级-战区

+ 3 - 3
script/module/combat/BeSkill.lua

@@ -1350,10 +1350,10 @@ function onRoundBegin(round)
 				-- print("[onRoundBegin] 开始加类型71的被动技能 pos = "..pos)
 				local skillConfig = Skill.GetSkillConfig(v[1])
 				if skillConfig and skillConfig.args then
-					local nLen = skillConfig.args[1]
-					for i = 1, nLen, 1 do
+					-- local nLen = skillConfig.args[1]
+					-- for i = 1, nLen, 1 do
 						use(target,{},v)
-					end
+					-- end
 				end
 			end
 		end

+ 29 - 23
script/module/combat/CombatBuff.lua

@@ -802,7 +802,7 @@ function reviceObj(attackPos, obj, bufferID, skillID)
 	end
 
     local attacker = CombatImpl.objList[attackPos] or CombatImpl.elfList[attackPos]
-    local hpRevive = CombatCalc.calcHp(attacker, obj, conf.args[1], conf.args[2], true)
+    local hpRevive = CombatCalc.calcHpBuff(attacker, obj, conf.args[1], conf.args[2], true)
     local hpAddRate = CombatObj.getValue(attacker,RoleDefine.ZAOCHENG_HP_ADD_RATE) / 10000
     hpRevive = hpRevive * (1 + hpAddRate)
 	hpRevive = hpRevive < 0 and 1 or hpRevive
@@ -1005,7 +1005,7 @@ function addBuffer(attackPos,obj, id, skillID,arg,parentConf)
 	if  bufferCmd == "shengling" then
 		buffer.arg = conf.args[3]
 	elseif bufferCmd == "hudun" then
-		local attackerHp = CombatCalc.calcHp(attacker, obj, conf.args[1], conf.args[2], true)
+		local attackerHp = CombatCalc.calcHpBuff(attacker, obj, conf.args[1], conf.args[2], true)
 		local hudunValue = math.floor(conf.args[2] * attackerHp / 10000)
 		buffer.arg = hudunValue
 	end
@@ -1056,7 +1056,7 @@ local function beforeDelBuffer(obj, buffer)
 	--local conf = BufferExcel.buffer[buffer.id]
 	local conf = GetBuffConfig(buffer.id)
 	if conf.cmd == "fentan" and buffer.round < 1 then
-	   local hurt = CombatCalc.calcHp(obj, obj, conf.args[1], conf.args[2])
+	   local hurt = CombatCalc.calcHpBuff(obj, obj, conf.args[1], conf.args[2])
        if hurt > 0 then
 	      local d = CombatObj.updateHp(obj, hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
 	      CombatImpl.setExtraHit(obj, hurt)
@@ -1199,7 +1199,7 @@ function onHit(attacker, skillTargets, skillConfig, cmdTargets, otherArgs, cmdCh
                 end
 
                 if bHit then
-                    local hurt = CombatCalc.calcHp(attacker, v, conf.args[1], conf.args[2])
+                    local hurt = CombatCalc.calcHpBuff(attacker, v, conf.args[1], conf.args[2])
                     local d = CombatObj.updateHp(attacker, - hurt, nil, nil, v.pos, CombatObj.BUFFER_HP_TYPE)
                     CombatImpl.setExtraHit(attacker, d)
                     CombatObj.onHpCB(attacker, d, v.pos)
@@ -1299,7 +1299,7 @@ function onHit(attacker, skillTargets, skillConfig, cmdTargets, otherArgs, cmdCh
                     local arg
                     if bufferConf.cmd == "zuzhou" then
                         local rate = bufferConf.args[2] + BeSkill.getBufferExtraHurt(attacker, bufferID, bufferConf.cmd)
-                        arg = { CombatCalc.calcHp(attacker, target, bufferConf.args[1], rate) }
+                        arg = { CombatCalc.calcHpBuff(attacker, target, bufferConf.args[1], rate) }
                     end
 
                     if bufferConf.cmd == "stealattr" then
@@ -1374,7 +1374,7 @@ function onHit(attacker, skillTargets, skillConfig, cmdTargets, otherArgs, cmdCh
                                 local arg
                                 if bufferConf.cmd == "zuzhou" then
                                     local rate = bufferConf.args[2] + BeSkill.getBufferExtraHurt(attacker, bufferID, bufferConf.cmd)
-                                    arg = { CombatCalc.calcHp(attacker, target, bufferConf.args[1], rate) }
+                                    arg = { CombatCalc.calcHpBuff(attacker, target, bufferConf.args[1], rate) }
                                 end
 
                                 if bufferConf.cmd == "stealattr" then
@@ -1497,13 +1497,17 @@ function onUseBeSkill(attacker,skillConfig,objs,cmdTargets, arg, arg2)--attacker
 		if #targets > 0 then
 			if bufferConf.cmd == "zuzhou" then
 				local rate = bufferConf.args[2] + BeSkill.getBufferExtraHurt(attacker,bufferID)
-				bufferArg1 = {CombatCalc.calcHp(attacker,targets[1],bufferConf.args[1],rate)}
+				bufferArg1 = {CombatCalc.calcHpBuff(attacker,targets[1],bufferConf.args[1],rate)}
 			end
 			local attackPos = attacker.pos
 			if bufferConf.roundOne == 1 and objs and objs[1] then
 				attackPos = objs[1].pos
 			end
 
+			if bufferConf.cmd == "shuihua" then
+				addBuffTimes = addBuffTimes + (skillConfig.args[1] or 0)
+			end
+
 			local targetObjCnt
 			for _,target in ipairs(targets) do
 				if canAdd(target,bufferID,buffers[i][3], attacker, skillConfig) then
@@ -1522,7 +1526,7 @@ function onUseBeSkill(attacker,skillConfig,objs,cmdTargets, arg, arg2)--attacker
 						end
 					end
 
-					if bufferConf.cmd == "shaqi" then
+					if bufferConf.cmd == "shaqi" or bufferConf.cmd == "shuihua" then
 						for k=1, addBuffTimes do
 							addBuffer(attackPos,target, bufferID,skillConfig.id,bufferArg1 or bufferArg)
 						end
@@ -1781,7 +1785,7 @@ function getExtraHurt(attacker, target, skillConfig)
 		--local conf = BufferExcel.buffer[buffer.id]
 		local conf = GetBuffConfig(buffer.id)
 		if conf.cmd == "shenhuo" then
-            local hurt = CombatCalc.calcHp(attacker, target, conf.args[1], conf.args[2], true)
+            local hurt = CombatCalc.calcHpBuff(attacker, target, conf.args[1], conf.args[2], true)
 			extraHurt = extraHurt + hurt
 		end
 	end
@@ -2341,21 +2345,23 @@ function updateHuDun(obj, value)
 				if subVal < 0 then
 					for j =  1 , obj.buffer[0] do
 						local buffer = obj.buffer[j]
-						--local conf = BufferExcel.buffer[buffer.id]
-						local conf = GetBuffConfig(buffer.id)
-						local bufferCmd = conf.cmd
-
-						if bufferCmd == "hudun1" then
-							buffer.arg = buffer.arg + subVal
-							subVal = buffer.arg
-							if subVal >= 0 then
-								break
-							end
+						if buffer then
+							--local conf = BufferExcel.buffer[buffer.id]
+							local conf = GetBuffConfig(buffer.id)
+							local bufferCmd = conf.cmd
+
+							if bufferCmd == "hudun1" then
+								buffer.arg = buffer.arg + subVal
+								subVal = buffer.arg
+								if subVal >= 0 then
+									break
+								end
 
-							if subVal < 0 then
-								buffer.arg = 0
-								local bufferCnt = delBuffer(obj, j)
-								CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_DEL)
+								if subVal < 0 then
+									buffer.arg = 0
+									local bufferCnt = delBuffer(obj, j)
+									CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_DEL)
+								end
 							end
 						end
 					end

+ 193 - 0
script/module/combat/CombatCalc.lua

@@ -965,6 +965,196 @@ function calcHp(attacker, defender, calcType, rate, isAddHp, flag)
         end
     end
 
+    if not isAddHp and not isCmdBuffHurtRate then
+        -- hp = hp * (1 + getCmdBuffHurtRate(attacker, defender))
+    end
+
+    if isAddHp and CombatImpl.comboType > 0  then
+        hp = math.ceil(hp * 0.5)
+    end
+    hp = hp > 0 and hp or 0
+    return hp
+end
+
+-- 复制原 calcHp(), 用于兼容 combatBuff.lua 之前的逻辑, combatBuff.lua 中使用该函数
+function calcHpBuff(attacker, defender, calcType, rate, isAddHp, flag)
+    local hp
+    -- 魔兽技能是 具体值 不需要 除以一万
+    if calcType ~= 8 then
+        rate = rate / 10000
+    end
+
+    local isCmdBuffHurtRate = nil
+    local baoJi = 1
+    if calcType == 1 then
+        -- 攻击百分比(技能释放者)
+        -- local atk = CombatObj.getValue(attacker,RoleDefine.ATK_COMBAT_NOW)
+        -- hp = atk * rate
+        local atk = CombatObj.getValue(attacker, RoleDefine.ATK)
+        local atkRate = CombatObj.getValue(attacker, RoleDefine.ATK_RATE) / 10000
+        local extraHurtRate = 0
+        if not isAddHp then
+            extraHurtRate = defender.attr[RoleDefine.XURUO] / 10000
+        end
+        hp = atk *(1 + extraHurtRate) * rate
+    elseif calcType == 2 then
+        -- 生命上限百分比(技能释放者)
+        hp = CombatObj.getHpMax(attacker) * rate
+    elseif calcType == 3 then
+        -- 当前生命百分比(技能释放者)
+        hp = attacker.hp * rate
+    elseif calcType == 4 then
+        -- 损失生命百分比(技能释放者)
+        hp =(CombatObj.getHpMax(attacker) - attacker.hp) * rate
+    elseif calcType == 5 then
+        -- 目标生命百分比(技能目标)
+        hp = defender.hp * rate
+    elseif calcType == 6 then
+        -- 目标生命上限百分比(技能目标)
+        hp = CombatObj.getHpMax(defender) * rate
+        if flag ~= nil and flag > 0 then
+            local atk = CombatObj.getValue(defender, RoleDefine.ATK)
+            local atkMax = flag * atk / 10000
+            if hp > atkMax then
+                hp = atkMax
+            end
+        end
+    elseif calcType == 7 then
+        -- 伤害百分比
+        local realAttacker = CombatImpl.nowAttacker or attacker
+        hp = CombatObj.getValue(realAttacker, RoleDefine.HURT_COMBAT_NOW) * rate
+        isCmdBuffHurtRate = true
+
+    elseif calcType == 8 then
+        -- 具体值(魔兽用)
+        hp = rate
+    elseif calcType == 9 then
+        -- 当前攻击力百分比
+        local atk = CombatObj.getValue(defender, RoleDefine.ATK)
+        hp = atk * rate
+    elseif calcType == 10 then
+        -- 技能暴击时伤害的百分比
+        hp = getOutAtk(attacker)
+        local baojiRate = 10000
+        baojiRate = attacker.attr[RoleDefine.BAOJI_HURT_RATE]
+        baojiRate = baojiRate / 10000
+        baoJi = baojiRate * rate
+    elseif calcType == 11 then
+        -- 生命上限百分比不走公式(技能释放者)
+        hp = CombatObj.getHpMax(attacker) * rate
+    elseif calcType == 12 then
+        -- 当前战斗回合造成的总伤害
+        if attacker.combatResult[4] then
+            hp = - attacker.combatResult[4] * rate
+        else
+            hp = 1
+        end
+    elseif calcType == 13 then
+        -- 当前生命百分比(技能释放者,不算减伤)
+        hp = attacker.hp * rate
+    elseif calcType == 14 then
+        -- 损失生命百分比(技能释放者,不算减伤)
+        hp =(CombatObj.getHpMax(attacker) - attacker.hp) * rate
+    elseif calcType == 15 then
+        -- 目标生命百分比(技能目标,不算减伤)
+        hp = defender.hp * rate
+    elseif calcType == 16 then
+        -- 目标生命上限百分比(技能目标,不算减伤)
+        hp = CombatObj.getHpMax(defender) * rate
+        if flag ~= nil and flag > 0 then
+            local atk = CombatObj.getValue(defender, RoleDefine.ATK)
+            local atkMax = flag * atk / 10000
+            if hp > atkMax then
+                hp = atkMax
+            end
+        end
+    elseif calcType == 17 then
+        -- 回合内 目标上一次对我造成的伤害
+        if defender.combatResult[5] and defender.combatResult[5][attacker.pos] then
+            hp = - defender.combatResult[5][attacker.pos] * rate
+        else
+            hp = 1
+        end
+    elseif calcType == 18 then
+        -- 当前攻击力百分比(不算减伤)
+        local atk = CombatObj.getValue(defender, RoleDefine.ATK)
+        hp = atk * rate
+    elseif calcType == 19 then
+        -- 攻击百分比(技能释放者,不算减伤)
+        local atk = CombatObj.getValue(attacker, RoleDefine.ATK)
+        local atkRate = CombatObj.getValue(attacker, RoleDefine.ATK_RATE) / 10000
+        local extraHurtRate = 0
+        if not isAddHp then
+            extraHurtRate = defender.attr[RoleDefine.XURUO] / 10000
+        end
+        hp = atk *(1 + atkRate) *(1 + extraHurtRate) * rate
+
+    elseif calcType == 20 then
+        -- 触发了被动技能类型40的攻击对象的伤害加成
+        hp = 0
+        if attacker.beskill40 then
+            for pos in pairs(attacker.beskill40) do
+                local hpAdd = attacker.combatResult[5][pos] or 0
+                hp = hp + hpAdd
+            end
+        end
+        hp = - hp * rate
+    elseif calcType == 21 then
+        -- 回合内 我对目标造成造成的伤害
+        if attacker.combatResult[5] and attacker.combatResult[5][defender.pos] then
+            hp = - attacker.combatResult[5][defender.pos] * rate
+        else
+            hp = 1
+        end
+    elseif calcType == 22 then
+        -- 目标生命上限百分比(上限是自己的攻击)
+        hp = CombatObj.getHpMax(defender) * rate
+        if flag ~= nil and flag > 0 then
+            local atk = CombatObj.getValue(attacker, RoleDefine.ATK)
+            local atkMax = flag * atk / 10000
+            if hp > atkMax then
+                hp = atkMax
+            end
+        end
+    elseif calcType == 23 then
+        -- 目标损失生命上限百分比  上限时攻击的4倍
+        hp = (CombatObj.getHpMax(defender) - defender.hp) * rate
+    elseif calcType == 24 then
+        -- 目标损失生命上限百分比  上限时攻击的4倍
+        hp = CombatObj.getValue(defender, RoleDefine.RATE_COMBAT_NOW) * rate
+    elseif calcType == 25 then
+        -- 目标当前生命百分比,不超过攻击者攻击力的10倍
+        local atk = CombatObj.getValue(attacker, RoleDefine.ATK)
+        local nMaxHp = atk * 10
+        hp = defender.hp * rate
+        if hp > nMaxHp then
+            hp = nMaxHp
+        end
+    elseif calcType == 26 then
+        -- 当前攻击者攻击力百分比
+        local atk = CombatObj.getValue(attacker, RoleDefine.ATK)
+        hp = atk * rate
+    end
+
+    if not NO_EXCALC_LIST[calcType] then
+        if isAddHp then
+            if defender.type == CombatDefine.COMBAT_OBJ_TYPE3 then
+                hp = 0
+            else
+                local hpAddRate = CombatObj.getValue(defender, RoleDefine.HP_ADD_RATE) / 10000
+                hp = hp *(1 + hpAddRate)
+                hp = hp < 0 and 1 or hp
+            end
+        --[[
+        else
+            local defRate = getDef(defender)
+            local jianshangRate = getJianshangRate(attacker, defender)
+            local rateCombatNow =(1 -(defRate /(defRate + 600))) *(1 - jianshangRate)
+            hp = hp * rateCombatNow * baoJi
+        ]]--
+        end
+    end
+
     if not isAddHp and not isCmdBuffHurtRate then
         hp = hp * (1 + getCmdBuffHurtRate(attacker, defender))
     end
@@ -976,6 +1166,9 @@ function calcHp(attacker, defender, calcType, rate, isAddHp, flag)
     return hp
 end
 
+
+
+
 function calcBufferHp(attacker, defender, bufferID, isAddHp)
     --local conf = BufferExcel[bufferID]
     local conf = CombatBuff.GetBuffConfig(bufferID)

+ 10 - 2
script/module/combat/CombatLogic.lua

@@ -407,7 +407,7 @@ function createHeroObjByID(heroId, lv, star, quality, index)
 end
 
 -- 根据英雄表信息创建临时对象
-function createHeroObj(human, heroId, lv, star, index,skin)
+function createHeroObj(human, heroId, lv, star, index, skin, attrsChange)
 	local heroConfig = HeroExcel.hero[heroId]
 	local skinCfg = skin and SkinExcel.skin[skin]
 	if not heroConfig then return end
@@ -434,8 +434,16 @@ function createHeroObj(human, heroId, lv, star, index,skin)
     if not SkinLogic.setSkill(human,index,attrConfig,obj) then
 		Skill.setSkill(obj, attrConfig)	
 		BeSkill.setBeSkill(obj, attrConfig)
-	end	
+	end
 	obj.attrs = Util.copyTable(RoleAttr.calcHeroGrid(obj, index, human))
+	if attrsChange then
+		for attrId, valMul in pairs(attrsChange) do
+			if obj.attrs[attrId] then
+				obj.attrs[attrId] = math.max(obj.attrs[attrId] * valMul, 0)
+			end
+		end
+	end
+
     obj.zhandouli = obj.attrs[RoleDefine.ZHANDOULI]
 	return obj
 end

+ 8 - 0
script/module/combat/CombatPosLogic.lua

@@ -84,6 +84,14 @@ function getCombatHeroDB(human,combatType)
 	return human.db.combatHero[teamType],teamType
 end
 
+-- 重置阵容数据
+function ResetCombatData(human,combatType)
+	local teamType = getTeamType(combatType)
+	if teamType and human.db.combatHero[teamType] then
+		human.db.combatHero[teamType] = nil
+	end
+end
+
 --根据阵法id返回可用站位
 function getPosList(formation)
 	local formationConf = FormationExcel[formation]

+ 1 - 7
script/module/combat/JibanLogic.lua

@@ -567,13 +567,7 @@ function update(human,combatType,jibanListStr, heroIdStr, extraArgs)
 
 			-- setDB_JibanHeroID(human, k,	heroGrid.id)
 
-			local res
-			if combatType == CombatDefine.COMBAT_TYPE37 then
-				ServerCommerceActBattleGroundNS = ServerCommerceActBattleGroundNS or require("serverCommerce.ServerCommerceActBattleGroundNS")
-				res = ServerCommerceActBattleGroundNS.isGetHero(human, heroId)
-			else
-				HeroBook.isGetHero(human, heroId)
-			end
+			local res = HeroBook.isGetHero(human, heroId)
 			if not res or res == HeroBook.LIEZHUAN_REWARD_NO then
 				return
 			end

+ 9 - 4
script/module/elf/ElfLogic.lua

@@ -28,7 +28,7 @@ local RoleDefine = require("role.RoleDefine")
 local ObjHuman = require("core.ObjHuman")
 local RoleSystemLogic = require("roleSystem.RoleSystemLogic")
 local RoleSystemDefine = require("roleSystem.RoleSystemDefine")
--- local HuanJingTowerLogic = require("huanjingTower.HuanjingTowerLogic")
+local HuanJingTowerLogic = require("huanjingTower.HuanjingTowerLogic")
 local TalismanLogic = require("talisman.TalismanLogic")
 local TriggerLogic = require("trigger.TriggerLogic")
 local TriggerDefine = require("trigger.TriggerDefine")
@@ -38,7 +38,7 @@ local GiftLogic
 
 local ELF_UPGRADELV_LOG_TAG = "elfUpGradeLv"
 local ELF_UPGRADESTAR_LOG_TAG = "elfUpGradeStar"
--- local ELF_COND_TOWER_LEVEL =  600
+local ELF_COND_TOWER_LEVEL =  600
 local ELF_2_CHENGJIU_TASKID = 406 -- 精灵系统对应的成就任务Id
 
 
@@ -204,7 +204,7 @@ end
 
 
 
---是否开启本系统
+--是否开启本系统, 内部使用, 需要领取任务奖励后才解锁
 local function isOpen(human)
     -- local towerLevel = HuanJingTowerLogic.getTowerLevel(human)
     -- if towerLevel >= ELF_COND_TOWER_LEVEL then
@@ -316,7 +316,12 @@ end
 
 -- 外部调用, 本系统是否开启
 function ModuleisOpen(human)
-    return isOpen(human)
+    -- return isOpen(human)
+    local towerLevel = HuanJingTowerLogic.getTowerLevel(human)
+    if towerLevel >= ELF_COND_TOWER_LEVEL then
+        return true
+    end
+    return false
 end
 
 -- 外部调用, 是否有红点

+ 16 - 0
script/module/hero/Handler.lua

@@ -8,6 +8,7 @@ local HeroGem = require("hero.HeroGem")
 local HeroExclusiveWeapon = require("hero.HeroExclusiveWeapon")
 local HeroPubLogic = require("hero.HeroPubLogic")
 local HeroSeed = require("hero.HeroSeed")
+local HeroTianYuan = require("hero.HeroTianYuan")
 
 -- 请求英雄详细信息:静态
 function CG_HERO_BAG_STATIC(human,msg)
@@ -290,4 +291,19 @@ function CG_HEROSEED_UPGRADE(human, msg)
     HeroSeed.HeroSeed_UpGrade(human, msg.heroID, msg.heroIndex, msg.seedIdx, msg.opType)
 end
 
+---------------------------------------------------------------------------------------------
+
+---------------------------------------英雄天元系统-----------------------------------------------
+function CG_HEROTY_QUERY(human, msg)
+    HeroTianYuan.HeroTianYuan_Query(human, msg.heroID, msg.heroIndex)
+end
+
+function CG_HEROTY_POINT_UPGRADE(human, msg)
+    HeroTianYuan.HeroTianYuan_PointUpGrade(human, msg.heroID, msg.heroIndex)
+end
+
+function CG_HEROTY_STAGE_UPGRADE(human, msg)
+    HeroTianYuan.HeroTianYuan_StageUpGrade(human, msg.heroID, msg.heroIndex)
+end
+
 ---------------------------------------------------------------------------------------------

+ 41 - 1
script/module/hero/HeroLogic.lua

@@ -77,6 +77,7 @@ local Abs365CardLogic = require("absAct.Abs365CardLogic")
 local HeroSeed = require("hero.HeroSeed")
 local DeleteHeroConfig = require("excel.delteHero")
 local AnotherWorldBattleNS = require("anotherWorldBattle.AnotherWorldBattleNS")
+local HeroTianYuan = require("hero.HeroTianYuan")
 
 
 HERO_MAX_STAR    =        15    -- 目前英雄最大星级
@@ -441,6 +442,8 @@ function sendHeroGridDynamic(human, heroGrid, index, isQuery)
     msgRet.canJueXing = isHeroJuexingDot(human, index, heroGrid) == true and 1 or 0
 	msgRet.canWeapon = HeroExclusiveWeapon.isWeaponDot(human, heroGrid) == true and 1 or 0
 	msgRet.canSeed = HeroSeed.isSeedDot(human, heroGrid) == true and 1 or 0
+	msgRet.canTianYuan = HeroTianYuan.isTianYuanDot(human, heroGrid) == true and 1 or 0
+
 	local bingShuState = BingshuLogic.isBingShuDot(human, heroGrid)
 	if bingShuState == -1 then
 		msgRet.canBingShu = -1 
@@ -998,8 +1001,17 @@ function getSkillDiffList(cf1, cf2)
 	return diffCnt, JUEXING_SKILL_DIFF_LIST
 end
 
--- 英雄升星 16~20的额外条件表, 升到 key 星, 背包中还额外需要有 value[2] 个星级为 value[1] 的英雄
+-- 英雄升星 8~20 的额外条件表, 升到 key 星, 背包中还额外需要有 value[2] 个星级为 value[1] 的英雄
 local upStarExtraCond = {
+	[8] = {6, 5},
+	[9] = {7, 5},
+	[10] = {8, 5},
+	[11] = {9, 5},
+	[12] = {10, 5},
+	[13] = {11, 5},
+	[14] = {12, 5},
+	[15] = {13, 5},
+
 	[16] = {11, 10},
 	[17] = {11, 15},
 	[18] = {12, 10},
@@ -1621,6 +1633,18 @@ function sendHuituiQuery(human, heroID, heroIndex)
 		end
 	end
 
+	local tianYuanReturnItem = HeroTianYuan.CalcReturnItem(human, heroGrid)
+		if tianYuanReturnItem then
+		for itemId, itemCnt in pairs(tianYuanReturnItem) do
+			if msgRet.returnItems[0] >= #msgRet.returnItems then
+				break
+			end
+			
+			msgRet.returnItems[0] = msgRet.returnItems[0] + 1
+			Grid.makeItem(msgRet.returnItems[msgRet.returnItems[0]], itemId, itemCnt)
+		end
+	end
+
 	msgRet.returnHeros[0] = 0
 	for star, v in pairs(heros) do
         local rHeroID = v[1]
@@ -1699,6 +1723,17 @@ function huituiHero(human, heroID, heroIndex)
 		HeroSeed.ResetSeedLv(human, heroGrid)
 	end
 
+	-- 英雄天元返还材料
+	local tianYuanReturnItem = HeroTianYuan.CalcReturnItem(human, heroGrid)
+	if tianYuanReturnItem then
+		for itemId, itemCnt in pairs(tianYuanReturnItem) do
+			items[itemId] = (items[itemId] or 0) + itemCnt
+		end
+
+		-- 重置英雄天元数据
+		HeroTianYuan.ResetTianYuanData(human, heroGrid)
+	end
+
 
 	heroGrid.star = star
 	heroGrid.lv = targetLv
@@ -2039,6 +2074,11 @@ function isHeroDot(human, heroGrid)
 		return true
 	end
 
+	-- 英雄天元
+	if HeroTianYuan.isTianYuanDot(human, heroGrid) then
+		return true
+	end
+
 end
 
 -- 升级判定

+ 406 - 0
script/module/hero/HeroTianYuan.lua

@@ -0,0 +1,406 @@
+-- 天元系统
+
+local Lang = require("common.Lang")
+local Msg = require("core.Msg")
+local BagLogic = require("bag.BagLogic")
+local HeroLogic = require("hero.HeroLogic")
+local ObjHuman = require("core.ObjHuman")
+local Grid = require("bag.Grid")
+local RoleAttr = require("role.RoleAttr")
+local HeroTianYuanCfg = require("excel.heroTianYuan")
+local Broadcast = require("broadcast.Broadcast")
+local RoleDefine = require("role.RoleDefine")
+
+
+local LOGTAG = "HeroTianYuan" --日志标识
+
+
+local function initData(heroGrid)
+    heroGrid.tianYuanData = {
+        pointIdx = 0,
+        stage = 0,
+    }
+end
+
+local function updateData(heroGrid, newPointIdx, newStage)
+    if not heroGrid.tianYuanData then
+        initData(heroGrid)
+    end
+
+    if newPointIdx then
+        heroGrid.tianYuanData.pointIdx = newPointIdx
+    end
+
+    if newStage then
+        heroGrid.tianYuanData.stage = newStage
+    end
+end
+
+
+
+-- 系统开启条件检查
+local function openCheck(human, heroID, heroIndex)
+    local heroGrid = HeroLogic.getHeroGrid(human, heroID, heroIndex)
+    if not heroGrid then
+        return Broadcast.sendErr(human, Lang.FUWEN_HERO_GRID_ERR)
+    end
+
+    local varCfg = HeroTianYuanCfg.var[1]
+    if heroGrid.star < varCfg.unLockCondStar then
+        return Broadcast.sendErr(human, Lang.HEROPUB_STAR_NOT_ENOUGH)
+    end
+
+    return true
+end
+
+-- 获取正确的消耗道具信息
+local function getTargetItemArr(nowStage, nowPointIdx, maxStage)
+    local varCfg = HeroTianYuanCfg.var[1]
+    local targetStageCfgIdx = math.min(nowStage + 1, maxStage)
+    local targetStageCfg = HeroTianYuanCfg.upGrade[targetStageCfgIdx]
+
+    local itemCfg
+    if nowPointIdx < varCfg.pointMaxNum and nowStage < maxStage then
+        itemCfg = targetStageCfg.pointCost
+    else
+        itemCfg = targetStageCfg.stageCost
+    end
+
+    local itemArr = {}
+    for i, itemInfo in ipairs(itemCfg) do
+        itemArr[i] = { itemInfo[1], itemInfo[2] }
+    end
+
+    return itemArr
+end
+
+local function transformData(targetList, sourceArr, mul)
+    mul = mul or 1
+    for _, tb in ipairs(sourceArr) do
+        local id = tb[1]
+        local val = tb[2]
+        targetList[id] = (targetList[id] or 0) + val * mul
+    end
+end
+
+-- 统计数据, dataType: 1-加成属性, 2-消耗道具
+local function calcData(nowStage, nowPointIdx, dataType)
+    if nowStage <= 0 and nowPointIdx <= 0 then
+        return
+    end
+
+    local dataList = {}
+    local maxPointNum = HeroTianYuanCfg.var[1].pointMaxNum
+
+    for i = 1, nowStage do
+        -- 天元突破的消耗道具/加成属性
+        local stageCfg = HeroTianYuanCfg.upGrade[i]
+        if stageCfg then
+            local sourceData = stageCfg.stageCost
+            if dataType == 1 then
+                sourceData = stageCfg.stageAttrs
+            end
+            transformData(dataList, sourceData)
+        end
+
+        -- 天元点的消耗道具/加成属性
+        stageCfg = HeroTianYuanCfg.upGrade[i+1]
+        if stageCfg then
+            local sourceData = stageCfg.pointCost
+            local pointNum = 0
+
+            if i == nowStage and nowPointIdx > 0 then
+                pointNum = nowPointIdx
+            elseif i ~= nowStage then
+                pointNum = maxPointNum
+            end
+
+            if pointNum > 0 then
+                if dataType == 1 then
+                    sourceData = stageCfg.pointAttrs
+                end
+                transformData(dataList, sourceData, pointNum)
+            end
+        end
+    end
+
+    -- 0 ~ 1重天元点的消耗道具/加成属性
+    local pointNum = nowPointIdx
+    if nowStage >= 1 then
+        pointNum = maxPointNum
+    end
+
+    local stageOneCfg = HeroTianYuanCfg.upGrade[1]
+    local sourceData = stageOneCfg.pointCost
+    if dataType == 1 then
+        sourceData = stageOneCfg.pointAttrs
+    end
+    transformData(dataList, sourceData, pointNum)
+
+    return dataList
+end
+
+-- 获取下一次提升增加的属性
+local function getNextAttrs(nowStage, nowPointIdx, maxPointNum)
+    nowStage = math.min(nowStage+1, #HeroTianYuanCfg.upGrade)
+    local stageCfg = HeroTianYuanCfg.upGrade[nowStage]
+
+    if nowPointIdx >= maxPointNum then -- 当前天元点已全部点亮, 需要突破天元
+        return stageCfg.stageAttrs
+    else
+        return stageCfg.pointAttrs
+    end
+end
+
+-- 更新战力
+local function updatePower(human, heroID, heroIndex)
+    RoleAttr.cleanHeroAttrCache(human)
+    RoleAttr.doCalc(human)
+    HeroLogic.sendHeroBagDynamic(human, heroID, heroIndex)
+    ObjHuman.sendAttr(human, RoleDefine.ZHANDOULI)
+end
+
+
+
+-- 英雄天元红点检测
+function isTianYuanDot(human, heroGrid)
+    local varCfg = HeroTianYuanCfg.var[1]
+    if heroGrid.star < varCfg.unLockCondStar then
+        return false
+    end
+
+    local tianYuanData = heroGrid.tianYuanData
+    local nowPointIdx = tianYuanData and tianYuanData.pointIdx or 0
+    local nowStage = tianYuanData and tianYuanData.stage or 0
+    local maxStage = #HeroTianYuanCfg.upGrade
+
+    if nowStage >= maxStage then
+        return false
+    end
+
+    local itemArr = getTargetItemArr(nowStage, nowPointIdx, maxStage)
+    for _, item in ipairs(itemArr) do
+        if BagLogic.getItemCnt(human, item[1]) < item[2] then
+            return false
+        end
+    end
+
+    return true
+end
+
+-- 计算返还材料
+function CalcReturnItem(human, heroGrid)
+    if not heroGrid or not heroGrid.tianYuanData then
+        return
+    end
+
+    local nowStage = heroGrid.tianYuanData.stage or 0
+    local nowPointIdx = heroGrid.tianYuanData.pointIdx or 0
+    local itemList = calcData(nowStage, nowPointIdx, 2)
+
+    return itemList
+end
+
+-- 重置英雄天元数据
+function ResetTianYuanData(human, heroGrid)
+    if not heroGrid or not heroGrid.tianYuanData then
+        return
+    end
+
+    heroGrid.tianYuanData = nil
+end
+
+-- 英雄天元加成
+function doCalcHero(human, heroGrid, tatgetAttrs)
+    if not heroGrid or not heroGrid.tianYuanData then
+        return
+    end
+
+    local nowStage = heroGrid.tianYuanData.stage or 0
+    local nowPointIdx = heroGrid.tianYuanData.pointIdx or 0
+    local sourceAttrs = calcData(nowStage, nowPointIdx, 1)
+
+    for attrId, attrVal in pairs(sourceAttrs or {}) do
+        RoleAttr.updateValue(attrId, attrVal, tatgetAttrs)
+    end
+end
+
+
+
+-- 查询英雄天元信息
+function HeroTianYuan_Query(human, heroID, heroIndex)
+    local res = openCheck(human, heroID, heroIndex)
+    if res ~= true then
+        return
+    end
+
+    local maxPointNum = HeroTianYuanCfg.var[1].pointMaxNum
+    local upGradeCfg = HeroTianYuanCfg.upGrade
+
+    local heroGrid = HeroLogic.getHeroGrid(human, heroID, heroIndex)
+    local tianYuanData = heroGrid.tianYuanData
+    local nowPointIdx = tianYuanData and tianYuanData.pointIdx or 0
+    local nowStage = tianYuanData and tianYuanData.stage or 0
+
+    local msgRet = Msg.gc.GC_HEROTY_QUERY
+    msgRet.pointIdx = nowPointIdx
+    msgRet.stageIdx = nowStage
+    msgRet.stageMax = #upGradeCfg
+    msgRet.maxPoint = maxPointNum
+
+    -- 消耗
+    local itemArr = getTargetItemArr(nowStage, nowPointIdx, msgRet.stageMax)
+    local item = itemArr[1]
+    local itemId, itemCnt = item[1], item[2]
+    if nowStage >= msgRet.stageMax then
+        itemCnt = 0
+    end
+    Grid.makeItem(msgRet.cost, itemId, itemCnt)
+
+    -- msgRet.cost[0] = #itemArr
+    -- for i, item in ipairs(itemArr) do
+    --     local itemId, itemCnt = item[1], item[2]
+    --     if nowStage >= msgRet.stageMax then
+    --         itemCnt = 0
+    --     end
+
+    --     Grid.makeItem(msgRet.cost[i], itemId, itemCnt)
+    -- end
+
+    -- 总加成属性
+    msgRet.attrs[0] = 0
+    local attrs = calcData(nowStage, nowPointIdx, 1)
+    if attrs then
+        local len = 0
+        for attrId, attrVal in pairs(attrs) do
+            len = len + 1
+            msgRet.attrs[0] = len
+            msgRet.attrs[len].key = attrId
+            msgRet.attrs[len].value = attrVal
+        end
+    end
+
+    -- 下一次提升增加的属性
+    msgRet.nextAttrs[0] = 0
+    if nowStage < msgRet.stageMax then
+        local nextAttrs = getNextAttrs(nowStage, nowPointIdx, maxPointNum)
+        if nextAttrs then
+            msgRet.nextAttrs[0] = #nextAttrs
+            for i, attrTb in ipairs(nextAttrs) do
+                msgRet.nextAttrs[i].key = attrTb[1]
+                msgRet.nextAttrs[i].value = attrTb[2]
+            end
+        end
+    end
+
+    Msg.send(msgRet, human.fd)
+end
+
+-- 请求点亮天元点
+function HeroTianYuan_PointUpGrade(human, heroID, heroIndex)
+    local res = openCheck(human, heroID, heroIndex)
+    if res ~= true then
+        return
+    end
+
+    local heroGrid = HeroLogic.getHeroGrid(human, heroID, heroIndex)
+    local varCfg = HeroTianYuanCfg.var[1]
+
+    local tianYuanData = heroGrid.tianYuanData
+    local nowPointIdx = tianYuanData and tianYuanData.pointIdx or 0
+    local nowStage = tianYuanData and tianYuanData.stage or 0
+
+    if nowPointIdx >= varCfg.pointMaxNum then
+        return Broadcast.sendErr(human, Lang.HERO_TY_POINT_MAX)
+    end
+
+    if nowStage >= #HeroTianYuanCfg.upGrade then
+        return Broadcast.sendErr(human, Lang.HERO_TY_STAGE_MAX)
+    end
+
+    local targetCfgIdx = nowStage + 1
+    local targetStageCfg = HeroTianYuanCfg.upGrade[targetCfgIdx]
+
+    if not targetStageCfg then
+        return Broadcast.sendErr(human, Lang.COMMON_COMFIG_ERROR)
+    end
+
+    -- 消耗检查
+    for _, itemInfo in ipairs(targetStageCfg.pointCost) do
+        if BagLogic.getItemCnt(human, itemInfo[1]) < itemInfo[2] then
+            return Broadcast.sendErr(human, Lang.COMMON_ITEM_NOT_ENOUGH)
+        end
+    end
+
+    -- 扣除消耗
+    for _, itemInfo in ipairs(targetStageCfg.pointCost) do
+        BagLogic.delItem(human, itemInfo[1], itemInfo[2], LOGTAG)
+    end
+
+
+    -- 更新点亮天元点索引
+    nowPointIdx = nowPointIdx + 1
+    updateData(heroGrid, nowPointIdx)
+
+    -- 推送最新数据给客户端
+    HeroTianYuan_Query(human, heroID, heroIndex)
+
+    -- 更新战力
+    updatePower(human, heroID, heroIndex)
+
+    -- 刷新红点
+    HeroLogic.refreshDot(human, heroGrid.uuid)
+end
+
+-- 请求天元突破
+function HeroTianYuan_StageUpGrade(human, heroID, heroIndex)
+    local res = openCheck(human, heroID, heroIndex)
+    if res ~= true then
+        return
+    end
+
+    local heroGrid = HeroLogic.getHeroGrid(human, heroID, heroIndex)
+    local varCfg = HeroTianYuanCfg.var[1]
+
+    local tianYuanData = heroGrid.tianYuanData
+    local nowPointIdx = tianYuanData and tianYuanData.pointIdx or 0
+    local nowStage = tianYuanData and tianYuanData.stage or 0
+
+    if nowPointIdx < varCfg.pointMaxNum then
+        return Broadcast.sendErr(human, Lang.HERO_TY_POINT_NOT_ENOUGH)
+    end
+
+    if nowStage >= #HeroTianYuanCfg.upGrade then
+        return Broadcast.sendErr(human, Lang.HERO_TY_STAGE_MAX)
+    end
+
+    local nextStage = nowStage + 1
+    local nextStageCfg = HeroTianYuanCfg.upGrade[nextStage]
+    if not nextStageCfg then
+        return Broadcast.sendErr(human, Lang.COMMON_COMFIG_ERROR)
+    end
+
+    -- 消耗检查
+    for _, itemInfo in ipairs(nextStageCfg.stageCost) do
+        if BagLogic.getItemCnt(human, itemInfo[1]) < itemInfo[2] then
+            return Broadcast.sendErr(human, Lang.COMMON_ITEM_NOT_ENOUGH)
+        end
+    end
+
+    -- 扣除消耗
+    for _, itemInfo in ipairs(nextStageCfg.stageCost) do
+        BagLogic.delItem(human, itemInfo[1], itemInfo[2], LOGTAG)
+    end
+
+    -- 更新天元点索引, 天元重数
+    updateData(heroGrid, 0, nextStage)
+
+    -- 推送最新数据给客户端
+    HeroTianYuan_Query(human, heroID, heroIndex)
+
+    -- 更新战力
+    updatePower(human, heroID, heroIndex)
+
+    -- 刷新红点
+    HeroLogic.refreshDot(human, heroGrid.uuid)
+end

+ 36 - 1
script/module/hero/Proto.lua

@@ -218,6 +218,7 @@ GC_HERO_BAG_DYNAMIC = {
 	{"canBingShu",  1,      "byte"},
 	{"canWeapon",   1,      "byte"},
 	{"canSeed",   	1,      "byte"},
+	{"canTianYuan", 1,      "byte"},
 }
 
 -- 获取配置英雄属性
@@ -989,4 +990,38 @@ CG_HEROSEED_UPGRADE = {
 }
 
 
-------------------------------------------------------------------------------------
+------------------------------------------------------------------------------------
+
+
+-----------------------------------英雄天元系统---------------------------------------
+
+-- 查询英雄天元信息
+CG_HEROTY_QUERY = {
+	{"heroID",			1,		"int"},   -- 英雄id
+	{"heroIndex",		1,		"short"}, -- 英雄index
+}
+
+GC_HEROTY_QUERY = {
+	{"pointIdx",	1,		"short"}, 	-- 当前已点亮的天元点索引
+	{"stageIdx",	1,		"short"}, 	-- 当前已突破的重数
+	{"stageMax",	1,		"short"}, 	-- 最大可突破重数
+	{"attrs",		6,		Attr}, 		-- 总加成属性
+	{"cost", 		1,     ItemData},	-- 点亮/突破消耗的道具,没法升级后数量为0
+	{"maxPoint",	1,		"short"}, 	-- 最大可点亮天元点数量
+	{"nextAttrs",	6,		Attr}, 		-- 下一次提升的属性
+}
+
+-- 点亮天元
+CG_HEROTY_POINT_UPGRADE = {
+	{"heroID",			1,		"int"},   -- 英雄id
+	{"heroIndex",		1,		"short"}, -- 英雄index
+}
+
+
+-- 突破天元
+CG_HEROTY_STAGE_UPGRADE = {
+	{"heroID",			1,		"int"},   -- 英雄id
+	{"heroIndex",		1,		"short"}, -- 英雄index
+}
+
+-------------------------------------------------------------------------------------

+ 8 - 0
script/module/present/DailyLibaoLogic.lua

@@ -19,6 +19,7 @@ local BuyLogic = require("topup.BuyLogic")
 local VipLogic = require("vip.VipLogic")
 local YunYingLogic = require("yunying.YunYingLogic")
 local CommonDefine = require("common.CommonDefine")
+local CommonDB = require("common.CommonDB")
 
 local FREE_LIBAO_ID = 0 		-- 免费
 local QUICK_LIBAO_ID = 1  		-- 一键购买
@@ -28,6 +29,8 @@ local QUICK_STATUS_CAN = 1 		-- 可购买
 
 local DAILY_GITFT_ACTID = 312	-- 日礼包活动Id
 
+local COND_OPEN_SRV_DAYS = 2	--  需要开服2天后才展示
+
 
 -- 通过渠道标识获取礼包配置ID
 local function getCfgIdxByChannel(human)
@@ -270,6 +273,11 @@ function isOpen(human, YYInfo, funcConfig)
 		return false
 	end
 
+	local openDay = CommonDB.getServerOpenDay()
+    if openDay < COND_OPEN_SRV_DAYS then
+        return false
+    end
+
 	return true
 end
 

+ 8 - 0
script/module/present/RichangLibaoLogic.lua

@@ -18,6 +18,7 @@ local Grid = require("bag.Grid")
 local BagLogic = require("bag.BagLogic")
 local BuyLogic = require("topup.BuyLogic")
 local YunYingLogic = require("yunying.YunYingLogic")
+local CommonDB = require("common.CommonDB")
 
 LIBAOTYPE_WEEK = 1 			-- 每周礼包
 LIBAOTYPE_MONTH = 2 		-- 每月礼包
@@ -26,6 +27,8 @@ FREE_BUY = 1 				-- 免费领取
 RMB_BUY = 2 				-- rmb购买
 
 
+local COND_OPEN_SRV_DAYS = 2	--  需要开服2天后才展示
+
 local WEEK_GITFT_ACTID = 315	-- 周礼包活动Id
 local MONTH_GITFT_ACTID = 316	-- 月礼包活动Id
 
@@ -259,6 +262,11 @@ function isOpen(human, YYInfo, funcConfig)
 		return false
 	end
 
+	local openDay = CommonDB.getServerOpenDay()
+    if libaoType == LIBAOTYPE_WEEK and openDay < COND_OPEN_SRV_DAYS then
+        return false
+    end
+
 	return true, endTime, startTime
 end
 

+ 2 - 0
script/module/role/RoleAttr.lua

@@ -44,6 +44,7 @@ local WinnerRelicLogic = require("winnerRelic.WinnerRelicLogic")
 local HeroPubLogic = require("hero.HeroPubLogic")
 local HeroSeed = require("hero.HeroSeed")
 local ElfLogic = require("elf.ElfLogic")
+local HeroTianYuan = require("hero.HeroTianYuan")
 
 
 local function printAttr(attr, szText)
@@ -180,6 +181,7 @@ function calcHeroGrid(heroGrid, index, human)
 	HeroPubLogic.doCalcHero(human, HERO_OTHER_ATTRS) --英雄酒馆
 	HeroSeed.doCalcHero(human, heroGrid, HERO_OTHER_ATTRS) -- 英雄种子
 	ElfLogic.doCalcHero(human, HERO_OTHER_ATTRS) --精灵系统
+	HeroTianYuan.doCalcHero(human, heroGrid, HERO_OTHER_ATTRS) -- 英雄天元
 	
 
 	--不同模块在英雄属性计算 end	

+ 1 - 1
script/module/roleSystem/Proto.lua

@@ -23,7 +23,7 @@ CG_ROLESYSTEM_QUERY = {
 }
 
 GC_ROLESYSTEM_QUERY = {
-	{"list",		100,		RoleSystemNet},	
+	{"list",		110,		RoleSystemNet},	
 }
 
 CG_ROLESYSTEM_TOUCH = {

+ 1 - 0
script/module/roleSystem/RoleSystemDefine.lua

@@ -10,6 +10,7 @@ ROLE_SYS_ID_108 =  108  -- 充值返利
 ROLE_SYS_ID_109 =  109  -- QQ大咖  
 ROLE_SYS_ID_110 =  110  -- 系统开启奖励
 ROLE_SYS_ID_111 =  111  -- 无限高抽
+ROLE_SYS_ID_112 =  112  -- 闯关主题
 
 ROLE_SYS_ID_201 =  201  -- 主界面中-聊天
 ROLE_SYS_ID_202 =  202  -- 主界面中-战报

+ 10 - 2
script/module/serverCommerce/Handler.lua

@@ -95,6 +95,14 @@ function CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_RANKAWARD_QUERY(human, msg)
     ServerCommerceActBattleGroundNS.BattleGround_RankAward_Query(human)
 end
 
-function CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_ATKLINEUP_UPDATE(human, msg)
-    ServerCommerceActBattleGroundNS.BattleGround_Lineup_Update(human, msg)
+function CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_UPDATE_MATCHLIST(human, msg)
+    ServerCommerceActBattleGroundNS.BattleGround_Update_MatchList(human, msg)
+end
+
+function CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_ONECLICK_SWEEP(human, msg)
+    ServerCommerceActBattleGroundNS.BattleGround_OneClickSweep(human, msg)
+end
+
+function CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_ALREAFY_KNOW(human, msg)
+    ServerCommerceActBattleGroundNS.BattleGround_AlreadyKonw_GetNewHero(human, msg)
 end

+ 11 - 6
script/module/serverCommerce/Proto.lua

@@ -233,6 +233,7 @@ BATTLEGROUND_HERO_INFO = {
     {"heroId",                1,      "int"},              -- 英雄Id
     {"heroUuid",              1,      "string"},           -- 英雄唯一Id
     {"heroBagIdx",            1,      "int"},              -- 背包位置
+    {"heroJob",               1,      "int"},              -- 英雄职业
 }
 
 SERVEERCOMMERCE_ACT_RANK_INFO = {
@@ -246,7 +247,7 @@ SERVEERCOMMERCE_ACT_RANK_INFO = {
 SERVEERCOMMERCE_ACT_RANKAWARD_INFO = {
     {"minRank",                1,      "short"},            -- 最低排名
     {"maxRank",                1,      "short"},            -- 最高排名
-    {"rankAward",              3,      ItemData},           -- 排名奖励
+    {"rankAward",              4,      ItemData},           -- 排名奖励
 }
 
 
@@ -302,8 +303,12 @@ GC_SERVEERCOMMERCE_ACT_BATTLEGROUND_RANKAWARD_QUERY = {
     {"rankAwardList",           10,      SERVEERCOMMERCE_ACT_RANKAWARD_INFO}, -- 排行榜奖励
 }
 
--- 设置进攻阵容
-CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_ATKLINEUP_UPDATE = {
-    {"formation",	1,	    "short"},--阵法
-	{"heroList"	,	1,		"string"}, --上阵英雄
-}
+-- 更新匹配列表
+CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_UPDATE_MATCHLIST = {}
+
+-- 一键扫荡
+CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_ONECLICK_SWEEP = {}
+
+-- 已经知道获得新英雄了
+CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_ALREAFY_KNOW = {}
+

+ 84 - 34
script/module/serverCommerce/ServerCommerceActBattleGroundCS.lua

@@ -60,9 +60,6 @@ local battleGroundData = {
     -- },
 }
 
-local function cmp(a, b)
-    return a.rank < b.rank
-end
 
 -- 生成一个排行榜列表
 local function genRankList(rankList)
@@ -125,7 +122,10 @@ local function loadData()
 
     if battleGroundData.allAreaRankList and next(battleGroundData.allAreaRankList) then
         for areaIdx, rankList in pairs(battleGroundData.allAreaRankList) do
-            table.sort(rankList, cmp)
+            battleGroundData.allAreaRankList[areaIdx] = {}
+            for _, player in pairs(rankList) do
+                battleGroundData.allAreaRankList[areaIdx][player.rank] = player
+            end
         end
     end
 
@@ -135,7 +135,9 @@ local function loadData()
         insertData(battleGroundData)
     end
 
-    table.sort(battleGroundData.generaRankList, cmp)
+    table.sort(battleGroundData.generaRankList, function (a, b)
+        return a.rank < b.rank
+    end)
 end
 
 
@@ -206,7 +208,7 @@ local function getPlayerRankByUuid(rankList, targetPlayerUuid)
         return targetRank
     end
 
-    for rank, rankInfo in ipairs(rankList) do
+    for rank, rankInfo in pairs(rankList) do
         if rankInfo.playerUuid == targetPlayerUuid then
             targetRank = rank
             break
@@ -225,9 +227,13 @@ local function findVal(list, val)
     end
 end
 
+local function writeLog(logStr)
+    Log.write(Log.LOGID_OSS_COMMON_ACT, logStr)
+end
+
 -- 发奖
 local function issueReward(fd, rankArr)
-    local msgData = InnerMsg.wl.WL_BATTLEGROUND_NOTIFY_PLAYER
+    local msgData = InnerMsg.wl.WL_BATTLEGROUND_NOTIFY_PRIZEAWARD
     msgData.playerArr = rankArr
     InnerMsg.sendMsg(fd, msgData)
 end
@@ -322,6 +328,7 @@ function BG_N2C_RankList_Req(msg)
             name = rankInfo.name,
             heroHeadId = rankInfo.headId,
             heroHeadFrameId = rankInfo.headFrameId,
+            playerUuid = rankInfo.playerUuid,
         }
     end
 
@@ -340,7 +347,7 @@ function BG_N2C_Challenge_Req(msg)
     local targetRank = msg.rank
     local myWarZoneRankList = getMyWarZoneRankList(msg.sourceServerId)
     local generaRankList = getGeneraRankList()
-    local targetRanker = myWarZoneRankList and myWarZoneRankList[rank] or generaRankList[rank]
+    local targetRanker = myWarZoneRankList and myWarZoneRankList[targetRank] or generaRankList[targetRank]
     if not targetRanker then
         msgData.errCode = -1
         return InnerMsg.sendMsg(fd, msgData)
@@ -381,42 +388,70 @@ function BG_N2C_Challenge_End(msg)
     end
 
 
-    -- 检查挑战方当前排名与挑战时排名是否一致
+    -- 如果挑战方在榜上, 则检查当前排名与挑战时排名是否一致, 如果不一致则获取最新排名
     local atkRanker = myWarZoneRankList[atkRank]
     if atkRanker and atkRanker.playerUuid ~= atkPlayerUuid then
         atkRank = getPlayerRankByUuid(myWarZoneRankList, msg.playerUuid)
     end
 
+
+    local msgData = InnerMsg.wl.WL_BATTLEGROUND_NOTIFY_PLAYER
+    local fd = MiddleManager.getFDBySvrIndex(msg.sourceServerId)
+    msgData.playerUuid = msg.playerUuid
+    msgData.newRank = atkRank
+    msgData.atkeServerId = msg.sourceServerId
+    msgData.atkName = atkRanker and atkRanker.name or msg.playerShowData.name or ""
+    msgData.updateType = 0
+
+    -- 如果挑战者排名高于被挑战者排名, 则只通知挑战者刷新匹配列表
+    if atkRank < defRank then
+        return InnerMsg.sendMsg(fd, msgData)
+    end
+
     local defTemp = myWarZoneRankList[defRank]
 
-    -- 第一次挑战
+
+    -- 如果挑战方在榜上, 则先把挑战方从排行榜上移除
+    if atkRank <= ServerCommerceActDefine.COMMERCEACT_NPC_CNT then
+        myWarZoneRankList[atkRank] = nil
+    end
+
+    -- 第一次挑战, 则使用生成的玩家数据
     if not atkRanker then
         atkRanker = msg.playerShowData
     end
-
-    -- 挑战方排名提升为被挑战方原排名
+    -- 把挑战方加入到排行榜上, 排名为防守方原排名
     atkRanker.rank = defRank
     myWarZoneRankList[defRank] = atkRanker
 
-    -- 如果双方都在本战区排行榜上, 被挑战方排名下降为原挑战方排名
+    -- 如果双方都在榜上, 被挑战方排名下降为挑战方排名
     if defTemp and atkRank <= ServerCommerceActDefine.COMMERCEACT_NPC_CNT then
         defTemp.rank = atkRank
         myWarZoneRankList[atkRank] = defTemp
     end
 
+    -- 保存排行榜数据
+    local warZoneServerIdx = getWarZoneServerIdx(msg.sourceServerId)
+    updateValue("allAreaRankList".."."..warZoneServerIdx, battleGroundData.allAreaRankList[warZoneServerIdx])
+
+
+    -- 通知挑战者排名提高
+    fd = MiddleManager.getFDBySvrIndex(atkRanker.serverId)
+    msgData.playerUuid = atkRanker.playerUuid
+    msgData.newRank = atkRanker.rank
+    msgData.atkeServerId = msg.sourceServerId
+    msgData.atkName = atkRanker.name
+    msgData.updateType = 1
+    InnerMsg.sendMsg(fd, msgData)
+
     -- 如果被挑战方是真实玩家, 则通知
-    if defTemp and defTemp.serverId ~= 0 then
-        local msgData = InnerMsg.wl.WL_BATTLEGROUND_NOTIFY_PLAYER
+    if defTemp and defTemp.serverId and defTemp.serverId ~= 0 then
         msgData.playerUuid = defTemp.playerUuid
         msgData.newRank = defTemp.rank
-        msgData.atkeServerId = msg.sourceServerId
-        msgData.atkName = atkRanker.name
-        local fd = MiddleManager.getFDBySvrIndex(defTemp.serverId)
+        msgData.updateType = 2
+        fd = MiddleManager.getFDBySvrIndex(defTemp.serverId)
         InnerMsg.sendMsg(fd, msgData)
     end
-
-    local warZoneServerIdx = getWarZoneServerIdx(msg.sourceServerId)
-    updateValue("allAreaRankList".."."..warZoneServerIdx, battleGroundData.allAreaRankList[warZoneServerIdx])
 end
 
 -- 更换战斗阵容
@@ -438,26 +473,42 @@ function BG_N2C_Act_End(msg)
         return
     end
 
+    local logData = {
+        joinList = battleGroundData.joinList,
+        allAreaRankList = battleGroundData.allAreaRankList,
+    }
+
+    local logTb = Util.serialize(logData)
+    local logStr = table.concat(logTb)
+    writeLog(logStr)
+
+    -- 更新标识
+    notifyActEnd = true
+
     local fd_2_Rank = {}
     local joinList = battleGroundData.joinList
     local allAreaRankList = battleGroundData.allAreaRankList
 
     -- 参与玩家(包括在榜玩家)
-    for _, playerInfo in ipairs(joinList) do
+    for _, playerInfo in ipairs(joinList or {}) do
         local serverId = playerInfo[1]
         local fd = MiddleManager.getFDBySvrIndex(serverId)
-        fd_2_Rank[fd] = fd_2_Rank[fd] or {}
-        fd_2_Rank[fd][#fd_2_Rank[fd]+1] = {ServerCommerceActDefine.COMMERCEACT_NPC_CNT, playerInfo[2]}
+        if fd then
+            fd_2_Rank[fd] = fd_2_Rank[fd] or {}
+            fd_2_Rank[fd][#fd_2_Rank[fd]+1] = {ServerCommerceActDefine.COMMERCEACT_NPC_CNT, playerInfo[2]}
+        end
     end
 
     -- 在榜玩家
     for _, rankList in pairs(allAreaRankList or {}) do
-        for _, player in ipairs(rankList) do
+        for _, player in pairs(rankList) do
             local fd = MiddleManager.getFDBySvrIndex(player.serverId)
-            fd_2_Rank[fd] = fd_2_Rank[fd] or {}
-            local idx = findVal(fd_2_Rank[fd], player.playerUuid)
-            if idx then
-                fd_2_Rank[fd][idx][1] = player.rank
+            if fd then
+                fd_2_Rank[fd] = fd_2_Rank[fd] or {}
+                local idx = findVal(fd_2_Rank[fd], player.playerUuid)
+                if idx then
+                    fd_2_Rank[fd][idx][1] = player.rank
+                end
             end
         end
     end
@@ -470,10 +521,9 @@ function BG_N2C_Act_End(msg)
         end
 
         -- 重置排行榜数据
-        battleGroundData = {}
-        saveAllData()
-
-        -- 更新标识
-        notifyActEnd = true
+        battleGroundData.joinList = nil
+        updateValue("joinList", battleGroundData.joinList)
+        battleGroundData.allAreaRankList = nil
+        updateValue("allAreaRankList", battleGroundData.allAreaRankList)
     end
 end

+ 321 - 116
script/module/serverCommerce/ServerCommerceActBattleGroundNS.lua

@@ -40,6 +40,7 @@ local MiddleCommonLogic = require("middle.MiddleCommonLogic")
 local RoleDBLogic = require("role.RoleDBLogic")
 local Log = require("common.Log")
 local lua_mongo = _G.lua_mongo
+local RoleDefine = require("role.RoleDefine")
 
 
 local rankListCache = {}
@@ -47,6 +48,15 @@ local lastGetRankListTime = 0
 local LOGTYPE = "ServerCommerceActBattleGround"
 
 
+
+local function initData(human)
+    human.db.ServerCommerce.battleGround =
+    {
+        freeChallengeCnt = ServerCommerceActDefine.COMMERCEACT_DAILY_FREECHALLENGETIMES,
+        resetTime = os.time(),
+    }
+end
+
 local function writeLog(logStr)
     Log.write(Log.LOGID_OSS_COMMON_ACT, logStr)
 end
@@ -66,9 +76,10 @@ local function rankReduceMail(mailId, receiverUuid, arg)
 end
 
 -- 排行奖励邮件
-local function sendAwardMail(mailId, receiverUuid, itemArray)
+local function sendAwardMail(mailId, receiverUuid, rank, itemArray)
     local mailCfg = MailExcel.mail[mailId]
     local content = mailCfg.content
+    content = Util.format(content, rank or ServerCommerceActDefine.COMMERCEACT_NPC_CNT)
     MailManager.add(MailManager.SYSTEM, receiverUuid, mailCfg.title, content, itemArray, mailCfg.senderName or "GM")
 end
 
@@ -92,10 +103,9 @@ local function createRewardQueue()
         for i=1, maxNum do
             local resTag = ServerCommerceActDefine.BG_MAIL_SUCC_TAG
             local playerInfo = table.remove(self.playerArray)
-            local rank = playerInfo[1]
             local playerUuid = playerInfo[2]
 
-            local ok, err = pcall(sendAwardMail, mailId, playerUuid, playerInfo[3])
+            local ok, err = pcall(sendAwardMail, mailId, playerUuid, playerInfo[1], playerInfo[3])
 
             if not ok then
                 if not self.repeatTb[playerUuid] or self.repeatTb[playerUuid] < self.repeatMaxTimes then
@@ -211,6 +221,7 @@ local function populateHeroMsg(net, heroInfo, heroConfig, heroLv, heroStar, hero
     net.heroId = heroInfo[1] or 0
     net.heroUuid = heroInfo[2] or ""
     net.heroBagIdx = heroBagIdx or 0
+    net.heroJob = heroConfig.job or 1
 end
 
 -- 获取可以解锁的英雄信息
@@ -232,7 +243,7 @@ local function unlockHero(human, unlockHeroInfo, isInit)
 
     if #unlockHeroInfo == 0 then
         for heroId, heroCfg in pairs(HeroConfig) do
-            if heroCfg.grade >= HeroDefine.HERO_SSR_GRADE and not findVal(heroBagData, heroId) then
+            if heroCfg.grade >= HeroDefine.HERO_SSR_GRADE and heroId > 100000 and not findVal(heroBagData, heroId) then
                 heroBagData[#heroBagData+1] = genHeroGrid(heroId)
             end
         end
@@ -241,18 +252,24 @@ local function unlockHero(human, unlockHeroInfo, isInit)
         return
     end
 
-    local heroList = {}
+    -- local heroList = {}
+    local heroArr = {}
     for heroId, heroCfg in pairs(HeroConfig) do
-        if heroCfg.grade >= HeroDefine.HERO_SSR_GRADE and not findVal(heroBagData, heroId) then
-            heroList[heroId] = heroCfg
+        if heroCfg.grade >= HeroDefine.HERO_SSR_GRADE and heroId > 100000 and not findVal(heroBagData, heroId) then
+            -- heroList[heroId] = heroCfg
+            heroArr[#heroArr+1] = {heroId, heroCfg}
         end
     end
 
+    table.shuffle(heroArr)
+
     for _, heroCond in ipairs(unlockHeroInfo) do
         local campCond = heroCond[1] or 0
         local numCond = heroCond[2] or 0
         for i=1, numCond do
-            for heroId, heroCfg in pairs(heroList) do
+            for _, heroData in ipairs(heroArr) do
+                local heroId =  heroData[1]
+                local heroCfg = heroData[2]
                 if heroCfg.camp == campCond and not findVal(heroBagData, heroId) then
                     heroBagData[#heroBagData+1] = genHeroGrid(heroId)
                     break
@@ -270,12 +287,14 @@ end
 -- 获取上阵英雄
 local function getLineupHeroArr(human)
     local heroArr
-    local battleGroundData = human.db.ServerCommerce.battleGround
-    local lineUpData = battleGroundData.lineUpData
-    for _, heroId in ipairs(lineUpData.heroList) do
-        if heroId and heroId ~= 0 then
-            heroArr = heroArr or {}
-            heroArr[#heroArr+1] = heroId
+    local heroList = CombatPosLogic.getCombatHeros(human, CombatDefine.COMBAT_TYPE37)
+    for _, heroUuid in ipairs(heroList) do
+        if heroUuid and heroUuid ~= "" and heroUuid ~= "0" then
+            local heroGrid = getHeroGridByUuid(human, heroUuid)
+            if heroGrid then
+                heroArr = heroArr or {}
+                heroArr[#heroArr+1] = heroGrid.id
+            end
         end
     end
     return heroArr
@@ -295,6 +314,105 @@ local function populatePlayerShowData(human, showData, rank)
     showData.heroArr = getLineupHeroArr(human)
 end
 
+-- 排名没变化, 只刷新匹配列表
+local function rankNoChange(msg)
+    local human = ObjHuman.onlineUuid[msg.playerUuid]
+    if not human then
+        local db = RoleDBLogic.getDb(msg.playerUuid)
+        if not db then
+            return
+        end
+
+        human = {}
+        human.db = db
+    end
+
+    local newMatchList = matchListAlgorithm(msg.newRank)
+    local battleGroundData = human.db.ServerCommerce.battleGround
+    battleGroundData.matchList = newMatchList
+
+    -- 玩家在线
+    if human.fd then
+        -- BattleGround_MatchPage_Query(human)
+        return
+    end
+
+    -- 玩家不在线,则保存数据
+    ObjHuman.save(human)
+end
+
+-- 排名提高
+local function rankImprove(msg)
+    local human = ObjHuman.onlineUuid[msg.playerUuid]
+    if not human then
+        local db = RoleDBLogic.getDb(msg.playerUuid)
+        if not db then
+            return
+        end
+
+        human = {}
+        human.db = db
+    end
+
+    human.battleGroundRank = msg.newRank
+    -- local newMatchList = matchListAlgorithm(human.battleGroundRank)
+
+    -- 更新对手列表
+    local battleGroundData = human.db.ServerCommerce.battleGround
+    -- battleGroundData.matchList = newMatchList
+
+    rankNoChange(msg)
+
+    -- 检查是否能解锁新英雄
+    local idx, unlockHeroInfo = getUnlockHeroInfoByRank(human.battleGroundRank)
+    if idx ~= battleGroundData.unLockIdx then
+        unlockHero(human, unlockHeroInfo)
+        battleGroundData.unLockIdx = idx
+        battleGroundData.isHaveNewHero = true
+    end
+
+    -- 玩家在线
+    if human.fd then
+        -- BattleGround_MatchPage_Query(human)
+        return
+    end
+
+    -- 玩家不在线,则保存数据
+    ObjHuman.save(human)
+end
+
+-- 排名降低
+local function rankReduce(msg)
+    local human = ObjHuman.onlineUuid[msg.playerUuid]
+    if not human then
+        local db = RoleDBLogic.getDb(msg.playerUuid)
+        if not db then
+            return
+        end
+
+        human = {}
+        human.db = db
+    end
+
+    -- 更新对手列表
+    local battleGroundData = human.db.ServerCommerce.battleGround
+    battleGroundData.matchList = matchListAlgorithm(msg.newRank)
+
+    -- 邮件通知
+    local varCfg = battleGroundConfig.var[1]
+    local arg = {msg.atkeServerId - ServerCommerceActDefine.BG_SERVERID_START, msg.atkName, msg.newRank}
+    rankReduceMail(varCfg.defeatMailId, human.db._id, arg)
+
+    -- 玩家在线
+    if human.fd then
+        human.battleGroundRank = msg.newRank
+        return
+    end
+
+    -- 玩家不在线,则保存数据
+    ObjHuman.save(human)
+end
+
 -- 战斗结束处理
 local function fightEndHanle(human, result)
     local msgData = InnerMsg.lw.LW_BATTLEGROUND_CHALLENGE_END
@@ -302,29 +420,22 @@ local function fightEndHanle(human, result)
     msgData.playerUuid = human.db._id
     msgData.atkRank = human.battleGroundRank
     msgData.defRank = human.battleGroundCache.defRank
-    msgData.challengeRes = CombatDefine.RESULT_WIN
+    msgData.challengeRes = result
     msgData.playerShowData = {}
 
     local varCfg = battleGroundConfig.var[1]
     local challengeAward = varCfg.defeatAward
 
     if result == CombatDefine.RESULT_WIN then
-        human.battleGroundRank = human.battleGroundCache.defRank
-        local newMatchList = matchListAlgorithm(human.battleGroundRank)
-
         -- 更新对手列表
-        local battleGroundData = human.db.ServerCommerce.battleGround
-        battleGroundData.matchList = newMatchList
-
-        -- 检查是否能解锁新英雄
-        local idx, unlockHeroInfo = getUnlockHeroInfoByRank(human.battleGroundRank)
-        if idx ~= battleGroundData.unLockIdx then
-            unlockHero(human, unlockHeroInfo)
-            battleGroundData.unLockIdx = idx
-        end
+        -- local newMatchList = matchListAlgorithm(human.battleGroundRank)
+        -- local battleGroundData = human.db.ServerCommerce.battleGround
+        -- battleGroundData.matchList = newMatchList
 
         -- 展示数据
-        populatePlayerShowData(human, msgData.playerShowData, human.battleGroundCache.defRank)
+        --if human.battleGroundRank <= ServerCommerceActDefine.COMMERCEACT_NPC_CNT then
+            populatePlayerShowData(human, msgData.playerShowData, human.battleGroundCache.defRank)
+        --end
 
         -- 挑战奖励
         challengeAward = varCfg.winAward
@@ -345,7 +456,7 @@ end
 local function getRankAward(rank)
     local itemArr
     for i, cfg in ipairs(battleGroundConfig.rankAward) do
-        if rank >= cfg.rankArea[1] and rank <= cfg.rankArea[1] then
+        if rank >= cfg.rankArea[1] and rank <= cfg.rankArea[2] then
             itemArr = {}
             for k, itemInfo in ipairs(cfg.rankAward) do
                 itemArr[k] = {itemInfo[1], itemInfo[2]}
@@ -364,6 +475,10 @@ function updateDaily(human)
         return
     end
 
+    if human.db.ServerCommerce and not human.db.ServerCommerce.battleGround then
+        initData(human)
+    end
+
     local battleGroundData = human.db.ServerCommerce and human.db.ServerCommerce.battleGround
     if not battleGroundData then
         return
@@ -382,23 +497,31 @@ function getHeroGridByUuid(human, heroUuid)
         return
     end
 
+    if not human.db.ServerCommerce then
+        return
+    end
+
     local battleGroundData = human.db.ServerCommerce.battleGround
-    if not battleGroundData.heroBag then
+    if not battleGroundData or not battleGroundData.heroBag then
         return
     end
 
+    local heroGrid
     local heroBagData = battleGroundData.heroBag
-    local bagIdx = findVal(heroBagData, heroUuid)
-    if bagIdx then
-        local heroInfo = heroBagData[bagIdx]
-        local heroGrid = {
-            id = heroInfo[1],
-            bagIndex = bagIdx,
-            uuid = heroInfo[2]
-        }
 
-        return heroGrid
+    for bagIdx, heroInfo in ipairs(heroBagData) do
+        if heroInfo[2] == heroUuid then
+            heroGrid = {
+                id = heroInfo[1],
+                bagIndex = bagIdx,
+                uuid = heroInfo[2],
+                zhandouli = 0
+            }
+            break
+        end
     end
+
+    return heroGrid
 end
 
 -- 根据英雄id获取英雄信息
@@ -407,8 +530,12 @@ function getHeroGridByheroId(human, heroId)
         return
     end
 
+    if not human.db.ServerCommerce then
+        return
+    end
+
     local battleGroundData = human.db.ServerCommerce.battleGround
-    if not battleGroundData.heroBag then
+    if not battleGroundData or not battleGroundData.heroBag then
         return
     end
 
@@ -433,6 +560,29 @@ function isGetHero(human, heroId)
     return getHeroGridByheroId(human, heroId)
 end
 
+-- 阵容有更新
+function onUpdatePos(human)
+    BattleGround_Lineup_Update(human)
+end
+
+-- 是否有红点
+function isRed(human)
+    -- 兼容老数据
+    if human.db.ServerCommerce and not human.db.ServerCommerce.battleGround then
+        initData(human)
+    end
+
+    if not human.db.ServerCommerce or not human.db.ServerCommerce.battleGround then
+        return false
+    end
+
+    local battleGroundData = human.db.ServerCommerce.battleGround
+    if not battleGroundData.freeChallengeCnt or battleGroundData.freeChallengeCnt <= 0 then
+        return false
+    end
+
+    return true
+end
 
 
 -- 推送主界面信息
@@ -452,8 +602,8 @@ local function sendRankListData(human)
     local msgRet = Msg.gc.GC_SERVEERCOMMERCE_ACT_BATTLEGROUND_RANK_QUERY
     msgRet.rankList[0] = 0
     msgRet.isEnd = 0
-    msgRet.myRankInfo.rank = human.battleGroundRank
-    msgRet.myRankInfo.serverId = Config.SVR_INDEX
+    msgRet.myRankInfo.rank = ServerCommerceActDefine.COMMERCEACT_NPC_CNT
+    msgRet.myRankInfo.serverId = Config.SVR_INDEX - ServerCommerceActDefine.BG_SERVERID_START
     msgRet.myRankInfo.name = human.db.name
     msgRet.myRankInfo.heroHeadId = RoleHeadLogic.getRoleAppearance(human, RoleHeadLogic.HEAD_TYPE_1) or 0
     msgRet.myRankInfo.heroHeadFrameId = RoleHeadLogic.getRoleAppearance(human, RoleHeadLogic.HEAD_TYPE_2) or 0
@@ -466,11 +616,15 @@ local function sendRankListData(human)
         len = len + 1
         msgRet.rankList[0] = len
         msgRet.rankList[len].rank = rank
-        msgRet.rankList[len].serverId = rankInfo.serverId or 0
+        msgRet.rankList[len].serverId = rankInfo.serverId and (rankInfo.serverId - ServerCommerceActDefine.BG_SERVERID_START)  or 1
         msgRet.rankList[len].name = rankInfo.name
         msgRet.rankList[len].heroHeadId = rankInfo.heroHeadId
         msgRet.rankList[len].heroHeadFrameId = rankInfo.heroHeadFrameId
 
+        if rankInfo.playerUuid == human.db._id then
+            msgRet.myRankInfo.rank = rank
+        end
+
         if len >= msgMaxLen then
             rankNum = rankNum - len
 
@@ -496,6 +650,10 @@ function BattleGround_MainPage_Query(human)
         return Broadcast.sendErr(human, Lang.ACT_NOT_START)
     end
 
+    if human.db.ServerCommerce and not human.db.ServerCommerce.battleGround then
+        initData(human)
+    end
+
     if not human.battleGroundRank then
         local msgData = InnerMsg.lw.LW_BATTLEGROUND_PLAYER_RANK_QUERY
         msgData.sourceServerId = Config.SVR_INDEX
@@ -529,6 +687,22 @@ function BattleGround_MatchPage_Query(human)
     InnerMsg.sendMsg(0, msgData)
 end
 
+-- 刷新匹配对手
+function BattleGround_Update_MatchList(human)
+    if not isRunning() then
+        return Broadcast.sendErr(human, Lang.ACT_NOT_START)
+    end
+
+    if not human.battleGroundRank then
+        return
+    end
+
+    local battleGroundData = human.db.ServerCommerce.battleGround
+    battleGroundData.matchList = matchListAlgorithm(human.battleGroundRank)
+
+    BattleGround_MatchPage_Query(human)
+end
+
 -- 匹配对手查询
 function BattleGround_Player_Query(human, targetRank)
     if not isRunning() then
@@ -557,6 +731,32 @@ function BattleGround_Try_Challenge(human, targetRank)
     InnerMsg.sendMsg(0, msgData)
 end
 
+-- 一键扫荡
+function BattleGround_OneClickSweep(human)
+    if not isRunning() then
+        return Broadcast.sendErr(human, Lang.ACT_NOT_START)
+    end
+
+    local battleGroundData = human.db.ServerCommerce.battleGround
+    if battleGroundData.freeChallengeCnt <= 0 then
+        return Broadcast.sendErr(human, Lang.BG_FREECNT_NOT_ENOUGH)
+    end
+
+    local winAwardCfg = battleGroundConfig.var[1].winAward
+    local winAwardArr = {}
+
+    for i, itemInfo in ipairs(winAwardCfg) do
+        winAwardArr[i] = { itemInfo[1], itemInfo[2] * battleGroundData.freeChallengeCnt }
+    end
+
+    battleGroundData.freeChallengeCnt = 0
+    BattleGround_MatchPage_Query(human)
+
+    BagLogic.addItemList(human, winAwardArr, LOGTYPE)
+
+    ServerCommerceManager.CommerceAct_SendActInfo(human)
+end
+
 -- 英雄背包查询
 function BattleGround_HeroBag_Query(human)
     if not isRunning() then
@@ -572,6 +772,8 @@ function BattleGround_HeroBag_Query(human)
         end
     end
 
+    -- battleGroundData.isHaveNewHero = false
+
     local msgRet = Msg.gc.GC_SERVEERCOMMERCE_ACT_BATTLEGROUND_HEROBAG_QUERY
     msgRet.heroArr[0] = 0
     msgRet.isEnd = 0
@@ -601,8 +803,20 @@ function BattleGround_HeroBag_Query(human)
         msgRet.isEnd = 1
         Msg.send(msgRet, human.fd)
     end
+
 end
 
+-- 已经知道获得新英雄了
+function BattleGround_AlreadyKonw_GetNewHero(human)
+    if not isRunning() then
+        return Broadcast.sendErr(human, Lang.ACT_NOT_START)
+    end
+
+    local battleGroundData = human.db.ServerCommerce.battleGround
+    battleGroundData.isHaveNewHero = false
+end
+
+
 -- 排行榜查询
 function BattleGround_RankList_Query(human)
     if not isRunning() then
@@ -610,7 +824,7 @@ function BattleGround_RankList_Query(human)
     end
 
     local now = os.time()
-    if #rankListCache == 0 or now - lastGetRankListTime >= ServerCommerceActDefine.COMMERCEACT_RANKUPDATE then
+    if #rankListCache == 0 or now - lastGetRankListTime >= ServerCommerceActDefine.BG_COMMERCEACT_RANKUPDATE then
         local msgData = InnerMsg.lw.LW_BATTLEGROUND_RANKLIST_QUERY
         msgData.sourceServerId = Config.SVR_INDEX
         msgData.playerUuid = human.db._id
@@ -646,46 +860,46 @@ end
 -- 更新阵容数据
 function BattleGround_Lineup_Update(human, msg)
     if not isRunning() then
-        return Broadcast.sendErr(human, Lang.ACT_NOT_START)
+        return
     end
 
-    local battleGroundData = human.db.ServerCommerce.battleGround
-
-    local formation = msg.formation
-    local posList = CombatPosLogic.getPosList(formation)
-    local heroList = Util.split(msg.heroList, ",", true)
-
-    local reapetTb = {}
-    for i = 1, CombatDefine.COMBAT_HERO_CNT do
-        local heroId = heroList[i]
-        if heroId > 0 then
-            -- 英雄Id检测
-            if HeroConfig[heroId] then
-                return Broadcast.sendErr(human, Lang.FUWEN_HERO_GRID_ERR)
-            end
-
-            -- 英雄背包检测
-            if not battleGroundData.heroBag or not table.find(battleGroundData.heroBag, heroId) then
-                return Broadcast.sendErr(human, Lang.FUWEN_HERO_GRID_ERR)
-            end
-
-            -- 相同英雄检测
-            if reapetTb[heroId] then
-                return Broadcast.sendErr(human, Lang.HERO_SAME)
-            end
-
-            -- 位置检测
-            if posList[i] == nil and i ~= CombatDefine.COMBAT_HERO_CNT then
-                return Broadcast.sendErr(human, Lang.POS_ERROR)
-            end
+    -- local battleGroundData = human.db.ServerCommerce.battleGround
 
-            reapetTb[heroId] = true
-        end
-    end
+    -- local formation = msg.formation
+    -- local posList = CombatPosLogic.getPosList(formation)
+    -- local heroList = Util.split(msg.heroList, ",", true)
+
+    -- local reapetTb = {}
+    -- for i = 1, CombatDefine.COMBAT_HERO_CNT do
+    --     local heroId = heroList[i]
+    --     if heroId > 0 then
+    --         -- 英雄Id检测
+    --         if HeroConfig[heroId] then
+    --             return Broadcast.sendErr(human, Lang.FUWEN_HERO_GRID_ERR)
+    --         end
+
+    --         -- 英雄背包检测
+    --         if not battleGroundData.heroBag or not table.find(battleGroundData.heroBag, heroId) then
+    --             return Broadcast.sendErr(human, Lang.FUWEN_HERO_GRID_ERR)
+    --         end
+
+    --         -- 相同英雄检测
+    --         if reapetTb[heroId] then
+    --             return Broadcast.sendErr(human, Lang.HERO_SAME)
+    --         end
+
+    --         -- 位置检测
+    --         if posList[i] == nil and i ~= CombatDefine.COMBAT_HERO_CNT then
+    --             return Broadcast.sendErr(human, Lang.POS_ERROR)
+    --         end
+
+    --         reapetTb[heroId] = true
+    --     end
+    -- end
 
-    battleGroundData.lineUp = battleGroundData.lineUp or {}
-    battleGroundData.lineUp.formation = formation
-    battleGroundData.lineUp.heroList = heroList
+    -- battleGroundData.lineUp = battleGroundData.lineUp or {}
+    -- battleGroundData.lineUp.formation = formation
+    -- battleGroundData.lineUp.heroList = heroList
 
     -- 通知跨服更新
     if human.battleGroundRank and human.battleGroundRank <= ServerCommerceActDefine.COMMERCEACT_NPC_CNT then
@@ -758,7 +972,7 @@ function BG_C2N_PlayerData_Res(msg)
 
     local playerInfo = msg.playerInfo
     local msgRet = Msg.gc.GC_SERVEERCOMMERCE_ACT_BATTLEGROUND_PLAYER_QUERY
-    msgRet.serverId = playerInfo.serverId or 0
+    msgRet.serverId = playerInfo.serverId and (playerInfo.serverId - ServerCommerceActDefine.BG_SERVERID_START) or 1
     msgRet.name = playerInfo.name
     msgRet.heroHeadId = playerInfo.heroHeadId
     msgRet.heroHeadFrameId = playerInfo.heroHeadFrameId
@@ -830,36 +1044,15 @@ function BG_C2N_Challenge_Res(msg)
     end
 end
 
--- 跨服通知玩家排名下降
-function BG_C2N_RankReduce(msg)
-    local human = ObjHuman.onlineUuid[msg.playerUuid]
-    if not human then
-        local db = RoleDBLogic.getDb(msg.playerUuid)
-        if not db then
-            return
-        end
-
-        human = {}
-        human.db = db
-    end
-
-    -- 更新对手列表
-    local battleGroundData = human.db.ServerCommerce.battleGround
-    battleGroundData.matchList = matchListAlgorithm(msg.newRank)
-
-    -- 邮件通知
-    local varCfg = battleGroundConfig.var[1]
-    local arg = {msg.atkeServerId - 810537, msg.atkName, msg.newRank}
-    rankReduceMail(varCfg.defeatMailId, human.db.id, arg)
-
-    -- 玩家在线
-    if human.fd then
-        human.battleGroundRank = msg.newRank
-        return
+-- 跨服通知玩家排名更新
+function BG_C2N_RankUpdate(msg)
+    if msg.updateType == 1 then -- 排名提高
+        rankImprove(msg)
+    elseif msg.updateType == 0 then -- 排名没变化
+        rankNoChange(msg)
+    else
+        rankReduce(msg)
     end
-
-    -- 玩家不在线,则保存数据
-    ObjHuman.save(human)
 end
 
 -- 跨服通知发奖
@@ -875,7 +1068,7 @@ function BG_C2N_PrizeAward(msg)
         local itemArr = getRankAward(playerInfo[1])
         if itemArr then
             playerInfo[3] = itemArr
-            issueRewardQueue:add(itemArr)
+            issueRewardQueue:add(playerInfo)
         end
     end
 
@@ -902,7 +1095,7 @@ function fight(human, args, combatType)
     -- end
 
     local heroList = CombatPosLogic.getCombatHeros(human, combatType)
-    if not not next(heroList) then
+    if not next(heroList) then
         return Broadcast.sendErr(human, Lang.SEAL_GROUND_COMBAT_HERO_ERR)
     end
 
@@ -916,6 +1109,9 @@ function fight(human, args, combatType)
         BagLogic.delItem(human, itemId, itemNum, LOGTYPE)
     else
         battleGroundData.freeChallengeCnt = battleGroundData.freeChallengeCnt - 1
+        if battleGroundData.freeChallengeCnt <= 0 then
+            ServerCommerceManager.CommerceAct_SendActInfo(human)
+        end
     end
 
     BattleGround_Try_Challenge(human, targetRank)
@@ -926,7 +1122,6 @@ function getCombatMonsterOutID(human, side, args)
     return args[1]
 end
 
-
 function getCombatObjList(human, side, args, combatType)
     if side == CombatDefine.ATTACK_SIDE and not human then return end
 
@@ -951,11 +1146,21 @@ function getCombatObjList(human, side, args, combatType)
     -- end
 
     local heroList, _, formation = CombatPosLogic.getCombatHeros(human, combatType)
-    if not not next(heroList) then
+    if not next(heroList) then
         return Broadcast.sendErr(human, Lang.SEAL_GROUND_COMBAT_HERO_ERR)
     end
 
-    local fakeHuman = {}
+    local heroLv = ServerCommerceActDefine.COMMERCEACT_HERO_LV
+    local heroStar = ServerCommerceActDefine.COMMERCEACT_HERO_STAR
+
+    local attrsChange = {
+        [RoleDefine.ATK] = 2,
+        [RoleDefine.HP] = 2,
+        [RoleDefine.BAOJI] = 1.7,
+        [RoleDefine.HURT_RATE] = 2,
+    }
+
+    local fakeHuman = { db = {} }
     local objList = {}
     for i = 1, CombatDefine.COMBAT_HERO_CNT do
         local heroUuid = heroList[i]
@@ -964,7 +1169,7 @@ function getCombatObjList(human, side, args, combatType)
             if not heroInfo then
                 return Broadcast.sendErr(human, Lang.SEAL_GROUND_COMBAT_HERO_ERR)
             end
-            objList[i] = CombatLogic.createHeroObj(fakeHuman, heroInfo.id, ServerCommerceActDefine.COMMERCEACT_HERO_LV, ServerCommerceActDefine.COMMERCEACT_HERO_STAR, i)
+            objList[i] = CombatLogic.createHeroObj(fakeHuman, heroInfo.id, heroLv, heroStar, i, nil,  attrsChange)
         end
     end
 

+ 4 - 2
script/module/serverCommerce/ServerCommerceActDefine.lua

@@ -9,7 +9,7 @@ COMMERCEACT_BEGINTIME = 0               -- 开启时间
 COMMERCEACT_ENDTIME = 23                -- 结束时间
 COMMERCEACT_LASTDAY = 7                 -- 持续时间
 COMMERCEACT_BEGINDELATTIME = 10 * 60    -- 延迟10分钟开始
-COMMERCEACT_INITSERVERTIME = 4 * 60     -- 普通服 起服3分钟请求活动是否开始
+COMMERCEACT_INITSERVERTIME =4 * 60     -- 普通服 起服3分钟请求活动是否开始
 COMMERCEACT_INITOPENDAY = 3 * 60        -- 中心服2分钟后请求普通服开服时间
 COMMERCEACT_RANKUPDATE = 150            -- 普通服 5 分钟请求排行榜数据
 COMMERCEACT_ENDBATCH = 3                -- 结束批次
@@ -54,4 +54,6 @@ COMMERCEACT_NPC_CNT = 999               -- 巅峰战场机器人数量
 BG_MAIL_SUCC_TAG = "succ"
 BG_MAIL_FAIL_TAG = "fail"
 
-BG_SERVERID_START = 810537  -- 区服Id偏移值
+BG_SERVERID_START = 810537  -- 区服Id偏移值
+
+BG_COMMERCEACT_RANKUPDATE = 60 -- 巅峰战场排行榜刷新间隔

+ 5 - 0
script/module/serverCommerce/ServerCommerceManager.lua

@@ -23,6 +23,8 @@ local ServerCommerceActCharge = require("serverCommerce.ServerCommerceActCharge"
 local ServerCommerceActRank = require("serverCommerce.ServerCommerceActRank")
 local ServerCommerceTask = require("serverCommerce.ServerCommerceActTask")
 local Config = require("Config")
+local CombatPosLogic = require("combat.CombatPosLogic")
+local CombatDefine = require("combat.CombatDefine")
 
 -- 活动信息
 tCommerceActInfo = nil
@@ -599,6 +601,9 @@ function onLogin(human, funcID)
                 CommerveManager_WriteLog("[CommerceManger_onLogin] 玩家登录 记录的批次不一致 nOldBatchID = "..nOldBatchID.." nNowBatchID = "..nNowBatchID, human)
                 print("[CommerceManger_onLogin] 玩家登录批次不一致, 重置玩家数据 name = "..human.db.name)
                 CommerceAct_CreateHumanDB(human)
+
+                -- 重置巅峰战场的阵容数据
+                CombatPosLogic.ResetCombatData(human, CombatDefine.COMBAT_TYPE37)
             end
         end
         

+ 16 - 2
script/module/talisman/TalismanLogic.lua

@@ -22,12 +22,15 @@ local RoleSystemLogic = require("roleSystem.RoleSystemLogic")
 local RoleSystemDefine = require("roleSystem.RoleSystemDefine")
 local TriggerDefine = require("trigger.TriggerDefine")
 local TriggerLogic = require("trigger.TriggerLogic")
+local ChengjiuLogic = require("chengjiu.ChengjiuLogic")
 
 local GiftLogic
 
 local LOGTYPE = "talisman"
 local COND_TOWER_LEVEL = 100 --开启本系统需要通关恶魔之塔的层数
 
+local TALISMAN_2_CHENGJIU_TASKID = 404 -- 秘宝系统对应的成就任务Id
+
 --秘宝对挂机钻石/情报等其他方面增益标识
 OTHER_EFFECT_TBL = {
     ["GJ_QB"] = "GJ_QB",                            --挂机情报类型
@@ -61,10 +64,11 @@ OTHER_EFFECT_TBL = {
 
 --是否开启本系统
 local function isOpen(human)
-    local towerLevel = HuanJingTowerLogic.getTowerLevel(human)
-    if towerLevel >= COND_TOWER_LEVEL then
+    local state = ChengjiuLogic.GetTaskState(human, TALISMAN_2_CHENGJIU_TASKID)
+    if state == 2 then
         return true
     end
+
     return false
 end
 
@@ -223,6 +227,16 @@ function isDot(human, dotConfig)
     end
 end
 
+
+-- 外部调用, 本系统是否开启
+function ModuleisOpen(human)
+    local towerLevel = HuanJingTowerLogic.getTowerLevel(human)
+    if towerLevel >= COND_TOWER_LEVEL then
+        return true
+    end
+    return false
+end
+
 --秘宝对其他方面的加成, 如:挂机钻石
 function getTalismanAdd(human, effectType)
     local addValue = 0

+ 10 - 0
script/module/topup/BuyLogic.lua

@@ -138,6 +138,16 @@ local function getRealProductId(human, buyID, region)
 	region = human.region or "CN"
 	local buyConf = BuyExcel[buyID]
 	if not buyConf then return "" end
+
+	if region == "US" and human.phpChanelID == CommonDefine.CHANNEL_TAG_FT then
+		if human.version == "ios" or human.version == "iostishen" then
+			return buyConf.productidIos
+		else
+			return buyConf.productidEn
+		end
+	end
+
+
 	if region == "US" then
 		return buyConf.productidEn
 	else

+ 3 - 1
script/module/topup/TopupLogic.lua

@@ -17,7 +17,8 @@ local RoleSystemDefine = require("roleSystem.RoleSystemDefine")
 local MailExcel = require("excel.mail")
 local MailManager = require("mail.MailManager")
 local CommonDB = require("common.CommonDB")
-local Msg = require("core.Msg")
+local BreakThroughTheme = require("battle.BreakThroughTheme")
+
 -- 专属客服充值额度
 EXCLUSIVE_SERVER_9937 = 1000
 
@@ -69,6 +70,7 @@ function clacTopupAcount(human, price, buyID, buyNum)
 	LeichongHaoli.onAddMoney(human, nAllPrice)
 	LeijiChongzhi.onAddMoney(human, nAllPrice)
 	LoginSignLogic.chargeAfter(human)
+	BreakThroughTheme.charge(human, nAllPrice, buyID)
 
 	sendFireworksMail(human,nAllPrice)
 end

+ 3 - 3
script/module/voucher/VoucherShopLogic.lua

@@ -176,7 +176,7 @@ local function VoucherShop_GetAddNum(tConfig)
         return 0, 0
     end
 
-    table.print_lua_table(tConfig)
+    -- table.print_lua_table(tConfig)
     local nMultiple = 1
     local nNum = tConfig.tData.nGetVoucherNum
     if VoucherShopDefine.VOUCHERTYPE_INFLATION == tConfig.tData.nType then
@@ -194,7 +194,7 @@ local function VoucherShop_GetAddNum(tConfig)
         end
     end
 
-    nNum = nMultiple * nNum
+    nNum = math.ceil(nMultiple * nNum)
 
     return nNum, nMultiple
 end
@@ -408,7 +408,7 @@ function VoucherShop_BuyItem(human, nBuyID, nBuyNum)
         return
     end
 
-    if tTrueBuyConfig.module then
+    if tTrueBuyConfig.module and tTrueBuyConfig.module ~= "" then
         local tModule = load("return require(\"" .. tTrueBuyConfig.module .. "\")")()
         if tModule and tModule.GetRemainNum then
             local nTrueNum = tModule.GetRemainNum(human, nBuyID)

+ 23 - 2
script/module/winnerRelic/WinnerRelicLogic.lua

@@ -17,6 +17,7 @@ local Util = require("common.Util")
 local TriggerDefine = require("trigger.TriggerDefine")
 local TriggerLogic = require("trigger.TriggerLogic")
 local TalismanLogic = require("talisman.TalismanLogic")
+local ChengjiuLogic = require("chengjiu.ChengjiuLogic")
 
 
 local GiftLogic
@@ -26,6 +27,7 @@ local relicUpgradeConfig = relicModule.RelicUpgrade  -- 获取升级配置表
 local relicDataConfig = relicModule.RelicData       -- 获取遗物数据表
 local COND_TOWER_LEVEL = 500  --开启本系统需要通关恶魔之塔的层数
 local WINNERRELIC_HEROSTAR = 13     -- 需要穿戴的星级
+local WINNERRELIC_2_CHENGJIU_TASKID = 405 -- 圣遗物系统对应的成就任务Id
 --[[
     DB =
     {{    	 
@@ -51,10 +53,17 @@ end
 
 --判断是否开启圣者遗物
 local function isOpen(human)
-    local towerLevel = HuanJingTowerLogic.getTowerLevel(human)
-    if towerLevel >= COND_TOWER_LEVEL then
+    -- local towerLevel = HuanJingTowerLogic.getTowerLevel(human)
+    -- if towerLevel >= COND_TOWER_LEVEL then
+    --     return true
+    -- end
+    -- return false
+
+    local state = ChengjiuLogic.GetTaskState(human, WINNERRELIC_2_CHENGJIU_TASKID)
+    if state == 2 then
         return true
     end
+
     return false
 end
 -- 获取对应类型的遗物
@@ -608,6 +617,18 @@ function isDot(human, dotConfig)
     end
 end
 
+
+-- 外部调用, 本系统是否开启
+function ModuleisOpen(human)
+    local towerLevel = HuanJingTowerLogic.getTowerLevel(human)
+    if towerLevel >= COND_TOWER_LEVEL then
+        return true
+    end
+    return false
+end
+
+
+
 function WinnerRelic_GetSkillID(nRelicID, nStar)
     local tConfig = relicDataConfig[nRelicID]
     if nil == tConfig then