Эх сурвалжийг харах

同步功能修改到泰版

gitwallet 1 жил өмнө
parent
commit
fc896fa9e3

+ 20 - 18
script/module/lostTemple/Proto.lua

@@ -6,9 +6,9 @@ local Attr = require("role.Proto").Attr
 
 LostNode = {
     { "id", 1, "int" },-- id
-    { "name", 1, "string" },-- 名称
-    { "type", 1, "byte" },-- 图标
-    { "desc", 1, "string" },-- 描述
+    { "name", 1, "string" },-- 鍚嶇О
+    { "type", 1, "byte" },-- 鍥炬爣
+    { "desc", 1, "string" },-- 鎻忚堪
     { "x", 1, "byte" },-- id
     { "y", 1, "byte" },-- id
     { "body", 1, "int" },-- id
@@ -24,12 +24,12 @@ LostTree = {
     { "id", 1, "byte" },
     { "icon", 1, "int" },
     { "name", 1, "string" },
-    { "attr", 5, Attr },-- 攻击,血量,护甲
+    { "attr", 5, Attr },-- 鏀诲嚮,琛€閲�,鎶ょ敳
 }
 
 LostBuff = {
     { "name", 1, "string" },-- 
-    { "attr", 1, Attr },  -- 攻击,血量,护甲 
+    { "attr", 1, Attr },  -- 鏀诲嚮,琛€閲�,鎶ょ敳 
 }
 
 LostShop = {
@@ -39,83 +39,85 @@ LostShop = {
     { "discount", 1, "byte" },
 }
 
--- 查询
+-- 鏌ヨ�
 CG_LOST_TEMPLE_QUERY = { }
 GC_LOST_TEMPLE_QUERY = {
     { "list", 20, LostNode },
     { "playerX", 1, "byte" },
     { "playerY", 1, "byte" },
     { "layer", 1, "byte" },
+    { "leftTime", 1, "int"},-- 娲诲姩鍓╀綑鏃堕棿
 }
 
 GC_LOST_TEMPLE_CLOSE = {
 }
 
--- 点击
+-- 鐐瑰嚮
 CG_LOST_TEMPLE_PUT = {
-    { "op", 1, "byte" },-- 0 查询  1 确认操作
+    { "op", 1, "byte" },-- 0 鏌ヨ�  1 纭��鎿嶄綔
     { "x", 1, "byte" },
     { "y", 1, "byte" },
     { "arg", 1, "string" },
 }
 
--- 点击后怪物信息
+-- 鐐瑰嚮鍚庢€�墿淇℃伅
 GC_LOST_TEMPLE_MONSTER = {
     { "gdReward", 10, ItemData },
     { "randomReward", 10, ItemData },
     { "list", 6, HeroSimple },
 }
 
--- 英雄信息
+-- 鑻遍泟淇℃伅
 GC_LOST_TEMPLE_HERO_STATUS = {
     { "list", 30, LostHero },
     { "isEnd", 1, "byte" },
 }
 
--- 召唤神坛信息
+-- 鍙�敜绁炲潧淇℃伅
 GC_LOST_TEMPLE_SUMMON = {
     { "list", 5, HeroSimple },
 }
 
--- 召唤英雄列表
+-- 鍙�敜鑻遍泟鍒楄〃
 CG_LOST_TEMPLE_SUMMON_LIST = { }
 GC_LOST_TEMPLE_SUMMON_LIST = {
     { "list", 15, HeroSimple },
 }
 
--- BUFF属性
+-- BUFF灞炴€�
 GC_LOST_TEMPLE_BUFF = {
     { "list", 5, LostTree },
 }
 
--- 叠加的BUFF属性
+-- 鍙犲姞鐨凚UFF灞炴€�
 CG_LOST_TEMPLE_BUFF_LIST = { }
 GC_LOST_TEMPLE_BUFF_LIST = {
     { "list", 10, LostBuff },
 }
 
--- 商店
+-- 鍟嗗簵
 GC_LOST_TEMPLE_SHOP = {
     { "list", 5, LostShop },
 }
 
 
--- 更新
+-- 鏇存柊
 GC_LOST_TEMPLE_UPDATE = {
     { "list", 20, LostNode },
     { "playerX", 1, "byte" },
     { "playerY", 1, "byte" },
     { "layer", 1, "byte" },
+    { "leftTime", 1, "int"},-- 娲诲姩鍓╀綑鏃堕棿
 }
 
--- 结算
+-- 缁撶畻
 GC_LOST_TEMPLE_FIGHT_END = {
     { "data", 1, CombatFinishData },
     { "gdReward", 10, ItemData },
     { "randomReward", 2, ItemData },
 }
 
--- 随机奖励查询
+-- 闅忔満濂栧姳鏌ヨ�
 CG_LOGT_TEMPLE_RANDOM_BOX = {}
 GC_LOGT_TEMPLE_RANDOM_BOX = {
     { "randomReward", 15, ItemData },

+ 54 - 12
script/module/lostTemple/lostTempleLogic.lua

@@ -34,15 +34,40 @@ START_LAYER = 1     -- ��ʼ����
 OP_QUERY = 0
 OP_CONFIRM = 1
 INIT_HP_MAX = 100
-
+DAY_7s = 604800
+DAY_2s = 172800
+DAY_1s = 86400
 
 function initAfterHot()
 
 end
 
+function getLeftTime()
+    local openDay = CommonDB.getServerOpenDay()
+    if not openDay then
+        return 0
+    end
+    local openTime = CommonDB.getServerOpenTime()
+    local curTime = os.time()
+    if openDay <= 7 and openDay > 0 then
+        local endTime = openTime + DAY_7s
+        return (endTime - curTime)
+    elseif openDay > 7 then
+        if (openDay - 7 + 1)%2 ~= 1 then
+           local endTime = openTime + DAY_7s + (openDay-7)*DAY_1s
+           return (endTime - curTime)
+		end
+        if(openDay - 7 + 1)%2 == 1 then
+            local endTime = openTime + DAY_7s + ((openDay-7)-1)*DAY_2s
+            return (endTime - curTime)
+        end
+    end
+    return 0
+end
+
 --
 local function isOpen(human)
-    --[[local openDay = CommonDB.getServerOpenDay()
+    local openDay = CommonDB.getServerOpenDay()
     if not openDay then
         return 
     end
@@ -54,7 +79,7 @@ local function isOpen(human)
     ---- �Ѿ�����
     if (openDay - 7 + 1) % 2 ~= 1 then
         return 
-    end]]
+    end
     
     if not RoleSystemLogic.isOpen(human, RoleSystemDefine.ROLE_SYS_ID_1208) then
        return 
@@ -113,16 +138,16 @@ function dbSave(human)
     if not human.lostTemple then return end
     if not human.db then return end
 
-    --[[DB_DATA = { }
+    DB_DATA = { }
     LuaMongo.find(DB.db_lost_temple, QueryByUuid)
     if not LuaMongo.next(DB_DATA) then
         human.lostTemple._id = human.db._id
         LuaMongo.insert(DB.db_lost_temple, human.lostTemple)
         return
-    end]]
+    end
 
     QueryByUuid._id = human.db._id
-    LuaMongo.update(DB.db_lost_temple, QueryByUuid,human.lostTemple,1)
+    LuaMongo.update(DB.db_lost_temple, QueryByUuid, human.lostTemple)
 end
 
 -- db
@@ -598,19 +623,29 @@ local function makeGridNet(human, net)
 end
 
 -- ��ѯ
-function query(human)
-    if not isOpen(human) then return end
+function query(human)  
+    if not isOpen(human) then
+        return
+    end
 
     -- û�й���
     local db = human.db.xingYaoGongMing
-    if not db or not db.defList then return end
+    if not db or not db.defList then
+        return 
+    end
 
     initDB(human)
+
+    local leftTime = getLeftTime()
     local msgRet = Msg.gc.GC_LOST_TEMPLE_QUERY
+    msgRet.leftTime = leftTime
+    
     if not makeGridNet(human, msgRet.list) then return end
     msgRet.playerX = human.lostTemple.x
     msgRet.playerY = human.lostTemple.y
     msgRet.layer = human.lostTemple.layer
+    msgRet.leftTime = leftTime
+
     Msg.send(msgRet, human.fd)
 
     sendHeroStatus(human)
@@ -619,13 +654,20 @@ end
 
 -- ����
 function update(human)
-    if not human.lostTemple then return end
-
+    if not human.lostTemple then 
+        return
+    end
+    
+    if not makeGridNet(human, msgRet.list) then
+        return 
+    end
     local msgRet = Msg.gc.GC_LOST_TEMPLE_UPDATE
-    if not makeGridNet(human, msgRet.list) then return end
+    local leftTime = getLeftTime()
+    msgRet.leftTime = leftTime
     msgRet.playerX = human.lostTemple.x
     msgRet.playerY = human.lostTemple.y
     msgRet.layer = human.lostTemple.layer
+
     Msg.send(msgRet, human.fd)
 end