--上古神装宝盒 function I6600344_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --判断背包空闲空间是否足够 local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID,6600343) if(FreeSize < 1) then --提示玩家背包空间不足 bRet = 40 end if(b < 1) then --提示玩家背包空间不足 bRet = 103 end return bRet, bIgnore end function I6600344_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600343, 1, 101) local r = math.random(3360) local temp = 0 local index = 1 local tbl = {} tbl[1] = {7602117,3,6,420} tbl[2] = {7602119,30,5,420} tbl[3] = {3070090,1,6,420} tbl[4] = {3070020,1,6,420} tbl[5] = {7602116,3,6,420} tbl[6] = {3500207,10,5,420} tbl[7] = {4810109,1,6,420} tbl[8] = {4820109,10,5,420} for i = 1,#tbl do temp = temp + tbl[i][4] if temp >= r then index = i break end end role.AddRoleItem(MapID, InstanceID, TargetID, tbl[index][1], tbl[index][2], tbl[index][3], 8, 35) end aux.RegisterItemEvent(6600344, 1, "I6600344_GiftBag") aux.RegisterItemEvent(6600344, 0, "I6600344_CanUseGiftBag") --上古神装宝盒 function I6600345_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --判断背包空闲空间是否足够 local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID,6600342) if(FreeSize < 1) then --提示玩家背包空间不足 bRet = 40 end if(b < 1) then --提示玩家背包空间不足 bRet = 103 end return bRet, bIgnore end function I6600345_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600342, 1, 101) local r = math.random(3360) local temp = 0 local index = 1 local tbl = {} tbl[1] = {4080071, 20, -1, 420} tbl[2] = {4080072, 2, -1, 420} tbl[3] = {3500207, 5, -1, 420} tbl[4] = {4080073, 2, -1, 420} tbl[5] = {3070020, 1, -1, 420} tbl[6] = {4080074, 2, -1, 420} tbl[7] = {4080075, 2, -1, 420} tbl[8] = {4810109, 1, -1, 420} for i = 1,#tbl do temp = temp + tbl[i][4] if temp >= r then index = i break end end role.AddRoleItem(MapID, InstanceID, TargetID, tbl[index][1], tbl[index][2], tbl[index][3], 8, 35) end aux.RegisterItemEvent(6600345, 1, "I6600345_GiftBag") aux.RegisterItemEvent(6600345, 0, "I6600345_CanUseGiftBag")