From 8be1dd54bb17b3ba3e20960aa3c3f696d09facf7 Mon Sep 17 00:00:00 2001 From: nshah25 <68348722+nshah25@users.noreply.github.com> Date: Mon, 3 May 2021 16:07:09 -0400 Subject: Add player statistics to API (#5193) * Fixed issue #5166 Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com> Co-authored-by: Tiger Wang --- src/Blocks/BlockBed.cpp | 2 +- src/Blocks/BlockCake.h | 2 +- src/Blocks/BlockCauldron.h | 4 ++-- src/Blocks/BlockWorkbench.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockBed.cpp b/src/Blocks/BlockBed.cpp index ef4359416..37c57b6b3 100644 --- a/src/Blocks/BlockBed.cpp +++ b/src/Blocks/BlockBed.cpp @@ -134,7 +134,7 @@ bool cBlockBedHandler::OnUse( // Occupy the bed, where 0x4 = occupied bit: a_ChunkInterface.SetBlockMeta(a_BlockPos, Meta | 0x04); - a_Player.GetStatManager().AddValue(Statistic::SleepInBed); + a_Player.GetStatistics().Custom[CustomStatistic::SleepInBed]++; // When sleeping, the player's bounding box moves to approximately where his head is. // Set the player's position to somewhere close to the edge of the pillow block: diff --git a/src/Blocks/BlockCake.h b/src/Blocks/BlockCake.h index ae8cd0228..4b238fa48 100644 --- a/src/Blocks/BlockCake.h +++ b/src/Blocks/BlockCake.h @@ -33,7 +33,7 @@ private: return false; } - a_Player.GetStatManager().AddValue(Statistic::EatCakeSlice); + a_Player.GetStatistics().Custom[CustomStatistic::EatCakeSlice]++; if (Meta >= 5) { a_ChunkInterface.DigBlock(a_WorldInterface, a_BlockPos, &a_Player); diff --git a/src/Blocks/BlockCauldron.h b/src/Blocks/BlockCauldron.h index 37e638d72..80f95164f 100644 --- a/src/Blocks/BlockCauldron.h +++ b/src/Blocks/BlockCauldron.h @@ -65,7 +65,7 @@ private: { a_Player.ReplaceOneEquippedItemTossRest(cItem(E_ITEM_BUCKET)); } - a_Player.GetStatManager().AddValue(Statistic::FillCauldron); + a_Player.GetStatistics().Custom[CustomStatistic::FillCauldron]++; } break; } @@ -79,7 +79,7 @@ private: { a_Player.ReplaceOneEquippedItemTossRest(cItem(E_ITEM_POTION)); } - a_Player.GetStatManager().AddValue(Statistic::UseCauldron); + a_Player.GetStatistics().Custom[CustomStatistic::UseCauldron]++; } break; } diff --git a/src/Blocks/BlockWorkbench.h b/src/Blocks/BlockWorkbench.h index e654a6b84..a0ec3df4a 100644 --- a/src/Blocks/BlockWorkbench.h +++ b/src/Blocks/BlockWorkbench.h @@ -29,7 +29,7 @@ private: const Vector3i a_CursorPos ) const override { - a_Player.GetStatManager().AddValue(Statistic::InteractWithCraftingTable); + a_Player.GetStatistics().Custom[CustomStatistic::InteractWithCraftingTable]++; cWindow * Window = new cCraftingWindow(); a_Player.OpenWindow(*Window); -- cgit v1.2.3