1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00

Quick implementation of stack experience details. Minor fixes.

Man, it's ugly.
This commit is contained in:
DjWarmonger 2011-03-21 08:14:23 +00:00
parent f88ac50a44
commit 70b21fc9eb
5 changed files with 70 additions and 4 deletions

View File

@ -56,7 +56,7 @@ CCreatureWindow::CCreatureWindow(int Cid, int Type, int creatureCount)
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
CStackInstance * stack = new CStackInstance(Type,creatureCount); //TODO: simplify?
CStackInstance * stack = new CStackInstance(Cid, creatureCount); //TODO: simplify?
init(stack, CGI->creh->creatures[Cid], NULL);
delete stack;
}
@ -138,12 +138,67 @@ void CCreatureWindow::init(const CStackInstance *stack, const CBonusSystemNode *
printLine(4, CGI->generaltexth->allTexts[388], c->valOfBonuses(Bonus::STACK_HEALTH), stackNode->valOfBonuses(Bonus::STACK_HEALTH));
printLine(6, CGI->generaltexth->zelp[441].first, c->valOfBonuses(Bonus::STACKS_SPEED), stackNode->valOfBonuses(Bonus::STACKS_SPEED));
if (stack)
new CPicture(graphics->pskillsm->ourImages[4].bitmap, 335, 50, false); //exp icon - Print it always?
if (type) //not in fort window
{
if (STACK_EXP)
{
int rank = std::min(stack->getExpRank(), 10); //hopefully nobody adds more
printAtMiddle("Rank " + boost::lexical_cast<std::string>(stack->getExpRank()), 436, 62, FONT_MEDIUM, tytulowy,*bitmap);
printAtMiddle(boost::lexical_cast<std::string>(stack->experience), 436, 82, FONT_SMALL, zwykly,*bitmap);
if (type > BATTLE) //we need it only on adv. map
{
int tier = stack->type->level;
if (!iswith(tier, 1, 7))
tier = 0;
int number;
std::string expText = CGI->generaltexth->zcrexp[324];
boost::replace_first (expText, "%s", c->namePl);
boost::replace_first (expText, "%s", CGI->generaltexth->zcrexp[rank]);
boost::replace_first (expText, "%i", boost::lexical_cast<std::string>(rank));
boost::replace_first (expText, "%i", boost::lexical_cast<std::string>(stack->experience));
number = CGI->creh->expRanks[tier][rank] - stack->experience;
boost::replace_first (expText, "%i", boost::lexical_cast<std::string>(number));
number = CGI->creh->maxExpPerBattle[tier]; //percent
boost::replace_first (expText, "%i%", boost::lexical_cast<std::string>(number));
number *= CGI->creh->expRanks[tier].back() / 100; //actual amount
boost::replace_first (expText, "%i", boost::lexical_cast<std::string>(number));
boost::replace_first (expText, "%i", boost::lexical_cast<std::string>(stack->count)); //Number of Creatures in stack
int expmin = std::max(CGI->creh->expRanks[tier][std::max(rank-1, 0)], (ui32)1);
number = (stack->count * (stack->experience - expmin)) / expmin; //Maximum New Recruits without losing current Rank
boost::replace_first (expText, "%i", boost::lexical_cast<std::string>(number)); //TODO
boost::replace_first (expText, "%.2f", boost::lexical_cast<std::string>(1)); //TODO Experience Multiplier
number = CGI->creh->expAfterUpgrade;
boost::replace_first (expText, "%.2f", boost::lexical_cast<std::string>(number) + "%"); //Upgrade Multiplier
expmin = CGI->creh->expRanks[tier][9];
int expmax = CGI->creh->expRanks[tier][10];
number = expmax - expmin;
boost::replace_first (expText, "%i", boost::lexical_cast<std::string>(number));
number = (stack->count * (expmax - expmin)) / expmin;
boost::replace_first (expText, "%i", boost::lexical_cast<std::string>(number));
//» S t a c k E x p e r i e n c e D e t a i l s «
//
//Creature Type ................... : %s
//Experience Rank ................. : %s (%i)
//Experience Points ............... : %i
//Experience Points to Next Rank .. : %i
//Maximum Experience per Battle ... : %i%% (%i)
//Number of Creatures in stack .... : %i
//Maximum New Recruits
// without losing current Rank .... : %i
//Experience Multiplier ........... : %.2f
//Upgrade Multiplier .............. : %.2f
//Experience after Rank 10 ........ : %i
//Maximum New Recruits to remain at
// Rank 10 if at Maximum Experience : %i
expArea = new LRClickableAreaWText(Rect(334, 49, 160, 44), "" , expText );
}
}
if (STACK_ARTIFACT && type > BATTLE)

View File

@ -393,7 +393,7 @@ void CMessage::drawIWindow(CInfoWindow * ret, std::string text, int player)
if(dynamic_cast<CSelWindow*>(ret)) //it's selection window, so we'll blit "or" between components
_or = FNT_RenderText(FONT_MEDIUM,CGI->generaltexth->allTexts[4],zwykly);
const int sizes[][2] = {{400, 125}, {500, 150}, {600, 200}};
const int sizes[][2] = {{400, 125}, {500, 150}, {600, 200}, {480, 400}};
for(int i = 0;
i < ARRAY_COUNT(sizes)
&& sizes[i][0] < conf.cc.resx - 150

View File

@ -681,7 +681,7 @@ std::string CStackInstance::bonusToGraphics(Bonus *bonus) const
{
switch (bonus->subtype)
{
case 74: //Blind
case 62: //Blind
fileName = "E_SPBLIND.bmp"; break;
case 60: //Hypnotize
fileName = "E_SPHYPN.bmp"; break;

View File

@ -536,6 +536,16 @@ void CGeneralTextHandler::load()
} while (nameBuf.size());
}
buf = bitmaph->getTextFile ("ZCREXP.TXT");
it = 0;
loadToIt (dump, buf, it, 3); //comment
for (int i = 0; i < 459; ++i) //some texts seem to be empty
{
loadToIt(dump, buf, it, 4); //description, usually useless
loadToIt(nameBuf, buf, it, 3);
zcrexp.push_back(nameBuf);
}
std::ifstream ifs(DATA_DIR "/config/threatlevel.txt", std::ios::in | std::ios::binary);
getline(ifs, buf); //skip 1st line
for (int i = 0; i < 13; ++i)

View File

@ -74,6 +74,7 @@ public:
std::vector <std::string> skillName;
std::vector <std::vector <std::string> > skillInfoTexts; //[id][level] : level 0 - basic; 2 - advanced
std::vector<std::string> levels;
std::vector<std::string> zcrexp; //more or less useful content of that file
//campaigns
std::vector <std::string> campaignMapNames;