Ejemplo n.º 1
0
        public static void FriendInvite(WorldClient pClient, Packet pPacket)
        {
            string sender, receiver;
            if (!pPacket.TryReadString(out sender, 16) ||
                !pPacket.TryReadString(out receiver, 16))
            {
                Log.WriteLine(LogLevel.Warn, "Error reading friend invite.");
                return;
            }

            WorldCharacter inviter = pClient.Character;
            WorldClient invitee = ClientManager.Instance.GetClientByCharname(receiver);
            if (invitee == null)
            {
                //character not found
                using (var pack = new Packet(SH21Type.FriendInviteResponse))
                {
                    pack.WriteString(sender, 16);
                    pack.WriteString(receiver, 16);
                    pack.WriteUShort(0x0946);	// Cannot find ${Target}

                    pClient.SendPacket(pack);
                }
            }
            else if (receiver == sender)
            {
                using (var pack = new Packet(SH21Type.FriendInviteResponse))
                {
                    pack.WriteString(sender, 16);
                    pack.WriteString(receiver, 16);
                    pack.WriteUShort(0x0942);	// You cannot add yourself to your Buddy List.

                    pClient.SendPacket(pack);
                }
            }
            else if (inviter.Friends.Find(f => f.Name == receiver) != null)
            {
                using (var pack = new Packet(SH21Type.FriendInviteResponse))
                {
                    pack.WriteString(sender, 16);
                    pack.WriteString(receiver, 16);
                    pack.WriteUShort(0x0945);	// {Target} is already registered in the friends list.
                    pClient.SendPacket(pack);
                }
            }
            else
            {
                using (var pack = new Packet(SH21Type.FriendInviteRequest))
                {
                    pack.WriteString(receiver, 16);
                    pack.WriteString(sender, 16);

                    invitee.SendPacket(pack);
                }
            }
        }
Ejemplo n.º 2
0
 public static void Wisper(WorldClient client, Packet packet)
 {
     string toname;
     byte messagelenght;
     if (packet.TryReadString(out toname, 16) && packet.TryReadByte(out messagelenght))
     {
         string message;
         if (!packet.TryReadString(out message, messagelenght))
         {
             return;
         }
         WorldClient toChar = ClientManager.Instance.GetClientByCharname(toname);
         if (toChar != null)
         {
             using (var frompacket = new Packet(SH8Type.WisperFrom))
             {
                 frompacket.WriteString(client.Character.Character.Name, 16);
                 if (!toChar.Character.BlocketUser.Contains(client.Character.Character.Name))
                 {
                     frompacket.WriteByte(0);
                 }
                 else
                 {
                     frompacket.WriteByte(12);//blocket notdisplay message
                 }
                 frompacket.WriteByte(messagelenght);
                 frompacket.WriteString(message, messagelenght);
                 toChar.SendPacket(frompacket);
             }
             using (var pack = new Packet(SH8Type.WisperTo))
             {
                 pack.WriteString(toname, 16);
                 pack.WriteByte(messagelenght);
                 pack.WriteString(message, messagelenght);
                 client.SendPacket(pack);
             }
         }
         else
         {
             //target not found
             using (var pp = new Packet(SH8Type.WisperTargetNotfound))
             {
                 pp.WriteUShort(3945);//unk
                 pp.WriteString(toname, 16);
                 client.SendPacket(pp);
             }
         }
     }
 }
Ejemplo n.º 3
0
 public static void SendPing(WorldClient client)
 {
     using (var packet = new Packet(SH2Type.Ping))
     {
         client.SendPacket(packet);
     }
 }
