mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-26 18:45:29 +00:00
refactor: flatten app/ and util/ directory structure
This commit is contained in:
29
targets/app/common/Tutorial/Tasks/StatTask.cpp
Normal file
29
targets/app/common/Tutorial/Tasks/StatTask.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "StatTask.h"
|
||||
|
||||
#include "platform/sdl2/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[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;
|
||||
}
|
||||
Reference in New Issue
Block a user