local XianzhiLogic = require("xianzhi.XianzhiLogic")


-- 先知查询
function CG_XIANZHI_QUERY(human, msg)
	XianzhiLogic.query(human, msg.type)
end

-- 召唤
function CG_XIANZHI_ZHAOHUAN_DO(human, msg)
	local Log = require("common.Log")
	local drawType = (msg.cnt == 10) and "10连" or ((msg.cnt == 1) and "单抽" or "未知")
	-- Log.write(Log.LOGID_DEBUG, "[CG_XIANZHI_ZHAOHUAN_DO] 收到天命召唤请求("..drawType.."): uuid="..(human.db._id or "nil")..", camp="..(msg.camp or "nil")..", cnt="..(msg.cnt or "nil")..", skip="..(msg.skip or "nil"))
	
	-- -- 验证cnt参数
	-- if msg.cnt ~= 1 and msg.cnt ~= 10 then
	-- 	Log.write(Log.LOGID_DEBUG, "[CG_XIANZHI_ZHAOHUAN_DO] WARNING: cnt值异常，不是1或10: cnt="..(msg.cnt or "nil"))
	-- end
	
	XianzhiLogic.zhaohuanDo(human, msg.camp, msg.cnt, msg.skip)
end

-- 置换
function CG_XIANZHI_ZHIHUAN_QUERY(human, msg)
	XianzhiLogic.zhihuanQuery(human, msg.heroID, msg.heroIndex)
end

function CG_XIANZHI_ZHIHUAN_DO(human, msg)
	XianzhiLogic.zhihuanDo(human, msg.heroID, msg.heroIndex)
end

function CG_XIANZHI_DETAIL(human, msg)
    XianzhiLogic.detail(human, msg.camp)
end

function CG_XIANZHI_ZHIHUAN_PREVIEW(human, msg)
	XianzhiLogic.preview(human, msg.camp, msg.star)
end

function CG_XIANZHI_SHOP_QUERY(human,msg)
	XianzhiLogic.shopQuery(human)
end

function CG_XIANZHI_SHOP_BUY(human,msg)
	XianzhiLogic.shopBuy(human,msg.id,msg.count)
end