mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
skill names and descriptions are fully managed by CSkillHandler
This commit is contained in:
@ -37,11 +37,3 @@ void CGameInfo::setFromLib()
|
|||||||
skillh = VLC->skillh;
|
skillh = VLC->skillh;
|
||||||
objtypeh = VLC->objtypeh;
|
objtypeh = VLC->objtypeh;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string & CGameInfo::skillInfo(int skill, int level) const
|
|
||||||
{
|
|
||||||
const std::string & desc = (*skillh)[SecondarySkill(skill)]->getDescription(level);
|
|
||||||
if(desc.size() > 0)
|
|
||||||
return desc;
|
|
||||||
return generaltexth->skillInfoTexts[skill][level-1];
|
|
||||||
}
|
|
||||||
|
@ -68,6 +68,5 @@ public:
|
|||||||
friend class CClient;
|
friend class CClient;
|
||||||
|
|
||||||
CGameInfo();
|
CGameInfo();
|
||||||
const std::string & skillInfo(int skill, int level) const;
|
|
||||||
};
|
};
|
||||||
extern const CGameInfo* CGI;
|
extern const CGameInfo* CGI;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "CGameInfo.h"
|
#include "CGameInfo.h"
|
||||||
#include "gui/CCursorHandler.h"
|
#include "gui/CCursorHandler.h"
|
||||||
#include "../lib/CGeneralTextHandler.h"
|
#include "../lib/CGeneralTextHandler.h"
|
||||||
|
#include "../lib/CSkillHandler.h"
|
||||||
#include "../lib/CTownHandler.h"
|
#include "../lib/CTownHandler.h"
|
||||||
#include "../lib/CHeroHandler.h"
|
#include "../lib/CHeroHandler.h"
|
||||||
#include "../lib/mapping/CCampaignHandler.h"
|
#include "../lib/mapping/CCampaignHandler.h"
|
||||||
@ -3624,7 +3625,7 @@ void CBonusSelection::updateBonusSelection()
|
|||||||
desc = CGI->generaltexth->allTexts[718];
|
desc = CGI->generaltexth->allTexts[718];
|
||||||
|
|
||||||
boost::algorithm::replace_first(desc, "%s", CGI->generaltexth->levels[bonDescs[i].info3 - 1]); //skill level
|
boost::algorithm::replace_first(desc, "%s", CGI->generaltexth->levels[bonDescs[i].info3 - 1]); //skill level
|
||||||
boost::algorithm::replace_first(desc, "%s", CGI->generaltexth->skillName[bonDescs[i].info2]); //skill name
|
boost::algorithm::replace_first(desc, "%s", CGI->skillh->skillName(bonDescs[i].info2)); //skill name
|
||||||
picNumber = bonDescs[i].info2 * 3 + bonDescs[i].info3 - 1;
|
picNumber = bonDescs[i].info2 * 3 + bonDescs[i].info3 - 1;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "../../lib/CArtHandler.h"
|
#include "../../lib/CArtHandler.h"
|
||||||
#include "../../lib/CTownHandler.h"
|
#include "../../lib/CTownHandler.h"
|
||||||
#include "../../lib/CCreatureHandler.h"
|
#include "../../lib/CCreatureHandler.h"
|
||||||
|
#include "../../lib/CSkillHandler.h"
|
||||||
#include "../../lib/spells/CSpellHandler.h"
|
#include "../../lib/spells/CSpellHandler.h"
|
||||||
#include "../../lib/CGeneralTextHandler.h"
|
#include "../../lib/CGeneralTextHandler.h"
|
||||||
#include "../../lib/NetPacksBase.h"
|
#include "../../lib/NetPacksBase.h"
|
||||||
@ -148,7 +149,7 @@ std::string CComponent::getDescription()
|
|||||||
{
|
{
|
||||||
case primskill: return (subtype < 4)? CGI->generaltexth->arraytxt[2+subtype] //Primary skill
|
case primskill: return (subtype < 4)? CGI->generaltexth->arraytxt[2+subtype] //Primary skill
|
||||||
: CGI->generaltexth->allTexts[149]; //mana
|
: CGI->generaltexth->allTexts[149]; //mana
|
||||||
case secskill: return CGI->skillInfo(subtype,val);
|
case secskill: return CGI->skillh->skillInfo(subtype, val);
|
||||||
case resource: return CGI->generaltexth->allTexts[242];
|
case resource: return CGI->generaltexth->allTexts[242];
|
||||||
case creature: return "";
|
case creature: return "";
|
||||||
case artifact:
|
case artifact:
|
||||||
@ -192,7 +193,7 @@ std::string CComponent::getSubtitleInternal()
|
|||||||
switch(compType)
|
switch(compType)
|
||||||
{
|
{
|
||||||
case primskill: return boost::str(boost::format("%+d %s") % val % (subtype < 4 ? CGI->generaltexth->primarySkillNames[subtype] : CGI->generaltexth->allTexts[387]));
|
case primskill: return boost::str(boost::format("%+d %s") % val % (subtype < 4 ? CGI->generaltexth->primarySkillNames[subtype] : CGI->generaltexth->allTexts[387]));
|
||||||
case secskill: return CGI->generaltexth->levels[val-1] + "\n" + CGI->generaltexth->skillName[subtype];
|
case secskill: return CGI->generaltexth->levels[val-1] + "\n" + CGI->skillh->skillName(subtype);
|
||||||
case resource: return boost::lexical_cast<std::string>(val);
|
case resource: return boost::lexical_cast<std::string>(val);
|
||||||
case creature: return (val? boost::lexical_cast<std::string>(val) + " " : "") + CGI->creh->creatures[subtype]->*(val != 1 ? &CCreature::namePl : &CCreature::nameSing);
|
case creature: return (val? boost::lexical_cast<std::string>(val) + " " : "") + CGI->creh->creatures[subtype]->*(val != 1 ? &CCreature::namePl : &CCreature::nameSing);
|
||||||
case artifact: return CGI->arth->artifacts[subtype]->Name();
|
case artifact: return CGI->arth->artifacts[subtype]->Name();
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "../lib/CConfigHandler.h"
|
#include "../lib/CConfigHandler.h"
|
||||||
#include "../lib/CGeneralTextHandler.h"
|
#include "../lib/CGeneralTextHandler.h"
|
||||||
#include "../lib/CHeroHandler.h"
|
#include "../lib/CHeroHandler.h"
|
||||||
|
#include "../lib/CSkillHandler.h"
|
||||||
#include "../lib/mapObjects/CGHeroInstance.h"
|
#include "../lib/mapObjects/CGHeroInstance.h"
|
||||||
#include "../lib/NetPacksBase.h"
|
#include "../lib/NetPacksBase.h"
|
||||||
#include "../mapHandler.h"
|
#include "../mapHandler.h"
|
||||||
@ -240,8 +241,8 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded)
|
|||||||
level = curHero->getSecSkillLevel(SecondarySkill(curHero->secSkills[g].first));
|
level = curHero->getSecSkillLevel(SecondarySkill(curHero->secSkills[g].first));
|
||||||
secSkillAreas[g]->type = skill;
|
secSkillAreas[g]->type = skill;
|
||||||
secSkillAreas[g]->bonusValue = level;
|
secSkillAreas[g]->bonusValue = level;
|
||||||
secSkillAreas[g]->text = CGI->skillInfo(skill,level);
|
secSkillAreas[g]->text = CGI->skillh->skillInfo(skill, level);
|
||||||
secSkillAreas[g]->hoverText = boost::str(boost::format(heroscrn[21]) % CGI->generaltexth->levels[level-1] % CGI->generaltexth->skillName[skill]);
|
secSkillAreas[g]->hoverText = boost::str(boost::format(heroscrn[21]) % CGI->generaltexth->levels[level-1] % CGI->skillh->skillName(skill));
|
||||||
secSkillImages[g]->setFrame(skill*3 + level + 2);
|
secSkillImages[g]->setFrame(skill*3 + level + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +373,7 @@ void CHeroWindow::showAll(SDL_Surface * to)
|
|||||||
for(size_t v=0; v<std::min(secSkillAreas.size(), curHero->secSkills.size()); ++v)
|
for(size_t v=0; v<std::min(secSkillAreas.size(), curHero->secSkills.size()); ++v)
|
||||||
{
|
{
|
||||||
printAtLoc(CGI->generaltexth->levels[curHero->secSkills[v].second-1], (v%2) ? 212 : 68, 280 + 48 * (v/2), FONT_SMALL, Colors::WHITE, to);
|
printAtLoc(CGI->generaltexth->levels[curHero->secSkills[v].second-1], (v%2) ? 212 : 68, 280 + 48 * (v/2), FONT_SMALL, Colors::WHITE, to);
|
||||||
printAtLoc(CGI->generaltexth->skillName[curHero->secSkills[v].first], (v%2) ? 212 : 68, 300 + 48 * (v/2), FONT_SMALL, Colors::WHITE, to);
|
printAtLoc(CGI->skillh->skillName(curHero->secSkills[v].first), (v%2) ? 212 : 68, 300 + 48 * (v/2), FONT_SMALL, Colors::WHITE, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
//printing special ability
|
//printing special ability
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "../../lib/CGeneralTextHandler.h"
|
#include "../../lib/CGeneralTextHandler.h"
|
||||||
#include "../../lib/CHeroHandler.h"
|
#include "../../lib/CHeroHandler.h"
|
||||||
#include "../../lib/CModHandler.h"
|
#include "../../lib/CModHandler.h"
|
||||||
|
#include "../../lib/CSkillHandler.h"
|
||||||
#include "../../lib/CTownHandler.h"
|
#include "../../lib/CTownHandler.h"
|
||||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||||
#include "../../lib/mapObjects/CGTownInstance.h"
|
#include "../../lib/mapObjects/CGTownInstance.h"
|
||||||
@ -170,7 +171,7 @@ std::string InfoBoxAbstractHeroData::getNameText()
|
|||||||
return CGI->heroh->heroes[getSubID()]->specName;
|
return CGI->heroh->heroes[getSubID()]->specName;
|
||||||
case HERO_SECONDARY_SKILL:
|
case HERO_SECONDARY_SKILL:
|
||||||
if (getValue())
|
if (getValue())
|
||||||
return CGI->generaltexth->skillName[getSubID()];
|
return CGI->skillh->skillName(getSubID());
|
||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
default:
|
default:
|
||||||
@ -281,7 +282,7 @@ bool InfoBoxAbstractHeroData::prepareMessage(std::string &text, CComponent **com
|
|||||||
if (!value)
|
if (!value)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
text = CGI->skillInfo(subID,value);
|
text = CGI->skillh->skillInfo(subID, value);
|
||||||
*comp = new CComponent(CComponent::secskill, subID, value);
|
*comp = new CComponent(CComponent::secskill, subID, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -356,7 +357,7 @@ std::string InfoBoxHeroData::getHoverText()
|
|||||||
if (hero->secSkills.size() > index)
|
if (hero->secSkills.size() > index)
|
||||||
{
|
{
|
||||||
std::string level = CGI->generaltexth->levels[hero->secSkills[index].second-1];
|
std::string level = CGI->generaltexth->levels[hero->secSkills[index].second-1];
|
||||||
std::string skill = CGI->generaltexth->skillName[hero->secSkills[index].first];
|
std::string skill = CGI->skillh->skillName(hero->secSkills[index].first);
|
||||||
return boost::str(boost::format(CGI->generaltexth->heroscrn[21]) % level % skill);
|
return boost::str(boost::format(CGI->generaltexth->heroscrn[21]) % level % skill);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#include "../lib/CHeroHandler.h"
|
#include "../lib/CHeroHandler.h"
|
||||||
#include "../lib/CModHandler.h"
|
#include "../lib/CModHandler.h"
|
||||||
#include "../lib/CondSh.h"
|
#include "../lib/CondSh.h"
|
||||||
|
#include "../lib/CSkillHandler.h"
|
||||||
#include "../lib/spells/CSpellHandler.h"
|
#include "../lib/spells/CSpellHandler.h"
|
||||||
#include "../lib/CStopWatch.h"
|
#include "../lib/CStopWatch.h"
|
||||||
#include "../lib/CTownHandler.h"
|
#include "../lib/CTownHandler.h"
|
||||||
@ -944,11 +945,11 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
|
|||||||
|
|
||||||
secSkillAreas[b][g]->type = skill;
|
secSkillAreas[b][g]->type = skill;
|
||||||
secSkillAreas[b][g]->bonusValue = level;
|
secSkillAreas[b][g]->bonusValue = level;
|
||||||
secSkillAreas[b][g]->text = CGI->skillInfo(skill,level);
|
secSkillAreas[b][g]->text = CGI->skillh->skillInfo(skill, level);
|
||||||
|
|
||||||
secSkillAreas[b][g]->hoverText = CGI->generaltexth->heroscrn[21];
|
secSkillAreas[b][g]->hoverText = CGI->generaltexth->heroscrn[21];
|
||||||
boost::algorithm::replace_first(secSkillAreas[b][g]->hoverText, "%s", CGI->generaltexth->levels[level - 1]);
|
boost::algorithm::replace_first(secSkillAreas[b][g]->hoverText, "%s", CGI->generaltexth->levels[level - 1]);
|
||||||
boost::algorithm::replace_first(secSkillAreas[b][g]->hoverText, "%s", CGI->generaltexth->skillName[skill]);
|
boost::algorithm::replace_first(secSkillAreas[b][g]->hoverText, "%s", CGI->skillh->skillName(skill));
|
||||||
}
|
}
|
||||||
|
|
||||||
portrait[b] = new CHeroArea(257 + 228*b, 13, heroInst[b]);
|
portrait[b] = new CHeroArea(257 + 228*b, 13, heroInst[b]);
|
||||||
@ -1222,7 +1223,7 @@ void CUniversityWindow::CItem::clickRight(tribool down, bool previousState)
|
|||||||
{
|
{
|
||||||
if(down)
|
if(down)
|
||||||
{
|
{
|
||||||
CRClickPopup::createAndPush(CGI->skillInfo(ID, 1),
|
CRClickPopup::createAndPush(CGI->skillh->skillInfo(ID, 1),
|
||||||
new CComponent(CComponent::secskill, ID, 1));
|
new CComponent(CComponent::secskill, ID, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1230,7 +1231,7 @@ void CUniversityWindow::CItem::clickRight(tribool down, bool previousState)
|
|||||||
void CUniversityWindow::CItem::hover(bool on)
|
void CUniversityWindow::CItem::hover(bool on)
|
||||||
{
|
{
|
||||||
if (on)
|
if (on)
|
||||||
GH.statusbar->setText(CGI->generaltexth->skillName[ID]);
|
GH.statusbar->setText(CGI->skillh->skillName(ID));
|
||||||
else
|
else
|
||||||
GH.statusbar->clear();
|
GH.statusbar->clear();
|
||||||
}
|
}
|
||||||
@ -1264,7 +1265,7 @@ void CUniversityWindow::CItem::showAll(SDL_Surface * to)
|
|||||||
|
|
||||||
blitAtLoc(bar->bg, -28, -22, to);
|
blitAtLoc(bar->bg, -28, -22, to);
|
||||||
blitAtLoc(bar->bg, -28, 48, to);
|
blitAtLoc(bar->bg, -28, 48, to);
|
||||||
printAtMiddleLoc (CGI->generaltexth->skillName[ID], 22, -13, FONT_SMALL, Colors::WHITE,to);//Name
|
printAtMiddleLoc (CGI->skillh->skillName(ID), 22, -13, FONT_SMALL, Colors::WHITE,to);//Name
|
||||||
printAtMiddleLoc (CGI->generaltexth->levels[0], 22, 57, FONT_SMALL, Colors::WHITE,to);//Level(always basic)
|
printAtMiddleLoc (CGI->generaltexth->levels[0], 22, 57, FONT_SMALL, Colors::WHITE,to);//Level(always basic)
|
||||||
|
|
||||||
CAnimImage::showAll(to);
|
CAnimImage::showAll(to);
|
||||||
@ -1328,12 +1329,12 @@ CUnivConfirmWindow::CUnivConfirmWindow(CUniversityWindow * PARENT, int SKILL, bo
|
|||||||
|
|
||||||
std::string text = CGI->generaltexth->allTexts[608];
|
std::string text = CGI->generaltexth->allTexts[608];
|
||||||
boost::replace_first(text, "%s", CGI->generaltexth->levels[0]);
|
boost::replace_first(text, "%s", CGI->generaltexth->levels[0]);
|
||||||
boost::replace_first(text, "%s", CGI->generaltexth->skillName[SKILL]);
|
boost::replace_first(text, "%s", CGI->skillh->skillName(SKILL));
|
||||||
boost::replace_first(text, "%d", "2000");
|
boost::replace_first(text, "%d", "2000");
|
||||||
|
|
||||||
new CTextBox(text, Rect(24, 129, 413, 70), 0, FONT_SMALL, CENTER, Colors::WHITE);//Clerk speech
|
new CTextBox(text, Rect(24, 129, 413, 70), 0, FONT_SMALL, CENTER, Colors::WHITE);//Clerk speech
|
||||||
|
|
||||||
new CLabel(230, 37, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth-> skillName[SKILL]);//Skill name
|
new CLabel(230, 37, FONT_SMALL, CENTER, Colors::WHITE, CGI->skillh->skillName(SKILL));//Skill name
|
||||||
new CAnimImage("SECSKILL", SKILL*3+3, 0, 211, 51);//skill
|
new CAnimImage("SECSKILL", SKILL*3+3, 0, 211, 51);//skill
|
||||||
new CLabel(230, 107, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->levels[1]);//Skill level
|
new CLabel(230, 107, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->levels[1]);//Skill level
|
||||||
|
|
||||||
@ -1341,11 +1342,11 @@ CUnivConfirmWindow::CUnivConfirmWindow(CUniversityWindow * PARENT, int SKILL, bo
|
|||||||
new CLabel(230, 267, FONT_SMALL, CENTER, Colors::WHITE, "2000");//Cost
|
new CLabel(230, 267, FONT_SMALL, CENTER, Colors::WHITE, "2000");//Cost
|
||||||
|
|
||||||
std::string hoverText = CGI->generaltexth->allTexts[609];
|
std::string hoverText = CGI->generaltexth->allTexts[609];
|
||||||
boost::replace_first(hoverText, "%s", CGI->generaltexth->levels[0]+ " " + CGI->generaltexth->skillName[SKILL]);
|
boost::replace_first(hoverText, "%s", CGI->generaltexth->levels[0]+ " " + CGI->skillh->skillName(SKILL));
|
||||||
|
|
||||||
text = CGI->generaltexth->zelp[633].second;
|
text = CGI->generaltexth->zelp[633].second;
|
||||||
boost::replace_first(text, "%s", CGI->generaltexth->levels[0]);
|
boost::replace_first(text, "%s", CGI->generaltexth->levels[0]);
|
||||||
boost::replace_first(text, "%s", CGI->generaltexth->skillName[SKILL]);
|
boost::replace_first(text, "%s", CGI->skillh->skillName(SKILL));
|
||||||
boost::replace_first(text, "%d", "2000");
|
boost::replace_first(text, "%d", "2000");
|
||||||
|
|
||||||
confirm= new CButton(Point(148, 299), "IBY6432.DEF", CButton::tooltip(hoverText, text), [=](){makeDeal(SKILL);}, SDLK_RETURN);
|
confirm= new CButton(Point(148, 299), "IBY6432.DEF", CButton::tooltip(hoverText, text), [=](){makeDeal(SKILL);}, SDLK_RETURN);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"pathfinding" : {
|
"pathfinding" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.pathfinding",
|
"subtype" : "skill.pathfinding",
|
||||||
@ -28,7 +27,6 @@
|
|||||||
},
|
},
|
||||||
"archery" : {
|
"archery" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.archery",
|
"subtype" : "skill.archery",
|
||||||
@ -55,7 +53,6 @@
|
|||||||
},
|
},
|
||||||
"logistics" : {
|
"logistics" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.logistics",
|
"subtype" : "skill.logistics",
|
||||||
@ -82,7 +79,6 @@
|
|||||||
},
|
},
|
||||||
"scouting" : {
|
"scouting" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"type" : "SIGHT_RADIOUS",
|
"type" : "SIGHT_RADIOUS",
|
||||||
@ -108,7 +104,6 @@
|
|||||||
},
|
},
|
||||||
"diplomacy" : {
|
"diplomacy" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.diplomacy",
|
"subtype" : "skill.diplomacy",
|
||||||
@ -143,7 +138,6 @@
|
|||||||
},
|
},
|
||||||
"navigation" : {
|
"navigation" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.navigation",
|
"subtype" : "skill.navigation",
|
||||||
@ -170,7 +164,6 @@
|
|||||||
},
|
},
|
||||||
"leadership" : {
|
"leadership" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"type" : "MORALE",
|
"type" : "MORALE",
|
||||||
@ -196,7 +189,6 @@
|
|||||||
},
|
},
|
||||||
"wisdom" : {
|
"wisdom" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.wisdom",
|
"subtype" : "skill.wisdom",
|
||||||
@ -223,7 +215,6 @@
|
|||||||
},
|
},
|
||||||
"mysticism" : {
|
"mysticism" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"type" : "MANA_REGENERATION",
|
"type" : "MANA_REGENERATION",
|
||||||
@ -249,7 +240,6 @@
|
|||||||
},
|
},
|
||||||
"luck" : {
|
"luck" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"type" : "LUCK",
|
"type" : "LUCK",
|
||||||
@ -275,7 +265,6 @@
|
|||||||
},
|
},
|
||||||
"ballistics" : {
|
"ballistics" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.ballistics",
|
"subtype" : "skill.ballistics",
|
||||||
@ -308,7 +297,6 @@
|
|||||||
},
|
},
|
||||||
"eagleEye" : {
|
"eagleEye" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.eagleEye",
|
"subtype" : "skill.eagleEye",
|
||||||
@ -343,7 +331,6 @@
|
|||||||
},
|
},
|
||||||
"necromancy" : {
|
"necromancy" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.necromancy",
|
"subtype" : "skill.necromancy",
|
||||||
@ -399,7 +386,6 @@
|
|||||||
},
|
},
|
||||||
"fireMagic" : {
|
"fireMagic" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.fireMagic",
|
"subtype" : "skill.fireMagic",
|
||||||
@ -426,7 +412,6 @@
|
|||||||
},
|
},
|
||||||
"airMagic" : {
|
"airMagic" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.airMagic",
|
"subtype" : "skill.airMagic",
|
||||||
@ -453,7 +438,6 @@
|
|||||||
},
|
},
|
||||||
"waterMagic" : {
|
"waterMagic" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.waterMagic",
|
"subtype" : "skill.waterMagic",
|
||||||
@ -480,7 +464,6 @@
|
|||||||
},
|
},
|
||||||
"earthMagic" : {
|
"earthMagic" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.earthMagic",
|
"subtype" : "skill.earthMagic",
|
||||||
@ -507,7 +490,6 @@
|
|||||||
},
|
},
|
||||||
"scholar" : {
|
"scholar" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.scholar",
|
"subtype" : "skill.scholar",
|
||||||
@ -534,7 +516,6 @@
|
|||||||
},
|
},
|
||||||
"tactics" : {
|
"tactics" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.tactics",
|
"subtype" : "skill.tactics",
|
||||||
@ -561,7 +542,6 @@
|
|||||||
},
|
},
|
||||||
"artillery" : {
|
"artillery" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.artillery",
|
"subtype" : "skill.artillery",
|
||||||
@ -602,7 +582,6 @@
|
|||||||
},
|
},
|
||||||
"learning" : {
|
"learning" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.learning",
|
"subtype" : "skill.learning",
|
||||||
@ -629,7 +608,6 @@
|
|||||||
},
|
},
|
||||||
"offence" : {
|
"offence" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.offence",
|
"subtype" : "skill.offence",
|
||||||
@ -656,7 +634,6 @@
|
|||||||
},
|
},
|
||||||
"armorer" : {
|
"armorer" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.armorer",
|
"subtype" : "skill.armorer",
|
||||||
@ -683,7 +660,6 @@
|
|||||||
},
|
},
|
||||||
"intelligence" : {
|
"intelligence" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.intelligence",
|
"subtype" : "skill.intelligence",
|
||||||
@ -710,7 +686,6 @@
|
|||||||
},
|
},
|
||||||
"sorcery" : {
|
"sorcery" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.sorcery",
|
"subtype" : "skill.sorcery",
|
||||||
@ -737,7 +712,6 @@
|
|||||||
},
|
},
|
||||||
"resistance" : {
|
"resistance" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.resistance",
|
"subtype" : "skill.resistance",
|
||||||
@ -764,7 +738,6 @@
|
|||||||
},
|
},
|
||||||
"firstAid" : {
|
"firstAid" : {
|
||||||
"base" : {
|
"base" : {
|
||||||
"description" : "",
|
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.firstAid",
|
"subtype" : "skill.firstAid",
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "CHeroHandler.h"
|
#include "CHeroHandler.h"
|
||||||
#include "mapObjects/CObjectHandler.h"
|
#include "mapObjects/CObjectHandler.h"
|
||||||
#include "CModHandler.h"
|
#include "CModHandler.h"
|
||||||
|
#include "CSkillHandler.h"
|
||||||
#include "mapping/CMap.h"
|
#include "mapping/CMap.h"
|
||||||
#include "mapping/CMapService.h"
|
#include "mapping/CMapService.h"
|
||||||
#include "StartInfo.h"
|
#include "StartInfo.h"
|
||||||
@ -113,6 +114,10 @@ void MetaString::getLocalString(const std::pair<ui8,ui32> &txt, std::string &dst
|
|||||||
{
|
{
|
||||||
dst = VLC->objtypeh->getObjectName(ser);
|
dst = VLC->objtypeh->getObjectName(ser);
|
||||||
}
|
}
|
||||||
|
else if(type == SEC_SKILL_NAME)
|
||||||
|
{
|
||||||
|
dst = VLC->skillh->skillName(ser);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::vector<std::string> *vec;
|
std::vector<std::string> *vec;
|
||||||
@ -139,9 +144,6 @@ void MetaString::getLocalString(const std::pair<ui8,ui32> &txt, std::string &dst
|
|||||||
case ADVOB_TXT:
|
case ADVOB_TXT:
|
||||||
vec = &VLC->generaltexth->advobtxt;
|
vec = &VLC->generaltexth->advobtxt;
|
||||||
break;
|
break;
|
||||||
case SEC_SKILL_NAME:
|
|
||||||
vec = &VLC->generaltexth->skillName;
|
|
||||||
break;
|
|
||||||
case COLOR:
|
case COLOR:
|
||||||
vec = &VLC->generaltexth->capColors;
|
vec = &VLC->generaltexth->capColors;
|
||||||
break;
|
break;
|
||||||
|
@ -377,23 +377,6 @@ CGeneralTextHandler::CGeneralTextHandler()
|
|||||||
}
|
}
|
||||||
while (parser.endLine());
|
while (parser.endLine());
|
||||||
}
|
}
|
||||||
{
|
|
||||||
CLegacyConfigParser parser("DATA/SSTRAITS.TXT");
|
|
||||||
|
|
||||||
//skip header
|
|
||||||
parser.endLine();
|
|
||||||
parser.endLine();
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
skillName.push_back(parser.readString());
|
|
||||||
|
|
||||||
skillInfoTexts.push_back(std::vector<std::string>());
|
|
||||||
for(int j = 0; j < 3; j++)
|
|
||||||
skillInfoTexts.back().push_back(parser.readString());
|
|
||||||
}
|
|
||||||
while (parser.endLine());
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
CLegacyConfigParser parser("DATA/SEERHUT.TXT");
|
CLegacyConfigParser parser("DATA/SEERHUT.TXT");
|
||||||
|
|
||||||
|
@ -130,8 +130,6 @@ public:
|
|||||||
std::vector<std::string> tentColors;
|
std::vector<std::string> tentColors;
|
||||||
|
|
||||||
//sec skills
|
//sec skills
|
||||||
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> levels;
|
||||||
std::vector<std::string> zcrexp; //more or less useful content of that file
|
std::vector<std::string> zcrexp; //more or less useful content of that file
|
||||||
//commanders
|
//commanders
|
||||||
|
@ -35,7 +35,7 @@ CSkill::LevelInfo::~LevelInfo()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSkill::CSkill(SecondarySkill id) : id(id)
|
CSkill::CSkill(SecondarySkill id) : id(id), name("")
|
||||||
{
|
{
|
||||||
if(id == SecondarySkill::DEFAULT)
|
if(id == SecondarySkill::DEFAULT)
|
||||||
identifier = "default";
|
identifier = "default";
|
||||||
@ -113,24 +113,41 @@ CSkillHandler::CSkillHandler()
|
|||||||
|
|
||||||
std::vector<JsonNode> CSkillHandler::loadLegacyData(size_t dataSize)
|
std::vector<JsonNode> CSkillHandler::loadLegacyData(size_t dataSize)
|
||||||
{
|
{
|
||||||
|
CLegacyConfigParser parser("DATA/SSTRAITS.TXT");
|
||||||
|
|
||||||
|
//skip header
|
||||||
|
parser.endLine();
|
||||||
|
parser.endLine();
|
||||||
|
|
||||||
|
std::vector<std::string> skillNames;
|
||||||
|
std::vector<std::vector<std::string>> skillInfoTexts;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
skillNames.push_back(parser.readString());
|
||||||
|
skillInfoTexts.push_back(std::vector<std::string>());
|
||||||
|
for(int i = 0; i < 3; i++)
|
||||||
|
skillInfoTexts.back().push_back(parser.readString());
|
||||||
|
}
|
||||||
|
while (parser.endLine());
|
||||||
|
|
||||||
|
assert(skillNames.size() == GameConstants::SKILL_QUANTITY);
|
||||||
|
|
||||||
|
//store & construct JSON
|
||||||
std::vector<JsonNode> legacyData;
|
std::vector<JsonNode> legacyData;
|
||||||
/* problem: CGI is client-side only
|
|
||||||
for(int id = 0; id < GameConstants::SKILL_QUANTITY; id++)
|
for(int id = 0; id < GameConstants::SKILL_QUANTITY; id++)
|
||||||
{
|
{
|
||||||
CSkill & skill = *objects[id];
|
CSkill & skill = *objects[id];
|
||||||
JsonNode skillNode(JsonNode::DATA_STRUCT);
|
JsonNode skillNode(JsonNode::DATA_STRUCT);
|
||||||
for(int level = 1; level < NSecondarySkill::levels.size(); level++)
|
for(int level = 1; level < NSecondarySkill::levels.size(); level++)
|
||||||
{
|
{
|
||||||
//only "real" legacy data is skill description
|
skill.name = skillNames[id];
|
||||||
std::string desc = CGI->generaltexth->skillInfoTexts[skill.id][level-1];
|
std::string & desc = skillInfoTexts[id][level-1];
|
||||||
//update both skill & JSON
|
|
||||||
skill.setDescription(desc, level);
|
skill.setDescription(desc, level);
|
||||||
auto & levelNode = skillNode[NSecondarySkill::levels[level]].Struct();
|
auto & levelNode = skillNode[NSecondarySkill::levels[level]].Struct();
|
||||||
levelNode["description"].String() = desc;
|
levelNode["description"].String() = desc;
|
||||||
}
|
}
|
||||||
legacyData.push_back(skillNode);
|
legacyData.push_back(skillNode);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return legacyData;
|
return legacyData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,6 +156,16 @@ const std::string CSkillHandler::getTypeName() const
|
|||||||
return "skill";
|
return "skill";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string & CSkillHandler::skillInfo(int skill, int level) const
|
||||||
|
{
|
||||||
|
return objects[skill]->getDescription(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string & CSkillHandler::skillName(int skill) const
|
||||||
|
{
|
||||||
|
return objects[skill]->name;
|
||||||
|
}
|
||||||
|
|
||||||
CSkill * CSkillHandler::loadFromJson(const JsonNode & json, const std::string & identifier)
|
CSkill * CSkillHandler::loadFromJson(const JsonNode & json, const std::string & identifier)
|
||||||
{
|
{
|
||||||
CSkill * skill = nullptr;
|
CSkill * skill = nullptr;
|
||||||
@ -148,6 +175,8 @@ CSkill * CSkillHandler::loadFromJson(const JsonNode & json, const std::string &
|
|||||||
if(NSecondarySkill::names[id].compare(identifier) == 0)
|
if(NSecondarySkill::names[id].compare(identifier) == 0)
|
||||||
{
|
{
|
||||||
skill = new CSkill(SecondarySkill(id));
|
skill = new CSkill(SecondarySkill(id));
|
||||||
|
//skill name isn't stored in JSON
|
||||||
|
skill->name = objects[id]->name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,6 +201,8 @@ CSkill * CSkillHandler::loadFromJson(const JsonNode & json, const std::string &
|
|||||||
// parse skill description - tracked separately
|
// parse skill description - tracked separately
|
||||||
if(vstd::contains(levelNode.Struct(), "description") && !levelNode["description"].isNull())
|
if(vstd::contains(levelNode.Struct(), "description") && !levelNode["description"].isNull())
|
||||||
skill->setDescription(levelNode["description"].String(), level);
|
skill->setDescription(levelNode["description"].String(), level);
|
||||||
|
else
|
||||||
|
skill->setDescription(skillInfo(skill->id, level), level);
|
||||||
}
|
}
|
||||||
logMod->debug("loaded secondary skill %s(%d)", identifier, (int)skill->id);
|
logMod->debug("loaded secondary skill %s(%d)", identifier, (int)skill->id);
|
||||||
logMod->trace("%s", skill->toString());
|
logMod->trace("%s", skill->toString());
|
||||||
|
@ -45,11 +45,13 @@ public:
|
|||||||
|
|
||||||
SecondarySkill id;
|
SecondarySkill id;
|
||||||
std::string identifier;
|
std::string identifier;
|
||||||
|
std::string name; //as displayed in GUI
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler & h, const int version)
|
template <typename Handler> void serialize(Handler & h, const int version)
|
||||||
{
|
{
|
||||||
h & id;
|
h & id;
|
||||||
h & identifier;
|
h & identifier;
|
||||||
|
h & name;
|
||||||
h & levels;
|
h & levels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +76,9 @@ public:
|
|||||||
void loadObject(std::string scope, std::string name, const JsonNode & data) override;
|
void loadObject(std::string scope, std::string name, const JsonNode & data) override;
|
||||||
void loadObject(std::string scope, std::string name, const JsonNode & data, size_t index) override;
|
void loadObject(std::string scope, std::string name, const JsonNode & data, size_t index) override;
|
||||||
|
|
||||||
|
const std::string & skillInfo(int skill, int level) const;
|
||||||
|
const std::string & skillName(int skill) const;
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler & h, const int version)
|
template <typename Handler> void serialize(Handler & h, const int version)
|
||||||
{
|
{
|
||||||
h & objects;
|
h & objects;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "CCreatureSet.h"
|
#include "CCreatureSet.h"
|
||||||
#include "CHeroHandler.h"
|
#include "CHeroHandler.h"
|
||||||
#include "CGeneralTextHandler.h"
|
#include "CGeneralTextHandler.h"
|
||||||
|
#include "CSkillHandler.h"
|
||||||
#include "CStack.h"
|
#include "CStack.h"
|
||||||
#include "CArtHandler.h"
|
#include "CArtHandler.h"
|
||||||
|
|
||||||
@ -1078,7 +1079,7 @@ std::string Bonus::Description() const
|
|||||||
str << VLC->creh->creatures[sid]->namePl;
|
str << VLC->creh->creatures[sid]->namePl;
|
||||||
break;
|
break;
|
||||||
case SECONDARY_SKILL:
|
case SECONDARY_SKILL:
|
||||||
str << VLC->generaltexth->skillName[sid]/* << " secondary skill"*/;
|
str << VLC->skillh->skillName(sid);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//todo: handle all possible sources
|
//todo: handle all possible sources
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "../CSoundBase.h"
|
#include "../CSoundBase.h"
|
||||||
#include "../CModHandler.h"
|
#include "../CModHandler.h"
|
||||||
#include "../CHeroHandler.h"
|
#include "../CHeroHandler.h"
|
||||||
|
#include "../CSkillHandler.h"
|
||||||
#include "CObjectClassesHandler.h"
|
#include "CObjectClassesHandler.h"
|
||||||
#include "../spells/CSpellHandler.h"
|
#include "../spells/CSpellHandler.h"
|
||||||
#include "../IGameCallback.h"
|
#include "../IGameCallback.h"
|
||||||
@ -1476,7 +1477,7 @@ std::string CGWitchHut::getHoverText(PlayerColor player) const
|
|||||||
if(wasVisited(player))
|
if(wasVisited(player))
|
||||||
{
|
{
|
||||||
hoverName += "\n" + VLC->generaltexth->allTexts[356]; // + (learn %s)
|
hoverName += "\n" + VLC->generaltexth->allTexts[356]; // + (learn %s)
|
||||||
boost::algorithm::replace_first(hoverName,"%s",VLC->generaltexth->skillName[ability]);
|
boost::algorithm::replace_first(hoverName, "%s", VLC->skillh->skillName(ability));
|
||||||
}
|
}
|
||||||
return hoverName;
|
return hoverName;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user