搜索
LUA

LUA

本版块未设置版块简介!请后台版块编辑添加。
  •  帖子: 115
  •  讨论: 115
  •  关注: 0

MBHC-ornamentscompose.lua--秘宝头饰合成

GP 发表于 2025-5-10 02:56:40 | 显示全部楼层 |阅读模式
191 0
local ItemComposeNpcMetamo = 104420 --装备分解npc形象
local ItemComposeNpcName = "安娜" --装备分解npc名字
local ItemComposeNpcMap = 60037 --装备分解npc地图
local ItemComposeNpcPosX = 17 --装备分解npc x坐标
local ItemComposeNpcPosY = 29 --装备分解npc y坐标
local ItemComposeNpcDir = 0 --装备分解npc方向
local ItemComposeNpcMsg = "\n★功能:将道具栏第一格的首饰(乐器、头饰除外)属性附加到道具栏第二格的精致时装&秘宝时装上(时装均为头饰)\n★特点:可以带着强力饰品能力值的首饰进行游戏,其中秘宝首饰还能在原素材首饰的基础上附加1点随机修正\n★注意事项:合成后道具栏第一格的首饰会消失,合成后时装可以交易(即使合成道具是绑定道具),成品时装双击后会绑定,请各位注意"
local ErrorMsg1 = "道具栏第1格无装备或第2格无时装类道具。"
local ErrorMsg2 = "道具栏第1格必须是提供属性的饰品装备。"
local ErrorMsg3 = "道具栏第2格必须是可以属性合成的时装类道具(精致&秘宝时装)。"
local ErrorMsg4 = "您没有所需的道具。"
local ErrorMsg5 = "您的钱不够。"
local ErrorMsg6 = "已经合成的时装无法再次作为属性提供道具。"
local ErrorMsg7 = "道具栏第一格道具不是饰品装备。"
local OverMsg = "合成成功!"

local TempItemId = 999999 --用于删除道具的临时道具编号,请填写itemset中【绝不】使用的道具编号,否则会导致误删道具。

local FirstItemTypeList = {15,17,18,19,20,21} --可用于提供属性的道具类型列表
local NoComposeItemId = {} --不可用于合成的道具Id
NoComposeItemId[50423] = 1 --幻想VIP
NoComposeItemId[16420] = 1 --猫头鹰头盔
NoComposeItemId[51333] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[790004] = 1 --王者守护神
NoComposeItemId[79780] = 1 --女神项链·蓝
NoComposeItemId[56121] = 1 --斗神徽章
NoComposeItemId[17720] = 1 --斗神之魂
NoComposeItemId[50264] = 1 --如月沙罗戒指
NoComposeItemId[50263] = 1 --智慧之果
NoComposeItemId[56126] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56127] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56128] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56129] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56130] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56131] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56132] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56512] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[59131] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56781] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56782] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56783] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56784] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56785] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56786] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56787] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56788] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56789] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56792] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56793] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56794] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56795] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56796] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56797] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56798] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56799] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56800] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56801] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56802] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56803] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56804] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56635] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56636] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56637] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56638] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[56639] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[59353] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[59361] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[59362] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[59363] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[59364] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[59365] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[59366] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[59367] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[59368] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[59369] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[59370] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[59371] = 1 --设置为任意数值均为不允许合成
NoComposeItemId[59372] = 1 --设置为任意数值均为不允许合成

