Login Languish
txt_captcha_stage.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include "stage.h"
11 #include "../game_manager.h"
12 #include <set>
13 
14 const char MENACING_CAPTCHAS = 0;
15 const char COUNTRY_CAPTCHAS = 1;
16 
21 class TxtCaptchaStage : public Stage {
22 public:
23  TxtCaptchaStage(GameManager *gameManager);
24  bool validateStage();
25  void update(const rapidjson::Value &req);
26  rapidjson::Value getFieldStates(rapidjson::Document::AllocatorType &allocator);
27  bool setNewChallenge();
28 
29 private:
30  void updateErrors(const std::string &field);
31  void progressStage();
32  void rerollChallenge();
33 
34  std::string txt_captcha = "";
35  std::string challenge_text = "";
36  bool tall_image = false;
37  std::string image_url = "";
38  std::set<char> challenges_remaining = {MENACING_CAPTCHAS, COUNTRY_CAPTCHAS};
39  char current_challenge = 0;
40  std::string challenge_answer = "";
41  bool captcha_passed = false;
42  std::string last_round_error = "";
43  std::string current_roll_identifier = ""; // Used to identify the particular item rolled in a given challenge
44 };
rapidjson::Value getFieldStates(rapidjson::Document::AllocatorType &allocator)
gets the field states
Definition: txt_captcha_stage.cpp:169
the Stage class is an abstract class that represents a stage in the game
Definition: stage.h:20
the Stage class is an abstract class that represents a stage of the game
void update(const rapidjson::Value &req)
updates the stage
Definition: txt_captcha_stage.cpp:153
bool validateStage()
validates the stage
Definition: txt_captcha_stage.cpp:125
the TxtCaptchaStage class is a class that represents a txt captcha stage in the game ...
Definition: txt_captcha_stage.h:21
the GameManager class is a class that controls the flow of the game
Definition: game_manager.h:22
TxtCaptchaStage(GameManager *gameManager)
constructor for TxtCaptchaStage
Definition: txt_captcha_stage.cpp:22