自动增长类变量实现.txt 1.14 KB
Role.magics = {
	talentPoint = {
		timestr = "talentLastTime",	-- timestamps
		limit = function (role)
			return globalCsv.talentPointLimit
		end,
		recover = "talentRecoveryTime", -- globaldefine
		collectIn = "in_talentPoint",
		collectOut = "out_talentPoint",
		cycle = true, -- 回复满,是否复用时间
	},-- 天赋点
}

方法:
1. produce 生产

2. consume 消费

3. onRecoverTimer 定时更新

4. onRecoverLogin 登录回复

使用前准备:

在 timestamp 类中添加 talentLastTime ,上次修改时间

在 globaldefine 中添加 talentPointLimit ,添加上限值,如上,limit中是function 可以根据role的属性来调整上限值;例如可根据vip调整上限值

在 globaldefine 中添加 talentRecoveryTime ,每(多少)个单位时间回复该值,这里默认以分钟为单位

collectIn 和 out_talentPoint 变量 是日志字段

cycle 是标志位 意思是 满了后消耗,会接着上次剩余时间回复该值

====================================================================

对外提供接口

role:produce(params)
role:consume(params)

params 可使用字段

field

delta

cantOver

notify