gitxsm 1 mēnesi atpakaļ
vecāks
revīzija
a838a513c3
2 mainītis faili ar 87 papildinājumiem un 87 dzēšanām
  1. 2 2
      script/core/ObjHuman.lua
  2. 85 85
      script/module/broadcast/BigRPlayerShow.lua

+ 2 - 2
script/core/ObjHuman.lua

@@ -106,7 +106,7 @@ local AnotherWorldBattleNS = require("anotherWorldBattle.AnotherWorldBattleNS")
 local RoleStorageBox = require("roleSystem.RoleStorageBox")
 local BreakThroughTheme = require("battle.BreakThroughTheme")
 local BattleGift = require("battle.BattleGift")
--- local BigRPlayerShow = require("broadcast.BigRPlayerShow")
+local BigRPlayerShow = require("broadcast.BigRPlayerShow")
 
 
 local Json = require("common.Json")
@@ -855,7 +855,7 @@ function onLogin(human, isNew)
 		Msg.send(msgRet,human.fd)
 	end
 
-	-- BigRPlayerShow.onLogin(human)
+	BigRPlayerShow.onLogin(human)
 	
 	-- 注意 这个函数写在doLogin的最后
 	MiddleLogic.onLogin(human)

+ 85 - 85
script/module/broadcast/BigRPlayerShow.lua

@@ -1,101 +1,101 @@
--- -- 大R玩家实力显示
-
--- local Msg = require("core.Msg")
--- local ObjHuman = require("core.ObjHuman")
--- local BillboardLogic = require("billboard.BillboardLogic")
--- local BillboardDefine = require("billboard.BillboardDefine")
--- local Util = require("common.Util")
--- -- local CommonDB = require("common.CommonDB")
-
--- -- local pRank1lastBroadcastTime
-
-
--- -- local function getBigRPlayerData()
--- --     return CommonDB.getValueByKey(CommonDB.KEY_BIGRPLAYER_SHOW_DATA)
--- -- end
-
--- -- local function updateBigRPlayerData(newData)
--- --     CommonDB.updateValue(CommonDB.KEY_BIGRPLAYER_SHOW_DATA, newData)
--- -- end
-
--- -- local function getpRank1LastBroadcastTime()
--- --     local data = getBigRPlayerData()
--- --     return data and data.pRank1lastBroadcastTime
--- -- end
-
--- -- local function updatepRank1LastBroadcastTime()
--- --     local data = getBigRPlayerData()
--- --     data = data or {}
--- --     local now  = os.time()
--- --     data.pRank1lastBroadcastTime = now
--- --     updateBigRPlayerData(data)
-
--- --     -- 更新缓存
--- --     pRank1lastBroadcastTime = now
--- -- end
-
--- local function isShowTips(human)
---     local bl = true
---     if not human.db.showTipsData then
---         return bl
---     end
-
---     if human.db.lv < 10 then
---         return bl
---     end
-
---     local showTipsData = human.db.showTipsData
---     local pRank1LoginShowTime = showTipsData.pRank1LoginShowTime
---     if not pRank1LoginShowTime then
---         return bl
---     end
-
---     if Util.isSameDay(pRank1LoginShowTime) then
---         bl = false
---     end
-
---     return bl
+-- 大R玩家实力显示
+
+local Msg = require("core.Msg")
+local ObjHuman = require("core.ObjHuman")
+local BillboardLogic = require("billboard.BillboardLogic")
+local BillboardDefine = require("billboard.BillboardDefine")
+local Util = require("common.Util")
+-- local CommonDB = require("common.CommonDB")
+
+-- local pRank1lastBroadcastTime
+
+
+-- local function getBigRPlayerData()
+--     return CommonDB.getValueByKey(CommonDB.KEY_BIGRPLAYER_SHOW_DATA)
 -- end
 
--- local function updateShowTipsData(human)
---     human.db.showTipsData = human.db.showTipsData or {}
---     human.db.showTipsData.pRank1LoginShowTime = os.time()
+-- local function updateBigRPlayerData(newData)
+--     CommonDB.updateValue(CommonDB.KEY_BIGRPLAYER_SHOW_DATA, newData)
 -- end
 
+-- local function getpRank1LastBroadcastTime()
+--     local data = getBigRPlayerData()
+--     return data and data.pRank1lastBroadcastTime
+-- end
 
+-- local function updatepRank1LastBroadcastTime()
+--     local data = getBigRPlayerData()
+--     data = data or {}
+--     local now  = os.time()
+--     data.pRank1lastBroadcastTime = now
+--     updateBigRPlayerData(data)
 
--- -- 战力排行榜排名第一的玩家上线的处理
--- local function powerRankTopOneLogin(human)
---     -- if not pRank1lastBroadcastTime then
---     --     pRank1lastBroadcastTime = getpRank1LastBroadcastTime()
---     -- end
+--     -- 更新缓存
+--     pRank1lastBroadcastTime = now
+-- end
 
---     -- if pRank1lastBroadcastTime and Util.isSameDay(pRank1lastBroadcastTime) then
---     --     return
---     -- end
+local function isShowTips(human)
+    local bl = true
+    if not human.db.showTipsData then
+        return bl
+    end
 
---     local rankList = BillboardLogic.GetRankList(BillboardDefine.TYPE_ZHANDOULI)
---     if not rankList or not rankList[1] or rankList[1].uuid ~= human.db._id then
---         return
---     end
+    if human.db.lv < 10 then
+        return bl
+    end
 
---     local msg = Msg.gc.GC_POWERRANK_TOPONE_LOGIN
---     msg.playerName = human.db.name
+    local showTipsData = human.db.showTipsData
+    local pRank1LoginShowTime = showTipsData.pRank1LoginShowTime
+    if not pRank1LoginShowTime then
+        return bl
+    end
 
---     for uuid, h in pairs(ObjHuman.onlineUuid) do
---         if uuid ~= human.db._id and isShowTips(h) then
---             Msg.send(msg, h.fd)
+    if Util.isSameDay(pRank1LoginShowTime) then
+        bl = false
+    end
 
---             updateShowTipsData(h)
---         end
---     end
+    return bl
+end
 
---     -- updatepRank1LastBroadcastTime()
--- end
+local function updateShowTipsData(human)
+    human.db.showTipsData = human.db.showTipsData or {}
+    human.db.showTipsData.pRank1LoginShowTime = os.time()
+end
 
 
 
+-- 战力排行榜排名第一的玩家上线的处理
+local function powerRankTopOneLogin(human)
+    -- if not pRank1lastBroadcastTime then
+    --     pRank1lastBroadcastTime = getpRank1LastBroadcastTime()
+    -- end
 
--- function onLogin(human)
---     powerRankTopOneLogin(human)
--- end
+    -- if pRank1lastBroadcastTime and Util.isSameDay(pRank1lastBroadcastTime) then
+    --     return
+    -- end
+
+    local rankList = BillboardLogic.GetRankList(BillboardDefine.TYPE_ZHANDOULI)
+    if not rankList or not rankList[1] or rankList[1].uuid ~= human.db._id then
+        return
+    end
+
+    local msg = Msg.gc.GC_POWERRANK_TOPONE_LOGIN
+    msg.playerName = human.db.name
+
+    for uuid, h in pairs(ObjHuman.onlineUuid) do
+        if uuid ~= human.db._id and isShowTips(h) then
+            Msg.send(msg, h.fd)
+
+            updateShowTipsData(h)
+        end
+    end
+
+    -- updatepRank1LastBroadcastTime()
+end
+
+
+
+
+function onLogin(human)
+    powerRankTopOneLogin(human)
+end