aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRose Witchaven <32779090+in1tiate@users.noreply.github.com>2021-06-16 23:58:39 -0500
committerGitHub <noreply@github.com>2021-06-16 23:58:39 -0500
commit65f812cf7331acb5d5d1f1dfbac4bc99fd0aed04 (patch)
tree1cb1a52bc041fe19b8556405f546692c6f2fcd16 /src
parent9e0a964af814fa941f04ebebbc28bdbb23977651 (diff)
Extend /pair command to work with character names as well as IDs (#562)
Diffstat (limited to 'src')
-rw-r--r--src/courtroom.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 18c6f01e..7b4d4f04 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -4029,10 +4029,28 @@ void Courtroom::on_ooc_return_pressed()
}
}
else {
- append_server_chatmessage("CLIENT",
- tr("Are you sure you typed that well? The char "
- "ID could not be recognised."),
- "1");
+ int whom = 0;
+ bool matched = false;
+ for (char_type chara : char_list) {
+ if (chara.name.toLower() == ooc_message.toLower()) {
+ matched = true;
+ break;
+ }
+ whom++;
+ }
+ if (matched) {
+ other_charid = whom;
+ QString msg = tr("You will now pair up with %1 if they also choose "
+ "your character in return.")
+ .arg(char_list.at(whom).name);
+ append_server_chatmessage("CLIENT", msg, "1");
+ }
+ else {
+ append_server_chatmessage("CLIENT",
+ tr("Are you sure you typed that well? The char "
+ "ID/name could not be recognised."),
+ "1");
+ }
}
return;
}