dp光环回收卷

-- 光环回收券处理函数
item_handler[2023061230] = function(user, item_id)
    -- 定义可回收的光环ID以及回收奖励ID列表
    local pet_map = {
        [202207741] = 3340, -- 创世纪光环id  回收获得大饼{3340}  
        [110003] = 3299, -- 光环2
        [110008] = 3300, -- 光环3
        [110010] = 3301, -- 光环4
    }
    local pet_item = dpx.item.info(user.cptr, 1, 0)-- 获取背包中宠物第一格的信息

    if pet_item then

        local pet_id = pet_item.id
        local reward_id = pet_map[pet_id]
        if reward_id then
            -- 删除背包中的光环,并随机给予回收奖励
            dpx.item.delete(user.cptr, 1, 0, 1)
            local reward_count = math.random(10, 50)
            dpx.item.add(user.cptr, reward_id, reward_count)
        else
            -- 背包中的光环不能回收,回收券返回背包
            dpx.item.add(user.cptr, item_id)
            user:SendNotiPacketMessage("该光环不能回收!", 1)
        end
    else
        user:SendNotiPacketMessage("请确保时装栏第一格有宠物!", 1)
    end
end
© 版权声明
THE END
喜欢就支持一下吧
点赞12 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容