Implemented stack artifact handling, no tested yet
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
BIN
Mods/vcmi/Sprites/stackWindow/cancel-normal.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
Mods/vcmi/Sprites/stackWindow/cancel-pressed.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
8
Mods/vcmi/Sprites/stackWindow/cancelButton.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"basepath" : "stackWindow/",
|
||||
"images" :
|
||||
[
|
||||
{ "frame" : 0, "file" : "cancel-normal.png"},
|
||||
{ "frame" : 1, "file" : "cancel-pressed.png"}
|
||||
]
|
||||
}
|
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.2 KiB |
@ -1,8 +0,0 @@
|
||||
{
|
||||
"basepath" : "stackWindow/",
|
||||
"images" :
|
||||
[
|
||||
{ "frame" : 0, "file" : "switch-mode-normal.png"},
|
||||
{ "frame" : 1, "file" : "switch-mode-pressed.png"}
|
||||
]
|
||||
}
|
@ -226,7 +226,32 @@ void CStackWindow::CWindowSection::createStackInfo(bool showExp, bool showArt)
|
||||
auto luck = new MoraleLuckBox(false, genRect(42, 42, 375, 110));
|
||||
luck->set(parent->info->stackNode);
|
||||
|
||||
//TODO: stack artifact
|
||||
//TODO: TEST
|
||||
//TODO: delete "pass artifact" button on removal
|
||||
//TODO: refactor into give art / take art methods
|
||||
if (showArt)
|
||||
{
|
||||
const CStackInstance * stack = parent->info->stackNode;
|
||||
if (stack->getArt(ArtifactPosition::CREATURE_SLOT))
|
||||
{
|
||||
auto art = stack->getArt(ArtifactPosition::CREATURE_SLOT);
|
||||
|
||||
Point pos = showExp ? Point(375, 32) : Point(347, 32);
|
||||
parent->stackArtifactIcon = new CAnimImage("ARTIFACT", art->artType->iconIndex, 0, pos.x, pos.y);
|
||||
parent->stackArtifactHelp = new LRClickableAreaWTextComp(Rect(pos, Point(44, 44)), CComponent::artifact);
|
||||
parent->stackArtifactHelp->type = art->artType->id;
|
||||
|
||||
const JsonNode & text = VLC->generaltexth->localizedTexts["creatureWindow"]["returnArtifact"];
|
||||
|
||||
if (parent->info->owner)
|
||||
{
|
||||
new CAdventureMapButton(text["label"].String(), text["help"].String(),[=]{
|
||||
LOCPLINT->cb->swapArtifacts(ArtifactLocation(stack, ArtifactPosition::CREATURE_SLOT),
|
||||
ArtifactLocation(parent->info->owner, art->firstBackpackSlot(parent->info->owner)));
|
||||
}, pos.x - 2 , pos.y + 46, "stackWindow/cancelButton");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showExp)
|
||||
{
|
||||
@ -481,7 +506,6 @@ void CStackWindow::CWindowSection::createBonuses(boost::optional<size_t> preferr
|
||||
|
||||
void CStackWindow::CWindowSection::createButtonPanel()
|
||||
{
|
||||
//TODO: localization, place creature icon on button, proper path to animation-button
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
||||
createBackground("button-panel");
|
||||
|
||||
@ -647,8 +671,8 @@ void CStackWindow::initSections()
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
||||
CWindowSection * currentSection;
|
||||
|
||||
bool showArt = CGI->modh->modules.STACK_ARTIFACT && info->commander == nullptr;
|
||||
bool showExp = CGI->modh->modules.STACK_EXP || info->commander != nullptr;
|
||||
bool showArt = CGI->modh->modules.STACK_ARTIFACT && info->commander == nullptr && info->stackNode;
|
||||
bool showExp = (CGI->modh->modules.STACK_EXP || info->commander != nullptr) && info->stackNode;
|
||||
currentSection = new CWindowSection(this);
|
||||
currentSection->createStackInfo(showExp, showArt);
|
||||
pos.w = currentSection->pos.w;
|
||||
@ -732,6 +756,9 @@ void CStackWindow::initBonusesList()
|
||||
|
||||
void CStackWindow::init()
|
||||
{
|
||||
stackArtifactHelp = nullptr;
|
||||
stackArtifactIcon = nullptr;
|
||||
|
||||
selectedIcon = nullptr;
|
||||
selectedSkill = 0;
|
||||
if (info->levelupInfo)
|
||||
|
@ -18,6 +18,7 @@ class CCommanderInstance;
|
||||
class CStackInstance;
|
||||
class CStack;
|
||||
struct UpgradeInfo;
|
||||
class LRClickableAreaWTextComp;
|
||||
|
||||
class CClickableObject : public LRClickableAreaWText
|
||||
{
|
||||
@ -68,6 +69,9 @@ class CStackWindow : public CWindowObject
|
||||
CWindowSection(CStackWindow * parent);
|
||||
};
|
||||
|
||||
CAnimImage * stackArtifactIcon;
|
||||
LRClickableAreaWTextComp * stackArtifactHelp;
|
||||
|
||||
std::unique_ptr<StackWindowInfo> info;
|
||||
std::vector<BonusInfo> activeBonuses;
|
||||
size_t activeTab;
|
||||
|
@ -66,6 +66,11 @@
|
||||
{
|
||||
"label" : "Switch to skills view",
|
||||
"help" : "Displays all learned skills of the commander"
|
||||
},
|
||||
"returnArtifact" :
|
||||
{
|
||||
"label" : "Give back artifact",
|
||||
"help" : "Use this button to return stack artifact back into hero backpack"
|
||||
}
|
||||
}
|
||||
}
|
||||
|