mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
commit
4949b98ed3
@ -466,6 +466,9 @@ void CInteractableTownTooltip::init(const CGTownInstance * town)
|
|||||||
if(town->id == townId && town->builtBuildings.count(BuildingID::TAVERN))
|
if(town->id == townId && town->builtBuildings.count(BuildingID::TAVERN))
|
||||||
LOCPLINT->showTavernWindow(town, nullptr, QueryID::NONE);
|
LOCPLINT->showTavernWindow(town, nullptr, QueryID::NONE);
|
||||||
}
|
}
|
||||||
|
}, [&]{
|
||||||
|
if(!town->town->faction->getDescriptionTranslated().empty())
|
||||||
|
CRClickPopup::createAndPush(town->town->faction->getDescriptionTranslated());
|
||||||
});
|
});
|
||||||
fastMarket = std::make_shared<LRClickableArea>(Rect(143, 31, 30, 34), []()
|
fastMarket = std::make_shared<LRClickableArea>(Rect(143, 31, 30, 34), []()
|
||||||
{
|
{
|
||||||
|
@ -1351,6 +1351,9 @@ void CCastleInterface::recreateIcons()
|
|||||||
{
|
{
|
||||||
if(town->builtBuildings.count(BuildingID::TAVERN))
|
if(town->builtBuildings.count(BuildingID::TAVERN))
|
||||||
LOCPLINT->showTavernWindow(town, nullptr, QueryID::NONE);
|
LOCPLINT->showTavernWindow(town, nullptr, QueryID::NONE);
|
||||||
|
}, [&]{
|
||||||
|
if(!town->town->faction->getDescriptionTranslated().empty())
|
||||||
|
CRClickPopup::createAndPush(town->town->faction->getDescriptionTranslated());
|
||||||
});
|
});
|
||||||
|
|
||||||
creainfo.clear();
|
creainfo.clear();
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "../widgets/Images.h"
|
#include "../widgets/Images.h"
|
||||||
#include "../widgets/TextControls.h"
|
#include "../widgets/TextControls.h"
|
||||||
#include "../widgets/ObjectLists.h"
|
#include "../widgets/ObjectLists.h"
|
||||||
|
#include "../windows/InfoWindows.h"
|
||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
#include "../gui/Shortcut.h"
|
#include "../gui/Shortcut.h"
|
||||||
|
|
||||||
@ -517,6 +518,10 @@ CStackWindow::MainSection::MainSection(CStackWindow * owner, int yOffset, bool s
|
|||||||
};
|
};
|
||||||
|
|
||||||
animation = std::make_shared<CCreaturePic>(5, 41, parent->info->creature);
|
animation = std::make_shared<CCreaturePic>(5, 41, parent->info->creature);
|
||||||
|
animationArea = std::make_shared<LRClickableArea>(Rect(5, 41, 100, 130), nullptr, [&]{
|
||||||
|
if(!parent->info->creature->getDescriptionTranslated().empty())
|
||||||
|
CRClickPopup::createAndPush(parent->info->creature->getDescriptionTranslated());
|
||||||
|
});
|
||||||
|
|
||||||
if(parent->info->stackNode != nullptr && parent->info->commander == nullptr)
|
if(parent->info->stackNode != nullptr && parent->info->commander == nullptr)
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,7 @@ class CButton;
|
|||||||
class CMultiLineLabel;
|
class CMultiLineLabel;
|
||||||
class CListBox;
|
class CListBox;
|
||||||
class CCommanderArtPlace;
|
class CCommanderArtPlace;
|
||||||
|
class LRClickableArea;
|
||||||
|
|
||||||
class CCommanderSkillIcon : public LRClickableAreaWText //TODO: maybe bring commander skill button initialization logic inside?
|
class CCommanderSkillIcon : public LRClickableAreaWText //TODO: maybe bring commander skill button initialization logic inside?
|
||||||
{
|
{
|
||||||
@ -132,6 +133,7 @@ class CStackWindow : public CWindowObject
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::shared_ptr<CCreaturePic> animation;
|
std::shared_ptr<CCreaturePic> animation;
|
||||||
|
std::shared_ptr<LRClickableArea> animationArea;
|
||||||
std::shared_ptr<CLabel> name;
|
std::shared_ptr<CLabel> name;
|
||||||
std::shared_ptr<CPicture> icons;
|
std::shared_ptr<CPicture> icons;
|
||||||
std::shared_ptr<MoraleLuckBox> morale;
|
std::shared_ptr<MoraleLuckBox> morale;
|
||||||
|
@ -811,6 +811,9 @@ CTownItem::CTownItem(const CGTownInstance * Town)
|
|||||||
{
|
{
|
||||||
if(town->builtBuildings.count(BuildingID::TAVERN))
|
if(town->builtBuildings.count(BuildingID::TAVERN))
|
||||||
LOCPLINT->showTavernWindow(town, nullptr, QueryID::NONE);
|
LOCPLINT->showTavernWindow(town, nullptr, QueryID::NONE);
|
||||||
|
}, [&]{
|
||||||
|
if(!town->town->faction->getDescriptionTranslated().empty())
|
||||||
|
CRClickPopup::createAndPush(town->town->faction->getDescriptionTranslated());
|
||||||
});
|
});
|
||||||
fastMarket = std::make_shared<LRClickableArea>(Rect(153, 6, 65, 64), []()
|
fastMarket = std::make_shared<LRClickableArea>(Rect(153, 6, 65, 64), []()
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"description" : {
|
||||||
|
"type" : "string",
|
||||||
|
"description" : "Description of creature"
|
||||||
|
},
|
||||||
"faction" : {
|
"faction" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"description" : "Faction this creature belongs to. Examples: castle, rampart"
|
"description" : "Faction this creature belongs to. Examples: castle, rampart"
|
||||||
|
@ -40,6 +40,10 @@
|
|||||||
"type" : "string",
|
"type" : "string",
|
||||||
"description" : "Localizable faction name, e.g. Rampart"
|
"description" : "Localizable faction name, e.g. Rampart"
|
||||||
},
|
},
|
||||||
|
"description" : {
|
||||||
|
"type" : "string",
|
||||||
|
"description" : "Description about the faction"
|
||||||
|
},
|
||||||
"alignment" : {
|
"alignment" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"enum" : [ "good", "neutral", "evil" ],
|
"enum" : [ "good", "neutral", "evil" ],
|
||||||
|
@ -29,6 +29,10 @@ In order to make functional creature you also need:
|
|||||||
"singular" : "Creature",
|
"singular" : "Creature",
|
||||||
"plural" : "Creatures"
|
"plural" : "Creatures"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Description of creature
|
||||||
|
"description" : "",
|
||||||
|
|
||||||
"level" : 0,
|
"level" : 0,
|
||||||
|
|
||||||
// Marks this object as special and not available by default
|
// Marks this object as special and not available by default
|
||||||
|
@ -57,6 +57,9 @@ Each town requires a set of buildings (Around 30-45 buildings)
|
|||||||
// Localizable faction name, e.g. "Rampart"
|
// Localizable faction name, e.g. "Rampart"
|
||||||
"name" : "",
|
"name" : "",
|
||||||
|
|
||||||
|
// Description of town (e.g. history or story about town)
|
||||||
|
"description" : "",
|
||||||
|
|
||||||
// Faction alignment. Can be good, neutral (default) or evil.
|
// Faction alignment. Can be good, neutral (default) or evil.
|
||||||
"alignment" : "",
|
"alignment" : "",
|
||||||
|
|
||||||
|
@ -199,6 +199,11 @@ std::string CCreature::getNameTextID() const
|
|||||||
return getNameSingularTextID();
|
return getNameSingularTextID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CCreature::getDescriptionTranslated() const
|
||||||
|
{
|
||||||
|
return VLC->generaltexth->translate(getDescriptionTextID());
|
||||||
|
}
|
||||||
|
|
||||||
std::string CCreature::getNamePluralTextID() const
|
std::string CCreature::getNamePluralTextID() const
|
||||||
{
|
{
|
||||||
return TextIdentifier("creatures", modScope, identifier, "name", "plural" ).get();
|
return TextIdentifier("creatures", modScope, identifier, "name", "plural" ).get();
|
||||||
@ -209,6 +214,11 @@ std::string CCreature::getNameSingularTextID() const
|
|||||||
return TextIdentifier("creatures", modScope, identifier, "name", "singular" ).get();
|
return TextIdentifier("creatures", modScope, identifier, "name", "singular" ).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CCreature::getDescriptionTextID() const
|
||||||
|
{
|
||||||
|
return TextIdentifier("creatures", modScope, identifier, "description").get();
|
||||||
|
}
|
||||||
|
|
||||||
CCreature::CreatureQuantityId CCreature::getQuantityID(const int & quantity)
|
CCreature::CreatureQuantityId CCreature::getQuantityID(const int & quantity)
|
||||||
{
|
{
|
||||||
if (quantity<5)
|
if (quantity<5)
|
||||||
@ -600,6 +610,7 @@ CCreature * CCreatureHandler::loadFromJson(const std::string & scope, const Json
|
|||||||
|
|
||||||
VLC->generaltexth->registerString(scope, cre->getNameSingularTextID(), node["name"]["singular"].String());
|
VLC->generaltexth->registerString(scope, cre->getNameSingularTextID(), node["name"]["singular"].String());
|
||||||
VLC->generaltexth->registerString(scope, cre->getNamePluralTextID(), node["name"]["plural"].String());
|
VLC->generaltexth->registerString(scope, cre->getNamePluralTextID(), node["name"]["plural"].String());
|
||||||
|
VLC->generaltexth->registerString(scope, cre->getDescriptionTextID(), node["description"].String());
|
||||||
|
|
||||||
cre->addBonus(node["hitPoints"].Integer(), BonusType::STACK_HEALTH);
|
cre->addBonus(node["hitPoints"].Integer(), BonusType::STACK_HEALTH);
|
||||||
cre->addBonus(node["speed"].Integer(), BonusType::STACKS_SPEED);
|
cre->addBonus(node["speed"].Integer(), BonusType::STACKS_SPEED);
|
||||||
|
@ -51,6 +51,9 @@ class DLL_LINKAGE CCreature : public Creature, public CBonusSystemNode
|
|||||||
TResources cost; //cost[res_id] - amount of that resource required to buy creature from dwelling
|
TResources cost; //cost[res_id] - amount of that resource required to buy creature from dwelling
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
std::string getDescriptionTranslated() const;
|
||||||
|
std::string getDescriptionTextID() const;
|
||||||
|
|
||||||
ui32 ammMin; // initial size of stack of these creatures on adventure map (if not set in editor)
|
ui32 ammMin; // initial size of stack of these creatures on adventure map (if not set in editor)
|
||||||
ui32 ammMax;
|
ui32 ammMax;
|
||||||
|
|
||||||
|
@ -188,6 +188,16 @@ std::string CFaction::getNameTextID() const
|
|||||||
return TextIdentifier("faction", modScope, identifier, "name").get();
|
return TextIdentifier("faction", modScope, identifier, "name").get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CFaction::getDescriptionTranslated() const
|
||||||
|
{
|
||||||
|
return VLC->generaltexth->translate(getDescriptionTextID());
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CFaction::getDescriptionTextID() const
|
||||||
|
{
|
||||||
|
return TextIdentifier("faction", modScope, identifier, "description").get();
|
||||||
|
}
|
||||||
|
|
||||||
FactionID CFaction::getId() const
|
FactionID CFaction::getId() const
|
||||||
{
|
{
|
||||||
return FactionID(index);
|
return FactionID(index);
|
||||||
@ -1037,6 +1047,7 @@ CFaction * CTownHandler::loadFromJson(const std::string & scope, const JsonNode
|
|||||||
faction->identifier = identifier;
|
faction->identifier = identifier;
|
||||||
|
|
||||||
VLC->generaltexth->registerString(scope, faction->getNameTextID(), source["name"].String());
|
VLC->generaltexth->registerString(scope, faction->getNameTextID(), source["name"].String());
|
||||||
|
VLC->generaltexth->registerString(scope, faction->getDescriptionTranslated(), source["description"].String());
|
||||||
|
|
||||||
faction->creatureBg120 = ImagePath::fromJson(source["creatureBackground"]["120px"]);
|
faction->creatureBg120 = ImagePath::fromJson(source["creatureBackground"]["120px"]);
|
||||||
faction->creatureBg130 = ImagePath::fromJson(source["creatureBackground"]["130px"]);
|
faction->creatureBg130 = ImagePath::fromJson(source["creatureBackground"]["130px"]);
|
||||||
|
@ -192,6 +192,8 @@ public:
|
|||||||
|
|
||||||
std::string getNameTranslated() const override;
|
std::string getNameTranslated() const override;
|
||||||
std::string getNameTextID() const override;
|
std::string getNameTextID() const override;
|
||||||
|
std::string getDescriptionTranslated() const;
|
||||||
|
std::string getDescriptionTextID() const;
|
||||||
|
|
||||||
bool hasTown() const override;
|
bool hasTown() const override;
|
||||||
TerrainId getNativeTerrain() const override;
|
TerrainId getNativeTerrain() const override;
|
||||||
|
Loading…
Reference in New Issue
Block a user