--物品礼包-新手装备套
---===================================================
x892324_g_scriptId = 892324
x892324_g_GiftItem = 38001876
x892324_g_Item = {10402001,10553090,10553091,10553092,10553093,10553094,10553095,10553096,10553097,10553098,10553098,10553099,10553099,10156001,10156002,10155001}
--**********************************
--事件交互入口
--**********************************
function x892324_OnDefaultEvent( sceneId, selfId, bagIndex )
-- 不需要这个接口,但要保留空函数
end
--**********************************
--这个物品的使用过程是否类似于技能:
--系统会在执行开始时检测这个函数的返回值,如果返回失败则忽略后面的类似技能的执行。
--返回1:技能类似的物品,可以继续类似技能的执行;返回0:忽略后面的操作。
--**********************************
function x892324_IsSkillLikeScript( sceneId, selfId)
return 1; --这个脚本需要动作支持
end
--**********************************
--直接取消效果:
--系统会直接调用这个接口,并根据这个函数的返回值确定以后的流程是否执行。
--返回1:已经取消对应效果,不再执行后续操作;返回0:没有检测到相关效果,继续执行。
--**********************************
function x892324_CancelImpacts( sceneId, selfId )
return 0; --不需要这个接口,但要保留空函数,并且始终返回0。
end
--**********************************
--条件检测入口:
--系统会在技能检测的时间点调用这个接口,并根据这个函数的返回值确定以后的流程是否执行。
--返回1:条件检测通过,可以继续执行;返回0:条件检测失败,中断后续执行。
--**********************************
function x892324_OnConditionCheck( sceneId, selfId )
--校验使用的物品
if(1~=LuaFnVerifyUsedItem(sceneId, selfId)) then
return 0
end
--等级检查
--if GetLevel(sceneId,selfId) < 1 then
--x892324_Tip(sceneId,selfId,"请在1级以后再来使用礼包");
--return 0
--end
if GetMenPai(sceneId,selfId) == 9 then
x892324_Tip(sceneId,selfId,"请在加入门派以后再来使用礼包");
return 0
end
local itemTblIndex = LuaFnGetItemIndexOfUsedItem( sceneId, selfId );
if x892324_g_GiftItem ~= itemTblIndex then
x892324_Tip(sceneId,selfId,"物品非法");
return 0
end
--背包空间检测
if LuaFnGetPropertyBagSpace(sceneId,selfId) < 17 then
x892324_Tip(sceneId,selfId,"背包道具栏已满,请保留至少17个空位后再进行该操作。");
return 0
end
return 1; --不需要任何条件,并且始终返回1。
end
--**********************************
--消耗检测及处理入口:
--系统会在技能消耗的时间点调用这个接口,并根据这个函数的返回值确定以后的流程是否执行。
--返回1:消耗处理通过,可以继续执行;返回0:消耗检测失败,中断后续执行。
--注意:这不光负责消耗的检测也负责消耗的执行。
--**********************************
function x892324_OnDeplete( sceneId, selfId )
if(0<LuaFnDepletingUsedItem(sceneId, selfId)) then
return 1;
end
return 1;
end
--**********************************
--只会执行一次入口:
--聚气和瞬发技能会在消耗完成后调用这个接口(聚气结束并且各种条件都满足的时候),而引导
--技能也会在消耗完成后调用这个接口(技能的一开始,消耗成功执行之后)。
--返回1:处理成功;返回0:处理失败。
--注:这里是技能生效一次的入口
--**********************************
function x892324_OnActivateOnce( sceneId, selfId )
--等级检查
--if GetLevel(sceneId,selfId) < 1 then
--x892324_Tip(sceneId,selfId,"请在1级以后再来使用礼包");
--return 0
--end
if GetMenPai(sceneId,selfId) == 9 then
x892324_Tip(sceneId,selfId,"请在加入门派以后再来使用礼包");
return 0
end
--背包空间检测
if LuaFnGetPropertyBagSpace(sceneId,selfId) < 18 then
x892324_Tip(sceneId,selfId,"背包空间不足!");
return 0
end
local Itemid = LuaFnGetItemIndexOfUsedItem(sceneId,selfId);
local nBagPos = LuaFnGetBagIndexOfUsedItem(sceneId,selfId);
local nMenPai = GetMenPai(sceneId,selfId);
local nSuperWeaponId = 0;
for i = 1,16 do
local pos = TryRecieveItem( sceneId, selfId, x892324_g_Item[i], 1)
if LuaFnGetItemBindStatus(sceneId,selfId,pos) ~= 1 then
LuaFnItemBind(sceneId,selfId,pos)
end
end
LuaFnSendSpecificImpactToUnit(sceneId, selfId, selfId, selfId, 151, 0)
x892324_Tip(sceneId,selfId,format("恭喜你成功打开了%s!",GetItemName(sceneId,x892324_g_GiftItem),GetItemName(sceneId,nSuperWeaponId)))
x892324_Xinshouxiangqian( sceneId, selfId )
return 1
end
function x892324_Xinshouxiangqian( sceneId, selfId )
local bing = {
[10553090] = {50413004,50412006,50414001,50413003}, [10553091] = {50413004,50412006,50414001,50413003},--防具
[10553092] = {50413004,50412006,50414001,50413003}, [10553093] = {50413004,50412006,50414001,50413003},
[10553094] = {50413004,50412006,50414001,50413003}, [10553096] = {50413004,50412006,50414001,50413003},
[10402001] = {50402006,50403001,50421002,50402006}, [10553095] = {50413004,50402006,50421002,50402006},--武具
[10553097] = {50402006,50403001,50404002,50402006}, [10553098] = {50402006,50403001,50404002,50402006},
[10553098] = {50402006,50403001,50404002,50402006}, [10553099] = {50402006,50403001,50404002,50402006},
[10155001] = {50413004,50402006,50404002,50402006}, [10553099] = {50402006,50403001,50404002,50402006},
[10156001] = {50413004,50402006,50404002,50402006}, [10156002] = {50413004,50402006,50404002,50402006},--暗器、坐骑、武魂
} --冰
local huo = {
[10553090] = {50413004,50412007,50414001,50413003}, [10553091] = {50413004,50412007,50414001,50413003},--防具
[10553092] = {50413004,50412007,50414001,50413003}, [10553093] = {50413004,50412007,50414001,50413003},
[10553094] = {50413004,50412007,50414001,50413003}, [10553096] = {50413004,50412007,50414001,50413003},
[10402001] = {50402007,50403001,50421003,50402007}, [10553095] = {50413004,50402007,50421003,50402007},--武具
[10553097] = {50402007,50403001,50404002,50402007}, [10553098] = {50402007,50403001,50404002,50402007},
[10553098] = {50402007,50403001,50404002,50402007}, [10553099] = {50402007,50403001,50404002,50402007},
[10155001] = {50413004,50402007,50404002,50402007}, [10553099] = {50402007,50403001,50404002,50402007},
[10156001] = {50413004,50402007,50404002,50402007}, [10156002] = {50413004,50402007,50404002,50402007},--暗器、武魂
} --火
local xuan = {
[10553090] = {50413004,50412005,50414001,50413003}, [10553091] = {50413004,50412005,50414001,50413003},--防具
[10553092] = {50413004,50412005,50414001,50413003}, [10553093] = {50413004,50412005,50414001,50413003},
[10553094] = {50413004,50412005,50414001,50413003}, [10553096] = {50413004,50412005,50414001,50413003},
[10402001] = {50402005,50403001,50421001,50402005}, [10553095] = {50413004,50402005,50421001,50402005},--武具
[10553097] = {50402005,50403001,50404002,50402005}, [10553098] = {50402005,50403001,50404002,50402005},
[10553098] = {50402005,50403001,50404002,50402005}, [10553099] = {50402005,50403001,50404002,50402005},
[10155001] = {50413004,50402005,50404002,50402005}, [10553099] = {50402005,50403001,50404002,50402005},
[10156001] = {50413004,50402005,50404002,50402005}, [10156002] = {50413004,50402005,50404002,50402005},--暗器、坐骑、武魂
} --玄
local du = {
[10553090] = {50413004,50412008,50414001,50413003}, [10553091] = {50413004,50412008,50414001,50413003},--防具
[10553092] = {50413004,50412008,50414001,50413003}, [10553093] = {50413004,50412008,50414001,50413003},
[10553094] = {50413004,50412008,50414001,50413003}, [10553096] = {50413004,50412008,50414001,50413003},
[10402001] = {50402008,50403001,50421004,50402008}, [10553095] = {50413004,50402008,50421004,50402008},--武具
[10553097] = {50402008,50403001,50404002,50402008}, [10553098] = {50402008,50403001,50404002,50402008},
[10553098] = {50402008,50403001,50404002,50402008}, [10553099] = {50402008,50403001,50404002,50402008},
[10155001] = {50413004,50402008,50404002,50402008}, [10553099] = {50402008,50403001,50404002,50402008},
[10156001] = {50413004,50402008,50404002,50402008}, [10156002] = {50413004,50402008,50404002,50402008},--暗器、坐骑、武魂
} --毒
---新手装宝石镶嵌。
local MenPai = GetMenPai(sceneId,selfId)
local Table
if MenPai == 3 or MenPai == 7 then--冰
Table = bing
end
if MenPai == 1 or MenPai == 8 then--火
Table = huo
end
if MenPai == 0 or MenPai == 4 or MenPai == 6 then--玄
Table = xuan
end
if MenPai == 2 or MenPai == 5 then--毒
Table = du
end
for i = 0,29 do
local item = LuaFnGetItemTableIndexByIndex(sceneId,selfId,i)
if item == 10402001 or item == 10553090 or item == 10553091 or item == 10553092 or item == 10553093 or item == 10553094 or item == 10553095 or item == 10553096 or item == 10553097 or item == 10553098 or item == 10553099 or item == 10156001 or item == 10156002 or item == 10155001 then
local nowBore_Count = GetBagGemCount( sceneId, selfId, i )
while nowBore_Count ~= 3 do
AddBagItemSlot( sceneId, selfId, i )
nowBore_Count = GetBagGemCount( sceneId, selfId, i )
end
end
end
for i = 0,29 do
local item = LuaFnGetItemTableIndexByIndex(sceneId,selfId,i)
if item == 10402001 or item == 10553090 or item == 10553091 or item == 10553092 or item == 10553093 or item == 10553094 or item == 10553095 or item == 10553096 or item == 10553097 or item == 10553098 or item == 10553099 or item == 10156001 or item == 10156002 or item == 10155001 then
for k = 1,3 do
local PosGem = TryRecieveItem(sceneId,selfId,Table[item][k],1)
GemEnchasing( sceneId, selfId, PosGem, i )
end
end
end
end
--**********************************
--引导心跳处理入口:
--引导技能会在每次心跳结束时调用这个接口。
--返回:1继续下次心跳;0:中断引导。
--注:这里是技能生效一次的入口
--**********************************
function x892324_OnActivateEachTick( sceneId, selfId)
return 1; --不是引导性脚本, 只保留空函数.
end
function x892324_Tip( sceneId,selfId,Tip )
BeginEvent( sceneId )
AddText( sceneId, Tip )
EndEvent( sceneId )
DispatchMissionTips( sceneId, selfId )
end