Example #1
0
        public static void NotifyServerGameSetup(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
        {
            List <Blaze.Tdf> input = Blaze.ReadPacketContent(p);
            uint             t     = Blaze.GetUnixTimeStamp();

            pi.game.GNAM = ((Blaze.TdfString)input[2]).Value;
            pi.game.GSET = ((Blaze.TdfInteger)input[3]).Value;
            pi.game.VOIP = ((Blaze.TdfInteger)input[21]).Value;
            pi.game.VSTR = ((Blaze.TdfString)input[22]).Value;
            List <Blaze.Tdf> result = new List <Blaze.Tdf>();
            List <Blaze.Tdf> GAME   = new List <Blaze.Tdf>();

            GAME.Add(Blaze.TdfList.Create("ADMN", 0, 1, new List <long>(new long[] { pi.userId })));
            GAME.Add(Blaze.TdfList.Create("CAP\0", 0, 2, new List <long>(new long[] { 0x20, 0 })));
            GAME.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
            GAME.Add(Blaze.TdfString.Create("GNAM", pi.game.GNAM));
            GAME.Add(Blaze.TdfInteger.Create("GPVH", 666));
            GAME.Add(Blaze.TdfInteger.Create("GSET", pi.game.GSET));
            GAME.Add(Blaze.TdfInteger.Create("GSID", 1));
            GAME.Add(Blaze.TdfInteger.Create("GSTA", pi.game.GSTA));
            GAME.Add(Blaze.TdfString.Create("GTYP", "AssaultStandard"));
            GAME.Add(BlazeHelper.CreateNETField(pi, "HNET"));
            GAME.Add(Blaze.TdfInteger.Create("HSES", 13666));
            GAME.Add(Blaze.TdfInteger.Create("IGNO", 0));
            GAME.Add(Blaze.TdfInteger.Create("MCAP", 0x20));
            GAME.Add(BlazeHelper.CreateNQOSField(pi, "NQOS"));
            GAME.Add(Blaze.TdfInteger.Create("NRES", 0));
            GAME.Add(Blaze.TdfInteger.Create("NTOP", 1));
            GAME.Add(Blaze.TdfString.Create("PGID", ""));
            List <Blaze.Tdf> PHST = new List <Blaze.Tdf>();

            PHST.Add(Blaze.TdfInteger.Create("HPID", pi.userId));
            GAME.Add(Blaze.TdfStruct.Create("PHST", PHST));
            GAME.Add(Blaze.TdfInteger.Create("PRES", 1));
            GAME.Add(Blaze.TdfString.Create("PSAS", "wv"));
            GAME.Add(Blaze.TdfInteger.Create("QCAP", 0x10));
            GAME.Add(Blaze.TdfInteger.Create("SEED", 0x2CF2048F));
            GAME.Add(Blaze.TdfInteger.Create("TCAP", 0x10));
            List <Blaze.Tdf> THST = new List <Blaze.Tdf>();

            THST.Add(Blaze.TdfInteger.Create("HPID", pi.userId));
            GAME.Add(Blaze.TdfStruct.Create("THST", THST));
            GAME.Add(Blaze.TdfList.Create("TIDS", 0, 2, new List <long>(new long[] { 1, 2 })));
            GAME.Add(Blaze.TdfString.Create("UUID", "f5193367-c991-4429-aee4-8d5f3adab938"));
            GAME.Add(Blaze.TdfInteger.Create("VOIP", pi.game.VOIP));
            GAME.Add(Blaze.TdfString.Create("VSTR", pi.game.VSTR));
            result.Add(Blaze.TdfStruct.Create("GAME", GAME));
            List <Blaze.TdfStruct> PROS = new List <Blaze.TdfStruct>();
            List <Blaze.Tdf>       ee0  = new List <Blaze.Tdf>();

            ee0.Add(Blaze.TdfInteger.Create("EXID", pi.userId));
            ee0.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
            ee0.Add(Blaze.TdfInteger.Create("LOC\0", pi.loc));
            ee0.Add(Blaze.TdfString.Create("NAME", pi.profile.name));
            ee0.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
            ee0.Add(BlazeHelper.CreateNETFieldUnion(pi, "PNET"));
            ee0.Add(Blaze.TdfInteger.Create("SID\0", pi.slot));
            ee0.Add(Blaze.TdfInteger.Create("SLOT", 0));
            ee0.Add(Blaze.TdfInteger.Create("STAT", 2));
            ee0.Add(Blaze.TdfInteger.Create("TIDX", 0xFFFF));
            ee0.Add(Blaze.TdfInteger.Create("TIME", t));
            ee0.Add(Blaze.TdfInteger.Create("UID\0", pi.userId));
            PROS.Add(Blaze.TdfStruct.Create("0", ee0));
            result.Add(Blaze.TdfList.Create("PROS", 3, 1, PROS));
            List <Blaze.Tdf> VALU = new List <Blaze.Tdf>();

            VALU.Add(Blaze.TdfInteger.Create("DCTX", 0));
            result.Add(Blaze.TdfUnion.Create("REAS", 0, Blaze.TdfStruct.Create("VALU", VALU)));
            byte[] buff = Blaze.CreatePacket(p.Component, 0x14, 0, 0x2000, 0, result);
            ns.Write(buff, 0, buff.Length);
            ns.Flush();
            BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0014] NotifyServerGameSetup", System.Drawing.Color.Black);
        }
