function s9100601_canuse(MapID, InstanceID, SkillID, RoleID) local FreeSize = role.GetBagFreeSize(RoleID) local LearnedSkill = role.IsLearnedSkill(RoleID, 91005) local itemNum = role.GetRoleItemNum(RoleID, 6600384) if LearnedSkill == 1 then if itemNum < 1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 950636) msg.AddMsgEvent(MsgID, 9, 1) msg.DispatchRoleMsgEvent(RoleID, MsgID) return 19, false end end if LearnedSkill == 2 then if itemNum < 1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 950636) msg.AddMsgEvent(MsgID, 9, 1) msg.DispatchRoleMsgEvent(RoleID, MsgID) return 19, false end end if LearnedSkill == 3 then if itemNum < 1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 950636) msg.AddMsgEvent(MsgID, 9, 1) msg.DispatchRoleMsgEvent(RoleID, MsgID) return 19, false end end if LearnedSkill == 4 then if itemNum < 1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 950636) msg.AddMsgEvent(MsgID, 9, 1) msg.DispatchRoleMsgEvent(RoleID, MsgID) return 19, false end end if LearnedSkill >= 5 then if itemNum < 1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 950636) msg.AddMsgEvent(MsgID, 9, 1) msg.DispatchRoleMsgEvent(RoleID, MsgID) return 19, false end end if FreeSize < 2 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 100003) msg.AddMsgEvent(MsgID, 9, 1) msg.DispatchRoleMsgEvent(RoleID, MsgID) return 40, false end if MapID == 3373743400 or MapID == 201103695 then local bCanUse1 = map.IsInArea(MapID, InstanceID, RoleID, 1071) local bCanUse2 = map.IsInArea(MapID, InstanceID, RoleID, 4833) if bCanUse1 == true or bCanUse2 == true then return 0 else return 23 end else return 23 end end aux.RegisterSkillEvent(9100601, 0, "s9100601_canuse") function s9100601_Cast(MapID, InstanceID, SkillID, TargetID) local LearnedSkill = role.IsLearnedSkill(TargetID, 91005) local a = math.random(10000) if LearnedSkill == 1 then role.RemoveFromRole(MapID, InstanceID, TargetID, 6600384, 1, 420) if a >0 and a <7000 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100301, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 10) elseif a >=7000 and a<10000 then role.AddRoleItem(MapID, InstanceID, TargetID, 2610025, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 10) end elseif LearnedSkill == 2 then role.RemoveFromRole(MapID, InstanceID, TargetID, 6600384, 1, 420) if a >0 and a <4000 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100301, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 10) elseif a >=9000 and a<10000 then role.AddRoleItem(MapID, InstanceID, TargetID, 2610025, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 10) elseif a >=4000 and a<9000 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100303, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 10) elseif a >=9000 and a<10000 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100302, 1, -1, 8, 420) end elseif LearnedSkill == 3 then role.RemoveFromRole(MapID, InstanceID, TargetID, 6600384, 1, 420) if a >0 and a <3000 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100301, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 10) elseif a >=3000 and a<6000 then role.AddRoleItem(MapID, InstanceID, TargetID, 6600790, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 10) elseif a >=6000 and a<9000 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100304, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 20) elseif a >=9000 and a<10000 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100302, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 10) end elseif LearnedSkill == 4 then role.RemoveFromRole(MapID, InstanceID, TargetID, 6600384, 1, 420) if a >0 and a <2500 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100301, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 10) elseif a >=2500 and a<5000 then role.AddRoleItem(MapID, InstanceID, TargetID, 2610025, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 10) elseif a >=5000 and a<7500 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100304, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 20) elseif a >=7500 and a<10000 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100302, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 20) elseif a >=10000 and a<11000 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100302, 1, -1, 8, 420) end elseif LearnedSkill >=5 then role.RemoveFromRole(MapID, InstanceID, TargetID, 6600384, 1, 420) if a >0 and a <2500 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100301, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 10) elseif a >=2500 and a<5000 then role.AddRoleItem(MapID, InstanceID, TargetID, 2610025, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 10) elseif a >=5000 and a<7500 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100304, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 20) elseif a >=7500 and a<10000 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100302, 1, -1, 8, 420) role.ChangeSkillExp(TargetID, 91005, 20) elseif a >=10000 and a<11000 then role.AddRoleItem(MapID, InstanceID, TargetID, 4100302, 1, -1, 8, 420) end end end aux.RegisterSkillEvent(9100601, 1, "s9100601_Cast") function I4800300_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) --Призмы local time1 = {} time1[4800300] = 30 time1[4800301] = 120 time1[4800302] = 360 time1[4800303] = 720 local k = role.GetRoleScriptData(TargetID, 1, RoleDataType["rubalka_time"]) if k + time1[TypeID] > 2880 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 605017) msg.DispatchRoleMsgEvent(TargetID, MsgID) return 32, false end return 0,false end function I4800300_GiftBag(MapID, InstanceID, TypeID, RoleID) --Рыбалка local time1 = {} time1[4800300] = 30 time1[4800301] = 120 time1[4800302] = 360 time1[4800303] = 720 local k = role.GetRoleScriptData(RoleID, 1, RoleDataType["rubalka_time"]) k = k+time1[TypeID] role.SetRoleScriptData(RoleID, 1, RoleDataType["rubalka_time"], k) local hour = math.floor(k/60) local minute = k%60 local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 13, 0) msg.AddMsgEvent(MsgID, 1, 930437) msg.AddMsgEvent(MsgID, 9, hour) msg.AddMsgEvent(MsgID, 9, minute) msg.DispatchRoleMsgEvent(RoleID, MsgID) if MapID == 3373743400 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 16, 28) msg.AddMsgEvent(MsgID, 16, k*60) msg.DispatchRoleMsgEvent(RoleID, MsgID) end end aux.RegisterItemEvent(4800300, 0, "I4800300_CanUseGiftBag") aux.RegisterItemEvent(4800300, 1, "I4800300_GiftBag") aux.RegisterItemEvent(4800301, 0, "I4800300_CanUseGiftBag") aux.RegisterItemEvent(4800301, 1, "I4800300_GiftBag") aux.RegisterItemEvent(4800302, 0, "I4800300_CanUseGiftBag") aux.RegisterItemEvent(4800302, 1, "I4800300_GiftBag") aux.RegisterItemEvent(4800303, 0, "I4800300_CanUseGiftBag") aux.RegisterItemEvent(4800303, 1, "I4800300_GiftBag")