Пример #1
0
        /// <summary>
        /// Parses the response received from the server.
        /// </summary>
        protected override void UnpackResponse()
        {
            base.UnpackResponse();

            // Create the streams we will be reading from.
            MemoryStream responseStream = new MemoryStream(m_responsePayload);
            BinaryReader responseReader = new BinaryReader(responseStream, Encoding.Unicode);

            // Check the response length.
            if (responseStream.Length < MinResponseMessageLength)
            {
                throw new MessageWrongSizeException("Get Player Tier List");
            }

            // Try to unpack the data.
            try
            {
                // Seek past return code.
                responseReader.BaseStream.Seek(sizeof(int), SeekOrigin.Begin);

                // Get the count of tiers.
                ushort tierCount = responseReader.ReadUInt16();

                // Clear the tiers array.
                m_tiers.Clear();

                // Read all the tiers
                for (ushort x = 0; x < tierCount; x++)
                {
                    PlayerLoyaltyTier tier = new PlayerLoyaltyTier();

                    // Tier Id
                    tier.Id = responseReader.ReadInt32();

                    // Tier Name
                    ushort stringLen = responseReader.ReadUInt16();
                    tier.Name = new string(responseReader.ReadChars(stringLen));

                    // Tier Level
                    tier.Level = responseReader.ReadInt32();

                    // Points Per Hour
                    stringLen = responseReader.ReadUInt16();
                    string tempDec = new string(responseReader.ReadChars(stringLen));

                    if (tempDec != string.Empty)
                    {
                        tier.PointsPerHour = decimal.Parse(tempDec, CultureInfo.InvariantCulture);
                    }

                    m_tiers.Add(tier);
                }
            }
            catch (EndOfStreamException e)
            {
                throw new MessageWrongSizeException("Get Player Tier List", e);
            }
            catch (Exception e)
            {
                throw new ServerException("Get Player Tier List", e);
            }

            // Close the streams.
            responseReader.Close();
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the Player class.  This constructor
        /// will call various server message in order to populate the instance
        /// variables.
        /// </summary>
        /// <param name="playerId">The id of the player to create.</param>
        /// <param name="operatorId">The id of the operator this player
        /// belongs to.</param>
        /// <param name="PIN">The PIN for the third party system.</param>
        /// <exception cref="GTI.Modules.Shared.ServerCommException">The server
        /// did not response to a message request.</exception>
        /// <exception cref="GTI.Modules.Shared.MessageWrongSizeException">The
        /// server sent a message that was an unexpected size.</exception>
        /// <exception cref="GTI.Modules.Shared.ServerException">The server
        /// returned a negative return code or a problem occured while
        /// unpackaging a message.</exception>
        public Player(int playerId, int operatorId, int PIN = 0, bool thirdPartyPlayerSync = true, bool pointsAreGood = false)
        {
            // Rally TA1583
            GetPlayerDataMessage getMsg = new GetPlayerDataMessage(playerId, PIN);//JC-A

            getMsg.ThirdPartyPlayerSync = thirdPartyPlayerSync;
            getMsg.PointsAreGood        = pointsAreGood;

            // Send the message.
            getMsg.Send();

            // Fill in the data.
            m_id                      = playerId;
            m_firstName               = getMsg.FirstName;
            m_middleInitial           = getMsg.MiddleInitial;
            m_lastName                = getMsg.LastName;
            m_govIssuedIdNum          = getMsg.GovIssuedIdNumber;
            m_birthDate               = getMsg.BirthDate;
            m_age                     = getMsg.Age;
            m_email                   = getMsg.Email;
            m_playerIdent             = getMsg.PlayerIdentity;
            m_phoneNum                = getMsg.PhoneNumber;
            m_gender                  = getMsg.Gender;
            m_pinNum                  = getMsg.PinNumber;
            m_address1                = getMsg.Address1;
            m_address2                = getMsg.Address2;
            m_city                    = getMsg.City;
            m_state                   = getMsg.State;
            m_zip                     = getMsg.Zip;
            m_country                 = getMsg.Country;
            m_joinDate                = getMsg.JoinDate;
            m_lastVisit               = getMsg.LastVisit;
            m_pointsBalance           = getMsg.PointsBalance;
            m_visitCount              = getMsg.VisitCount;
            m_comment                 = getMsg.Comment;
            m_magCardNum              = getMsg.MagCardNumber;
            m_totalSpend              = getMsg.TotalSpend;
            m_IsLoggedIn              = getMsg.IsLoggedIn;
            m_pointsUpToDate          = getMsg.PointsUpToDate;
            m_playerCardPINError      = getMsg.PlayerCardPINError;
            m_thirdPartyInterfaceDown = getMsg.ThirdPartyInterfaceDown;
            m_ErrorMessage            = getMsg.ErrorMessage;

            // Find the player's tier
            GetPlayerTierListMessage tierMsg = new GetPlayerTierListMessage(operatorId);

            tierMsg.Send();

            PlayerLoyaltyTier[] playerTiers = tierMsg.Tiers;

            if (getMsg.PlayerTierId > 0 && playerTiers != null)
            {
                foreach (PlayerLoyaltyTier tier in playerTiers)
                {
                    if (tier.Id == getMsg.PlayerTierId)
                    {
                        m_tier = tier;
                        break;
                    }
                }
            }
            else
            {
                m_tier = null;
            }

            // Get the player's picture.
            GetPlayerImageMessage getPicMsg = new GetPlayerImageMessage();

            getPicMsg.PlayerId = m_id;

            getPicMsg.Send();
            m_image = getPicMsg.Image;

            // Get the player's comps.
            GetPlayerCompsMessage getCompMsg = new GetPlayerCompsMessage(m_id);

            getCompMsg.Send();
            m_comps.AddRange(getCompMsg.Comps);

            // TTP 50067
            // Get the current gaming date.
            GetGamingDateMessage gamingMsg = new GetGamingDateMessage(operatorId);

            gamingMsg.Send();

            // Get the player's receipts
            GetPlayerReceipts getReceiptsMsg = new GetPlayerReceipts(m_id, operatorId, gamingMsg.GamingDate);

            getReceiptsMsg.Send();
            ReceiptNumbers = getReceiptsMsg.Receipts;

            // Rally US493
            // Get the player's statuses
            ActiveStatusList = GetPlayerStatusCode.GetPlayerStatus(m_id);

            // Rally US507
            GetPlayerCBBFavoriteCountsMessage favoritesMsg = new GetPlayerCBBFavoriteCountsMessage(m_id);

            favoritesMsg.Send();

            foreach (KeyValuePair <short, int> pair in favoritesMsg.FavoriteCounts)
            {
                m_cbbFavoriteCount.Add(pair.Key, pair.Value);
            }

            CreditModuleOnline col = new CreditModuleOnline();

            /*          Debug Code             */
            // mbolIsCreditOnline = false;

            if (col.IsCreditModuleOnline)
            {
                // Get the player's credit.
                GetCreditMessage creditMsg = new GetCreditMessage(m_id);

                creditMsg.Send();

                m_RefundableCredit    = creditMsg.RefundableCredit;
                m_NonRefundableCredit = creditMsg.NonRefundableCredit;
                m_cashOnlyCredit      = creditMsg.CashOnlyCredit; // TTP 50114
            }
            else
            {
                mbolIsCreditOnline = false;
            }

            GetPlayerMagCardPINMessage PINMsg = new GetPlayerMagCardPINMessage(playerId);

            PINMsg.Send();

            m_playerCardPIN = PINMsg.PlayerMagCardPIN;
            m_playerCard    = PINMsg.PlayerMagCard;
        }