예제 #1
0
        private void OnCharacterListingRequest(INetworkConnection con, Packet msg)
        {
            // character was created successfully.  send a listing of all new characters
            PacketCharacterListing pcl      = (PacketCharacterListing)con.CreatePacket((int)PacketType.CharacterListing, 0, false, false);
            List <ICharacterInfo>  allToons = CharacterUtil.Instance.GetCharacterListing(this.ServerUser.ID);

            if (allToons.Count == 0)
            {
                if (ServerUser.CurrentCharacter != null)
                {
                    pcl.Characters.Add(ServerUser.CurrentCharacter.CharacterInfo);
                }
                else
                {
                    pcl.Characters = new List <ICharacterInfo>();
                }
            }
            else
            {
                foreach (ICharacterInfo inf in allToons)
                {
                    pcl.Characters.Add(inf);
                }
            }

            msg.ReplyPacket = pcl;
        }
예제 #2
0
        /// <summary>
        /// Gets called when we get a listing of characters on this cluster.  This only happens if the server is configured to use Characters.  If the server
        /// does not use characters, this message will never arrive.  If it does, we need to pick a character (or create a new one and then pick one) before
        /// central server will let us get to any of the content on the server.
        /// </summary>
        /// <param name="con"></param>
        /// <param name="p"></param>
        protected virtual void OnCharacterListingReceived(INetworkConnection con, Packet p)
        {
            PacketCharacterListing msg = p as PacketCharacterListing;

            Characters.Clear();
            for (int i = 0; i < msg.Characters.Count; i++)
            {
                Characters.Add(msg.Characters[i] as CharacterInfo);
            }
            FireCharacterListingArrived(this, EventArgs.Empty);
        }