本帖最后由 muscipular 于 2021-12-29 20:09 编辑
进入迷宫时提示迷宫重置时间,需要框架v0.1.17以上
-
- ---模块类
- local DungeonTips = ModuleBase:createModule('dungeonTips.lua')
-
- --- 加载模块钩子
- function DungeonTips:onLoad()
- self:logInfo('load')
- self:regCallback('AfterWarpEvent', function(
- CharIndex, Ori_MapId, Ori_FloorId, Ori_X, Ori_Y,
- Target_MapId, Target_FloorId, Target_X, Target_Y)
- if Target_MapId == 1 and Target_FloorId ~= Ori_FloorId then
- local cfgId = Map.GetDungeonId(Target_FloorId)
- if cfgId < 0 then
- return ;
- end
- if Ori_MapId == 1 then
- local cfgIdF = Map.GetDungeonId(Ori_FloorId);
- if cfgIdF == cfgId then
- return ;
- end
- end
- local s = Map.GetDungeonExpireAtByDungeonId(cfgId) - os.time();
- if s > 3600 then
- NLG.SystemMessage(CharIndex, string.format('天线宝宝提醒你:你将于 %d 小时 %d 分钟后被神秘力量送出当前迷宫',
- math.floor(s / 3600),
- math.floor(math.fmod(s / 60, 60))
- ))
- elseif s > 60 then
- NLG.SystemMessage(CharIndex, string.format('天线宝宝提醒你:你将于 %d 分钟后被神秘力量送出当前迷宫', math.floor(s / 60)))
- else
- NLG.SystemMessage(CharIndex, '天线宝宝提醒你:你将马上被神秘力量送出当前迷宫')
- end
- end
- end)
- end
-
- --- 卸载模块钩子
- function DungeonTips:onUnload()
- self:logInfo('unload')
- end
-
- return DungeonTips;
-
复制代码
|