|
@@ -1,13 +1,13 @@
|
|
|
#include "director.h"
|
|
|
|
|
|
#include <boost/format.hpp>
|
|
|
+#include <cctype>
|
|
|
|
|
|
#include "boxes.h"
|
|
|
#include "galaxy.h"
|
|
|
#include "logging.h"
|
|
|
#include "scripts.h"
|
|
|
#include "utils.h"
|
|
|
-#include <cctype>
|
|
|
|
|
|
Director::Director() {
|
|
|
BUGZ_LOG(warning) << "Director::Director()";
|
|
@@ -148,7 +148,8 @@ void Director::server_line(const std::string &line,
|
|
|
if (!galaxy.config["display_lines"]) {
|
|
|
galaxy.config["display_lines"] = 20;
|
|
|
}
|
|
|
- galaxy.meta["help"]["display_lines"] = "Number of report lines to display";
|
|
|
+ galaxy.meta["help"]["display_lines"] =
|
|
|
+ "Number of report lines to display";
|
|
|
if (!galaxy.config["burnt_percent"]) {
|
|
|
galaxy.config["burnt_percent"] = 40;
|
|
|
}
|
|
@@ -468,6 +469,7 @@ void Director::scripts_done(void) {
|
|
|
} else {
|
|
|
switch (md->input[0]) {
|
|
|
case 'T':
|
|
|
+ {
|
|
|
script = std::make_shared<ScriptTrader>(*this);
|
|
|
ScriptTrader *ts = static_cast<ScriptTrader *>(&((*script)));
|
|
|
ts->setNotify([this]() { this->proxy_deactivate(); });
|
|
@@ -493,7 +495,18 @@ void Director::scripts_done(void) {
|
|
|
chain = script;
|
|
|
chain->activate();
|
|
|
return;
|
|
|
- break;
|
|
|
+ } break;
|
|
|
+ case '!': {
|
|
|
+ auto best = galaxy.find_closest(current_sector);
|
|
|
+ if (best.type != 0) {
|
|
|
+ std::string text =
|
|
|
+ str(boost::format("Best/Closest: %1% with %2% & %3%\n\r") %
|
|
|
+ best.type % best.s1 % best.s2);
|
|
|
+ to_client(text);
|
|
|
+ } else {
|
|
|
+ to_client("I don't see any best trades.\n\r");
|
|
|
+ }
|
|
|
+ } break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -827,17 +840,15 @@ void Director::SL_portline(const std::string &line) {
|
|
|
std::string work = line;
|
|
|
replace(work, "Fuel Ore", "Fuel");
|
|
|
auto parts = split(work);
|
|
|
-
|
|
|
- if (parts[0] == "Items")
|
|
|
- return;
|
|
|
-
|
|
|
+
|
|
|
+ if (parts[0] == "Items") return;
|
|
|
+
|
|
|
char c = tolower(parts[0][0]);
|
|
|
int pos;
|
|
|
char foe[4] = "foe";
|
|
|
|
|
|
- for( pos = 0; pos < 3; ++pos) {
|
|
|
- if (c == foe[pos])
|
|
|
- break;
|
|
|
+ for (pos = 0; pos < 3; ++pos) {
|
|
|
+ if (c == foe[pos]) break;
|
|
|
}
|
|
|
int amount = stoi(parts[2]);
|
|
|
int percent = stoi(parts[3]);
|
|
@@ -856,10 +867,9 @@ void Director::SL_portline(const std::string &line) {
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
-
|
|
|
- if (parts[0] == "Equipment")
|
|
|
- SL_parser = nullptr;
|
|
|
-
|
|
|
+
|
|
|
+ if (parts[0] == "Equipment") SL_parser = nullptr;
|
|
|
+
|
|
|
|
|
|
}
|
|
|
}
|