<commit_before>package BN::Mission;
use strict;
use warnings;

my $missions;
my $json_file = 'Missions.json';

sub all {
   my ($class) = @_;
   $missions ||= BN::File->json($json_file);
   return map { $class->get($_) } sort keys %$missions;
}

my %name = (
   p02_SWLG_010_HiddenEncounter1    => 'Mystery Troops 1',
   p02_SWLG_020_HiddenEncounter2    => 'Mystery Troops 2',
   p02_SWLG_030_HiddenEncounter3    => 'Mystery Troops 3',
   p03_PLASMA_020_RebelFight        => 'Defense is the Best (Insert Cliche Here)',
);

sub get {
   my ($class, $key) = @_;
   return unless $key;
   $missions ||= BN::File->json($json_file);
   my $mis = $missions->{$key} or return;
   if (ref($mis) eq 'HASH') {
      bless $mis, $class;
      $mis->{_tag} = $key;
      my $name = $name{$key} || BN::Text->get($mis->{title}) || $key;
      $name .= ' (Hidden)' if $mis->{hideIcon} && $name !~ /hidden/i;
      $name =~ s/\x{2026}/.../g;
      $mis->{_name} = $name;
   }
   return $mis;
}

sub get_by_name {
   my ($class, $key) = @_;
   return unless defined $key;
   foreach my $mis ($class->all()) {
      return $mis if $mis->{_name} eq $key;
   }
   return;
}

BN->simple_accessor('name');
BN->simple_accessor('tag');
BN->simple_accessor('hidden', 'hideIcon');

sub wikilink {
   my ($mis, $text) = @_;
   my $page;
   if (my $level = $mis->level()) {
      my $lo = int(($level - 1) / 5) * 5 + 1;
      my $hi = $lo + 4;
      my $max = BN::Level->max();
      $hi = $max if $hi > $max && $lo < $max;
      $page = "Level $lo-$hi missions";
   }
   else {
      $page = 'Missions';
   }
   $text //= $mis->{_name};
   my $link = "[[$page#$mis->{_name}";
   $link .= '|' . $text if length($text);
   $link .= ']]';
   return $link;
}

my %old_missions;
$old_missions{$_} = 1 foreach qw(
   p01_BK2RR_010_RaidersBattle2
   p01_BK2RR_020_BuildPillbox
   p01_BK2RR_030_TrainGrenadier
   p01_BK2RR_040_ReturnRecoilRidge
   p01_BK2RR_050_BattleRecoilRidge
   p01_BK2RR_060_HelpAdventurer
   p01_BUILD_020_BuildSupplyDepot
   p01_BUILD_040_CollectSupplyDrops
   p01_BUILD_050_BuildShelter
   p01_BUILD_060_RaiderAttack1
   p01_BUILD_070_BuildBootCamp
   p01_BUILD_090_BuildShelter
   p01_BUILD_100_TeachCamera
   p01_BUILD_110_RaiderEncounters
   p01_BUILD_130_BuildStoneQuarry
   p01_BUILD_140_BuildResourceDepot
   p01_BUILD_150_CollectTaxes
   p01_BUILD_280_BuildBunker2
   p01_BUILD_290_BuildBunker2
   p01_BUILD_510_BuildHospital
   p01_FARMS_010_BuildFarm1
   p01_HOSP_010_QueueSomething
   p01_INTRO_020_OpeningBattle
   p01_INTRO_040_BuildShelter
   p01_INTRO_050_PlantArtichoke
   p01_INTRO_060_CollectCrop
   p01_INTRO_070_CollectTax
   p01_NEWINTRO_010_Cinematic
   p01_NEWINTRO_030_Fight
   p01_NEWINTRO_040_BuildBarracks
   p01_NEWINTRO_045_CutBarracksRibbon
   p01_NEWINTRO_050_TrainTrooper
   p01_NEWINTRO_055_MissionsAdvice
   p01_NEWINTRO_060_BuildPillbox
   p01_NEWINTRO_070_PillboxFight
   p01_NEWINTRO_080_GantasFight
   p01_NEWINTRO_120_BuildStoneQuarry
   p01_NEWINTRO_130_BuildDepot
   p01_NEWINTRO_140_BuildHospital
   p01_NEWINTRO_142_StartHospital
   p01_NEWINTRO_143_StartAdvHospital
   p01_RTANK_010_RaiderScouts
   p01_RTANK_060_BuildToolShop
   p01_RTANK_070_MakeTools
   p01_UNIT_020_TeachGrenadier
   p01_UNIT_030_TeachMortar
   p01_UPBLD_010_BuildingUpgradeLvl1
   p01_UPBLD_010_BuildingUpgradeLvl1_LateGame
   p01_UPBLD_020_BuildingUpgradeLvl2
   p01_UPBLD_020_BuildingUpgradeLvl2_LateGame
   p01_VALENTINE_001_WaitingTag
   p01_ZOEY1_010_BuildHovel
);

