|
这个LUA原本的功能是 人物满级以后 挂机可以收集经验
由于我手上的端 没有相应的接口 所以不能接收满级后怪物给予的经验值
itemExp.lua --道具LUA
function Exp(itemindex, charaindex, toindex, haveitemindex)
local itemExp=other.atoi(item.getChar(itemindex,"字段"))
char.setInt(toindex,"当前经验",char.getInt(toindex,"当前经验")+itemExp)
char.DelItem(charaindex, haveitemindex)
end
function main()
item.addLUAListFunction( "ITEM_Exp", "Exp", "")
end
battlefinishfunction.lua --战斗结束LUA
function BattleFinishFunction( charaindex, battletime, battleturn, battletype )
local itemindex=checkItem(charaindex,30733)
if itemindex>-1 then
local getExp=char.getWorkInt(charaindex,"获得经验")
local serverExp=2
local playExp=char.getWorkInt(charaindex, "经验加成")/100
if playExp==0 then
playExp=1
end
local itemExp=other.atoi(item.getChar(itemindex,"字段"))
if itemExp<100000000 then
getExp=getExp*serverExp*playExp
itemExp=itemExp+getExp
if itemExp>100000000 then
itemExp=100000000
end
item.setChar(itemindex,"字段",itemExp)
item.setChar(itemindex,"说明","当前储存经验为:"..itemExp)
item.UpdataItemOne(charaindex, itemindex)
end
end
end
function checkItem(charaindex,itemid)
for i=9,23 do
local itemindex=char.getItemIndex(charaindex,i)
if itemindex>-1 then
if item.getInt(itemindex,0)== itemid then
return itemindex
end
end
end
return -1
end |
|