From b691c43c44ff180d10e7d4a9afc83b98551ff586 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 1 Mar 2026 12:16:08 +0800 Subject: Initial commit --- Minecraft.World/Stat.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Minecraft.World/Stat.h (limited to 'Minecraft.World/Stat.h') diff --git a/Minecraft.World/Stat.h b/Minecraft.World/Stat.h new file mode 100644 index 00000000..3c2ab071 --- /dev/null +++ b/Minecraft.World/Stat.h @@ -0,0 +1,61 @@ +#pragma once +using namespace std; + +#include "StatFormatter.h" +#include "GenericStats.h" + +class DecimalFormat; + +class Stat +{ +public: + const int id; + const wstring name; + bool awardLocallyOnly; + +private: + const StatFormatter *formatter; + void _init(); + +public: + Stat(int id, const wstring& name, StatFormatter *formatter); + Stat(int id, const wstring& name); + Stat *setAwardLocallyOnly(); + + virtual Stat *postConstruct(); + virtual bool isAchievement(); + wstring format(int value); + +private: + //static NumberFormat *numberFormat; + +public: + class DefaultFormat : public StatFormatter + { + public: + wstring format(int value); + } static *defaultFormatter; + +private: + static DecimalFormat *decimalFormat; + +public: + + class TimeFormatter : public StatFormatter + { + public: + wstring format(int value); + } static *timeFormatter; + + class DistanceFormatter : public StatFormatter + { + public: + wstring format(int cm); + } static *distanceFormatter; + + wstring toString(); + +public: + // 4J-JEV, for Durango stats + virtual void handleParamBlob(shared_ptr plr, byteArray param) { app.DebugPrintf("'Stat.h', Unhandled AwardStat blob.\n"); return; } +}; -- cgit v1.2.3