服务端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 |