2
0
Laserlicht 1 жил өмнө
parent
commit
e83a30ea11

+ 5 - 0
Mods/vcmi/config/vcmi/english.json

@@ -180,10 +180,15 @@
 	"vcmi.statisticWindow.title.resourcesSpentArmy" : "Army costs",
 	"vcmi.statisticWindow.title.resourcesSpentBuildings" : "Building costs",
 	"vcmi.statisticWindow.title.mapExplored" : "Map explore ratio",
+	"vcmi.statisticWindow.param.playerName" : "Player name",
 	"vcmi.statisticWindow.param.daysSurvived" : "Days survived",
 	"vcmi.statisticWindow.param.maxHeroLevel" : "Max hero level",
 	"vcmi.statisticWindow.param.battleWinRatioHero" : "Win ratio (hero)",
 	"vcmi.statisticWindow.param.battleWinRatioNeutral" : "Win ratio (neutral)",
+	"vcmi.statisticWindow.param.battlesHero" : "Battles (hero)",
+	"vcmi.statisticWindow.param.battlesNeutral" : "Battles (neutral)",
+	"vcmi.statisticWindow.param.tradeVolume" : "Trade volume",
+	"vcmi.statisticWindow.param.obeliskVisited" : "Obelisk visited",
 
 	"vcmi.systemOptions.fullscreenBorderless.hover" : "Fullscreen (borderless)",
 	"vcmi.systemOptions.fullscreenBorderless.help"  : "{Borderless Fullscreen}\n\nIf selected, VCMI will run in borderless fullscreen mode. In this mode, game will always use same resolution as desktop, ignoring selected resolution.",

+ 5 - 0
Mods/vcmi/config/vcmi/german.json

@@ -180,10 +180,15 @@
 	"vcmi.statisticWindow.title.resourcesSpentArmy" : "Armeekosten",
 	"vcmi.statisticWindow.title.resourcesSpentBuildings" : "Gebäudekosten",
 	"vcmi.statisticWindow.title.mapExplored" : "Maperkundungsrate",
+	"vcmi.statisticWindow.param.playerName" : "Spielername",
 	"vcmi.statisticWindow.param.daysSurvived" : "Tage überlebt",
 	"vcmi.statisticWindow.param.maxHeroLevel" : "Max Heldenlevel",
 	"vcmi.statisticWindow.param.battleWinRatioHero" : "Sieg Verh. (Helden)",
 	"vcmi.statisticWindow.param.battleWinRatioNeutral" : "Sieg Verh. (Neutral)",
+	"vcmi.statisticWindow.param.battlesHero" : "Kämpfe (Helden)",
+	"vcmi.statisticWindow.param.battlesNeutral" : "Kämpfe (Neutral)",
+	"vcmi.statisticWindow.param.tradeVolume" : "Handelsvolumen",
+	"vcmi.statisticWindow.param.obeliskVisited" : "Obelisk besucht",
 
 	"vcmi.systemOptions.fullscreenBorderless.hover" : "Vollbild (randlos)",
 	"vcmi.systemOptions.fullscreenBorderless.help"  : "{Randloses Vollbild}\n\nWenn diese Option ausgewählt ist, wird VCMI im randlosen Vollbildmodus ausgeführt. In diesem Modus wird das Spiel immer dieselbe Auflösung wie der Desktop verwenden und die gewählte Auflösung ignorieren.",

+ 67 - 2
client/mainmenu/CStatisticScreen.cpp

@@ -42,7 +42,7 @@ CStatisticScreen::CStatisticScreen(StatisticDataSet stat)
 
 	contentArea = Rect(10, 40, 780, 510);
 	layout.push_back(std::make_shared<CLabel>(400, 20, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->translate("vcmi.statisticWindow.statistic")));
