15#include "absl/strings/str_cat.h"
16#include "absl/strings/str_join.h"
17#include "absl/strings/substitute.h"
23#include "extras/IconsFontAwesome6.h"
25#include "protocol/version.h"
31constexpr ImGuiWindowFlags kWindowFlags = ImGuiWindowFlags_NoMove |
32 ImGuiWindowFlags_NoResize |
33 ImGuiWindowFlags_NoSavedSettings;
36constexpr ImGuiWindowFlags kBare =
37 ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove |
38 ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoSavedSettings |
39 ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoBringToFrontOnFocus;
43constexpr float kTurnPerPixel = 0.012f;
44constexpr float kNearest = 2.2f;
45constexpr float kFarthest = 5.5f;
46constexpr float kZoomStep = 0.3f;
49constexpr float kCornerMargin = 14.0f;
53constexpr float kActionWidth = 300.0f;
54constexpr float kActionHeight = 52.0f;
56void ShowErrorText(
const std::string& error) {
58 ImGui::PushTextWrapPos(0.0f);
59 ImGui::TextColored({1.0f, 0.45f, 0.4f, 1.0f},
60 ICON_FA_TRIANGLE_EXCLAMATION
" %s", error.c_str());
61 ImGui::PopTextWrapPos();
68bool Row(
const char*
id,
const std::string& name,
const std::string& line,
69 bool picked,
bool* twice =
nullptr) {
70 const float height =
Ui(58.0f);
71 const float width = ImGui::GetContentRegionAvail().x;
72 const bool clicked = ImGui::InvisibleButton(
id, {width, height});
73 const bool hovered = ImGui::IsItemHovered();
74 if (twice !=
nullptr) {
75 *twice = hovered && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left);
77 const ImVec2 min = ImGui::GetItemRectMin();
78 const ImVec2 max = ImGui::GetItemRectMax();
79 ImDrawList* draw = ImGui::GetWindowDrawList();
81 draw->AddRectFilledMultiColor(
90 {min.x +
Ui(14.0f), min.y +
Ui(8.0f)},
101bool Arrow(
const char*
id,
float width,
float way) {
102 const bool clicked =
GameButton(
id, {width, 0.0f});
103 const ImVec2 min = ImGui::GetItemRectMin();
104 const ImVec2 max = ImGui::GetItemRectMax();
105 const ImVec2 centre{(min.x + max.x) / 2.0f, (min.y + max.y) / 2.0f};
106 const float half =
Ui(6.0f);
107 ImVec2 tip{centre.x + way * half, centre.y};
108 ImVec2 top{centre.x - way * half * 0.7f, centre.y - half};
109 ImVec2 bottom{centre.x - way * half * 0.7f, centre.y + half};
112 std::swap(top, bottom);
114 ImGui::GetWindowDrawList()->AddTriangleFilled(tip, bottom, top,
122void Stepper(
const char* label,
const std::vector<std::string>& names,
124 if (names.size() < 2) {
127 ImGui::TextDisabled(
"%s",
Tr(label));
128 const auto count =
static_cast<uint32_t
>(names.size());
130 ImGui::PushID(label);
131 const float arrow =
Ui(38.0f);
132 const float gap = ImGui::GetStyle().ItemSpacing.x;
133 const float middle = ImGui::GetContentRegionAvail().x - 2.0f * (arrow + gap);
134 if (Arrow(
"##back", arrow, -1.0f)) {
135 *at = (*at + count - 1) % count;
138 ImGui::Dummy({middle,
Ui(34.0f)});
139 const ImVec2 min = ImGui::GetItemRectMin();
140 const ImVec2 max = ImGui::GetItemRectMax();
142 const float size =
Ui(17.0f);
143 const std::string& name = names[*at];
144 const ImVec2 extent = font->CalcTextSizeA(size, FLT_MAX, 0.0f, name.c_str());
146 ImGui::GetWindowDrawList(), font, size,
147 {(min.x + max.x - extent.x) / 2.0f, (min.y + max.y - extent.y) / 2.0f},
150 if (Arrow(
"##on", arrow, 1.0f)) {
151 *at = (*at + 1) % count;
157google::protobuf::RepeatedField<uint32_t> Shirts() {
158 google::protobuf::RepeatedField<uint32_t>
colors;
160 colors.Add(
static_cast<uint32_t
>(
161 ColorToInt(
ShirtColor(
static_cast<uint32_t
>(shirt)))));
169void Swatches(
const char* label,
170 const google::protobuf::RepeatedField<uint32_t>& palette,
172 if (palette.size() < 2) {
175 ImGui::TextDisabled(
"%s",
Tr(label));
176 *at %=
static_cast<uint32_t
>(palette.size());
177 ImGui::PushID(label);
178 const float size =
Ui(34.0f);
179 ImDrawList* draw = ImGui::GetWindowDrawList();
180 for (
int i = 0; i < palette.size(); ++i) {
185 if (ImGui::InvisibleButton(
"##swatch", {size, size})) {
186 *at =
static_cast<uint32_t
>(i);
188 const bool hovered = ImGui::IsItemHovered();
189 const ImVec2 min = ImGui::GetItemRectMin();
190 const ImVec2 max = ImGui::GetItemRectMax();
191 const ImVec2 centre{(min.x + max.x) / 2.0f, (min.y + max.y) / 2.0f};
192 const Color color = GetColor(palette[i]);
193 draw->AddCircleFilled(centre, size * 0.36f,
194 IM_COL32(color.r, color.g, color.b, 255));
196 if (*at ==
static_cast<uint32_t
>(i)) {
198 }
else if (hovered) {
209template <
typename Named>
210std::vector<std::string> NamesOf(
211 const google::protobuf::RepeatedPtrField<Named>& each) {
212 std::vector<std::string> names;
213 names.reserve(each.size());
214 for (
int i = 0; i < each.size(); ++i) {
215 names.push_back(each[i].name().empty() ? absl::StrCat(i + 1)
225 const figures::Figures& figures) {
227 figure.
id = character.id();
228 if (character.has_looks()) {
231 figure.
name = character.name();
232 figure.
level =
static_cast<int>(character.level());
233 figure.
weapon = character.weapon();
234 figure.
wearing = {character.wearing().begin(), character.wearing().end()};
237 if (character.fresh()) {
238 std::vector<items::Slot> taken;
239 for (
const items::Stack& stack : items.
starting) {
240 const auto item = items.
by_id.find(stack.item());
241 if (item == items.
by_id.end() || !item->second.has_equip()) {
244 const items::Slot slot = item->second.equip().slot();
245 if (std::ranges::find(taken, slot) != taken.end()) {
248 taken.push_back(slot);
249 if (slot == items::SLOT_MAIN_HAND) {
250 figure.
weapon = stack.item();
252 figure.
wearing.push_back(stack.item());
256 figure.
from = protocol::MOTION_IDLE;
257 figure.
to = protocol::MOTION_IDLE;
263 const ImVec2 screen = ImGui::GetIO().DisplaySize;
264 ImDrawList* back = ImGui::GetBackgroundDrawList();
265 DrawBackdrop(back, screen,
static_cast<float>(ImGui::GetTime()));
268 if (step_ == Step::kAccount) {
269 DrawLogo(back, {screen.x / 2.0f, screen.y * 0.14f},
Ui(92.0f));
274 const std::string version = absl::StrCat(
"nanoMMO ", kVersion);
276 const float size =
Ui(14.0f);
277 const ImVec2 extent =
278 font->CalcTextSizeA(size, FLT_MAX, 0.0f, version.c_str());
279 back->AddText(font, size,
280 {screen.x - extent.x -
Ui(kCornerMargin),
281 screen.y - extent.y -
Ui(kCornerMargin)},
286 return BuildAccount();
288 return BuildWorlds();
289 case Step::kCharacters:
290 return BuildCharacters();
292 return BuildCreate();
301 error_ = reply.ok() ?
""
306 if (reply.session().empty()) {
308 step_ = Step::kAccount;
311 if (session_.empty()) {
312 step_ = Step::kWorlds;
314 session_ = reply.session();
316 worlds_ = {reply.worlds().begin(), reply.worlds().end()};
317 selected_world_ = std::clamp(
318 selected_world_, 0, std::max(
static_cast<int>(worlds_.size()) - 1, 0));
320 characters_ = {reply.characters().begin(), reply.characters().end()};
323 const std::vector<const protocol::CharacterListing*> here = Here();
324 const auto named = std::ranges::find_if(
325 here, [&](
const auto* c) {
return c->name() == new_name_.data(); });
326 if (reply.ok() && named != here.end() && new_name_[0] !=
'\0') {
327 picked_ = (*named)->id();
328 new_name_.fill(
'\0');
330 if (step_ == Step::kCreate) {
331 step_ = Step::kCharacters;
333 }
else if (std::ranges::none_of(
334 here, [&](
const auto* c) {
return c->id() == picked_; })) {
335 picked_ = here.empty() ? 0 : here.front()->id();
340 const auto found = std::ranges::find_if(
341 characters_, [&](
const auto& c) {
return c.id() == picked_; });
342 return found != characters_.end() ? found->name() :
"";
345protocol::LoginRequest LoginScreen::WithSession()
const {
346 protocol::LoginRequest request;
347 request.set_session(session_);
351std::vector<const protocol::CharacterListing*> LoginScreen::Here()
const {
352 std::vector<const protocol::CharacterListing*> here;
353 for (
const protocol::CharacterListing& character : characters_) {
354 if (world_ && character.world() == world_->name()) {
355 here.push_back(&character);
361int LoginScreen::CountIn(
const std::string& world)
const {
362 return static_cast<int>(std::ranges::count_if(
363 characters_, [&](
const auto& c) {
return c.world() ==
world; }));
366std::optional<protocol::LoginRequest> LoginScreen::BuildAccount() {
367 const ImVec2 screen = ImGui::GetIO().DisplaySize;
368 ImGui::SetNextWindowPos({screen.x / 2.0f, screen.y * 0.55f}, ImGuiCond_Always,
370 ImGui::SetNextWindowSize({
Ui(380.0f), 0.0f});
371 BeginPanel(
"Your account",
nullptr, kWindowFlags);
372 ImGui::TextDisabled(
"%s",
Tr(
"Name"));
373 if (ImGui::IsWindowAppearing()) {
374 ImGui::SetKeyboardFocusHere();
376 ImGui::SetNextItemWidth(-FLT_MIN);
377 ImGui::InputText(
"##name", username_.data(), username_.size());
378 ImGui::TextDisabled(
"%s",
Tr(
"Password"));
379 ImGui::SetNextItemWidth(-FLT_MIN);
380 const bool enter = ImGui::InputText(
381 "##password", password_.data(), password_.size(),
382 ImGuiInputTextFlags_Password | ImGuiInputTextFlags_EnterReturnsTrue);
384 const bool log_in =
GameButton(
"Log in", {-1.0f, 0.0f},
true) || enter;
385 const bool create =
GameButton(
"Make an account", {-1.0f, 0.0f});
386 ShowErrorText(error_);
389 if (!log_in && !create) {
392 protocol::LoginRequest request;
393 request.set_username(username_.data());
394 request.set_password(password_.data());
395 request.set_new_account(create);
396 request.set_version(kVersion);
399 password_.fill(
'\0');
404std::optional<protocol::LoginRequest> LoginScreen::BuildWorlds() {
405 const ImVec2 screen = ImGui::GetIO().DisplaySize;
406 ImGui::SetNextWindowPos({screen.x / 2.0f, screen.y * 0.5f}, ImGuiCond_Always,
408 ImGui::SetNextWindowSize({
Ui(480.0f), 0.0f});
411 BeginPanel(
"Choose a world",
nullptr, kWindowFlags | ImGuiWindowFlags_NoNav);
412 bool refresh = ImGui::IsWindowAppearing() || ImGui::IsKeyPressed(ImGuiKey_F5);
413 const int count =
static_cast<int>(worlds_.size());
414 if (ImGui::IsKeyPressed(ImGuiKey_DownArrow) && selected_world_ + 1 < count) {
417 if (ImGui::IsKeyPressed(ImGuiKey_UpArrow) && selected_world_ > 0) {
420 bool pick = ImGui::IsKeyPressed(ImGuiKey_Enter);
422 for (
int i = 0; i < count; ++i) {
423 const protocol::WorldListing&
world = worlds_[i];
425 std::vector<std::string> line = {absl::Substitute(
426 TrN(
"$0 playing",
"$0 playing",
world.players()),
world.players())};
427 if (
const int yours = CountIn(
world.name()); yours > 0) {
428 line.push_back(absl::Substitute(
Tr(
"$0 of your characters"), yours));
430 if (
world.content() != content_) {
431 line.push_back(
Tr(
"other content"));
435 if (
Row(
"##world",
world.name(), absl::StrJoin(line,
", "),
436 i == selected_world_, &twice)) {
439 pick = pick || twice;
444 ImGui::TextDisabled(
"%s",
Tr(
"No worlds are up."));
445 ImGui::TextDisabled(
"%s",
Tr(
"Start nanommo_server, then Refresh."));
448 const float third = (ImGui::GetContentRegionAvail().x -
449 2.0f * ImGui::GetStyle().ItemSpacing.x) /
451 const bool log_out =
GameButton(
"Log out", {third, 0.0f});
453 refresh =
GameButton(
"Refresh", {third, 0.0f}) || refresh;
455 pick =
GameButton(
"Continue", {third, 0.0f},
true) || pick;
456 ShowErrorText(error_);
463 step_ = Step::kAccount;
466 if (pick && count > 0) {
467 const protocol::WorldListing& picked = worlds_[selected_world_];
470 if (picked.content() != content_) {
471 error_ = absl::Substitute(
Tr(
"$0 has other content than this client, so "
472 "they can't play together."),
478 step_ = Step::kCharacters;
479 const std::vector<const protocol::CharacterListing*> here = Here();
480 picked_ = here.empty() ? 0 : here.front()->id();
491 return WithSession();
494std::optional<protocol::LoginRequest> LoginScreen::BuildCharacters() {
498 const protocol::WorldListing&
world = *world_;
499 const std::vector<const protocol::CharacterListing*> here = Here();
500 const auto picked = std::ranges::find_if(
501 here, [&](
const auto* c) {
return c->id() == picked_; });
502 const protocol::CharacterListing* character =
503 picked != here.end() ? *picked :
nullptr;
504 const ImVec2 screen = ImGui::GetIO().DisplaySize;
505 const bool typing = ImGui::GetIO().WantTextInput;
506 if (!typing && !here.empty() && picked != here.end()) {
507 if (ImGui::IsKeyPressed(ImGuiKey_DownArrow) && picked + 1 != here.end()) {
508 picked_ = (*(picked + 1))->
id();
511 if (ImGui::IsKeyPressed(ImGuiKey_UpArrow) && picked != here.begin()) {
512 picked_ = (*(picked - 1))->
id();
518 ImGui::SetNextWindowPos({
Ui(24.0f),
Ui(24.0f)});
519 ImGui::Begin(
"##back",
nullptr, kBare | ImGuiWindowFlags_AlwaysAutoResize);
520 const bool back =
GameButton(
"« Worlds", {0.0f, 0.0f});
523 if (character !=
nullptr) {
525 DrawStage(character->name(),
526 absl::Substitute(
Tr(
"Level $0, in the $1"), character->level(),
531 ImGui::SetNextWindowPos({screen.x -
Ui(48.0f), screen.y * 0.48f},
532 ImGuiCond_Always, {1.0f, 0.5f});
533 ImGui::SetNextWindowSize({
Ui(360.0f), 0.0f});
535 kWindowFlags | ImGuiWindowFlags_NoNav);
537 const bool refresh = ImGui::IsWindowAppearing();
538 for (
const protocol::CharacterListing* each : here) {
539 ImGui::PushID(
static_cast<int>(each->id()));
541 if (
Row(
"##character", each->name(),
542 absl::Substitute(
Tr(
"Level $0, $1"), each->level(),
544 each->id() == picked_)) {
545 picked_ = each->id();
551 ImGui::TextDisabled(
"%s",
Tr(
"Nobody yet."));
557 GameButton(
"New character", {-1.0f,
Ui(kActionHeight)}, here.empty());
560 "%s", absl::Substitute(
Tr(
"$0 is the most a world has room for."),
564 ShowErrorText(error_);
569 bool delete_it =
false;
570 if (character !=
nullptr) {
571 ImGui::SetNextWindowPos({screen.x * 0.42f, screen.y -
Ui(36.0f)},
572 ImGuiCond_Always, {0.5f, 1.0f});
573 ImGui::Begin(
"##enter",
nullptr, kBare | ImGuiWindowFlags_AlwaysAutoResize);
574 const ImVec2 action =
Ui(ImVec2{kActionWidth, kActionHeight});
576 enter =
GameButton(
"Enter the world", action,
true) ||
577 (!typing && ImGui::IsKeyPressed(ImGuiKey_Enter));
582 {1.0f, 0.7f, 0.4f, 1.0f},
"%s",
583 absl::Substitute(
Tr(
"Delete $0 for good?"), character->name())
585 delete_it =
GameButton(
"Delete", action,
true);
595 step_ = Step::kWorlds;
604 protocol::LoginRequest request = WithSession();
605 if (enter && character !=
nullptr) {
606 request.set_enter(
true);
607 request.set_character(character->id());
608 }
else if (delete_it && character !=
nullptr) {
609 request.set_delete_character(
true);
610 request.set_character(character->id());
612 }
else if (!refresh) {
619std::optional<protocol::LoginRequest> LoginScreen::BuildCreate() {
623 const ImVec2 screen = ImGui::GetIO().DisplaySize;
626 ImGui::SetNextWindowPos({
Ui(24.0f),
Ui(24.0f)});
627 ImGui::Begin(
"##back",
nullptr, kBare | ImGuiWindowFlags_AlwaysAutoResize);
628 const bool back =
GameButton(
"« Characters", {0.0f, 0.0f});
631 DrawStage(new_name_[0] !=
'\0' ? new_name_.data() :
Tr(
"A new character"),
632 absl::Substitute(
Tr(
"Level 1, new to $0"), world_->name()));
636 ImGui::SetNextWindowPos({screen.x -
Ui(48.0f), screen.y * 0.48f},
637 ImGuiCond_Always, {1.0f, 0.5f});
638 ImGui::SetNextWindowSize({
Ui(380.0f), 0.0f});
639 BeginPanel(
"A new character###create",
nullptr,
640 kWindowFlags | ImGuiWindowFlags_NoNav);
641 ImGui::TextDisabled(
"%s",
Tr(
"Name"));
642 if (ImGui::IsWindowAppearing()) {
643 ImGui::SetKeyboardFocusHere();
645 ImGui::SetNextItemWidth(-FLT_MIN);
646 const bool named = ImGui::InputTextWithHint(
647 "##name",
Tr(
"Their name"), new_name_.data(), new_name_.size(),
648 ImGuiInputTextFlags_EnterReturnsTrue);
650 uint32_t build = looks_.build();
651 uint32_t skin = looks_.skin();
652 uint32_t hair = looks_.hair();
653 uint32_t hair_color = looks_.hair_color();
654 uint32_t shirt = looks_.shirt();
655 Stepper(
"Build", NamesOf(rig_.builds()), &build);
656 Swatches(
"Skin", figures_.skins(), &skin);
657 Stepper(
"Hair", NamesOf(figures_.hairs()), &hair);
658 Swatches(
"Hair colour", figures_.hair_colors(), &hair_color);
659 Swatches(
"Shirt", Shirts(), &shirt);
660 looks_.set_build(build);
661 looks_.set_skin(skin);
662 looks_.set_hair(hair);
663 looks_.set_hair_color(hair_color);
664 looks_.set_shirt(shirt);
668 (ImGui::GetContentRegionAvail().x - ImGui::GetStyle().ItemSpacing.x) /
671 const float height =
Ui(kActionHeight);
676 const bool create =
GameButton(
"Create", {half, height},
true) || named;
677 ShowErrorText(error_);
681 step_ = Step::kCharacters;
685 if (!create || !world_) {
691 protocol::LoginRequest request = WithSession();
692 request.set_create_character(
true);
693 request.set_world(world_->name());
694 request.set_name(new_name_.data());
695 *request.mutable_looks() = looks_;
700void LoginScreen::DrawStage(
const std::string& name,
const std::string& line) {
701 const ImVec2 screen = ImGui::GetIO().DisplaySize;
702 const ImVec2 stage{
Ui(380.0f),
Ui(506.0f)};
703 const ImVec2 stage_min{screen.x * 0.42f - stage.x / 2.0f,
704 screen.y * 0.5f - stage.y / 2.0f};
705 const ImVec2 stage_max{stage_min.x + stage.x, stage_min.y + stage.y};
706 ImGui::SetNextWindowPos(stage_min);
707 ImGui::SetNextWindowSize({stage.x, stage.y +
Ui(90.0f)});
708 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, {0.0f, 0.0f});
709 ImGui::Begin(
"##stage",
nullptr, kBare);
710 ImGui::PopStyleVar();
711 ImDrawList* draw = ImGui::GetWindowDrawList();
713 const ImVec2 floor{(stage_min.x + stage_max.x) / 2.0f,
714 stage_max.y - stage.y * 0.035f};
715 for (
int ring = 8; ring >= 1; --ring) {
716 const float share =
static_cast<float>(ring) / 8.0f;
717 draw->AddEllipseFilled({floor.x, floor.y - stage.y * 0.4f},
718 {stage.x * 0.55f * share, stage.y * 0.55f * share},
721 ImGui::SetCursorScreenPos(stage_min);
722 ImGui::InvisibleButton(
"##preview", stage);
724 draw->AddImage(
static_cast<ImTextureID
>(preview_.texture().id), stage_min,
725 stage_max, {0.0f, 1.0f}, {1.0f, 0.0f});
726 const ImGuiIO& io = ImGui::GetIO();
727 if (ImGui::IsItemActive()) {
728 turn_ += io.MouseDelta.x * kTurnPerPixel /
UiScale();
730 if (ImGui::IsItemHovered()) {
731 ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW);
733 std::clamp(distance_ - io.MouseWheel * kZoomStep, kNearest, kFarthest);
737 const float name_size =
Ui(30.0f);
738 const ImVec2 name_extent =
739 title->CalcTextSizeA(name_size, FLT_MAX, 0.0f, name.c_str());
741 {floor.x - name_extent.x / 2.0f, stage_max.y +
Ui(6.0f)},
743 const float line_size =
Ui(17.0f);
744 const ImVec2 line_extent =
745 GetFonts().
text->CalcTextSizeA(line_size, FLT_MAX, 0.0f, line.c_str());
748 {floor.x - line_extent.x / 2.0f, stage_max.y +
Ui(10.0f) + name_extent.y},
753void LoginScreen::StartCreating() {
754 step_ = Step::kCreate;
755 new_name_.fill(
'\0');
762void LoginScreen::PickAnyLooks() {
763 const auto any = [](
int count) {
764 return count > 0 ?
static_cast<uint32_t
>(GetRandomValue(0, count - 1)) : 0u;
766 looks_.set_build(any(rig_.builds_size()));
767 looks_.set_skin(any(figures_.skins_size()));
768 looks_.set_hair_color(any(figures_.hair_colors_size()));
769 looks_.set_hair(any(figures_.hairs_size()));
773protocol::CharacterListing LoginScreen::Draft()
const {
774 protocol::CharacterListing draft;
775 draft.set_name(new_name_.data());
777 draft.set_fresh(
true);
778 *draft.mutable_looks() = looks_;
784 std::optional<protocol::CharacterListing> shown;
785 if (step_ == Step::kCreate) {
787 }
else if (step_ == Step::kCharacters && world_) {
788 const auto found = std::ranges::find_if(
789 characters_, [&](
const auto& c) {
return c.id() == picked_; });
790 if (found != characters_.end()) {
800 figure.
to_time =
static_cast<float>(GetTime());
803 constexpr float kFov = 35.0f;
804 constexpr float kTop = 2.0f;
806 std::max(0.9f, kTop - distance_ * std::tan(kFov / 2.0f * DEG2RAD));
807 const Camera3D camera{
808 .position = {0.0f, height + 0.1f, distance_},
809 .target = {0.0f, height, 0.0f},
810 .up = {0.0f, 1.0f, 0.0f},
812 .projection = CAMERA_PERSPECTIVE,
814 preview_.RenderPreview(renderer, figure, camera);
void Show(const protocol::LoginReply &reply)
std::string character_name() const
The name of the character picked, once it's entering.
void Render(const Renderer &renderer)
const std::optional< protocol::WorldListing > & world() const
The world picked, which a token from an enter request is for.
static Figure FigureOf(const protocol::CharacterListing &character, const ItemTable &items, const figures::Figures &figures=figures::Figures::default_instance())
std::optional< protocol::LoginRequest > Build()
constexpr ImU32 kGoldDark
constexpr ImU32 kGoldLight
constexpr int kShirtColors
How many colours there are to dye a player's clothes in.
bool BeginPanel(const char *name, bool *open, ImGuiWindowFlags flags, float alpha)
std::string Translated(const protocol::Message &message, const Content &content)
void DrawLogo(ImDrawList *draw, ImVec2 top_centre, float size)
Color ShirtColor(uint32_t shirt)
constexpr int kCharactersPerWorld
const char * Tr(const char *text)
const char * TrN(const char *one, const char *many, uint64_t n)
The form for the count: in English, one for 1 and many for the rest.
std::string LandName(std::string_view land)
ImU32 Faded(ImU32 color, float share)
The same colour, with its alpha times the share.
void DrawBackdrop(ImDrawList *draw, ImVec2 size, float time)
Features FeaturesOf(const figures::Figures &figures, uint32_t id)
bool GameButton(const char *label, ImVec2 size, bool primary, bool enabled)
void DrawGradientText(ImDrawList *draw, ImFont *font, float size, ImVec2 at, ImU32 top, ImU32 bottom, const char *text)
void DrawShadowedText(ImDrawList *draw, ImFont *font, float size, ImVec2 at, ImU32 color, const char *text)
Text with a shadow under it.
std::string Row(const Event &event, const Content &content, std::string_view world, absl::Time time)
const char * NameOf(const items::Item &item)
The items in the items file, by id.
std::vector< items::Stack > starting
What each new player starts with.
std::map< uint32_t, items::Item > by_id