12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- local schema = require "model.schema"
- local skynet = require "skynet"
- local embattle = require "model.embattle"
- local module_fun = require "model.module_fun"
- -- local rankinglist
- local module_name = "presence"
- local _M = schema.new(module_name)
- local function update(character)
- if character.ban_rank ~= 0 then
- return
- end
- if character.level <= 1 then
- return
- end
-
- local power = embattle.battle_power(character)
- local data = {
- num = power,
- num2 = 0,
- role = module_fun.simple_role(character),
- }
- -- skynet.call(rankinglist, "lua", "update", RANKING_POWER, data)
- character.set_power(power)
- character.dispatch("power_update", power)
- end
- local MODULE = {}
- -- TODO: 解析/升级模块数据 在这里把数据初始化好
- function MODULE.parse(character)
- end
- -- TODO: 侦听事件
- function MODULE.monitor(character)
- end
- -- TODO: 类似泰利的 prepare 接口
- function MODULE.launch(character)
- -- rankinglist = skynet.localname(".rankinglist")
- end
- -- TODO: 玩家下线时的处理
- function MODULE.saybye(character)
- update(character)
- end
- -- TODO: 与客户端同步数据
- function MODULE.ready(character)
- skynet.fork(
- function()
- while(true) do
- update(character)
- skynet.sleep(100*60*3)
- end
- end
- )
- end
- return MODULE
|