示例#1
0
        //**********************************************************
        //\bm\<MESSAGE>\f\<from profileid>\msg\<>\final\
        //\bm\<UTM>\f\<from profileid>\msg\<>\final\
        //\bm\<REQUEST>\f\<from profileid>\msg\|signed|\final\
        //\bm\<AUTH>\f\<from profileid>\final\
        //\bm\<REVOKE>\f\<from profileid>\final\
        //\bm\<STATUS>\f\<from profileid>\msg\|s|<status code>|ss|<status string>|ls|<location string>|ip|<>|p|<port>|qm|<quiet mode falgs>\final\
        //\bm\<INVITE>\f\<from profileid>\msg\|p|<productid>|l|<location string>
        //\bm\<ping>\f\<from profileid>\msg\final\
        //\bm\<pong>\f\<from profileid>\final\

        public static void SendBuddyList(GPCMSession session)
        {
            // \bdy\<number of friends>\list\<array of profileids>\
            //total number of friends
            // we have to separate friends by productid,namespaceid,partnerid,gamename
            //because you will have different friends in different game

            if (session.PlayerInfo.BuddiesSent)
            {
                return;
            }
            session.PlayerInfo.BuddiesSent = true;
            //return;
            string sendingBuffer = @"\bdy\";
            var    result        = SendBuddiesQuery.SearchBuddiesId(session.PlayerInfo.Profileid, session.PlayerInfo.NamespaceID);

            uint[] profileids;
            if (result != null)
            {
                //convert the object in dictionary to uint array
                profileids     = result.Values.Cast <uint>().ToArray();
                sendingBuffer += profileids.Length + @"\list\";
                for (int i = 0; i < profileids.Length; i++)
                {
                    //last one we do not add ,
                    if (i == profileids.Length - 1)
                    {
                        sendingBuffer += profileids[i];
                        break;
                    }
                    sendingBuffer += profileids[i] + @",";
                }

                sendingBuffer += @"\final\";
                session.SendAsync(sendingBuffer);
                //we send the player's status info to client
                SendBuddyStatusInfo(session, profileids);
            }
            else
            {
                sendingBuffer = @"\bdy\0\list\\final\";
                session.SendAsync(sendingBuffer);
            }
        }
示例#2
0
        public static void SendBuddyStatusInfo(GPCMSession session, uint[] profileids)
        {
            Dictionary <string, object> result;

            foreach (uint profileid in profileids)
            {
                string sendingBuffer = @"\bm\" + (uint)GPBasic.BmStatus + @"\f\";
                result         = SendBuddiesQuery.GetStatusInfo(profileid, session.PlayerInfo.NamespaceID);
                sendingBuffer += profileid + @"\msg\";
                sendingBuffer += @"|s|" + Convert.ToUInt32(result["status"]);
                sendingBuffer += @"|ss|" + result["statstring"].ToString();
                sendingBuffer += @"|ls|" + result["location"].ToString();
                sendingBuffer += @"|ip|" + result["lastip"];
                sendingBuffer += @"|p|" + Convert.ToUInt32(result["port"]);
                sendingBuffer += @"|qm|" + result["quietflags"] + @"\final\";

                session.SendAsync(sendingBuffer);
            }
        }