Ejemplo n.º 4
0
        public static void GetAcademyGoldRewardList(WorldClient client, Packet packet)
        {
            using (var pack = new Packet(SH38Type.SendAcademyGoldRewardList))
            {
                pack.WriteHexAsBytes("80 18");//responsecode
                pack.WriteByte(1);//stat count
                pack.WriteHexAsBytes("0A 0A CA 9A 3B 00 00 00 00");//unk

                pack.WriteByte(10);//levelbreich
                pack.WriteLong(1000);
                pack.WriteByte(15);//level bereich
                pack.WriteLong(1000);
                pack.WriteByte(26);//level bereich
                pack.WriteLong(1000);
                pack.WriteByte(31);//level bereich
                pack.WriteLong(1000);
                pack.WriteByte(36);//levelbereich
                pack.WriteLong(1000);
                pack.WriteByte(41);//level bereich
                pack.WriteLong(9000);
                pack.WriteByte(46);//level bereich
                pack.WriteLong(1000);
                pack.WriteByte(51);//level bereich
                pack.WriteLong(1000);
                pack.WriteByte(56);//level bereich
                pack.WriteLong(1000);
                client.SendPacket(pack);
            }
        }
Ejemplo n.º 5
0
        public static void SendClientTime(WorldClient client, DateTime time)
        {
            using (var packet = new Packet(SH2Type.UpdateClientTime))
            {
                //pPacket.WriteUInt((59 << 25) | (23 << 19) | (31 << 13) | (12 << 8) | (254));
            // *                    Minutes   | Hours      | Days       | Months    | Years
                packet.WriteInt(3);
                packet.WriteInt(time.Minute);//minutes
                packet.WriteInt(time.Hour);//hourses
                packet.WriteInt(time.Day);
                packet.WriteInt(time.Month-1);
                packet.WriteInt((time.Year - 1900));
                packet.WriteInt((int)time.DayOfWeek);//wekday?
                packet.WriteInt(105);
                packet.WriteInt(2);

                packet.WriteByte(1); //GMT 0-130 positive 130 -254 negative
              //  packet.WriteLong(2012);
               // packet.WriteInt(4);//unk
                //packet.WriteInt(1);//unk
                //packet.WriteInt(3);//unk
                //packet.WriteInt(46);
              //  packet.Fill(3, 0);//unk
               // packet.WriteByte(2);
                client.SendPacket(packet);
            }
        }
Ejemplo n.º 6
0
 public static void SendUnknown(WorldClient client)
 {
     using (var packet = new Packet(SH31Type.LoadUnkown))
     {
         packet.WriteInt(0xbd1); //lolwut?!  charid or sumtin'
         client.SendPacket(packet);
     }
 }
Ejemplo n.º 7
0
 public static void SendError(WorldClient client, ServerError error)
 {
     using (Packet pack = new Packet(SH3Type.Error))
     {
         pack.WriteShort((byte)error);
         client.SendPacket(pack);
     }
 }
Ejemplo n.º 8
0
 public static void SendConnectError(WorldClient client, ConnectErrors error)
 {
     using (var packet = new Packet(SH4Type.ConnectError))
     {
         packet.WriteUShort((ushort)error);
         client.SendPacket(packet);
     }
 }
Ejemplo n.º 9
0
 public static void sendUnk14(WorldClient client)
 {
     using (var packet = new Packet(SH2Type.Unk14))
     {
         packet.WriteHexAsBytes("07 2C 2A");
         client.SendPacket(packet);
     }
 }
Ejemplo n.º 10
0
 public static void SendAcademyResponse(WorldClient pClient,string GuildName, GuildAcademyResponse Response)
 {
     using (var packet = new Packet(SH38Type.AcademyResponse))
     {
         packet.WriteString(GuildName, 16);
         packet.WriteUShort((ushort)Response);
         pClient.SendPacket(packet);
     }
 }
Ejemplo n.º 11
0
 public static void SendBackToWorldSelect(WorldClient client)
 {
     using(Packet packet = new Packet(SH3Type.BackToWorldSelect))
     {
         packet.WriteUShort(7768);
         packet.WriteString(client.AccountKey);
         client.SendPacket(packet);
     }
 }
Ejemplo n.º 12
0
 public static void SendGuildNameResult(WorldClient client, int pID, string pName)
 {
     using (var packet = new Packet(SH29Type.GuildNameResult))
     {
         packet.WriteInt(pID);
         packet.WriteString(pName, 16);
         client.SendPacket(packet);
     }
 }
