1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Merge pull request #1816 from krs0/feature/all_cheats_should_have_lotr_equivalent

Added LotR alternatives for vcmiarmy and vcmiexp
This commit is contained in:
Ivan Savenko
2023-04-02 20:08:33 +03:00
committed by GitHub

View File

@@ -5024,7 +5024,7 @@ void CGameHandler::playerMessage(PlayerColor player, const std::string &message,
} }
int obj = 0; int obj = 0;
if (words.size() == 2 && words[0] != "vcmiexp") if (words.size() == 2 && words[0] != "vcmiexp" && words[0] != "vcmiolorin")
{ {
obj = std::atoi(words[1].c_str()); obj = std::atoi(words[1].c_str());
if (obj) if (obj)
@@ -5036,7 +5036,7 @@ void CGameHandler::playerMessage(PlayerColor player, const std::string &message,
if (!town && hero) if (!town && hero)
town = hero->visitedTown; town = hero->visitedTown;
if((words[0] == "vcmiarmy" || words[0] == "vcmiexp") && words.size() > 1) if(words.size() > 1 && (words[0] == "vcmiarmy" || words[0] == "vcminissi" || words[0] == "vcmiexp" || words[0] == "vcmiolorin"))
{ {
std::string cheatCodeWithOneParameter = std::string(words[0]) + " " + words[1]; std::string cheatCodeWithOneParameter = std::string(words[0]) + " " + words[1];
handleCheatCode(cheatCodeWithOneParameter, player, hero, town, cheated); handleCheatCode(cheatCodeWithOneParameter, player, hero, town, cheated);
@@ -7004,7 +7004,7 @@ void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, cons
if (!hero->hasStackAtSlot(SlotID(i))) if (!hero->hasStackAtSlot(SlotID(i)))
insertNewStack(StackLocation(hero, SlotID(i)), creature, creatures[cheat].second); insertNewStack(StackLocation(hero, SlotID(i)), creature, creatures[cheat].second);
} }
else if (boost::starts_with(cheat, "vcmiarmy")) else if (boost::starts_with(cheat, "vcmiarmy") || boost::starts_with(cheat, "vcminissi"))
{ {
cheated = true; cheated = true;
if (!hero) return; if (!hero) return;
@@ -7055,7 +7055,7 @@ void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, cons
///selected hero gains a new level ///selected hero gains a new level
changePrimSkill(hero, PrimarySkill::EXPERIENCE, VLC->heroh->reqExp(hero->level + 1) - VLC->heroh->reqExp(hero->level)); changePrimSkill(hero, PrimarySkill::EXPERIENCE, VLC->heroh->reqExp(hero->level + 1) - VLC->heroh->reqExp(hero->level));
} }
else if (boost::starts_with(cheat, "vcmiexp")) else if (boost::starts_with(cheat, "vcmiexp") || boost::starts_with(cheat, "vcmiolorin"))
{ {
cheated = true; cheated = true;
if (!hero) return; if (!hero) return;