魔力宝贝

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz

[GP] shoushicashiitem.lua--首饰擦拭布

[复制链接]
发表于 前天 03:29 | 显示全部楼层 |阅读模式
Global_Reg.RegMoveEquipItem("shoushicashi_item")--移动一件道具到另一个格子事件


function shoushicashi_item(player, OldItemPos, NewItemPos)--移动一件道具到另一个格子事件
        local cashiindex = Char.GetItemIndex(player,NewItemPos);--拿起的index
        local cashiItem_ID = Item.GetData(cashiindex,0) or -1--拿起的道具ID
        if cashiItem_ID == 79781 then
                local shoushiindex = Char.GetItemIndex(player,OldItemPos);--目标index
                local shoushiItem_ID = Item.GetData(shoushiindex,0) or -1--目标道具ID
                local shoushiItem_type = Item.GetData(shoushiindex,%道具_类型%) or -1 --目标首饰类型
                if (shoushiItem_type >= 15 and shoushiItem_type <= 21) or shoushiItem_type == 55 then --若是首饰
                        local shoushiItem_name = Item.GetData(shoushiindex,%道具_已鉴定名%) --目标首饰名称
                        local a = string.sub(shoushiItem_name,1,6)--获取前6字符
                        if a and a == "秘宝·"then
                                local shoushiItem_naijiu = Item.GetData(shoushiindex,%道具_最大耐久%) --目标首饰最大耐久
                                NLG.DelItem(player, cashiItem_ID, 1) --扣除道具
                                Item.SetData(shoushiindex,%道具_耐久%,shoushiItem_naijiu)
                                Item.UpItem(player,OldItemPos)
                                NLG.SystemMessage(player,"秘宝首饰已擦拭,如新的一样。")
                        elseif a and a == "精致·" then
                                local shoushiItem_naijiu = Item.GetData(shoushiindex,%道具_最大耐久%) --目标首饰最大耐久
                                NLG.DelItem(player, cashiItem_ID, 1) --扣除道具
                                Item.SetData(shoushiindex,%道具_耐久%,shoushiItem_naijiu)
                                Item.UpItem(player,OldItemPos)
                                NLG.SystemMessage(player,"精致首饰已擦拭,如新的一样。")
                        else
                                NLG.SystemMessage(player,"该首饰不是秘宝或精致首饰,不可擦拭。")
                        end
                else
                        NLG.SystemMessage(player,"该道具并不是首饰类别,不可擦拭。")
                end
        end
        return 0
end


回复

使用道具 举报

Archiver|魔力研究社

GMT+8, 2025-5-12 13:32 , Processed in 0.118056 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表