Ejemplo n.º 13
0
 public static void SendConnectError(WorldClient client, ConnectErrors error)
 {
     Log.WriteLine(LogLevel.Error, error.ToString());
     using (var packet = new Packet(SH4Type.ConnectError))
     {
         packet.WriteUShort((ushort)error);
         client.SendPacket(packet);
     }
 }
Ejemplo n.º 14
0
 public static void SendZoneServerIP(WorldClient client, ZoneConnection info)
 {
     using (var packet = new Packet(SH4Type.ServerIP))
     {
         packet.WriteString(info.IP, 16);
         packet.WriteUShort(info.Port);
         client.SendPacket(packet);
     }
 }
Ejemplo n.º 15
0
        public static void ChangeFromGuildAcademyToResponse(WorldClient client, Packet packet)
        {
            string GuildName;
              string RequestName;
              bool answer;
              if (!packet.TryReadString(out GuildName, 16) || !packet.TryReadString(out RequestName, 16)|| (!packet.TryReadBool(out answer) || !client.Character.IsInGuildAcademy))
                  return;
             if (answer)
            {
                GuildAcademyMember pMember = client.Character.GuildAcademy.Members.Find(m => m.Character.Character.Name == RequestName);
                if (pMember == null)
                    return;
                pMember.Character.IsInGuildAcademy = false;
                pMember.Academy.RemoveMember(pMember);
               pMember.Character.GuildAcademy.Guild.AddMember(pMember.Character, GuildRank.Member, Program.DatabaseManager.GetClient().GetConnection(), true, true);

                pMember.Character.Guild = pMember.Character.GuildAcademy.Guild;
                pMember.Character.IsInGuild = true;
             using (var pack = new Packet(SH38Type.SendJoinGuildFromAcademy))
             {
                 //this packet remove character from academy List and added to GuildList
                 pack.WriteString(RequestName, 16);
                 pack.WriteString(client.Character.Character.Name, 16);
                 pack.WriteByte(6);//rank
                 pack.WriteInt(0);//unk
                 pack.WriteUShort(0);//korp
                 pack.Fill(64, 0x00);//unk
                 pack.WriteByte(true ? (byte)0x95 : (byte)0x00);// (this.isOnline ? (byte)0x95 : (byte)0x00);
                 pack.Fill(3, 0x00);//unk
                 pack.WriteByte(pMember.Character.Character.Job);
                 pack.WriteByte(pMember.Character.Character.CharLevel);
                 pack.Fill(13, 0x00);//unk
                 client.Character.GuildAcademy.Guild.Broadcast(pack);
                 client.Character.GuildAcademy.Broadcast(pack);
                 }
             }
             using (var p2 = new Packet(SH4Type.CharacterGuildinfo))
             {
                 client.Character.Guild.WriteGuildInfo(packet);
                 client.SendPacket(p2);
             }
             using (var pack = new Packet(SH29Type.GuildMemberJoined))
             {
                 pack.WriteString(client.Character.Character.Name, 16);
                 client.Character.GuildAcademy.Guild.Broadcast(pack);
                 client.Character.GuildAcademy.Broadcast(pack);

             }
             using (var pack = new Packet(SH29Type.ChangeResponse))
             {
                 pack.WriteUShort(3137);//unk
                 pack.WriteByte(3);
                 pack.Fill(2, 0x00);//unk
                 client.SendPacket(pack);
             }
        }
Ejemplo n.º 16
0
 public static void clearBlock(WorldClient client, Packet packet)
 {
     using (var pp = new Packet(SH42Type.ClearBlockList))
     {
         pp.WriteUShort(7200);//unk
         client.SendPacket(packet);
     }
     Program.DatabaseManager.GetClient().ExecuteQuery("DELETE FROM BlockUser WHERE CharID = '" + client.Character.ID + "'");
     client.Character.BlocketUser.Clear();
 }
