Ejemplo n.º 1
0
        public void SetStat(StatsAccessor statsAcc)
        {
            this.statsAcc = statsAcc; // redundancy, but whatever

            SetStatInt("accum.iPlayTime", TimePlayed);
            SetStatInt("accum.iPointsScored", MaxPoints);
            SetStatInt("accum.iNumberOfKills", MaxKills);
            SetStatInt("accum.iDamageDealt", MaxDamage);
            SetStatInt("max.iPlayTime", LongestLife);

            SetStatInt("max.iPointsScored", MostPoints2);
            SetStatInt("max.iNumberOfKills", MostKills2);
            SetStatInt("max.iKillAssists", MostAssists);
            SetStatInt("max.iPointCaptures", MostCaptures);
            SetStatInt("max.iPointDefenses", MostDefenses);
            SetStatInt("max.iDamageDealt", MostDamage);
            SetStatInt("max.iBuildingsDestroyed", MostDestruction);
            SetStatInt("max.iDominations", MostDominations);
            SetStatInt("max.iRevenge", MostRevenges);
            SetStatInt("max.iNumInvulnerable", MostUberCharges);
        }
Ejemplo n.º 2
0
        public void LoadStats(StatsAccessor statsAcc)
        {
            this.statsAcc = statsAcc;

            // assign defaults (top bit)
            TimePlayed  = GetStatString("accum.iPlayTime");
            MaxPoints   = GetStatString("accum.iPointsScored");
            MaxKills    = GetStatString("accum.iNumberOfKills");
            MaxDamage   = GetStatString("accum.iDamageDealt");
            LongestLife = GetStatString("max.iPlayTime");

            // assign defaults (details)
            MostPoints2     = GetStatString("max.iPointsScored");
            MostKills2      = GetStatString("max.iNumberOfKills");
            MostAssists     = GetStatString("max.iKillAssists");
            MostCaptures    = GetStatString("max.iPointCaptures");
            MostDefenses    = GetStatString("max.iPointDefenses");
            MostDamage      = GetStatString("max.iDamageDealt");
            MostDestruction = GetStatString("max.iBuildingsDestroyed");
            MostDominations = GetStatString("max.iDominations");
            MostRevenges    = GetStatString("max.iRevenge");
            MostUberCharges = GetStatString("max.iNumInvulnerable");
        }
