mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-09-25 03:40:48 +00:00
refactor: unglob std::wstring
This commit is contained in:
@@ -15,18 +15,18 @@ void Achievement::_init()
|
||||
if (y > Achievements::yMax) Achievements::yMax = y;
|
||||
}
|
||||
|
||||
Achievement::Achievement(int id, const wstring& name, int x, int y, Item *icon, Achievement *requires)
|
||||
: Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(wstring(L"achievement.").append(name)) ), desc( I18n::get(wstring(L"achievement.").append(name).append(L".desc"))), icon( new ItemInstance(icon) ), x(x), y(y), requires(requires)
|
||||
Achievement::Achievement(int id, const std::wstring& name, int x, int y, Item *icon, Achievement *requires)
|
||||
: Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::wstring(L"achievement.").append(name)) ), desc( I18n::get(std::wstring(L"achievement.").append(name).append(L".desc"))), icon( new ItemInstance(icon) ), x(x), y(y), requires(requires)
|
||||
{
|
||||
}
|
||||
|
||||
Achievement::Achievement(int id, const wstring& name, int x, int y, Tile *icon, Achievement *requires)
|
||||
: Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(wstring(L"achievement.").append(name)) ), desc( I18n::get(wstring(L"achievement.").append(name).append(L".desc"))), icon( new ItemInstance(icon) ), x(x), y(y), requires(requires)
|
||||
Achievement::Achievement(int id, const std::wstring& name, int x, int y, Tile *icon, Achievement *requires)
|
||||
: Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::wstring(L"achievement.").append(name)) ), desc( I18n::get(std::wstring(L"achievement.").append(name).append(L".desc"))), icon( new ItemInstance(icon) ), x(x), y(y), requires(requires)
|
||||
{
|
||||
}
|
||||
|
||||
Achievement::Achievement(int id, const wstring& name, int x, int y, std::shared_ptr<ItemInstance> icon, Achievement *requires)
|
||||
: Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(wstring(L"achievement.").append(name)) ), desc( I18n::get(wstring(L"achievement.").append(name).append(L".desc"))), icon(icon), x(x), y(y), requires(requires)
|
||||
Achievement::Achievement(int id, const std::wstring& name, int x, int y, std::shared_ptr<ItemInstance> icon, Achievement *requires)
|
||||
: Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::wstring(L"achievement.").append(name)) ), desc( I18n::get(std::wstring(L"achievement.").append(name).append(L".desc"))), icon(icon), x(x), y(y), requires(requires)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ bool Achievement::isAchievement()
|
||||
return true;
|
||||
}
|
||||
|
||||
wstring Achievement::getDescription()
|
||||
std::wstring Achievement::getDescription()
|
||||
{
|
||||
if (descFormatter != NULL)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
Achievement *requires;
|
||||
|
||||
private:
|
||||
const wstring desc;
|
||||
const std::wstring desc;
|
||||
DescFormatter *descFormatter;
|
||||
|
||||
public:
|
||||
@@ -23,15 +23,15 @@ private:
|
||||
void _init();
|
||||
|
||||
public:
|
||||
Achievement(int id, const wstring& name, int x, int y, Item *icon, Achievement *requires);
|
||||
Achievement(int id, const wstring& name, int x, int y, Tile *icon, Achievement *requires);
|
||||
Achievement(int id, const wstring& name, int x, int y, std::shared_ptr<ItemInstance> icon, Achievement *requires);
|
||||
Achievement(int id, const std::wstring& name, int x, int y, Item *icon, Achievement *requires);
|
||||
Achievement(int id, const std::wstring& name, int x, int y, Tile *icon, Achievement *requires);
|
||||
Achievement(int id, const std::wstring& name, int x, int y, std::shared_ptr<ItemInstance> icon, Achievement *requires);
|
||||
|
||||
Achievement *setAwardLocallyOnly();
|
||||
Achievement *setGolden();
|
||||
Achievement *postConstruct();
|
||||
bool isAchievement();
|
||||
wstring getDescription();
|
||||
std::wstring getDescription();
|
||||
Achievement *setDescFormatter(DescFormatter *descFormatter);
|
||||
bool isGolden();
|
||||
int getAchievementID();
|
||||
|
||||
@@ -35,7 +35,7 @@ string DsItemEvent::nameMethods[] = {
|
||||
"itemBought", "itemSmithed", "blockMined", "blockPlaced", "MAX"
|
||||
};
|
||||
|
||||
DsItemEvent::DsItemEvent(int id, const wstring &name) : Stat(id,name) {}
|
||||
DsItemEvent::DsItemEvent(int id, const std::wstring &name) : Stat(id,name) {}
|
||||
|
||||
bool DsItemEvent::onLeaderboard(ELeaderboardId leaderboard, eAcquisitionMethod methodId, Param *param)
|
||||
{
|
||||
@@ -203,7 +203,7 @@ byteArray DsItemEvent::createParamBlob(eAcquisitionMethod eMethod, int itemId, i
|
||||
// Ds Mob Killed //
|
||||
///////////////////
|
||||
|
||||
DsMobKilled::DsMobKilled(int id, const wstring &name) : Stat(id,name) {}
|
||||
DsMobKilled::DsMobKilled(int id, const std::wstring &name) : Stat(id,name) {}
|
||||
|
||||
void DsMobKilled::handleParamBlob(std::shared_ptr<LocalPlayer> player, byteArray paramBlob)
|
||||
{
|
||||
@@ -321,7 +321,7 @@ string DsMobInteract::nameInteract[] = {
|
||||
"unknownMobInteraction", "mobBred", "mobTamed", "mobCured", "mobCrafted", "mobSheared"
|
||||
};
|
||||
|
||||
DsMobInteract::DsMobInteract(int id, const wstring &name) : Stat(id,name) {}
|
||||
DsMobInteract::DsMobInteract(int id, const std::wstring &name) : Stat(id,name) {}
|
||||
|
||||
void DsMobInteract::handleParamBlob(std::shared_ptr<LocalPlayer> player, byteArray paramBlob)
|
||||
{
|
||||
@@ -373,7 +373,7 @@ unsigned int DsTravel::CACHE_SIZES[eMethod_MAX] =
|
||||
20*60*5, // TIME - GameTicks (20*60*5 ~ 5 mins)
|
||||
};
|
||||
|
||||
DsTravel::DsTravel(int id, const wstring &name) : Stat(id,name)
|
||||
DsTravel::DsTravel(int id, const std::wstring &name) : Stat(id,name)
|
||||
{
|
||||
ZeroMemory(¶m_cache, sizeof(unsigned int)*eMethod_MAX*MAX_LOCAL_PLAYERS);
|
||||
}
|
||||
@@ -475,7 +475,7 @@ void DsTravel::write(std::shared_ptr<LocalPlayer> player, eMethod method, int di
|
||||
// Ds Item Used //
|
||||
//////////////////
|
||||
|
||||
DsItemUsed::DsItemUsed(int id, const wstring &name) : Stat(id,name) {}
|
||||
DsItemUsed::DsItemUsed(int id, const std::wstring &name) : Stat(id,name) {}
|
||||
|
||||
void DsItemUsed::handleParamBlob(std::shared_ptr<LocalPlayer> player, byteArray paramBlob)
|
||||
{
|
||||
@@ -518,7 +518,7 @@ byteArray DsItemUsed::createParamBlob(int itemId, int aux, int count, int health
|
||||
// Ds Achievement //
|
||||
////////////////////
|
||||
|
||||
DsAchievement::DsAchievement(int id, const wstring &name) : Stat(id,name) {}
|
||||
DsAchievement::DsAchievement(int id, const std::wstring &name) : Stat(id,name) {}
|
||||
|
||||
void DsAchievement::handleParamBlob(std::shared_ptr<LocalPlayer> player, byteArray paramBlob)
|
||||
{
|
||||
@@ -614,7 +614,7 @@ byteArray DsAchievement::createLargeParamBlob(eAward award, int count)
|
||||
// Ds Changed Dimension //
|
||||
//////////////////////////
|
||||
|
||||
DsChangedDimension::DsChangedDimension(int id, const wstring &name) : Stat(id,name) {}
|
||||
DsChangedDimension::DsChangedDimension(int id, const std::wstring &name) : Stat(id,name) {}
|
||||
|
||||
void DsChangedDimension::handleParamBlob(std::shared_ptr<LocalPlayer> player, byteArray paramBlob)
|
||||
{
|
||||
@@ -642,7 +642,7 @@ byteArray DsChangedDimension::createParamBlob(int fromDimId, int toDimId)
|
||||
// Ds Entered Biome //
|
||||
//////////////////////
|
||||
|
||||
DsEnteredBiome::DsEnteredBiome(int id, const wstring &name) : Stat(id,name) {}
|
||||
DsEnteredBiome::DsEnteredBiome(int id, const std::wstring &name) : Stat(id,name) {}
|
||||
|
||||
void DsEnteredBiome::handleParamBlob(std::shared_ptr<LocalPlayer> player, byteArray paramBlob)
|
||||
{
|
||||
@@ -1121,7 +1121,7 @@ LPCWSTR DurangoStats::getUserId(std::shared_ptr<LocalPlayer> player)
|
||||
|
||||
LPCWSTR DurangoStats::getUserId(int iPad)
|
||||
{
|
||||
static wstring cache = L"";
|
||||
static std::wstring cache = L"";
|
||||
PlayerUID uid = INVALID_XUID;
|
||||
ProfileManager.GetXUID(iPad, &uid, true);
|
||||
cache = uid.toString();
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
int methodId, itemId, itemAux, itemCount;
|
||||
} Param;
|
||||
|
||||
DsItemEvent(int id, const wstring &name);
|
||||
DsItemEvent(int id, const std::wstring &name);
|
||||
|
||||
bool onLeaderboard(ELeaderboardId leaderboard, eAcquisitionMethod methodId, Param *param);
|
||||
int mergeIds(int itemId);
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
|
||||
static const int SPIDER_JOCKEY_ID = 49;
|
||||
|
||||
DsMobKilled(int id, const wstring &name);
|
||||
DsMobKilled(int id, const std::wstring &name);
|
||||
|
||||
typedef struct { bool isRanged; int mobType, weaponId, distance, damage; } Param;
|
||||
virtual void handleParamBlob(std::shared_ptr<LocalPlayer> plr, byteArray param);
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
eInteract_Sheared
|
||||
};
|
||||
|
||||
DsMobInteract(int id, const wstring &name);
|
||||
DsMobInteract(int id, const std::wstring &name);
|
||||
|
||||
typedef struct { int interactionType, mobId; } Param;
|
||||
virtual void handleParamBlob(std::shared_ptr<LocalPlayer> plr, byteArray param);
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
|
||||
static unsigned int CACHE_SIZES[eMethod_MAX];
|
||||
|
||||
DsTravel(int id, const wstring &name);
|
||||
DsTravel(int id, const std::wstring &name);
|
||||
|
||||
typedef struct { eMethod method; int distance; } Param;
|
||||
virtual void handleParamBlob(std::shared_ptr<LocalPlayer> plr, byteArray paramBlob);
|
||||
@@ -124,7 +124,7 @@ protected:
|
||||
class DsItemUsed : public Stat
|
||||
{
|
||||
public:
|
||||
DsItemUsed(int id, const wstring &name);
|
||||
DsItemUsed(int id, const std::wstring &name);
|
||||
typedef struct { int itemId, aux, count, health, hunger; } Param;
|
||||
virtual void handleParamBlob(std::shared_ptr<LocalPlayer> plr, byteArray paramBlob);
|
||||
static byteArray createParamBlob(int itemId, int aux, int count, int health, int hunger);
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
class DsAchievement : public Stat
|
||||
{
|
||||
public:
|
||||
DsAchievement(int id, const wstring &name);
|
||||
DsAchievement(int id, const std::wstring &name);
|
||||
|
||||
virtual void handleParamBlob(std::shared_ptr<LocalPlayer> plr, byteArray paramBlob);
|
||||
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
class DsChangedDimension : public Stat
|
||||
{
|
||||
public:
|
||||
DsChangedDimension(int id, const wstring &name);
|
||||
DsChangedDimension(int id, const std::wstring &name);
|
||||
typedef struct { int fromDimId, toDimId; } Param;
|
||||
virtual void handleParamBlob(std::shared_ptr<LocalPlayer> plr, byteArray paramBlob);
|
||||
static byteArray createParamBlob(int fromDimId, int toDimId);
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
class DsEnteredBiome : public Stat
|
||||
{
|
||||
public:
|
||||
DsEnteredBiome(int id, const wstring &name);
|
||||
DsEnteredBiome(int id, const std::wstring &name);
|
||||
typedef struct { int biomeId; } Param;
|
||||
virtual void handleParamBlob(std::shared_ptr<LocalPlayer> plr, byteArray paramBlob);
|
||||
static byteArray createParamBlob(int biomeId);
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
#include "../Headers/net.minecraft.stats.h"
|
||||
#include "GeneralStat.h"
|
||||
|
||||
GeneralStat::GeneralStat(int id, const wstring& name, StatFormatter *formatter) : Stat(id, name, formatter)
|
||||
GeneralStat::GeneralStat(int id, const std::wstring& name, StatFormatter *formatter) : Stat(id, name, formatter)
|
||||
{
|
||||
}
|
||||
|
||||
GeneralStat::GeneralStat(int id, const wstring& name) : Stat(id, name)
|
||||
GeneralStat::GeneralStat(int id, const std::wstring& name) : Stat(id, name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ using namespace std;
|
||||
class GeneralStat : public Stat
|
||||
{
|
||||
public:
|
||||
GeneralStat(int id, const wstring& name, StatFormatter *formatter);
|
||||
GeneralStat(int id, const wstring& name);
|
||||
GeneralStat(int id, const std::wstring& name, StatFormatter *formatter);
|
||||
GeneralStat(int id, const std::wstring& name);
|
||||
Stat *postConstruct();
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "../Build/stdafx.h"
|
||||
#include "ItemStat.h"
|
||||
|
||||
ItemStat::ItemStat(int id, const wstring& name, int itemId) : Stat( id, name ), itemId(itemId)
|
||||
ItemStat::ItemStat(int id, const std::wstring& name, int itemId) : Stat( id, name ), itemId(itemId)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,6 @@ private:
|
||||
const int itemId;
|
||||
|
||||
public:
|
||||
ItemStat(int id, const wstring& name, int itemId);
|
||||
ItemStat(int id, const std::wstring& name, int itemId);
|
||||
int getItemId();
|
||||
};
|
||||
|
||||
@@ -16,12 +16,12 @@ void Stat::_init()
|
||||
awardLocallyOnly = false;
|
||||
}
|
||||
|
||||
Stat::Stat(int id, const wstring& name, StatFormatter *formatter) : id(id), name(name), formatter(formatter)
|
||||
Stat::Stat(int id, const std::wstring& name, StatFormatter *formatter) : id(id), name(name), formatter(formatter)
|
||||
{
|
||||
_init();
|
||||
}
|
||||
|
||||
Stat::Stat(int id, const wstring& name) : id(id), name(name), formatter(defaultFormatter)
|
||||
Stat::Stat(int id, const std::wstring& name) : id(id), name(name), formatter(defaultFormatter)
|
||||
{
|
||||
_init();
|
||||
}
|
||||
@@ -55,17 +55,17 @@ bool Stat::isAchievement()
|
||||
return false;
|
||||
}
|
||||
|
||||
wstring Stat::format(int value)
|
||||
std::wstring Stat::format(int value)
|
||||
{
|
||||
return ((StatFormatter *)formatter)->format(value);
|
||||
}
|
||||
|
||||
wstring Stat::toString()
|
||||
std::wstring Stat::toString()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
wstring Stat::TimeFormatter::format(int value)
|
||||
std::wstring Stat::TimeFormatter::format(int value)
|
||||
{
|
||||
double seconds = value / 20.0;
|
||||
double minutes = seconds / 60.0;
|
||||
@@ -93,12 +93,12 @@ wstring Stat::TimeFormatter::format(int value)
|
||||
return _toString<double>(seconds) + L" s";
|
||||
}
|
||||
|
||||
wstring Stat::DefaultFormat::format(int value)
|
||||
std::wstring Stat::DefaultFormat::format(int value)
|
||||
{
|
||||
return NumberFormat::format( value ); //numberFormat->format(value);
|
||||
}
|
||||
|
||||
wstring Stat::DistanceFormatter::format(int cm)
|
||||
std::wstring Stat::DistanceFormatter::format(int cm)
|
||||
{
|
||||
double meters = cm / 100.0;
|
||||
double kilometers = meters / 1000.0;
|
||||
|
||||
@@ -10,7 +10,7 @@ class Stat
|
||||
{
|
||||
public:
|
||||
const int id;
|
||||
const wstring name;
|
||||
const std::wstring name;
|
||||
bool awardLocallyOnly;
|
||||
|
||||
private:
|
||||
@@ -18,13 +18,13 @@ private:
|
||||
void _init();
|
||||
|
||||
public:
|
||||
Stat(int id, const wstring& name, StatFormatter *formatter);
|
||||
Stat(int id, const wstring& name);
|
||||
Stat(int id, const std::wstring& name, StatFormatter *formatter);
|
||||
Stat(int id, const std::wstring& name);
|
||||
Stat *setAwardLocallyOnly();
|
||||
|
||||
virtual Stat *postConstruct();
|
||||
virtual bool isAchievement();
|
||||
wstring format(int value);
|
||||
std::wstring format(int value);
|
||||
|
||||
private:
|
||||
//static NumberFormat *numberFormat;
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
class DefaultFormat : public StatFormatter
|
||||
{
|
||||
public:
|
||||
wstring format(int value);
|
||||
std::wstring format(int value);
|
||||
} static *defaultFormatter;
|
||||
|
||||
private:
|
||||
@@ -44,16 +44,16 @@ public:
|
||||
class TimeFormatter : public StatFormatter
|
||||
{
|
||||
public:
|
||||
wstring format(int value);
|
||||
std::wstring format(int value);
|
||||
} static *timeFormatter;
|
||||
|
||||
class DistanceFormatter : public StatFormatter
|
||||
{
|
||||
public:
|
||||
wstring format(int cm);
|
||||
std::wstring format(int cm);
|
||||
} static *distanceFormatter;
|
||||
|
||||
wstring toString();
|
||||
std::wstring toString();
|
||||
|
||||
public:
|
||||
// 4J-JEV, for Durango stats
|
||||
|
||||
@@ -4,5 +4,5 @@ using namespace std;
|
||||
class StatFormatter
|
||||
{
|
||||
public:
|
||||
virtual wstring format(int value) = 0;
|
||||
virtual std::wstring format(int value) = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user