From f5c2c930d804406ffbc556d043d9e5bb732c721b Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sat, 27 Apr 2024 12:08:31 -0700 Subject: [PATCH] don't use $CG in any server announcements --- src/CommandFormats.hh | 2 +- src/ItemNameIndex.cc | 11 ++++++----- src/ReceiveSubcommands.cc | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/CommandFormats.hh b/src/CommandFormats.hh index 6bf700e2..0b8e8dfe 100644 --- a/src/CommandFormats.hh +++ b/src/CommandFormats.hh @@ -72,7 +72,7 @@ // - - $C7: White (FFFFFF) // - - $C8: Pink (FF8080) // - - $C9: Violet (8080FF) -// - - $CG: Orange pulse (FFE000 + darkenings thereof) +// - - $CG: Orange pulse (FFE000 + darkenings thereof; v2 and later only) // - - $Ca: Orange (F5A052; Episode 3 only) // - Special character codes (Ep3 only) // - - $B: Dash + small bullet diff --git a/src/ItemNameIndex.cc b/src/ItemNameIndex.cc index 38402e82..fb6582ee 100644 --- a/src/ItemNameIndex.cc +++ b/src/ItemNameIndex.cc @@ -217,13 +217,14 @@ std::string ItemNameIndex::describe_item(const ItemData& item, bool include_colo if (!bonuses.is_filled_with(0)) { bool should_include_hit = (bonuses[4] != 0); bool should_highlight_hit = include_color_escapes && (bonuses[4] > 0); + const char* color_prefix = include_color_escapes ? "$C7" : ""; if (should_include_hit) { - ret_tokens.emplace_back(string_printf("%hhd/%hhd/%hhd/%hhd/%s%hhd", - bonuses[0], bonuses[1], bonuses[2], bonuses[3], - (should_highlight_hit ? "$CG" : ""), bonuses[4])); + ret_tokens.emplace_back(string_printf("%s%hhd/%hhd/%hhd/%hhd/%s%hhd", + color_prefix, bonuses[0], bonuses[1], bonuses[2], bonuses[3], + (should_highlight_hit ? "$C6" : ""), bonuses[4])); } else { - ret_tokens.emplace_back(string_printf("%hhd/%hhd/%hhd/%hhd", - bonuses[0], bonuses[1], bonuses[2], bonuses[3])); + ret_tokens.emplace_back(string_printf("%s%hhd/%hhd/%hhd/%hhd", + color_prefix, bonuses[0], bonuses[1], bonuses[2], bonuses[3])); } } } diff --git a/src/ReceiveSubcommands.cc b/src/ReceiveSubcommands.cc index 8ad26358..e171e604 100644 --- a/src/ReceiveSubcommands.cc +++ b/src/ReceiveSubcommands.cc @@ -3175,9 +3175,9 @@ static void send_max_level_notification_if_needed(shared_ptr c) { if (p->disp.stats.level == max_level) { string name = p->disp.name.decode(c->language()); size_t level_for_str = max_level + 1; - string message = string_printf("$CG%s$C6\nGC: %" PRIu32 "\nhas reached Level $CG%zu", + string message = string_printf("$C6%s$C7\nGC: %" PRIu32 "\nhas reached Level $C6%zu", name.c_str(), c->login->account->account_id, level_for_str); - string bb_message = string_printf("$CG%s$C6 (GC: %" PRIu32 ") has reached Level $CG%zu", + string bb_message = string_printf("$C6%s$C7 (GC: %" PRIu32 ") has reached Level $C6%zu", name.c_str(), c->login->account->account_id, level_for_str); for (auto& it : s->channel_to_client) { if ((it.second != c) && it.second->login && !is_patch(it.second->version()) && it.second->lobby.lock()) {