Example #2
0
        public static void NotifyGamePlayerStateChange(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns, long stat)
        {
            List <Blaze.Tdf> result = new List <Blaze.Tdf>();

            result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
            result.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
            result.Add(Blaze.TdfInteger.Create("STAT", stat));
            byte[] buff = Blaze.CreatePacket(0x4, 0x74, 0, 0x2000, 0, result);
            ns.Write(buff, 0, buff.Length);
            ns.Flush();
            BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0074] NotifyGamePlayerStateChange", System.Drawing.Color.Black);
        }
Example #3
0
        public static void NotifyClientGameSetup(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, PlayerInfo srv, NetworkStream ns, long reas = 1)
        {
            List <Blaze.Tdf> result = new List <Blaze.Tdf>();
            List <Blaze.Tdf> GAME   = new List <Blaze.Tdf>();

            GAME.Add(Blaze.TdfList.Create("ADMN", 0, 1, new List <long>(new long[] { srv.userId })));
            if (srv.game.ATTR != null)
            {
                GAME.Add(srv.game.ATTR);
            }
            GAME.Add(Blaze.TdfList.Create("CAP\0", 0, 2, new List <long>(new long[] { 0x20, 0 })));
            GAME.Add(Blaze.TdfInteger.Create("GID\0", srv.game.id));
            GAME.Add(Blaze.TdfString.Create("GNAM", srv.game.GNAM));
            GAME.Add(Blaze.TdfInteger.Create("GPVH", 666));
            GAME.Add(Blaze.TdfInteger.Create("GSET", srv.game.GSET));
            GAME.Add(Blaze.TdfInteger.Create("GSID", 1));
            GAME.Add(Blaze.TdfInteger.Create("GSTA", srv.game.GSTA));
            GAME.Add(Blaze.TdfString.Create("GTYP", "AssaultStandard"));
            GAME.Add(BlazeHelper.CreateNETField(srv, "HNET"));
            GAME.Add(Blaze.TdfInteger.Create("HSES", 13666));
            GAME.Add(Blaze.TdfInteger.Create("IGNO", 0));
            GAME.Add(Blaze.TdfInteger.Create("MCAP", 0x20));
            GAME.Add(BlazeHelper.CreateNQOSField(srv, "NQOS"));
            GAME.Add(Blaze.TdfInteger.Create("NRES", 0));
            GAME.Add(Blaze.TdfInteger.Create("NTOP", 1));
            GAME.Add(Blaze.TdfString.Create("PGID", ""));
            List <Blaze.Tdf> PHST = new List <Blaze.Tdf>();

            PHST.Add(Blaze.TdfInteger.Create("HPID", srv.userId));
            PHST.Add(Blaze.TdfInteger.Create("HSLT", srv.slot));
            GAME.Add(Blaze.TdfStruct.Create("PHST", PHST));
            GAME.Add(Blaze.TdfInteger.Create("PRES", 1));
            GAME.Add(Blaze.TdfString.Create("PSAS", "wv"));
            GAME.Add(Blaze.TdfInteger.Create("QCAP", 0x10));
            GAME.Add(Blaze.TdfInteger.Create("SEED", 0x2CF2048F));
            GAME.Add(Blaze.TdfInteger.Create("TCAP", 0x10));
            List <Blaze.Tdf> THST = new List <Blaze.Tdf>();

            THST.Add(Blaze.TdfInteger.Create("HPID", srv.userId));
            THST.Add(Blaze.TdfInteger.Create("HSLT", srv.slot));
            GAME.Add(Blaze.TdfStruct.Create("THST", THST));
            List <long> playerIdList = new List <long>();

            for (int i = 0; i < 32; i++)
            {
                if (srv.game.slotUse[i] != -1)
                {
                    playerIdList.Add(srv.game.slotUse[i]);
                }
            }
            GAME.Add(Blaze.TdfList.Create("TIDS", 0, 2, playerIdList));
            GAME.Add(Blaze.TdfString.Create("UUID", "f5193367-c991-4429-aee4-8d5f3adab938"));
            GAME.Add(Blaze.TdfInteger.Create("VOIP", srv.game.VOIP));
            GAME.Add(Blaze.TdfString.Create("VSTR", srv.game.VSTR));
            result.Add(Blaze.TdfStruct.Create("GAME", GAME));
            List <Blaze.TdfStruct> PROS = new List <Blaze.TdfStruct>();

            for (int i = 0; i < 32; i++)
            {
                if (srv.game.players[i] != null)
                {
                    PROS.Add(BlazeHelper.MakePROSEntry(i, srv.game.players[i]));
                }
            }
            result.Add(Blaze.TdfList.Create("PROS", 3, PROS.Count, PROS));
            List <Blaze.Tdf> VALU = new List <Blaze.Tdf>();

            VALU.Add(Blaze.TdfInteger.Create("DCTX", reas));
            result.Add(Blaze.TdfUnion.Create("REAS", 0, Blaze.TdfStruct.Create("VALU", VALU)));
            byte[] buff = Blaze.CreatePacket(0x4, 0x14, 0, 0x2000, 0, result);
            ns.Write(buff, 0, buff.Length);
            ns.Flush();
            BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0014] NotifyClientGameSetup", System.Drawing.Color.Black);
        }
