增加斗笠合成

This commit is contained in:
Admin 2026-06-21 19:32:27 +08:00
parent 3786ef888e
commit e098e0197c
28 changed files with 448 additions and 0 deletions

View file

@ -0,0 +1,188 @@
-- cfg_斗笠升级
local config = {
[1] = {
name = "战神斗笠",
success = 100,
cost = {
[1] = {
itemname = "雷霆斗笠",
itemnum = 1,
itembind = 0,
},
[2] = {
itemname = "金币",
itemnum = 500000,
itembind = 1,
},
},
reward = {
[1] = {
givename = "战神斗笠",
givenum = 1,
bind = 0,
},
},
},
[2] = {
name = "玛法斗笠",
success = 100,
cost = {
[1] = {
itemname = "战神斗笠",
itemnum = 1,
itembind = 0,
},
[2] = {
itemname = "金条",
itemnum = 1,
itembind = 0,
},
},
reward = {
[1] = {
givename = "玛法斗笠",
givenum = 1,
bind = 0,
},
},
},
[3] = {
name = "史诗斗笠",
success = 100,
cost = {
[1] = {
itemname = "玛法斗笠",
itemnum = 1,
itembind = 0,
},
[2] = {
itemname = "金条",
itemnum = 3,
itembind = 0,
},
},
reward = {
[1] = {
givename = "史诗斗笠",
givenum = 1,
bind = 0,
},
},
},
[4] = {
name = "传说斗笠",
success = 100,
cost = {
[1] = {
itemname = "史诗斗笠",
itemnum = 1,
itembind = 0,
},
[2] = {
itemname = "金条",
itemnum = 6,
itembind = 0,
},
},
reward = {
[1] = {
givename = "传说斗笠",
givenum = 1,
bind = 0,
},
},
},
[5] = {
name = "不朽斗笠",
success = 100,
cost = {
[1] = {
itemname = "传说斗笠",
itemnum = 1,
itembind = 0,
},
[2] = {
itemname = "金条",
itemnum = 15,
itembind = 0,
},
},
reward = {
[1] = {
givename = "不朽斗笠",
givenum = 1,
bind = 0,
},
},
},
[6] = {
name = "至尊斗笠",
success = 100,
cost = {
[1] = {
itemname = "不朽斗笠",
itemnum = 1,
itembind = 0,
},
[2] = {
itemname = "金条",
itemnum = 50,
itembind = 0,
},
},
reward = {
[1] = {
givename = "至尊斗笠",
givenum = 1,
bind = 0,
},
},
},
[7] = {
name = "混沌斗笠",
success = 100,
cost = {
[1] = {
itemname = "至尊斗笠",
itemnum = 1,
itembind = 0,
},
[2] = {
itemname = "金条",
itemnum = 100,
itembind = 0,
},
},
reward = {
[1] = {
givename = "混沌斗笠",
givenum = 1,
bind = 0,
},
},
},
[8] = {
name = "主宰斗笠",
success = 100,
cost = {
[1] = {
itemname = "混沌斗笠",
itemnum = 1,
itembind = 0,
},
[2] = {
itemname = "金条",
itemnum = 200,
itembind = 0,
},
},
reward = {
[1] = {
givename = "主宰斗笠",
givenum = 1,
bind = 0,
},
},
},
}
return config

View file

@ -0,0 +1,45 @@
DouLiShengJiOBJ = Up_BaseClass:new()
DouLiShengJiOBJ._name = "DouLiShengJiOBJ"
DouLiShengJiOBJ.id = { 53 }
for _, v in ipairs(DouLiShengJiOBJ.id or {}) do
Npc.clicknpcCfg[v] = DouLiShengJiOBJ
end
DouLiShengJiOBJ.cfg = Func.require("cfg_斗笠升级")
Player.sycCfg[DouLiShengJiOBJ._name] = DouLiShengJiOBJ.cfg
DouLiShengJiOBJ.allowFunc = { "up" }
function DouLiShengJiOBJ:main(actor, npcID)
Message:SubLink(actor, self._name .. "_main", { cfg = self.cfg, npcid = npcID })
end
function DouLiShengJiOBJ:up(actor, p1, p2, p3, data)
local id = data and tonumber(data[1]) or nil
if not id or not self.cfg[id] then
return
end
local cfg = table.Copy(self.cfg[id])
local cost = {}
for _, v in ipairs(cfg.cost or {}) do
table.insert(cost, { v.itemname, v.itemnum, v.itembind })
end
if Func.batchcheckitem(actor, cost, true, true) then
if Func.random(cfg.success or 0) then
local gives_tbl = {}
for _, v in ipairs(cfg.reward or {}) do
table.insert(gives_tbl, string.format("%s#%d#%d", v.givename, v.givenum, v.bind))
end
gives(actor, table.concat(gives_tbl, "&"))
Func.sendmsg9(actor, "[提示]:#70|斗笠升级成功!")
else
Func.sendmsg9(actor, "[提示]:#70|斗笠升级失败,请重新尝试!")
end
end
end
return DouLiShengJiOBJ

