Jump to content
  • Advertisement
Sign in to follow this  
MatsK

Login confusion

This topic is 1319 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Given the following:

        /// <summary>
        /// Received client token.
        /// </summary>
        public static void HandleCityToken(NetworkClient Client, ProcessedPacket P)
        {
            try
            {
                bool ClientAuthenticated = false;
 
                using (DataAccess db = DataAccess.Get())
                {
                    string Token = P.ReadString();
 
                    foreach (ClientToken Tok in NetworkFacade.TransferringClients)
                    {
                        //Token matched, so client must have logged in through login server first.
                        if (Tok.Token.Equals(Token, StringComparison.InvariantCultureIgnoreCase))
                        {
                            ClientAuthenticated = true;
 
                            Character Char = db.Characters.GetForCharacterGUID(new Guid(Tok.CharacterGUID));
                            if (Char != null)
                            {
                                lock(NetworkFacade.CurrentSession)
                                    NetworkFacade.CurrentSession.AddPlayer(Client, Char);
 
                                PacketStream SuccessPacket = new PacketStream((byte)PacketType.CITY_TOKEN, 0);
                                SuccessPacket.WriteByte((byte)CityTransferStatus.Success);
                                Client.SendEncrypted((byte)PacketType.CITY_TOKEN, SuccessPacket.ToArray());
 
                                break;
                            }
                            else
                            {
                                ClientAuthenticated = false;
                                break;
                            }
                        }
                    }
 
                    if (!ClientAuthenticated)
                    {
                        PacketStream ErrorPacket = new PacketStream((byte)PacketType.CITY_TOKEN, 0);
                        ErrorPacket.WriteByte((byte)CityTransferStatus.GeneralError);
                        Client.SendEncrypted((byte)PacketType.CITY_TOKEN, ErrorPacket.ToArray());
                    }
                }
            }
            catch (Exception E)
            {
                Logger.LogDebug("Exception in HandleCityToken: " + E.ToString());
            }
        }
 
 
(...)
 
        private Dictionary<NetworkClient, Character> m_PlayingCharacters = new Dictionary<NetworkClient, Character>();
 
        /// <summary>
        /// Adds a player to the current session.
        /// </summary>
        /// <param name="Client">The player's client.</param>
        /// <param name="Char">The player's character.</param>
        public void AddPlayer(NetworkClient Client, Character Char)
        {
            lock (m_PlayingCharacters)
            {
                foreach (KeyValuePair<NetworkClient, Character> KVP in m_PlayingCharacters)
                {
                    ClientPacketSenders.SendPlayerJoinSession(KVP.Key, Char);
                    //Send a bunch of these in reverse (to the player joining the session).
                    ClientPacketSenders.SendPlayerJoinSession(Client, KVP.Value);
                }
 
                m_PlayingCharacters.Add(Client, Char);
            }
        }

why do BOTH players receive information about the other (or self?) when I log on using the same account, but NONE receive any information when I log in using two different accounts o_O

The answer should be blindingly obvious, I can't see it.

Share this post


Link to post
Share on other sites
Advertisement
If you set a breakpoint when the second player logs in, and step through the code line by line to see what it actually sends (and compare to what you'd expect it to send,) what do you find?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!