--�Ϲ���װ���� function I6601711_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --�жϱ������пռ��Ƿ��㹻 local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then --��ʾ��ұ����ռ䲻�� bRet = 40 end if b < 1 then --��ʾ��ұ����ռ䲻�� bRet = 103 end return bRet, bIgnore end function I6601711_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(6) local temp = 0 local index = 1 local tbl = {} tbl[1] = {8099453, 1, 5, 1} tbl[2] = {8099454, 1, 5, 1} tbl[3] = {8099455, 1, 5, 1} tbl[4] = {8099456, 1, 5, 1} tbl[5] = {8099457, 1, 5, 1} tbl[6] = {8099458, 1, 5, 1} 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(6601711, 1, "I6601711_GiftBag") aux.RegisterItemEvent(6601711, 0, "I6601711_CanUseGiftBag") --�Ϲ���װ���� function I6601765_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --�жϱ������пռ��Ƿ��㹻 local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then --��ʾ��ұ����ռ䲻�� bRet = 40 end if b < 1 then --��ʾ��ұ����ռ䲻�� bRet = 103 end return bRet, bIgnore end function I6601765_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(6) local temp = 0 local index = 1 local tbl = {} tbl[1] = {8099608, 1, 5, 1} tbl[2] = {8099609, 1, 5, 1} tbl[3] = {8099610, 1, 5, 1} tbl[4] = {8099611, 1, 5, 1} tbl[5] = {8099612, 1, 5, 1} tbl[6] = {8099613, 1, 5, 1} 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(6601765, 1, "I6601765_GiftBag") aux.RegisterItemEvent(6601765, 0, "I6601765_CanUseGiftBag") --�Ϲ���װ���� function I6601847_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --�жϱ������пռ��Ƿ��㹻 local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then --��ʾ��ұ����ռ䲻�� bRet = 40 end if b < 1 then --��ʾ��ұ����ռ䲻�� bRet = 103 end return bRet, bIgnore end function I6601847_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(6) local temp = 0 local index = 1 local tbl = {} tbl[1] = {8099643, 1, 5, 1} tbl[2] = {8099644, 1, 5, 1} tbl[3] = {8099645, 1, 5, 1} tbl[4] = {8099646, 1, 5, 1} tbl[5] = {8099647, 1, 5, 1} tbl[6] = {8099648, 1, 5, 1} 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(6601847, 1, "I6601847_GiftBag") aux.RegisterItemEvent(6601847, 0, "I6601847_CanUseGiftBag") --�Ϲ���װ���� function I6601863_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --�жϱ������пռ��Ƿ��㹻 local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then --��ʾ��ұ����ռ䲻�� bRet = 40 end if b < 1 then --��ʾ��ұ����ռ䲻�� bRet = 103 end return bRet, bIgnore end function I6601863_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(6) local temp = 0 local index = 1 local tbl = {} tbl[1] = {8099649, 1, 5, 1} tbl[2] = {8099650, 1, 5, 1} tbl[3] = {8099651, 1, 5, 1} tbl[4] = {8099652, 1, 5, 1} tbl[5] = {8099653, 1, 5, 1} tbl[6] = {8099654, 1, 5, 1} 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(6601863, 1, "I6601863_GiftBag") aux.RegisterItemEvent(6601863, 0, "I6601863_CanUseGiftBag") --�Ϲ���װ���� function I6602065_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --�жϱ������пռ��Ƿ��㹻 local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then --��ʾ��ұ����ռ䲻�� bRet = 40 end if b < 1 then --��ʾ��ұ����ռ䲻�� bRet = 103 end return bRet, bIgnore end function I6602065_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(6) local temp = 0 local index = 1 local tbl = {} tbl[1] = {8099748, 1, 5, 1} tbl[2] = {8099749, 1, 5, 1} tbl[3] = {8099750, 1, 5, 1} tbl[4] = {8099751, 1, 5, 1} tbl[5] = {8099752, 1, 5, 1} tbl[6] = {8099753, 1, 5, 1} 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(6602065, 1, "I6602065_GiftBag") aux.RegisterItemEvent(6602065, 0, "I6602065_CanUseGiftBag") --�Ϲ���װ���� function I6602181_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --�жϱ������пռ��Ƿ��㹻 local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then --��ʾ��ұ����ռ䲻�� bRet = 40 end if b < 1 then --��ʾ��ұ����ռ䲻�� bRet = 103 end return bRet, bIgnore end function I6602181_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(6) local temp = 0 local index = 1 local tbl = {} tbl[1] = {8099779, 1, 5, 1} tbl[2] = {8099780, 1, 5, 1} tbl[3] = {8099781, 1, 5, 1} tbl[4] = {8099782, 1, 5, 1} tbl[5] = {8099783, 1, 5, 1} tbl[6] = {8099784, 1, 5, 1} 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(6602181, 1, "I6602181_GiftBag") aux.RegisterItemEvent(6602181, 0, "I6602181_CanUseGiftBag") --�Ϲ���װ���� function I6602261_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --�жϱ������пռ��Ƿ��㹻 local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then --��ʾ��ұ����ռ䲻�� bRet = 40 end if b < 1 then --��ʾ��ұ����ռ䲻�� bRet = 103 end return bRet, bIgnore end function I6602261_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(6) local temp = 0 local index = 1 local tbl = {} tbl[1] = {8099814, 1, 5, 1} tbl[2] = {8099815, 1, 5, 1} tbl[3] = {8099816, 1, 5, 1} tbl[4] = {8099817, 1, 5, 1} tbl[5] = {8099818, 1, 5, 1} tbl[6] = {8099819, 1, 5, 1} 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(6602261, 1, "I6602261_GiftBag") aux.RegisterItemEvent(6602261, 0, "I6602261_CanUseGiftBag") --�Ϲ���װ���� function I6602309_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --�жϱ������пռ��Ƿ��㹻 local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then --��ʾ��ұ����ռ䲻�� bRet = 40 end if b < 1 then --��ʾ��ұ����ռ䲻�� bRet = 103 end return bRet, bIgnore end function I6602309_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(6) local temp = 0 local index = 1 local tbl = {} tbl[1] = {8099823, 1, 5, 1} tbl[2] = {8099824, 1, 5, 1} tbl[3] = {8099825, 1, 5, 1} tbl[4] = {8099826, 1, 5, 1} tbl[5] = {8099827, 1, 5, 1} tbl[6] = {8099828, 1, 5, 1} 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(6602309, 1, "I6602309_GiftBag") aux.RegisterItemEvent(6602309, 0, "I6602309_CanUseGiftBag") function I6600820_GiftBag(MapID, InstanceID, TypeID, TargetID) --�в� role.AddRoleItem(MapID, InstanceID, TargetID, 6600819, 3, 6, 8, 420) end function I6600820_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --�жϱ������пռ��Ƿ��㹻 local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 6 then --��ʾ��ұ����ռ䲻�� bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600820, 1, "I6600820_GiftBag") aux.RegisterItemEvent(6600820, 0, "I6600820_CanUseGiftBag") function I6601860_GiftBag(MapID, InstanceID, TypeID, TargetID) local rand = math.random(1, 17) local tbl = { 5802349, 5802391, 5802260, 5802324, 5802464, 5802241, 5802169, 6601003, 5802182, 5802293, 5802433, 5802439, 5802455, 5802299, 5802327, 5802305, 5802529 } role.AddRoleItem(MapID, InstanceID, TargetID, tbl[rand], 1, -1, 8, 420) end function I6601860_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6601860, 1, "I6601860_GiftBag") aux.RegisterItemEvent(6601860, 0, "I6601860_CanUseGiftBag") function I6601270_GiftBag(MapID, InstanceID, TypeID, TargetID) local r = math.random(14) local temp = 0 local index = 1 local tbl = { {8013012, 1, 6, 1}, {8023012, 1, 6, 1}, {8033012, 1, 6, 1}, {8043012, 1, 6, 1}, {8050312, 1, 6, 1}, {8060312, 1, 6, 1}, {8070312, 1, 6, 1}, {8080312, 1, 6, 1}, {8090312, 1, 6, 1}, {8100312, 1, 6, 1}, {8110312, 1, 6, 1}, {8121312, 1, 6, 1}, {8130312, 1, 6, 1}, {8099432, 1, 6, 1} } 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 I6601270_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(6601270, 1, "I6601270_GiftBag") aux.RegisterItemEvent(6601270, 0, "I6601270_CanUseGiftBag") function I6600673_GiftBag(MapID, InstanceID, TypeID, TargetID) local r = math.random(9000) local temp = 0 local index = 1 local tbl = { {3070009, 1, 6, 700}, -- ����ߧ� �ҧڧ�ӧ� [1 ��] {4652601, 1, 6, 700}, -- ����ݧ��ѧ� ���ߧ� ������� [1 ��] {4800133, 1, 6, 200}, -- ������ �� ����ѧ� ����ܧ֧� [12��.] {3010021, 1, 6, 700}, -- ���ѧ��� �ڧ��֧ݧ֧ߧڧ� [60] {3010026, 1, 6, 700}, -- ���ԧ��ާߧ�� �٧֧ݧ�� �ާѧߧ� {3070052, 15, 6, 700}, -- ���ѧާ֧ߧ� ���ݧ֧�� {4659501, 1, 6, 200}, -- ����ݧ��ѧ� ���ߧ� ���ܧ��ӧڧ� [1�է�] {4656501, 1, 6, 200}, -- ����ݧ��ѧ� �٧�ݧ��ѧ� ���ߧ� [1�է�] {6600384, 50, 6, 700}, -- �ߧѧاڧӧܧ� {3070002, 30, 6, 700}, -- ������� {3010036, 5, 6, 700}, -- ���֧ݧ�� ������� {4800128, 1, 6, 700}, -- ���ѧާ֧ߧ� ���֧ߧڧ��ӧܧ� ��ݧ��� {4500002, 20, 6, 700}, -- ���ѧܧѧ� {3070018, 10, 6, 700}, -- ���ӧڧ��� �ӧ��ܧ�֧�֧ߧڧ� {4800301, 2, 6, 700} -- ����ߧߧѧ� ���ڧ٧ާ� [2 ��.] } 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 I6600673_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(6600673, 1, "I6600673_GiftBag") aux.RegisterItemEvent(6600673, 0, "I6600673_CanUseGiftBag") function I4800190_OnUse(MapID, InstanceID, TypeID, RoleID, TargetID) local i = math.random(100) local Target_MapID, Target_InstanceID = role.GetRoleMapID(TargetID) if i <= 1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 102, 206801) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchBroadcast(MsgID, -1, -1, -1) role.ModRoleAttValue(Target_MapID, Target_InstanceID, TargetID, 128, 9) else role.ModRoleAttValue(Target_MapID, Target_InstanceID, TargetID, 128, 1) end local MsgID_1 = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID_1, 13, 0) msg.AddMsgEvent(MsgID_1, 1, 206805) msg.AddMsgEvent(MsgID_1, 2, RoleID) msg.DispatchRoleMsgEvent(TargetID, MsgID_1) local num = role.GetRoleAttValue(Target_MapID, TargetID, TargetID, 128) if num ~= nil and num % 10 == 0 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 102, 206808) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 9, num) msg.DispatchBroadcast(MsgID, -1, -1, -1) end end function I4800190_CanUse(MapID, InstanceID, TypeID, RoleID, TargetID) local bRet, bIgnore = 0, false local sex = role.GetRoleSex(TargetID) if sex ~= 0 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 206803) msg.DispatchRoleMsgEvent(RoleID, MsgID) bRet = 999 return bRet, bIgnore end end aux.RegisterItemEvent(4800190, 1, "I4800190_OnUse") aux.RegisterItemEvent(4800190, 0, "I4800190_CanUse") function I4800193_OnUse(MapID, InstanceID, TypeID, RoleID, TargetID) local Target_MapID, Target_InstanceID = role.GetRoleMapID(TargetID) role.ModRoleAttValue(Target_MapID, Target_InstanceID, TargetID, 128, 10) local MsgID_1 = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID_1, 13, 0) msg.AddMsgEvent(MsgID_1, 1, 206806) msg.AddMsgEvent(MsgID_1, 2, RoleID) msg.DispatchRoleMsgEvent(TargetID, MsgID_1) local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 102, 206810) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchBroadcast(MsgID, -1, -1, -1) local num = role.GetRoleAttValue(Target_MapID, TargetID, TargetID, 128) if num ~= nil and num % 10 == 0 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 102, 206808) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 9, num) msg.DispatchBroadcast(MsgID, -1, -1, -1) end end function I4800193_CanUse(MapID, InstanceID, TypeID, RoleID, TargetID) local bRet, bIgnore = 0, false local sex = role.GetRoleSex(TargetID) if sex ~= 0 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 206803) msg.DispatchRoleMsgEvent(RoleID, MsgID) bRet = 999 return bRet, bIgnore end end aux.RegisterItemEvent(4800193, 1, "I4800193_OnUse") aux.RegisterItemEvent(4800193, 0, "I4800193_CanUse") function I4800191_OnUse(MapID, InstanceID, TypeID, RoleID, TargetID) local Target_MapID, Target_InstanceID = role.GetRoleMapID(TargetID) local i = math.random(100) if i <= 1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 102, 206802) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchBroadcast(MsgID, -1, -1, -1) role.ModRoleAttValue(Target_MapID, Target_InstanceID, TargetID, 129, 1) else role.ModRoleAttValue(Target_MapID, Target_InstanceID, TargetID, 129, 1) end local MsgID_1 = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID_1, 13, 0) msg.AddMsgEvent(MsgID_1, 1, 206807) msg.AddMsgEvent(MsgID_1, 2, RoleID) msg.DispatchRoleMsgEvent(TargetID, MsgID_1) local num = role.GetRoleAttValue(Target_MapID, Target_InstanceID, TargetID, 129) if num ~= nil and num % 10 == 0 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 102, 206809) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 9, num) msg.DispatchBroadcast(MsgID, -1, -1, -1) end end function I4800191_CanUse(MapID, InstanceID, TypeID, RoleID, TargetID) local bRet, bIgnore = 0, false local sex = role.GetRoleSex(TargetID) if sex ~= 0 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 206803) msg.DispatchRoleMsgEvent(RoleID, MsgID) bRet = 999 return bRet, bIgnore end end aux.RegisterItemEvent(4800191, 1, "I4800191_OnUse") aux.RegisterItemEvent(4800191, 0, "I4800191_CanUse") function I4800192_OnUse(MapID, InstanceID, TypeID, RoleID, TargetID) role.ModRoleAttValue(MapID, InstanceID, RoleID, 129, -1) end function I4800192_CanUse(MapID, InstanceID, TypeID, RoleID, TargetID) local bRet, bIgnore = 0, false local sex = role.GetRoleSex(RoleID) if sex ~= 0 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 206558) msg.DispatchRoleMsgEvent(RoleID, MsgID) bRet = 999 return bRet, bIgnore end local eggs = role.GetRoleAttValue(MapID, InstanceID, RoleID, 129) if eggs == nil or eggs <= 0 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 206804) msg.DispatchRoleMsgEvent(RoleID, MsgID) bRet = 999 return bRet, bIgnore end end aux.RegisterItemEvent(4800192, 1, "I4800192_OnUse") aux.RegisterItemEvent(4800192, 0, "I4800192_CanUse") local drop_sund = { 3100241, 3100239, 3100237, 3100235, 3100233, 3100231, 3100229, 3100227 } function I6600626_GiftBag(MapID, InstanceID, TypeID, TargetID) local b = math.random(1, 8) role.AddRoleItem(MapID, InstanceID, TargetID, drop_sund[b], 1, -1, 8, 420) end function I6600626_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600626, 1, "I6600626_GiftBag") aux.RegisterItemEvent(6600626, 0, "I6600626_CanUseGiftBag") function elixir_versatility(MapID, InstanceID, ItemID, TargetID) local level = role.GetRoleLevel(MapID, InstanceID, TargetID) local level_el = ItemID - 3010193 local addbuff_bonus if level <= 20 then addbuff_bonus = 1 elseif level > 20 and level <= 40 then addbuff_bonus = 2 elseif level > 40 and level <= 60 then addbuff_bonus = 3 elseif level > 60 and level <= 80 then addbuff_bonus = 4 elseif level > 80 and level <= 100 then addbuff_bonus = 5 elseif level > 100 and level <= 120 then addbuff_bonus = 6 elseif level > 120 then addbuff_bonus = 6 end local buff = 2068600 + level_el * 100 + addbuff_bonus unit.AddBuff(MapID, InstanceID, TargetID, buff, TargetID) end aux.RegisterItemEvent(3010193, 1, "elixir_versatility") aux.RegisterItemEvent(3010194, 1, "elixir_versatility") aux.RegisterItemEvent(3010195, 1, "elixir_versatility") aux.RegisterItemEvent(3010196, 1, "elixir_versatility") function elixir_healer(MapID, InstanceID, TypeID, TargetID) local level = role.GetRoleLevel(MapID, InstanceID, TargetID) local level_el = TypeID - 3010189 local addbuff_bonus if level <= 20 then addbuff_bonus = 1 elseif level > 20 and level <= 40 then addbuff_bonus = 2 elseif level > 40 and level <= 60 then addbuff_bonus = 3 elseif level > 60 and level <= 80 then addbuff_bonus = 4 elseif level > 80 then addbuff_bonus = 5 end local buff = 2065300 + level_el * 100 + addbuff_bonus unit.AddBuff(MapID, InstanceID, TargetID, buff, TargetID) end aux.RegisterItemEvent(3010189, 1, "elixir_healer") aux.RegisterItemEvent(3010190, 1, "elixir_healer") aux.RegisterItemEvent(3010191, 1, "elixir_healer") aux.RegisterItemEvent(3010192, 1, "elixir_healer") function I5510001_GiftBag(MapID, InstanceID, ItemID, TargetID) role.ModRoleAttValue(MapID, InstanceID, TargetID, 81, -10) end aux.RegisterItemEvent(5510001, 1, "I5510001_GiftBag") function I4830136_GiftBag(MapID, InstanceID, TypeID, TargetID) role.ModRoleAttValue(MapID, InstanceID, TargetID, 108, 1000) -- ���ݧѧܧ�� ��ӧ������ end function I4830136_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(4830136, 1, "I4830136_GiftBag") aux.RegisterItemEvent(4830136, 0, "I4830136_CanUseGiftBag") function I6602131_GiftBag(MapID, InstanceID, TypeID, TargetID) local r = math.random(1200) local temp = 0 local index = 1 local tbl = { {8099716, 1, 4, 100}, {8099717, 1, 4, 100}, {8099718, 1, 4, 100}, {8099719, 1, 4, 100}, {8099720, 1, 4, 100}, {8099721, 1, 4, 100}, {8099725, 1, 4, 100}, {8099726, 1, 4, 100}, {8099727, 1, 4, 100}, {8099728, 1, 4, 100}, {8099729, 1, 4, 100}, {8099730, 1, 4, 100} } 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) -- ���ߧѧ��ا֧ߧڧ� 11 �٧ӧק٧է� end function I6602131_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(6602131, 1, "I6602131_GiftBag") aux.RegisterItemEvent(6602131, 0, "I6602131_CanUseGiftBag") function I6602132_GiftBag(MapID, InstanceID, TypeID, TargetID) local r = math.random(1000) local temp = 0 local index = 1 local tbl = { {8099712, 1, 4, 100}, {8099713, 1, 4, 100}, {8099714, 1, 4, 100}, {8099715, 1, 4, 100}, {8099722, 1, 4, 100}, {8099723, 1, 4, 100}, {8099724, 1, 4, 100}, {8099731, 1, 4, 100}, {8099732, 1, 4, 100}, {8099733, 1, 4, 100} } 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 I6602132_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(6602132, 1, "I6602132_GiftBag") aux.RegisterItemEvent(6602132, 0, "I6602132_CanUseGiftBag") function I4902011_Use(MapID, InstanceID, TypeID, TargetID) local k1 = role.GetRoleAttValue(MapID, InstanceID, TargetID, 74) role.ModRoleAttValue(MapID, InstanceID, TargetID, 74, 100) end function I4902011_CanUse(MapID, InstanceID, TypeID, TargetID) local k1 = role.GetRoleAttValue(MapID, InstanceID, TargetID, 74) if k1 > -200 then return 40, false end return 0, false end aux.RegisterItemEvent(4902010, 1, "I4902011_Use") aux.RegisterItemEvent(4902010, 0, "I4902011_CanUse") aux.RegisterItemEvent(4902011, 1, "I4902011_Use") aux.RegisterItemEvent(4902011, 0, "I4902011_CanUse") function I6600625_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) if class == 2 or class == 6 or class == 7 then role.AddRoleItem(MapID, InstanceID, TargetID, 6600600, 1, 6, 8, 420) elseif class == 3 or class == 8 or class == 9 then role.AddRoleItem(MapID, InstanceID, TargetID, 6600600, 1, 6, 8, 420) elseif class == 4 or class == 10 or class == 11 then role.AddRoleItem(MapID, InstanceID, TargetID, 6600601, 1, 6, 8, 420) elseif class == 5 or class == 12 or class == 13 then role.AddRoleItem(MapID, InstanceID, TargetID, 6600602, 1, 6, 8, 420) end end function I6600625_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 else if FreeSize < 2 then bRet = 40 end end return bRet, bIgnore end aux.RegisterItemEvent(6600625, 1, "I6600625_GiftBag") aux.RegisterItemEvent(6600625, 0, "I6600625_CanUseGiftBag") function IKvas_GiftBag(MapID, InstanceID, TypeID, RoleID) local drinks = {6600600, 6600601, 6600602, 6600603, 6600604, 6600605} local drinks_num = TypeID - 6600600 local CancelBuff = {9810201, 9810301, 9810401, 9810501, 9810601, 9810701} for i = 1, 6 do unit.CancelBuff(MapID, InstanceID, RoleID, CancelBuff[i]) end unit.AddBuff(MapID, InstanceID, RoleID, 9810201 + (drinks_num * 100), RoleID) end aux.RegisterItemEvent(6600600, 1, "IKvas_GiftBag") aux.RegisterItemEvent(6600601, 1, "IKvas_GiftBag") aux.RegisterItemEvent(6600602, 1, "IKvas_GiftBag") aux.RegisterItemEvent(6600603, 1, "IKvas_GiftBag") aux.RegisterItemEvent(6600604, 1, "IKvas_GiftBag") aux.RegisterItemEvent(6600605, 1, "IKvas_GiftBag") function I6600479_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local elfsMax = 0 local elfsNotHave = {} local elfsAll = { {8099001, 8099002, 8099003, 8099004}, {8099005, 8099006, 8099007, 8099008}, {8099009, 8099010, 8099011, 8099012} } local elfIndex = 0 if class == 2 or class == 6 or class == 7 or class == 3 or class == 8 or class == 9 then elfIndex = 1 elseif class == 4 or class == 10 or class == 11 then elfIndex = 2 elseif class == 5 or class == 12 or class == 13 then elfIndex = 3 end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) > elfsMax then elfsMax = role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) end end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) < elfsMax then elfsNotHave[#elfsNotHave + 1] = elfsAll[elfIndex][i] end end if #elfsNotHave == 0 then elfsNotHave = elfsAll[elfIndex] end local result = math.random(1, #elfsNotHave) role.AddRoleItem(MapID, InstanceID, TargetID, elfsNotHave[result], 1, 6, 8, 420) end function I6600479_CanUse(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 1 then bRet = 40 end local class = role.GetRoleClass(TargetID) if class == 1 then bRet = 46 end return bRet, bIgnore end aux.RegisterItemEvent(6600479, 1, "I6600479_GiftBag") aux.RegisterItemEvent(6600479, 0, "I6600479_CanUse") function I6600725_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local elfsMax = 0 local elfsNotHave = {} local elfsAll = { {8099162, 8099163, 8099164, 8099165, 8099166, 8099167, 8099168, 8099169}, {8099170, 8099171, 8099172, 8099173, 8099174, 8099175, 8099176, 8099177}, {8099178, 8099179, 8099180, 8099181, 8099182, 8099183, 8099184} } local elfIndex = 0 if class == 2 or class == 6 or class == 7 or class == 3 or class == 8 or class == 9 then elfIndex = 1 elseif class == 4 or class == 10 or class == 11 then elfIndex = 2 elseif class == 5 or class == 12 or class == 13 then elfIndex = 3 end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) > elfsMax then elfsMax = role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) end end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) < elfsMax then elfsNotHave[#elfsNotHave + 1] = elfsAll[elfIndex][i] end end if #elfsNotHave == 0 then elfsNotHave = elfsAll[elfIndex] end local result = math.random(1, #elfsNotHave) role.AddRoleItem(MapID, InstanceID, TargetID, elfsNotHave[result], 1, 6, 8, 420) end function I6600725_CanUse(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 1 then bRet = 40 end local class = role.GetRoleClass(TargetID) if class == 1 then bRet = 46 end return bRet, bIgnore end aux.RegisterItemEvent(6600725, 1, "I6600725_GiftBag") aux.RegisterItemEvent(6600725, 0, "I6600725_CanUse") function I6600826_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local elfsMax = 0 local elfsNotHave = {} local elfsAll = { {8099215, 8099216, 8099217, 8099218, 8099219, 8099220, 8099221, 8099222}, {8099223, 8099224, 8099225, 8099226, 8099227, 8099228, 8099229, 8099230}, {8099231, 8099232, 8099233, 8099234, 8099235, 8099236, 8099237} } local elfIndex = 0 if class == 2 or class == 6 or class == 7 or class == 3 or class == 8 or class == 9 then elfIndex = 1 elseif class == 4 or class == 10 or class == 11 then elfIndex = 2 elseif class == 5 or class == 12 or class == 13 then elfIndex = 3 end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) > elfsMax then elfsMax = role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) end end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) < elfsMax then elfsNotHave[#elfsNotHave + 1] = elfsAll[elfIndex][i] end end if #elfsNotHave == 0 then elfsNotHave = elfsAll[elfIndex] end local result = math.random(1, #elfsNotHave) role.AddRoleItem(MapID, InstanceID, TargetID, elfsNotHave[result], 1, 6, 8, 420) end function I6600826_CanUse(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 1 then bRet = 40 end local class = role.GetRoleClass(TargetID) if class == 1 then bRet = 46 end return bRet, bIgnore end aux.RegisterItemEvent(6600826, 1, "I6600826_GiftBag") aux.RegisterItemEvent(6600826, 0, "I6600826_CanUse") function I6601138_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local elfsMax = 0 local elfsNotHave = {} local elfsAll = { {8099273, 8099274, 8099275, 8099276, 8099277, 8099278, 8099279, 8099280}, {8099288, 8099281, 8099282, 8099283, 8099284, 8099285, 8099286, 8099287}, {8099289, 8099290, 8099291, 8099292, 8099293, 8099294, 8099295} } local elfIndex = 0 if class == 2 or class == 6 or class == 7 or class == 3 or class == 8 or class == 9 then elfIndex = 1 elseif class == 4 or class == 10 or class == 11 then elfIndex = 2 elseif class == 5 or class == 12 or class == 13 then elfIndex = 3 end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) > elfsMax then elfsMax = role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) end end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) < elfsMax then elfsNotHave[#elfsNotHave + 1] = elfsAll[elfIndex][i] end end if #elfsNotHave == 0 then elfsNotHave = elfsAll[elfIndex] end local result = math.random(1, #elfsNotHave) role.AddRoleItem(MapID, InstanceID, TargetID, elfsNotHave[result], 1, 6, 8, 420) end function I6601138_CanUse(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 1 then bRet = 40 end local class = role.GetRoleClass(TargetID) if class == 1 then bRet = 46 end return bRet, bIgnore end aux.RegisterItemEvent(6601138, 1, "I6601138_GiftBag") aux.RegisterItemEvent(6601138, 0, "I6601138_CanUse") function I6601295_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local elfsMax = 0 local elfsNotHave = {} local elfsAll = { {8099383, 8099384, 8099385, 8099386, 8099387, 8099388, 8099389, 8099390}, {8099391, 8099392, 8099393, 8099394, 8099395, 8099396, 8099397, 8099398}, {8099399, 8099400, 8099401, 8099402, 8099403, 8099404, 8099405} } local elfIndex = 0 if class == 2 or class == 6 or class == 7 or class == 3 or class == 8 or class == 9 then elfIndex = 1 elseif class == 4 or class == 10 or class == 11 then elfIndex = 2 elseif class == 5 or class == 12 or class == 13 then elfIndex = 3 end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) > elfsMax then elfsMax = role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) end end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) < elfsMax then elfsNotHave[#elfsNotHave + 1] = elfsAll[elfIndex][i] end end if #elfsNotHave == 0 then elfsNotHave = elfsAll[elfIndex] end local result = math.random(1, #elfsNotHave) role.AddRoleItem(MapID, InstanceID, TargetID, elfsNotHave[result], 1, 6, 8, 420) end function I6601295_CanUse(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 1 then bRet = 40 end local class = role.GetRoleClass(TargetID) if class == 1 then bRet = 46 end return bRet, bIgnore end aux.RegisterItemEvent(6601295, 1, "I6601295_GiftBag") aux.RegisterItemEvent(6601295, 0, "I6601295_CanUse") function I6601322_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local elfsMax = 0 local elfsNotHave = {} local elfsAll = { {8099409, 8099410, 8099411, 8099412, 8099413, 8099414, 8099415, 8099416}, {8099417, 8099418, 8099419, 8099420, 8099421, 8099422, 8099423, 8099424}, {8099425, 8099426, 8099427, 8099428, 8099429, 8099430, 8099431} } local elfIndex = 0 if class == 2 or class == 6 or class == 7 or class == 3 or class == 8 or class == 9 then elfIndex = 1 elseif class == 4 or class == 10 or class == 11 then elfIndex = 2 elseif class == 5 or class == 12 or class == 13 then elfIndex = 3 end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) > elfsMax then elfsMax = role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) end end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) < elfsMax then elfsNotHave[#elfsNotHave + 1] = elfsAll[elfIndex][i] end end if #elfsNotHave == 0 then elfsNotHave = elfsAll[elfIndex] end local result = math.random(1, #elfsNotHave) role.AddRoleItem(MapID, InstanceID, TargetID, elfsNotHave[result], 1, 6, 8, 420) end function I6601322_CanUse(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 1 then bRet = 40 end local class = role.GetRoleClass(TargetID) if class == 1 then bRet = 46 end return bRet, bIgnore end aux.RegisterItemEvent(6601322, 1, "I6601322_GiftBag") aux.RegisterItemEvent(6601322, 0, "I6601322_CanUse") function I6601774_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local elfsMax = 0 local elfsNotHave = {} local elfsAll = { {8099614, 8099615, 8099616, 8099617, 8099618, 8099619, 8099620, 8099621}, {8099622, 8099623, 8099624, 8099625, 8099626, 8099627, 8099628, 8099629}, {8099630, 8099631, 8099632, 8099633, 8099634, 8099635, 8099636} } local elfIndex = 0 if class == 2 or class == 6 or class == 7 or class == 3 or class == 8 or class == 9 then elfIndex = 1 elseif class == 4 or class == 10 or class == 11 then elfIndex = 2 elseif class == 5 or class == 12 or class == 13 then elfIndex = 3 end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) > elfsMax then elfsMax = role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) end end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) < elfsMax then elfsNotHave[#elfsNotHave + 1] = elfsAll[elfIndex][i] end end if #elfsNotHave == 0 then elfsNotHave = elfsAll[elfIndex] end local result = math.random(1, #elfsNotHave) role.AddRoleItem(MapID, InstanceID, TargetID, elfsNotHave[result], 1, 6, 8, 420) end function I6601774_CanUse(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 1 then bRet = 40 end local class = role.GetRoleClass(TargetID) if class == 1 then bRet = 46 end return bRet, bIgnore end aux.RegisterItemEvent(6601774, 1, "I6601774_GiftBag") aux.RegisterItemEvent(6601774, 0, "I6601774_CanUse") function I6602020_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local elfsMax = 0 local elfsNotHave = {} local elfsAll = { {8099655, 8099656, 8099657, 8099658, 8099659, 8099660, 8099661, 8099662}, {8099663, 8099664, 8099665, 8099666, 8099667, 8099668, 8099669, 8099670}, {8099671, 8099672, 8099673, 8099674, 8099675, 8099676, 8099677} } local elfIndex = 0 if class == 2 or class == 6 or class == 7 or class == 3 or class == 8 or class == 9 then elfIndex = 1 elseif class == 4 or class == 10 or class == 11 then elfIndex = 2 elseif class == 5 or class == 12 or class == 13 then elfIndex = 3 end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) > elfsMax then elfsMax = role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) end end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) < elfsMax then elfsNotHave[#elfsNotHave + 1] = elfsAll[elfIndex][i] end end if #elfsNotHave == 0 then elfsNotHave = elfsAll[elfIndex] end local result = math.random(1, #elfsNotHave) role.AddRoleItem(MapID, InstanceID, TargetID, elfsNotHave[result], 1, 6, 8, 420) end function I6602020_CanUse(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 1 then bRet = 40 end local class = role.GetRoleClass(TargetID) if class == 1 then bRet = 46 end return bRet, bIgnore end aux.RegisterItemEvent(6602020, 1, "I6602020_GiftBag") aux.RegisterItemEvent(6602020, 0, "I6602020_CanUse") function I6602044_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local elfsMax = 0 local elfsNotHave = {} local elfsAll = { {8099682, 8099683, 8099684, 8099685, 8099686, 8099687, 8099688, 8099689}, {8099690, 8099691, 8099692, 8099693, 8099694, 8099695, 8099696, 8099697}, {8099698, 8099699, 8099700, 8099701, 8099702, 8099703, 8099704} } local elfIndex = 0 if class == 2 or class == 6 or class == 7 or class == 3 or class == 8 or class == 9 then elfIndex = 1 elseif class == 4 or class == 10 or class == 11 then elfIndex = 2 elseif class == 5 or class == 12 or class == 13 then elfIndex = 3 end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) > elfsMax then elfsMax = role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) end end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) < elfsMax then elfsNotHave[#elfsNotHave + 1] = elfsAll[elfIndex][i] end end if #elfsNotHave == 0 then elfsNotHave = elfsAll[elfIndex] end local result = math.random(1, #elfsNotHave) role.AddRoleItem(MapID, InstanceID, TargetID, elfsNotHave[result], 1, 6, 8, 420) end function I6602044_CanUse(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 1 then bRet = 40 end local class = role.GetRoleClass(TargetID) if class == 1 then bRet = 46 end return bRet, bIgnore end aux.RegisterItemEvent(6602044, 1, "I6602044_GiftBag") aux.RegisterItemEvent(6602044, 0, "I6602044_CanUse") function I6602067_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local elfsMax = 0 local elfsNotHave = {} local elfsAll = { {8099754, 8099755, 8099756, 8099757, 8099758, 8099759, 8099760, 8099761}, {8099762, 8099763, 8099764, 8099765, 8099766, 8099767, 8099768, 8099769}, {8099770, 8099771, 8099772, 8099773, 8099774, 8099775, 8099776} } local elfIndex = 0 if class == 2 or class == 6 or class == 7 or class == 3 or class == 8 or class == 9 then elfIndex = 1 elseif class == 4 or class == 10 or class == 11 then elfIndex = 2 elseif class == 5 or class == 12 or class == 13 then elfIndex = 3 end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) > elfsMax then elfsMax = role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) end end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) < elfsMax then elfsNotHave[#elfsNotHave + 1] = elfsAll[elfIndex][i] end end if #elfsNotHave == 0 then elfsNotHave = elfsAll[elfIndex] end local result = math.random(1, #elfsNotHave) role.AddRoleItem(MapID, InstanceID, TargetID, elfsNotHave[result], 1, 6, 8, 420) end function I6602067_CanUse(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 1 then bRet = 40 end local class = role.GetRoleClass(TargetID) if class == 1 then bRet = 46 end return bRet, bIgnore end aux.RegisterItemEvent(6602067, 1, "I6602067_GiftBag") aux.RegisterItemEvent(6602067, 0, "I6602067_CanUse") function I6602068_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local elfsMax = 0 local elfsNotHave = {} local elfsAll = { {8099785, 8099786, 8099787, 8099788, 8099789, 8099790, 8099791, 8099792}, {8099793, 8099794, 8099795, 8099796, 8099797, 8099798, 8099799, 8099800}, {8099801, 8099802, 8099803, 8099804, 8099805, 8099806, 8099807} } local elfIndex = 0 if class == 2 or class == 6 or class == 7 or class == 3 or class == 8 or class == 9 then elfIndex = 1 elseif class == 4 or class == 10 or class == 11 then elfIndex = 2 elseif class == 5 or class == 12 or class == 13 then elfIndex = 3 end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) > elfsMax then elfsMax = role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) end end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) < elfsMax then elfsNotHave[#elfsNotHave + 1] = elfsAll[elfIndex][i] end end if #elfsNotHave == 0 then elfsNotHave = elfsAll[elfIndex] end local result = math.random(1, #elfsNotHave) role.AddRoleItem(MapID, InstanceID, TargetID, elfsNotHave[result], 1, 6, 8, 420) end function I6602068_CanUse(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 1 then bRet = 40 end local class = role.GetRoleClass(TargetID) if class == 1 then bRet = 46 end return bRet, bIgnore end aux.RegisterItemEvent(6602068, 1, "I6602068_GiftBag") aux.RegisterItemEvent(6602068, 0, "I6602068_CanUse") function I6600643_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then bRet = 40 elseif b < 1 then bRet = 103 end return bRet, bIgnore end function I6600643_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(2520) local temp, index = 0, 1 local tbl = { {8099095, 1, 6, 420}, {8099096, 1, 6, 420}, {8099097, 1, 6, 420}, {8099098, 1, 6, 420}, {8099099, 1, 6, 420}, {8099100, 1, 6, 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(6600643, 1, "I6600643_GiftBag") aux.RegisterItemEvent(6600643, 0, "I6600643_CanUseGiftBag") function I6600647_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then bRet = 40 elseif b < 1 then bRet = 103 end return bRet, bIgnore end function I6600647_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(3360) local temp, index = 0, 1 local tbl = { {8099119, 1, 5, 420}, {8099120, 1, 5, 420}, {8099123, 1, 5, 420}, {8099123, 1, 6, 420}, {8099124, 1, 6, 420}, {8099119, 1, 5, 420}, {8099120, 1, 6, 420}, {8099124, 1, 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(6600647, 1, "I6600647_GiftBag") aux.RegisterItemEvent(6600647, 0, "I6600647_CanUseGiftBag") function I6600648_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then bRet = 40 elseif b < 1 then bRet = 103 end return bRet, bIgnore end function I6600648_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(3360) local temp, index = 0, 1 local tbl = { {8099125, 1, 5, 420}, {8099126, 1, 5, 420}, {8099129, 1, 5, 420}, {8099129, 1, 6, 420}, {8099130, 1, 6, 420}, {8099125, 1, 5, 420}, {8099126, 1, 6, 420}, {8099130, 1, 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(6600648, 1, "I6600648_GiftBag") aux.RegisterItemEvent(6600648, 0, "I6600648_CanUseGiftBag") function I6600646_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(600) local temp, index = 0, 1 local tbl = { {8099113, 1, 6, 100}, {8099114, 1, 5, 100}, {8099115, 1, 5, 100}, {8099116, 1, 6, 100}, {8099117, 1, 6, 100}, {8099118, 1, 5, 100} } 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(6600646, 1, "I6600646_GiftBag") function I6601317_GiftBag(MapID, InstanceID, TypeID, TargetID) local items = { 6600127, 6600128, 6600129, 6600130, 6600131, 6600132, 6600133, 6600134, 6600135, 6600136, 6600137, 6600138 } for _, item in ipairs(items) do role.AddRoleItem(MapID, InstanceID, TargetID, item, 1, -1, 8, 420) end end aux.RegisterItemEvent(6601317, 1, "I6601317_GiftBag") function I6601317_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 12 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6601317, 0, "I6601317_CanUseGiftBag") function I6600428_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local elfsMax = 0 local elfsNotHave = {} local elfsAll = { {8170046, 8170047, 8170048, 8170049}, {8170050, 8170051, 8170052, 8170053}, {8170054, 8170055, 8170056, 8170057} } local elfIndex if class == 2 or class == 6 or class == 7 or class == 3 or class == 8 or class == 9 then elfIndex = 1 elseif class == 4 or class == 10 or class == 11 then elfIndex = 2 elseif class == 5 or class == 12 or class == 13 then elfIndex = 3 end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) > elfsMax then elfsMax = role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) end end for i = 1, #elfsAll[elfIndex] do if role.GetRoleItemNum(TargetID, elfsAll[elfIndex][i]) < elfsMax then table.insert(elfsNotHave, elfsAll[elfIndex][i]) end end if #elfsNotHave == 0 then elfsNotHave = elfsAll[elfIndex] end local result = math.random(1, #elfsNotHave) role.AddRoleItem(MapID, InstanceID, TargetID, elfsNotHave[result], 1, 6, 8, 420) end function I6600428_CanUse(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) local class = role.GetRoleClass(TargetID) if FreeSize < 1 then bRet = 40 end if class == 1 then bRet = 46 end return bRet, bIgnore end aux.RegisterItemEvent(6600428, 1, "I6600428_GiftBag") aux.RegisterItemEvent(6600428, 0, "I6600428_CanUse") function I6601319_GiftBag(MapID, InstanceID, TypeID, TargetID) role.AddRoleItem(MapID, InstanceID, TargetID, 6601317, 1, -1, 8, 420) role.ModRoleAttValue(MapID, InstanceID, TargetID, 106, 15) role.AddRoleItem(MapID, InstanceID, TargetID, 6601318, 1, -1, 8, 420) end aux.RegisterItemEvent(6601319, 1, "I6601319_GiftBag") function I6601319_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 4 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6601319, 0, "I6601319_CanUseGiftBag") function I6601318_Use(MapID, InstanceID, TypeID, TargetID) local rolelevel = role.GetRoleLevel(MapID, InstanceID, TargetID) while rolelevel < 95 do role.AddRoleExp(MapID, InstanceID, TargetID, 1000000000) rolelevel = role.GetRoleLevel(MapID, InstanceID, TargetID) end end function I6601318_CanUse(MapID, InstanceID, TypeID, TargetID) local lvl = role.GetRoleLevel(MapID, InstanceID, TargetID) if lvl > 94 then return 50, false end return 0, false end aux.RegisterItemEvent(6601318, 1, "I6601318_Use") aux.RegisterItemEvent(6601318, 0, "I6601318_CanUse") function I6600127_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local item if class == 2 or class == 6 or class == 7 then item = 8039007 elseif class == 3 or class == 8 or class == 9 then item = 8039009 elseif class == 4 or class == 10 or class == 11 then item = 8039011 elseif class == 5 or class == 12 or class == 13 then item = 8039013 end if item then role.AddRoleItem(MapID, InstanceID, TargetID, item, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600127, 1, "I6600127_GiftBag") function I6600127_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600127, 0, "I6600127_CanUseGiftBag") function I6600128_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local item if class == 2 or class == 6 or class == 7 then item = 8039008 elseif class == 3 or class == 8 or class == 9 then item = 8039010 elseif class == 4 or class == 10 or class == 11 then item = 8039012 elseif class == 5 or class == 12 or class == 13 then item = 8039014 end if item then role.AddRoleItem(MapID, InstanceID, TargetID, item, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600128, 1, "I6600128_GiftBag") function I6600128_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600128, 0, "I6600128_CanUseGiftBag") function I6600129_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local item if class == 2 or class == 6 or class == 7 then item = 8039019 elseif class == 3 or class == 8 or class == 9 then item = 8039020 elseif class == 4 or class == 10 or class == 11 then item = 8039021 elseif class == 5 or class == 12 or class == 13 then item = 8039022 end if item then role.AddRoleItem(MapID, InstanceID, TargetID, item, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600129, 1, "I6600129_GiftBag") function I6600129_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600129, 0, "I6600129_CanUseGiftBag") function I6600130_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local item if class == 2 or class == 6 or class == 7 then item = 8039015 elseif class == 3 or class == 8 or class == 9 then item = 8039016 elseif class == 4 or class == 10 or class == 11 then item = 8039017 elseif class == 5 or class == 12 or class == 13 then item = 8039018 end if item then role.AddRoleItem(MapID, InstanceID, TargetID, item, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600130, 1, "I6600130_GiftBag") function I6600130_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600130, 0, "I6600130_CanUseGiftBag") function I6600131_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local item if class == 2 or class == 6 or class == 7 then item = 8110922 elseif class == 3 or class == 8 or class == 9 then item = 8110924 elseif class == 4 or class == 10 or class == 11 then item = 8110926 elseif class == 5 or class == 12 or class == 13 then item = 8110928 end if item then role.AddRoleItem(MapID, InstanceID, TargetID, item, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600131, 1, "I6600131_GiftBag") function I6600131_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600131, 0, "I6600131_CanUseGiftBag") function I6600132_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local item if class == 2 or class == 6 or class == 7 then item = 8110923 elseif class == 3 or class == 8 or class == 9 then item = 8110925 elseif class == 4 or class == 10 or class == 11 then item = 8110927 elseif class == 5 or class == 12 or class == 13 then item = 8110929 end if item then role.AddRoleItem(MapID, InstanceID, TargetID, item, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600132, 1, "I6600132_GiftBag") function I6600132_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600132, 0, "I6600132_CanUseGiftBag") function I6600133_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local item if class == 2 or class == 6 or class == 7 then item = 8039023 elseif class == 3 or class == 8 or class == 9 then item = 8039024 elseif class == 4 or class == 10 or class == 11 then item = 8039025 elseif class == 5 or class == 12 or class == 13 then item = 8039026 end if item then role.AddRoleItem(MapID, InstanceID, TargetID, item, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600133, 1, "I6600133_GiftBag") function I6600133_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600133, 0, "I6600133_CanUseGiftBag") function I6600134_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local item if class == 2 or class == 6 or class == 7 then item = 8039027 elseif class == 3 or class == 8 or class == 9 then item = 8039028 elseif class == 4 or class == 10 or class == 11 then item = 8039029 elseif class == 5 or class == 12 or class == 13 then item = 8039030 end if item then role.AddRoleItem(MapID, InstanceID, TargetID, item, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600134, 1, "I6600134_GiftBag") function I6600134_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600134, 0, "I6600134_CanUseGiftBag") function I4820088_GiftBag(MapID, InstanceID, TypeID, TargetID) local tbal = { {8010014, 8020014, 8030014, 8040014, 8050014, 8051014, 8060014, 8061014, 8070014, 8071014, 8080014, 8081014, 8090014, 8091014, 8100014, 8110014, 8111014, 8121014, 8122014, 8130014}, {8010015, 8020015, 8030015, 8040015, 8050015, 8051015, 8060015, 8061015, 8070015, 8071015, 8080015, 8081015, 8090015, 8091015, 8100015, 8110015, 8111015, 8121015, 8122015, 8130015}, {8010016, 8020016, 8030016, 8040016, 8050016, 8051016, 8060016, 8061016, 8070016, 8071016, 8080016, 8081016, 8090016, 8091016, 8100016, 8110016, 8111016, 8121016, 8122016, 8130016}, {8010017, 8020017, 8030017, 8040017, 8050017, 8051017, 8060017, 8061017, 8070017, 8071017, 8080017, 8081017, 8090017, 8091017, 8100017, 8110017, 8111017, 8121017, 8122017, 8130017} } local index = TypeID - 4820087 if index == 1 then role.AddRoleItem(MapID, InstanceID, TargetID, tbal[1][math.random(#tbal[1])], 1, 3, 8, 420) elseif index == 2 then role.AddRoleItem(MapID, InstanceID, TargetID, tbal[2][math.random(#tbal[2])], 1, 3, 8, 420) elseif index == 3 then if math.random(100) == 57 then role.AddRoleItem(MapID, InstanceID, TargetID, tbal[4][math.random(#tbal[4])], 1, 4, 8, 420) else role.AddRoleItem(MapID, InstanceID, TargetID, tbal[3][math.random(#tbal[3])], 1, 3, 8, 420) end end end function I4820088_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(4820088, 1, "I4820088_GiftBag") aux.RegisterItemEvent(4820088, 0, "I4820088_CanUseGiftBag") aux.RegisterItemEvent(4820089, 1, "I4820088_GiftBag") aux.RegisterItemEvent(4820089, 0, "I4820088_CanUseGiftBag") aux.RegisterItemEvent(4820090, 1, "I4820088_GiftBag") aux.RegisterItemEvent(4820090, 0, "I4820088_CanUseGiftBag") function I6600338_GiftBag(MapID, InstanceID, TypeID, TargetID) local r = math.random(11) local temp = 0 local index = 1 local tbl = { {6600327, 1, 6, 1}, {6600328, 1, 6, 1}, {6600329, 1, 6, 1}, {6600330, 1, 6, 1}, {6600331, 1, 6, 1}, {6600332, 1, 6, 1}, {6600333, 1, 6, 1}, {6600334, 1, 6, 1}, {6600335, 1, 6, 1}, {6600336, 1, 6, 1}, {6600337, 1, 6, 1} } 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 I6600338_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(6600338, 1, "I6600338_GiftBag") function I6602198_GiftBag(MapID, InstanceID, TypeID, TargetID) local r = math.random(7) local temp = 0 local index = 1 local tbl = { {5802637, 1, 6, 1}, {5802642, 1, 6, 1}, {5802647, 1, 6, 1}, {5802652, 1, 6, 1}, {5802657, 1, 6, 1}, {5802662, 1, 6, 1}, {5802667, 1, 6, 1} } 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 I6602198_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(6602198, 1, "I6602198_GiftBag") function I3090103_zengquan(MapID, InstanceID, TypeID, TargetID) role.AddRoleGiftPoints(MapID, InstanceID, TargetID, 1) end aux.RegisterItemEvent(3090103, 1, "I3090103_zengquan") function I3090104_zengquan(MapID, InstanceID, TypeID, TargetID) role.AddRoleGiftPoints(MapID, InstanceID, TargetID, 5) end aux.RegisterItemEvent(3090104, 1, "I3090104_zengquan") function I3090105_zengquan(MapID, InstanceID, TypeID, TargetID) role.AddRoleGiftPoints(MapID, InstanceID, TargetID, 10) end aux.RegisterItemEvent(3090105, 1, "I3090105_zengquan") function I3070080_zengquan(MapID, InstanceID, TypeID, TargetID) role.AddRoleGiftPoints(MapID, InstanceID, TargetID, 500) end aux.RegisterItemEvent(3070080, 1, "I3070080_zengquan") function I3070081_zengquan(MapID, InstanceID, TypeID, TargetID) role.AddRoleGiftPoints(MapID, InstanceID, TargetID, 700) end aux.RegisterItemEvent(3070081, 1, "I3070081_zengquan") function I3070082_zengquan(MapID, InstanceID, TypeID, TargetID) role.AddRoleGiftPoints(MapID, InstanceID, TargetID, 1500) end aux.RegisterItemEvent(3070082, 1, "I3070082_zengquan") function I3090030_zengquan(MapID, InstanceID, TypeID, TargetID) role.AddRoleGiftPoints(MapID, InstanceID, TargetID, 1000) end aux.RegisterItemEvent(3090030, 1, "I3090030_zengquan") function I3070083_zengquan(MapID, InstanceID, TypeID, TargetID) role.AddRoleGiftPoints(MapID, InstanceID, TargetID, 2000) end aux.RegisterItemEvent(3070083, 1, "I3070083_zengquan") function I3070084_zengquan(MapID, InstanceID, TypeID, TargetID) role.AddRoleGiftPoints(MapID, InstanceID, TargetID, 3000) end aux.RegisterItemEvent(3070084, 1, "I3070084_zengquan") function I3070085_zengquan(MapID, InstanceID, TypeID, TargetID) role.AddRoleGiftPoints(MapID, InstanceID, TargetID, 5000) end aux.RegisterItemEvent(3070085, 1, "I3070085_zengquan") function I3090002_zengquan(MapID, InstanceID, TypeID, TargetID) role.AddRoleGiftPoints(MapID, InstanceID, TargetID, 300) end aux.RegisterItemEvent(3090002, 1, "I3090002_zengquan") function I3090029_zengquan(MapID, InstanceID, TypeID, TargetID) role.AddRoleGiftPoints(MapID, InstanceID, TargetID, 100) end aux.RegisterItemEvent(3090029, 1, "I3090029_zengquan") function I6600290_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local itemID if class == 2 or class == 6 or class == 7 then itemID = 8039058 elseif class == 3 or class == 8 or class == 9 then itemID = 8039060 elseif class == 4 or class == 10 or class == 11 then itemID = 8039070 elseif class == 5 or class == 12 or class == 13 then itemID = 8039081 end if itemID then role.AddRoleItem(MapID, InstanceID, TargetID, itemID, 1, 6, 8, 420) end end function I6600290_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600290, 1, "I6600290_GiftBag") aux.RegisterItemEvent(6600290, 0, "I6600290_CanUseGiftBag") function I6600291_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local itemID if class == 2 or class == 6 or class == 7 then itemID = 8039057 elseif class == 3 or class == 8 or class == 9 then itemID = 8039061 elseif class == 4 or class == 10 or class == 11 then itemID = 8039071 elseif class == 5 or class == 12 or class == 13 then itemID = 8039082 end if itemID then role.AddRoleItem(MapID, InstanceID, TargetID, itemID, 1, 6, 8, 420) end end function I6600291_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600291, 1, "I6600291_GiftBag") aux.RegisterItemEvent(6600291, 0, "I6600291_CanUseGiftBag") function I6600292_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local itemID if class == 2 or class == 6 or class == 7 then itemID = 8039056 elseif class == 3 or class == 8 or class == 9 then itemID = 8039062 elseif class == 4 or class == 10 or class == 11 then itemID = 8039072 elseif class == 5 or class == 12 or class == 13 then itemID = 8039083 end if itemID then role.AddRoleItem(MapID, InstanceID, TargetID, itemID, 1, 6, 8, 420) end end function I6600292_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600292, 1, "I6600292_GiftBag") aux.RegisterItemEvent(6600292, 0, "I6600292_CanUseGiftBag") function I6600293_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local itemID if class == 2 or class == 6 or class == 7 then itemID = 8039055 elseif class == 3 or class == 8 or class == 9 then itemID = 8039063 elseif class == 4 or class == 10 or class == 11 then itemID = 8039073 elseif class == 5 or class == 12 or class == 13 then itemID = 8039084 end if itemID then role.AddRoleItem(MapID, InstanceID, TargetID, itemID, 1, 6, 8, 420) end end function I6600293_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600293, 1, "I6600293_GiftBag") aux.RegisterItemEvent(6600293, 0, "I6600293_CanUseGiftBag") function I6600294_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local itemID if class == 2 or class == 6 or class == 7 then itemID = 8039054 elseif class == 3 or class == 8 or class == 9 then itemID = 8039064 elseif class == 4 or class == 10 or class == 11 then itemID = 8039074 elseif class == 5 or class == 12 or class == 13 then itemID = 8039085 end if itemID then role.AddRoleItem(MapID, InstanceID, TargetID, itemID, 1, 6, 8, 420) end end function I6600294_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600294, 1, "I6600294_GiftBag") aux.RegisterItemEvent(6600294, 0, "I6600294_CanUseGiftBag") function I6600295_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local itemID if class == 2 or class == 6 or class == 7 then itemID = 8039053 elseif class == 3 or class == 8 or class == 9 then itemID = 8039065 elseif class == 4 or class == 10 or class == 11 then itemID = 8039075 elseif class == 5 or class == 12 or class == 13 then itemID = 8039086 end if itemID then role.AddRoleItem(MapID, InstanceID, TargetID, itemID, 1, 6, 8, 420) end end function I6600295_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600295, 1, "I6600295_GiftBag") aux.RegisterItemEvent(6600295, 0, "I6600295_CanUseGiftBag") function I6600296_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local itemID if class == 2 or class == 6 or class == 7 then itemID = 8039052 elseif class == 3 or class == 8 or class == 9 then itemID = 8039066 elseif class == 4 or class == 10 or class == 11 then itemID = 8039076 elseif class == 5 or class == 12 or class == 13 then itemID = 8039087 end if itemID then role.AddRoleItem(MapID, InstanceID, TargetID, itemID, 1, 6, 8, 420) end end function I6600296_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 elseif FreeSize < 2 then bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(6600296, 1, "I6600296_GiftBag") aux.RegisterItemEvent(6600296, 0, "I6600296_CanUseGiftBag") function I6600297_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) if class == 2 or class == 6 or class == 7 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039051, 1, 6, 8, 420) elseif class == 3 or class == 8 or class == 9 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039067, 1, 6, 8, 420) elseif class == 4 or class == 10 or class == 11 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039077, 1, 6, 8, 420) elseif class == 5 or class == 12 or class == 13 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039088, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600297, 1, "I6600297_GiftBag") function I6600297_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 else if FreeSize < 2 then bRet = 40 end end return bRet, bIgnore end aux.RegisterItemEvent(6600297, 0, "I6600297_CanUseGiftBag") function I6600298_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) if class == 2 or class == 6 or class == 7 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039050, 1, 6, 8, 420) elseif class == 3 or class == 8 or class == 9 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039068, 1, 6, 8, 420) elseif class == 4 or class == 10 or class == 11 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039078, 1, 6, 8, 420) elseif class == 5 or class == 12 or class == 13 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039089, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600298, 1, "I6600298_GiftBag") function I6600298_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 else if FreeSize < 2 then bRet = 40 end end return bRet, bIgnore end aux.RegisterItemEvent(6600298, 0, "I6600298_CanUseGiftBag") function I6600299_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) if class == 2 or class == 6 or class == 7 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039049, 1, 6, 8, 420) elseif class == 3 or class == 8 or class == 9 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039069, 1, 6, 8, 420) elseif class == 4 or class == 10 or class == 11 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039079, 1, 6, 8, 420) elseif class == 5 or class == 12 or class == 13 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039090, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600299, 1, "I6600299_GiftBag") function I6600299_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 else if FreeSize < 2 then bRet = 40 end end return bRet, bIgnore end aux.RegisterItemEvent(6600299, 0, "I6600299_CanUseGiftBag") function I6600300_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) if class == 2 or class == 6 or class == 7 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039048, 1, 6, 8, 420) elseif class == 3 or class == 8 or class == 9 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039059, 1, 6, 8, 420) elseif class == 4 or class == 10 or class == 11 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039080, 1, 6, 8, 420) elseif class == 5 or class == 12 or class == 13 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039091, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600300, 1, "I6600300_GiftBag") function I6600300_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 else if FreeSize < 2 then bRet = 40 end end return bRet, bIgnore end aux.RegisterItemEvent(6600300, 0, "I6600300_CanUseGiftBag") function krasitelkrilo(MapID, InstanceID, RoleID, TargetID) local kraskakrilo = {1240001, 1240002, 1240003, 1240004, 1240005} for a = 1, 5 do if role.GetEquipIDOnPos(RoleID, 19) == kraskakrilo[a] then -- Add any additional logic here if needed end end end --�Ϲ���װ���� function I6600640_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then bRet = 40 end if b < 1 then bRet = 103 end return bRet, bIgnore end function I6600640_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(3360) local temp = 0 local index = 1 local tbl = { {8099077, 1, 5, 420}, {8099078, 1, 5, 420}, {8099081, 1, 5, 420}, {8099082, 1, 5, 420}, {8099081, 1, 6, 420}, {8099082, 1, 6, 420}, {8099077, 1, 6, 420}, {8099078, 1, 6, 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(6600640, 1, "I6600640_GiftBag") aux.RegisterItemEvent(6600640, 0, "I6600640_CanUseGiftBag") --�Ϲ���װ���� function I6601344_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then bRet = 40 end if b < 1 then bRet = 103 end return bRet, bIgnore end function I6601344_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(2520) local temp = 0 local index = 1 local tbl = { {8099433, 1, 6, 420}, {8099434, 1, 6, 420}, {8099435, 1, 6, 420}, {8099436, 1, 6, 420}, {8099437, 1, 6, 420}, {8099438, 1, 6, 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(6601344, 1, "I6601344_GiftBag") aux.RegisterItemEvent(6601344, 0, "I6601344_CanUseGiftBag") --�Ϲ���װ���� function I6600641_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then bRet = 40 end if b < 1 then bRet = 103 end return bRet, bIgnore end function I6600641_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(3360) local temp = 0 local index = 1 local tbl = { {8099083, 1, 6, 420}, {8099084, 1, 5, 420}, {8099088, 1, 5, 420}, {8099087, 1, 6, 420}, {8099088, 1, 6, 420}, {8099083, 1, 5, 420}, {8099084, 1, 6, 420}, {8099087, 1, 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(6600641, 1, "I6600641_GiftBag") aux.RegisterItemEvent(6600641, 0, "I6600641_CanUseGiftBag") --�Ϲ���װ���� function I8099433_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then bRet = 40 end if b < 1 then bRet = 103 end return bRet, bIgnore end --�Ϲ���װ���� function I6601244_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then bRet = 40 end if b < 1 then bRet = 103 end return bRet, bIgnore end function I6601244_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(2520) local temp = 0 local index = 1 local tbl = { {8099313, 1, 6, 420}, {8099314, 1, 6, 420}, {8099315, 1, 6, 420}, {8099316, 1, 6, 420}, {8099317, 1, 6, 420}, {8099318, 1, 6, 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(6601244, 1, "I6601244_GiftBag") aux.RegisterItemEvent(6601244, 0, "I6601244_CanUseGiftBag") --�Ϲ���װ���� function I6600644_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then bRet = 40 end if b < 1 then bRet = 103 end return bRet, bIgnore end function I6600644_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(2520) local temp = 0 local index = 1 local tbl = { {8099101, 1, 6, 420}, {8099102, 1, 6, 420}, {8099103, 1, 6, 420}, {8099104, 1, 6, 420}, {8099105, 1, 6, 420}, {8099106, 1, 6, 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(6600644, 1, "I6600644_GiftBag") aux.RegisterItemEvent(6600644, 0, "I6600644_CanUseGiftBag") --�Ϲ���װ���� function I6600645_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) local b = role.GetRoleItemNum(TargetID, 6600649) if FreeSize < 1 then bRet = 40 end if b < 1 then bRet = 103 end return bRet, bIgnore end function I6600645_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(2520) local temp = 0 local index = 1 local tbl = { {8099107, 1, 6, 420}, {8099108, 1, 6, 420}, {8099109, 1, 6, 420}, {8099111, 1, 6, 420}, {8099112, 1, 6, 420}, {8099110, 1, 6, 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(6600645, 1, "I6600645_GiftBag") aux.RegisterItemEvent(6600645, 0, "I6600645_CanUseGiftBag") function I6600135_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) if class == 2 or class == 6 or class == 7 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039031, 1, 6, 8, 420) elseif class == 3 or class == 8 or class == 9 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039032, 1, 6, 8, 420) elseif class == 4 or class == 10 or class == 11 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039033, 1, 6, 8, 420) elseif class == 5 or class == 12 or class == 13 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039034, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600135, 1, "I6600135_GiftBag") function I6600135_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 else if FreeSize < 2 then bRet = 40 end end return bRet, bIgnore end aux.RegisterItemEvent(6600135, 0, "I6600135_CanUseGiftBag") function I6600136_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) if class == 2 or class == 6 or class == 7 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039035, 1, 6, 8, 420) elseif class == 3 or class == 8 or class == 9 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039036, 1, 6, 8, 420) elseif class == 4 or class == 10 or class == 11 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039037, 1, 6, 8, 420) elseif class == 5 or class == 12 or class == 13 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039038, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600136, 1, "I6600136_GiftBag") function I6600136_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 else if FreeSize < 2 then bRet = 40 end end return bRet, bIgnore end aux.RegisterItemEvent(6600136, 0, "I6600136_CanUseGiftBag") function I6600137_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) if class == 2 or class == 6 or class == 7 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039039, 1, 6, 8, 420) elseif class == 3 or class == 8 or class == 9 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039040, 1, 6, 8, 420) elseif class == 4 or class == 10 or class == 11 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039041, 1, 6, 8, 420) elseif class == 5 or class == 12 or class == 13 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039042, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600137, 1, "I6600137_GiftBag") function I6600137_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 else if FreeSize < 2 then bRet = 40 end end return bRet, bIgnore end aux.RegisterItemEvent(6600137, 0, "I6600137_CanUseGiftBag") function I6600138_GiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) if class == 2 or class == 6 or class == 7 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039043, 1, 6, 8, 420) elseif class == 3 or class == 8 or class == 9 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039044, 1, 6, 8, 420) elseif class == 4 or class == 10 or class == 11 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039045, 1, 6, 8, 420) elseif class == 5 or class == 12 or class == 13 then role.AddRoleItem(MapID, InstanceID, TargetID, 8039046, 1, 6, 8, 420) end end aux.RegisterItemEvent(6600138, 1, "I6600138_GiftBag") function I6600138_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local bRet, bIgnore = 0, false local FreeSize = role.GetBagFreeSize(TargetID) if class == 1 then bRet = 32 else if FreeSize < 2 then bRet = 40 end end return bRet, bIgnore end aux.RegisterItemEvent(6600138, 0, "I6600138_CanUseGiftBag") -- function I6600576_GiftBag(MapID, InstanceID, TypeID, TargetID) -- local r = math.random(55443) -- local temp = 0 -- local index = 1 -- local tbl = { -- { "4500002", 15, 1, 5000, "���ѧܧѧ�" }, -- Common item -- { "4653201", 1, 1, 4500, "����ݧ��ѧ� ���ߧ� �������[6 ��]" }, -- Common item -- { "3070019", 2, 1, 4600, "���ӧڧ��� �ӧ��ܧ�֧�֧ߧڧ�" }, -- Common item -- { "3070010", 1, 1, 5000, "����ߧ� �ҧڧ�ӧ� [2 ��]" }, -- Common item -- { "3040058", 1, 1, 4000, "���ӧ��֧ߧߧ��� ��ӧ֧� [����. 3]" }, -- Uncommon item -- { "4820273", 15, 1, 5000, "����ܧ�ݧ�� ��ݧ֧ާ֧ߧ�ѧݧ֧�" }, -- Uncommon item -- { "3040023", 1, 1, 4000, "���ӧ��֧ߧߧ�� ��ڧ�ߧڧ� [����. 3]" }, -- Uncommon item -- { "3500048", 1, 1, 3000, "����է֧�ߧ��� �ܧ�֧ާ֧ߧ� ��֧ާߧ���" }, -- Rare item -- { "3050065", 1, 1, 2000, "����֧էߧ֧� �����ҧڧ� ��� ��֧ާ֧�ݧ�" }, -- Rare item -- { "3050066", 1, 1, 2000, "����֧էߧ֧� �����ҧڧ� �ܧ�٧ߧ֧��" }, -- Rare item -- { "3050067", 1, 1, 2000, "����֧էߧ֧� �����ҧڧ� �����ߧ�ԧ�" }, -- Rare item -- { "4820079", 1, 1, 1000, "����ާ֧�֧�ߧ��� �ڧ���" }, -- Very Rare item -- { "4820039", 1, 1, 1000, "���ڧ���ڧ� �ڧ���" }, -- Very Rare item -- { "4400031", 1, 1, 1200, "���ڧ����� ��ݧ��ڧۧ�ܧڧ� ��ݧڧܧ�ڧ�" }, -- Very Rare item -- { "3060059", 1, 1, 1000, "�������ڧ� ��ݧڧܧ�ڧ� ��ݧ����" }, -- Very Rare item -- { "4999004", 1, 1, 1000, "���ݧ���֧ߧߧ��� ���ߧߧ��� �ܧѧާ֧ߧ�" }, -- Very Rare item -- { "3070029", 1, 1, 900, "����ݧ��ѧ� ���ߧ� ������� [1 ��]" }, -- Very Rare item -- { "4820274", 1, 1, 900, "����� ��ݧ֧ާ֧ߧ�ѧݧ֧�" }, -- Very Rare item -- { "5510006", 1, 1, 900, "���֧ԧ֧ߧէѧ�ߧ��� ���ߧߧ��� �ܧѧާ֧ߧ�" }, -- Legendary item -- { "4800132", 1, 1, 900, "������ �� ����ѧ� ����ܧ֧� [4 ��.]" }, -- Legendary item -- { "4820084", 1, 1, 900, "����ߧ� ����ڧ��ѧݧݧ�" }, -- Legendary item -- { "4820239", 1, 1, 800, "�����ߧ��� ��ܧ���ѧܧ� �ܧ�ڧ��ѧݧݧ�" }, -- Legendary item -- { "3500205", 1, 1, 700, "���է�� �է��� ��ݧ��� [95]" }, -- Legendary item -- { "3020012", 1, 1, 600, "����ߧ� ��էѧ�� [+20]" }, -- Legendary item -- { "3500023", 1, 1, 500, "�����ҧѧ� ���ߧ� ������ҧߧ���֧�" }, -- Legendary item -- { "4800133", 1, 1, 500, "������ �� ����ѧ� ����ܧ֧� [12��.]" }, -- Legendary item -- { "3020013", 1, 1, 400, "����ا֧��ӧ֧ߧߧѧ� ���ߧ� ��էѧ��" }, -- Legendary item -- { "3500208", 1, 1, 200, "���է�� �է��� ��ݧ��� [110]" }, -- Legendary item -- { "4820180", 1, 1, 150, "���ݧ֧ۧ�ߧ�" }, -- Legendary item -- { "3060061", 1, 1, 100, "���ӧ���� ��ݧڧܧ�ڧ�" }, -- Legendary item -- { "3051616", 1, 1, 100, "���֧�ߧ�� ��ӧ֧�ݧ�" }, -- Legendary item -- { "3030508", 1, 1, 60, "����է֧�ߧ��� �ا֧ާ���[����. 9]" }, -- Legendary item -- { "3030502", 1, 1, 60, "���֧��ѧ��ڧ� �ا֧ާ���[����. 9]" }, -- Legendary item -- { "3030449", 1, 1, 60, "���ڧ��ڧ�֧�ܧڧ� �էڧѧާѧߧ�[����. 9]" }, -- Legendary item -- { "3030448", 1, 1, 60, "����ҧڧ�֧ݧ�ߧ��� �էڧѧާѧߧ�[����. 9]" }, -- Legendary item -- { "3030442", 1, 1, 60, "���ڧ����� �ݧ�ߧߧڧ�[����. 9]" }, -- Legendary item -- { "3030438", 1, 1, 60, "�������ڧ� ���ݧߧ�֧ӧڧ�[����. 9]" }, -- Legendary item -- { "3030157", 1, 1, 60, "����ݧ���� ��ѧ��ӧڧ�[����. 9]" }, -- Legendary item -- { "4810109", 1, 1, 50, "����ݧ��ѧ� ��ݧ֧ۧ�ߧ�" }, -- Legendary item -- { "3020099", 1, 1, 30, "���ѧԧڧ�֧�ܧ�� ��ا֧�֧ݧ�� +27" }, -- Legendary item -- { "3020100", 1, 1, 25, "���ѧԧڧ�֧�ܧ�� ��ا֧�֧ݧ�� +28" }, -- Legendary item -- { "3020101", 1, 1, 20, "���ѧԧڧ�֧�ܧ�� ��ا֧�֧ݧ�� +29" }, -- Legendary item -- { "3020043", 1, 1, 15, "���ѧާ֧ߧ� �է��� +26" }, -- Legendary item -- { "3020044", 1, 1, 10, "���ѧާ֧ߧ� �է��� +27" }, -- Legendary item -- { "3020102", 1, 1, 15, "���ѧԧڧ�֧�ܧ�� ��ا֧�֧ݧ�� +30" }, -- Legendary item -- { "3020045", 1, 1, 5, "���ѧާ֧ߧ� �է��� +28" }, -- Legendary item -- { "3020047", 1, 1, 3, "���ѧާ֧ߧ� �է��� +30" }, -- Legendary item -- } -- for i = 1, #tbl do -- temp = temp + tbl[i][4] -- if temp >= r then -- index = i -- break -- end -- end -- if index >= 27 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 I6600576_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(6600576, 1, "I6600576_GiftBag") -- aux.RegisterItemEvent(6600576, 0, "I6600576_CanUseGiftBag") function I6600639_GiftBag(MapID, InstanceID, TypeID, TargetID) role.RemoveFromRole(MapID, InstanceID, TargetID, 6600649, 1, 101) local r = math.random(6) local temp = 0 local index = 1 local tbl = { {8099071, 1, 4, 1}, {8099072, 1, 4, 1}, {8099073, 1, 4, 1}, {8099074, 1, 4, 1}, {8099075, 1, 4, 1}, {8099076, 1, 4, 1}, } 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(6600639, 1, "I6600639_GiftBag") aux.RegisterItemEvent(6600639, 0, "I6600639_CanUseGiftBag") function I4530095_GiftBag(MapID, InstanceID, TypeID, TargetID) local r = math.random(23) local temp = 0 local index = 1 local tbl = { {3030097, 1, 6, 1}, {3030004, 1, 6, 1}, {3030012, 1, 6, 1}, {3030018, 1, 6, 1}, {3030024, 1, 6, 1}, {3030032, 1, 6, 1}, {3030040, 1, 6, 1}, {3030046, 1, 6, 1}, {3030052, 1, 6, 1}, {3030057, 1, 6, 1}, {3030062, 1, 6, 1}, {3030067, 1, 6, 1}, {3030075, 1, 6, 1}, {3030083, 1, 6, 1}, {3030088, 1, 6, 1}, {3030094, 1, 6, 1}, {3030422, 1, 6, 1}, {3030463, 1, 6, 1}, {3030470, 1, 6, 1}, {3030477, 1, 6, 1}, {3030484, 1, 6, 1}, {6600996, 1, 6, 1}, {3030100, 1, 6, 1} } 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 I4530095_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(4530095, 1, "I4530095_GiftBag") aux.RegisterItemEvent(4530095, 0, "I4530095_CanUseGiftBag") function I4530096_GiftBag(MapID, InstanceID, TypeID, TargetID) local r = math.random(20) local temp = 0 local index = 1 local tbl = { {3030098, 1, 6, 1}, {3030005, 1, 6, 1}, {3030013, 1, 6, 1}, {3030019, 1, 6, 1}, {3030025, 1, 6, 1}, {3030033, 1, 6, 1}, {3030041, 1, 6, 1}, {3030047, 1, 6, 1}, {3030053, 1, 6, 1}, {3030058, 1, 6, 1}, {3030063, 1, 6, 1}, {3030068, 1, 6, 1}, {3030076, 1, 6, 1}, {3030084, 1, 6, 1}, {3030423, 1, 6, 1}, {3030464, 1, 6, 1}, {3030471, 1, 6, 1}, {3030478, 1, 6, 1}, {3030485, 1, 6, 1}, {6600997, 1, 6, 1} } 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 I4530096_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(4530096, 1, "I4530096_GiftBag") aux.RegisterItemEvent(4530096, 0, "I4530096_CanUseGiftBag") function I4530097_GiftBag(MapID, InstanceID, TypeID, TargetID) local r = math.random(20) local temp = 0 local index = 1 local tbl = { {3030006, 1, 6, 1}, {3030014, 1, 6, 1}, {3030020, 1, 6, 1}, {3030026, 1, 6, 1}, {3030034, 1, 6, 1}, {3030042, 1, 6, 1}, {3030048, 1, 6, 1}, {3030054, 1, 6, 1}, {3030059, 1, 6, 1}, {3030064, 1, 6, 1}, {3030069, 1, 6, 1}, {3030077, 1, 6, 1}, {3030085, 1, 6, 1}, {3030090, 1, 6, 1}, {3030424, 1, 6, 1}, {3030465, 1, 6, 1}, {3030472, 1, 6, 1}, {3030479, 1, 6, 1}, {3030486, 1, 6, 1}, {6600998, 1, 6, 1} } 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 I4530097_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(4530097, 1, "I4530097_GiftBag") aux.RegisterItemEvent(4530097, 0, "I4530097_CanUseGiftBag") function I4530098_GiftBag(MapID, InstanceID, TypeID, TargetID) local r = math.random(20) local temp = 0 local index = 1 local tbl = { {3030007, 1, 6, 1}, {3030015, 1, 6, 1}, {3030021, 1, 6, 1}, {3030027, 1, 6, 1}, {3030035, 1, 6, 1}, {3030043, 1, 6, 1}, {3030049, 1, 6, 1}, {3030055, 1, 6, 1}, {3030060, 1, 6, 1}, {3030065, 1, 6, 1}, {3030070, 1, 6, 1}, {3030078, 1, 6, 1}, {3030086, 1, 6, 1}, {3030091, 1, 6, 1}, {3030425, 1, 6, 1}, {3030466, 1, 6, 1}, {3030473, 1, 6, 1}, {3030480, 1, 6, 1}, {3030487, 1, 6, 1}, {6600999, 1, 6, 1} } 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 I4530098_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(4530098, 1, "I4530098_GiftBag") aux.RegisterItemEvent(4530098, 0, "I4530098_CanUseGiftBag") function I4530099_GiftBag(MapID, InstanceID, TypeID, TargetID) local r = math.random(20) local temp = 0 local index = 1 local tbl = { {3030008, 1, 6, 1}, {3030016, 1, 6, 1}, {3030022, 1, 6, 1}, {3030028, 1, 6, 1}, {3030036, 1, 6, 1}, {3030044, 1, 6, 1}, {3030050, 1, 6, 1}, {3030056, 1, 6, 1}, {3030061, 1, 6, 1}, {3030066, 1, 6, 1}, {3030071, 1, 6, 1}, {3030079, 1, 6, 1}, {3030087, 1, 6, 1}, {3030092, 1, 6, 1}, {3030426, 1, 6, 1}, {3030467, 1, 6, 1}, {3030474, 1, 6, 1}, {3030481, 1, 6, 1}, {3030488, 1, 6, 1}, {6601000, 1, 6, 1} } 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 I4530099_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(4530099, 1, "I4530099_GiftBag") aux.RegisterItemEvent(4530099, 0, "I4530099_CanUseGiftBag") function I6600538_GiftBag(MapID, InstanceID, TypeID, TargetID) local r = math.random(20) local temp = 0 local index = 1 local tbl = { {3030154, 1, 6, 1}, {3030155, 1, 6, 1}, {3030156, 1, 6, 1}, {3030157, 1, 6, 1}, {3030158, 1, 6, 1}, {3030159, 1, 6, 1}, {3030160, 1, 6, 1}, {3030161, 1, 6, 1}, {3030162, 1, 6, 1}, {3030163, 1, 6, 1}, {3030164, 1, 6, 1}, {3030165, 1, 6, 1}, {3030166, 1, 6, 1}, {3030167, 1, 6, 1}, {3030435, 1, 6, 1}, {3030468, 1, 6, 1}, {3030475, 1, 6, 1}, {3030482, 1, 6, 1}, {3030489, 1, 6, 1}, {6601001, 1, 6, 1} } 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 I6600538_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(6600538, 1, "I6600538_GiftBag") aux.RegisterItemEvent(6600538, 0, "I6600538_CanUseGiftBag") function I6602200_GiftBag(MapID, InstanceID, TypeID, TargetID) local r = math.random(20) local temp = 0 local index = 1 local tbl = { {5802168, 1, 6, 1}, {5802181, 1, 6, 1}, {5802240, 1, 6, 1}, {5802259, 1, 6, 1}, {5802292, 1, 6, 1}, {5802298, 1, 6, 1}, {5802304, 1, 6, 1}, {5802323, 1, 6, 1}, {5802326, 1, 6, 1}, {5802390, 1, 6, 1}, {5802432, 1, 6, 1}, {5802438, 1, 6, 1}, {5802444, 1, 6, 1}, {5802454, 1, 6, 1}, {5802460, 1, 6, 1}, {5802463, 1, 6, 1}, {5802528, 1, 6, 1}, {5802540, 1, 6, 1}, {6601002, 1, 6, 1}, {5802348, 1, 6, 1} } 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 I6602200_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(6602200, 1, "I6602200_GiftBag") aux.RegisterItemEvent(6602200, 0, "I6602200_CanUseGiftBag")