function I6600369_GiftBag(MapID, InstanceID, TypeID, TargetID) --??ID, ????TypeID,??,??,????,log??????? local r = math.random(5040) local temp = 0 local index = 1 local tbl = {} tbl[1] = {8170034,1,6,420} tbl[2] = {8170035,1,6,420} tbl[3] = {8170036,1,6,420} tbl[4] = {8170037,1,6,420} tbl[5] = {8170038,1,6,420} tbl[6] = {8170039,1,6,420} tbl[7] = {8170040,1,6,420} tbl[8] = {8170041,1,6,420} tbl[9] = {8170042,1,6,420} tbl[10] = {8170043,1,6,420} tbl[11] = {8170044,1,6,420} tbl[12] = {8170045,1,6,420} for i = 1,10 do temp = temp + tbl[i][4] if temp >= r then index = i break end end local sex = role.GetRoleSex(TargetID) role.AddRoleItem(MapID, InstanceID, TargetID, tbl[index][1], tbl[index][2], tbl[index][3], 8, 420) if index >= 15 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 100, 280) --?????? msg.AddMsgEvent(MsgID, 2, TargetID) msg.AddMsgEvent(MsgID, 4, TypeID) msg.AddMsgEvent(MsgID, 4, tbl[index][1]) msg.DispatchWorldMsgEvent(MsgID) end end function I6600369_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(6600369, 1, "I6600369_GiftBag") aux.RegisterItemEvent(6600369, 0, "I6600369_CanUseGiftBag")