private Bitmap DrawWorstSpotsMap()
        {
            _addtoradius = 0; //init the mf
            var b = _zone.CreatePassableBitmap(_passableColor, _islandColor);

            var terminalSpots     = MissionSpot.GetTerminalSpotsFromZone(_zone);
            var spotInfos         = MissionSpot.GetMissionSpotsFromUnitsOnZone(_zone, true);
            var randomPointsInfos = MissionSpot.GetRandomPointSpotsFromTargets(_zone.Configuration, true);

            var allSpots = terminalSpots.Concat(spotInfos).Concat(randomPointsInfos).ToList();

            var spotStats = new List <MissionSpotStat>(allSpots.Count);

            foreach (var missionSpot in allSpots)
            {
                var stat = missionSpot.CountSelectableSpots(allSpots);
                spotStats.Add(stat);
            }

            WriteReportByType(MissionSpotType.randompoint, spotStats, b);
            WriteReportByType(MissionSpotType.mswitch, spotStats, b);
            WriteReportByType(MissionSpotType.kiosk, spotStats, b);
            WriteReportByType(MissionSpotType.itemsupply, spotStats, b);


            b.WithGraphics(g => g.DrawString("switch", new Font("Tahoma", 15), new SolidBrush(_switchColor), new PointF(20, 60)));
            b.WithGraphics(g => g.DrawString("item submit/kiosk", new Font("Tahoma", 15), new SolidBrush(_kioskColor), new PointF(20, 80)));
            b.WithGraphics(g => g.DrawString("item supply", new Font("Tahoma", 15), new SolidBrush(_itemSupplyColor), new PointF(20, 100)));
            b.WithGraphics(g => g.DrawString("random point", new Font("Tahoma", 15), new SolidBrush(_randomPointColor), new PointF(20, 120)));


            return(b);
        }
예제 #2
0
        private Bitmap DisplaySpots()
        {
            var staticObjects = MissionSpot.GetStaticObjectsFromZone(_zone);

            var spotInfos = MissionSpot.GetMissionSpotsFromUnitsOnZone(_zone);

            var randomPointsInfos = MissionSpot.GetRandomPointSpotsFromTargets(_zone.Configuration);

            spotInfos.AddRange(randomPointsInfos);

            return(DrawResultOnBitmap(spotInfos, staticObjects));
        }
        private Bitmap GenerateRandomPointsOnly(IRequest request)
        {
            //-------- kick brute force fill in
            const int randomPointTargetAmount = 2500;

            //----code

            var deletedSpots =
                Db.Query().CommandText("delete missionspotinfo where zoneid=@zoneId and type=@spotType")
                .SetParameter("@zoneId", _zone.Id)
                .SetParameter("@spotType", (int)MissionSpotType.randompoint)
                .ExecuteNonQuery();

            Logger.Info(deletedSpots + " random point spots were deleted from zone:" + _zone.Id);

            var staticObjects = MissionSpot.GetStaticObjectsFromZone(_zone);

            var spotInfos = MissionSpot.GetMissionSpotsFromUnitsOnZone(_zone);

            PlaceOneType(spotInfos, MissionSpotType.randompoint, randomPointTargetAmount, randomPointDistanceInfos, staticObjects, randomPointAccuracy);

            var resultBitmap = DrawResultOnBitmap(spotInfos, staticObjects);

            SendDrawFunctionFinished(request);

            var randomPoints = spotInfos.Where(i => i.type == MissionSpotType.randompoint).ToList();

            Logger.Info(randomPoints.Count + " new random points were generated.");

            //-------


            var deletedTargets =
                Db.Query().CommandText("delete missiontargets where targetpositionzone=@zoneId and targettype=@targetType")
                .SetParameter("@zoneId", _zone.Id)
                .SetParameter("@targetType", (int)MissionTargetType.rnd_point)
                .ExecuteNonQuery();

            Logger.Info(deletedTargets + " mission targets were deleted.");


            foreach (var missionSpot in randomPoints)
            {
                MissionHelper.PlaceRandomPoint(_zone, missionSpot.position, (int)DistanceConstants.MISSION_RANDOM_POINT_FINDRADIUS_DEFAULT);
            }

            Logger.Info("new mission targets inserted");

            return(resultBitmap);
        }