local CarryItemTypeList = {} --可用于承载属性的道具id列表
CarryItemTypeList[90102] = {901020,0,1,1} --CarryItemTypeList[x] = {a,b,c,d} x为承载道具id a为合成后道具id b为合成后道具说明编号(无效) 如为0则不改变 c为随机修正下限 d为随机修正上限
CarryItemTypeList[90103] = {901030,0,2,3}
CarryItemTypeList[90112] = {901120,0,1,1}
CarryItemTypeList[90113] = {901130,0,2,3}
CarryItemTypeList[90502] = {905020,0,1,1}
CarryItemTypeList[90503] = {905030,0,2,3}
CarryItemTypeList[90512] = {905120,0,1,1}
CarryItemTypeList[90513] = {905130,0,2,3}
CarryItemTypeList[90522] = {905220,0,1,1}
CarryItemTypeList[90523] = {905230,0,2,3}
CarryItemTypeList[90121] = {901210,0,1,1}
CarryItemTypeList[90532] = {905320,0,1,1}
CarryItemTypeList[90533] = {905330,0,2,3}
CarryItemTypeList[90122] = {901220,0,1,1}
CarryItemTypeList[90123] = {901230,0,2,3}
CarryItemTypeList[90132] = {901320,0,1,1}
CarryItemTypeList[90133] = {901330,0,2,3}
CarryItemTypeList[90142] = {901420,0,1,1}
CarryItemTypeList[90143] = {901430,0,2,3}
CarryItemTypeList[90542] = {905420,0,1,1}
CarryItemTypeList[90543] = {905430,0,2,3}
CarryItemTypeList[90554] = {905540,0,2,3}
CarryItemTypeList[90552] = {905520,0,1,1}
CarryItemTypeList[90553] = {905530,0,2,3}
CarryItemTypeList[90152] = {901520,0,1,1}
CarryItemTypeList[90153] = {901530,0,2,3}
CarryItemTypeList[90162] = {901620,0,1,1}
CarryItemTypeList[90163] = {901630,0,2,3}

local UsedItemId = 0 --额外需求的道具id 为0时无需
local UsedItemNum = 1 --需求道具的数量
local UsedItemName = "水龙枪" --需求的道具名
local UsedGold = 10000 --额外需求的魔币 为0时无需
local StateList = {%道具_类型%,%道具_等级%,%道具_攻击%,%道具_防御%,%道具_敏捷%,%道具_精神%,%道具_回复%,%道具_抗魔%,%道具_魔功%,%道具_必杀%,%道具_反击%,%道具_命中%,%道具_闪躲%,%道具_HP%,%道具_MP%,%道具_魅力%,%道具_毒抗%,%道具_睡抗%,%道具_石抗%,%道具_醉抗%,%道具_乱抗%,%道具_忘抗%,%道具_属性一%,%道具_属性二%,%道具_属性一值%,%道具_属性二值%,%道具_特殊类别%,%道具_子参一%,%道具_子参二%,51,2006,2008,2009,2010,2011,2012}--可继承的道具属性
--*注意:分解时给予的道具不要超过1组,否则会造成道具栏判定不正常。特殊分解列表不要给予超过20件道具,否则不可能分解成功。

------------------------------------------------------
Global_Reg.RegInit("ItemComposeNpc_InitA");--注册创建NPC事件

local FirstItemTypeListTurn = {}
for k,v in pairs(FirstItemTypeList) do
        FirstItemTypeListTurn[v] = 1
end
local NoComposeList = {}
for k,v in pairs(CarryItemTypeList) do
        NoComposeList[v[1]] = 1
end


function ItemComposeNpc_InitA()
        ItemComposeNpc_InitB();
        return 0;
end

function ItemComposeNpc_InitB(npc)
        if npc == nil or npc < 0 then
        npc = NL.CreateNpc(nil,"ItemComposeNpc_InitC")
        end
        Char.SetData(npc,%对象_形象%,ItemComposeNpcMetamo)
        Char.SetData(npc,%对象_原形%,ItemComposeNpcMetamo)
        Char.SetData(npc,%对象_地图%,ItemComposeNpcMap)
        Char.SetData(npc,%对象_X%,ItemComposeNpcPosX)
        Char.SetData(npc,%对象_Y%,ItemComposeNpcPosY)
        Char.SetData(npc,%对象_方向%,ItemComposeNpcDir)
        Char.SetData(npc,%对象_原名%,ItemComposeNpcName)
        NLG.UpChar(npc)
        LuaNpcIndex["ItemComposeNpc_Init"]=npc;
        InstallNpc("ItemComposeNpc_Init",npc);
        Char.SetTalkedEvent(nil, "ItemComposeTalkedCallBack",npc)
        Char.SetWindowTalkedEvent(nil,"ItemComposeWindowTalkedCallBack",npc)
        return true
