122 lines
2.9 KiB
Lua
122 lines
2.9 KiB
Lua
ZhuangBeiFenJieOBJ = Up_BaseClass:new()
|
|
|
|
|
|
ZhuangBeiFenJieOBJ._name = "ZhuangBeiFenJieOBJ"
|
|
|
|
-- NPCID
|
|
ZhuangBeiFenJieOBJ.id = { 9 }
|
|
|
|
for i, v in ipairs(ZhuangBeiFenJieOBJ.id or {}) do
|
|
Npc.clicknpcCfg[v] = ZhuangBeiFenJieOBJ
|
|
end
|
|
|
|
|
|
ZhuangBeiFenJieOBJ.fjtbl = Func.require("cfg_装备分解")
|
|
local function ZhuangBeiFenJieOBJ_for()
|
|
local tbl = {}
|
|
local str = {}
|
|
for i, v in ipairs(ZhuangBeiFenJieOBJ.fjtbl or {}) do
|
|
for k, value in pairs(v) do
|
|
if not tbl[k] then
|
|
tbl[k] = {}
|
|
end
|
|
table.insert(tbl[k], value)
|
|
if not str[k] then
|
|
str[k] = {}
|
|
end
|
|
table.insert(str[k], string.format("%s&%d#%d", value[1], value[2], value[3]))
|
|
end
|
|
end
|
|
return tbl, str
|
|
end
|
|
|
|
|
|
|
|
ZhuangBeiFenJieOBJ.fj, ZhuangBeiFenJieOBJ.qzstr = ZhuangBeiFenJieOBJ_for()
|
|
|
|
|
|
ZhuangBeiFenJieOBJ.onlywhere = {
|
|
[3] = true,
|
|
[4] = true,
|
|
[5] = true,
|
|
[6] = true,
|
|
[7] = true,
|
|
[8] = true,
|
|
[10] = true,
|
|
[11] = true,
|
|
[2] = true,
|
|
}
|
|
|
|
|
|
-- 配置文件
|
|
ZhuangBeiFenJieOBJ.cfg = {
|
|
fj = ZhuangBeiFenJieOBJ.fj,
|
|
list = Func.require("cfg_装备分解列表"),
|
|
xh = {
|
|
[1] = { "金币", 150000, 1 },
|
|
[2] = { "金币", 100000, 1 },
|
|
[3] = { "金币", 50000, 1 },
|
|
[4] = { "金币", 50000, 1 },
|
|
[5] = { "金币", 50000, 1 },
|
|
},
|
|
}
|
|
|
|
local function ZhuangBeiFenJieOBJ_forlist()
|
|
local tbl = {}
|
|
for i, v in ipairs(ZhuangBeiFenJieOBJ.cfg.list) do
|
|
tbl[v.name] = v.level
|
|
end
|
|
return tbl
|
|
end
|
|
|
|
|
|
ZhuangBeiFenJieOBJ.itemlist = ZhuangBeiFenJieOBJ_forlist()
|
|
|
|
|
|
---* 加入上线同步数据
|
|
Player.sycCfg[ZhuangBeiFenJieOBJ._name] = ZhuangBeiFenJieOBJ.cfg
|
|
|
|
|
|
function ZhuangBeiFenJieOBJ:up(actor, p1, p2, p3, data)
|
|
local fj_item = data[1]
|
|
if not fj_item or not Npc.CheckNPCRange(actor, 9) then
|
|
return
|
|
end
|
|
|
|
|
|
if not ZhuangBeiFenJieOBJ.itemlist[fj_item] then
|
|
Func.sendmsg9(actor, "此物品不可分解!")
|
|
return
|
|
end
|
|
|
|
local need = getdbitemfieldvalue(fj_item, ConstCfg.ItemConfig[10][1])
|
|
local needLevel = getdbitemfieldvalue(fj_item, ConstCfg.ItemConfig[11][1])
|
|
|
|
|
|
local xh = {
|
|
self.cfg.xh[needLevel],
|
|
{ fj_item, 1, 0 }
|
|
}
|
|
|
|
if Func.takeitmes(actor, xh, true, true) then
|
|
local result1, result2 = ransjstr(table.concat(self.qzstr[needLevel], "|"), 1, 3)
|
|
local part = Func.splitString(result1, "&")
|
|
|
|
if part[1] then
|
|
setflagstatus(actor, VarCfg.Falg_fangshua, 1)
|
|
|
|
if getstditeminfo(part[1], ConstCfg.stditeminfo.idx) < 5 and getflagstatus(actor, VarCfg.Falg_tequan) == 0 then
|
|
part[1] = "绑定" .. part[1]
|
|
end
|
|
|
|
|
|
Func.givesitem(actor, { { part[1], tonumber(part[2]), 0 } }, "装备分解", false)
|
|
|
|
Func.sendmsg9(actor, string.format("[装备分解]:#70|分解成功,获得:#255|%s#215|.#255", part[1] .. "x" .. part[2]))
|
|
end
|
|
end
|
|
end
|
|
|
|
ZhuangBeiFenJieOBJ.allowFunc = {"up"}
|
|
|
|
return ZhuangBeiFenJieOBJ
|