FactoryClient.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. #include <Punkt.h>
  10. class FactoryClient : public Framework::ReferenceCounter
  11. {
  12. private:
  13. Network::SSLKlient* client;
  14. Network::Klient* foreground;
  15. Network::Klient* background;
  16. Network::NetworkReader* foregroundReader;
  17. Network::NetworkReader* backgroundReader;
  18. Framework::Critical cs;
  19. int bgReaderUsage;
  20. int fgReaderUsage;
  21. void disconnect();
  22. public:
  23. FactoryClient();
  24. ~FactoryClient();
  25. bool connect(Text ip, short port, int accountId, Text secret);
  26. Network::NetworkReader* getNextForegroundMessage();
  27. Network::NetworkReader* getNextBackgroundMessage();
  28. void endMessageReading(bool bg);
  29. void sendPlayerAction(char* data, unsigned short length);
  30. void entityAPIRequest(int entityId, char* message, unsigned short length);
  31. void chunkAPIRequest(Framework::Punkt center, char* message, unsigned short length);
  32. void inventoryAPIRequest(Framework::Either<int, Framework::VecN<int, 4>> target, char* message, unsigned short length);
  33. };