Beispiel #1
0
        bool ShipComponentExperiment(monocle.Telegraph telegraph)
        {
            List <monocle.ShipData> ships = null;

            if (!telegraph.GetAllShips(monocle.Area.OldWorld, out ships))
            {
                return(false);
            }

            for (ulong i = 0; i < 2048; ++i)
            {
                ulong address = 0;

                if (!telegraph.GetShipComponentAddress(ships[0].shipId, i, out address))
                {
                    continue;
                }

                if (address == 0)
                {
                    continue;
                }

                string idString      = i.ToString();
                string addressString = address.ToString("X");

                Console.WriteLine(string.Format("{0} {1}", idString, addressString));
            }

            return(true);
        }
Beispiel #2
0
        void Demo()
        {
            monocle.Telegraph telegraph = new monocle.Telegraph();

            List <ShipData> testShips;

            telegraph.GetAllShips(Area.OldWorld, out testShips);

            return;

            List <monocle.IslandData> islandData = new List <monocle.IslandData>();

            if (!telegraph.GetIslandsByName("Shortisland", out islandData))
            {
                return;
            }

            monocle.IslandData island = islandData.First();

            List <monocle.BuildingData> buildings = new List <monocle.BuildingData>();

            if (!telegraph.GetIslandBuildings(islandData.First().id, out buildings))
            {
                return;
            }

            foreach (var building in buildings)
            {
                if (building.buidlingType == monocle.Building.SmallTradingPost)
                {
                    for (ulong i = 0; i < 2048; ++i)
                    {
                        ulong compAddress = 0;

                        telegraph.GetBuildingComponentAddress(islandData.First().id, building.id, i, out compAddress);

                        if (compAddress != 0)
                        {
                            string sAddress = compAddress.ToString("X");
                            string sI       = i.ToString();

                            Console.WriteLine(string.Format("{0} {1}", sI, sAddress));
                        }
                    }
                }


                monocle.ProductionNode productionNode;

                if (!telegraph.GetBuildingProduction(island.id, building.id, out productionNode))
                {
                    continue;
                }
            }

            List <monocle.ConsumptionNode> consumption = new List <monocle.ConsumptionNode>();

            if (!telegraph.GetIslandConsumption(island.id, out consumption))
            {
                return;
            }

            List <monocle.ShipData> ships = new List <monocle.ShipData>();

            if (!telegraph.GetAllShips(monocle.Area.OldWorld, out ships))
            {
                return;
            }

            ships = (from s in ships where s.shipType == monocle.ShipType.Clipper select s).ToList();

            monocle.ShipMoveData moveData;

            if (!telegraph.GetShipMoveData(ships.First().shipId, out moveData))
            {
                return;
            }

            monocle.Coordinate target = moveData.position;
            target.x = target.x + 100;

            List <ulong> ids = (from s in ships select s.shipId).ToList();

            if (!telegraph.AddWaypoint(ids, target))
            {
                return;
            }

            List <monocle.ShipCargoSlot> cargo = new List <monocle.ShipCargoSlot>();

            if (!telegraph.GetShipCargo(ids.First(), out cargo))
            {
                return;
            }

            if (!telegraph.ShipDumpCargo(ids.First(), 1))
            {
                return;
            }

            ulong address = 0;

            telegraph.GetShipComponentAddress(ids.First(), 253, out address);
        }