装备合成脚本
module('Market_Def_通用脚本_合成师傅-3', package.seeall)local HCtext = {
[1] = { '兽皮腰带', '兽皮腰带+1', 2, '黑铁矿石', 5, 10, 100 },
[2] = { '兽皮腰带+1', '兽皮腰带+2', 2, '黑铁矿石', 5, 10, 90 },
[3] = { '兽皮腰带+2', '兽皮腰带+3', 2, '黑铁矿石', 5, 10, 50 },
[4] = { '兽皮腰带+3', '兽皮腰带+4', 2, '黑铁矿石', 5, 10, 30 },
[5] = { '兽皮腰带+4', '兽皮腰带+5', 2, '黑铁矿石', 5, 10, 10 },
[6] = { '布鞋', '布鞋+1', 2, '黑铁矿石', 5, 10, 100 },
[7] = { '布鞋+1', '布鞋+2', 2, '黑铁矿石', 5, 10, 90 },
[8] = { '布鞋+2', '布鞋+3', 2, '黑铁矿石', 5, 10, 50 },
[9] = { '布鞋+3', '布鞋+4', 2, '黑铁矿石', 5, 10, 30 },
[10] = { '布鞋+4', '布鞋+5', 2, '黑铁矿石', 5, 10, 10 },
[11] = { '勋章', '勋章+1', 2, '黑铁矿石', 5, 10, 100 },
[12] = { '勋章+1', '勋章+2', 2, '黑铁矿石', 5, 10, 90 },
[13] = { '勋章+2', '勋章+3', 2, '黑铁矿石', 5, 10, 50 },
[14] = { '勋章+3', '勋章+4', 2, '黑铁矿石', 5, 10, 30 },
[15] = { '勋章+4', '勋章+5', 2, '黑铁矿石', 5, 10, 10 },
}
function main(Npc, Actor)
local S = [[
<&TEXT:[--装备合成--]:140:20{FCOLOR=250;FSIZE=24;FNAME=黑体}>
<&TEXT:[腰带系列]:230:70{FCOLOR=250;FSIZE=12;FNAME=黑体}>
<&ItemShow:501:0:70:100:1:1/@HeCheng(1)><&ItemShow:502:0:250:100:1:1/@HeCheng(2)><&ItemShow:503:0:430:100:1:1/@HeCheng(3)>
<&ItemShow:504:0:70:150:1:1/@HeCheng(4)><&ItemShow:505:0:250:150:1:1/@HeCheng(5)><&ItemShow:506:0:430:150:1:1/@HeCheng(6)>
<&TEXT:[靴子系列]:230:195{FCOLOR=250;FSIZE=12;FNAME=黑体}>
<&ItemShow:495:0:70:220:1:1/@HeCheng(7)><&ItemShow:496:0:250:220:1:1/@HeCheng(8)><&ItemShow:497:0:430:220:1:1/@HeCheng(9)>
<&ItemShow:498:0:70:270:1:1/@HeCheng(10)><&ItemShow:499:0:250:270:1:1/@HeCheng(11)><&ItemShow:500:0:430:270:1:1/@HeCheng(12)>
<&TEXT:[勋章系列]:230:315{FCOLOR=250;FSIZE=12;FNAME=黑体}>
<&ItemShow:450:0:70:340:1:1/@HeCheng(13)><&ItemShow:453:0:250:340:1:1/@HeCheng(14)><&ItemShow:454:0:430:340:1:1/@HeCheng(15)>
vvlib:OpenMerchantBigDlg(Actor, 14, 1, 1, 4, 0, 0, 1, 522, 0, 1) --大对话框
Npc:Say(Actor, '', S, false)
end
function HeCheng(Npc, Actor, NUM)
local CanShu = tonumber(NUM)
local UserItem
local ZBconut1 = 0
local ZBconut2 = 0
local list = Actor.BagItemList
--print('CanShu:' .. CanShu)
for index, value in ipairs(HCtext) do
if index == CanShu then
--print('Index:' .. index .. 'value:' .. '(' .. value .. ')')
--print( value)
--print(value)
--print(value)
for I = 1, #list do
UserItem = vvlib:TUserItem(list[I]) --获取背包物品对象
--print(I, UserItem.MakeIndex, UserItem.Index, '物品名称:' .. UserItem.Name)
if UserItem.Name == value[1] then
ZBconut1 = ZBconut1 + 1
--print(UserItem.Name)
--print(ZBconut1)
elseif UserItem.Name == value[4] then
ZBconut2 = ZBconut2 + 1
--print(ZBconut2)
--print(value)
end
end
if ZBconut1 < value[3] then
Npc:MessageBox(Actor, "合成条件不满足,缺少的物品为:" .. (value[1] .. '需有数量' .. value[3]))
elseif ZBconut2 < value[5] then
Npc:MessageBox(Actor, "合成条件不满足,缺少的物品为:" .. (value[4] .. '需有数量' .. value[5]))
elseif not Actor:CheckMoney(2, value[6]) then
Npc:MessageBox(Actor, "合成条件不满足,缺少的物品为:" .. (元宝 .. '需有数量' .. value[7]))
elseif ZBconut1 >= value[3] and
ZBconut2 >= value[5] and
Actor:CheckMoney(2, value[6]) and
math.random(1, 100) < value[7] then --随机是否成共
Actor:DecGameGold(value[6])
vvlib:Give(Npc, Actor, value[2], 1, false) --给一件普通装备
vvlib:Take(Npc, Actor, value[1], value[3]) --拿走装备材料
vvlib:Take(Npc, Actor, value[4], value[5]) --拿走黑铁矿石
Actor:DelBagItem(UserItem) --删除背包物品
Actor:SendDelItem(UserItem) --通知客户端删除物品
Actor:SysMsg('成功', 249, 255, 1)
else --失败不给装备
Actor:DecGameGold(value[6])
--vvlib:Give(Npc, Actor, value, 1, false) --给一件普通装备
vvlib:Take(Npc, Actor, value[1], value[3]) --拿走装备材料
vvlib:Take(Npc, Actor, value[4], value[5]) --拿走黑铁矿石
Actor:DelBagItem(UserItem) --删除背包物品
Actor:SendDelItem(UserItem) --通知客户端删除物品
Actor:SysMsg('成功', 249, 255, 1)
end
end
end
end
大佬66666
页:
[1]