function I4530182_GiftBag(MapID, InstanceID, TypeID, TargetID) local tbl = { {3070010, 1, -1}, {4659501, 5, -1}, {3070057, 2, -1}, {3070006, 1, -1}, {4510022, 1, -1}, {4510023, 1, -1}, {3050007, 20, -1}, {3070010, 1, -1}, {4530183, 1, -1} } for i, item in ipairs(tbl) do role.AddRoleItem(MapID, InstanceID, TargetID, item[1], item[2], item[3], 8, 420) end end function I4530182_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 9 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(4530182, 1, "I4530182_GiftBag") aux.RegisterItemEvent(4530182, 0, "I4530182_CanUseGiftBag") function I4530183_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local sex = role.GetRoleSex(TargetID) local tbl = { {4659501, 5, -1}, {3070011, 1, -1}, {3070056, 40, -1}, {3070051, 20, -1}, {3070018, 4, -1}, {3010054, 1, -1}, {3010055, 1, -1}, {3030120, 4, -1}, {3030122, 4, -1}, {3040056, 2, -1}, {3040021, 2, -1}, {3050007, 20, -1}, {3010035, 4, -1}, {3020010, 15, -1}, {3020057, 15, -1}, {3020005, 20, -1}, {4530184, 1, -1}, {3070011, 1, -1} } if sex == 1 then table.insert(tbl, 18, {4700175, 1, -1}) else table.insert(tbl, 18, {4700176, 1, -1}) end if class == 1 or class == 2 or class == 3 or class == 6 or class == 7 or class == 8 or class == 9 then table.insert(tbl, 19, {8160008, 1, 5}) elseif class == 4 or class == 5 or class == 10 or class == 11 or class == 12 or class == 13 then table.insert(tbl, 19, {8170008, 1, 5}) end for i, item in ipairs(tbl) do role.AddRoleItem(MapID, InstanceID, TargetID, item[1], item[2], item[3], 8, 420) end end function I4530183_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 20 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(4530183, 1, "I4530183_GiftBag") aux.RegisterItemEvent(4530183, 0, "I4530183_CanUseGiftBag")