Files
chuanqi-server-instance/LogicServer/data/functions/ItemEvent/UseSkillBook.txt
2024-12-16 20:45:03 +08:00

45 lines
1.5 KiB
Plaintext
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--lua script
--ʹ<>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD>ѧϰ<D1A7><CFB0><EFBFBD><EFBFBD>
--#include "data\config\item\SkillBookItem.txt" once
--[[
--<2D><><EFBFBD><EFBFBD>buff<66><66><EFBFBD><EFBFBD>Ʒ
--sysarg:ʵ<><CAB5><EFBFBD>ָ<EFBFBD><D6B8>
--itemidx: <20><>Ʒ<EFBFBD><C6B7>ID
--itemPtr: <20><>Ʒ<EFBFBD><C6B7>ָ<EFBFBD><D6B8>
--ItemTable: <20><><EFBFBD>õIJ<C3B5><C4B2><EFBFBD><EFBFBD>б<EFBFBD>
--]]
function UseBookLearnSkill(sysarg,count,itemidx,itemPtr,ItemTable) --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>count<6E><74>Ч
local nJop = Actor.getIntProperty(sysarg, PROP_ACTOR_VOCATION)
if nJop == 0 or nJop == ItemTable.jop_id then
local curSkillLv = Actor.getSkillLevel(sysarg,ItemTable.skill_id)
if curSkillLv < ItemTable.skill_Level then
if curSkillLv ~= (ItemTable.skill_Level - 1) then
Actor.sendTipmsg( sysarg,OldLang.Script.UseSkillBook001,ttFlyTip )
return
end
local canLearn = true
if ItemTable.needConsume and Actor.removeItemByPtr(sysarg,itemPtr,1,true, OldLang.Log.UseSkillBook, 167) <= 0 then
canLearn = false
end
if canLearn then
Actor.startLearnSkill(sysarg,ItemTable.skill_id,ItemTable.skill_Level)
return true
end
elseif curSkillLv >= ItemTable.skill_Level then
Actor.sendTipmsg( sysarg,OldLang.Script.UseSkillBook002,ttFlyTip )
end
else
Actor.sendTipmsg( sysarg,OldLang.Script.UseSkillBook003,ttFlyTip )
end
end
function BookLeanrnSkillInit(sysarg)
for i = 1,table.getn(SkillBoolConfig) do
local x = SkillBoolConfig[i]
GlobalItemFn[x.item_id] = { func = UseBookLearnSkill, params = x }
end
end
table.insert(InitFnTable,BookLeanrnSkillInit)