Example #1
0
        public void SetRules(BinaryReader packet)
        {
            uint lfList = packet.ReadUInt32();

            if (lfList >= 0 && lfList < BanlistManager.Banlists.Count)
            {
                Banlist = BanlistManager.Banlists[BanlistManager.GetIndex(lfList)];
            }
            Region         = packet.ReadByte();
            MasterRule     = packet.ReadByte();
            Mode           = packet.ReadByte();
            IsMatch        = Mode == 1;
            IsTag          = Mode == 2;
            IsReady        = new bool[IsTag ? 4 : 2];
            Players        = new Player[IsTag ? 4 : 2];
            EnablePriority = packet.ReadByte() > 0;
            NoCheckDeck    = packet.ReadByte() > 0;
            NoShuffleDeck  = packet.ReadByte() > 0;
            //C++ padding: 5 bytes + 3 bytes = 8 bytes
            for (int i = 0; i < 3; i++)
            {
                packet.ReadByte();
            }
            int lifePoints = packet.ReadInt32();

            LifePoints[0] = lifePoints;
            LifePoints[1] = lifePoints;
            StartHand     = packet.ReadByte();
            DrawCount     = packet.ReadByte();
            Timer         = packet.ReadInt16();
        }
Example #2
0
        public static void Main(string[] args)
        {
#if !DEBUG
            try
            {
#endif
            Config.Load(args);

            BanlistManager.Init(Config.GetString("BanlistFile", "lflist.conf"));
            Api.Init(Config.GetString("RootPath", "."), Config.GetString("ScriptDirectory", "script"), Config.GetString("DatabaseFile", "cards.cdb"));

            ClientVersion = Config.GetUInt("ClientVersion", ClientVersion);

            CoreServer server = new CoreServer();
            server.Start();
            while (server.IsRunning)
            {
                server.Tick();
                Thread.Sleep(1);
            }
#if !DEBUG
        }

        catch (Exception ex)
        {
            File.WriteAllText("crash_" + DateTime.UtcNow.ToString("yyyy-MM-dd_HH-mm-ss") + ".txt", ex.ToString());
        }
#endif
        }
Example #3
0
        public static void Main(string[] args)
        {
            try {
                CoreConfig config = new CoreConfig();
                if (args.Length != 2 || !config.Load(args[0], args[1]))
                {
                    return;
                }

                BanlistManager.Init("lflist.conf");
                Api.Init();

                CoreServer server = new CoreServer(config);
                server.Start();
                while (server.IsRunning)
                {
                    server.Tick();
                    Thread.Sleep(1);
                }
            }
            catch (Exception ex) {
                File.WriteAllText("crash_" + DateTime.UtcNow.ToString("yyyy-MM-dd_HH-mm-ss") + ".txt", ex.ToString());
            }
        }