搜索
查看: 1098|回复: 13

[求助] LUA的极品显示问题

[复制链接]
发表于 2022-6-24 09:32:19 | 显示全部楼层 |阅读模式
500金钱
--物品掉落回调
function on_DropItem(x, y, looks, color, effectId, name, expand1, dbIdx, count, seeMode)
  if expand1 == 3 then
    return {showName = name.."【极品+3】",color=249,effectId = 164}
  elseif expand1 == 4 then
    return {showName = name.."【极品+4】",color=249,effectId = 164}
  elseif expand1 == 5 then
    return {showName = name.."【极品+5】",color=249,effectId = 164}
  elseif expand1 == 6 then
    return {showName = name.."【极品+6】",color=249,effectId = 164}
  elseif expand1 == 7 then
    return {showName = name.."【极品+7】",color=249,effectId = 164}
  elseif expand1 == 8 then
    return {showName = name.."【极品+8】",color=249,effectId = 164}
  elseif expand1 == 10 then
    return {showName = name.."【极品+5】",color=249,effectId = 164}
  elseif expand1 == 12 then
    return {showName = name.."【极品+6】",color=249,effectId = 164}
  elseif expand1 == 14 then
    return {showName = name.."【极品+7】",color=249,effectId = 164}
  elseif expand1 == 16 then
    return {showName = name.."【极品+8】",color=249,effectId = 164}
  elseif expand1 == 18 then
    return {showName = name.."【极品+9】",color=249,effectId = 164}
  elseif expand1 == 20 then
    return {showName = name.."【极品+10】",color=249,effectId = 164}
  elseif expand1 == 21 then
    return {showName = name.."【攻速+1】",color=249,effectId = 164}
  elseif expand1 == 22 then
    return {showName = name.."【攻速+2】",color=249,effectId = 164}
  end  
end

现在这个值能做到显示极品,不能显示具体是什么属性
求教大神 怎么改成根据 攻击 魔法 道术 攻速 幸运来显示???

发表于 2022-6-24 10:27:19 | 显示全部楼层
服务端只能往客户端传   数值
 楼主| 发表于 2022-6-24 11:10:47 | 显示全部楼层
我是你三哥 发表于 2022-6-24 10:27
服务端只能往客户端传   数值

不能实现吗?
发表于 2022-6-24 11:26:12 | 显示全部楼层
可以实现 只是你这个写法太臃肿了  其实6行代码就可以解决的
 楼主| 发表于 2022-6-24 12:17:48 | 显示全部楼层
亚麻跌 发表于 2022-6-24 11:26
可以实现 只是你这个写法太臃肿了  其实6行代码就可以解决的

大神 你倒是写出来啊
发表于 2022-6-24 12:38:20 | 显示全部楼层
服务端你自己定义,1-1000,攻击,1001-2000,魔法,2001-3000,道术,客户端检测范围在1-1000,就显示攻击+值,检测范围在1001-2000,就-1000显示魔法+值,检测范围在2001-3000,就-2000显示道术+值。就这么简单!
发表于 2022-6-24 15:15:26 | 显示全部楼层
参谋长 发表于 2022-6-24 12:38
服务端你自己定义,1-1000,攻击,1001-2000,魔法,2001-3000,道术,客户端检测范围在1-1000,就显示攻击 ...

正解。。。。。。。。。。
 楼主| 发表于 2022-6-24 16:20:10 | 显示全部楼层
我是你三哥 发表于 2022-6-24 15:15
正解。。。。。。。。。。

哈哈哈哈 会写LUA我就不会来发帖子啦
发表于 2022-6-24 20:37:05 | 显示全部楼层
服务端LUA:

        local _JP_G = item:getBestValue(0)
        local _JP_M = item:getBestValue(1)
        local _JP_D = item:getBestValue(2)
        local bestValue = 0

        if _JP_G > 0 or _JP_M > 0 or _JP_D > 0 then

                if     _JP_G > _JP_M and _JP_G > _JP_D then
                        bestValue = _JP_G + 1000
                elseif _JP_M > _JP_G and _JP_M > _JP_D then
                        bestValue = _JP_M + 2000
                elseif _JP_D > _JP_M and _JP_D > _JP_G then
                        bestValue = _JP_D + 3000
                elseif _JP_G == _JP_M and _JP_G == _JP_D then
                        bestValue = _JP_G + 1000
                elseif _JP_G == _JP_M then
                        bestValue = _JP_G + 1000
                elseif _JP_M == _JP_D then
                        bestValue = _JP_M + 2000
                end
        end


补充内容 (2022-6-24 20:37):
显示顺序,攻击魔法道术,显示最高的点数,优先显示攻击,其次魔法,其次道术!
 楼主| 发表于 2022-6-24 20:44:24 | 显示全部楼层
参谋长 发表于 2022-6-24 20:37
服务端LUA:

        local _JP_G = item:getBestValue(0)

客户端的不变吗?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|HGEM2论坛

GMT+8, 2024-9-22 19:30 , Processed in 0.486916 second(s), 13 queries .

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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