mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Rumors: client-side proof of concept implementation
Actually information about this week rumor should be stored in gamestate and updated weekly
This commit is contained in:
parent
6704ea0cff
commit
879eaa47f8
@ -12,6 +12,7 @@
|
|||||||
#include "CGameInfoCallback.h"
|
#include "CGameInfoCallback.h"
|
||||||
|
|
||||||
#include "CGameState.h" // PlayerState
|
#include "CGameState.h" // PlayerState
|
||||||
|
#include "CGeneralTextHandler.h"
|
||||||
#include "mapObjects/CObjectHandler.h" // for CGObjectInstance
|
#include "mapObjects/CObjectHandler.h" // for CGObjectInstance
|
||||||
#include "StartInfo.h" // for StartInfo
|
#include "StartInfo.h" // for StartInfo
|
||||||
#include "BattleState.h" // for BattleInfo
|
#include "BattleState.h" // for BattleInfo
|
||||||
@ -566,7 +567,70 @@ EPlayerStatus::EStatus CGameInfoCallback::getPlayerStatus(PlayerColor player, bo
|
|||||||
|
|
||||||
std::string CGameInfoCallback::getTavernRumor(const CGObjectInstance * townOrTavern) const
|
std::string CGameInfoCallback::getTavernRumor(const CGObjectInstance * townOrTavern) const
|
||||||
{
|
{
|
||||||
return "GOSSIP TEST";
|
std::string text = "";
|
||||||
|
auto & rand = gs->getRandomGenerator();
|
||||||
|
|
||||||
|
static std::vector<int> rumorTypes = {0, 1, 2, 2};
|
||||||
|
auto & rumorType = *RandomGeneratorUtil::nextItem(rumorTypes, rand);
|
||||||
|
switch(rumorType)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
SThievesGuildInfo tgi;
|
||||||
|
gs->obtainPlayersStats(tgi, 20);
|
||||||
|
static std::vector<int> statRumorTypes = {208, 209, 210};// 211, 212};
|
||||||
|
std::vector<PlayerColor> players = {};
|
||||||
|
auto statRumorType = *RandomGeneratorUtil::nextItem(statRumorTypes, rand);
|
||||||
|
switch(statRumorType)
|
||||||
|
{
|
||||||
|
case 208:
|
||||||
|
players = tgi.obelisks[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 209:
|
||||||
|
players = tgi.artifacts[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 210:
|
||||||
|
players = tgi.army[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 211:
|
||||||
|
/// TODO: not implemented in obtainPlayersStats
|
||||||
|
players = tgi.income[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 212:
|
||||||
|
/// TODO: Check that ultimate artifact (grail) found
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
auto & playerId = *RandomGeneratorUtil::nextItem(players, rand);
|
||||||
|
std::string playerName = VLC->generaltexth->colors[playerId.getNum()];
|
||||||
|
text = boost::str(boost::format(VLC->generaltexth->allTexts[statRumorType]) % playerName);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
if(gs->map->rumors.size())
|
||||||
|
{
|
||||||
|
auto & mapRumor = *RandomGeneratorUtil::nextItem(gs->map->rumors, rand);
|
||||||
|
text = mapRumor.text;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// don't break - if map don't have rumors we show predefined instead
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
do
|
||||||
|
{
|
||||||
|
text = *RandomGeneratorUtil::nextItem(VLC->generaltexth->tavernRumors, rand);
|
||||||
|
}
|
||||||
|
while(!text.length());
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerRelations::PlayerRelations CGameInfoCallback::getPlayerRelations( PlayerColor color1, PlayerColor color2 ) const
|
PlayerRelations::PlayerRelations CGameInfoCallback::getPlayerRelations( PlayerColor color1, PlayerColor color2 ) const
|
||||||
|
@ -327,6 +327,7 @@ CGeneralTextHandler::CGeneralTextHandler()
|
|||||||
readToVector("DATA/PRISKILL.TXT", primarySkillNames);
|
readToVector("DATA/PRISKILL.TXT", primarySkillNames);
|
||||||
readToVector("DATA/JKTEXT.TXT", jktexts);
|
readToVector("DATA/JKTEXT.TXT", jktexts);
|
||||||
readToVector("DATA/TVRNINFO.TXT", tavernInfo);
|
readToVector("DATA/TVRNINFO.TXT", tavernInfo);
|
||||||
|
readToVector("DATA/RANDTVRN.TXT", tavernRumors);
|
||||||
readToVector("DATA/TURNDUR.TXT", turnDurations);
|
readToVector("DATA/TURNDUR.TXT", turnDurations);
|
||||||
readToVector("DATA/HEROSCRN.TXT", heroscrn);
|
readToVector("DATA/HEROSCRN.TXT", heroscrn);
|
||||||
readToVector("DATA/TENTCOLR.TXT", tentColors);
|
readToVector("DATA/TENTCOLR.TXT", tentColors);
|
||||||
|
@ -109,6 +109,7 @@ public:
|
|||||||
//towns
|
//towns
|
||||||
std::vector<std::string> tcommands, hcommands, fcommands; //texts for town screen, town hall screen and fort screen
|
std::vector<std::string> tcommands, hcommands, fcommands; //texts for town screen, town hall screen and fort screen
|
||||||
std::vector<std::string> tavernInfo;
|
std::vector<std::string> tavernInfo;
|
||||||
|
std::vector<std::string> tavernRumors;
|
||||||
|
|
||||||
std::vector<std::pair<std::string,std::string> > zelp;
|
std::vector<std::pair<std::string,std::string> > zelp;
|
||||||
std::vector<std::string> lossCondtions;
|
std::vector<std::string> lossCondtions;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user