sub old {<commit_msg>strike that<commit_after>package BN::Mission;
use strict;
use warnings;

my $missions;
my $json_file = 'Missions.json';

sub all {
   my ($class) = @_;
   $missions ||= BN::File->json($json_file);
   return map { $class->get($_) } sort keys %$missions;
}

my %name = (
   p02_SWLG_010_HiddenEncounter1    => 'Mystery Troops 1',
   p02_SWLG_020_HiddenEncounter2    => 'Mystery Troops 2',
   p02_SWLG_030_HiddenEncounter3    => 'Mystery Troops 3',
   p03_PLASMA_020_RebelFight        => 'Defense is the Best (Insert Cliche Here)',
);

sub get {
   my ($class, $key) = @_;
   return unless $key;
   $missions ||= BN::File->json($json_file);
   my $mis = $missions->{$key} or return;
   if (ref($mis) eq 'HASH') {
      bless $mis, $class;
      $mis->{_tag} = $key;
      my $name = $name{$key} || BN::Text->get($mis->{title}) || $key;
      $name .= ' (Hidden)' if $mis->{hideIcon} && $name !~ /hidden/i;
      $name =~ s/\x{2026}/.../g;
      $mis->{_name} = $name;
   }
   return $mis;
}

sub get_by_name {
   my ($class, $key) = @_;
   return unless defined $key;
   foreach my $mis ($class->all()) {
      return $mis if $mis->{_name} eq $key;
   }
   return;
}

BN->simple_accessor('name');
BN->simple_accessor('tag');
BN->simple_accessor('hidden', 'hideIcon');

sub wikilink {
   my ($mis, $text) = @_;
   my $page;
   if (my $level = $mis->level()) {
      my $lo = int(($level - 1) / 5) * 5 + 1;
      my $hi = $lo + 4;
      my $max = BN::Level->max();
      $hi = $max if $hi > $max && $lo < $max;
      $page = "Level $lo-$hi missions";
   }
   else {
      $page = 'Missions';
   }
   $text //= $mis->{_name};
   my $link = "[[$page#$mis->{_name}";
   $link .= '|' . $text if length($text);
   $link .= ']]';
   return $link;
}

my %old_missions;
$old_missions{$_} = 1 foreach qw(
   p01_BK2RR_010_RaidersBattle2
   p01_BK2RR_020_BuildPillbox
   p01_BK2RR_030_TrainGrenadier
   p01_BK2RR_040_ReturnRecoilRidge
   p01_BK2RR_050_BattleRecoilRidge
   p01_BK2RR_060_HelpAdventurer
   p01_BUILD_020_BuildSupplyDepot
   p01_BUILD_040_CollectSupplyDrops
   p01_BUILD_050_BuildShelter
   p01_BUILD_060_RaiderAttack1
   p01_BUILD_070_BuildBootCamp
   p01_BUILD_090_BuildShelter
   p01_BUILD_100_TeachCamera
   p01_BUILD_110_RaiderEncounters
   p01_BUILD_130_BuildStoneQuarry
   p01_BUILD_140_BuildResourceDepot
   p01_BUILD_150_CollectTaxes
   p01_BUILD_280_BuildBunker2
   p01_BUILD_290_BuildBunker2
   p01_BUILD_510_BuildHospital
   p01_FARMS_010_BuildFarm1
   p01_HOSP_010_QueueSomething
   p01_INTRO_020_OpeningBattle
   p01_INTRO_040_BuildShelter
   p01_INTRO_050_PlantArtichoke
   p01_INTRO_060_CollectCrop
   p01_INTRO_070_CollectTax
   p01_NEWINTRO_010_Cinematic
   p01_NEWINTRO_030_Fight
   p01_NEWINTRO_040_BuildBarracks
   p01_NEWINTRO_045_CutBarracksRibbon
   p01_NEWINTRO_050_TrainTrooper
   p01_NEWINTRO_055_MissionsAdvice
   p01_NEWINTRO_060_BuildPillbox
   p01_NEWINTRO_070_PillboxFight
   p01_NEWINTRO_080_GantasFight
   p01_NEWINTRO_120_BuildStoneQuarry
   p01_NEWINTRO_130_BuildDepot
   p01_NEWINTRO_140_BuildHospital
   p01_NEWINTRO_142_StartHospital
   p01_NEWINTRO_143_StartAdvHospital
   p01_RTANK_010_RaiderScouts
   p01_RTANK_060_BuildToolShop
   p01_RTANK_070_MakeTools
   p01_UPBLD_010_BuildingUpgradeLvl1
   p01_UPBLD_010_BuildingUpgradeLvl1_LateGame
   p01_UPBLD_020_BuildingUpgradeLvl2
   p01_UPBLD_020_BuildingUpgradeLvl2_LateGame
   p01_VALENTINE_001_WaitingTag
   p01_ZOEY1_010_BuildHovel
);

sub old {
{'fraction_non_alphanumeric': 0.11019760565411799, 'fraction_numerical': 0.0885619500937545, 'mean_word_length': 4.136296296296297, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2923838', 'n_tokens_mistral': 3370, 'n_tokens_neox': 2914, 'n_words': 441}