示例#1
0
        public void SaveHealthbar(Bitmap bitmap)
        {
            var image = cropWindowService.CropHealthbar(bitmap);

            Directory.CreateDirectory($"{OutputDirectoryDated}/Player/PlayerHealth");

            image.Save($"{OutputDirectoryDated}/Player/PlayerHealth/H_FILLIN.png");
        }
示例#2
0
        public void Extract(Bitmap picture)
        {
            if (picture == null)
            {
                return;
            }

            var classPart     = imageService.CropPlayerClass(picture);
            var healthPart    = imageService.CropHealthbar(picture);
            var primaryPart   = imageService.CropPrimaryResource(picture, modelService.Player.Class);
            var secondaryPart = imageService.CropSecondaryResource(picture, modelService.Player.Class);

            var classChanged             = ExtractPlayerClass(classPart);
            var healthChanged            = ExtractHealth(healthPart);
            var primaryResourceChanged   = ExtractPrimaryResource(primaryPart);
            var secondaryResourceChanged = ExtractSecondaryResource(secondaryPart);

            var @event = new PlayerInformationChangedEvent();

            if (classChanged)
            {
                @event.ChangedProperties.Add(nameof(Player.Class));
            }
            if (healthChanged)
            {
                @event.ChangedProperties.Add(nameof(Player.HealthPercentage));
            }
            if (primaryResourceChanged)
            {
                @event.ChangedProperties.Add(nameof(Player.PrimaryResourcePercentage));
            }
            if (secondaryResourceChanged)
            {
                @event.ChangedProperties.Add(nameof(Player.SecondaryRessourcePercentage));
            }

            if (@event.ChangedProperties.Any())
            {
                Publish(@event);
            }

            logService.AddEntry(this, $"Extracted Playerinformation: [Class:{modelService.Player.Class}, HP: {modelService.Player.HealthPercentage}, PrimaryResource: {modelService.Player.PrimaryResourcePercentage}].", LogLevel.Debug);
        }