end

function ItemComposeNpc_InitC(index)
        return true;
end

function ItemComposeTalkedCallBack(npc,player)
        if NLG.CanTalk(npc,player) then
                local msg = "2\n请选择:\n\n1.首饰&头饰时装合成说明\n2.合成首饰"
                NLG.ShowWindowTalked(player,2,2,0,msg,npc)
        end
end

function ItemComposeWindowTalkedCallBack(npc,player,Seqno,Select,Data)
        if NLG.CanTalk(npc,player) then
                if Select ~= 2 then
                        if Seqno == 0 then
                                if tonumber(Data) == 1 then
                                        NLG.ShowWindowTalked(player,0,2,9999,ItemComposeNpcMsg,npc)
                                elseif tonumber(Data) == 2 then
                                        local itemindex1 = Char.GetItemIndex(player,8)
                                        local itemindex2 = Char.GetItemIndex(player,9)
                                        if itemindex1 >= 0 and itemindex2 >= 0 then
--                                                local msg = "\n注意:您确定要把『"..Item.GetData(itemindex1,%道具_名字%).."』和『"..Item.GetData(itemindex2,%道具_名字%).."』合成吗?合成后『"..Item.GetData(itemindex1,%道具_名字%).."』将会消失\n\n备注:继承了装备属性的时装在初次装备后会绑定\n\n\n【"..(Item.GetData(itemindex1,%道具_名字%)).."】  覆盖至===>  【"..(Item.GetData(itemindex2,%道具_名字%)).."】"
                                                local msg = "\n注意:您确定要把『"..Item.GetData(itemindex1,%道具_名字%).."』和『"..Item.GetData(itemindex2,%道具_名字%).."』合成吗?合成后『"..Item.GetData(itemindex1,%道具_名字%).."』将会消失\n\n备注:继承了装备属性的时装在初次装备后会绑定\n\n\n【"..(Item.GetData(itemindex1,%道具_名字%)).."】  覆盖至===>  【"..(Item.GetData(itemindex2,%道具_名字%)).."】"
                                                NLG.ShowWindowTalked(player,0,12,1,msg,npc)
                                        else
                                                NLG.SystemMessage(player,ErrorMsg1)
                                        end
                                end
                        elseif Seqno == 1 then
                                if Select == 4 then
                                        if UsedItemId == 0 or Char.ItemNum(player,UsedItemId) >= UsedItemNum then
                                --if Char.GetData(player,%对象_金币%) >= UsedGold then
                                                if Char.GetData(player,%对象_金币%) >= UsedGold then
                                                        local itemindex1 = Char.GetItemIndex(player,8)
                                                        local itemindex2 = Char.GetItemIndex(player,9)
                                                        if itemindex1 >= 0 and itemindex2 >= 0 then
                                                                local itemtype1 = Item.GetData(itemindex1,%道具_类型%)
                                                                if FirstItemTypeListTurn[itemtype1] then
                                                                        local itemid1 = Item.GetData(itemindex1,%道具_ID%)
                                                                        if NoComposeList[itemid1] == nil then
                                                                                if NoComposeItemId[itemid1] == nil then
                                                                                        local itemid2 = Item.GetData(itemindex2,%道具_ID%)
                                                                                        if CarryItemTypeList[itemid2] then
                                                                                                for _,v in pairs(StateList) do
                                                                                                        Item.SetData(itemindex2,v,Item.GetData(itemindex1,v))
                                                                                                end
                                                                                                local rdm1 = math.random(CarryItemTypeList[itemid2][3],CarryItemTypeList[itemid2][4])
                                                                                                local rdm2
                                                                                                if rdm1 >= 1 then
                                                                                                        for i = 1,rdm1 do
                                                                                                                rdm2 = math.random(%道具_必杀%,%道具_闪躲%)
                                                                                                                Item.SetData(itemindex2,rdm2,Item.GetData(itemindex2,rdm2)+1)
                                                                                                        end
                                                                                                end
                                                                                                Item.SetData(itemindex2,%道具_ID%,CarryItemTypeList[itemid2][1])
                                                                                                if CarryItemTypeList[itemid2][2] > 0 then
                                                                                                --        Item.SetData(itemindex2,%%,CarryItemTypeList[itemid2][2])
                                                                                                end
                                                                                                if UsedItemId > 0 then
                                                                                                        Char.DelItem(player,UsedItemId,UsedItemNum)
                                                                                                end
                                                                                                if UsedGold > 0 then
                                                                                                        Char.SetData(player,%对象_金币%,Char.GetData(player,%对象_金币%)-UsedGold)
                                                                                                        NLG.SystemMessage(player,"交出了 "..UsedGold.."金币。")
                                                                                                        NLG.UpChar(player)
                                                                                                end
                                                                                                Item.SetData(itemindex1,%道具_ID%,TempItemId)
                                                                                                Char.DelItem(player,TempItemId,9999)
                                                                                                Item.UpItem(player,9)
                                                                                                NLG.SystemMessage(player,OverMsg)
                                                                                        else
                                                                                                NLG.SystemMessage(player,ErrorMsg3)
                                                                                        end
                                                                                else
                                                                                        NLG.SystemMessage(player,ErrorMsg7)
                                                                                end
                                                                        else
                                                                                NLG.SystemMessage(player,ErrorMsg6)
                                                                        end
                                                                else
                                                                        NLG.SystemMessage(player,ErrorMsg2)
                                                                end
                                                        else
                                                                NLG.SystemMessage(player,ErrorMsg1)
                                                        end
                                                else
                                                        NLG.SystemMessage(player,ErrorMsg5)
                                                end
                                        else
                                                NLG.SystemMessage(player,ErrorMsg4)
                                        end
                                end
                        end
                end
        end
