PlayerMessageProcessor.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * CGameHandler.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. #include "../../lib/GameConstants.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class CGHeroInstance;
  14. class CGTownInstance;
  15. class CConnection;
  16. VCMI_LIB_NAMESPACE_END
  17. class CGameHandler;
  18. class PlayerMessageProcessor
  19. {
  20. void executeCheatCode(const std::string & cheatName, PlayerColor player, ObjectInstanceID currObj, const std::vector<std::string> & arguments );
  21. bool handleCheatCode(const std::string & cheatFullCommand, PlayerColor player, ObjectInstanceID currObj);
  22. bool handleHostCommand(PlayerColor player, const std::string & message);
  23. void cheatGiveSpells(PlayerColor player, const CGHeroInstance * hero);
  24. void cheatBuildTown(PlayerColor player, const CGTownInstance * town);
  25. void cheatGiveArmy(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
  26. void cheatGiveMachines(PlayerColor player, const CGHeroInstance * hero);
  27. void cheatGiveArtifacts(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
  28. void cheatLevelup(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
  29. void cheatExperience(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
  30. void cheatMovement(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
  31. void cheatResources(PlayerColor player, std::vector<std::string> words);
  32. void cheatVictory(PlayerColor player);
  33. void cheatDefeat(PlayerColor player);
  34. void cheatMapReveal(PlayerColor player, bool reveal);
  35. void cheatPuzzleReveal(PlayerColor player);
  36. void cheatMaxLuck(PlayerColor player, const CGHeroInstance * hero);
  37. void cheatMaxMorale(PlayerColor player, const CGHeroInstance * hero);
  38. public:
  39. CGameHandler * gameHandler;
  40. PlayerMessageProcessor();
  41. PlayerMessageProcessor(CGameHandler * gameHandler);
  42. /// incoming NetPack handling
  43. void playerMessage(PlayerColor player, const std::string & message, ObjectInstanceID currObj);
  44. /// Send message to specific client with "System" as sender
  45. void sendSystemMessage(std::shared_ptr<CConnection> connection, const std::string & message);
  46. /// Send message to all players with "System" as sender
  47. void broadcastSystemMessage(const std::string & message);
  48. /// Send message from specific player to all other players
  49. void broadcastMessage(PlayerColor playerSender, const std::string & message);
  50. template <typename Handler> void serialize(Handler &h, const int version)
  51. {
  52. }
  53. };