function x900022_LuaFnBuyNotEnoughMaterial(sceneId,selfId,ItemID,nMaterialNum,nPayCheck,nExMsg)
--x900022_g_ShopItemTable[shopA][shopB][nRealIndex]
--得到不够材料的价格
local nItemPrice = LuaFnGetNotEnoughMaterialPrice(sceneId,ItemID);
if nItemPrice == 0 then
x900022_NotifyTip( sceneId, selfId, format("元宝商城暂时没有%s销售,请到其他途径如交易、副本、活动中获取!",GetItemName(sceneId,ItemID)) )
return -1
end
BeginAddItem(sceneId)
AddItem(sceneId,ItemID,nMaterialNum)
if EndAddItem(sceneId,selfId) <= 0 then
x900022_NotifyTip( sceneId, selfId,StringTable_GetData(342) )
return
end
if nPayCheck ~= nil and nPayCheck >= 1 then
--SetMissionDataEx(sceneId,selfId,MD_SHOPSYS_ID,ItemID);因接口异常废弃
--SetMissionDataEx(sceneId,selfId,MD_SHOPSYS_NUM,nMaterialNum);
--SetMissionDataEx(sceneId,selfId,MD_SHOPSYS_PRICE,nItemPrice);
--改临时,这里快捷购买东西不会存在过场景之间的操作
LuaFnSetGlobalPlayerData(sceneId,selfId,1,ItemID)
LuaFnSetGlobalPlayerData(sceneId,selfId,2,nMaterialNum)
LuaFnSetGlobalPlayerData(sceneId,selfId,3,nItemPrice)
BeginUICommand(sceneId)
if nExMsg == nil then
UICommand_AddString(sceneId,"#cfff263你确认花费#G"..nItemPrice.."#cfff263元宝来购买#G"..nMaterialNum.."件"..GetItemName(sceneId,ItemID).."#cfff263吗?")
else
UICommand_AddString(sceneId,nExMsg)
end
EndUICommand(sceneId)
DispatchUICommand(sceneId,selfId, 1000000002)
return -1
else
local nYuanBao = YuanBao(sceneId,selfId,selfId,3,0)
if nYuanBao < nItemPrice then
x900022_NotifyTip( sceneId, selfId, format(StringTable_GetData(341),nItemPrice) )
return -1
end
LuaFnCostYuanBao(sceneId,selfId,nItemPrice)
local nItemPos = -1
for i = 1,nMaterialNum do
nItemPos = TryRecieveItem(sceneId,selfId,ItemID,1)
end
x900022_NotifyTip( sceneId, selfId, "购买了"..tostring(nMaterialNum).."个"..GetItemName(sceneId,ItemID))
return nItemPos
end
end