PlayerMessageProcessor.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. void cheatFly(PlayerColor player, const CGHeroInstance * hero);
  39. public:
  40. CGameHandler * gameHandler;
  41. PlayerMessageProcessor();
  42. PlayerMessageProcessor(CGameHandler * gameHandler);
  43. /// incoming NetPack handling
  44. void playerMessage(PlayerColor player, const std::string & message, ObjectInstanceID currObj);
  45. /// Send message to specific client with "System" as sender
  46. void sendSystemMessage(std::shared_ptr<CConnection> connection, const std::string & message);
  47. /// Send message to all players with "System" as sender
  48. void broadcastSystemMessage(const std::string & message);
  49. /// Send message from specific player to all other players
  50. void broadcastMessage(PlayerColor playerSender, const std::string & message);
  51. template <typename Handler> void serialize(Handler &h, const int version)
  52. {
  53. }
  54. };