|
@@ -57,156 +57,6 @@ void Dispatch::client_input(const std::string &input) {
|
|
|
deactivate();
|
|
|
}
|
|
|
|
|
|
-#ifdef NOMORE
|
|
|
-MainDispatch::MainDispatch(Director &d) : Dispatch{d}, id{d}, md{d} {
|
|
|
- BUGZ_LOG(warning) << "MainDispatch()";
|
|
|
-}
|
|
|
-
|
|
|
-MainDispatch::~MainDispatch() { BUGZ_LOG(warning) << "~MainDispatch()"; }
|
|
|
-
|
|
|
-void MainDispatch::activate(void) {
|
|
|
- count = 0;
|
|
|
- old_prompt = get_prompt();
|
|
|
-
|
|
|
- /*
|
|
|
- ╔══════════════════════════════╗
|
|
|
- ║ TradeWars Proxy Active ║
|
|
|
- ╚══════════════════════════════╝
|
|
|
- -=>
|
|
|
- */
|
|
|
-
|
|
|
- Boxes box(30, 1, true);
|
|
|
- box.boxcolor = "\x1b[1;33;44m";
|
|
|
- box.textcolor = "\x1b[1;33;44m";
|
|
|
- to_client("\n\r");
|
|
|
- to_client(box.top());
|
|
|
- std::string output = " TradeWars Proxy \x1b[5mActive\x1b[0;1;33;44m ";
|
|
|
- to_client(box.row(output));
|
|
|
- to_client(box.bottom());
|
|
|
-
|
|
|
- // to_client("\n\r\x1b[1;34mWELCOME! You are now in the proxy zone...\n\r");
|
|
|
- id.prompt = "\x1b[0m \x1b[1;33;44m-=>\x1b[0m \x1b[1;37;44m";
|
|
|
- id.max_length = 15;
|
|
|
- id.setNotify([this]() { this->have_input(); });
|
|
|
- id.activate();
|
|
|
-}
|
|
|
-
|
|
|
-void MainDispatch::have_input(void) {
|
|
|
- ++count;
|
|
|
- std::string output =
|
|
|
- str(boost::format("Your Input (%2%): [%1%]\n\r") % id.input % count);
|
|
|
- to_client("\x1b[0m");
|
|
|
- to_client(output);
|
|
|
- if (id.input == "?") {
|
|
|
- // Maybe? Maybe not.
|
|
|
- }
|
|
|
-
|
|
|
- if (id.input == "menu") {
|
|
|
- md.menu_box_color = "\x1b[1;33;44m";
|
|
|
- md.menu_text_color = "\x1b[1;37;44m";
|
|
|
- md.menu_title = "Proxy Menu";
|
|
|
- md.menu_options_color = "\x1b[1;36;40m";
|
|
|
- // md.menu_prompt = " --==>> ";
|
|
|
-
|
|
|
- // bold white to white --- black to green
|
|
|
- // md.menu_prompt = "\x1b[1;37;47m\xdb\xb2\xb1\xb0\x1b[0;30;47m RED GREEN
|
|
|
- // \x1b[30;42m\xdb\xb2\xb1\xb0\x1b[0m : ";
|
|
|
-
|
|
|
- // md.menu_prompt = "\x1b[0;31;47m\xdb\xb2\xb1\xb0\x1b[0;30;47m RED
|
|
|
- // GREEN\x1b[37;42m\xdb\xb2\xb1\xb0\x1b[0m : ";
|
|
|
- const char *CP437_GRADIENT = "\xdb\xb2\xb1\xb0 "; // 100, 75, 50, 25, 0
|
|
|
-
|
|
|
- md.menu_prompt =
|
|
|
- "\x1b[0;31;40m\xdb\xb2\xb1\xb0 \x1b[31;40mRED "
|
|
|
- "\x1b[32;40mGREEN\x1b[30;42m\xdb\xb2\xb1\xb0 \x1b[0m : ";
|
|
|
- md.lazy = true;
|
|
|
- md.menu = {{"A", "Apple"}, {"B", "Blue"}, {"R", "Rabbit"}, {"Z", "ZOOO!"}};
|
|
|
- md.setNotify([this]() { this->menu_choice(); });
|
|
|
- md.activate();
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (id.input == "menu2") {
|
|
|
- md.lazy = false;
|
|
|
- md.setNotify([this]() { this->menu_choice(); });
|
|
|
- md.activate();
|
|
|
- return;
|
|
|
- }
|
|
|
- if (id.input.empty()) {
|
|
|
- // if (count >= 5) {
|
|
|
- auto lines = Boxes::alert(" Returning you to the game... ", "",
|
|
|
- "\x1b[1;32m", 30, 1, true);
|
|
|
- // I'm not setting the box color, so the last color bleeds over.
|
|
|
- to_client("\x1b[0m");
|
|
|
- for (auto line : lines) {
|
|
|
- to_client(line);
|
|
|
- };
|
|
|
- to_client("Returning you to the game...\n\r");
|
|
|
- deactivate();
|
|
|
- } else {
|
|
|
- // prompt it again, sam.
|
|
|
- id.setNotify([this]() { this->have_input(); });
|
|
|
- id.activate();
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-void MainDispatch::menu_choice(void) {
|
|
|
- if (md.input.empty()) {
|
|
|
- to_client("Menu abort.\n\r");
|
|
|
- } else {
|
|
|
- std::string text = "Back from menu [";
|
|
|
- text.append(md.input);
|
|
|
- text.append("] was your selection.\n\r");
|
|
|
- to_client(text);
|
|
|
- }
|
|
|
-
|
|
|
- id.max_length = 15;
|
|
|
- id.setNotify([this]() { this->have_input(); });
|
|
|
- id.activate();
|
|
|
-}
|
|
|
-
|
|
|
-void MainDispatch::deactivate(void) {
|
|
|
- // Since we're the main thing there --
|
|
|
- // sess->show_client = true;
|
|
|
- // sess->talk_direct = true;
|
|
|
-
|
|
|
- notify();
|
|
|
-}
|
|
|
-
|
|
|
-void MainDispatch::server_line(const std::string &line,
|
|
|
- const std::string &raw_line) {
|
|
|
- BUGZ_LOG(info) << "MDSL: " << line;
|
|
|
- to_client("SL: ");
|
|
|
- to_client(line);
|
|
|
- to_client("\n\r");
|
|
|
-}
|
|
|
-
|
|
|
-void MainDispatch::server_prompt(const std::string &prompt) {
|
|
|
- BUGZ_LOG(info) << "MDSP: " << prompt;
|
|
|
-}
|
|
|
-
|
|
|
-#ifdef NEVERMORE
|
|
|
-void MainDispatch::client_input(const std::string &input) {
|
|
|
- // I don't care what the old prompt looked liked at this point.
|
|
|
- BUGZ_LOG(warning) << "Got: " << input; // << " prompt=" << get_prompt();
|
|
|
-
|
|
|
- // Serious problem when the input = "\x1b" ESC. The output gets gummed/locked
|
|
|
- // up.
|
|
|
- if (input == "\x1b") {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- ++count;
|
|
|
- std::string output = str(boost::format("MSG %1%: [%2%]\n\r") % count % input);
|
|
|
- to_client(output);
|
|
|
- if (count >= 5) {
|
|
|
- to_client("And we're outta here!\n\r");
|
|
|
- deactivate();
|
|
|
- }
|
|
|
-}
|
|
|
-#endif
|
|
|
-#endif
|
|
|
-
|
|
|
InputDispatch::InputDispatch(Director &d) : Dispatch(d) {
|
|
|
BUGZ_LOG(warning) << "InputDispatch()";
|
|
|
numeric = false;
|
|
@@ -645,7 +495,7 @@ void MoveDispatch::server_line(const std::string &line,
|
|
|
// [344 > 23328 > 2981 > 10465 > 14016 > 8979 > 1916 > 18734 > 5477 > 131 >
|
|
|
// 27464 >] watch for <Move> it contains >
|
|
|
// if ((line != "<Move>") && in(line, " > ")) {
|
|
|
- if ((line != "<Move>") && (in(line, " > ") || !warp_lane.empty())) {
|
|
|
+ if ((line != "<Move>") && (in(line, " > ") || !warp_lane.empty())) {
|
|
|
bool more = false;
|
|
|
std::string work = line;
|
|
|
|
|
@@ -1185,7 +1035,7 @@ void TraderDispatch::server_prompt(const std::string &prompt) {
|
|
|
<< " is burnt " << x << " burnt = true";
|
|
|
burnt = true;
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|