mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-24 13:13:37 +00:00
29 lines
905 B
C++
29 lines
905 B
C++
#include "StatTask.h"
|
|
|
|
#include "platform/profile/profile.h"
|
|
#include "app/common/Tutorial/Tasks/TutorialTask.h"
|
|
#include "minecraft/client/Minecraft.h"
|
|
#include "minecraft/stats/StatsCounter.h"
|
|
|
|
class Tutorial;
|
|
|
|
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[PlatformProfile.GetPrimaryPad()]->getTotalValue(stat) +
|
|
variance;
|
|
}
|
|
|
|
bool StatTask::isCompleted() {
|
|
if (bIsCompleted) return true;
|
|
|
|
Minecraft* minecraft = Minecraft::GetInstance();
|
|
bIsCompleted =
|
|
minecraft->stats[PlatformProfile.GetPrimaryPad()]->getTotalValue(stat) >=
|
|
(unsigned int)targetValue;
|
|
return bIsCompleted;
|
|
} |