搜索
查看: 754|回复: 9

[求助] 物品地面LUA极品提示,如果叫金币不提示极品

[复制链接]
发表于 2023-3-7 14:26:16 | 显示全部楼层 |阅读模式
物品地面LUA极品提示,我的LUIA里写的是装备要是极品提示极品,怪物爆出金币有时候正常,有时候就会出现极品,求大佬求助!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
 楼主| 发表于 2023-3-7 14:27:35 | 显示全部楼层
服务端LUA:
--物品掉落地上时触发,返回expand1值,用于自定义值传送给客户端
function on_ItemDropShowType(item)
        local JpNum = 0
        local ItemStdMode = item:getStdMode()
        if ItemStdMode == 19 then
                local luck = item:getBestValue(5)+item:getBestValue(4)
                if luck > 0 then
                        return {expand1 = luck + 30}
                end               
        elseif ItemStdMode == 5 then
                local attackSpeed = item:getBestValue(8)+item:getBestValue(11)+item:getBestValue(7)+item:getBestValue(9)+item:getBestValue(10)
                if attackSpeed > 0 then
                        return {expand1 = attackSpeed + 40}
                end                       
        elseif ItemStdMode == 26 then
                local attackSpeed = item:getBestValue(4)+item:getBestValue(5)
                if attackSpeed > 0 then
                        return {expand1 = attackSpeed + 50}
                end                       
        elseif ItemStdMode == 24 then
                local attackSpeed = item:getBestValue(4)+item:getBestValue(5)       
                if attackSpeed > 0 then
                        return {expand1 = attackSpeed + 60}
                end                       
               
        elseif ItemStdMode == 23 then
                local attackSpeed = item:getBestValue(4)+item:getBestValue(5)       
                if attackSpeed > 0 then
                        return {expand1 = attackSpeed + 70}
                end       
               
        elseif ItemStdMode == 21 then
                local attackSpeed = item:getBestValue(4)+item:getBestValue(5)       
                if attackSpeed > 0 then
                        return {expand1 = attackSpeed + 80}
                end                       
               
        elseif ItemStdMode == 54 then
                local attackSpeed = item:getBestValue(4)+item:getBestValue(5)       
                if attackSpeed > 0 then
                        return {expand1 = attackSpeed + 90}
                end                       
               
        elseif ItemStdMode == 52 then
                local attackSpeed = item:getBestValue(4)+item:getBestValue(5)       
                if attackSpeed > 0 then
                        return {expand1 = attackSpeed + 100}
                end                       
               
        elseif ItemStdMode == 10 then
                local attackSpeed = item:getBestValue(4)+item:getBestValue(5)       
                if attackSpeed > 0 then
                        return {expand1 = attackSpeed + 110}
                end                       
                       
        elseif ItemStdMode == 11 then
                local attackSpeed = item:getBestValue(4)+item:getBestValue(5)       
                if attackSpeed > 0 then
                        return {expand1 = attackSpeed + 110}
                end                       
               
        elseif ItemStdMode == 15 then
                local attackSpeed = item:getBestValue(4)+item:getBestValue(5)       
                if attackSpeed > 0 then
                        return {expand1 = attackSpeed + 110}
                end               
               
                elseif ItemStdMode == 20 then
                local attackSpeed = item:getBestValue(4)+item:getBestValue(5)       
                if attackSpeed > 0 then
                        return {expand1 = attackSpeed + 80}
                end               
               
        end
       
        local Best3 = {
                item:getBestValue(0),
                item:getBestValue(1),
                item:getBestValue(2),
                item:getBestValue(3),
                item:getBestValue(4),               
                item:getBestValue(5),               
                item:getBestValue(6),
                item:getBestValue(7),
                item:getBestValue(8),
                item:getBestValue(9),
                item:getBestValue(10),
                item:getBestValue(11)
               
        }
       
        local maxIndex = 0
        local maxValue = 0
        for i=1,#Best3 do
                if Best3[i] > maxValue then
                        maxIndex = i
                        maxValue = Best3[i]
                end
        end
       
        if maxValue > 0 then
                if maxIndex == 1 then
                        JpNum = maxValue
                elseif maxIndex == 2 then
                        JpNum = maxValue + 10
                elseif maxIndex == 3 then
                        JpNum = maxValue + 20
                end
        end
        return {expand1 = JpNum} --返回expand1
end
 楼主| 发表于 2023-3-7 14:28:25 | 显示全部楼层
客户端LUA:
--物品掉落回调

function on_DropItem(x, y, looks, color, effectId, name, expand1, dbIdx, count, seeMode, filterConfig)
        if expand1 > 0 then
                return {showName = name.."[极品]", color = 253}
        end
end
 楼主| 发表于 2023-3-7 14:32:07 | 显示全部楼层
这是装备 极品提示,显示正常,就是金币一会正常,一会显示极品,望大佬给个思路

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
发表于 2023-3-7 14:50:55 | 显示全部楼层
加个检测不结了
 楼主| 发表于 2023-3-7 15:17:04 | 显示全部楼层
这不是不会吗,会的话就不来求助了
 楼主| 发表于 2023-3-7 15:44:36 | 显示全部楼层
麻烦 领导删帖吧 解决了 说明书 就有例子
--物品掉落回调显示数量示例
function on_DropItem(x, y, looks, color, effectId, name, expand1, dbIdx, count, seeMode, filterConfig)
        if count > 1 then --物品数量大于1个
                local _dbItem = c.item.getDBItem(dbIdx)
                if ((_dbItem ~= nil) and (_dbItem:getStdMode() == 17)) or (name == "金币") then
                        return {showName = name.."x"..count}
                end
        end
end
发表于 2023-3-7 16:27:05 | 显示全部楼层
我这里直接设置金币入包 就没有这个烦恼
 楼主| 发表于 2023-3-7 16:32:15 | 显示全部楼层
二大爷 发表于 2023-3-7 16:27
我这里直接设置金币入包 就没有这个烦恼

我这个复古区,要是金币入包的话 就感觉很别扭
发表于 2023-3-8 11:40:24 | 显示全部楼层
百区裁决 发表于 2023-3-7 16:32
我这个复古区,要是金币入包的话 就感觉很别扭

其实是一样的 金币你设置爆的少一些 让他入包 没毛病的
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|HGEM2论坛

GMT+8, 2024-9-23 11:23 , Processed in 0.898506 second(s), 14 queries .

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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