View file

@ -0,0 +1,105 @@
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 Layer
local Layer = GUI:Node_Create(parent, "Layer", 0, 0)
GUI:setTag(Layer, -1)
-- Create bg_close
local bg_close = GUI:Layout_Create(Layer, "bg_close", 0, 0, 1136, 640, false)
GUI:Layout_setBackGroundColorType(bg_close, 1)
GUI:Layout_setBackGroundColor(bg_close, "#000000")
GUI:Layout_setBackGroundColorOpacity(bg_close, 0)
GUI:setAnchorPoint(bg_close, 0.00, 0.00)
GUI:setTouchEnabled(bg_close, true)
GUI:setTag(bg_close, -1)
-- Create nd_root
local nd_root = GUI:Node_Create(Layer, "nd_root", 568, 320)
GUI:setTag(nd_root, 670)
TAGOBJ["670"] = nd_root
-- Create img_bg
local img_bg = GUI:Image_Create(nd_root, "img_bg", 0, 0, "res/custom/44/bg.png")
GUI:setChineseName(img_bg, "斗笠升级_背景图片")
GUI:setAnchorPoint(img_bg, 0.50, 0.50)
GUI:setTouchEnabled(img_bg, true)
GUI:setTag(img_bg, -1)
-- Create btn_close
local btn_close = GUI:Button_Create(img_bg, "btn_close", 769, 448, "res/public/1900000510.png")
GUI:Button_loadTexturePressed(btn_close, "res/public/1900000511.png")
GUI:setContentSize(btn_close, 26, 42)
GUI:setIgnoreContentAdaptWithSize(btn_close, false)
GUI:Button_setTitleText(btn_close, [[]])
GUI:Button_setTitleColor(btn_close, "#ffffff")
GUI:Button_setTitleFontSize(btn_close, 14)
GUI:Button_titleDisableOutLine(btn_close)
GUI:setAnchorPoint(btn_close, 0.00, 0.00)
GUI:setTouchEnabled(btn_close, true)
GUI:setTag(btn_close, -1)
-- Create btn_ListView
local btn_ListView = GUI:ListView_Create(img_bg, "btn_ListView", 51, 34, 193, 417, 1)
GUI:setAnchorPoint(btn_ListView, 0.00, 0.00)
GUI:setTouchEnabled(btn_ListView, true)
GUI:setTag(btn_ListView, 0)
-- Create Button_1
local Button_1 = GUI:Button_Create(btn_ListView, "Button_1", 0, 368, "res/custom/44/btn/1.png")
GUI:Button_setTitleText(Button_1, [[]])
GUI:Button_setTitleColor(Button_1, "#ffffff")
GUI:Button_setTitleFontSize(Button_1, 16)
GUI:Button_titleEnableOutline(Button_1, "#000000", 1)
GUI:setAnchorPoint(Button_1, 0.00, 0.00)
GUI:setTouchEnabled(Button_1, true)
GUI:setTag(Button_1, 0)
-- Create ItemShow
local ItemShow = GUI:ItemShow_Create(img_bg, "ItemShow", 500, 303, {index = 1, count = 1, look = true, bgVisible = false, color = 255})
GUI:setAnchorPoint(ItemShow, 0.50, 0.50)
GUI:setTag(ItemShow, 0)
ItemShow["object_config"] = {" "}
-- Create Text_success
local Text_success = GUI:Text_Create(img_bg, "Text_success", 498, 110, 16, "#00ff00", [[成功率80%]])
GUI:Text_enableOutline(Text_success, "#000000", 1)
GUI:setAnchorPoint(Text_success, 0.50, 0.50)
GUI:setTouchEnabled(Text_success, false)
GUI:setTag(Text_success, 0)
-- Create up_btn
local up_btn = GUI:Button_Create(img_bg, "up_btn", 433, 41, "res/custom/44/2.png")
GUI:Button_setTitleText(up_btn, [[]])
GUI:Button_setTitleColor(up_btn, "#ffffff")
GUI:Button_setTitleFontSize(up_btn, 16)
GUI:Button_titleEnableOutline(up_btn, "#000000", 1)
GUI:setAnchorPoint(up_btn, 0.00, 0.00)
GUI:setTouchEnabled(up_btn, true)
GUI:setTag(up_btn, 0)
-- Create cost_ItemShow_1
local cost_ItemShow_1 = GUI:ItemShow_Create(img_bg, "cost_ItemShow_1", 399, 209, {index = 1, count = 1, look = true, bgVisible = false, color = 255})
GUI:setAnchorPoint(cost_ItemShow_1, 0.50, 0.50)
GUI:setTag(cost_ItemShow_1, 0)
-- Create cost_ItemShow_2
local cost_ItemShow_2 = GUI:ItemShow_Create(img_bg, "cost_ItemShow_2", 600, 209, {index = 1, count = 1, look = true, bgVisible = false, color = 255})
GUI:setAnchorPoint(cost_ItemShow_2, 0.50, 0.50)
GUI:setTag(cost_ItemShow_2, 0)
ui.update(__data__)
return Layer
end
function ui.update(data)
for _, func in pairs(FUNCQUEUE) do
if func then func(data) end
end
end
return ui

