From c2f8ceb554982a33bcd4a1e168f6c4e26d0b85dd Mon Sep 17 00:00:00 2001 From: 12xx12 <44411062+12xx12@users.noreply.github.com> Date: Sat, 5 Sep 2020 17:13:44 +0200 Subject: Add more statistic tracking (#4837) + Added possible 1.8 stats + Added stat tracking for 1.8.2 + Added stat tracking for 1.9 + Added the breed cow achievement Co-authored-by: 12xx12 <12xx12100@gmail.com> --- src/Mobs/PassiveMonster.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/Mobs/PassiveMonster.cpp') diff --git a/src/Mobs/PassiveMonster.cpp b/src/Mobs/PassiveMonster.cpp index f9d5e4ba4..1a8aaa3bf 100644 --- a/src/Mobs/PassiveMonster.cpp +++ b/src/Mobs/PassiveMonster.cpp @@ -57,6 +57,7 @@ void cPassiveMonster::ResetLoveMode() m_LoveTimer = 0; m_MatingTimer = 0; m_LoveCooldown = 20 * 60 * 5; // 5 minutes + m_Feeder = cUUID(); // when an animal is in love mode, the client only stops sending the hearts if we let them know it's in cooldown, which is done with the "age" metadata m_World->BroadcastEntityMetadata(*this); @@ -125,6 +126,15 @@ void cPassiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) m_World->SpawnExperienceOrb(Pos.x, Pos.y, Pos.z, GetRandomProvider().RandInt(1, 6)); + m_World->DoWithPlayerByUUID(m_Feeder, [&] (cPlayer & a_Player) + { + a_Player.GetStatManager().AddValue(Statistic::AnimalsBred); + if (GetMobType() == eMonsterType::mtCow) + { + a_Player.AwardAchievement(Statistic::AchBreedCow); + } + return true; + }); m_LovePartner->ResetLoveMode(); ResetLoveMode(); } @@ -241,6 +251,8 @@ void cPassiveMonster::OnRightClicked(cPlayer & a_Player) } } } + // Stores feeder UUID for statistic tracking + m_Feeder = a_Player.GetUUID(); } -- cgit v1.2.3