feat: achievements, minecraft store, languages, auto lb sendStats, more Language Strings

This commit is contained in:
Byte
2026-06-23 20:40:27 +02:00
parent 658849b427
commit 028dcdce41
58 changed files with 1649 additions and 375 deletions
+33 -2
View File
@@ -12,6 +12,7 @@
#include "FurnaceScreen.h"
#include "TrapScreen.h"
#include "../Minecraft.Client/Common/UI/UIScene.h"
#include "MultiPlayerLocalPlayer.h"
#include "CreativeMode.h"
#include "GameRenderer.h"
@@ -783,6 +784,16 @@ void LocalPlayer::displayClientMessage(int messageId)
minecraft->gui->displayClientMessage(messageId, GetXboxPad());
}
// Helper to convert LPCWSTR -> std::string (UTF-8)
static std::string WideToUtf8(LPCWSTR wide)
{
if (!wide) return {};
int size = WideCharToMultiByte(CP_UTF8, 0, wide, -1, nullptr, 0, nullptr, nullptr);
std::string result(size - 1, '\0');
WideCharToMultiByte(CP_UTF8, 0, wide, -1, result.data(), size, nullptr, nullptr);
return result;
}
void LocalPlayer::awardStat(Stat *stat, byteArray param)
{
#ifdef _DURANGO
@@ -805,6 +816,28 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param)
if (stat->isAchievement())
{
Achievement *ach = static_cast<Achievement *>(stat);
/*ui.ShowAchievementToast(
WideToUtf8(app.GetString(ach->nameID)),
WideToUtf8(app.GetString(IDS_ACHIEVEMENT_VIEW))
);*/
std::wstring iconStr(ach->iconInt.begin(),
ach->iconInt.end());
wstring path = L"Graphics\\Achievements\\TROP" +
(iconStr.empty() ? L"000" : iconStr) +
L".png";
byteArray ba = app.getArchiveFile(path);
//auto t = ui.GetTopScene(0);
//t->registerSubstitutionTexture(path, ba.data, ba.length);
if (!minecraft->stats[m_iPad]->hasTaken(ach))
{
ui.ShowAchievementToast(
WideToUtf8(app.GetString(ach->nameID)),
WideToUtf8(app.FormatHTMLString(0, app.GetString(IDS_ACHIEVEMENT_VIEW), 0xFFFFFFFF, true).c_str()), ba,
WideToUtf8(path.c_str())
);
minecraft->achID = ach->getAchievementID();
}
//app.FormatHTMLString(0, app.GetString(IDS_ACHIEVEMENT_VIEW));
// 4J-PB - changed to attempt to award everytime - the award may need a storage device, so needs a primary player, and the player may not have been a primary player when they first 'got' the award
// so let the award manager figure it out
//if (!minecraft->stats[m_iPad]->hasTaken(ach))
@@ -941,7 +974,6 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param)
}
#endif
#ifdef _EXTENDED_ACHIEVEMENTS
// AWARD : Porkchop, cook and eat a porkchop.
{
@@ -1101,7 +1133,6 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param)
}
#endif
}
#endif
}
bool LocalPlayer::isSolidBlock(int x, int y, int z)