ClientCommandManager.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * ClientCommandManager.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. VCMI_LIB_NAMESPACE_BEGIN
  12. class PlayerColor;
  13. VCMI_LIB_NAMESPACE_END
  14. class CIntObject;
  15. class ClientCommandManager //take mantis #2292 issue about account if thinking about handling cheats from command-line
  16. {
  17. bool currentCallFromIngameConsole = false; // commands can come from 2 sources: ingame console (chat) and client console
  18. // Quits the game (die, fool command)
  19. void handleQuitCommand();
  20. // Saves current game under the given filename
  21. void handleSaveCommand(std::istringstream & singleWordBuffer);
  22. // Loads a game with the given filename
  23. void handleLoadCommand(std::istringstream & singleWordBuffer);
  24. // AI takes over until the end of turn (unlike original H3 currently causes AI to take over until typed again)
  25. void handleGoSoloCommand();
  26. // Toggles autoskip mode on and off. In this mode, player turns are automatically skipped and only AI moves.
  27. // However, GUI is still present and allows to observe AI moves. After this option is activated, you need to end first turn manually.
  28. // Press [Shift] before your turn starts to not skip it.
  29. void handleAutoskipCommand();
  30. // Gives you control over specified AI player. If none is specified gives you control over all AI players
  31. void handleControlaiCommand(std::istringstream& singleWordBuffer);
  32. // Change battle AI used by neutral creatures to the one specified. Persists through game quit
  33. void handleSetBattleAICommand(std::istringstream& singleWordBuffer);
  34. // Redraw the current screen
  35. void handleRedrawCommand();
  36. // Enable or disable network lag compensation
  37. void handleAntilagCommand(std::istringstream& singleWordBuffer);
  38. // Extracts all translateable game texts into Translation directory, separating files on per-mod basis
  39. void handleTranslateGameCommand(bool onlyMissing);
  40. // Extracts all translateable texts from maps and campaigns into Translation directory, separating files on per-mod basis
  41. void handleTranslateMapsCommand();
  42. // Saves current game configuration into extracted/configuration folder
  43. void handleGetConfigCommand();
  44. // Dumps all scripts in Extracted/Scripts
  45. void handleGetScriptsCommand();
  46. // Dumps all .txt files from DATA into Extracted/DATA
  47. void handleGetTextCommand();
  48. // Extract .def animation as BMP files
  49. void handleDef2bmpCommand(std::istringstream& singleWordBuffer);
  50. // Export file into Extracted directory
  51. void handleExtractCommand(std::istringstream& singleWordBuffer);
  52. // Print in console the current bonuses for current army
  53. void handleBonusesCommand(std::istringstream & singleWordBuffer);
  54. // Get what artifact is present on artifact slot with specified ID for hero with specified ID
  55. void handleTellCommand(std::istringstream& singleWordBuffer);
  56. // Show current movement points, max movement points on land / max movement points on water.
  57. void handleMpCommand();
  58. // set <command> <on/off> - sets special temporary settings that reset on game quit.
  59. void handleSetCommand(std::istringstream& singleWordBuffer);
  60. // Crashes the game forcing an exception
  61. void handleCrashCommand();
  62. // shows object graph
  63. void handleVsLog(std::istringstream & singleWordBuffer);
  64. // generate all assets
  65. void handleGenerateAssets();
  66. // Prints in Chat the given message
  67. void printCommandMessage(const std::string &commandMessage, ELogLevel::ELogLevel messageType = ELogLevel::NOT_SET);
  68. void giveTurn(const PlayerColor &color);
  69. public:
  70. ClientCommandManager() = default;
  71. void processCommand(const std::string & message, bool calledFromIngameConsole);
  72. };