View file

@ -0,0 +1,100 @@
DouLiShengJiOBJ = Up_BaseClassOBJ:new()
DouLiShengJiOBJ.__cname = "DouLiShengJiOBJ"
DouLiShengJiOBJ.cfg = {}
DouLiShengJiOBJ.UIfile = "game/B/DouLiShengJiUI"
DouLiShengJiOBJ.leftNum = 8
DouLiShengJiOBJ.id = 1
function DouLiShengJiOBJ:updata()
self.id = self.id or 1
local listview = self.ui.btn_ListView
local imgDir = "res/custom/44/btn/"
GUI:ListView_removeAllItems(listview)
for i = 1, self.leftNum do
local btnKey = string.format("list_btn_%d", i)
local isSelected = (self.id == i)
self.ui[btnKey] = GUI:Button_Create(listview, btnKey, 0, 0,
string.format("%s%s.png", imgDir, isSelected and tostring(i) or (i .. "a")))
GUI:addOnClickEvent(self.ui[btnKey], function()
if self.id == i then return end
local oldId = self.id
self.id = i
GUI:Button_loadTextures(self.ui[string.format("list_btn_%d", oldId)],
string.format("%s%s.png", imgDir, oldId .. "a"), "", "", 0)
GUI:Button_loadTextures(self.ui[btnKey],
string.format("%s%s.png", imgDir, tostring(i)), "", "", 0)
self:init()
end)
end
self:init()
end
function DouLiShengJiOBJ:init()
local cfg = self.cfg[self.id]
if not cfg then
return
end
if GUI:Win_IsNotNull(self.ui.ItemShow) then
GUI:removeFromParent(self.ui.ItemShow)
end
self.ui.ItemShow = GUI:ItemShow_Create(self.ui.img_bg, "ItemShow", 500, 304,
{ index = SL:GetMetaValue("ITEM_INDEX_BY_NAME", cfg.name), count = 1, look = true, bgVisible = false, color = 255 })
GUI:setAnchorPoint(self.ui.ItemShow, 0.50, 0.50)
for i = 1, 2 do
local costItem = self.ui[string.format("cost_ItemShow_%d", i)]
local costCfg = cfg.cost and cfg.cost[i]
if GUI:Win_IsNotNull(costItem) then
if costCfg then
GUI:ItemShow_updateItem(costItem, {
index = SL:GetMetaValue("ITEM_INDEX_BY_NAME", costCfg.itemname),
count = costCfg.itemnum,
look = true,
bgVisible = false,
color = 255
})
GUI:setVisible(costItem, true)
else
GUI:setVisible(costItem, false)
end
end
end
GUI:Text_setString(self.ui.Text_success, string.format("成功率:%d%%", cfg.success or 0))
GUI:addOnClickEvent(self.ui.up_btn, function()
ssrMessage:SubLink(string.format("%s_%s", self.__cname, "up"), self.id)
end)
end
function DouLiShengJiOBJ:EventBind()
local function DouLiShengJiOBJ_EQUIP_CHANGE(data)
if GUI:Win_IsNotNull(self._parent) then
if data.Where == 13 then
self:updata()
end
end
end
SL:RegisterLUAEvent(LUA_EVENT_PLAYER_EQUIP_CHANGE, self.__cname, DouLiShengJiOBJ_EQUIP_CHANGE)
SL:RegisterLUAEvent(LUA_EVENT_CLOSEWIN, self.__cname, function(widgetName)
self:OnClose(widgetName)
end)
end
function DouLiShengJiOBJ:OnClose(widgetName)
if widgetName == self.__cname then
self:UnRegisterEvent()
end
end
function DouLiShengJiOBJ:UnRegisterEvent()
SL:UnRegisterLUAEvent(LUA_EVENT_PLAYER_EQUIP_CHANGE, self.__cname)
SL:UnRegisterLUAEvent(LUA_EVENT_CLOSEWIN, self.__cname)
end
return DouLiShengJiOBJ

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

