Пример #1
0
        private void GETWORLD_Packet(Socket s, string[] data, ref ClientList _thisclient)
        {
            Character thisclient;

            thisclient          = new Character(Convert.ToUInt64(data[1]), Database.MYSQL, s, Database.ItemDatabase);
            _thisclient._client = thisclient;
            if (thisclient.CharHash != data[2])
            {
                Console.WriteLine("MSG_INFO", "Hash code = " + data[2]);
                return;
            }
            Console.WriteLine("MSG_INFO", "User selected CharacterName = " + thisclient.Name);
            int index = -1;

            lock (ClientList)
            {
                for (int i = 0; i < ClientList.Count; i++)
                {
                    if (ClientList[i]._Socket.RemoteEndPoint.ToString().Equals(s.RemoteEndPoint.ToString()))
                    {
                        ClientList[i] = new ClientList(thisclient);
                        index         = i;
                    }
                }
            }

            //ClientList.Add(new ClientList(thisclient));
            if (index < 0)
            {
                Console.WriteLine("MSG_FATAL", "CLIENT COULD NOT BE FOUND IN ClientList. WTF?");
            }

            if (thisclient != null && thisclient.Id > 0)
            {
                Box.AddCharacter(thisclient);
                string temp = "0;" + thisclient.Level + ";25;";
                for (int i = 0; i < thisclient.Skills.Count; i++)
                {
                    temp += thisclient.Skills[i].Id + ";" + thisclient.Skills[i].Level + ";" + thisclient.Skills[i].Active + ";";
                }
                SendData(s, "GETWORLD;" + thisclient.Packet());
                SendData(s, "SKILLS;" + temp);
                SendData(s, "INVENTORY;" + thisclient.ItemsPacket());
                //Database.MapList.Add(new MapList(thisclient, 0));
                Console.WriteLine("MSG_FATAL", thisclient.Packet());

                //SendToAllConnected("USERCONNECTED;" + thisclient.Id + ";" + thisclient.Name + ";" + thisclient.Level + ";" + thisclient.MaxHP + ";" + thisclient.MaxMP + ";" + thisclient.EquippedItemsPacket());
                Console.WriteLine("MSG_INFO", "Character information sent.");
            }
            else
            {
                Console.WriteLine("MSG_FATAL", "Character information could not be sent. Unknown charatcer.");
            }
            thisclient = null;
        }