init
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
--#include "data\config\item\ItemUseCountCfg.config" once
|
||||
|
||||
function sendItemUseCount(sysarg, groupId)
|
||||
--print("sendItemUseCount, groupId="..groupId)
|
||||
local netPack = DataPack.allocPacket(sysarg,139, enScriptMiscSystemSendItemUseCount)
|
||||
if netPack == nil then
|
||||
return
|
||||
end
|
||||
local GropList = {}
|
||||
if(type(groupId) == 'number')then
|
||||
table.insert(GropList, groupId)
|
||||
else
|
||||
GropList = groupId
|
||||
end
|
||||
DataPack.writeByte(netPack, #GropList)
|
||||
for k,v in pairs(GropList)do
|
||||
local lastCount, maxCount = getItemUseCountByGrop(sysarg, v)
|
||||
DataPack.writeShort(netPack, v)
|
||||
DataPack.writeShort(netPack, lastCount)
|
||||
DataPack.writeShort(netPack, maxCount)
|
||||
end
|
||||
DataPack.flush(netPack)
|
||||
--print("sendItemUseCount, groupId="..groupId..", lastCount="..lastCount..", maxCount="..maxCount)
|
||||
end
|
||||
|
||||
--获得道具的使用次数
|
||||
function getItemUseCountByGrop(sysarg, groupId)
|
||||
--print("getItemUseCountByGrop, groupId="..groupId)
|
||||
for itemId, v in pairs(ItemUseCountCfg)do
|
||||
if v.group == groupId then
|
||||
return getItemUseCount(sysarg, itemId)
|
||||
end
|
||||
end
|
||||
return 999,999
|
||||
end
|
||||
|
||||
--[[获得道具的剩余使用次数
|
||||
此方法内部,不要发送任何消息,可能导致宕机
|
||||
返回:剩余次数,最大次数
|
||||
]]
|
||||
function getItemUseCount(sysarg, itemId)
|
||||
--使用次数限制
|
||||
local cfg = ItemUseCountCfg[itemId]
|
||||
if not cfg then
|
||||
return 0,0
|
||||
end
|
||||
|
||||
local groupId = cfg.group
|
||||
local maxCount = cfg.dailyUseLimit
|
||||
|
||||
if not maxCount or not groupId then
|
||||
return 0,0
|
||||
end
|
||||
local actorVar = Actor.getStaticVar(sysarg)
|
||||
if not actorVar.dailyItemUseCount then
|
||||
actorVar.dailyItemUseCount = {}
|
||||
end
|
||||
if not actorVar.dailyItemUseCount[groupId] then
|
||||
actorVar.dailyItemUseCount[groupId] = 0
|
||||
end
|
||||
local lastCount = maxCount - actorVar.dailyItemUseCount[groupId] --剩余次数
|
||||
if lastCount < 0 then
|
||||
lastCount = 0
|
||||
end
|
||||
--print("getItemUseCount,groupId="..groupId..", maxCount="..maxCount..", lastCount="..lastCount)
|
||||
return lastCount, maxCount
|
||||
end
|
||||
|
||||
--增加每日道具已使用次数
|
||||
function AddDailyItemUseCount(sysarg, itemId, count)
|
||||
--print("AddDailyItemUseCount, itemId="..itemId..", count="..count)
|
||||
local cfg = ItemUseCountCfg[itemId]
|
||||
if not cfg then
|
||||
return false
|
||||
end
|
||||
|
||||
local groupId = cfg.group
|
||||
local maxCount = cfg.dailyUseLimit
|
||||
local actorVar = Actor.getStaticVar(sysarg)
|
||||
if not actorVar.dailyItemUseCount then
|
||||
actorVar.dailyItemUseCount = {}
|
||||
end
|
||||
if not actorVar.dailyItemUseCount[groupId] then
|
||||
actorVar.dailyItemUseCount[groupId] = 0
|
||||
end
|
||||
actorVar.dailyItemUseCount[groupId] = actorVar.dailyItemUseCount[groupId] + count
|
||||
--print("addItemUseCount, groupId="..groupId..", newCount="..actorVar.dailyItemUseCount[groupId] )
|
||||
sendItemUseCount(sysarg, groupId)
|
||||
local nLastCount = getItemUseCount(sysarg, itemId)
|
||||
local strNotice = string.format(OldLang.NoticeStr.strItemUseCount,Item.getItemName(itemId),count, nLastCount)
|
||||
Actor.sendTipmsg( sysarg, strNotice , ttFlyTip )
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
--lua script
|
||||
--Reward configs
|
||||
|
||||
MONEYTYPE = {
|
||||
[0] = OldLang.NoticeStr.x00005, --<2D><><EFBFBD>
|
||||
[3] = OldLang.NoticeStr.x00007, --Ԫ<><D4AA>
|
||||
}
|
||||
--<2D><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3B2BBB4>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD>չ
|
||||
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD><C7B8><EFBFBD><EFBFBD>dz<EFBFBD><C7B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǯ<EFBFBD><C7AE>Ʒ <20><><EFBFBD><EFBFBD><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
--<2D><><EFBFBD><EFBFBD>չ<EFBFBD>ԺͿ<D4BA>ά<EFBFBD><CEAC><EFBFBD>ԵĽǶȿ<C7B6> <20>б<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
--rewardCheck <09><>Ϊר<CEAA>Ŷ<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD>õĹ<C3B5><C4B9>߷<EFBFBD><DFB7><EFBFBD> <20><><EFBFBD>ڼ<EFBFBD>⽱<EFBFBD><E2BDB1><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD>״<EFBFBD><D7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>
|
||||
--doReward <09><>Ϊר<CEAA>Ŷ<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD>õĹ<C3B5><C4B9>߷<EFBFBD><DFB7><EFBFBD> <20><><EFBFBD><EFBFBD>ִ<EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD>Ϊ
|
||||
|
||||
--ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
function rewardConfigCheck (sysarg,rewardConfig)
|
||||
if rewardConfig == nil then return 2 end
|
||||
local needspace = 0
|
||||
local myJob = Actor.getIntProperty( sysarg, PROP_ACTOR_VOCATION )
|
||||
local mySex = Actor.getIntProperty(sysarg,PROP_ACTOR_SEX)
|
||||
for i,c in ipairs(rewardConfig) do
|
||||
if c.rewardtype == 1 and (not c.sex or c.sex == mySex) and (not c.job or c.job == myJob) then
|
||||
needspace = needspace + Item.getAddItemNeedGridCount( sysarg, c.itemid, c.amount )
|
||||
end
|
||||
end
|
||||
--if ( needspace > Item.getBagEmptyGridCount( sysarg ) ) then
|
||||
if ( needspace > Item.getAllBagMinEmptyGridCount( sysarg ) ) then
|
||||
----print("---Reward config bag space lack."..needspace)
|
||||
return 2 , needspace
|
||||
end
|
||||
return 0 , needspace
|
||||
end
|
||||
|
||||
--ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD>
|
||||
function doRewardConfig (sysarg,rewardConfig)
|
||||
if rewardConfig == nil then return end
|
||||
local myJob = Actor.getIntProperty( sysarg, PROP_ACTOR_VOCATION )
|
||||
local mySex = Actor.getIntProperty(sysarg,PROP_ACTOR_SEX)
|
||||
for i = 1, #rewardConfig do
|
||||
local c = rewardConfig[i]
|
||||
if ( c.rewardtype == 1 ) then
|
||||
if (not c.sex or c.sex == mySex) and (not c.job or c.job == myJob) then
|
||||
Actor.addItem(sysarg,c.itemid,c.quality,c.strong, c.amount,c.bind,0,OldLang.Log.LogclOnAsyncOpResultFunc,205)
|
||||
local itemname = Item.getItemName(c.itemid)
|
||||
if itemname then
|
||||
local allmsg = string.format(OldLang.NoticeStr.q00037,itemname,c.amount)
|
||||
Actor.sendTipmsg(sysarg,allmsg, ttFlyTip)
|
||||
else
|
||||
print("Item.getItemName() failed, itemid = " .. c.itemid);
|
||||
end
|
||||
end
|
||||
elseif ( c.rewardtype == 2 ) then
|
||||
Actor.changeMoney( sysarg, c.type, c.amount,205, OldLang.Log.LogclOnAsyncOpResultFunc)
|
||||
local moneystr = MONEYTYPE[c.type]
|
||||
local allmsg = string.format(moneystr,c.amount)
|
||||
Actor.sendTipmsg(sysarg,allmsg, ttFlyTip)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
--<2D><><EFBFBD>ܸ<EFBFBD><DCB8>ʵķ<CAB5>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
|
||||
|
||||
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
--#include "data/config/item/scriptItemConfig/ProabilityItem.txt" once
|
||||
|
||||
|
||||
--[[
|
||||
--<2D><><EFBFBD><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD>Roll<6C><6C>Ʒ
|
||||
--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><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õĻ<C3B5><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
--]]
|
||||
function ProbablityItemFunc(sysarg,count,itemidx,itemPtr,ItemTable) --<2D><>ʱδ<CAB1>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>count<6E>ֶμ<D6B6><CEBC>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
if(itemidx == nil) then
|
||||
System.trace ("ProbablityItemFunc itemidx ==nil")
|
||||
return
|
||||
end
|
||||
--print ("ProbablityItemFunc"..itemidx)
|
||||
--<2D><>ȡ<EFBFBD><C8A1><EFBFBD>Ŀǰ<C4BF>ж<EFBFBD><D0B6>ٸ<EFBFBD><D9B8>ո<EFBFBD><D5B8>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>
|
||||
local config =ItemTable
|
||||
if(config == nil) then
|
||||
System.trace("ProbablityItemFunc config is nill")
|
||||
return
|
||||
end
|
||||
-- <20><><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>D<EFBFBD><EFBCA4>ſ<EFBFBD>ʹ<EFBFBD><CAB9>
|
||||
if config.needRideActivited and not IsRideActivited(sysarg) then
|
||||
return
|
||||
end
|
||||
|
||||
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵı<CFB5><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
local count = Item.getAllBagMinEmptyGridCount(sysarg)
|
||||
--local count = Item.getBagEmptyGridCount(sysarg)
|
||||
local needGridCount=1 --<2D><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
if( config.needMinBagGrid ~= nil) then
|
||||
needGridCount = config.needMinBagGrid
|
||||
end
|
||||
|
||||
if needGridCount and count < needGridCount then
|
||||
local tipMsg = string.format(OldLang.ScriptTips.x00074,needGridCount)
|
||||
Actor.sendTipmsg( sysarg,tipMsg,ttFlyTip )
|
||||
return false
|
||||
end
|
||||
|
||||
-- <20><>ȡ<EFBFBD><C8A1><EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
local nYb = Actor.getIntProperty(sysarg,PROP_ACTOR_YUANBAO)
|
||||
local needYb = 0
|
||||
if config.needYuanBao and config.needYuanBao > 0 then
|
||||
needYb = config.needYuanBao
|
||||
if nYb < needYb then
|
||||
Actor.sendTipmsg( sysarg,OldLang.Script.comm005, ttFlyTip )
|
||||
return false
|
||||
end
|
||||
local itemName = Item.getItemName(config.item_id);
|
||||
if not Actor.changeMoney(sysarg, 3, -needYb, 842, itemName) then
|
||||
local msg = string.format(OldLang.Script.comm004, needYb, itemName);
|
||||
Actor.sendTipmsg( sysarg, msg, ttFlyTip );
|
||||
return false;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--<2D>ж<EFBFBD><D0B6><EFBFBD>Ʒ<EFBFBD><C6B7>Ҫ<EFBFBD><D2AA><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD>Ŀ
|
||||
local nNeedItemCount = ItemTable.itemCount
|
||||
if(nNeedItemCount == nil) then
|
||||
nNeedItemCount =1
|
||||
end
|
||||
if( Actor.getItemCount(sysarg,itemidx,-1,-1) < nNeedItemCount) then
|
||||
local tipMsg = string.format(OldLang.ScriptTips.x00140,nNeedItemCount)
|
||||
Actor.sendTipmsg( sysarg,tipMsg,ttFlyTip )
|
||||
return false
|
||||
end
|
||||
|
||||
local consumes = {}
|
||||
|
||||
if config.consumes and table.getn(config.consumes) > 0 then
|
||||
for k, v in ipairs(config.consumes) do
|
||||
table.insert(consumes, v)
|
||||
end
|
||||
end
|
||||
|
||||
local consume = {type = 0, id = itemidx, count = nNeedItemCount}
|
||||
table.insert(consumes, consume)
|
||||
|
||||
--[[
|
||||
if CommonFunc.Consumes.SuccessCheck(sysarg, consumes) ~= successCheckResult.ok then
|
||||
return false
|
||||
end
|
||||
]]
|
||||
|
||||
--<2D><>Ҫrollһ<6C><D2BB><EFBFBD><EFBFBD>Ʒ
|
||||
local dropName = "proability"..tostring(itemidx) --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
local drop = System.getObjectVar(dropName)
|
||||
if (not drop) then
|
||||
System.trace("getObjectVar is nil"..itemidx)
|
||||
return
|
||||
end
|
||||
|
||||
local items = drop:proabilityDrop(sysarg)
|
||||
if ( items.itemCount > 0) then
|
||||
for i = items.itemCount - 1, 0, -1 do
|
||||
local result = Actor.canGiveAward(sysarg,
|
||||
items.itemList[i].btAwardType,
|
||||
items.itemList[i].wItemId,
|
||||
items.itemList[i].btCount,
|
||||
items.itemList[i].btQuality,
|
||||
items.itemList[i].btStrong,
|
||||
items.itemList[i].btBind,
|
||||
true)
|
||||
if not result then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--<2D><><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>Ʒ<EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD>ɾ<EFBFBD><C9BE>
|
||||
--if (config.needDelete and (Actor.removeItem(sysarg,itemidx,nNeedItemCount,-1,-1,-1,"Roll",2) ~=nNeedItemCount) ) then --ɾ<><C9BE><EFBFBD><EFBFBD>Ʒʧ<C6B7><CAA7>
|
||||
--[[
|
||||
local bBind = 1
|
||||
local result = successCheckResult.otherLack
|
||||
if (config.needDelete) then
|
||||
result, bBind = Consumes.OnConsumes(sysarg, consumes, 0, 0, 2, "ProabilityItem Roll")
|
||||
if result ~= successCheckResult.ok then
|
||||
return false
|
||||
end
|
||||
end
|
||||
]]
|
||||
|
||||
--[[
|
||||
<09><>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>tips<70>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣬<EFBFBD><E2A3AC>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
||||
Item.addItem(sysarg,itemPtr,"roll",1,items.itemList[i].btCount)
|
||||
if(items.itemList[i].btAuxParam ==1) then
|
||||
local itemDes = Item.getItemLinkMsg(items.itemList[i].wItemId,itemPtr)
|
||||
local tipMsg = string.format(OldLang.ScriptTips.x00085,Actor.getName(sysarg),Item.getItemName(itemidx), itemDes ) --Ҫȫ<D2AA><C8AB><EFBFBD>㲥
|
||||
System.broadcastTipmsg(tipMsg,ttScreenCenter )
|
||||
end
|
||||
--]]
|
||||
|
||||
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>Ʒ
|
||||
|
||||
if ( items.itemCount > 0) then
|
||||
for i=0, items.itemCount -1 do
|
||||
if config.infectBind == nil or config.infectBind ~= true then
|
||||
bBind = items.itemList[i].btBind
|
||||
end
|
||||
|
||||
Actor.giveAward(sysarg,
|
||||
items.itemList[i].btAwardType,
|
||||
items.itemList[i].wItemId,
|
||||
items.itemList[i].btCount,
|
||||
items.itemList[i].btQuality,
|
||||
items.itemList[i].btStrong,
|
||||
bBind,
|
||||
items.itemList[i].nTime,
|
||||
1,"roll")
|
||||
if(items.itemList[i].btAuxParam ==1) then
|
||||
local count = items.itemList[i].btCount
|
||||
local name = Item.getAwardDesc(items.itemList[i].btAwardType,items.itemList[i].wItemId,true,items.itemList[i])
|
||||
if(name ~= nil and name ~= "") then
|
||||
|
||||
if(items.itemList[i].btAwardType == 20) then --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>þ<EFBFBD><C3BE><EFBFBD><EFBFBD>
|
||||
count = Actor.getActivityExp(sysarg,items.itemList[i].wItemId,items.itemList[i].btCount,items.itemList[i].btQuality)
|
||||
end
|
||||
local tipMsg = string.format(OldLang.ScriptTips.x00085,Actor.getName(sysarg),Item.getItemName(itemidx), name,count ) --Ҫȫ<D2AA><C8AB><EFBFBD>㲥
|
||||
System.broadcastTipmsg(tipMsg,ttScreenCenter + ttChatWindow)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--<2D><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۺϱ<DBBA><CFB1><EFBFBD>Ʒ
|
||||
function InitProabilityDropItem(sysarg)
|
||||
-- <20><>ȡ"data/config/item/scriptItemConfig/ProabilityItem.txt"<22>ı<EFBFBD>ProabolityItemConfig
|
||||
for i = 1,table.getn(ProabolityItemConfig) do
|
||||
local x = ProabolityItemConfig[i]
|
||||
|
||||
GlobalItemFn[x.item_id] = { func = ProbablityItemFunc,params =x }
|
||||
|
||||
--<2D>ڳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ȫ<EFBFBD><C8AB>װ<EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD> ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱȥ<CAB1><C8A5><EFBFBD><EFBFBD>
|
||||
local dropName = "proability"..tostring(x.item_id)
|
||||
local boxdrop = System.getObjectVar(dropName)
|
||||
if (not boxdrop) then
|
||||
boxdrop = CBoxDropMgr:getSingleton():createBoxDrop(dropName) -- <20><><EFBFBD><EFBFBD>᷵<EFBFBD><E1B7B5>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(CBoxDrop)
|
||||
end
|
||||
if(boxdrop) then
|
||||
boxdrop:load(x.dropName) -- <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
table.insert(InitFnTable,InitProabilityDropItem)
|
||||
194
server/s1/LogicServer/data/functions/ItemEvent/RollItem.txt
Normal file
194
server/s1/LogicServer/data/functions/ItemEvent/RollItem.txt
Normal file
@@ -0,0 +1,194 @@
|
||||
--类似开箱子的道具,按怪物的掉落爆出物品
|
||||
--添加配置
|
||||
--#include "data\config\item\scriptItemConfig\RollItem.txt" once
|
||||
--#include "data\config\item\scriptItemConfig\PreUseItemConfig.txt" once
|
||||
--#include "data\functions\ItemEvent\ItemUseCount.txt" once
|
||||
|
||||
function PreUseItem(sysarg, itemId, itemPtr, ItemTable)
|
||||
local cfg = PreUseItemConfig[itemId]
|
||||
if cfg then
|
||||
if cfg.startDt then
|
||||
local nNowDt = System.getCurrMiniTime()
|
||||
if nNowDt < cfg.startDt then
|
||||
Actor.sendTipmsg(sysarg, OldLang.Script.comm008, ttFlyTip)
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--[[
|
||||
--按怪物掉落类似的配置Roll一个物品
|
||||
--sysarg:实体的指针
|
||||
--itemidx: 物品的ID
|
||||
--itemPtr: 物品的指针
|
||||
--ItemTable: 配置的参数列表,如果单独调用的话,这里是需要背包格子的数量
|
||||
--]]
|
||||
function RollItemFunc(sysarg,count,itemidx,itemPtr,ItemTable)
|
||||
for idx = 1, count do
|
||||
RollItemFuncImp(sysarg,itemidx,itemPtr,ItemTable)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
function RollItemFuncImp(sysarg,itemidx,itemPtr,ItemTable)
|
||||
--获取玩家目前有多少个空格子,如果格子不够,就返回
|
||||
local count = Item.getBagEmptyGridCount(sysarg)
|
||||
local needGridCount=1
|
||||
if( type( ItemTable ) == 'number' ) then
|
||||
needGridCount = ItemTable
|
||||
else
|
||||
needGridCount = ItemTable.needMinBagGrid
|
||||
end
|
||||
|
||||
if(itemidx == 791)then --銮金宝箱
|
||||
local nMyGuildId = Actor.getGuildId(sysarg)
|
||||
if(nMyGuildId < 1)then
|
||||
Actor.sendTipmsg( sysarg,OldLang.NoticeStr.n029, ttFlyTip )
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
--判断物品需要消耗的数目
|
||||
local nNeedItemCount = ItemTable.itemCount
|
||||
if nNeedItemCount == nil then
|
||||
nNeedItemCount = 1
|
||||
end
|
||||
local myItemCount = Actor.getItemCount(sysarg,itemidx,-1,-1)
|
||||
if myItemCount < nNeedItemCount then
|
||||
local tipMsg = string.format(OldLang.Script.comm009, nNeedItemCount)
|
||||
Actor.sendTipmsg( sysarg,tipMsg, ttFlyTip )
|
||||
return false
|
||||
end
|
||||
|
||||
if needGridCount and count < needGridCount then
|
||||
if ItemTable.needDelete and nNeedItemCount == myItemCount and (count +1)>= needGridCount then
|
||||
--允许删除item之后多空出一个格子来放roll出来的物品
|
||||
else
|
||||
local tipMsg = string.format(OldLang.Script.comm001,needGridCount)
|
||||
Actor.sendTipmsg( sysarg,tipMsg,ttFlyTip )
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
if not PreUseItem(sysarg, itemidx,itemPtr,ItemTable) then
|
||||
return false
|
||||
end
|
||||
|
||||
--需要roll一个物品
|
||||
local dropName = "roll"..tostring(itemidx) --按名字索引的
|
||||
local drop = System.getObjectVar(dropName)
|
||||
if (not drop) then
|
||||
System.trace("getObjectVar is nil"..itemidx)
|
||||
return
|
||||
end
|
||||
|
||||
--[[
|
||||
drop:drop(sysarg),怪物掉落模式,对于group>0的,是否出道具,除了判断propability的比率,
|
||||
还受怪物死亡次数影响,即同group不一定必出;
|
||||
drop:proabilityDrop(sysarg),宝箱掉落模式,对于groupid>0的,是否出道具,仅判断propability的比率,
|
||||
即同group必出一个
|
||||
]]
|
||||
--local items = drop:drop(sysarg)
|
||||
local items = drop:proabilityDrop(sysarg)
|
||||
--print("drop:proabilityDrop()...")
|
||||
for i = items.itemCount - 1, 0, -1 do
|
||||
local result = Actor.canGiveAward(sysarg,
|
||||
items.itemList[i].btAwardType,
|
||||
items.itemList[i].wItemId,
|
||||
items.itemList[i].btCount,
|
||||
items.itemList[i].btQuality,
|
||||
items.itemList[i].btStrong,
|
||||
items.itemList[i].btBind,
|
||||
true)
|
||||
if not result then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
--如果需要删除物品的话就删除
|
||||
if ItemTable.needDelete then
|
||||
|
||||
if ItemUseCountCfg[itemidx] then
|
||||
|
||||
local lastTimes, maxTimes = getItemUseCount(sysarg, itemidx)
|
||||
if lastTimes <= 0 then
|
||||
Actor.sendTipmsg( sysarg, OldLang.Script.ItemUseCount001, ttFlyTip )
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local logDesc = OldLang.Script.comm007
|
||||
local logId = 3
|
||||
if itemPtr then
|
||||
local delCount = Actor.removeItemByPtr(sysarg,itemPtr,nNeedItemCount,true,logDesc, logId)
|
||||
local otherDelCount = nNeedItemCount - delCount
|
||||
if otherDelCount > 0 then
|
||||
Actor.removeItem(sysarg,itemidx,otherDelCount,-1,-1,-1, logDesc, logId)
|
||||
end
|
||||
else
|
||||
if nNeedItemCount ~= Actor.removeItem(sysarg,itemidx,nNeedItemCount,-1,-1,-1, logDesc, logId) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
if ItemUseCountCfg[itemidx] then
|
||||
AddDailyItemUseCount(sysarg, itemidx, nNeedItemCount)
|
||||
end
|
||||
end
|
||||
|
||||
--遍历掉落列表,并添加玩家的物品
|
||||
if items.itemCount > 0 then
|
||||
for i=0, items.itemCount -1 do
|
||||
Actor.giveAward(sysarg,
|
||||
items.itemList[i].btAwardType,
|
||||
items.itemList[i].wItemId,
|
||||
items.itemList[i].btCount,
|
||||
items.itemList[i].btQuality,
|
||||
items.itemList[i].btStrong,
|
||||
items.itemList[i].btBind,
|
||||
items.itemList[i].nTime,
|
||||
337,
|
||||
"roll",
|
||||
items.itemList[i].nQualityDataIndex) --nQualityDataIndex默认为0,此值需要>0才有效
|
||||
|
||||
if(items.itemList[i].btAuxParam ==1) then
|
||||
local count = items.itemList[i].btCount
|
||||
local name = Item.getAwardDesc(items.itemList[i].btAwardType,items.itemList[i].wItemId)
|
||||
if(name ~= nil and name ~= "") then
|
||||
if(items.itemList[i].btAwardType == 20) then --按经验表里配置经验的
|
||||
count = Actor.getActivityExp(sysarg,items.itemList[i].wItemId,items.itemList[i].btCount,items.itemList[i].btQuality)
|
||||
end
|
||||
local tipMsg = string.format(OldLang.Script.comm006,Actor.getName(sysarg),Item.getItemName(itemidx),name,count ) --要全服广播
|
||||
System.broadcastTipmsg(tipMsg, ttChatWindow )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function RollItemsInit(sysarg)
|
||||
for i = 1,table.getn(RollItemConfig) do
|
||||
local x = RollItemConfig[i]
|
||||
--如果只执行爆率的话,那么就注册调用函数
|
||||
if x.onlyDoRoll then
|
||||
GlobalItemFn[x.item_id] = { func = RollItemFunc,params =x }
|
||||
end
|
||||
--在初始化的时候全部装载进来 ,避免后期临时去加载
|
||||
local dropName = "roll"..tostring(x.item_id)
|
||||
local boxdrop = System.getObjectVar(dropName)
|
||||
if not boxdrop then
|
||||
boxdrop = CBoxDropMgr:getSingleton():createBoxDrop(dropName) -- 这里会返回一个宝箱掉落对象(CBoxDrop)
|
||||
end
|
||||
|
||||
if boxdrop then
|
||||
boxdrop:load(x.dropName)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(InitFnTable,RollItemsInit)
|
||||
@@ -0,0 +1,55 @@
|
||||
--boss令
|
||||
|
||||
----#include "data\functions\ItemEvent\ItemUseCount.txt" once
|
||||
--#include "data\functions\GlobalMiscExpand\GlobalMisc.txt" once
|
||||
--#include "data\config\item\BossToken.txt" once
|
||||
|
||||
|
||||
function UseBossToken(sysarg, count, itemidx, itemPtr,ItemTable, delType, param)
|
||||
--local lastTimes, maxTimes = getItemUseCount(sysarg, itemidx)
|
||||
--if lastTimes <= 0 then
|
||||
-- local MaxDailyUseCircleSoulItemTimes = ItemUseCountCfg[itemidx].dailyUseLimit
|
||||
-- Actor.sendTipmsg( sysarg, OldLang.Script.EscortTips030, ttFlyTip )
|
||||
-- return
|
||||
--end
|
||||
if Actor.getSceneId(sysarg) ~= bossTokenConfig.senceId then
|
||||
Actor.sendTipmsg( sysarg, OldLang.Script.UseBossToken001, ttFlyTip )
|
||||
return
|
||||
end
|
||||
if Actor.hasMapAreaAttri(sysarg, aaSaft) then
|
||||
Actor.sendTipmsg( sysarg, OldLang.Script.UseBossToken004, ttFlyTip )
|
||||
return
|
||||
end
|
||||
local SenceName,x,y = Actor.getSceneName(sysarg,0,0)
|
||||
local logId, logStr = 301, OldLang.Log.UseBossToken
|
||||
if Actor.removeItemByPtr(sysarg, itemPtr, 1, true, logStr, logId) > 0 then
|
||||
--if AddDailyItemUseCount(sysarg, itemidx, 1) then --次数增加,并发送客户端
|
||||
local bossId = ItemTable.bossId
|
||||
BossTokenMonsterCreate(sysarg, bossId, x, y)
|
||||
return true
|
||||
--Actor.sendTipmsg( sysarg, string.format(OldLang.Script.EscortTips031, lastTimes-1), ttFlyTip )
|
||||
--end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function BossTokenMonsterCreate(sysarg, bossId, x, y) --boss创建
|
||||
local hScene = Actor.getSceneHandle(sysarg)
|
||||
bossarg = Fuben.createMonster(hScene, bossId, x, y, bossTokenConfig.lastTime)
|
||||
bossName = System.getMonsterNameById(bossId)
|
||||
local tip = string.format(OldLang.Script.UseBossToken002, Actor.getName(sysarg), bossName, x, y)
|
||||
System.broadcastTipmsg(tip , ttChatWindow, bossTokenConfig.BroadCastLevel )
|
||||
local actorId = Actor.getActorId(sysarg)
|
||||
Actor.SetForceVesterId(bossarg, actorId)
|
||||
--print("bossTokenConfig.lastTime="..bossTokenConfig.lastTime)
|
||||
Actor.regScriptTimer(bossarg, 0, bossTokenConfig.lastTime * 1000, 0, 1, "OnUseTokenBossEnd", actorId)
|
||||
end
|
||||
|
||||
function UseBossTokenInit(sysarg)
|
||||
for i = 1,table.getn(bossTokenConfig.bossTokenList) do
|
||||
local x = bossTokenConfig.bossTokenList[i]
|
||||
GlobalItemFn[x.itemId] = { func = UseBossToken, params = x }
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(InitFnTable, UseBossTokenInit)
|
||||
@@ -0,0 +1,41 @@
|
||||
--英魂道具
|
||||
|
||||
--#include "data\functions\ItemEvent\ItemUseCount.txt" once
|
||||
--#include "data\functions\GlobalMiscExpand\GlobalMisc.txt" once
|
||||
--#include "data\config\item\CircleSoulItem.txt" once
|
||||
|
||||
|
||||
function UseCircleSoulItem(sysarg, count, itemidx, itemPtr,ItemTable, delType, param)
|
||||
local lastTimes, maxTimes = getItemUseCount(sysarg, itemidx)
|
||||
if lastTimes <= 0 then
|
||||
local MaxDailyUseCircleSoulItemTimes = ItemUseCountCfg[itemidx].dailyUseLimit
|
||||
Actor.sendTipmsg( sysarg, OldLang.Script.CircleSoul001, ttFlyTip )
|
||||
return
|
||||
end
|
||||
local useCount = count
|
||||
if useCount > lastTimes then
|
||||
useCount = lastTimes
|
||||
end
|
||||
useCount = Actor.removeItemByPtr(sysarg, itemPtr, useCount, true, "CircleSoule", 133)
|
||||
if useCount > 0 then
|
||||
if AddDailyItemUseCount(sysarg, itemidx, useCount) then --次数增加,并发送客户端
|
||||
local nValue = ItemTable.value*useCount
|
||||
Actor.giveAward(sysarg,14,0,nValue,0,0,0,0,133,"CircleItem")
|
||||
Actor.sendTipmsg( sysarg, string.format(OldLang.Script.CircleSoul002, nValue, lastTimes-useCount), ttFlyTip )
|
||||
AddDailyActivityDoneNum(sysarg, enDailyActId_UseCircleSoulItem, useCount) --领取英魂道具一次1次
|
||||
end
|
||||
return true,useCount
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function UseCircleSoulItemInit(sysarg)
|
||||
for i = 1,table.getn(CircleSoulItem) do
|
||||
local x = CircleSoulItem[i]
|
||||
GlobalItemFn[x.item_id] = { func = UseCircleSoulItem, params = x }
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(InitFnTable, UseCircleSoulItemInit)
|
||||
@@ -0,0 +1,61 @@
|
||||
--lua script
|
||||
--ʹ<><CAB9><EFBFBD><EFBFBD>ʯ<EFBFBD><CAAF><EFBFBD>忨
|
||||
--#include "data\functions\GlobalMiscExpand\GlobalMisc.txt" once
|
||||
--#include "data\config\item\ConcVipItem.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 UseConcVipItem(sysarg, count, itemidx, itemPtr,ItemTable, delType, param) --<2D><>ʯ<EFBFBD><CAAF><EFBFBD>忨<EFBFBD><E5BFA8>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
--print("UseConcVipItem, itemidx="..itemidx)
|
||||
if(Actor.getItemCount(sysarg, itemidx) == 0) then
|
||||
Actor.sendTipmsg( sysarg, OldLang.Script.comm015, ttFlyTip )
|
||||
return
|
||||
end
|
||||
|
||||
local vipType = ItemTable.vipType
|
||||
if not vipType then --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʯ<EFBFBD><CAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Actor.sendTipmsg( sysarg,OldLang.Script.vipConc021, ttTipmsgWindow + ttFly)
|
||||
return
|
||||
end
|
||||
|
||||
local vip = VipConcCfg.Vips[vipType]
|
||||
if not vip then
|
||||
Actor.sendTipmsg( sysarg,OldLang.Script.vipConc021, ttTipmsgWindow + ttFly)
|
||||
return
|
||||
end
|
||||
|
||||
if Actor.removeItemByPtr(sysarg, itemPtr, 1, true, "ConcVipItem", 233) > 0 then
|
||||
if not Actor.isConcurrentVip( sysarg, vipType ) then
|
||||
if DoBuyConcVip( sysarg, vip, ItemTable.addHour ) then --<2D><><EFBFBD><EFBFBD>
|
||||
local actorId = Actor.getActorId(sysarg)
|
||||
local actorName = Actor.getName(sysarg)
|
||||
System.sendCommonLog(234, actorId, actorName, vipType, ItemTable.item_id, ConcVipWay.AddByItem, "", "",
|
||||
OldLang.Script.vipConc025)
|
||||
end
|
||||
else
|
||||
if DoRenewalConcVip( sysarg, vip, ItemTable.addHour ) then --<2D><><EFBFBD><EFBFBD>
|
||||
local actorId = Actor.getActorId(sysarg)
|
||||
local actorName = Actor.getName(sysarg)
|
||||
System.sendCommonLog(234, actorId, actorName, vipType, ItemTable.item_id, ConcVipWay.AddByItem, "", "",
|
||||
OldLang.Script.vipConc026)
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function UseConcVipItemInit(sysarg)
|
||||
for i = 1,table.getn(ConcVipItemTable) do
|
||||
local x = ConcVipItemTable[i]
|
||||
GlobalItemFn[x.item_id] = { func = UseConcVipItem, params = x }
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(InitFnTable, UseConcVipItemInit)
|
||||
67
server/s1/LogicServer/data/functions/ItemEvent/UseExpBox.txt
Normal file
67
server/s1/LogicServer/data/functions/ItemEvent/UseExpBox.txt
Normal file
@@ -0,0 +1,67 @@
|
||||
--lua script
|
||||
--ʹ<>þ<EFBFBD><C3BE><EFBFBD>ħ<EFBFBD><C4A7>(ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, UseExpJade.txt)
|
||||
--#include "data\functions\ItemEvent\ItemUseCount.txt" once
|
||||
--#include "data\functions\GlobalMiscExpand\GlobalMisc.txt" once
|
||||
--#include "data\config\item\ExpBox.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 UseExpBox(sysarg, count, itemidx, itemPtr,ItemTable, delType, param) -- count <20><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>ܶѵ<DCB6><D1B5><EFBFBD>
|
||||
--print("UseExpBox, itemidx="..itemidx)
|
||||
if(Actor.getItemCount(sysarg, itemidx) == 0) then
|
||||
Actor.sendTipmsg( sysarg,OldLang.ScriptTips.comm013,ttTipmsgWindow )
|
||||
return
|
||||
end
|
||||
|
||||
--local todayTimes = GetDailyFlag(sysarg, DailyFlagDefine.UseExpBoxTimes) or 0
|
||||
local lastTimes, maxTimes = getItemUseCount(sysarg, itemidx)
|
||||
--print("UseExpBox, lastTimes="..lastTimes..", maxTimes="..maxTimes)
|
||||
if lastTimes <= 0 then
|
||||
Actor.sendTipmsg( sysarg, OldLang.Script.ExpBox001, ttFlyTip )
|
||||
return
|
||||
end
|
||||
|
||||
local nExpMax = Item.getItemProperty(sysarg, itemPtr, Item.ipItemDuaMax, 0) --<2D><><EFBFBD><EFBFBD><EFBFBD>
|
||||
local nExpHas = Item.getItemProperty(sysarg, itemPtr, Item.ipItemDua, 0) --<2D><><EFBFBD>о<EFBFBD><D0BE><EFBFBD>
|
||||
--print("UseExpBox, nExpMax="..nExpMax..", nExpHas="..nExpHas)
|
||||
if nExpHas < nExpMax then --<2D><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>
|
||||
Actor.sendTipmsg( sysarg, OldLang.Script.ExpBox002, ttFlyTip )
|
||||
return
|
||||
end
|
||||
|
||||
if nExpHas > nExpMax then --<2D><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
nExpHas = nExpMax
|
||||
end
|
||||
|
||||
if Actor.removeItemByPtr(sysarg, itemPtr, 1, true, "ExpBox", 219) > 0 then
|
||||
if AddDailyItemUseCount(sysarg, itemidx, 1) then --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϳͻ<CDBF><CDBB><EFBFBD>
|
||||
AddExpToActor(sysarg, nExpHas, 218 )
|
||||
Actor.sendTipmsg( sysarg, string.format(OldLang.Script.ExpBox003, nExpHas, lastTimes-1), ttFlyTip )
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function GetExpBoxTableFromId(itemId)
|
||||
for k, v in ipairs(ExpBoxTable) do
|
||||
if v.item_id == itemId then
|
||||
return v
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function UseExpBoxItemInit(sysarg)
|
||||
for i = 1,table.getn(ExpBoxTable) do
|
||||
local x = ExpBoxTable[i]
|
||||
GlobalItemFn[x.item_id] = { func = UseExpBox, params = x }
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(InitFnTable, UseExpBoxItemInit)
|
||||
@@ -0,0 +1,38 @@
|
||||
--经验勾玉
|
||||
|
||||
--#include "data\functions\ItemEvent\ItemUseCount.txt" once
|
||||
--#include "data\functions\GlobalMiscExpand\GlobalMisc.txt" once
|
||||
--#include "data\config\item\ExpJade.txt" once
|
||||
|
||||
|
||||
function UseExpJadeItem(sysarg, count, itemidx, itemPtr,ItemTable, delType, param)
|
||||
local lastTimes, maxTimes = getItemUseCount(sysarg, itemidx)
|
||||
if lastTimes <= 0 then
|
||||
local MaxDailyUseTimes = ItemUseCountCfg[itemidx].dailyUseLimit
|
||||
Actor.sendTipmsg( sysarg, OldLang.Script.ExpJade001, ttFlyTip )
|
||||
return
|
||||
end
|
||||
local useCount = count
|
||||
if useCount > lastTimes then
|
||||
useCount = lastTimes
|
||||
end
|
||||
useCount = Actor.removeItemByPtr(sysarg, itemPtr, useCount, true, "ExpJade",221)
|
||||
if useCount > 0 then
|
||||
if AddDailyItemUseCount(sysarg, itemidx, useCount) then --次数增加,并发送客户端
|
||||
local expVal = Actor.getActivityExp(sysarg, ItemTable.expTab, ItemTable.value, 0) * useCount
|
||||
Actor.giveAward(sysarg,1,0,expVal,0,0,0,0,221,"ExpJade")
|
||||
Actor.sendTipmsg( sysarg, string.format(OldLang.Script.ExpJade002, expVal, lastTimes-useCount), ttFlyTip )
|
||||
end
|
||||
return true,useCount
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function UseExpJadeItemInit(sysarg)
|
||||
for i = 1,table.getn(ExpJadeTable) do
|
||||
local x = ExpJadeTable[i]
|
||||
GlobalItemFn[x.item_id] = { func = UseExpJadeItem, params = x }
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(InitFnTable, UseExpJadeItemInit)
|
||||
@@ -0,0 +1,73 @@
|
||||
--#include "data\functions\ItemEvent\ItemUseCount.txt" once
|
||||
--#include "data\functions\GlobalMiscExpand\GlobalMisc.txt" once
|
||||
--#include "data\config\item\HeroExp.txt" once
|
||||
--#include "data\config\Hero\HeroConfig.txt" once
|
||||
|
||||
--英雄经验丹
|
||||
|
||||
function UseHeroExpItem(sysarg, count, itemidx, itemPtr,ItemTable, delType, param)
|
||||
if(Actor.getItemCount(sysarg, itemidx) == 0) then
|
||||
Actor.sendTipmsg( sysarg,OldLang.Script.HeroItem001,ttFlyTip)
|
||||
return
|
||||
end
|
||||
local nHeroId = Hero.getBattleHeroId(sysarg)
|
||||
if nHeroId == -1 then
|
||||
Actor.sendTipmsg( sysarg,OldLang.Script.HeroItem002,ttFlyTip)
|
||||
return
|
||||
end
|
||||
--判断英雄等级是否已经到了本阶最高等级
|
||||
local Stage = Hero.getHeroProperty(sysarg,nHeroId,enHeroStage)
|
||||
local Level = Hero.getHeroProperty(sysarg,nHeroId,enHeroLevel)
|
||||
local Exp = Hero.getHeroProperty(sysarg,nHeroId,enHeroExp)
|
||||
local cfg = HeroConfig.HeroList[nHeroId]
|
||||
if not cfg then
|
||||
return
|
||||
end
|
||||
local LevelCfg = cfg.Levels[Level]
|
||||
local StageCfg = cfg.Stages[Stage]
|
||||
if not StageCfg or not LevelCfg then
|
||||
return
|
||||
end
|
||||
local MaxLevel = StageCfg.MaxLevel
|
||||
local MaxExp = LevelCfg.LevelUpExp
|
||||
if Level == MaxLevel and Exp >= MaxExp then
|
||||
Actor.sendTipmsg( sysarg,OldLang.Script.Hero009,ttFlyTip)
|
||||
return
|
||||
end
|
||||
|
||||
local canAddExp = MaxExp - Exp
|
||||
if Level < MaxLevel then
|
||||
for idx = Level + 1, MaxLevel do
|
||||
LevelCfg = cfg.Levels[idx]
|
||||
canAddExp = canAddExp + LevelCfg.LevelUpExp
|
||||
end
|
||||
end
|
||||
local useCount = math.ceil(canAddExp/ItemTable.exp)
|
||||
if useCount > count then
|
||||
useCount = count
|
||||
end
|
||||
useCount = Actor.removeItemByPtr(sysarg, itemPtr, useCount, true, "HeroExp",303)
|
||||
if useCount > 0 then
|
||||
local addExp = ItemTable.exp * useCount
|
||||
if addExp > canAddExp then
|
||||
addExp = canAddExp
|
||||
end
|
||||
Hero.addExp(sysarg, addExp)
|
||||
local ItemName = Item.getItemName(ItemTable.itemid)
|
||||
Actor.sendTipmsg( sysarg, string.format(OldLang.Script.HeroItem003, useCount, ItemName,addExp), ttFlyTip )
|
||||
return true,useCount
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function UseHeroExpInit(sysarg)
|
||||
for i = 1,table.getn(HeroExpConfig) do
|
||||
local x = HeroExpConfig[i]
|
||||
GlobalItemFn[x.itemid] = { func = UseHeroExpItem, params = x }
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(InitFnTable, UseHeroExpInit)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
--#include "data\functions\ItemEvent\ItemUseCount.txt" once
|
||||
--#include "data\functions\GlobalMiscExpand\GlobalMisc.txt" once
|
||||
--#include "data\config\item\HeroForce.txt" once
|
||||
--#include "data\config\Hero\HeroConfig.txt" once
|
||||
--#include "data\functions\ItemEvent\ItemUseCount.txt" once
|
||||
--#include "data\functions\GlobalMiscExpand\GlobalMisc.txt" once
|
||||
|
||||
--英雄体力丹
|
||||
|
||||
function UseHeroForceItem(sysarg, count, itemidx, itemPtr,ItemTable, delType, param)
|
||||
local lastTimes, maxTimes = getItemUseCount(sysarg, itemidx)
|
||||
if lastTimes <= 0 then
|
||||
Actor.sendTipmsg( sysarg, OldLang.Script.HeroItem008, ttFlyTip )
|
||||
return
|
||||
end
|
||||
local useCount = count
|
||||
if useCount > lastTimes then
|
||||
useCount = lastTimes
|
||||
end
|
||||
if(Actor.getItemCount(sysarg, itemidx) == 0) then
|
||||
Actor.sendTipmsg( sysarg,OldLang.Script.HeroItem004,ttFlyTip)
|
||||
return
|
||||
end
|
||||
local nHeroId = Hero.getBattleHeroId(sysarg)
|
||||
if nHeroId == -1 then
|
||||
local nDefHero = Hero.getHeroProperty(sysarg,1,enHeroLevel)
|
||||
if nDefHero > 0 then
|
||||
nHeroId = 1
|
||||
else
|
||||
Actor.sendTipmsg( sysarg,OldLang.Script.HeroItem007,ttFlyTip)
|
||||
return
|
||||
end
|
||||
end
|
||||
local HeroCfg = HeroConfig.HeroList[nHeroId]
|
||||
if HeroCfg then
|
||||
local nMaxForce = HeroCfg.MaxForce
|
||||
local nForce = Hero.getHeroProperty(sysarg,nHeroId,enHeroForce)
|
||||
local nOldForce = nForce
|
||||
nForce = nForce + ItemTable.force * count
|
||||
if nForce > nMaxForce then
|
||||
Actor.sendTipmsg( sysarg,OldLang.Script.HeroItem005,ttFlyTip)
|
||||
return
|
||||
end
|
||||
local useCount = Actor.removeItemByPtr(sysarg, itemPtr, count, true, "HeroForce",327)
|
||||
if useCount > 0 then
|
||||
nForce = nOldForce + ItemTable.force * useCount
|
||||
Hero.setHeroProperty(sysarg,nHeroId,enHeroForce,nForce)
|
||||
local nAdd = nForce - nOldForce
|
||||
Actor.sendTipmsg( sysarg, string.format(OldLang.Script.HeroItem006,nAdd), ttFlyTip )
|
||||
AddDailyItemUseCount(sysarg, itemidx, 1)
|
||||
return true,useCount
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UseHeroForceInit(sysarg)
|
||||
for i = 1,table.getn(HeroForceConfig) do
|
||||
local x = HeroForceConfig[i]
|
||||
GlobalItemFn[x.itemid] = { func = UseHeroForceItem, params = x }
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(InitFnTable, UseHeroForceInit)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
--劫镖道具
|
||||
|
||||
--#include "data\functions\ItemEvent\ItemUseCount.txt" once
|
||||
--#include "data\functions\GlobalMiscExpand\GlobalMisc.txt" once
|
||||
--#include "data\config\item\JieBiaoBox.txt" once
|
||||
|
||||
|
||||
function UseJieBiaoBox(sysarg, count, itemidx, itemPtr,ItemTable, delType, param)
|
||||
local lastTimes, maxTimes = getItemUseCount(sysarg, itemidx)
|
||||
if lastTimes <= 0 then
|
||||
local MaxDailyUseCircleSoulItemTimes = ItemUseCountCfg[itemidx].dailyUseLimit
|
||||
Actor.sendTipmsg( sysarg, OldLang.Script.EscortTips030, ttFlyTip )
|
||||
return
|
||||
end
|
||||
local useCount = count
|
||||
if useCount > lastTimes then
|
||||
useCount = lastTimes
|
||||
end
|
||||
useCount = Actor.removeItemByPtr(sysarg, itemPtr, useCount, true, "JieBiaoBox", 286)
|
||||
if useCount > 0 then
|
||||
if AddDailyItemUseCount(sysarg, itemidx, useCount) then --次数增加,并发送客户端
|
||||
local logId, logStr = 286, "JieBiaoBox"
|
||||
local awards = GetAwardsByRate(ItemTable.Awards, useCount)
|
||||
CommonFunc.Awards.Give(sysarg, awards, logId, logStr)
|
||||
Actor.sendTipmsg( sysarg, string.format(OldLang.Script.EscortTips031, lastTimes-useCount), ttFlyTip )
|
||||
end
|
||||
return true,useCount
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function UseJieBiaoBoxInit(sysarg)
|
||||
for i = 1,table.getn(JieBiaoBox) do
|
||||
local x = JieBiaoBox[i]
|
||||
GlobalItemFn[x.itemid] = { func = UseJieBiaoBox, params = x }
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(InitFnTable, UseJieBiaoBoxInit)
|
||||
200
server/s1/LogicServer/data/functions/ItemEvent/UseNormalItem.txt
Normal file
200
server/s1/LogicServer/data/functions/ItemEvent/UseNormalItem.txt
Normal file
@@ -0,0 +1,200 @@
|
||||
--#include "data\config\item\NormalItem.txt" once
|
||||
--#include "data\functions\ItemEvent\ItemUseCount.txt" once
|
||||
|
||||
--回城券,随机传送卷
|
||||
function BackToCityFunc(sysarg,count,itemidx,itemPtr,ItemTable) --count 无效,一次只能用一个
|
||||
|
||||
if not Actor.canUseItem(sysarg,itemidx) then
|
||||
Actor.sendTipmsg( sysarg, Lang.Script.UserItem001,ttTipmsgWindow )
|
||||
return false
|
||||
end
|
||||
--红名
|
||||
if Actor.GetNameColorData(sysarg) == 3 then
|
||||
Actor.sendTipmsg(sysarg,Lang.Script.UserItem002,ttFlyTip)
|
||||
return false
|
||||
end
|
||||
--其他限制尚未添加...
|
||||
if ItemTable.usedura == false then
|
||||
Actor.removeItemByPtr(sysarg, itemPtr, 1, true, Lang.Log.UserItem001, 166)
|
||||
else
|
||||
local duaMax = Item.getItemProperty( sysarg, itemPtr, Item.ipItemDuaMax, 0)
|
||||
local dua = Item.getItemProperty( sysarg, itemPtr, Item.ipItemDua, 0 )
|
||||
local duaRemain = duaMax - dua
|
||||
if duaRemain < 1000 then
|
||||
return false
|
||||
end
|
||||
dua = dua + 1000
|
||||
Item.setItemProperty( sysarg, itemPtr, Item.ipItemDua, dua)
|
||||
if dua == duaMax then
|
||||
Actor.removeItemByPtr(sysarg, itemPtr, 1, true, Lang.Log.UserItem001, 166)
|
||||
end
|
||||
end
|
||||
local sendType = ItemTable.type or 2
|
||||
if sendType == 1 then
|
||||
System.telportScene(sysarg, ItemTable.SceneId, ItemTable.x, ItemTable.y)
|
||||
elseif sendType == 2 then
|
||||
System.telportRandPos(sysarg)
|
||||
elseif sendType == 3 then
|
||||
Actor.returnCity(sysarg)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
--经验丹
|
||||
function UseExpItemFunc(sysarg,count,itemidx,itemPtr,ItemTable) --不能堆叠,一次只能吃一个
|
||||
local idx1 = 0
|
||||
local idx2 = 0
|
||||
local level = Actor.getIntProperty(sysarg, PROP_CREATURE_LEVEL)
|
||||
for k, v in ipairs(ExpItem) do
|
||||
if v.item_id == itemidx then
|
||||
idx1 = k
|
||||
for x,y in ipairs(v.level) do
|
||||
if level >= y.min and level <= y.max then
|
||||
idx2 = x
|
||||
break
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
if idx1 == 0 or idx2 == 0 then
|
||||
return false
|
||||
end
|
||||
local upLevel = ExpItem[idx1].level[idx2].level
|
||||
local upExp = ExpItem[idx1].level[idx2].exp
|
||||
--转数判断
|
||||
local ReachLevel = Actor.AddExpReachLevel(sysarg,upExp)
|
||||
local circle = Actor.getIntProperty(sysarg, PROP_ACTOR_CIRCLE)
|
||||
local circleMaxLevel = System.getPlayerMaxLevel(circle)
|
||||
if upExp > 0 and ReachLevel > circleMaxLevel then
|
||||
local str = string.format(Lang.Script.ExpItem001,circleMaxLevel)
|
||||
Actor.sendTipmsg(sysarg,str,ttFlyTip)
|
||||
return
|
||||
elseif upExp > 0 and level == circleMaxLevel then
|
||||
local levelupExp = Actor.GetLevelExp(sysarg,level+1)
|
||||
local actorExp = Actor.getUInt64Property(sysarg, PROP_ACTOR_EXP)
|
||||
if actorExp + upExp > levelupExp then
|
||||
local str = string.format(Lang.Script.ExpItem001,circleMaxLevel)
|
||||
Actor.sendTipmsg(sysarg,str,ttFlyTip)
|
||||
return
|
||||
end
|
||||
end
|
||||
--判断是否到本转最高级
|
||||
if level == circleMaxLevel and upLevel > 0 then
|
||||
local str = string.format(Lang.Script.ExpItem001,circleMaxLevel)
|
||||
Actor.sendTipmsg(sysarg,str,ttFlyTip)
|
||||
return
|
||||
end
|
||||
local delCount = Actor.removeItemByPtr(sysarg, itemPtr, 1, true, Lang.Log.UserItem002, 183)
|
||||
if delCount < 1 then
|
||||
return false
|
||||
end
|
||||
if upLevel > 0 then
|
||||
Actor.giveAward(sysarg, qatUpgrade,0,upLevel,0,0,0,0,183, Lang.Log.UserItem002)
|
||||
end
|
||||
if upExp > 0 then
|
||||
Actor.giveAward(sysarg, qatExp,0,upExp,0,0,0,0,183, Lang.Log.UserItem002)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--战神油
|
||||
function repairAllEquipItemFunc(sysarg,count,itemidx,itemPtr,ItemTable) -- count 无效,不能批量使用
|
||||
local repairTabEquip = {}
|
||||
local repairTabMaxDua = {}
|
||||
local equipCount = Item.getEquipCount( sysarg ) --玩家穿着装备数
|
||||
for i = 1, equipCount do
|
||||
local equipPtr = Item.getEquipBySortID( sysarg, i )
|
||||
if equipPtr then
|
||||
local curDua = Item.getItemProperty( sysarg, equipPtr, Item.ipItemDua, 0 )
|
||||
local maxDua = Item.getItemProperty( sysarg, equipPtr, Item.ipItemDuaMax, 0 )
|
||||
if curDua < maxDua then
|
||||
table.insert(repairTabEquip, equipPtr)
|
||||
table.insert(repairTabMaxDua, maxDua)
|
||||
end
|
||||
end
|
||||
end
|
||||
local msgId = Lang.Script.zf045
|
||||
if #repairTabEquip > 0 then
|
||||
if ItemTable.needDelete then
|
||||
if Actor.removeItemByPtr(sysarg, itemPtr, 1, true, Lang.Log.l00111, 190) <= 0 then
|
||||
return false
|
||||
end
|
||||
end
|
||||
for idx, equipPtr in ipairs(repairTabEquip) do
|
||||
Item.setItemProperty( sysarg, equipPtr, Item.ipItemDua, repairTabMaxDua[idx] )
|
||||
end
|
||||
msgId = Lang.Script.zf044
|
||||
end
|
||||
Actor.sendTipmsg(sysarg, msgId, ttChatWindow)
|
||||
return true
|
||||
end
|
||||
|
||||
--祝福油
|
||||
function useBlessOilFunc(sysarg,count,itemidx,itemPtr,ItemTable) -- count无效,不能批量使用祝福油
|
||||
local weaponPtr = Item.getEquipByType(sysarg, Item.itWeapon)
|
||||
if not weaponPtr then
|
||||
Actor.sendTipmsg(sysarg, Lang.Script.itemFunctionTips000001, ttFlyTip)
|
||||
return false
|
||||
end
|
||||
local luckVal = Item.getItemProperty(sysarg, weaponPtr, Item.ipItemLuck, 0)
|
||||
local msgId = string.format(Lang.Script.itemFunctionTips000002,luckVal)
|
||||
if luckVal < 0 then
|
||||
luckVal = luckVal + ItemTable.blessVal
|
||||
if luckVal >= 0 then
|
||||
msgId = string.format(Lang.Script.itemFunctionTips000003,luckVal)
|
||||
else
|
||||
msgId = string.format(Lang.Script.itemFunctionTips000004,-luckVal)
|
||||
end
|
||||
else
|
||||
|
||||
if ItemTable.maxLv > 0 and luckVal >= ItemTable.maxLv then
|
||||
Actor.sendTipmsg(sysarg, string.format(Lang.Script.itemFunctionTips000007,ItemTable.maxLv), ttChatWindow + ttFlyTip)
|
||||
return
|
||||
end
|
||||
|
||||
local succRates = ItemTable.succRate[luckVal + ItemTable.blessVal] or ItemTable.succRate[#ItemTable.succRate]
|
||||
local noChgRates = ItemTable.noChgRate[luckVal + ItemTable.blessVal] or ItemTable.noChgRate[#ItemTable.failRate]
|
||||
local randVal = math.random(10000)
|
||||
if randVal <= succRates then --成功
|
||||
luckVal = luckVal + ItemTable.blessVal
|
||||
msgId = string.format(Lang.Script.itemFunctionTips000003,luckVal)
|
||||
elseif randVal > (succRates + noChgRates) then--失败
|
||||
luckVal = luckVal - ItemTable.blessVal
|
||||
if luckVal >= 0 then
|
||||
msgId = string.format(Lang.Script.itemFunctionTips000005,luckVal)
|
||||
else
|
||||
msgId = string.format(Lang.Script.itemFunctionTips000006,-luckVal)
|
||||
end
|
||||
end
|
||||
end
|
||||
if Actor.removeItemByPtr(sysarg, itemPtr, 1, true, "use Blessing oil", 3) > 0 then
|
||||
Item.setItemProperty(sysarg, weaponPtr, Item.ipItemLuck, luckVal )
|
||||
Actor.sendTipmsg(sysarg, msgId, ttChatWindow + ttFlyTip)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--初始化物品使用时回调
|
||||
function UseNormalItemFunc_Init(sysarg)
|
||||
--回城卷
|
||||
for k, v in ipairs(BackToCity) do
|
||||
GlobalItemFn[v.item_id] = {func = BackToCityFunc,params = v}
|
||||
end
|
||||
--经验丹
|
||||
for k, v in ipairs(ExpItem) do
|
||||
GlobalItemFn[v.item_id] = {func = UseExpItemFunc,params = v}
|
||||
end
|
||||
--战神油
|
||||
for i = 1,table.getn(RepairItems) do
|
||||
local x = RepairItems[i]
|
||||
GlobalItemFn[x.item_id] = { func = repairAllEquipItemFunc, params = x }
|
||||
end
|
||||
--祝福油
|
||||
for idx, x in ipairs(BlessOil) do
|
||||
GlobalItemFn[x.item_id] = {func = useBlessOilFunc,params = x}
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(InitFnTable, UseNormalItemFunc_Init)
|
||||
@@ -0,0 +1,51 @@
|
||||
--红名药水
|
||||
|
||||
----#include "data\functions\ItemEvent\ItemUseCount.txt" once
|
||||
--#include "data\functions\GlobalMiscExpand\GlobalMisc.txt" once
|
||||
--#include "data\config\item\RedNameMedical.txt" once
|
||||
|
||||
|
||||
function UseRedNameMedical(sysarg, count, itemidx, itemPtr,ItemTable, delType, param)
|
||||
--local lastTimes, maxTimes = getItemUseCount(sysarg, itemidx)
|
||||
--if lastTimes <= 0 then
|
||||
-- local MaxDailyUseCircleSoulItemTimes = ItemUseCountCfg[itemidx].dailyUseLimit
|
||||
-- Actor.sendTipmsg( sysarg, OldLang.Script.EscortTips030, ttFlyTip )
|
||||
-- return
|
||||
--end
|
||||
local nPkValue = Actor.getIntProperty(sysarg,PROP_ACTOR_PK_VALUE)
|
||||
if nPkValue <= 0 then
|
||||
Actor.sendTipmsg( sysarg, OldLang.Script.UseRedNameMedical001, ttFlyTip )
|
||||
--print(nPkValue)
|
||||
return
|
||||
end
|
||||
--print(count..","..nPkValue)
|
||||
local useCount = math.ceil(nPkValue/ItemTable.value)
|
||||
if useCount > count then
|
||||
useCount = count
|
||||
end
|
||||
--print(useCount)
|
||||
local logId, logStr = 328, OldLang.Log.RedNameMedical
|
||||
if Actor.removeItemByPtr(sysarg, itemPtr, useCount, true, logStr, logId) > 0 then
|
||||
--if AddDailyItemUseCount(sysarg, itemidx, 1) then --次数增加,并发送客户端
|
||||
local pkValue = nPkValue-useCount*ItemTable.value
|
||||
if pkValue < 0 then
|
||||
pkValue = 0
|
||||
end
|
||||
Actor.setUIntProperty(sysarg, PROP_ACTOR_PK_VALUE, pkValue)
|
||||
local changeValue = nPkValue - pkValue
|
||||
Actor.sendTipmsg( sysarg, string.format(OldLang.Script.UseRedNameMedical002, changeValue) ,ttTipmsgWindow )
|
||||
return true,useCount
|
||||
--Actor.sendTipmsg( sysarg, string.format(OldLang.Script.EscortTips031, lastTimes-1), ttFlyTip )
|
||||
--end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function UseRedNameMedicalInit(sysarg)
|
||||
for i = 1,table.getn(RedNameMedicalConfig.MedicalList) do
|
||||
local x = RedNameMedicalConfig.MedicalList[i]
|
||||
GlobalItemFn[x.itemId] = { func = UseRedNameMedical, params = x }
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(InitFnTable, UseRedNameMedicalInit)
|
||||
@@ -0,0 +1,45 @@
|
||||
--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)
|
||||
Reference in New Issue
Block a user