function I6600587_GiftBag(MapID, InstanceID, TypeID, TargetID) --??ID, ????TypeID,??,??,????,log??????? local r = math.random(1400) local temp = 0 local index = 1 local tbl = {} tbl[1] = {9990002,1,6,700} tbl[2] = {9990003,1,6,700} 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 function I6600587_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --???????????? local FreeSize = role.GetBagFreeSize(TargetID) if(FreeSize < 1) then --?????????? bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600587, 1, "I6600587_GiftBag") aux.RegisterItemEvent(6600587, 0, "I6600587_CanUseGiftBag")