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

Add sane aliases for cheat names + "vcmiazure" "vcmifaerie" cheats

This commit is contained in:
Dydzio 2023-01-23 18:56:00 +01:00
parent a19c9eccc4
commit d5b02f8dc2

View File

@ -7032,7 +7032,7 @@ void CGameHandler::spawnWanderingMonsters(CreatureID creatureID)
void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, const CGHeroInstance * hero, const CGTownInstance * town, bool & cheated)
{
if (cheat == "vcmiistari")
if (cheat == "vcmiistari" || cheat == "vcmispells")
{
cheated = true;
if (!hero) return;
@ -7058,7 +7058,7 @@ void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, cons
sm.absolute = true;
sendAndApply(&sm);
}
else if (cheat == "vcmiarmenelos")
else if (cheat == "vcmiarmenelos" || cheat == "vcmibuild")
{
cheated = true;
if (!town) return;
@ -7073,7 +7073,8 @@ void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, cons
}
}
}
else if (cheat == "vcmiainur" || cheat == "vcmiangband" || cheat == "vcmiglaurung")
else if (cheat == "vcmiainur" || cheat == "vcmiangband" || cheat == "vcmiglaurung" || cheat == "vcmiarchangel"
|| cheat == "vcmiblackknight" || cheat == "vcmicrystal" || cheat == "vcmiazure" || cheat == "vcmifaerie")
{
cheated = true;
if (!hero) return;
@ -7082,13 +7083,18 @@ void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, cons
creatures.insert(std::make_pair("vcmiainur", std::make_pair(13, 5))); //5 archangels
creatures.insert(std::make_pair("vcmiangband", std::make_pair(66, 10))); //10 black knights
creatures.insert(std::make_pair("vcmiglaurung", std::make_pair(133, 5000))); //5000 crystal dragons
creatures.insert(std::make_pair("vcmiarchangel", std::make_pair(13, 5))); //5 archangels
creatures.insert(std::make_pair("vcmiblackknight", std::make_pair(66, 10))); //10 black knights
creatures.insert(std::make_pair("vcmicrystal", std::make_pair(133, 5000))); //5000 crystal dragons
creatures.insert(std::make_pair("vcmiazure", std::make_pair(132, 5000))); //5000 azure dragons
creatures.insert(std::make_pair("vcmifaerie", std::make_pair(134, 5000))); //5000 faerie dragons
const CCreature * creature = VLC->creh->objects.at(creatures[cheat].first);
for (int i = 0; i < GameConstants::ARMY_SIZE; i++)
if (!hero->hasStackAtSlot(SlotID(i)))
insertNewStack(StackLocation(hero, SlotID(i)), creature, creatures[cheat].second);
}
else if (cheat == "vcminoldor")
else if (cheat == "vcminoldor" || cheat == "vcmimachines")
{
cheated = true;
if (!hero) return;
@ -7100,7 +7106,7 @@ void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, cons
if (!hero->getArt(ArtifactPosition::MACH3))
giveHeroNewArtifact(hero, VLC->arth->objects[ArtifactID::FIRST_AID_TENT], ArtifactPosition::MACH3);
}
else if (cheat == "vcmiforgeofnoldorking")
else if (cheat == "vcmiforgeofnoldorking" || cheat == "vcmiartifacts")
{
cheated = true;
if (!hero) return;
@ -7108,14 +7114,14 @@ void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, cons
for (int g = 7; g < VLC->arth->objects.size(); ++g) //including artifacts from mods
giveHeroNewArtifact(hero, VLC->arth->objects[g], ArtifactPosition::PRE_FIRST);
}
else if (cheat == "vcmiglorfindel")
else if (cheat == "vcmiglorfindel" || cheat == "vcmilevel")
{
cheated = true;
if (!hero) return;
///selected hero gains a new level
changePrimSkill(hero, PrimarySkill::EXPERIENCE, VLC->heroh->reqExp(hero->level + 1) - VLC->heroh->reqExp(hero->level));
}
else if (cheat == "vcminahar")
else if (cheat == "vcminahar" || cheat == "vcmimove")
{
cheated = true;
if (!hero) return;
@ -7132,7 +7138,7 @@ void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, cons
gb.id = hero->id.getNum();
giveHeroBonus(&gb);
}
else if (cheat == "vcmiformenos")
else if (cheat == "vcmiformenos" || cheat == "vcmiresources")
{
cheated = true;
///Give resources to player
@ -7143,7 +7149,7 @@ void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, cons
giveResources(player, resources);
}
else if (cheat == "vcmisilmaril")
else if (cheat == "vcmisilmaril" || cheat == "vcmiwin")
{
cheated = true;
///Player wins
@ -7152,7 +7158,7 @@ void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, cons
pc.winningCheatCode = true;
sendAndApply(&pc);
}
else if (cheat == "vcmimelkor")
else if (cheat == "vcmimelkor" || cheat == "vcmilose")
{
cheated = true;
///Player looses
@ -7161,12 +7167,12 @@ void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, cons
pc.losingCheatCode = true;
sendAndApply(&pc);
}
else if (cheat == "vcmieagles" || cheat == "vcmiungoliant")
else if (cheat == "vcmieagles" || cheat == "vcmiungoliant" || cheat == "vcmimap" || cheat == "vcmihidemap")
{
cheated = true;
///Reveal or conceal FoW
FoWChange fc;
fc.mode = (cheat == "vcmieagles" ? 1 : 0);
fc.mode = ((cheat == "vcmieagles" || cheat == "vcmimap") ? 1 : 0);
fc.player = player;
const auto & fowMap = gs->getPlayerTeam(player)->fogOfWarMap;
auto hlp_tab = new int3[gs->map->width * gs->map->height * (gs->map->levels())];