|
@@ -231,17 +231,19 @@ int mangle_clrscr(std::string &buffer, std::string &work, size_t pos) {
|
|
|
if (random_activate(level * 5)) {
|
|
|
int r;
|
|
|
std::ostringstream display;
|
|
|
+ // If the username is something, we have their info!
|
|
|
+ bool have_userinfo = !username.empty();
|
|
|
|
|
|
const char *phrasing[] = {
|
|
|
- TRIGGER "R1Haha" TRIGGER "P1ha" TRIGGER "P1ha", "Poof!", "Got U",
|
|
|
+ TRIGGER "R1Haha" TRIGGER "P1ha" TRIGGER "P1ha", "Poof!",
|
|
|
"Anyone there?", TRIGGER "R1Knock, " TRIGGER "P1Knock",
|
|
|
/*
|
|
|
This picks random color and position -- then
|
|
|
homes cursor and changes to another color. (This can be seen.)
|
|
|
*/
|
|
|
TRIGGER "G0101" TRIGGER "C07" TRIGGER "S0"
|
|
|
- "Segmentation fault" TRIGGER "P1" " (core dumped)"
|
|
|
- TRIGGER "P2",
|
|
|
+ "Segmentation fault" TRIGGER "P1"
|
|
|
+ " (core dumped)" TRIGGER "P2",
|
|
|
TRIGGER
|
|
|
"G0101" TRIGGER "C07" TRIGGER "S0"
|
|
|
"/usr/include/c++/7/bits/basic_string.h:1057: "
|
|
@@ -277,14 +279,40 @@ int mangle_clrscr(std::string &buffer, std::string &work, size_t pos) {
|
|
|
// as well as how many elements and the memory location.
|
|
|
|
|
|
const int max_phrases = sizeof(phrasing) / sizeof(char *);
|
|
|
+
|
|
|
+ const char *user_phrasing[] = {
|
|
|
+ "We've got you now, NICK!",
|
|
|
+ "Are you there, USER?",
|
|
|
+ TRIGGER "R1Knock, " TRIGGER "P1Knock " TRIGGER "P1NICK",
|
|
|
+ "I see you," TRIGGER "P1" TRIGGER "S1" TRIGGER "R1 NICK" TRIGGER
|
|
|
+ "S0" TRIGGER "R0",
|
|
|
+ "I see NICK hiding."
|
|
|
+ };
|
|
|
+
|
|
|
+ const int max_user_phrases = sizeof(user_phrasing) / sizeof(char *);
|
|
|
+
|
|
|
static LastSeen last_phrasing(LastSeen::best_guess(max_phrases));
|
|
|
|
|
|
+ int total_possible =
|
|
|
+ have_userinfo ? max_phrases + max_user_phrases : max_phrases;
|
|
|
+
|
|
|
ZF_LOGI("mangle(ANSI_CLS)");
|
|
|
|
|
|
do {
|
|
|
- r = randint(max_phrases);
|
|
|
+ r = randint(total_possible);
|
|
|
} while (last_phrasing.seen_before(r));
|
|
|
|
|
|
+ std::string selected;
|
|
|
+ if (r >= max_phrases) {
|
|
|
+ selected = user_phrasing[r - max_phrases];
|
|
|
+ std::string temp = username;
|
|
|
+ a_or_an(temp);
|
|
|
+ replace(selected, " a NICK", temp);
|
|
|
+ replace(selected, "USER", fullname);
|
|
|
+ replace(selected, "NICK", username);
|
|
|
+ } else
|
|
|
+ selected = phrasing[r];
|
|
|
+
|
|
|
int color = randint(14) + 1;
|
|
|
int x = randint(30) + 1;
|
|
|
int y = randint(15) + 1;
|
|
@@ -303,8 +331,8 @@ int mangle_clrscr(std::string &buffer, std::string &work, size_t pos) {
|
|
|
HOME, CLS, HOME, ... Not sure what others do there. We'll see.
|
|
|
*/
|
|
|
|
|
|
- if (strncmp(phrasing[r], TRIGGER "G", 2) == 0) {
|
|
|
- display << TRIGGER "CS" TRIGGER "S3" TRIGGER "P1" << phrasing[r]
|
|
|
+ if (strncmp(selected.c_str(), TRIGGER "G", 2) == 0) {
|
|
|
+ display << TRIGGER "CS" TRIGGER "S3" TRIGGER "P1" << selected
|
|
|
<< TRIGGER "S0" TRIGGER "R0" TRIGGER "CR" TRIGGER "P1" TRIGGER
|
|
|
"G0101";
|
|
|
// This starts with a GOTO, so don't use our random position
|
|
@@ -312,7 +340,7 @@ int mangle_clrscr(std::string &buffer, std::string &work, size_t pos) {
|
|
|
display << TRIGGER "CS" TRIGGER "G" << std::setw(2)
|
|
|
<< std::setfill('0') << x << std::setw(2) << y
|
|
|
<< TRIGGER "S3" TRIGGER "C" << std::setw(2) << color
|
|
|
- << TRIGGER "P1" << phrasing[r]
|
|
|
+ << TRIGGER "P1" << selected
|
|
|
<< TRIGGER "S0" TRIGGER "R0" TRIGGER "CR" TRIGGER "P1" TRIGGER
|
|
|
"G0101";
|
|
|
};
|