Пример #1
0
 /// <summary>
 /// STATUS packet. The purpose of STATUS records is unknown. It is hypothesized that status values are:
 /// 1 = transient state, such as "logging in" or "ending trade";
 /// 2 = game has joined another game;
 /// 5 = game is attempting to join another game;
 /// 6 = standby announcement state;
 /// </summary>
 private void OnReceive_Status(NetState ns, GsTcpReader reader)
 {
     ns.GsStatus = int.Parse(reader.RecordValue);
     Kernel.WriteLine(TypeName, $"{ns} GsStatus=='{ns.GsStatus}'.");
     if (reader.HasParameter("statstring", out string statusString))
     {
         ns.GsStatusString = statusString;
     }
     if (reader.HasParameter("locstring", out string locationString))
     {
         ns.GsStatusLocation = locationString;
     }
 }
Пример #2
0
        /// <summary>
        /// "updatepro" packet. Appended to a GETPROFILE record (after its \final\ record terminator) to modify a
        /// profile. Note that, as it is does not have a corresponding response record (or perhaps because it is
        /// appended to a GETPROFILE record), there is no id key in this record.
        /// </summary>
        private void OnReceive_UpdateProfile(NetState ns, GsTcpReader reader)
        {
            int sessionKey = int.Parse(reader.GetParameter("sesskey"));

            if (ns.GsSessionID != sessionKey)
            {
                Send(ns, GsSmsgError.ErrFatalSessionKeyInvalid(0));
                throw new NetStateMsgException(ns, "sent incorrect sesskey parameter.", reader);
            }
            if (reader.HasParameter("firstname", out string firstName))
            {
                ns.Account.FirstName = firstName;
            }
            if (reader.HasParameter("lastname", out string lastName))
            {
                ns.Account.LastName = lastName;
            }
            Kernel.WriteLine(TypeName, $"{ns} updated profile.");
        }