1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Added "vcmiartifacts angelWings" form to cheat

This commit is contained in:
Ivan Savenko 2023-09-06 22:44:41 +03:00
parent d7fb2bcf83
commit e5719daf11
2 changed files with 18 additions and 6 deletions

View File

@ -211,15 +211,27 @@ void PlayerMessageProcessor::cheatGiveMachines(PlayerColor player, const CGHeroI
gameHandler->giveHeroNewArtifact(hero, VLC->arth->objects[ArtifactID::FIRST_AID_TENT], ArtifactPosition::MACH3);
}
void PlayerMessageProcessor::cheatGiveArtifacts(PlayerColor player, const CGHeroInstance * hero)
void PlayerMessageProcessor::cheatGiveArtifacts(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words)
{
if (!hero)
return;
for(int g = 7; g < VLC->arth->objects.size(); ++g) //including artifacts from mods
if (!words.empty())
{
if(VLC->arth->objects[g]->canBePutAt(hero))
gameHandler->giveHeroNewArtifact(hero, VLC->arth->objects[g], ArtifactPosition::FIRST_AVAILABLE);
for (auto const & word : words)
{
auto artID = VLC->modh->identifiers.getIdentifier(CModHandler::scopeGame(), "artifact", word, false);
if(artID && VLC->arth->objects[*artID])
gameHandler->giveHeroNewArtifact(hero, VLC->arth->objects[*artID], ArtifactPosition::FIRST_AVAILABLE);
}
}
else
{
for(int g = 7; g < VLC->arth->objects.size(); ++g) //including artifacts from mods
{
if(VLC->arth->objects[g]->canBePutAt(hero))
gameHandler->giveHeroNewArtifact(hero, VLC->arth->objects[g], ArtifactPosition::FIRST_AVAILABLE);
}
}
}
@ -432,7 +444,7 @@ void PlayerMessageProcessor::executeCheatCode(const std::string & cheatName, Pla
const auto & doCheatGiveArmyCustom = [&]() { cheatGiveArmy(player, hero, words); };
const auto & doCheatGiveArmyFixed = [&](std::vector<std::string> customWords) { cheatGiveArmy(player, hero, customWords); };
const auto & doCheatGiveMachines = [&]() { cheatGiveMachines(player, hero); };
const auto & doCheatGiveArtifacts = [&]() { cheatGiveArtifacts(player, hero); };
const auto & doCheatGiveArtifacts = [&]() { cheatGiveArtifacts(player, hero, words); };
const auto & doCheatLevelup = [&]() { cheatLevelup(player, hero, words); };
const auto & doCheatExperience = [&]() { cheatExperience(player, hero, words); };
const auto & doCheatMovement = [&]() { cheatMovement(player, hero, words); };

View File

@ -31,7 +31,7 @@ class PlayerMessageProcessor
void cheatBuildTown(PlayerColor player, const CGTownInstance * town);
void cheatGiveArmy(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
void cheatGiveMachines(PlayerColor player, const CGHeroInstance * hero);
void cheatGiveArtifacts(PlayerColor player, const CGHeroInstance * hero);
void cheatGiveArtifacts(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
void cheatLevelup(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
void cheatExperience(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
void cheatMovement(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);