Ejemplo n.º 1
0
 public OnBanchoPacketEvent(EventManager evmgr,
                            PacketStreamService pss,
                            MultiplayerService ms,
                            PresenceService ps)
 {
     _evmgr = evmgr;
     _pss   = pss;
     _ms    = ms;
     _ps    = ps;
 }
Ejemplo n.º 2
0
 public MainActivity()
 {
     _service = new SamsungMultiplayerService(this)
     {
         MessageTypes = new Dictionary<string, Type>
         {
             { "T", typeof(TestMessage) },
         },
     };
 }
Ejemplo n.º 3
0
 public MultiplayerRoom(PacketStreamService pss, MultiplayerService ms, PresenceService ps)
 {
     _pss    = pss;
     _ms     = ms;
     _ps     = ps;
     stream  = new PacketStream("multiplayer");
     Channel = new Channel("#multiplayer", "Even more osu! default channels!", stream);
     for (var i = 0; i < MaxPlayers; i++)
     {
         Slots[i] = new MultiplayerSlot
         {
             // ReSharper disable once ConditionalTernaryEqualBranch
             Status = i > 6 ? MultiSlotStatus.Locked : MultiSlotStatus.Locked,
             Mods   = 0,
             Team   = MultiSlotTeam.NoTeam,
             UserId = -1
         }
     }
     ;
 }
Ejemplo n.º 4
0
        public Sora(SoraDbContextFactory factory,
                    IServiceProvider provider,
                    PacketStreamService pss,
                    MultiplayerService ms,
                    PresenceService ps,
                    ChannelService cs,
                    EventManager ev
                    )
        {
            _provider = provider;
            _factory  = factory;
            _pss      = pss;
            _ms       = ms;
            _ps       = ps;
            _cs       = cs;
            _ev       = ev;

            #region DEFAULT COMMANDS

            RegisterCommandClass <RestrictCommand>();
            RegisterCommandClass <DebugCommand>();

            #endregion
        }
Ejemplo n.º 5
0
        public void Configure(IApplicationBuilder app,
                              IServiceProvider provider,
                              SoraDbContextFactory factory,
                              Config config,
                              IConfig icfg,
                              PluginService plugs,
                              EventManager ev,
                              IHostingEnvironment env,
                              MultiplayerService mps,
                              PacketStreamService pss,
                              ChannelService cs,
                              PresenceService ps,
                              ConsoleCommandService ccs,
                              Bot.Sora s
                              )
        {
            app.UseMiddleware <LoggingMiddleware>();

            Logger.Info(
                @"%#FFFFFF%Sora V1.0.0

%#800000%=============================== %#F94848%License %#800000%=================================
%#F94848%Sora - A Modular Bancho written in C#
Copyright (C) 2019 Robin A. P.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
%#800000%==========================================================================

"
                );
            var w = new Stopwatch();

            Logger.Info("Generating %#F94848%Database%#FFFFFF%! this could take a while.");
            w.Start();
            // Create Sora (bot) if not exists.
            if (Users.GetUser(factory, 100) == null)
            {
                Users.InsertUser(
                    factory, new Users
                {
                    Id          = 100,
                    Username    = "******",
                    Email       = "*****@*****.**",
                    Password    = "",
                    Permissions = Permission.From(Permission.GROUP_ADMIN)
                }
                    );
            }
            w.Stop();
            Logger.Info("Done, it took%#3cfc59%", w.ElapsedMilliseconds + "ms");

            AchievementProcessor.CreateDefaultAchievements(factory);
            Localisation.Initialize();

            ev.SetProvider(provider);

            if (Environment.GetEnvironmentVariable("COS_READONLY") == null)
            {
                ccs.Start();
            }
            s.RunAsync();

            if (!Directory.Exists("plugins"))
            {
                Directory.CreateDirectory("plugins");
            }

            foreach (var plug in Directory.GetFiles("plugins"))
            {
                plugs.LoadPlugin(Directory.GetCurrentDirectory() + "/" + plug);
            }

            ev.RegisterEvents();

            ps.TimeoutCheck();

            if (!Directory.Exists("data"))
            {
                Directory.CreateDirectory("data");
            }

            app.UseDeveloperExceptionPage();

            app.UseMvc(
                routes =>
            {
                routes.MapRoute(
                    "default",
                    "{controller=Home}/{action=Index}/{id?}"
                    );
            }
                );
        }
Ejemplo n.º 6
0
 public OnBanchoMatchJoinEvent(MultiplayerService ms, EventManager ev)
 {
     _ms = ms;
     _ev = ev;
 }
Ejemplo n.º 7
0
 public OnLobbyJoinEvent(PacketStreamService ps, MultiplayerService ms)
 {
     _ps = ps;
     _ms = ms;
 }