Ejemplo n.º 1
0
        public static void Broadcast(WorldConnector pConnector, InterPacket pPacket)
        {
            int packetlenght;
            byte[] packet;
            string charname;
            if (!pPacket.TryReadString(out charname, 16))
                return;

            if (!pPacket.TryReadInt(out packetlenght))
                return;

            if (!pPacket.TryReadBytes(packetlenght, out packet))
                return;

            ZoneClient pClient = ClientManager.Instance.GetClientByCharName(charname);
            if (pClient == null)
                return;
            using (var ipacket = new InterPacket(InterHeader.SendBroiadCastList))
            {
                List<ZoneCharacter> Sender = pClient.Character.Map.GetCharactersBySectors(pClient.Character.MapSector.SurroundingSectors);
                if (Sender.Count == 0)
                    return;
                ipacket.WriteInt(packetlenght);
                ipacket.WriteBytes(packet);
                ipacket.WriteInt(Sender.Count);
                foreach (var character in Sender)
                {
                    ipacket.WriteString(character.Name,16);
                }
                pConnector.SendPacket(ipacket);
            }
        }
Ejemplo n.º 2
0
 public static void TryAssiging(WorldConnector lc)
 {
     using (var p = new InterPacket(InterHeader.Assign))
     {
         p.WriteStringLen(Settings.Instance.IP);
         lc.SendPacket(p);
     }
 }
Ejemplo n.º 3
0
        public static void Broadcast(WorldConnector pConnector, InterPacket pPacket)
        {
            int packetlenght;

            byte[] packet;
            string charname;

            if (!pPacket.TryReadString(out charname, 16))
            {
                return;
            }

            if (!pPacket.TryReadInt(out packetlenght))
            {
                return;
            }

            if (!pPacket.TryReadBytes(packetlenght, out packet))
            {
                return;
            }

            var pClient = ClientManager.Instance.GetClientByCharName(charname);

            if (pClient == null)
            {
                return;
            }
            using (var ipacket = new InterPacket(InterHeader.SendBroiadCastList))
            {
                var Sender =
                    pClient.Character.Map.GetCharactersBySectors(pClient.Character.MapSector.SurroundingSectors);
                if (Sender.Count == 0)
                {
                    return;
                }
                ipacket.WriteInt(packetlenght);
                ipacket.WriteBytes(packet);
                ipacket.WriteInt(Sender.Count);
                foreach (var character in Sender)
                {
                    ipacket.WriteString(character.Name, 16);
                }

                pConnector.SendPacket(ipacket);
            }
        }
Ejemplo n.º 4
0
 public static void TryAssiging(WorldConnector lc)
 {
     using (var p = new InterPacket(InterHeader.Assign))
     {
         p.WriteStringLen(Settings.Instance.IP);
         lc.SendPacket(p);
     }
 }