Exemplo n.º 1
0
 // Sets up all the command hooks
 internal static void Init()
 {
     ModerationCommands.Init();
     BuildingCommands.Init();
     InfoCommands.Init();
     WorldCommands.Init();
     ZoneCommands.Init();
     MaintenanceCommands.Init();
     ChatCommands.Init();
     CpeCommands.Init();
     Logger.Log(LogType.Debug,
                "CommandManager: {0} commands registered ({1} hidden, {2} aliases)",
                Commands.Count,
                GetCommands(true).Length,
                Aliases.Count);
 }
Exemplo n.º 2
0
        public static void OldLoad()
        {
            string[] EntityFileList = Directory.GetFiles("./Entities");
            foreach (string filename in EntityFileList)
            {
                Entity entity = new Entity();
                if (Path.GetExtension(filename) != ".txt")
                {
                    continue;
                }

                string[] entityData = File.ReadAllLines(filename);
                entity.Model = CpeCommands.ParseModel(Player.Console, entityData[2]) ?? "humanoid";
                entity.World = entityData[4];

                sbyte id;
                if (!sbyte.TryParse(entityData[3], out id))
                {
                    id = NextFreeID(entity.World);
                }
                if (id == Packet.SelfId)
                {
                    continue;
                }

                entity.ID   = id;
                entity.Name = entityData[0] ?? entity.ID.ToString();
                entity.Skin = entityData[1] ?? entity.Name;
                Position pos;

                Position spawn = default(Position);
                World    world = entity.WorldIn();
                if (world != null && world.map != null)
                {
                    spawn = world.map.Spawn;
                }

                if (!int.TryParse(entityData[5], out pos.X))
                {
                    pos.X = spawn.X;
                }
                if (!int.TryParse(entityData[6], out pos.Y))
                {
                    pos.Y = spawn.Y;
                }
                if (!int.TryParse(entityData[7], out pos.Z))
                {
                    pos.Z = spawn.Z;
                }
                if (!byte.TryParse(entityData[8], out pos.L))
                {
                    pos.L = spawn.L;
                }
                if (!byte.TryParse(entityData[9], out pos.R))
                {
                    pos.R = spawn.R;
                }

                entity.SetPos(pos);
                EntityList.Add(entity);
            }
        }