65 lines
1.8 KiB
Lua
65 lines
1.8 KiB
Lua
local skynet = require "skynet"
|
|
local oo = require "Class"
|
|
local log = require "Log"
|
|
local pb = require "pb"
|
|
local dataType = require "DataType"
|
|
local errorInfo = require "ErrorInfo"
|
|
local Remake = oo.class()
|
|
|
|
Remake.ShopStatus_Lock = 1 --未解锁
|
|
Remake.ShopStatus_UnLock = 2 --已解锁
|
|
Remake.ShopStatus_UnOpen = 3 --暂未开放
|
|
Remake.ShopStatus_GoOut = 4 --店主外出
|
|
|
|
--[[
|
|
CMD_C2S_RemakeGenerate = 1143; //重造物品开始生成
|
|
CMD_S2C_RemakeGenerate = 1144;
|
|
|
|
//重造物品开始生成
|
|
message C2SRemakeGenerate
|
|
{
|
|
int32 type = 1; //商品类型 参考协议最前面
|
|
int32 id = 2; //商品在该goodsType类型下配置中的id
|
|
int32 count = 3; //商品数量
|
|
}
|
|
|
|
//重造物品开始生成
|
|
message S2CRemakeGenerate
|
|
{
|
|
PBBagItem goodsInfo = 1; //商品信息
|
|
}
|
|
]]
|
|
|
|
function Remake:InitData( player )
|
|
local id = 1
|
|
local isExist = false
|
|
for k, v in pairs( player.gameData.Remake ) do
|
|
if id == v.id then
|
|
isExist = true
|
|
end
|
|
end
|
|
|
|
if not isExist then
|
|
table.insert( player.gameData.Remake , { id = id , status = self.ShopStatus_Lock })
|
|
end
|
|
end
|
|
|
|
--重造物品开始生成
|
|
function Remake:Generate( player , c2sData , s2cData )
|
|
c2sData.data = assert(pb.decode("C2SRemakeGenerate", c2sData.data ))
|
|
local type = c2sData.data.type
|
|
local id = c2sData.data.id
|
|
local count = c2sData.data.count
|
|
local data = {}
|
|
if not type or not id or not count then
|
|
s2cData.code = errorInfo.ErrorCode.ErrRequestParam
|
|
else
|
|
data.goodsInfo = {}
|
|
end
|
|
s2cData.cmd = pb.enum("MsgType","CMD_S2C_RemakeGenerate")
|
|
s2cData.data = assert(pb.encode("S2CRemakeGenerate", data))
|
|
end
|
|
|
|
|
|
skynet.server.remake = Remake
|
|
return Remake |