Ejemplo n.º 3
0
        private void MainForm_Load( object sender, EventArgs e )
        {
            ClassEditControl scout = new ClassEditControl( "Scout" );
            scout.ClassImage = Properties.Resources.scout;

            // heavy
            ClassEditControl heavy = new ClassEditControl( "Heavy" );
            heavy.ClassImage = Properties.Resources.heavy;

            // medic
            ClassEditControl medic = new ClassEditControl( "Medic" );
            medic.ClassImage = Properties.Resources.medic;

            // soldier
            ClassEditControl soldier = new ClassEditControl( "Soldier" );
            soldier.ClassImage = Properties.Resources.soldier;

            // engi
            ClassEditControl engineer = new ClassEditControl( "Engineer" );
            engineer.ClassImage = Properties.Resources.engineer;

            // spy
            ClassEditControl spy = new ClassEditControl( "Spy" );
            spy.ClassImage = Properties.Resources.spy;

            // sniper
            ClassEditControl sniper = new ClassEditControl( "Sniper" );
            sniper.ClassImage = Properties.Resources.sniper;

            // demo
            ClassEditControl demo = new ClassEditControl( "Demoman" );
            demo.ClassImage = Properties.Resources.demoman;

            // pyro
            ClassEditControl pyro = new ClassEditControl( "Pyro" );
            pyro.ClassImage = Properties.Resources.pyro;

            flowLayoutPanel1.Controls.Add( scout );
            flowLayoutPanel1.Controls.Add( heavy );
            flowLayoutPanel1.Controls.Add( medic );
            flowLayoutPanel1.Controls.Add( soldier );
            flowLayoutPanel1.Controls.Add( engineer );
            flowLayoutPanel1.Controls.Add( spy );
            flowLayoutPanel1.Controls.Add( sniper );
            flowLayoutPanel1.Controls.Add( demo );
            flowLayoutPanel1.Controls.Add( pyro );

            toolStripStatusLabel1.Text = "Initializing steamworks...";

            try
            {
                int error;
                client = ( SteamClient008 )Steamworks.CreateInterface( SteamClient008.InterfaceVersion, out error );

                if ( client == null )
                    throw new InvalidOperationException( "Unable to create ISteamClient." );

                pipe = client.CreateSteamPipe();
                if ( pipe == SteamPipeHandle.InvalidHandle )
                    throw new InvalidOperationException( "Unable to create steam pipe." );

                user = client.ConnectToGlobalUser( pipe );

                clientEngine = ( ClientEngine )Steamworks.CreateInterface( ClientEngine.InterfaceVersion, out error );

                if ( clientEngine == null )
                    throw new InvalidOperationException( "Unable to create IClientEngine." );
            }
            catch (Exception ex)
            {
                MessageBox.Show( this, "Unable to initialize steamworks. Please ensure the following:\n\n" +
                    " * steamclient.dll, tier0_s.dll, vstdlib_s.dll, are present in the running directory\n" +
                    " * You are logged into steam and are online.\n\nAdditional Details: " + ex.Message, "TF2 Stats Suite"
                );

                this.Close();
                return;
            }

            toolStripStatusLabel1.Text = "Loading stats...";

            statsAcc = new StatsAccessor( client, pipe, user, 440 );

            steamUser = ( SteamUser012 )client.GetISteamUser( user, pipe, SteamUser012.InterfaceVersion );
            clientUtils = ( ClientUtils )clientEngine.GetIClientUtils( pipe, ClientUtils.InterfaceVersion );

            clientUtils.SetAppIDForCurrentPipe( new AppID( 440 ) );

            foreach ( ClassEditControl cec in flowLayoutPanel1.Controls )
            {
                toolStripStatusLabel1.Text = "Loading stats for '" + cec.Class + "'...";
                cec.LoadStats( statsAcc );
                Application.DoEvents();
            }

            toolStripStatusLabel1.Text = "Stats fully loaded!";
        }
Ejemplo n.º 4
0
        public void SetStat( StatsAccessor statsAcc )
        {
            this.statsAcc = statsAcc; // redundancy, but whatever

            SetStatInt( "accum.iPlayTime", TimePlayed );
            SetStatInt( "accum.iPointsScored", MaxPoints );
            SetStatInt( "accum.iNumberOfKills", MaxKills );
            SetStatInt( "accum.iDamageDealt", MaxDamage );
            SetStatInt( "max.iPlayTime", LongestLife );

            SetStatInt( "max.iPointsScored", MostPoints2 );
            SetStatInt( "max.iNumberOfKills", MostKills2 );
            SetStatInt( "max.iKillAssists", MostAssists );
            SetStatInt( "max.iPointCaptures", MostCaptures );
            SetStatInt( "max.iPointDefenses", MostDefenses );
            SetStatInt( "max.iDamageDealt", MostDamage );
            SetStatInt( "max.iBuildingsDestroyed", MostDestruction );
            SetStatInt( "max.iDominations", MostDominations );
            SetStatInt( "max.iRevenge", MostRevenges );
            SetStatInt( "max.iNumInvulnerable", MostUberCharges );
        }
Ejemplo n.º 5
0
        public void LoadStats( StatsAccessor statsAcc )
        {
            this.statsAcc = statsAcc;

            // assign defaults (top bit)
            TimePlayed = GetStatString( "accum.iPlayTime" );
            MaxPoints = GetStatString( "accum.iPointsScored" );
            MaxKills = GetStatString( "accum.iNumberOfKills" );
            MaxDamage = GetStatString( "accum.iDamageDealt" );
            LongestLife = GetStatString( "max.iPlayTime" );

            // assign defaults (details)
            MostPoints2 = GetStatString( "max.iPointsScored" );
            MostKills2 = GetStatString( "max.iNumberOfKills" );
            MostAssists = GetStatString( "max.iKillAssists" );
            MostCaptures = GetStatString( "max.iPointCaptures" );
            MostDefenses = GetStatString( "max.iPointDefenses" );
            MostDamage = GetStatString( "max.iDamageDealt" );
            MostDestruction = GetStatString( "max.iBuildingsDestroyed" );
            MostDominations = GetStatString( "max.iDominations" );
            MostRevenges = GetStatString( "max.iRevenge" );
            MostUberCharges = GetStatString( "max.iNumInvulnerable" );
        }
