10 lines
273 B
Lua
10 lines
273 B
Lua
|
|
local reward_hp = tonumber(redis.call('get', KEYS[1]))
|
||
|
|
local hp = tonumber(ARGV[1])
|
||
|
|
local tag_hp = 0
|
||
|
|
if hp > 0 and reward_hp < hp then
|
||
|
|
return 3
|
||
|
|
else
|
||
|
|
reward_hp = redis.call('incrBy',KEYS[1],-hp)
|
||
|
|
tag_hp = redis.call('hincrBy',KEYS[2],'hp',hp)
|
||
|
|
end
|
||
|
|
return {reward_hp,tag_hp}
|