FactoryClient.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include <Network.h>
  3. #include <Klient.h>
  4. #include <Text.h>
  5. #include <Thread.h>
  6. #include <Critical.h>
  7. #include <VecN.h>
  8. #include <Either.h>
  9. class FactoryClient : public Framework::ReferenceCounter
  10. {
  11. private:
  12. Network::SSLKlient* client;
  13. Network::Klient* foreground;
  14. Network::Klient* background;
  15. Network::NetworkReader* foregroundReader;
  16. Network::NetworkReader* backgroundReader;
  17. Framework::Critical cs;
  18. int bgReaderUsage;
  19. int fgReaderUsage;
  20. void disconnect();
  21. public:
  22. FactoryClient();
  23. ~FactoryClient();
  24. bool connect(Text ip, short port, int accountId, Text secret);
  25. Network::NetworkReader* getNextForegroundMessage();
  26. Network::NetworkReader* getNextBackgroundMessage();
  27. void endMessageReading(bool bg);
  28. void sendPlayerAction(char* data, unsigned short length);
  29. void entityAPIRequest(int entityId, char* message, unsigned short length);
  30. void inventoryAPIRequest(Framework::Either<int, Framework::VecN<int, 4>> target, char* message, unsigned short length);
  31. };