function I7300276_GiftBag(MapID, InstanceID, TypeID, TargetID) --??ID, ????TypeID,??,??,????,log??????? local r = math.random(71000) local temp = 0 local index = 1 local tbl = {} tbl[1] = {6802208,1,8,9000} tbl[2] = {6802209,1,8,8000} tbl[3] = {6802123,1,8,8000} tbl[4] = {6802142,1,8,9000} tbl[5] = {6600240,10,8,9000} tbl[6] = {6802122,1,8,9000} tbl[7] = {6802210,1,8,5700} tbl[8] = {6802124,1,8,5700} tbl[9] = {6802125,1,8,4700} tbl[10] = {6802126,1,8,3700} tbl[11] = {6802211,1,8,4700} tbl[12] = {6802212,1,8,3700} for i = 1,12 do temp = temp + tbl[i][4] if temp >= r then index = i break end end if index >= 7 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 role.AddRoleItem(MapID, InstanceID, TargetID, tbl[index][1], tbl[index][2], tbl[index][3], 8, 420) end function I7300276_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(7300276, 1, "I7300276_GiftBag") aux.RegisterItemEvent(7300276, 0, "I7300276_CanUseGiftBag")