Exemple #1
0
        public void PilotInformations()
        {
            string          sqlPilotInformations = "SELECT user_nome, user_apelido, utilizadores.rank, ranks.rank, utilizadores.user_id, utilizadores.levelid, utilizadores.eps from utilizadores left join ranks on utilizadores.rank = ranks.rankid where user_email=@PilotId";
            MySqlConnection conn = new MySqlConnection(Login.ConnectionString);

            try
            {
                conn.Open();

                MySqlCommand sqlCmd = new MySqlCommand(sqlPilotInformations, conn);
                sqlCmd.Parameters.AddWithValue("@PilotId", Properties.Settings.Default.Email);

                MySqlDataReader sqlCmdRes = sqlCmd.ExecuteReader();
                if (sqlCmdRes.HasRows)
                {
                    while (sqlCmdRes.Read())
                    {
                        result.UserName    = (string)sqlCmdRes[0];
                        result.UserSurname = (string)sqlCmdRes[1];
                        result.Rank        = (string)sqlCmdRes[3];
                        result.UserID      = (int)sqlCmdRes[4];
                        result.AdminLevel  = (int)sqlCmdRes[5];
                        result.UserEps     = (int)sqlCmdRes[6];
                    }
                }


                PilotInfo.PilotInfos(result.UserID);
            }
            catch (Exception crap)
            {
                MessageBox.Show(crap.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
            }
        }
        /// <summary>
        /// Writes pilot info into a packet
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="info"></param>
        public static void WritePilotInfo(this ServerBasePacket packet, PilotInfo info)
        {
            packet.WriteInt(info.AbilityPointsAvailable);

            packet.WriteByte((byte)info.HpLevel);
            packet.WriteByte((byte)info.MoveSpeedLevel);
            packet.WriteByte((byte)info.EnLevel);
            packet.WriteByte((byte)info.ScanRangeLevel);
            packet.WriteByte((byte)info.SpLevel);
            packet.WriteByte((byte)info.AimLevel);

            packet.WriteByte(0); // Unknown
            packet.WriteByte(0); // Unknown

            packet.WriteInt(info.MeleeLevel);
            packet.WriteInt(info.RangedLevel);
            packet.WriteInt(info.SiegeLevel);
            packet.WriteInt(info.RocketLevel);

            //packet.WriteInt(0); // Unknown
            packet.WriteByte(0); // NOTE: Not sure why everything after here is offset by one, so i am just doing 3 bytes instead of 4 here
            packet.WriteByte(0);
            packet.WriteByte(0);
        }
    void Awake()
    {
        CurrentRoom = null;

        // Setting up references.
        groundCheck = transform.Find("groundCheck");
        wallClimbCheck = transform.Find("climbWallCheck");
        mRoofClimbCheck = transform.Find("climbRoofCheck");
        anim = GetComponent<Animator>();

        Physics2D.IgnoreLayerCollision(LayerMask.NameToLayer("Climbable"), LayerMask.NameToLayer("Player"));

        mPilotInfo = new PilotInfo();
        mPilotInfo.PlayerName = "";

        mLatestCorrectPos = transform.position;
        mOnUpdatePos = transform.position;
    }