10
csv/cfg_斗笠升级.csv Normal file
View file

@ -0,0 +1,10 @@
序列,装备名,成功率,消耗_1_消耗物品,消耗_1_消耗数量,消耗_1_绑定规则,消耗_2_消耗物品,消耗_2_消耗数量,消耗_2_绑定规则,奖励_1_奖励物品,奖励_1_奖励数量,奖励_1_绑定规则
序列,name,success,cost_1_itemname,cost_1_itemnum,cost_1_itembind,cost_2_itemname,cost_2_itemnum,cost_2_itembind,reward_1_givename,reward_1_givenum,reward_1_bind
1,战神斗笠,100,雷霆斗笠,1,0,金币,500000,1,战神斗笠,1,0
2,玛法斗笠,100,战神斗笠,1,0,金条,1,0,玛法斗笠,1,0
3,史诗斗笠,100,玛法斗笠,1,0,金条,3,0,史诗斗笠,1,0
4,传说斗笠,100,史诗斗笠,1,0,金条,6,0,传说斗笠,1,0
5,不朽斗笠,100,传说斗笠,1,0,金条,15,0,不朽斗笠,1,0
6,至尊斗笠,100,不朽斗笠,1,0,金条,50,0,至尊斗笠,1,0
7,混沌斗笠,100,至尊斗笠,1,0,金条,100,0,混沌斗笠,1,0
8,主宰斗笠,100,混沌斗笠,1,0,金条,200,0,主宰斗笠,1,0
1 序列 装备名 成功率 消耗_1_消耗物品 消耗_1_消耗数量 消耗_1_绑定规则 消耗_2_消耗物品 消耗_2_消耗数量 消耗_2_绑定规则 奖励_1_奖励物品 奖励_1_奖励数量 奖励_1_绑定规则
2 序列 name success cost_1_itemname cost_1_itemnum cost_1_itembind cost_2_itemname cost_2_itemnum cost_2_itembind reward_1_givename reward_1_givenum reward_1_bind
3 1 战神斗笠 100 雷霆斗笠 1 0 金币 500000 1 战神斗笠 1 0
4 2 玛法斗笠 100 战神斗笠 1 0 金条 1 0 玛法斗笠 1 0
5 3 史诗斗笠 100 玛法斗笠 1 0 金条 3 0 史诗斗笠 1 0
6 4 传说斗笠 100 史诗斗笠 1 0 金条 6 0 传说斗笠 1 0
7 5 不朽斗笠 100 传说斗笠 1 0 金条 15 0 不朽斗笠 1 0
8 6 至尊斗笠 100 不朽斗笠 1 0 金条 50 0 至尊斗笠 1 0
9 7 混沌斗笠 100 至尊斗笠 1 0 金条 100 0 混沌斗笠 1 0
10 8 主宰斗笠 100 混沌斗笠 1 0 金条 200 0 主宰斗笠 1 0