Ejemplo n.º 6
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            ClassEditControl scout = new ClassEditControl("Scout");

            scout.ClassImage = Properties.Resources.scout;

            // heavy
            ClassEditControl heavy = new ClassEditControl("Heavy");

            heavy.ClassImage = Properties.Resources.heavy;

            // medic
            ClassEditControl medic = new ClassEditControl("Medic");

            medic.ClassImage = Properties.Resources.medic;

            // soldier
            ClassEditControl soldier = new ClassEditControl("Soldier");

            soldier.ClassImage = Properties.Resources.soldier;

            // engi
            ClassEditControl engineer = new ClassEditControl("Engineer");

            engineer.ClassImage = Properties.Resources.engineer;

            // spy
            ClassEditControl spy = new ClassEditControl("Spy");

            spy.ClassImage = Properties.Resources.spy;

            // sniper
            ClassEditControl sniper = new ClassEditControl("Sniper");

            sniper.ClassImage = Properties.Resources.sniper;

            // demo
            ClassEditControl demo = new ClassEditControl("Demoman");

            demo.ClassImage = Properties.Resources.demoman;

            // pyro
            ClassEditControl pyro = new ClassEditControl("Pyro");

            pyro.ClassImage = Properties.Resources.pyro;

            flowLayoutPanel1.Controls.Add(scout);
            flowLayoutPanel1.Controls.Add(heavy);
            flowLayoutPanel1.Controls.Add(medic);
            flowLayoutPanel1.Controls.Add(soldier);
            flowLayoutPanel1.Controls.Add(engineer);
            flowLayoutPanel1.Controls.Add(spy);
            flowLayoutPanel1.Controls.Add(sniper);
            flowLayoutPanel1.Controls.Add(demo);
            flowLayoutPanel1.Controls.Add(pyro);


            toolStripStatusLabel1.Text = "Initializing steamworks...";

            try
            {
                int error;
                client = ( SteamClient008 )Steamworks.CreateInterface(SteamClient008.InterfaceVersion, out error);

                if (client == null)
                {
                    throw new InvalidOperationException("Unable to create ISteamClient.");
                }

                pipe = client.CreateSteamPipe();
                if (pipe == SteamPipeHandle.InvalidHandle)
                {
                    throw new InvalidOperationException("Unable to create steam pipe.");
                }

                user = client.ConnectToGlobalUser(pipe);

                clientEngine = ( ClientEngine )Steamworks.CreateInterface(ClientEngine.InterfaceVersion, out error);

                if (clientEngine == null)
                {
                    throw new InvalidOperationException("Unable to create IClientEngine.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Unable to initialize steamworks. Please ensure the following:\n\n" +
                                " * steamclient.dll, tier0_s.dll, vstdlib_s.dll, are present in the running directory\n" +
                                " * You are logged into steam and are online.\n\nAdditional Details: " + ex.Message, "TF2 Stats Suite"
                                );

                this.Close();
                return;
            }

            toolStripStatusLabel1.Text = "Loading stats...";

            statsAcc = new StatsAccessor(client, pipe, user, 440);

            steamUser   = ( SteamUser012 )client.GetISteamUser(user, pipe, SteamUser012.InterfaceVersion);
            clientUtils = ( ClientUtils )clientEngine.GetIClientUtils(pipe, ClientUtils.InterfaceVersion);

            clientUtils.SetAppIDForCurrentPipe(new AppID(440));

            foreach (ClassEditControl cec in flowLayoutPanel1.Controls)
            {
                toolStripStatusLabel1.Text = "Loading stats for '" + cec.Class + "'...";
                cec.LoadStats(statsAcc);
                Application.DoEvents();
            }

            toolStripStatusLabel1.Text = "Stats fully loaded!";
        }