diff options
author | peterbell10 <peterbell10@live.co.uk> | 2020-10-05 12:27:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 12:27:14 +0200 |
commit | a9031b6bae742b333b1b390192fa590f2ecb07ea (patch) | |
tree | b2802c81d24d339c201a0747d66ba44e9ea8b1b0 /src/WorldStorage/NamespaceSerializer.cpp | |
parent | Fixed current end generator (#4968) (diff) | |
download | cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.gz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.bz2 cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.lz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.xz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.zst cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.zip |
Diffstat (limited to 'src/WorldStorage/NamespaceSerializer.cpp')
-rw-r--r-- | src/WorldStorage/NamespaceSerializer.cpp | 232 |
1 files changed, 118 insertions, 114 deletions
diff --git a/src/WorldStorage/NamespaceSerializer.cpp b/src/WorldStorage/NamespaceSerializer.cpp index e717e7b3e..41023caea 100644 --- a/src/WorldStorage/NamespaceSerializer.cpp +++ b/src/WorldStorage/NamespaceSerializer.cpp @@ -131,125 +131,129 @@ namespace NamespaceSerializer UNREACHABLE("Tried to save unhandled statistic"); } - static const std::unordered_map<std::string_view, Statistic> CustomStatistics - { - { "animals_bred", Statistic::AnimalsBred }, - { "aviate_one_cm", Statistic::AviateOneCm }, - { "bell_ring", Statistic::BellRing }, - { "boat_one_cm", Statistic::BoatOneCm }, - { "clean_armor", Statistic::CleanArmor }, - { "clean_banner", Statistic::CleanBanner }, - { "clean_shulker_box", Statistic::CleanShulkerBox }, - { "climb_one_cm", Statistic::ClimbOneCm }, - { "crouch_one_cm", Statistic::CrouchOneCm }, - { "damage_absorbed", Statistic::DamageAbsorbed }, - { "damage_blocked_by_shield", Statistic::DamageBlockedByShield }, - { "damage_dealt", Statistic::DamageDealt }, - { "damage_dealt_absorbed", Statistic::DamageDealtAbsorbed }, - { "damage_dealt_resisted", Statistic::DamageDealtResisted }, - { "damage_resisted", Statistic::DamageResisted }, - { "damage_taken", Statistic::DamageTaken }, - { "deaths", Statistic::Deaths }, - { "drop", Statistic::Drop }, - { "eat_cake_slice", Statistic::EatCakeSlice }, - { "enchant_item", Statistic::EnchantItem }, - { "fall_one_cm", Statistic::FallOneCm }, - { "fill_cauldron", Statistic::FillCauldron }, - { "fish_caught", Statistic::FishCaught }, - { "fly_one_cm", Statistic::FlyOneCm }, - { "horse_one_cm", Statistic::HorseOneCm }, - { "inspect_dispenser", Statistic::InspectDispenser }, - { "inspect_dropper", Statistic::InspectDropper }, - { "inspect_hopper", Statistic::InspectHopper }, - { "interact_with_anvil", Statistic::InteractWithAnvil }, - { "interact_with_beacon", Statistic::InteractWithBeacon }, - { "interact_with_blast_furnace", Statistic::InteractWithBlastFurnace }, - { "interact_with_brewingstand", Statistic::InteractWithBrewingstand }, - { "interact_with_campfire", Statistic::InteractWithCampfire }, - { "interact_with_cartography_table", Statistic::InteractWithCartographyTable }, - { "interact_with_crafting_table", Statistic::InteractWithCraftingTable }, - { "interact_with_furnace", Statistic::InteractWithFurnace }, - { "interact_with_grindstone", Statistic::InteractWithGrindstone }, - { "interact_with_lectern", Statistic::InteractWithLectern }, - { "interact_with_loom", Statistic::InteractWithLoom }, - { "interact_with_smithing_table", Statistic::InteractWithSmithingTable }, - { "interact_with_smoker", Statistic::InteractWithSmoker }, - { "interact_with_stonecutter", Statistic::InteractWithStonecutter }, - { "jump", Statistic::Jump }, - { "leave_game", Statistic::LeaveGame }, - { "minecart_one_cm", Statistic::MinecartOneCm }, - { "mob_kills", Statistic::MobKills }, - { "open_barrel", Statistic::OpenBarrel }, - { "open_chest", Statistic::OpenChest }, - { "open_enderchest", Statistic::OpenEnderchest }, - { "open_shulker_box", Statistic::OpenShulkerBox }, - { "pig_one_cm", Statistic::PigOneCm }, - { "play_noteblock", Statistic::PlayNoteblock }, - { "play_one_minute", Statistic::PlayOneMinute }, - { "play_record", Statistic::PlayRecord }, - { "player_kills", Statistic::PlayerKills }, - { "pot_flower", Statistic::PotFlower }, - { "raid_trigger", Statistic::RaidTrigger }, - { "raid_win", Statistic::RaidWin }, - { "sleep_in_bed", Statistic::SleepInBed }, - { "sneak_time", Statistic::SneakTime }, - { "sprint_one_cm", Statistic::SprintOneCm }, - { "strider_one_cm", Statistic::StriderOneCm }, - { "swim_one_cm", Statistic::SwimOneCm }, - { "talked_to_villager", Statistic::TalkedToVillager }, - { "target_hit", Statistic::TargetHit }, - { "time_since_death", Statistic::TimeSinceDeath }, - { "time_since_rest", Statistic::TimeSinceRest }, - { "traded_with_villager", Statistic::TradedWithVillager }, - { "trigger_trapped_chest", Statistic::TriggerTrappedChest }, - { "tune_noteblock", Statistic::TuneNoteblock }, - { "use_cauldron", Statistic::UseCauldron }, - { "walk_on_water_one_cm", Statistic::WalkOnWaterOneCm }, - { "walk_one_cm", Statistic::WalkOneCm }, - { "walk_under_water_one_cm", Statistic::WalkUnderWaterOneCm }, - // Old ones just for compatibility - { "junk_fished", Statistic::JunkFished }, - { "treasure_fished", Statistic::TreasureFished }, - // The old advancements - { "cuberite:achievement.openInventory", Statistic::AchOpenInventory }, - { "cuberite:achievement.mineWood", Statistic::AchMineWood }, - { "cuberite:achievement.buildWorkBench", Statistic::AchBuildWorkBench }, - { "cuberite:achievement.buildPickaxe", Statistic::AchBuildPickaxe }, - { "cuberite:achievement.buildFurnace", Statistic::AchBuildFurnace }, - { "cuberite:achievement.acquireIron", Statistic::AchAcquireIron }, - { "cuberite:achievement.buildHoe", Statistic::AchBuildHoe }, - { "cuberite:achievement.makeBread", Statistic::AchMakeBread }, - { "cuberite:achievement.bakeCake", Statistic::AchBakeCake }, - { "cuberite:achievement.buildBetterPickaxe", Statistic::AchBuildBetterPickaxe }, - { "cuberite:achievement.cookFish", Statistic::AchCookFish }, - { "cuberite:achievement.onARail", Statistic::AchOnARail }, - { "cuberite:achievement.buildSword", Statistic::AchBuildSword }, - { "cuberite:achievement.killEnemy", Statistic::AchKillEnemy }, - { "cuberite:achievement.killCow", Statistic::AchKillCow }, - { "cuberite:achievement.flyPig", Statistic::AchFlyPig }, - { "cuberite:achievement.snipeSkeleton", Statistic::AchSnipeSkeleton }, - { "cuberite:achievement.diamonds", Statistic::AchDiamonds }, - { "cuberite:achievement.portal", Statistic::AchPortal }, - { "cuberite:achievement.ghast", Statistic::AchGhast }, - { "cuberite:achievement.blazeRod", Statistic::AchBlazeRod }, - { "cuberite:achievement.potion", Statistic::AchPotion }, - { "cuberite:achievement.theEnd", Statistic::AchTheEnd }, - { "cuberite:achievement.theEnd2", Statistic::AchTheEnd2 }, - { "cuberite:achievement.enchantments", Statistic::AchEnchantments }, - { "cuberite:achievement.overkill", Statistic::AchOverkill }, - { "cuberite:achievement.bookcase", Statistic::AchBookcase }, - { "cuberite:achievement.exploreAllBiomes", Statistic::AchExploreAllBiomes }, - { "cuberite:achievement.spawnWither", Statistic::AchSpawnWither }, - { "cuberite:achievement.killWither", Statistic::AchKillWither }, - { "cuberite:achievement.fullBeacon", Statistic::AchFullBeacon }, - { "cuberite:achievement.breedCow", Statistic::AchBreedCow }, - { "cuberite:achievement.diamondsToYou", Statistic::AchDiamondsToYou} - }; + Statistic ToCustomStatistic(const std::string_view ID) { + static const std::unordered_map<std::string_view, Statistic> CustomStatistics + { + { "animals_bred", Statistic::AnimalsBred }, + { "aviate_one_cm", Statistic::AviateOneCm }, + { "bell_ring", Statistic::BellRing }, + { "boat_one_cm", Statistic::BoatOneCm }, + { "clean_armor", Statistic::CleanArmor }, + { "clean_banner", Statistic::CleanBanner }, + { "clean_shulker_box", Statistic::CleanShulkerBox }, + { "climb_one_cm", Statistic::ClimbOneCm }, + { "crouch_one_cm", Statistic::CrouchOneCm }, + { "damage_absorbed", Statistic::DamageAbsorbed }, + { "damage_blocked_by_shield", Statistic::DamageBlockedByShield }, + { "damage_dealt", Statistic::DamageDealt }, + { "damage_dealt_absorbed", Statistic::DamageDealtAbsorbed }, + { "damage_dealt_resisted", Statistic::DamageDealtResisted }, + { "damage_resisted", Statistic::DamageResisted }, + { "damage_taken", Statistic::DamageTaken }, + { "deaths", Statistic::Deaths }, + { "drop", Statistic::Drop }, + { "eat_cake_slice", Statistic::EatCakeSlice }, + { "enchant_item", Statistic::EnchantItem }, + { "fall_one_cm", Statistic::FallOneCm }, + { "fill_cauldron", Statistic::FillCauldron }, + { "fish_caught", Statistic::FishCaught }, + { "fly_one_cm", Statistic::FlyOneCm }, + { "horse_one_cm", Statistic::HorseOneCm }, + { "inspect_dispenser", Statistic::InspectDispenser }, + { "inspect_dropper", Statistic::InspectDropper }, + { "inspect_hopper", Statistic::InspectHopper }, + { "interact_with_anvil", Statistic::InteractWithAnvil }, + { "interact_with_beacon", Statistic::InteractWithBeacon }, + { "interact_with_blast_furnace", Statistic::InteractWithBlastFurnace }, + { "interact_with_brewingstand", Statistic::InteractWithBrewingstand }, + { "interact_with_campfire", Statistic::InteractWithCampfire }, + { "interact_with_cartography_table", Statistic::InteractWithCartographyTable }, + { "interact_with_crafting_table", Statistic::InteractWithCraftingTable }, + { "interact_with_furnace", Statistic::InteractWithFurnace }, + { "interact_with_grindstone", Statistic::InteractWithGrindstone }, + { "interact_with_lectern", Statistic::InteractWithLectern }, + { "interact_with_loom", Statistic::InteractWithLoom }, + { "interact_with_smithing_table", Statistic::InteractWithSmithingTable }, + { "interact_with_smoker", Statistic::InteractWithSmoker }, + { "interact_with_stonecutter", Statistic::InteractWithStonecutter }, + { "jump", Statistic::Jump }, + { "leave_game", Statistic::LeaveGame }, + { "minecart_one_cm", Statistic::MinecartOneCm }, + { "mob_kills", Statistic::MobKills }, + { "open_barrel", Statistic::OpenBarrel }, + { "open_chest", Statistic::OpenChest }, + { "open_enderchest", Statistic::OpenEnderchest }, + { "open_shulker_box", Statistic::OpenShulkerBox }, + { "pig_one_cm", Statistic::PigOneCm }, + { "play_noteblock", Statistic::PlayNoteblock }, + { "play_one_minute", Statistic::PlayOneMinute }, + { "play_record", Statistic::PlayRecord }, + { "player_kills", Statistic::PlayerKills }, + { "pot_flower", Statistic::PotFlower }, + { "raid_trigger", Statistic::RaidTrigger }, + { "raid_win", Statistic::RaidWin }, + { "sleep_in_bed", Statistic::SleepInBed }, + { "sneak_time", Statistic::SneakTime }, + { "sprint_one_cm", Statistic::SprintOneCm }, + { "strider_one_cm", Statistic::StriderOneCm }, + { "swim_one_cm", Statistic::SwimOneCm }, + { "talked_to_villager", Statistic::TalkedToVillager }, + { "target_hit", Statistic::TargetHit }, + { "time_since_death", Statistic::TimeSinceDeath }, + { "time_since_rest", Statistic::TimeSinceRest }, + { "traded_with_villager", Statistic::TradedWithVillager }, + { "trigger_trapped_chest", Statistic::TriggerTrappedChest }, + { "tune_noteblock", Statistic::TuneNoteblock }, + { "use_cauldron", Statistic::UseCauldron }, + { "walk_on_water_one_cm", Statistic::WalkOnWaterOneCm }, + { "walk_one_cm", Statistic::WalkOneCm }, + { "walk_under_water_one_cm", Statistic::WalkUnderWaterOneCm }, + + // Old ones just for compatibility + { "junk_fished", Statistic::JunkFished }, + { "treasure_fished", Statistic::TreasureFished }, + + // The old advancements + { "cuberite:achievement.openInventory", Statistic::AchOpenInventory }, + { "cuberite:achievement.mineWood", Statistic::AchMineWood }, + { "cuberite:achievement.buildWorkBench", Statistic::AchBuildWorkBench }, + { "cuberite:achievement.buildPickaxe", Statistic::AchBuildPickaxe }, + { "cuberite:achievement.buildFurnace", Statistic::AchBuildFurnace }, + { "cuberite:achievement.acquireIron", Statistic::AchAcquireIron }, + { "cuberite:achievement.buildHoe", Statistic::AchBuildHoe }, + { "cuberite:achievement.makeBread", Statistic::AchMakeBread }, + { "cuberite:achievement.bakeCake", Statistic::AchBakeCake }, + { "cuberite:achievement.buildBetterPickaxe", Statistic::AchBuildBetterPickaxe }, + { "cuberite:achievement.cookFish", Statistic::AchCookFish }, + { "cuberite:achievement.onARail", Statistic::AchOnARail }, + { "cuberite:achievement.buildSword", Statistic::AchBuildSword }, + { "cuberite:achievement.killEnemy", Statistic::AchKillEnemy }, + { "cuberite:achievement.killCow", Statistic::AchKillCow }, + { "cuberite:achievement.flyPig", Statistic::AchFlyPig }, + { "cuberite:achievement.snipeSkeleton", Statistic::AchSnipeSkeleton }, + { "cuberite:achievement.diamonds", Statistic::AchDiamonds }, + { "cuberite:achievement.portal", Statistic::AchPortal }, + { "cuberite:achievement.ghast", Statistic::AchGhast }, + { "cuberite:achievement.blazeRod", Statistic::AchBlazeRod }, + { "cuberite:achievement.potion", Statistic::AchPotion }, + { "cuberite:achievement.theEnd", Statistic::AchTheEnd }, + { "cuberite:achievement.theEnd2", Statistic::AchTheEnd2 }, + { "cuberite:achievement.enchantments", Statistic::AchEnchantments }, + { "cuberite:achievement.overkill", Statistic::AchOverkill }, + { "cuberite:achievement.bookcase", Statistic::AchBookcase }, + { "cuberite:achievement.exploreAllBiomes", Statistic::AchExploreAllBiomes }, + { "cuberite:achievement.spawnWither", Statistic::AchSpawnWither }, + { "cuberite:achievement.killWither", Statistic::AchKillWither }, + { "cuberite:achievement.fullBeacon", Statistic::AchFullBeacon }, + { "cuberite:achievement.breedCow", Statistic::AchBreedCow }, + { "cuberite:achievement.diamondsToYou", Statistic::AchDiamondsToYou} + }; + return CustomStatistics.at(ID); } |