Merge branch 'dev' of http://git.juzugame.com/b6-client/b6-lua into dev
This commit is contained in:
commit
de7643a18f
@ -129,7 +129,11 @@ function Time:setServerTimeZone(timeZone)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Time:getClientTimeZone()
|
function Time:getClientTimeZone()
|
||||||
return os.difftime(os.time(), os.time(os.date("!*t", os.time())))/SECONDS_PRE_HOUR
|
local now = os.time()
|
||||||
|
local utcdate = os.date("!*t", now)
|
||||||
|
local localdate = os.date("*t", now)
|
||||||
|
localdate.isdst = false
|
||||||
|
return os.difftime(os.time(localdate), os.time(utcdate))
|
||||||
end
|
end
|
||||||
|
|
||||||
function Time:getTimeZoneOffset()
|
function Time:getTimeZoneOffset()
|
||||||
|
|||||||
@ -30,6 +30,13 @@ Example: del_item]],
|
|||||||
Example: clear_item]],
|
Example: clear_item]],
|
||||||
type = "clear_item"
|
type = "clear_item"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title = "添加英雄",
|
||||||
|
desc = [[添加英雄 type:add_hero
|
||||||
|
arg1:英雄id
|
||||||
|
Example: add_hero 1]],
|
||||||
|
type = "add_hero"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return GMConst
|
return GMConst
|
||||||
@ -1,8 +1,6 @@
|
|||||||
local ServerHeroData = class("ServerHeroData", ServerBaseData)
|
local ServerHeroData = class("ServerHeroData", ServerBaseData)
|
||||||
|
|
||||||
function ServerHeroData:init(data)
|
function ServerHeroData:init(data)
|
||||||
Logger.logHighlight("ServerHeroData")
|
|
||||||
Logger.printTable(data)
|
|
||||||
self.data.heroes = data and data.heroes or {}
|
self.data.heroes = data and data.heroes or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -117,6 +117,26 @@ function ServerDataManager:dealGM(params, callback)
|
|||||||
for k, v in pairs(items) do
|
for k, v in pairs(items) do
|
||||||
v.count = 0
|
v.count = 0
|
||||||
end
|
end
|
||||||
|
elseif args[1] == "add_hero" then
|
||||||
|
local id = tonumber(args[2])
|
||||||
|
if not id then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local hero = ServerGameData.HeroData:getHeroByCfgId(id)
|
||||||
|
if hero == nil or hero.lv <= 0 then
|
||||||
|
local heroCfg = ConfigManager:getConfig("hero")
|
||||||
|
local heroLvCfg = ConfigManager:getConfig("hero_level")
|
||||||
|
local heroInfo = heroCfg[id]
|
||||||
|
if heroInfo then
|
||||||
|
local costKey = "cost_" .. heroInfo.qlt
|
||||||
|
for k, v in ipairs(heroLvCfg) do
|
||||||
|
if v[costKey] then -- 第一个有值的就是解锁所需的数量
|
||||||
|
ServerGameData.HeroData:addHero(id, k)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ServerGameData:saveData()
|
ServerGameData:saveData()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user