497 lines
18 KiB
Lua
497 lines
18 KiB
Lua
|
|
local skynet = require "skynet"
|
|||
|
|
local oo = require "Class"
|
|||
|
|
local log = require "Log"
|
|||
|
|
local protoc = require "protoc"
|
|||
|
|
local pb = require "pb"
|
|||
|
|
local json =require "json"
|
|||
|
|
local dataType = require "DataType"
|
|||
|
|
local GameConfig = oo.class()
|
|||
|
|
|
|||
|
|
--配置类型
|
|||
|
|
GameConfig.ConfigType_Main = { "Main" , "GameConfig" } --配置类型1 参数1 客户端发来的字段 参数2 具体配置的文件夹名
|
|||
|
|
GameConfig.ConfigType_A = { "A" , "GameConfigA" } --配置类型2
|
|||
|
|
GameConfig.ConfigType_B = { "B" , "GameConfigB" } --配置类型3
|
|||
|
|
|
|||
|
|
--获取类型
|
|||
|
|
function GameConfig:GetConfigType( configType , paramId )
|
|||
|
|
if paramId < 1 or paramId > 2 or not self["ConfigType_"..configType ] then
|
|||
|
|
return nil
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
return self["ConfigType_"..configType ][ paramId ]
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
function GameConfig:GetClusterServerConfig( name )
|
|||
|
|
for k, v in pairs(skynet.server.gameConfig.ClusterServerConfig) do
|
|||
|
|
if name == v.serverName then
|
|||
|
|
return v
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--配置进行扩展
|
|||
|
|
function GameConfig:ExpendConfig()
|
|||
|
|
local tmpConfig = {}
|
|||
|
|
for k1, v1 in pairs( self.ClusterServerConfig ) do
|
|||
|
|
for i = 1, v1.groupCount, 1 do
|
|||
|
|
local offset = ( i - 1 )
|
|||
|
|
local newCfg = {}
|
|||
|
|
for k2, v2 in pairs( v1 ) do
|
|||
|
|
newCfg[ k2 ] = v2
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
newCfg.serverId = newCfg.serverId + offset
|
|||
|
|
newCfg.clusterPort = newCfg.clusterPort + offset
|
|||
|
|
|
|||
|
|
--组装HTTP端口
|
|||
|
|
if 0 ~= newCfg.httpPort then
|
|||
|
|
newCfg.httpPort = newCfg.httpPort + offset
|
|||
|
|
if self:IsOnline() then
|
|||
|
|
local domain = self.BasicConfig[ "domain"..newCfg.hardware ]
|
|||
|
|
self.BasicConfig.domain = domain
|
|||
|
|
newCfg.httpUrl = string.format("https://%s/Game%d/" , domain , newCfg.httpPort )
|
|||
|
|
else
|
|||
|
|
newCfg.httpUrl = string.format("http://%s:%s/" , newCfg.externalIp , newCfg.httpPort )
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--组装TCP端口
|
|||
|
|
if 0 ~= newCfg.tcpPort then
|
|||
|
|
newCfg.tcpPort = newCfg.tcpPort + offset
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--组装WS端口
|
|||
|
|
if 0 ~= newCfg.webSocketPort then
|
|||
|
|
newCfg.webSocketPort = newCfg.webSocketPort + offset
|
|||
|
|
if self:IsOnline() then
|
|||
|
|
local domain = self.BasicConfig[ "domain"..newCfg.hardware ]
|
|||
|
|
newCfg.webSocketUrl = string.format("wss://%s/Game%d" , domain , newCfg.webSocketPort )
|
|||
|
|
else
|
|||
|
|
newCfg.webSocketUrl = string.format("ws://%s:%d" , newCfg.internalIp , newCfg.webSocketPort )
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
table.insert( tmpConfig , newCfg)
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
self.ClusterServerConfig = tmpConfig
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
function GameConfig:LoadConfig()
|
|||
|
|
log.info("开始加载配置")
|
|||
|
|
local cmd = string.format("find %s -name *.config","Server")
|
|||
|
|
local fp = io.popen(cmd)
|
|||
|
|
for filename in fp:lines() do
|
|||
|
|
self:LoadOneConfig(filename)
|
|||
|
|
end
|
|||
|
|
fp:close()
|
|||
|
|
|
|||
|
|
self:ExpendConfig()
|
|||
|
|
|
|||
|
|
--加载屏蔽词
|
|||
|
|
GameConfig.MaskWords = {}
|
|||
|
|
local fp = io.open("Server/Config/屏蔽词.txt")
|
|||
|
|
if fp then
|
|||
|
|
local keyWords = fp:read "*a"
|
|||
|
|
GameConfig.MaskWords = skynet.server.common:Split( keyWords , "|")
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
log.info("结束加载配置")
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
function GameConfig:LoadOneConfig(filename)
|
|||
|
|
local newModule = {}
|
|||
|
|
if filename then
|
|||
|
|
local f = assert(io.open(filename))
|
|||
|
|
local source = f:read "*a"
|
|||
|
|
f:close()
|
|||
|
|
assert(load(source, "@"..filename, "t", newModule))()
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
for name,config in pairs(newModule) do
|
|||
|
|
GameConfig[name] = config
|
|||
|
|
--log.info(string.format("加载配置文件 %s 变量名 %s",filename, name))
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--载入JSON配置
|
|||
|
|
function GameConfig:LoadJson()
|
|||
|
|
log.info("开始加载JSON配置")
|
|||
|
|
local cmd = string.format("find '%s' -name '*.json'","Server/Config/".. self:GetConfigType( "Main" , 2 ))
|
|||
|
|
local fp = io.popen(cmd)
|
|||
|
|
for filename in fp:lines() do
|
|||
|
|
self:LoadOneJson( self:GetConfigType( "Main" , 2 ) , filename)
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
cmd = string.format("find '%s' -name '*.json'","Server/Config/".. self:GetConfigType( "A" , 2 ))
|
|||
|
|
fp = io.popen(cmd)
|
|||
|
|
for filename in fp:lines() do
|
|||
|
|
self:LoadOneJson( self:GetConfigType( "A" , 2 ) , filename)
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
cmd = string.format("find '%s' -name '*.json'","Server/Config/".. self:GetConfigType( "B" , 2 ))
|
|||
|
|
fp = io.popen(cmd)
|
|||
|
|
for filename in fp:lines() do
|
|||
|
|
self:LoadOneJson( self:GetConfigType( "B" , 2 ) , filename)
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
cmd = string.format("find '%s' -name '*.json'","Server/Config/InitHouse")
|
|||
|
|
fp = io.popen(cmd)
|
|||
|
|
for filename in fp:lines() do
|
|||
|
|
self:LoadOneJson( "InitHouse" , filename)
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
fp:close()
|
|||
|
|
log.info("结束加载JSON配置")
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--修改三测服的时间
|
|||
|
|
function GameConfig:Modify3TestServerTime( newFileName )
|
|||
|
|
if self:Is3TestServer() and ( "Activity" == newFileName or "StorePack" == newFileName ) then
|
|||
|
|
log.info("光子服活动提前3天开启")
|
|||
|
|
local addDay = -3
|
|||
|
|
for k, v in pairs( GameConfig[ newFileName ] ) do
|
|||
|
|
if 10 ~= v.activityType then
|
|||
|
|
--除了周赛,其他活动都减3天
|
|||
|
|
if v.startTime and "" ~= v.startTime then
|
|||
|
|
local startTime = skynet.server.common:GetTime(v.startTime)
|
|||
|
|
startTime = skynet.server.common:GetSomeDayTime( startTime , addDay)
|
|||
|
|
startTime = skynet.server.common:GetStrTime( startTime)
|
|||
|
|
v.startTime = startTime
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
if v.endTime and "" ~= v.endTime then
|
|||
|
|
local endTime = skynet.server.common:GetTime(v.endTime)
|
|||
|
|
endTime = skynet.server.common:GetSomeDayTime( endTime , addDay)
|
|||
|
|
endTime = skynet.server.common:GetStrTime( endTime)
|
|||
|
|
v.endTime = endTime
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
if v.mailTime and "" ~= v.mailTime then
|
|||
|
|
local mailTime = skynet.server.common:GetTime(v.mailTime)
|
|||
|
|
mailTime = skynet.server.common:GetSomeDayTime( mailTime , addDay)
|
|||
|
|
mailTime = skynet.server.common:GetStrTime( mailTime)
|
|||
|
|
v.mailTime = mailTime
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
function GameConfig:LoadOneJson( cfgName , filename)
|
|||
|
|
if filename then
|
|||
|
|
local f = assert(io.open(filename))
|
|||
|
|
local source = f:read("*all")
|
|||
|
|
f:close()
|
|||
|
|
|
|||
|
|
--local startPos = string.find(filename ,"GameConfig/") + #"GameConfig/"
|
|||
|
|
local startPos = string.find(filename ,cfgName.."/") + #(cfgName.."/")
|
|||
|
|
local endPos = string.find(filename ,"_" ) - 1
|
|||
|
|
local newFileName = string.sub(filename,startPos ,endPos)
|
|||
|
|
local isHousePreData,_ = string.find( newFileName , "HousePreData")
|
|||
|
|
if "SValue" == newFileName then
|
|||
|
|
if self:GetConfigType( "Main" , 2 ) == cfgName then
|
|||
|
|
GameConfig[ newFileName ] = json:decode(source)
|
|||
|
|
else
|
|||
|
|
GameConfig[ cfgName .."_".. newFileName ] = json:decode(source)
|
|||
|
|
end
|
|||
|
|
elseif nil ~= isHousePreData then
|
|||
|
|
GameConfig[ cfgName .."_".. newFileName ] = json:decode(source)
|
|||
|
|
else
|
|||
|
|
if self:GetConfigType( "Main" , 2 ) == cfgName then
|
|||
|
|
GameConfig[ newFileName ] = json:decode(source)["items"]
|
|||
|
|
self:Modify3TestServerTime( newFileName )
|
|||
|
|
else
|
|||
|
|
GameConfig[ cfgName .."_".. newFileName ] = json:decode(source)["items"]
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
--log.info(string.format("加载配置文件 %s 变量名 %s",filename, newFileName))
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--载入PB协议
|
|||
|
|
function GameConfig:LoadProto()
|
|||
|
|
log.info("开始加载ProtoBuf")
|
|||
|
|
local cmd = string.format("find %s -name *.proto","Server")
|
|||
|
|
local fp = io.popen(cmd)
|
|||
|
|
for filename in fp:lines() do
|
|||
|
|
self:LoadOneProto(filename)
|
|||
|
|
end
|
|||
|
|
fp:close()
|
|||
|
|
|
|||
|
|
log.info("结束加载ProtoBuf")
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
function GameConfig:LoadOneProto(filename)
|
|||
|
|
local newModule = {}
|
|||
|
|
if filename then
|
|||
|
|
local f = assert(io.open(filename))
|
|||
|
|
--log.info("加载ProtoBuf文件" , filename)
|
|||
|
|
local source = f:read "*a"
|
|||
|
|
f:close()
|
|||
|
|
protoc:load(source)
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--获取当前服的集群配置
|
|||
|
|
function GameConfig:GetCurClusterServerCfg( id )
|
|||
|
|
for k, v in pairs( self.ClusterServerConfig ) do
|
|||
|
|
if id == v.serverId then
|
|||
|
|
return v
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
return nil
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--将染色的家具id转化为正常id
|
|||
|
|
function GameConfig:RestoreGeneralID( id )
|
|||
|
|
if id >= 100000 then
|
|||
|
|
id = id % 100000
|
|||
|
|
end
|
|||
|
|
return id
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--获取玩家当前配置
|
|||
|
|
function GameConfig:GetInitHouseData( houseId )
|
|||
|
|
return self["InitHouse_HousePreData"..houseId ]
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--获取玩家当前配置
|
|||
|
|
function GameConfig:GetPlayerCurCfg( player , cfgName , id )
|
|||
|
|
if "Furniture" == cfgName and id > 100000 then
|
|||
|
|
id = id %100000
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
local cfg = self[ cfgName ] --默认主配置
|
|||
|
|
if self:GetConfigType("A" , 1) == player.basicInfo.configType and self[ self:GetConfigType( "A" , 2 ) .. "_"..cfgName ] then
|
|||
|
|
cfg = self[ self:GetConfigType( "A" , 2 ).."_"..cfgName ]
|
|||
|
|
elseif self:GetConfigType("B" , 1) == player.basicInfo.configType and self[ self:GetConfigType( "B" , 2 ) .. "_"..cfgName ] then
|
|||
|
|
cfg = self[ self:GetConfigType( "B" , 2 ).."_"..cfgName ]
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
if "Level" == cfgName then
|
|||
|
|
for k, v in pairs( cfg ) do
|
|||
|
|
if id == v.level then
|
|||
|
|
return v
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
for k, v in pairs( cfg ) do
|
|||
|
|
if id == v.id then
|
|||
|
|
return v
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
return nil
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--获取玩家所有配置
|
|||
|
|
function GameConfig:GetPlayerAllCfg( player , cfgName )
|
|||
|
|
local configType = nil
|
|||
|
|
if nil == player then
|
|||
|
|
configType = "Main" --player为空就直接取主配置
|
|||
|
|
else
|
|||
|
|
configType = player.basicInfo.configType
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
local cfg = self[ cfgName ]
|
|||
|
|
if self:GetConfigType("A" , 1) == configType and self[ self:GetConfigType( "A" , 2 ) "_" .. cfgName ] then
|
|||
|
|
cfg = self[ self:GetConfigType( "A" , 2 ) .. "_"..cfgName ]
|
|||
|
|
elseif self:GetConfigType("B" , 1) == configType and self[ self:GetConfigType( "B" , 2 ) .."_"..cfgName ] then
|
|||
|
|
cfg = self[ self:GetConfigType( "B" , 2 ) .. "_"..cfgName ]
|
|||
|
|
end
|
|||
|
|
return cfg
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--获取玩家所有配置
|
|||
|
|
function GameConfig:GetAllCfg( cfgName )
|
|||
|
|
return self[ cfgName ]
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--获取玩家所有配置
|
|||
|
|
function GameConfig:GetCurCfg( cfgName , id )
|
|||
|
|
for k, v in pairs( self[ cfgName ] ) do
|
|||
|
|
if id == v.id then
|
|||
|
|
return v
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
return nil
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--获取购买货币信息
|
|||
|
|
function GameConfig:GetBuyMoney( player , cfgName , id )
|
|||
|
|
local cfgCur = skynet.server.gameConfig:GetPlayerCurCfg( player , cfgName , id )
|
|||
|
|
if dataType.MoneyType_No == cfgCur.currencyBuy then
|
|||
|
|
return cfgCur.currencyBuy , 0
|
|||
|
|
elseif dataType.MoneyType_Coin == cfgCur.currencyBuy then
|
|||
|
|
return cfgCur.currencyBuy , cfgCur.coin
|
|||
|
|
elseif dataType.MoneyType_Map == cfgCur.currencyBuy then
|
|||
|
|
return cfgCur.currencyBuy , cfgCur.mapCoin
|
|||
|
|
elseif dataType.MoneyType_Volute == cfgCur.currencyBuy then
|
|||
|
|
return cfgCur.currencyBuy , cfgCur.voluteCoin
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--通过awardId获取对应奖励的信息 货币奖励Player:GiveReward()处理
|
|||
|
|
function GameConfig:AwardInfo( rewardId )
|
|||
|
|
local Reward = self.Reward --获取配置文件Reward中的数据
|
|||
|
|
local Furniture = self.Furniture --获取配置文件Furniture中的数据
|
|||
|
|
local Clothes = self.Clothes --获取配置文件Clothes中的数据
|
|||
|
|
local PetClothes = self.PetClothes --获取配置文件PetClothes中的数据
|
|||
|
|
local ClothesSuit = self.ClothesSuit --获取配置文件ClothesSuit中的数据
|
|||
|
|
local reward = {}
|
|||
|
|
for k ,v in pairs(Reward) do
|
|||
|
|
if rewardId==v.id then
|
|||
|
|
--场景物品(恒定数量为1) 1=furniture 2=decoration 物品类型_物品id 1_123
|
|||
|
|
if next(v.sceneObject) ~=nil then
|
|||
|
|
for k1 ,v1 in pairs(v.sceneObject) do
|
|||
|
|
local arr = skynet.server.common:Split(v1 , "_")
|
|||
|
|
arr[1],arr[2] = tonumber(arr[1]),tonumber(arr[2])
|
|||
|
|
if arr[1]==1 then
|
|||
|
|
local type = pb.enum("EnumGoodsType" , "Furniture")
|
|||
|
|
table.insert(reward , {type=type, id=arr[2] ,count=1})
|
|||
|
|
elseif arr[1]==2 then
|
|||
|
|
local type = pb.enum("EnumGoodsType" , "Decorate")
|
|||
|
|
table.insert(reward , {type=type, id=arr[2] ,count=1})
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
--服饰物品(恒定数量为1)1=人物 2=宠物 类型_衣服id 1_123
|
|||
|
|
if next(v.appearanceObject) ~=nil then
|
|||
|
|
for k1 ,v1 in pairs(v.appearanceObject) do
|
|||
|
|
local arr = skynet.server.common:Split(v1 , "_")
|
|||
|
|
arr[1],arr[2] = tonumber(arr[1]),tonumber(arr[2])
|
|||
|
|
if arr[1]==1 then
|
|||
|
|
local type = pb.enum("EnumGoodsType" , "Clothes")
|
|||
|
|
table.insert(reward , {type=type, id=arr[2] ,count=1})
|
|||
|
|
elseif arr[1]==2 then
|
|||
|
|
local type = pb.enum("EnumGoodsType" , "PetClothes")
|
|||
|
|
table.insert(reward , {type=type, id=arr[2] ,count=1})
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
--套装物品(恒定数量为1) 1=家装 2=服装 类型_套装id 1_1
|
|||
|
|
if next(v.suitObject)~=nil then
|
|||
|
|
for k1 ,v1 in pairs(v.suitObject) do
|
|||
|
|
local arr = skynet.server.common:Split(v1 , "_")
|
|||
|
|
arr[1],arr[2] = tonumber(arr[1]),tonumber(arr[2])
|
|||
|
|
if arr[1]==1 then
|
|||
|
|
--获取家具对应的套装物品
|
|||
|
|
for k2 ,v2 in pairs(Furniture) do
|
|||
|
|
if v2.suitType == arr[2] then
|
|||
|
|
local type = pb.enum("EnumGoodsType" , "Furniture")
|
|||
|
|
table.insert(reward , {type=type, id=v2.id ,count=1})
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
elseif arr[1]==2 then
|
|||
|
|
local type = nil
|
|||
|
|
for k2 ,v2 in pairs(ClothesSuit) do
|
|||
|
|
if v2.id==arr[2] then
|
|||
|
|
--获取该套装类型
|
|||
|
|
type = v2.type
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
if type == 1 then
|
|||
|
|
--获取人物服装对应的套装物品
|
|||
|
|
for k2 ,v2 in pairs(Clothes) do
|
|||
|
|
if v2.suitId == arr[2] then
|
|||
|
|
local type = pb.enum("EnumGoodsType" , "Clothes")
|
|||
|
|
table.insert(reward , {type=type, id=v2.id ,count=1})
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
elseif type == 2 then
|
|||
|
|
--获取动物服装对应的套装物品
|
|||
|
|
for k2 ,v2 in pairs(PetClothes) do
|
|||
|
|
if v2.suitId == arr[2] then
|
|||
|
|
local type = pb.enum("EnumGoodsType" , "PetClothes")
|
|||
|
|
table.insert(reward , {type=type, id=v2.id ,count=1})
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
--道具 类型_数量 id 3_10
|
|||
|
|
if next(v.ticket)~=nil then
|
|||
|
|
for k1 ,v1 in pairs(v.ticket) do
|
|||
|
|
local arr = skynet.server.common:Split(v1 , "_")
|
|||
|
|
arr[1],arr[2] = tonumber(arr[1]),tonumber(arr[2])
|
|||
|
|
local type = pb.enum("EnumGoodsType" , "Prop")
|
|||
|
|
table.insert(reward , {type=type, id=arr[1] ,count=arr[2]})
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
--种子 id_数量 id 3_10
|
|||
|
|
if next(v.seed)~=nil then
|
|||
|
|
for k1 ,v1 in pairs(v.seed) do
|
|||
|
|
local arr = skynet.server.common:Split(v1 , "_")
|
|||
|
|
arr[1],arr[2] = tonumber(arr[1]),tonumber(arr[2])
|
|||
|
|
table.insert(reward , {type=dataType.GoodsType_Seed, id=arr[1] ,count=arr[2]})
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
--个人物品
|
|||
|
|
if next(v.stuff)~=nil then
|
|||
|
|
for k1, v1 in pairs( v.stuff ) do
|
|||
|
|
local arr = skynet.server.common:Split(v1 , "_")
|
|||
|
|
arr[1],arr[2] = tonumber(arr[1]),tonumber(arr[2])
|
|||
|
|
table.insert(reward , {type=dataType.GoodsType_HeadAndHeadFrame, id=arr[2] ,count=1 })
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
--食材
|
|||
|
|
if next(v.cuisineMaterial)~=nil then
|
|||
|
|
for k1, v1 in pairs( v.cuisineMaterial ) do
|
|||
|
|
local arr = skynet.server.common:Split(v1 , "_")
|
|||
|
|
arr[1],arr[2] = tonumber(arr[1]),tonumber(arr[2])
|
|||
|
|
table.insert(reward , {type=dataType.GoodsType_CuisineMaterial, id=arr[1] ,count=arr[1] })
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
break
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
return reward
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--是否为多Redis
|
|||
|
|
function GameConfig:IsMultiRedis()
|
|||
|
|
if skynet.server.redisUser1 and skynet.server.redisUser2 then
|
|||
|
|
return true
|
|||
|
|
else
|
|||
|
|
return false
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--是否正式服
|
|||
|
|
function GameConfig:IsOnline()
|
|||
|
|
return self.BasicConfig.isOnline
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--是否开启测试
|
|||
|
|
function GameConfig:IsTest()
|
|||
|
|
return self.BasicConfig.isTest or false
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--是否开启审核
|
|||
|
|
function GameConfig:IsAudit()
|
|||
|
|
return self.BasicConfig.isAudit or false
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--是否三测(光子服)
|
|||
|
|
function GameConfig:Is3TestServer()
|
|||
|
|
return self.BasicConfig.is3TestServer or false
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--是否开启白名单
|
|||
|
|
function GameConfig:IsWhiteList()
|
|||
|
|
return self.BasicConfig.isWhiteList or false
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--是否开启MongoDB
|
|||
|
|
function GameConfig:IsMongoDB()
|
|||
|
|
if skynet.server.gameConfig.MongDBConfig then
|
|||
|
|
return true
|
|||
|
|
else
|
|||
|
|
return false
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
skynet.server.gameConfig = GameConfig
|
|||
|
|
return GameConfig
|