local ui = {}
local _V = function(...) return SL:GetMetaValue(...) end
local FUNCQUEUE = {}
local TAGOBJ = {}
function ui.init(parent, data, update)
if update then return ui.update(data) end
-- Create Node_1
local Node_1 = GUI:Node_Create(parent, "N
🤖 回答引擎: 浮生梦专用2 |
🕒 时间: 2026-03-06 22:13:31 |
👁️ 阅读: 15
--前端开始]]
local npc = {}
npc.CONFIG = {
MSG_ID = 9999,
UI_NAME = "转生系统",
Maxlv = 10,
needItems = {"法师之星", "金币"},
levels = {
[1] = {needlevel = 75, needNum = {10, 10000000}},
[2] = {needlevel = 75, needNum = {20, 20000000}},
[3] = {needlevel = 75, needNum = {40, 30000000}},
[4] = {needlevel = 75, needNum = {80, 40000000}},
[5] = {needlevel = 75, needNum = {160, 50000000}},
[6] = {needlevel = 75, needNum = {320, 60000000}},
[7] = {needlevel = 75, needNum = {640, 70000000}},
[8] = {needlevel = 75, needNum = {1280, 80000000}},
[9] = {needlevel = 75, needNum = {2560, 90000000}},
[10] = {needlevel = 75, needNum = {5120, 100000000}},
}
}
function npc:Lmain()
local ui = GUI:npcUi(self.CONFIG.UI_NAME)
self.ui = ui
self:updateUI()
GUI:onClick(ui.sendbtn, function()
SL:sendServer(self.CONFIG.MSG_ID, 1, 0, 0, "")
SL:yanshi(function()
self:updateUI()
end)
end)
end
function npc:updateUI()
if not self.ui then return end
local reLv = tonumber(SL:GetMetaValue("RELEVEL")) or 0
if reLv > self.CONFIG.Maxlv then
reLv = self.CONFIG.Maxlv
end
GUI:setText(self.ui.Text_1, "转生系统")
GUI:setText(self.ui.Text_str, "75级后可入雷劫之地转生,转生后等级重置为1级,属性、战力随转生次数跃升。每次转生成功获5 - 5攻魔道双防 + 5% HP上限,每阶段转生仅需消耗一次材料。")
local nextInfo = self.CONFIG.levels[reLv + 1]
if nextInfo then
GUI:ItemShow_updateItem(self.ui.ItemShow_fszx, {
index = SL:itemname2idx("法师之星"),
count = nextInfo.needNum[1],
})
GUI:ItemShow_updateItem(self.ui.itemshow_money, {
index = 1,
count = nextInfo.needNum[2],
})
end
end
--前端结束]]
function npc:Smain(actor, p1, p2, p3, str)
local player = class(actor)
if not player then return end
local dis = {
[1] = self.func1,
}
local handler = dis[p1]
if handler then
handler(self, actor, player, p2, p3, str)
else
player:send("未知的操作请求! 错误码:" .. tostring(p1))
end
end
function npc:func1(actor, player, p2, p3, str)
local reLv = getbaseinfo(actor, 39)
if reLv >= self.CONFIG.Maxlv then
player:send("已满级")
return
end
local nextInfo = self.CONFIG.levels[reLv + 1]
if not nextInfo then
player:send("配置错误")
return
end
if getbaseinfo(actor, 6) < nextInfo.needlevel then
player:send("等级不足")
return
end
if not player:checkitem("法师之星", nextInfo.needNum[1]) then
player:send("法师之星不足")
return
end
if not player:checkmoney("金币", nextInfo.needNum[2]) then
player:send("金币不足")
return
end
player:take("法师之星", nextInfo.needNum[1])
player:money("金币", "-", nextInfo.needNum[2])
player:addReLevel()
player:send("转生成功!当前转生等级:" .. (reLv + 1))
local att = string.format("3#4#%s|3#6#%s|3#8#%s", 5, 5, 5)
player:attlist("转生属性加成", att)
end
return npc
--前端开始]]
local npc = {}
npc.CONFIG = {
MSG_ID = 9999,
UI_NAME = "转生系统",
Maxlv = 10,
needItems = {"法师之星", "金币"},
levels = {
[1] = {needlevel = 75, needNum = {10, 10000000}},
[2] = {needlevel = 75, needNum = {20, 20000000}},
[3] = {needlevel = 75, needNum = {40, 30000000}},
[4] = {needlevel = 75, needNum = {80, 40000000}},
[5] = {needlevel = 75, needNum = {160, 50000000}},
[6] = {needlevel = 75, needNum = {320, 60000000}},
[7] = {needlevel = 75, needNum = {640, 70000000}},
[8] = {needlevel = 75, needNum = {1280, 80000000}},
[9] = {needlevel = 75, needNum = {2560, 90000000}},
[10] = {needlevel = 75, needNum = {5120, 100000000}},
}
}
function npc:Lmain()
local ui = GUI:npcUi(self.CONFIG.UI_NAME)
self.ui = ui
self:updateUI()
GUI:onClick(ui.sendbtn, function()
SL:sendServer(self.CONFIG.MSG_ID, 1, 0, 0, "")
SL:yanshi(function()
self:updateUI()
end)
end)
end
function npc:updateUI()
if not self.ui then return end
local reLv = tonumber(SL:GetMetaValue("RELEVEL")) or 0
if reLv > self.CONFIG.Maxlv then
reLv = self.CONFIG.Maxlv
end
GUI:setText(self.ui.Text_1, "转生系统")
GUI:setText(self.ui.Text_str, "75级后可入雷劫之地转生,转生后等级重置为1级,属性、战力随转生次数跃升。每次转生成功获5 - 5攻魔道双防 + 5% HP上限,每阶段转生仅需消耗一次材料。")
local nextInfo = self.CONFIG.levels[reLv + 1]
if nextInfo then
GUI:ItemShow_updateItem(self.ui.ItemShow_fszx, {
index = SL:itemname2idx("法师之星"),
count = nextInfo.needNum[1],
})
GUI:ItemShow_updateItem(self.ui.itemshow_money, {
index = 1,
count = nextInfo.needNum[2],
})
end
end
--前端结束]]
function npc:Smain(actor, p1, p2, p3, str)
local player = class(actor)
if not player then return end
local dis = {
[1] = self.func1,
}
local handler = dis[p1]
if handler then
handler(self, actor, player, p2, p3, str)
else
player:send("未知的操作请求! 错误码:" .. tostring(p1))
end
end
function npc:func1(actor, player, p2, p3, str)
local reLv = getbaseinfo(actor, 39)
if reLv >= self.CONFIG.Maxlv then
player:send("已满级")
return
end
local nextInfo = self.CONFIG.levels[reLv + 1]
if not nextInfo then
player:send("配置错误")
return
end
if getbaseinfo(actor, 6) < nextInfo.needlevel then
player:send("等级不足")
return
end
if not player:checkitem("法师之星", nextInfo.needNum[1]) then
player:send("法师之星不足")
return
end
if not player:checkmoney("金币", nextInfo.needNum[2]) then
player:send("金币不足")
return
end
player:take("法师之星", nextInfo.needNum[1])
player:money("金币", "-", nextInfo.needNum[2])
player:addReLevel()
player:send("转生成功!当前转生等级:" .. (reLv + 1))
local att = string.format("3#4#%s|3#6#%s|3#8#%s", 5, 5, 5)
player:attlist("转生属性加成", att)
end
return npc
← 返回问答库