Beispiel #1
0
        /// <summary>
        /// Instantiates a Bot Brain.
        /// </summary>
        public Brain()
        {
            this.InstantiateTargetLists();
            this.InstantiateActionQueues();

            this._world = new WorldParser();
        }
Beispiel #2
0
 public MapRenderer2D(IWorldParser parser,
                      ITextureProvider textureProvider,
                      IMapColumnCacheProvider cacheProvider)
 {
     _parser          = parser;
     _textureProvider = textureProvider;
     _cacheProvider   = cacheProvider;
 }
Beispiel #3
0
 private void PopulatePlayers(IWorldParser parser, WorldInfoModel worldInfo)
 {
     worldInfo.Players = parser.Players.Select(p => new PlayerInfoModel
     {
         Health    = p.Health,
         X         = p.X,
         Y         = p.Y,
         Z         = p.Z,
         UUID      = p.UUID,
         Inventory = p.Inventory.Select(i => new InventoryItemModel
         {
             Name  = i.Id,
             Count = i.Count
         })
     }).ToList();
 }
Beispiel #4
0
 public IMapRenderer2D Create2DRender(IWorldParser parser, IMapColumnCacheProvider cacheProvider)
 {
     return(new MapRenderer2D(parser, _textureProvider, cacheProvider));
 }
 public SimpleGridWorldEngine(IWorldParser w)
 {
     this.pars = new MyWorldEngineParams();
     this.w = w;
 }
Beispiel #6
0
        private void PopulateBlockEntities(IWorldParser parser, WorldInfoModel worldInfo)
        {
            var chests = new List <ChestInfoModel>();
            var signs  = new List <SignInfoModel>();

            foreach (var region in parser.GetRegions(TARGET_REGION))
            {
                foreach (var column in region.Columns)
                {
                    foreach (var chunk in column.Chunks)
                    {
                        foreach (var block in chunk.Blocks)
                        {
                            if (block is Chest)
                            {
                                var chest = block as Chest;

                                chests.Add(new ChestInfoModel
                                {
                                    X     = chest.WorldX,
                                    Y     = chest.WorldY,
                                    Z     = chest.WorldZ,
                                    Items = chest.Items.Select(i => new InventoryItemModel
                                    {
                                        Name  = i.Id,
                                        Count = i.Count
                                    }).ToList()
                                });
                            }
                            else if (block is Sign)
                            {
                                var    sign         = block as Sign;
                                string textRendered = string.Join("\n", sign.TextLines.Select(s =>
                                {
                                    if (s.Contains('{') && s.Contains('}') && s.Contains("\"text\":"))
                                    {
                                        var obj = JObject.Parse(s);
                                        return(obj.GetValue("text").ToString());
                                    }
                                    else
                                    {
                                        return(s);
                                    }
                                }));

                                signs.Add(new SignInfoModel
                                {
                                    X    = sign.WorldX,
                                    Y    = sign.WorldY,
                                    Z    = sign.WorldZ,
                                    Text = textRendered
                                });
                            }
                        }
                    }
                }
            }

            worldInfo.Chests = chests;
            worldInfo.Signs  = signs;
        }
Beispiel #7
0
 public SimpleGridWorldEngine(IWorldParser w)
 {
     this.pars = new MyWorldEngineParams();
     this.w    = w;
 }