Ejemplo n.º 17
0
        public static void getWhisperMessage(WorldClient client, Packet packet)
        {
            string toChar;
            byte len;
            string mess;
            if (!packet.TryReadString(out toChar, 16) || !packet.TryReadByte(out len) || !packet.TryReadString(out mess, len))
            {
                Log.WriteLine(LogLevel.Error, "WhisperChat :: Can not parse Whisper request from {0}", client.Character.Character.Name);
                return;
            }

            WorldClient wclient = ClientManager.Instance.GetClientByCharname(toChar);

            if (wclient != null)
            {
                using (var ppacket = new Packet(SH8Type.WhisperTo))
                {
                    ppacket.WriteString(toChar, 16);
                    ppacket.WriteByte(len);
                    ppacket.WriteString(mess, len);
                    client.SendPacket(ppacket);
                }

                using (var ppacket = new Packet(SH8Type.WhisperFrom))
                {
                    ppacket.WriteString(client.Character.Character.Name, 16);
                    ppacket.WriteByte(0); // unk
                    ppacket.WriteByte(len);
                    ppacket.WriteString(mess, len);
                    wclient.SendPacket(ppacket);
                }
            }
            else
            {
                using (var ppacket = new Packet(SH8Type.WhisperErrAnswer))
                {
                    ppacket.WriteUShort(3945);
                    ppacket.WriteString(toChar, 16);
                    client.SendPacket(ppacket);
                }
            }
        }
Ejemplo n.º 18
0
 public static void Handunk1(WorldClient character, Packet packet)
 {
     using (var to = new Packet(SH2Type.Unk1))
     {
         DateTime now = DateTime.Now;
         to.WriteByte(Convert.ToByte(now.Hour));
         to.WriteByte(Convert.ToByte(now.Minute));
         to.WriteByte(Convert.ToByte(now.Second));
         character.SendPacket(to);
     }
 }
Ejemplo n.º 19
0
 public static void AddBlock(WorldClient client, Packet packet)
 {
     string AddBlockname;
     if (packet.TryReadString(out AddBlockname, 16))
     {
         client.Character.BlocketUser.Add(AddBlockname);
         using (var pp = new Packet(SH42Type.AddToBlockList))
         {
             pp.WriteUShort(7168);//unk
             pp.WriteString(AddBlockname, 16);
             pp.WriteUShort(0);//unk
             client.SendPacket(pp);
         }
         Program.DatabaseManager.GetClient().ExecuteQuery("INSERT INTO BlockUser (CharID,BlockCharname) VALUES ('" + client.Character.ID + "','" + AddBlockname + "')");
     }
 }
Ejemplo n.º 20
0
 public static void RemoveFromBlockList(WorldClient client, Packet packet)
 {
     string removename;
     if (packet.TryReadString(out removename, 16))
     {
         if (client.Character.BlocketUser.Contains(removename))
         {
             using (var pack = new Packet(SH42Type.RemoveFromBlockList))
             {
                 pack.WriteUShort(7184);//unk
                 pack.WriteString(removename, 16);
                 client.SendPacket(pack);
             }
             Program.DatabaseManager.GetClient().ExecuteQuery("DELETE FROM BlockUser WHERE CharID = '" + client.Character.ID + "' AND BlockCharname= '" + removename + "'");
             client.Character.BlocketUser.Remove(removename);
         }
     }
 }
Ejemplo n.º 21
0
        public static void SendInterfaceClock(WorldClient client)
        {
            DateTime dt = DateTime.Now;

            using (var packet = new Packet(SH2Type.InterfaceClock))
            {
                packet.WriteInt(DateTime.Now.DayOfYear); //unk
                packet.WriteInt(DateTime.Now.Minute);
                packet.WriteInt(DateTime.Now.Hour);
                packet.WriteInt(DateTime.Now.Day);
                packet.WriteInt((DateTime.Now.Month - 1));
                packet.WriteInt((DateTime.Now.Year - 1900));
                packet.WriteInt((int)DateTime.Now.DayOfWeek);
                packet.WriteInt((DateTime.Now.DayOfYear - 1));
                packet.Fill(4, 0); //unk
                packet.WriteSByte(Convert.ToSByte((DateTime.Now - DateTime.UtcNow).ToString().Split(':')[0])); //Timezone
                client.SendPacket(packet);
            }
        }
