Ejemplo n.º 1
0
        public bool RegisterWorld(int RpcId,int WorldId, string Name, int port,string Ip)
        {
            Log.Info("RegisterWorld", "Enregistrement du world : " + Name + ", RpcID = " + RpcId + ",Ip=" + Ip + ":" + port);

            int iIp = BitConverter.ToInt32(IPAddress.Parse(Ip).GetAddressBytes(), 0);

            WorldInfo Info = null;
            foreach (WorldInfo World in _Worlds)
            {
                if (World._Info.Id == WorldId)
                    Info = World;
            }

            if (Info == null)
            {
                Log.Debug("RegisterWorld", "Le World n'existe pas, création");

                DBWorldInfo World = new DBWorldInfo();
                World.Name = Name;
                World.Id = WorldId;
                World.Population = 1;
                World.Status = 1;
                World.Crim = 1;
                World.Enf = 1;

                Info = new WorldInfo(World);
                Info.Port = port;
                Info.Ip = iIp;

                _Worlds.Add(Info);
                Database.AddObject(World);
            }
            else
            {
                Info.RpcID = RpcId;
                Info.Port = port;
                Info.Ip = iIp;
            }

            return true;
        }