PlayerMessageProcessor.h 2.4 KB

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