Ejemplo n.º 22
0
        public static void MasterList(WorldClient client, Packet packet)
        {
            Dictionary<string, string> list = new Dictionary<string, string>
            {
                {"Char1", "hier ist Char1"},
                {"Char2", "hier ist Char2"}
            };
            using (var ppacket = new Packet(SH14Type.GroupList))
            {
                ppacket.WriteHexAsBytes("00 00 14 01 01 00 01 00 00 00");
                ppacket.WriteInt(list.Count);
                foreach (KeyValuePair<string, string> stat in list)
                {
                    // Note - teh f**k?
                    ppacket.WriteHexAsBytes("");
                    ppacket.WriteString("haha", 16);
                    ppacket.WriteString("1234567890123456789012345678901234567890123456", 46);
                    ppacket.WriteHexAsBytes("00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8C 8E CD 00 88 49 DF 4E B3 08 4C 00 78 26 43 00 01 00 00 00 5A 68 42 00 18 FE 64 02 40 55 DF 4E 08 27 4D 00 94 FF 64 02 24 00 00 00 BD 68 42 00 87 BE");
                }

                list.Clear();
                client.SendPacket(ppacket);
            }
        }
Ejemplo n.º 23
0
 private void SendApprenticeLevelUp(WorldClient pClient,string charname,byte level)
 {
     using (var packet = new Packet(SH37Type.SendApprenticeLevelUp))
      {
          packet.WriteString(charname, 16);
          packet.WriteByte(level);
          pClient.SendPacket(packet);
      }
 }
Ejemplo n.º 24
0
        public static void GotIngame(WorldClient client, Packet packet)
        {
            /* using (var p1 = new Packet(SH4Type.CharacterGuildacademyinfo))
               {
               if(client.Character.GuildAcademy != null)
               {

               }
               else
               {
               p1.Fill(5, 0);
               }
               client.SendPacket(p1);
               }
              using (var p2 = new Packet(SH4Type.CharacterGuildinfo))
               {
                  if (client.Character.Guild != null)
                  {
                      client.Character.Guild.Details.WriteMessageAsGuildMember(p2, client.Character.Guild);

                  }
                  else
                  {
                      p2.WriteInt(0);
                  }
              client.SendPacket(p2);
               }*/
               // dafuq no op code..
               using (var p = new Packet(0x581C))
               {
             //p.WriteShort();
               p.WriteUInt(0x4d0bc167);   // 21h
               client.SendPacket(p);
               }
               // dafuq no op code..
               using (var p3 = new Packet(0x581D))
               {
               p3.WriteShort(0);           //zero kingdom quests!
               client.SendPacket(p3);
               }

               using (var p4 = new Packet(21, 7))
               {
               p4.WriteByte((byte)client.Character.Friends.Count);
               client.Character.WriteFriendData(p4);
               client.SendPacket(p4);
               }
               using (var p5 = new Packet(SH2Type.UnkTimePacket))
               {
               p5.WriteShort(256);
               client.SendPacket(p5);
               }
               if (!client.Character.IsIngame)
               {
               client.Character.IsIngame = true;

               client.Character.OneIngameLoginLoad();
               MasterManager.Instance.SendMasterList(client);
               //SendMasterList(pClient);
               }

               Managers.CharacterManager.InvokdeIngame(client.Character);
               client.Character.OnGotIngame();
        }
Ejemplo n.º 25
0
 public static void SendShortcuts(WorldClient client)
 {
     using (var packet = new Packet(SH28Type.LoadShortCuts))
     {
         byte[] data = client.Character.Character.Shortcuts;
         bool hasData = data != null;
         packet.WriteBool(hasData);
         packet.WriteBytes(hasData ? data : new byte[] { 0 });
         client.SendPacket(packet);
     }
 }
