make $where show other players' floors
This commit is contained in:
+10
-1
@@ -1827,7 +1827,16 @@ static void proxy_command_next(shared_ptr<ProxyServer::LinkedSession> ses, const
|
||||
}
|
||||
|
||||
static void server_command_where(shared_ptr<Client> c, const std::string&) {
|
||||
send_text_message_printf(c, "$C7Floor: %02" PRIX32 "\nX: %g\nZ: %g", c->floor, c->x, c->z);
|
||||
auto l = c->require_lobby();
|
||||
send_text_message_printf(c, "$C7%01" PRIX32 ":%s X:%" PRId32 " Z:%" PRId32,
|
||||
c->floor, short_name_for_floor(l->episode, c->floor), static_cast<int32_t>(c->x), static_cast<int32_t>(c->z));
|
||||
for (auto lc : l->clients) {
|
||||
if (lc && (lc != c)) {
|
||||
string name = lc->character()->disp.name.decode(lc->language());
|
||||
send_text_message_printf(c, "$C6%s$C7 %01" PRIX32 ":%s",
|
||||
name.c_str(), lc->floor, short_name_for_floor(l->episode, lc->floor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void server_command_what(shared_ptr<Client> c, const std::string&) {
|
||||
|
||||
@@ -749,6 +749,15 @@ static const array<const char*, 0x0B> ep4_floor_names = {
|
||||
"Purgatory",
|
||||
};
|
||||
|
||||
static const array<const char*, 0x12> ep1_floor_names_short = {
|
||||
"P2", "F1", "F2", "C1", "C2", "C3", "M1", "M2", "R1", "R2", "R3", "Dgn", "DRL", "VO", "DF", "Lby", "B1", "B2"};
|
||||
|
||||
static const array<const char*, 0x12> ep2_floor_names_short = {
|
||||
"Lab", "VRTA", "VRTB", "VRSA", "VRSB", "CCA", "JN", "JE", "Mtn", "SS", "SU", "SL", "GG", "OF", "BR", "GD", "SSN", "Twr"};
|
||||
|
||||
static const array<const char*, 0x0B> ep4_floor_names_short = {
|
||||
"P2", "CE", "CW", "CS", "CN", "CI", "D1", "D2", "D3", "SM", "Pg"};
|
||||
|
||||
size_t floor_limit_for_episode(Episode ep) {
|
||||
switch (ep) {
|
||||
case Episode::EP1:
|
||||
@@ -775,6 +784,19 @@ const char* name_for_floor(Episode episode, uint8_t floor) {
|
||||
}
|
||||
}
|
||||
|
||||
const char* short_name_for_floor(Episode episode, uint8_t floor) {
|
||||
switch (episode) {
|
||||
case Episode::EP1:
|
||||
return ep1_floor_names_short.at(floor);
|
||||
case Episode::EP2:
|
||||
return ep2_floor_names_short.at(floor);
|
||||
case Episode::EP4:
|
||||
return ep4_floor_names_short.at(floor);
|
||||
default:
|
||||
throw logic_error("invalid episode for floor");
|
||||
}
|
||||
}
|
||||
|
||||
bool floor_is_boss_arena(Episode episode, uint8_t floor) {
|
||||
switch (episode) {
|
||||
case Episode::EP1:
|
||||
|
||||
@@ -76,6 +76,7 @@ extern const std::unordered_map<std::string, uint8_t> mag_color_for_name;
|
||||
size_t floor_limit_for_episode(Episode ep);
|
||||
uint8_t floor_for_name(const std::string& name);
|
||||
const char* name_for_floor(Episode episode, uint8_t floor);
|
||||
const char* short_name_for_floor(Episode episode, uint8_t floor);
|
||||
bool floor_is_boss_arena(Episode episode, uint8_t floor);
|
||||
|
||||
uint32_t class_flags_for_class(uint8_t char_class);
|
||||
|
||||
Reference in New Issue
Block a user