end


回复

使用道具 举报

全部评论

暂无评论,期待您打破宁静

TA的帖子
相关帖子
  • admin 2025-5-11

    简单的宠物改造任务 使用时请自行将道具放到自己服某个BOSS战斗中掉落 山羊 大狮子 P ...

  • admin 2025-5-11

    ############## 城城的武器强化系统 ############## #剑1 block StrCmpChat == 700 W ...

  • admin 2025-5-11

    #####耐久版##### 道具? 魔石转化器 Cayenne_moshi_02.txt ITEM_useMystery 95 ...

  • admin 2025-5-11

    魔力宝贝手动架设中遇到的问题及解决方法魔力宝贝手动架设教程—魔力私服,魔力宝贝私 ...

  • admin 2025-5-12

    起始地点法兰城的竞技场的贝贝(34.36)头目战╳ 必要条件---必要等级Lv1 职业限定---建 ...

  • admin 2025-5-12

    1.与里谢里雅堡的H1N1防疫宣传员(28,77)说话,取得"防疫小口罩"。 图例物品名称等级种 ...

  • admin 2025-5-12

    魅惑的哈密瓜无取得宠物「哈密瓜公主」╳╳○ 起始地点魔法大学头目战╳ 必要条件--- ...

  • admin 2025-5-12

    起始地点法兰城的里谢里雅堡头目战○ 必要条件---必要等级--- 职业限定---建议等级--- ...

  • admin 2025-5-12

    起始地点法兰城的里谢里雅堡头目战○ 必要条件---必要等级--- 职业限定---建议等级--- ...

  • admin 2025-5-12

    起始地点法兰城的冒险者旅馆头目战○ 必要条件---必要等级--- 职业限定---建议等级LV8 ...

发布 联系QQ