找回密码
 register

QQ登录

只需一步,快速开始

查看: 17|回复: 0

[自写引擎] 交易回调 Lua 前置拦截 使用备忘录

[复制链接]

[自写引擎] 交易回调 Lua 前置拦截 使用备忘录

[复制链接]
  • 打卡等级:热心大叔
  • 打卡总天数:216
  • 打卡月天数:15
  • 打卡总奖励:214
  • 最近打卡:2025-06-16 16:16:50
Waylee

主题

0

回帖

2万

积分

仙帝

积分
22714
Waylee 2025-6-16 16:16 | 显示全部楼层 |阅读模式 | Google Chrome | Windows 10

马上注册,查看网站隐藏内容!!

您需要 登录 才可以下载或查看,没有账号?register

×


适用版本:0.85.0600


;交易前判断回调
768991==\NewScript\callback_Exchange.lua

--交易确认回调
--返回值: 允许交易:0 阻止交易:任何其他数
--获取物品信息:local item_id, count = GetData(sceneId, id1, "ITEM", i)
--获取珍兽信息:local pet_id_H, pet_id_L = GetData(sceneId, id1, "PET", i)
function x768990_ExchangeConfirmation(sceneId, selfId, targetId, GetData)
    local Allow = 0 --默认允许交易

    -- --物品、珍兽信息
    -- for i = 0, 4 do
        -- local item_id, count = GetData(sceneId, selfId, "ITEM", i)
        -- if item_id > 0 then
            -- AddGlobalCountNews( sceneId,tostring(i) .. " 物品ID:" .. tostring(item_id) .. " 物品数量:" .. tostring(count))
        -- end
    -- end
    -- for i = 0, 4 do
        -- local pet_id_H, pet_id_L = GetData(sceneId, selfId, "PET", i)
        -- if pet_id_H > 0 then
            -- AddGlobalCountNews( sceneId,tostring(i) .. " 珍兽高位:" .. tostring(pet_id_H) .. " 珍兽低位:" .. tostring(pet_id_L))
        -- end
    -- end
    -- if Allow ~= 0 then
        -- x768990_NotifyTip(sceneId,selfId,"存在违禁品,请检查交易物品后再次尝试。") --弹出提示信息
    -- end

    --交易是否拦截
    return Allow
end
您需要登录后才可以回帖 登录 | register

本版积分规则

雪舞知识库 | 浙ICP备15015590号-1 | 萌ICP备20232229号|浙公网安备33048102000118号 |网站地图|天天打卡

GMT+8, 2025-6-17 07:39 , Processed in 0.097708 second(s), 5 queries , Redis On.

Powered by XueWu Licensed

Copyright © Tencent Cloud.

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