Exemplo n.º 1
0
 public CServer()
 {
     allDone      = new ManualResetEvent(true);
     ItemList     = new CItemList[5338];
     NpcList      = ArrayList.Synchronized(new ArrayList());
     ClientIDList = new int[65535];
     for (int i = 0; i < 65535; i++)
     {
         ClientIDList[i] = 0;
     }
     m_ClientList  = ArrayList.Synchronized(new ArrayList());
     m_ClientCount = 0;
     m_Packet      = new CPacketBuilder();
     config        = new CConfig();
     config.LoadConfigs();
     m_Port       = config.Port;
     DB           = new CDatabase(config.odbcstring);
     Packets      = new CServerPackets(this);
     Process      = new CProcess(this);
     MapThread    = new Thread(Process.MapProcess);
     WorldThread  = new Thread(Process.WorldProcess);
     VisionThread = new Thread(Process.VisionProcess);
     MapThread.Start();
     Core.CLog("Started Map Thread");
     WorldThread.Start();
     Core.CLog("Started World Thread");
     VisionThread.Start();
     Core.CLog("Started Vision Thread");
     CLoadData.LoadItemList(this);
     CLoadData.LoadNpcList(this);
 }
Exemplo n.º 2
0
 public void SendPacket(CPacketBuilder thispacket, int size)
 {
     if (this.sock.Connected)
     {
         byte[] SendData = new byte[size];
         Buffer.BlockCopy(thispacket.dataBuffer, 0, SendData, 0, size);
         this.sock.Send(SendData, size, SocketFlags.None);
     }
 }
Exemplo n.º 3
0
        public void SendToVisionPlayers(CPlayer thisclient, CPacketBuilder thispacket, int size)
        {
            int lastid = 0;

            foreach (object player in thisclient.vPlayers)
            {
                if (!player.Equals(thisclient))
                {
                    CPlayer otherclient = (CPlayer)player;
                    if (otherclient.Session.ClientID != lastid)
                    {
                        otherclient.Client.SendPacket(thispacket, size);
                    }
                    lastid = otherclient.Session.ClientID;
                }
            }
        }
Exemplo n.º 4
0
 public CServerPackets(CServer sServer)
 {
     mServer = sServer;
     OutPak  = new CPacketBuilder();
 }
Exemplo n.º 5
0
 public int Encrypt(CPacketBuilder dest, byte[] src, int len, int hash)
 {
     return(WYD2_Encrypt(dest.dataBuffer, src, len, EncDecKeys, hash, 0));
 }