mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Necromancy & Eagle eye infowindows
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "CMT.h"
|
||||
#include "GameChatHandler.h"
|
||||
#include "CServerHandler.h"
|
||||
#include "UIHelper.h"
|
||||
|
||||
#include "../CCallback.h"
|
||||
#include "../lib/filesystem/Filesystem.h"
|
||||
@@ -851,22 +852,34 @@ void ApplyClientNetPackVisitor::visitStacksInjured(StacksInjured & pack)
|
||||
|
||||
void ApplyClientNetPackVisitor::visitBattleResultsApplied(BattleResultsApplied & pack)
|
||||
{
|
||||
InfoWindow win;
|
||||
win.player = pack.victor;
|
||||
win.text.appendLocalString(EMetaText::GENERAL_TXT, 30);
|
||||
if(!pack.learnedSpells.spells.empty())
|
||||
{
|
||||
const auto hero = GAME->interface()->cb->getHero(pack.learnedSpells.hid);
|
||||
assert(hero);
|
||||
callInterfaceIfPresent(cl, pack.victor, &CGameInterface::showInfoDialog, EInfoWindowMode::MODAL,
|
||||
UIHelper::getEagleEyeInfoWindowText(*hero, pack.learnedSpells.spells), UIHelper::getSpellsComponents(pack.learnedSpells.spells), soundBase::soundID(0));
|
||||
}
|
||||
|
||||
const auto artSet = GAME->interface()->cb->getArtSet(ArtifactLocation(pack.artifacts.front().dstArtHolder));
|
||||
assert(artSet);
|
||||
std::vector<Component> artComponents;
|
||||
for(const auto & artPack : pack.artifacts)
|
||||
{
|
||||
auto packComponents = GAME->interface()->artifactController->getMovedComponents(*artSet, artPack.artsPack0);
|
||||
win.components.insert(win.components.end(), std::make_move_iterator(packComponents.begin()), std::make_move_iterator(packComponents.end()));
|
||||
auto packComponents = UIHelper::getArtifactsComponents(*artSet, artPack.artsPack0);
|
||||
artComponents.insert(artComponents.end(), std::make_move_iterator(packComponents.begin()), std::make_move_iterator(packComponents.end()));
|
||||
}
|
||||
if(!win.components.empty())
|
||||
visitInfoWindow(win);
|
||||
if(!artComponents.empty())
|
||||
callInterfaceIfPresent(cl, pack.victor, &CGameInterface::showInfoDialog, EInfoWindowMode::MODAL, UIHelper::getArtifactsInfoWindowText(),
|
||||
artComponents, soundBase::soundID(0));
|
||||
|
||||
for(auto & artPack : pack.artifacts)
|
||||
visitBulkMoveArtifacts(artPack);
|
||||
|
||||
if(pack.raisedStack.getCreature())
|
||||
callInterfaceIfPresent(cl, pack.victor, &CGameInterface::showInfoDialog, EInfoWindowMode::AUTO,
|
||||
UIHelper::getNecromancyInfoWindowText(pack.raisedStack), std::vector<Component>{Component(ComponentType::CREATURE, pack.raisedStack.getId(),
|
||||
pack.raisedStack.count)}, UIHelper::getNecromancyInfoWindowSound());
|
||||
|
||||
callInterfaceIfPresent(cl, pack.victor, &IGameEventsReceiver::battleResultsApplied);
|
||||
callInterfaceIfPresent(cl, pack.loser, &IGameEventsReceiver::battleResultsApplied);
|
||||
callInterfaceIfPresent(cl, PlayerColor::SPECTATOR, &IGameEventsReceiver::battleResultsApplied);
|
||||
|
||||
Reference in New Issue
Block a user