scripts.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #ifndef SCRIPTS_H
  2. #define SCRIPTS_H
  3. #include "buysell.h"
  4. #include "dispatchers.h"
  5. #include "galaxy.h"
  6. #include <stack>
  7. #include "ansicolor.h"
  8. class ScriptTerror : public Dispatch {
  9. private:
  10. MoveDispatch * md;
  11. std::shared_ptr<Dispatch> move;
  12. InputDispatch * id;
  13. std::shared_ptr<Dispatch> input;
  14. TraderDispatch * td;
  15. std::shared_ptr<Dispatch> trader;
  16. std::string old_trade_end_empty;
  17. public:
  18. ScriptTerror(Director &);
  19. ~ScriptTerror();
  20. int loops;
  21. int max_loops;
  22. port_pair_type ppt;
  23. void init(void);
  24. void activate(void) override;
  25. void deactivate(void) override;
  26. void input_notify(void);
  27. void move_notify(void);
  28. void trade_notify(void);
  29. void server_prompt(const std::string &prompt) override;
  30. };
  31. class ScriptVoyager : public Dispatch {
  32. private:
  33. MoveDispatch * md;
  34. std::shared_ptr<Dispatch> move;
  35. InputDispatch * id;
  36. std::shared_ptr<Dispatch> input;
  37. void next(void);
  38. public:
  39. ScriptVoyager(Director &);
  40. ~ScriptVoyager();
  41. int loops;
  42. void init(void);
  43. void activate(void) override;
  44. void deactivate(void) override;
  45. void input_notify(void);
  46. void move_notify(void);
  47. void server_prompt(const std::string &prompt) override;
  48. };
  49. class ScriptExplore : public Dispatch {
  50. private:
  51. MoveDispatch * md;
  52. std::shared_ptr<Dispatch> move;
  53. InputDispatch * id;
  54. std::shared_ptr<Dispatch> input;
  55. void next(void);
  56. std::shared_ptr<Dispatch> us;
  57. public:
  58. ScriptExplore(Director &);
  59. ~ScriptExplore();
  60. int loops;
  61. bool infinite;
  62. bool prefer_ports;
  63. int state;
  64. int target;
  65. std::stack<sector_type> unknown_warps;
  66. void init(void);
  67. void activate(void) override;
  68. void deactivate(void) override;
  69. void input_notify(void);
  70. void move_notify(void);
  71. void server_prompt(const std::string &prompt) override;
  72. };
  73. class ScriptPlanet : public Dispatch {
  74. private:
  75. MoveDispatch * md;
  76. std::shared_ptr<Dispatch> move;
  77. InputDispatch * id;
  78. std::shared_ptr<Dispatch> input;
  79. TraderDispatch * td;
  80. std::shared_ptr<Dispatch> trader;
  81. void next(void);
  82. std::shared_ptr<Dispatch> us;
  83. public:
  84. ScriptPlanet(Director &);
  85. ~ScriptPlanet();
  86. int planet;
  87. int sector;
  88. int state;
  89. void init(void);
  90. void activate(void) override;
  91. void deactivate(void) override;
  92. void input_notify(void);
  93. void move_notify(void);
  94. void trade_notify(void);
  95. void server_prompt(const std::string &prompt) override;
  96. void server_line(const std::string &line, const std::string &raw_line) override;
  97. };
  98. #endif