Example #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);
            }
        }
Example #2
0
 public static void BackTo(ZoneClient client, Packet packet)
 {
     using(var iacket = new InterPacket(InterHeader.ClientDisconect))
     {
         iacket.WriteString(client.Character.Character.Name, 16);
         InterServer.WorldConnector.Instance.SendPacket(iacket);
     }
 }
Example #3
0
 public static void UpdateMoneyWorld(long Money,string charname)
 {
     using (var packet = new InterPacket(InterHeader.UpdateMoney))
     {
         packet.WriteString(charname, 16);
         packet.WriteLong(Money);
         WorldConnector.Instance.SendPacket(packet);
     }
 }
Example #4
0
 public static void SendReciveCoper(string name, long Coper,bool CoperType)
 {
     using(var packet = new InterPacket(InterHeader.ReciveCoper))
     {
         packet.WriteString(name, 16);
         packet.WriteLong(Coper);
         packet.WriteBool(CoperType);
         WorldConnector.Instance.SendPacket(packet);
     }
 }
Example #5
0
 public static void SendLevelUpToWorld(byte Level, string charname)
 {
     using (var packet = new InterPacket(InterHeader.CharacterLevelUP))
     {
         packet.WriteByte(Level);
         packet.WriteString(charname, 16);
         WorldConnector.Instance.SendPacket(packet);
     }
 }
Example #6
0
 public static void SendChangeZoneToWorld(ZoneCharacter character, ushort mapid, int x, int y, string ip, ushort port, ushort randomid)
 {
     using (var packet = new InterPacket(InterHeader.ChangeZone))
       {
           packet.WriteUShort(mapid);
           packet.WriteInt(x);
           packet.WriteInt(y);
           packet.WriteString(character.Name,16);
           packet.WriteString(Settings.Instance.IP, 16);
           packet.WriteUShort(port);
           packet.WriteUShort(randomid);
           WorldConnector.Instance.SendPacket(packet);
       }
 }
Example #7
0
 private void SendAddMemberInterPacket(GroupMember pMember)
 {
     ZoneConnection con = Program.GetZoneByMap(pMember.Character.Character.PositionInfo.Map);
     using (var pack = new InterPacket(InterHeader.AddPartyMember))
     {
         pack.WriteLong(this.Id);
         pack.WriteString(pMember.Name, 16);
         con.SendPacket(pack);
     }
 }
Example #8
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);
            }
        }
Example #9
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);
            }
        }
Example #10
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);
     }
 }
Example #11
0
        public static void On_GameClient_UpdateGuildMessage(WorldClient Client, Packet Packet)
        {
            ushort length;
            string message;
            if (Client.Character.Guild == null
                || !Packet.TryReadUShort(out length)
                || !Packet.TryReadString(out message, length))
            {
                return;
            }

            //response packets
            using (var packet = new Packet(SH29Type.UnkMessageChange))
            {
                packet.WriteHexAsBytes("68 1B 00 92 AD F8 4F 2E 00 00 00 2B 00 00 00 17 00 00 00 07 00 00 00 06 00 00 00 70 00 00 00 06 00 00 00 BC 00 00 00 01 00 00 00 00 00");

                Client.SendPacket(packet);
            }
            using (var packet = new Packet(SH29Type.ClearGuildDetailsMessage))
            {
                packet.WriteUShort(3137);
                packet.WriteLong(0);

                Client.SendPacket(packet);
            }
            using (var packet = new Packet(SH29Type.UpdateGuildMessageResponse))
            {
                packet.WriteUShort(3137);
                Client.SendPacket(packet);
            }

            //update guild
            lock (Client.Character.Guild.ThreadLocker)
            {
                Client.Character.Guild.Message = message;
                Client.Character.Guild.MessageCreater = Client.Character;
                Client.Character.Guild.MessageCreateTime = Program.CurrentTime;

                Client.Character.Guild.Save();

                //broadcast packet to all guild members
                using (var packet = new Packet(SH29Type.SendUpdateGuildDetails))
                {
                    packet.Fill(4, 0x00);
                    packet.WriteInt(Client.Character.Guild.MessageCreateTime.Second);
                    packet.WriteInt(Client.Character.Guild.MessageCreateTime.Minute);
                    packet.WriteInt(Client.Character.Guild.MessageCreateTime.Hour);
                    packet.WriteInt(Client.Character.Guild.MessageCreateTime.Day);
                    packet.WriteInt(Client.Character.Guild.MessageCreateTime.Month - 1);
                    packet.WriteInt(Client.Character.Guild.MessageCreateTime.Year - 1900);
                    packet.WriteInt(0);
                    packet.WriteLong(0);
                    packet.WriteString(Client.Character.Character.Name, 16);
                    packet.WriteUShort(length);
                    packet.WriteString(message, length);

                    Client.Character.Guild.Broadcast(packet);
                }

                //send packet to zone that guild message changed
                using (var packet = new InterPacket(InterHeader.ZONE_GuildMessageUpdate))
                {
                    packet.WriteInt(Client.Character.Guild.ID);
                    packet.WriteInt(Client.Character.ID);
                    packet.WriteDateTime(Client.Character.Guild.MessageCreateTime);

                    packet.WriteUShort(length);
                    packet.WriteString(message, length);
                    ZoneManager.Instance.Broadcast(packet);
                }
            }
        }
Example #12
0
 public void Ban()
 {
     Save();
     // Program.worldService.DisconnectClient(this.Name, true); // TODO: Inter server packet.
     using (var p = new InterPacket(InterHeader.BanAccount))
     {
         p.WriteString(this.Character.Name, 16);
         WorldConnector.Instance.SendPacket(p);
     }
     Client.Disconnect();
 }