Example #1
0
        internal void RegissterPlayerConnection(int serverId, int playerId, byte[] toKen, byte[] identifier, AionConnection client, string playerName, string accountName)
        {
            ChatClient value = null;

            if (!_players.TryGetValue(playerId, out value))
            {
                return;
            }
            _players.Remove(playerId);
            byte[] toKen2 = value.ToKen;
            if (!value.SamePlayer(playerName))
            {
                return;
            }
            bool flag = true;

            Array.ForEach(toKen, delegate(byte reg)
            {
                if (!toKen2.Contains(reg))
                {
                    flag = false;
                }
            });
            if (flag)
            {
                byte[] bytes = Encoding.Unicode.GetBytes(value.PlayerName + "@");
                value.Identifier  = bytes.Concat(identifier).ToArray();
                client.PlayerId   = playerId;
                client.ServerId   = serverId;
                client.ChatClient = value;
                AddPlayer(playerId, client);
                client.SendPacket(new SM_PLAYER_AUTH_RESPONSE());
                log.InfoFormat("#{0} 玩家[{1}]进入聊天频道!", (object)serverId, (object)playerName);
            }
        }
Example #2
0
        internal void RegisterPlayerChannel(AionConnection con, short channelIndex, byte[] channelIdentifier)
        {
            int hashCode = Encoding.Unicode.GetString(channelIdentifier).GetHashCode();

            if (!con.IsInChannel(hashCode))
            {
                con.AddChannel(hashCode);
            }
            if (!_connects.ContainsKey(con.PlayerId))
            {
                log.Warn((object)("进入频道异常 ID:" + Conversions.ToString(con.PlayerId)));
                _connects.Add(con.PlayerId, con);
            }
            con.SendPacket(new SM_CHANNEL_RESPONSE(channelIndex, hashCode));
        }