Example #4
0
        public static void NotifyPlatformHostInitialized(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
        {
            List <Blaze.Tdf> result = new List <Blaze.Tdf>();

            result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
            result.Add(Blaze.TdfInteger.Create("PHID", pi.userId));
            result.Add(Blaze.TdfInteger.Create("PHST", 0));
            byte[] buff = Blaze.CreatePacket(4, 0x47, 0, 0x2000, 0, result);
            ns.Write(buff, 0, buff.Length);
            ns.Flush();
            BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0047] NotifyPlatformHostInitialized", System.Drawing.Color.Black);
        }
Example #5
0
        private static void PreAuth(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
        {
            List <Blaze.Tdf> input = Blaze.ReadPacketContent(p);

            Blaze.TdfStruct  CDAT = (Blaze.TdfStruct)input[0];
            Blaze.TdfInteger TYPE = (Blaze.TdfInteger)CDAT.Values[3];
            pi.isServer = TYPE.Value != 0;
            if (pi.isServer)
            {
                pi.game    = new GameInfo();
                pi.profile = Profiles.Create("test-server", 999);
                pi.userId  = 999;
            }
            Blaze.TdfStruct  CINF = (Blaze.TdfStruct)input[1];
            Blaze.TdfString  CVER = (Blaze.TdfString)CINF.Values[4];
            Blaze.TdfInteger LOC  = (Blaze.TdfInteger)CINF.Values[7];
            pi.loc     = LOC.Value;
            pi.version = CVER.Value;
            BlazeServer.Log("[CLNT] #" + pi.userId + " is a " + (pi.isServer ? "server" : "client"), System.Drawing.Color.Blue);
            List <Blaze.Tdf> Result = new List <Blaze.Tdf>();

            Result.Add(Blaze.TdfInteger.Create("ANON", 0));
            Result.Add(Blaze.TdfString.Create("ASRC", "300294"));
            List <string> t  = Helper.ConvertStringList("{1} {25} {4} {27} {28} {6} {7} {9} {10} {11} {30720} {30721} {30722} {30723} {20} {30725} {30726} {2000}");
            List <long>   t2 = new List <long>();

            foreach (string v in t)
            {
                t2.Add(Convert.ToInt64(v));
            }
            Result.Add(Blaze.TdfList.Create("CIDS", 0, t2.Count, t2));
            t = new List <string>();
            List <string> t3 = new List <string>();

            Helper.ConvertDoubleStringList("{connIdleTimeout ; 90s} {defaultRequestTimeout ; 60s} {pingPeriod ; 20s} {voipHeadsetUpdateRate ; 1000} {xlspConnectionIdleTimeout ; 300}", out t, out t3);
            Blaze.TdfDoubleList conf2 = Blaze.TdfDoubleList.Create("CONF", 1, 1, t, t3, t.Count);
            List <Blaze.Tdf>    t4    = new List <Blaze.Tdf>();

            t4.Add(conf2);
            Result.Add(Blaze.TdfStruct.Create("CONF", t4));
            Result.Add(Blaze.TdfString.Create("INST", "battlefield-assault-pc"));
            Result.Add(Blaze.TdfInteger.Create("MINR", 0));
            Result.Add(Blaze.TdfString.Create("NASP", "cem_ea_id"));
            Result.Add(Blaze.TdfString.Create("PILD", ""));
            Result.Add(Blaze.TdfString.Create("PLAT", "pc"));
            List <Blaze.Tdf> QOSS = new List <Blaze.Tdf>();
            List <Blaze.Tdf> BWPS = new List <Blaze.Tdf>();

            BWPS.Add(Blaze.TdfString.Create("PSA\0", ProviderInfo.QOS_IP));
            BWPS.Add(Blaze.TdfInteger.Create("PSP\0", ProviderInfo.QOS_Port));
            BWPS.Add(Blaze.TdfString.Create("SNA\0", ProviderInfo.QOS_Name));
            QOSS.Add(Blaze.TdfStruct.Create("BWPS", BWPS));
            QOSS.Add(Blaze.TdfInteger.Create("LNP\0", 0xA));
            List <Blaze.Tdf> LTPS1 = new List <Blaze.Tdf>();

            LTPS1.Add(Blaze.TdfString.Create("PSA\0", ProviderInfo.QOS_IP));
            LTPS1.Add(Blaze.TdfInteger.Create("PSP\0", ProviderInfo.QOS_Port));
            LTPS1.Add(Blaze.TdfString.Create("SNA\0", ProviderInfo.QOS_Name));
            List <Blaze.TdfStruct> LTPS = new List <Blaze.TdfStruct>();

            LTPS.Add(Blaze.CreateStructStub(LTPS1));
            t = Helper.ConvertStringList("{" + ProviderInfo.QOS_SName + "}");
            QOSS.Add(Blaze.TdfDoubleList.Create("LTPS", 1, 3, t, LTPS, 1));
            QOSS.Add(Blaze.TdfInteger.Create("SVID", 0x45410805));
            Result.Add(Blaze.TdfStruct.Create("QOSS", QOSS));
            Result.Add(Blaze.TdfString.Create("RSRC", "300294"));
            Result.Add(Blaze.TdfString.Create("SVER", "WV Server"));
            byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result);
            ns.Write(buff, 0, buff.Length);
            ns.Flush();
        }
Example #6
0
 private static void SetClientMetrics(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
 {
     byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, new List <Blaze.Tdf>());
     ns.Write(buff, 0, buff.Length);
     ns.Flush();
 }