Exemplo n.º 1
0
        public IEnumerable <ArtifactScanResult> Scan(Player player, int scanRange, double scanAccuracy)
        {
            _artifactGenerator.GenerateArtifacts();

            var scanPosition         = player.CurrentPosition;
            var artifactsInScanRange = _artifactRepository.GetArtifacts();

            var scanResults = new List <ArtifactScanResult>();

            foreach (var artifact in artifactsInScanRange)
            {
                var dist = scanPosition.TotalDistance2D(artifact.Position);
                if (dist > scanRange)
                {
                    continue;
                }

                var scanResult = new ArtifactScanResult {
                    scannedArtifact = artifact
                };

                if (dist < 3.0)
                {
                    player.SendArtifactRadarBeam(artifact.Position);

                    scanResult.estimatedPosition = artifact.Position;
                    scanResult.radius            = 0.0;

                    _artifactRepository.DeleteArtifact(artifact);

                    CreateLoots(player, artifact);
                    SpawnNpcs(player, artifact);

                    var ep = _zone.Configuration.IsBeta ? 10 : 5;
                    if (_zone.Configuration.Type == ZoneType.Training)
                    {
                        ep = 0;
                    }
                    if (ep > 0)
                    {
                        player.Character.AddExtensionPointsBoostAndLog(EpForActivityType.Artifact, ep);
                    }

                    player.MissionHandler.EnqueueMissionEventInfo(new FindArtifactEventInfo(player, artifact.Info.type, artifact.Position));
                }
                else
                {
                    var radius = Math.Pow(dist, 1.5) / (scanAccuracy * 60);
                    var p      = artifact.Position.GetRandomPositionInRange2D(-radius, radius);
                    scanResult.radius            = p.TotalDistance2D(artifact.Position);
                    scanResult.estimatedPosition = p;
                }

                scanResults.Add(scanResult);
            }

            return(scanResults);
        }
Exemplo n.º 2
0
        public async Task <bool> DeleteArtifact(int id)
        {
            var artifact = await _artifactRepo.GetArtifact(id).ConfigureAwait(false);

            if (artifact != null)
            {
                await _artifactRepo.DeleteArtifact(id).ConfigureAwait(false);

                return(true);
            }
            return(false);
        }