4jcraft/Minecraft.Client/Platform/Common/Tutorial/StatTask.cpp
MatthewBeshay dfb0e3b03e refactor: replace NULL with nullptr across C++ codebase
Excludes vendored C libs (zlib, Miles, DirectXMath, boost, Iggy).
2026-03-30 16:25:52 +11:00

27 lines
987 B
C++

#include "../../Minecraft.World/Platform/stdafx.h"
#include "../../Minecraft.Client/Minecraft.h"
#include "../../Minecraft.Client/Player/LocalPlayer.h"
#include "../../Minecraft.Client/GameState/StatsCounter.h"
#include "../../Minecraft.World/Headers/net.minecraft.stats.h"
#include "StatTask.h"
StatTask::StatTask(Tutorial* tutorial, int descriptionId,
bool enablePreCompletion, Stat* stat, int variance /*= 1*/)
: TutorialTask(tutorial, descriptionId, enablePreCompletion, nullptr) {
this->stat = stat;
Minecraft* minecraft = Minecraft::GetInstance();
targetValue =
minecraft->stats[ProfileManager.GetPrimaryPad()]->getTotalValue(stat) +
variance;
}
bool StatTask::isCompleted() {
if (bIsCompleted) return true;
Minecraft* minecraft = Minecraft::GetInstance();
bIsCompleted =
minecraft->stats[ProfileManager.GetPrimaryPad()]->getTotalValue(stat) >=
(unsigned int)targetValue;
return bIsCompleted;
}