Ejemplo n.º 26
0
 public static void SendQuickbarState(WorldClient client)
 {
     using (var packet = new Packet(SH28Type.LoadQuickBarState))
     {
         byte[] data = client.Character.Character.QuickBarState;
         bool hasData = data != null;
         packet.WriteBool(hasData);
         packet.WriteBytes(hasData ? data : new byte[] { 0 });
         client.SendPacket(packet);
     }
 }
Ejemplo n.º 27
0
 private void SendMasterRequestAccept(WorldClient pClient,string TargetName)
 {
     using(var packet = new Packet(SH37Type.SendMasterRequestAccept))
     {
         packet.WriteString(TargetName, 16);
         pClient.SendPacket(packet);
     }
 }
Ejemplo n.º 28
0
 private void SendMasterRemoveResponse(WorldClient pClient)
 {
     using (var packet = new Packet(SH37Type.SendMasterResponseRemove))
     {
         packet.WriteByte(0);
         packet.WriteUShort(0x1740);
         pClient.SendPacket(packet);
     }
 }
Ejemplo n.º 29
0
 private void SendApprenticeRemoveMaster(WorldClient pClient,string name)
 {
     using(var packet = new Packet(SH37Type.SendApprenticeRemoveMaster))
        {
        packet.WriteString(name, 16);
        packet.WriteByte(0);//isonline?
        pClient.SendPacket(packet);
        }
 }
Ejemplo n.º 30
0
        public void SendMasterList(WorldClient pClient)
        {
            if(pClient.Character.MasterList.Count== 0)
                return;

            using(var packet = new Packet(SH37Type.SendMasterList))
            {
                MasterMember Master = pClient.Character.MasterList.Find(d => d.IsMaster == true);
                if (Master != null)
                {
                    int nowyear = (Master.RegisterDate.Year - 1920 << 1) | Convert.ToByte(Master.IsOnline);
                    int nowmonth = (Master.RegisterDate.Month << 4) | 0x0F;
                    packet.WriteString(Master.pMemberName, 16);
                    packet.WriteByte((byte)nowyear);
                    packet.WriteByte((byte)nowmonth);
                    packet.WriteByte((byte)DateTime.Now.Day);
                    packet.WriteByte(0x01);//unk
                    packet.WriteByte(Master.Level);
                    packet.WriteByte(0);//unk
                    packet.WriteByte(0x03);//unk
                    int count = pClient.Character.MasterList.Count - 1;
                    packet.WriteUShort((ushort)count);
                }
                else
                {
                    DateTime now = DateTime.Now;
                    int nowyear = (now.Year - 1920 << 1) | 1;
                    int nowmonth = (now.Month << 4) | 0x0F;
                    packet.WriteString("", 16);
                    packet.WriteByte((byte)nowyear);
                    packet.WriteByte((byte)nowmonth);
                    packet.WriteByte((byte)now.Day);
                    packet.WriteByte(0x01);//unk
                    packet.WriteByte(1);
                    packet.WriteByte(0);//unk
                    packet.WriteByte(0x03);//unk
                    packet.WriteUShort((ushort)pClient.Character.MasterList.Count);
                    //tODO when master null
                }
                foreach(var Member in pClient.Character.MasterList)
                {
                        packet.WriteString(Member.pMemberName, 16);
                        int year = (Member.RegisterDate.Year - 1920 << 1) | Convert.ToUInt16(Member.IsOnline);
                        int month = (Member.RegisterDate.Month << 4) | 0x0F;
                        packet.WriteByte((byte)year);
                        packet.WriteByte((byte)month);
                        packet.WriteByte(0xB9);
                        packet.WriteByte(0x11);//unk
                        packet.WriteByte(Member.Level);
                        packet.WriteByte(0);//unk

                }
                pClient.SendPacket(packet);
            }
        }