mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
puzzle map cheat
This commit is contained in:
@@ -57,6 +57,10 @@ Alternative usage: `vcmilevel <amount>` - advances hero by specified number of l
|
|||||||
- `vcmiolorin` or `vcmiexp` - gives selected hero 10000 experience
|
- `vcmiolorin` or `vcmiexp` - gives selected hero 10000 experience
|
||||||
Alternative usage: `vcmiexp <amount>` - gives selected hero specified amount of experience
|
Alternative usage: `vcmiexp <amount>` - gives selected hero specified amount of experience
|
||||||
|
|
||||||
|
### Puzzle map
|
||||||
|
|
||||||
|
`nwcoracle` - reveals the puzzle map
|
||||||
|
|
||||||
### Finishing the game
|
### Finishing the game
|
||||||
|
|
||||||
`nwcredpill` or `vcmisilmaril` or `vcmiwin` - player wins
|
`nwcredpill` or `vcmisilmaril` or `vcmiwin` - player wins
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "../../lib/mapObjects/CGTownInstance.h"
|
#include "../../lib/mapObjects/CGTownInstance.h"
|
||||||
#include "../../lib/modding/IdentifierStorage.h"
|
#include "../../lib/modding/IdentifierStorage.h"
|
||||||
#include "../../lib/modding/ModScope.h"
|
#include "../../lib/modding/ModScope.h"
|
||||||
|
#include "../../lib/mapping/CMap.h"
|
||||||
#include "../../lib/networkPacks/PacksForClient.h"
|
#include "../../lib/networkPacks/PacksForClient.h"
|
||||||
#include "../../lib/networkPacks/StackLocation.h"
|
#include "../../lib/networkPacks/StackLocation.h"
|
||||||
|
|
||||||
@@ -365,6 +366,23 @@ void PlayerMessageProcessor::cheatMapReveal(PlayerColor player, bool reveal)
|
|||||||
gameHandler->sendAndApply(&fc);
|
gameHandler->sendAndApply(&fc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlayerMessageProcessor::cheatPuzzleReveal(PlayerColor player)
|
||||||
|
{
|
||||||
|
TeamState *t = gameHandler->gameState()->getPlayerTeam(player);
|
||||||
|
|
||||||
|
for(auto & obj : gameHandler->gameState()->map->objects)
|
||||||
|
{
|
||||||
|
if(obj->ID == Obj::OBELISK)
|
||||||
|
{
|
||||||
|
gameHandler->setObjPropertyID(obj->id, ObjProperty::OBELISK_VISITED, t->id);
|
||||||
|
for(const auto & color : t->players)
|
||||||
|
{
|
||||||
|
gameHandler->setObjPropertyID(obj->id, ObjProperty::VISITED, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool PlayerMessageProcessor::handleCheatCode(const std::string & cheat, PlayerColor player, ObjectInstanceID currObj)
|
bool PlayerMessageProcessor::handleCheatCode(const std::string & cheat, PlayerColor player, ObjectInstanceID currObj)
|
||||||
{
|
{
|
||||||
std::vector<std::string> words;
|
std::vector<std::string> words;
|
||||||
@@ -383,7 +401,8 @@ bool PlayerMessageProcessor::handleCheatCode(const std::string & cheat, PlayerCo
|
|||||||
"vcmimelkor", "vcmilose", "nwcbluepill",
|
"vcmimelkor", "vcmilose", "nwcbluepill",
|
||||||
"vcmisilmaril", "vcmiwin", "nwcredpill",
|
"vcmisilmaril", "vcmiwin", "nwcredpill",
|
||||||
"vcmieagles", "vcmimap", "nwcwhatisthematrix",
|
"vcmieagles", "vcmimap", "nwcwhatisthematrix",
|
||||||
"vcmiungoliant", "vcmihidemap", "nwcignoranceisbliss"
|
"vcmiungoliant", "vcmihidemap", "nwcignoranceisbliss",
|
||||||
|
"nwcoracle"
|
||||||
};
|
};
|
||||||
std::vector<std::string> heroTargetedCheats = {
|
std::vector<std::string> heroTargetedCheats = {
|
||||||
"vcmiainur", "vcmiarchangel", "nwctrinity",
|
"vcmiainur", "vcmiarchangel", "nwctrinity",
|
||||||
@@ -469,11 +488,11 @@ void PlayerMessageProcessor::executeCheatCode(const std::string & cheatName, Pla
|
|||||||
const auto & doCheatDefeat = [&]() { cheatDefeat(player); };
|
const auto & doCheatDefeat = [&]() { cheatDefeat(player); };
|
||||||
const auto & doCheatMapReveal = [&]() { cheatMapReveal(player, true); };
|
const auto & doCheatMapReveal = [&]() { cheatMapReveal(player, true); };
|
||||||
const auto & doCheatMapHide = [&]() { cheatMapReveal(player, false); };
|
const auto & doCheatMapHide = [&]() { cheatMapReveal(player, false); };
|
||||||
|
const auto & doCheatRevealPuzzle = [&]() { cheatPuzzleReveal(player); };
|
||||||
|
|
||||||
// Unimplemented H3 cheats:
|
// Unimplemented H3 cheats:
|
||||||
// nwcfollowthewhiterabbit - The currently selected hero permanently gains maximum luck.
|
// nwcfollowthewhiterabbit - The currently selected hero permanently gains maximum luck.
|
||||||
// nwcmorpheus - The currently selected hero permanently gains maximum morale.
|
// nwcmorpheus - The currently selected hero permanently gains maximum morale.
|
||||||
// nwcoracle - The puzzle map is permanently revealed.
|
|
||||||
// nwcphisherprice - Changes and brightens the game colors.
|
// nwcphisherprice - Changes and brightens the game colors.
|
||||||
|
|
||||||
std::map<std::string, std::function<void()>> callbacks = {
|
std::map<std::string, std::function<void()>> callbacks = {
|
||||||
@@ -523,6 +542,7 @@ void PlayerMessageProcessor::executeCheatCode(const std::string & cheatName, Pla
|
|||||||
{"vcmiungoliant", doCheatMapHide },
|
{"vcmiungoliant", doCheatMapHide },
|
||||||
{"vcmihidemap", doCheatMapHide },
|
{"vcmihidemap", doCheatMapHide },
|
||||||
{"nwcignoranceisbliss", doCheatMapHide },
|
{"nwcignoranceisbliss", doCheatMapHide },
|
||||||
|
{"nwcoracle", doCheatRevealPuzzle },
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(callbacks.count(cheatName));
|
assert(callbacks.count(cheatName));
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ class PlayerMessageProcessor
|
|||||||
void cheatVictory(PlayerColor player);
|
void cheatVictory(PlayerColor player);
|
||||||
void cheatDefeat(PlayerColor player);
|
void cheatDefeat(PlayerColor player);
|
||||||
void cheatMapReveal(PlayerColor player, bool reveal);
|
void cheatMapReveal(PlayerColor player, bool reveal);
|
||||||
|
void cheatPuzzleReveal(PlayerColor player);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CGameHandler * gameHandler;
|
CGameHandler * gameHandler;
|
||||||
|
|||||||
Reference in New Issue
Block a user