public static void GenerateSheepGames() { /* * Thread.Sleep(5 * 1000); * ServerManager.Instance.Broadcast(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("SHEEP_STARTED"), 1)); * ServerManager.Instance.Broadcast("qnaml 4 #guri^514 ¿Quieres participar en el raid de las ovejas?"); * ServerManager.Instance.EventInWaiting = true; * Thread.Sleep(30 * 1000); * ServerManager.Instance.Sessions.Where(s => s.Character?.IsWaitingForEvent == false).ToList().ForEach(s => s.SendPacket("esf 1")); * ServerManager.Instance.EventInWaiting = false; * * IEnumerable<ClientSession> sessions = ServerManager.Instance.Sessions.Where(s => s.Character?.IsWaitingForEvent == true && s.Character.MapInstance.MapInstanceType == MapInstanceType.BaseMapInstance); * List<Tuple<MapInstance, byte>> maps = new List<Tuple<MapInstance, byte>>(); * MapInstance map = ServerManager.GenerateMapInstance(2009, MapInstanceType.EventSheepInstance, new InstanceBag()); */ ServerManager.Instance.Broadcast(UserInterfaceHelper.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("SHEEP_STARTED"), 10), 0)); ServerManager.Instance.Broadcast(UserInterfaceHelper.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("SHEEP_STARTED"), 10), 1)); Thread.Sleep(10 * 1000); ServerManager.Instance.Broadcast(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("METEORITE_STARTED"), 1)); ServerManager.Instance.Broadcast("qnaml 4 #guri^514 Veux tu participer au raid mouton ?"); ServerManager.Instance.EventInWaiting = true; Thread.Sleep(30 * 1000); ServerManager.Instance.Sessions.Where(s => s.Character?.IsWaitingForEvent == false).ToList().ForEach(s => s.SendPacket("esf 1")); ServerManager.Instance.EventInWaiting = false; IEnumerable <ClientSession> sessions = ServerManager.Instance.Sessions.Where(s => s.Character?.IsWaitingForEvent == true && s.Character.MapInstance.MapInstanceType == MapInstanceType.BaseMapInstance); List <Tuple <MapInstance, byte> > maps = new List <Tuple <MapInstance, byte> >(); MapInstance map = ServerManager.GenerateMapInstance(2009, MapInstanceType.SheepGameInstance, new InstanceBag()); maps.Add(new Tuple <MapInstance, byte>(map, 1)); if (map != null) { foreach (ClientSession sess in sessions) { ServerManager.Instance.TeleportOnRandomPlaceInMap(sess, map.MapInstanceId); sess.SendPacket("bsinfo 2 4 0 0"); } ServerManager.Instance.Sessions.Where(s => s.Character != null).ToList().ForEach(s => s.Character.IsWaitingForEvent = false); ServerManager.Instance.StartedEvents.Remove(EventType.SHEEPGAME); } foreach (Tuple <MapInstance, byte> mapinstance in maps) { if (mapinstance.Item1.Sessions.Count() < 1) { mapinstance.Item1.Broadcast(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("INSTANTBATTLE_NOT_ENOUGH_PLAYERS"), 0)); EventHelper.Instance.ScheduleEvent(TimeSpan.FromSeconds(5), new EventContainer(mapinstance.Item1, EventActionType.DISPOSEMAP, null)); continue; } SheepThread task = new SheepThread(); Observable.Timer(TimeSpan.FromSeconds(10)).Subscribe(X => task.Run(map)); } }
public static void GenerateSheepGames() { Thread.Sleep(5 * 1000); ServerManager.Instance.Broadcast(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("SHEEP_STARTED"), 1)); ServerManager.Instance.Broadcast("qnaml 100 #guri^514 The Sheep Game just started! Join now !"); ServerManager.Instance.EventInWaiting = true; Thread.Sleep(30 * 1000); ServerManager.Instance.Sessions.Where(s => s.Character?.IsWaitingForEvent == false).ToList().ForEach(s => s.SendPacket("esf 1")); ServerManager.Instance.EventInWaiting = false; IEnumerable <ClientSession> sessions = ServerManager.Instance.Sessions.Where(s => s.Character?.IsWaitingForEvent == true && s.Character.MapInstance.MapInstanceType == MapInstanceType.BaseMapInstance); List <Tuple <MapInstance, byte> > maps = new List <Tuple <MapInstance, byte> >(); MapInstance map = ServerManager.Instance.GenerateMapInstance(2009, MapInstanceType.SheepGameInstance, new InstanceBag()); maps.Add(new Tuple <MapInstance, byte>(map, 1)); if (map != null) { foreach (ClientSession sess in sessions) { ServerManager.Instance.TeleportOnRandomPlaceInMap(sess, map.MapInstanceId); sess.SendPacket("bsinfo 2 4 0 0"); } ServerManager.Instance.Sessions.Where(s => s.Character != null).ToList().ForEach(s => s.Character.IsWaitingForEvent = false); ServerManager.Instance.StartedEvents.Remove(EventType.SHEEPGAME); } if (map.Sessions.Count() < MiniPlayerForStart) { map.Broadcast(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("INSTANTBATTLE_NOT_ENOUGH_PLAYERS"), 0)); EventHelper.Instance.ScheduleEvent(TimeSpan.FromSeconds(5), new EventContainer(map, EventActionType.DISPOSEMAP, null)); return; } SheepThread task = new SheepThread(); Observable.Timer(TimeSpan.FromSeconds(10)).Subscribe(X => task.Run(map)); }