-	layout.push_back(std::make_shared<TransparentFilledRectangle>(contentArea, ColorRGBA(0, 0, 0, 64), ColorRGBA(64, 80, 128, 255), 1));
+	layout.push_back(std::make_shared<TransparentFilledRectangle>(contentArea, ColorRGBA(0, 0, 0, 128), ColorRGBA(64, 80, 128, 255), 1));
 	layout.push_back(std::make_shared<CButton>(Point(725, 558), AnimationPath::builtin("MUBCHCK"), CButton::tooltip(), [this](){ close(); }, EShortcut::GLOBAL_ACCEPT));
 
 	buttonSelect = std::make_shared<CToggleButton>(Point(10, 564), AnimationPath::builtin("GSPBUT2"), CButton::tooltip(), [this](bool on){
@@ -212,6 +212,11 @@ OverviewPanel::OverviewPanel(Rect position, std::string title, StatisticDataSet
 	canvas = std::make_shared<GraphicalPrimitiveCanvas>(Rect(0, Y_OFFS, pos.w - 16, pos.h - Y_OFFS));
 
 	dataExtract = {
+		{
+			CGI->generaltexth->translate("vcmi.statisticWindow.param.playerName"), [this](PlayerColor color){
+				return playerDataFilter(color).front().playerName;
+			}
+		},
 		{
 			CGI->generaltexth->translate("vcmi.statisticWindow.param.daysSurvived"), [this](PlayerColor color){
 				return std::to_string(playerDataFilter(color).size());
@@ -238,12 +243,72 @@ OverviewPanel::OverviewPanel(Rect position, std::string title, StatisticDataSet
 		{
 			CGI->generaltexth->translate("vcmi.statisticWindow.param.battleWinRatioNeutral"), [this](PlayerColor color){
 				auto val = playerDataFilter(color).back();
-				if(!val.numBattlesPlayer)
+				if(!val.numWinBattlesNeutral)
 					return std::string("");
 				float tmp = ((float)val.numWinBattlesNeutral / (float)val.numBattlesNeutral) * 100;
 				return std::to_string((int)tmp) + " %";
 			}
 		},
+		{
+			CGI->generaltexth->translate("vcmi.statisticWindow.param.battlesHero"), [this](PlayerColor color){
+				auto val = playerDataFilter(color).back();
+				return std::to_string(val.numBattlesPlayer);
+			}
+		},
+		{
+			CGI->generaltexth->translate("vcmi.statisticWindow.param.battlesNeutral"), [this](PlayerColor color){
+				auto val = playerDataFilter(color).back();
+				return std::to_string(val.numBattlesNeutral);
+			}
+		},
+		{
+			CGI->generaltexth->translate("vcmi.statisticWindow.param.obeliskVisited"), [this](PlayerColor color){
+				auto val = playerDataFilter(color).back();
+				return std::to_string((int)(val.obeliskVisitedRatio * 100)) + " %";
+			}
+		},
+		{
+			CGI->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + CGI->generaltexth->translate(TextIdentifier("core.restypes", EGameResID::GOLD).get()), [this](PlayerColor color){
+				auto val = playerDataFilter(color).back();
+				return std::to_string(val.tradeVolume[EGameResID::GOLD]);
+			}
+		},
+		{
+			CGI->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + CGI->generaltexth->translate(TextIdentifier("core.restypes", EGameResID::WOOD).get()), [this](PlayerColor color){
+				auto val = playerDataFilter(color).back();
+				return std::to_string(val.tradeVolume[EGameResID::WOOD]);
+			}
+		},
+		{
+			CGI->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + CGI->generaltexth->translate(TextIdentifier("core.restypes", EGameResID::MERCURY).get()), [this](PlayerColor color){
+				auto val = playerDataFilter(color).back();
+				return std::to_string(val.tradeVolume[EGameResID::MERCURY]);
+			}
+		},
+		{
+			CGI->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + CGI->generaltexth->translate(TextIdentifier("core.restypes", EGameResID::ORE).get()), [this](PlayerColor color){
+				auto val = playerDataFilter(color).back();
+				return std::to_string(val.tradeVolume[EGameResID::ORE]);
+			}
+		},
+		{
+			CGI->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + CGI->generaltexth->translate(TextIdentifier("core.restypes", EGameResID::SULFUR).get()), [this](PlayerColor color){
+				auto val = playerDataFilter(color).back();
+				return std::to_string(val.tradeVolume[EGameResID::SULFUR]);
+			}
+		},
+		{
+			CGI->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + CGI->generaltexth->translate(TextIdentifier("core.restypes", EGameResID::CRYSTAL).get()), [this](PlayerColor color){
+				auto val = playerDataFilter(color).back();
+				return std::to_string(val.tradeVolume[EGameResID::CRYSTAL]);
+			}
+		},
+		{
+			CGI->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + CGI->generaltexth->translate(TextIdentifier("core.restypes", EGameResID::GEMS).get()), [this](PlayerColor color){
+				auto val = playerDataFilter(color).back();
+				return std::to_string(val.tradeVolume[EGameResID::GEMS]);
+			}
+		},
 	};
 
 	int usedLines = dataExtract.size();

+ 3 - 0
lib/gameState/GameStatistics.cpp

@@ -45,6 +45,7 @@ StatisticDataSetEntry StatisticDataSet::createEntry(const PlayerState * ps, cons
 	data.timestamp = std::time(0);
 	data.day = gs->getDate(Date::DAY);
 	data.player = ps->color;
+	data.playerName = gs->getStartInfo()->playerInfos.at(ps->color).name;
 	data.team = ps->team;
 	data.isHuman = ps->isHuman();
 	data.status = ps->status;
@@ -87,6 +88,7 @@ std::string StatisticDataSet::toCsv()
 	ss << "Timestamp" << ";";
 	ss << "Day" << ";";
 	ss << "Player" << ";";
+	ss << "PlayerName" << ";";
 	ss << "Team" << ";";
 	ss << "IsHuman" << ";";
 	ss << "Status" << ";";
@@ -128,6 +130,7 @@ std::string StatisticDataSet::toCsv()
 		ss << vstd::getFormattedDateTime(entry.timestamp, "%Y-%m-%dT%H:%M:%S") << ";";
 		ss << entry.day << ";";
 		ss << GameConstants::PLAYER_COLOR_NAMES[entry.player] << ";";
+		ss << entry.playerName << ";";
 		ss << entry.team.getNum() << ";";
 		ss << entry.isHuman << ";";
 		ss << (int)entry.status << ";";

+ 2 - 0
lib/gameState/GameStatistics.h

@@ -25,6 +25,7 @@ struct DLL_LINKAGE StatisticDataSetEntry
 	time_t timestamp;
     int day;
     PlayerColor player;
+    std::string playerName;
 	TeamID team;
 	bool isHuman;
 	EPlayerStatus status;
@@ -60,6 +61,7 @@ struct DLL_LINKAGE StatisticDataSetEntry
 		h & timestamp;
 		h & day;
 		h & player;
+		h & playerName;
 		h & team;
 		h & isHuman;
 		h & status;