Пример #1
0
        public static void SendZoneList(ZoneConnection zc)
        {
            using (var packet = new InterPacket(InterHeader.Zonelist))
            {
                packet.Write(Program.Zones.Values.Count);
                foreach (var z in Program.Zones.Values)
                {
                    packet.Write(z.ID);
                    packet.Write(z.IP);
                    packet.Write(z.Port);
                    packet.WriteInt(z.Maps.Count);
                    foreach (var m in z.Maps)
                    {
                        packet.WriteUShort(m.ID);
                        packet.WriteStringLen(m.ShortName);
                        packet.WriteStringLen(m.FullName);
                        packet.WriteInt(m.RegenX);
                        packet.WriteInt(m.RegenY);
                        packet.WriteByte(m.Kingdom);
                        packet.WriteUShort(m.ViewRange);
                    }
                }

                zc.SendPacket(packet);
            }
        }
Пример #2
0
 public static void SendAddReward(ZoneConnection ZC, ushort itemID, byte count, string CharName)
 {
     using (var packet = new InterPacket(InterHeader.SendAddRewardItem))
     {
         packet.WriteUShort(itemID);
         packet.WriteByte(count);
         packet.WriteString(CharName, 16);
         ZC.SendPacket(packet);
     }
 }
Пример #3
0
        public static void SendGetCharacterBroaucast(WorldCharacter pChar, FiestaLib.Networking.Packet pPacket)
        {
            ZoneConnection conn = Program.GetZoneByMap(pChar.Character.PositionInfo.Map);

            using (var packet = new InterPacket(InterHeader.GetBroadcastList))
            {
                packet.WriteString(pChar.Character.Name, 16);
                packet.WriteInt(pPacket.ToNormalArray().Length);
                packet.WriteBytes(pPacket.ToNormalArray());
                conn.SendPacket(packet);
            }
        }
Пример #4
0
        public static void SendChangeMap(WorldCharacter pChar, int OldMap)
        {
            Managers.CharacterManager.InvokeChangeMapEvent(pChar);
            ZoneConnection conn = Program.GetZoneByMap(OldMap);

            using (var packet = new InterPacket(InterHeader.GetBroadcastList))
            {
                packet.WriteString(pChar.Character.Name, 16);
                packet.WriteInt(pChar.Character.PositionInfo.XPos);
                packet.WriteInt(pChar.Character.PositionInfo.YPos);
                conn.SendPacket(packet);
            }
        }
Пример #5
0
        public static void FunctionGetCharacterOnline(ZoneConnection pConnection, InterPacket pPacket)
        {
            long   id;
            string charName;

            if (!pPacket.TryReadLong(out id) || !pPacket.TryReadString(out charName, 16))
            {
                throw new InvalidPacketException();
            }

            var isOnline = ClientManager.Instance.IsOnline(charName);

            using (var packet = new InterPacket(InterHeader.FunctionAnswer))
            {
                packet.WriteLong(id);
                packet.WriteBool(isOnline);
                pConnection.SendPacket(packet);
            }
        }
Пример #6
0
        public static void FunctionGetCharacterOnline(ZoneConnection pConnection, InterPacket pPacket)
        {
            long id;
            string charName;

            if(!pPacket.TryReadLong(out id) ||!pPacket.TryReadString(out charName, 16))
                throw new InvalidPacketException();

            bool isOnline = ClientManager.Instance.IsOnline(charName);
            using (InterPacket packet = new InterPacket(InterHeader.FunctionAnswer))
            {
                packet.WriteLong(id);
                packet.WriteBool(isOnline);
                pConnection.SendPacket(packet);
            }
        }
Пример #7
0
 public static void SendZoneList(ZoneConnection zc)
 {
     using (var packet = new InterPacket(InterHeader.Zonelist))
     {
         packet.Write(Program.Zones.Values.Count);
         foreach (var z in Program.Zones.Values)
         {
             packet.Write(z.ID);
             packet.Write(z.IP);
             packet.Write(z.Port);
             packet.WriteInt(z.Maps.Count);
             foreach (var m in z.Maps)
             {
                 packet.WriteUShort(m.ID);
                 packet.WriteStringLen(m.ShortName);
                 packet.WriteStringLen(m.FullName);
                 packet.WriteInt(m.RegenX);
                 packet.WriteInt(m.RegenY);
                 packet.WriteByte(m.Kingdom);
                 packet.WriteUShort(m.ViewRange);
             }
         }
         zc.SendPacket(packet);
     }
 }
Пример #8
0
 public static void SendAddReward(ZoneConnection ZC, ushort itemID, byte count,string CharName)
 {
     using (var packet = new InterPacket(InterHeader.SendAddRewardItem))
     {
         packet.WriteUShort(itemID);
         packet.WriteByte(count);
         packet.WriteString(CharName, 16);
         ZC.SendPacket(packet);
     }
 }