mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Moved artifact-related text to CArtifact class.
This commit is contained in:
parent
a6388652d3
commit
cff758cfba
@ -27,18 +27,16 @@ extern boost::rand48 ran;
|
||||
|
||||
const std::string & CArtifact::Name() const
|
||||
{
|
||||
if(name.size())
|
||||
return name;
|
||||
else
|
||||
return VLC->generaltexth->artifNames[id];
|
||||
return name;
|
||||
}
|
||||
|
||||
const std::string & CArtifact::Description() const
|
||||
{
|
||||
if(description.size())
|
||||
return description;
|
||||
else
|
||||
return VLC->generaltexth->artifDescriptions[id];
|
||||
return description;
|
||||
}
|
||||
const std::string & CArtifact::EventText() const
|
||||
{
|
||||
return eventText;
|
||||
}
|
||||
|
||||
bool CArtifact::isBig () const
|
||||
@ -184,10 +182,18 @@ std::string CArtifact::nodeName() const
|
||||
// // //boost::algorithm::replace_first(description, "[spell name]", VLC->spellh->spells[spellid].name);
|
||||
// }
|
||||
|
||||
void CArtifact::setName (std::string desc)
|
||||
{
|
||||
name = desc;
|
||||
}
|
||||
void CArtifact::setDescription (std::string desc)
|
||||
{
|
||||
description = desc;
|
||||
}
|
||||
void CArtifact::setEventText (std::string desc)
|
||||
{
|
||||
eventText = desc;
|
||||
}
|
||||
|
||||
void CGrowingArtifact::levelUpArtifact (CArtifactInstance * art)
|
||||
{
|
||||
@ -240,12 +246,11 @@ void CArtHandler::loadArtifacts(bool onlyTxt)
|
||||
map_list_of('S',CArtifact::ART_SPECIAL)('T',CArtifact::ART_TREASURE)('N',CArtifact::ART_MINOR)('J',CArtifact::ART_MAJOR)('R',CArtifact::ART_RELIC);
|
||||
|
||||
CLegacyConfigParser parser("DATA/ARTRAITS.TXT");
|
||||
CLegacyConfigParser events("DATA/ARTEVENT.TXT");
|
||||
|
||||
parser.endLine(); // header
|
||||
parser.endLine();
|
||||
|
||||
VLC->generaltexth->artifNames.resize(GameConstants::ARTIFACTS_QUANTITY);
|
||||
VLC->generaltexth->artifDescriptions.resize(GameConstants::ARTIFACTS_QUANTITY);
|
||||
std::map<ui32,ui8>::iterator itr;
|
||||
|
||||
for (int i=0; i<GameConstants::ARTIFACTS_QUANTITY; i++)
|
||||
@ -261,7 +266,9 @@ void CArtHandler::loadArtifacts(bool onlyTxt)
|
||||
}
|
||||
CArtifact &nart = *art;
|
||||
nart.id=i;
|
||||
VLC->generaltexth->artifNames[i] = parser.readString();
|
||||
nart.setName (parser.readString());
|
||||
nart.setEventText (events.readString());
|
||||
events.endLine();
|
||||
|
||||
nart.price= parser.readNumber();
|
||||
|
||||
@ -277,7 +284,7 @@ void CArtHandler::loadArtifacts(bool onlyTxt)
|
||||
nart.aClass = classes[parser.readString()[0]];
|
||||
|
||||
//load description and remove quotation marks
|
||||
VLC->generaltexth->artifDescriptions[i] = parser.readString();
|
||||
nart.setDescription (parser.readString());
|
||||
|
||||
parser.endLine();
|
||||
|
||||
|
@ -63,12 +63,16 @@ class DLL_LINKAGE CArtifact : public CBonusSystemNode //container for artifacts
|
||||
{
|
||||
protected:
|
||||
std::string name, description; //set if custom
|
||||
std::string eventText; //short story displayed upon picking
|
||||
public:
|
||||
enum EartClass {ART_SPECIAL=1, ART_TREASURE=2, ART_MINOR=4, ART_MAJOR=8, ART_RELIC=16}; //artifact classes
|
||||
const std::string &Name() const; //getter
|
||||
const std::string &Description() const; //getter
|
||||
const std::string &EventText() const;
|
||||
bool isBig () const;
|
||||
void setName (std::string desc);
|
||||
void setDescription (std::string desc);
|
||||
void setEventText (std::string desc);
|
||||
|
||||
int getArtClassSerial() const; //0 - treasure, 1 - minor, 2 - major, 3 - relic, 4 - spell scroll, 5 - other
|
||||
std::string nodeName() const OVERRIDE;
|
||||
|
@ -823,6 +823,8 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, CLegacyConfigPars
|
||||
b.type = Bonus::DEATH_STARE;
|
||||
b.subtype = 0; //Gorgon
|
||||
break;
|
||||
case 'F':
|
||||
b.type = Bonus::FEAR; break;
|
||||
case 'g':
|
||||
b.type = Bonus::SPELL_DAMAGE_REDUCTION;
|
||||
b.subtype = -1; //all magic schools
|
||||
@ -988,7 +990,9 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, CLegacyConfigPars
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
case 'c': //some special abilities are threated as spells, work in progress
|
||||
case 'c':
|
||||
case 'K':
|
||||
case 'k':
|
||||
b.type = Bonus::SPELL_AFTER_ATTACK;
|
||||
b.subtype = stringToNumber(mod);
|
||||
break;
|
||||
@ -997,10 +1001,15 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, CLegacyConfigPars
|
||||
b.subtype = stringToNumber(mod);
|
||||
break;
|
||||
case 'p':
|
||||
case 'J':
|
||||
b.type = Bonus::SPELL_BEFORE_ATTACK;
|
||||
b.subtype = stringToNumber(mod);
|
||||
b.additionalInfo = 3; //always expert?
|
||||
break;
|
||||
case 'r':
|
||||
b.type = Bonus::HP_REGENERATION;
|
||||
b.val = stringToNumber(mod);
|
||||
break;
|
||||
case 's':
|
||||
b.type = Bonus::ENCHANTED;
|
||||
b.subtype = stringToNumber(mod);
|
||||
|
@ -173,6 +173,10 @@ void MetaString::getLocalString(const std::pair<ui8,ui32> &txt, std::string &dst
|
||||
{
|
||||
dst = VLC->arth->artifacts[ser]->Description();
|
||||
}
|
||||
else if (type == ART_EVNTS)
|
||||
{
|
||||
dst = VLC->arth->artifacts[ser]->EventText();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<std::string> *vec;
|
||||
@ -202,9 +206,6 @@ void MetaString::getLocalString(const std::pair<ui8,ui32> &txt, std::string &dst
|
||||
case ADVOB_TXT:
|
||||
vec = &VLC->generaltexth->advobtxt;
|
||||
break;
|
||||
case ART_EVNTS:
|
||||
vec = &VLC->generaltexth->artifEvents;
|
||||
break;
|
||||
case SEC_SKILL_NAME:
|
||||
vec = &VLC->generaltexth->skillName;
|
||||
break;
|
||||
|
@ -166,7 +166,6 @@ void CGeneralTextHandler::load()
|
||||
readToVector("DATA/TVRNINFO.TXT", tavernInfo);
|
||||
readToVector("DATA/TURNDUR.TXT", turnDurations);
|
||||
readToVector("DATA/HEROSCRN.TXT", heroscrn);
|
||||
readToVector("DATA/ARTEVENT.TXT", artifEvents);
|
||||
readToVector("DATA/TENTCOLR.TXT", tentColors);
|
||||
readToVector("DATA/SKILLLEV.TXT", levels);
|
||||
readToVector("DATA/OBJNAMES.TXT", names);
|
||||
|
@ -67,11 +67,6 @@ public:
|
||||
std::vector<std::string> capColors; //names of player colors with first letter capitalized ("Red",...)
|
||||
std::vector<std::string> turnDurations; //turn durations for pregame (1 Minute ... Unlimited)
|
||||
|
||||
//artifacts
|
||||
std::vector<std::string> artifEvents;
|
||||
std::vector<std::string> artifNames;
|
||||
std::vector<std::string> artifDescriptions;
|
||||
|
||||
//towns
|
||||
std::vector<std::string> tcommands, hcommands, fcommands; //texts for town screen, town hall screen and fort screen
|
||||
std::vector<std::string> tavernInfo;
|
||||
|
@ -3790,7 +3790,7 @@ void CGArtifact::onHeroVisit( const CGHeroInstance * h ) const
|
||||
if(message.length())
|
||||
iw.text << message;
|
||||
else
|
||||
iw.text << std::pair<ui8,ui32>(12,subID);
|
||||
iw.text << std::pair<ui8, ui32> (MetaString::ART_EVNTS, subID);
|
||||
}
|
||||
break;
|
||||
case Obj::SPELL_SCROLL:
|
||||
|
@ -4623,13 +4623,6 @@ void CGameHandler::stackTurnTrigger(const CStack * st)
|
||||
}
|
||||
else
|
||||
sse.stacks.push_back (st->ID);
|
||||
//from handleSpellCasting
|
||||
//SetStackEffect sse;
|
||||
//Bonus pseudoBonus;
|
||||
//pseudoBonus.sid = spellID;
|
||||
//pseudoBonus.val = spellLvl;
|
||||
//pseudoBonus.turnsRemain = gs->curB->calculateSpellDuration(spell, caster, stackSpellPower ? stackSpellPower : usedSpellPower);
|
||||
//CStack::stackEffectToFeature(sse.effect, pseudoBonus);
|
||||
|
||||
Bonus pseudoBonus;
|
||||
pseudoBonus.sid = b->subtype;
|
||||
|
Loading…
Reference in New Issue
Block a user