找回密码
 注册/Sign up
搜索
查看: 2142|回复: 2

[Lua] 迷宫重置提醒

[复制链接]
发表于 2021-12-29 20:05:19 | 显示全部楼层 |阅读模式
本帖最后由 muscipular 于 2021-12-29 20:09 编辑

进入迷宫时提示迷宫重置时间,需要框架v0.1.17以上
  1. ---模块类
  2. local DungeonTips = ModuleBase:createModule('dungeonTips.lua')
  3. --- 加载模块钩子
  4. function DungeonTips:onLoad()
  5.   self:logInfo('load')
  6.   self:regCallback('AfterWarpEvent', function(
  7.     CharIndex, Ori_MapId, Ori_FloorId, Ori_X, Ori_Y,
  8.     Target_MapId, Target_FloorId, Target_X, Target_Y)
  9.     if Target_MapId == 1 and Target_FloorId ~= Ori_FloorId then
  10.       local cfgId = Map.GetDungeonId(Target_FloorId)
  11.       if cfgId < 0 then
  12.         return ;
  13.       end
  14.       if Ori_MapId == 1 then
  15.         local cfgIdF = Map.GetDungeonId(Ori_FloorId);
  16.         if cfgIdF == cfgId then
  17.           return ;
  18.         end
  19.       end
  20.       local s = Map.GetDungeonExpireAtByDungeonId(cfgId) - os.time();
  21.       if s > 3600 then
  22.         NLG.SystemMessage(CharIndex, string.format('天线宝宝提醒你:你将于 %d 小时 %d 分钟后被神秘力量送出当前迷宫',
  23.           math.floor(s / 3600),
  24.           math.floor(math.fmod(s / 60, 60))
  25.         ))
  26.       elseif s > 60 then
  27.         NLG.SystemMessage(CharIndex, string.format('天线宝宝提醒你:你将于 %d 分钟后被神秘力量送出当前迷宫', math.floor(s / 60)))
  28.       else
  29.         NLG.SystemMessage(CharIndex, '天线宝宝提醒你:你将马上被神秘力量送出当前迷宫')
  30.       end
  31.     end
  32.   end)
  33. end
  34. --- 卸载模块钩子
  35. function DungeonTips:onUnload()
  36.   self:logInfo('unload')
  37. end
  38. return DungeonTips;
复制代码
`6A2PG1OZ9])2[H[E.png

发表于 2021-12-29 21:55:34 | 显示全部楼层
好东西~有这个就方便多了

发表于 2022-1-28 14:34:46 | 显示全部楼层
3qqqqqqqqqqq
您需要登录后才可以回帖 登录 | 注册/Sign up

本版积分规则

手机版|cgmsv引擎论坛

GMT+8, 2026-6-5 09:14 , Processed in 0.032809 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表