搜索
LUA

LUA

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

shoushicashiitem.lua--首饰擦拭布

GP 发表于 2025-5-10 03:29:47 | 显示全部楼层 |阅读模式
173 0
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


回复

使用道具 举报

全部评论

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

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

    Recipe 扩充 通过Lua引擎,我们可以扩充现有的Recipe数量,突破GMSV限制的255个。 这 ...

  • admin 2025-5-10

    Event Flg 扩充 通过Lua引擎,我们可以扩充现有的EventFlg数量,突破GMSV限制的255个 ...

  • admin 2025-5-10

    GMSV脚本的Lua接口 NpcEventCall NpcEventCall可以让用户在GMSV自身的脚本(data/npc/* ...

  • admin 2025-5-10

    常量 (BIG5) 常量 常量值 %對象_點卷% -1 %對象_積分% -1 %寵物狀態_無% 0 %寵物狀態_ ...

  • admin 2025-5-10

    [*]常量 [*]常量 常量值 [*]%对象_点卷% -1 [*]%对象_积分% -1 [*]%宠物状态_无% 0 [* ...

  • admin 2025-5-10

    道具index道具index在Cgdev Lua引擎中所定义的Lua脚本中表示: [*]道具对象 道具index ...

  • admin 2025-5-10

    -------------------------------------------------------------------------------- ...

  • admin 2025-5-11

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

  • admin 2025-5-11

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

发布 联系QQ