mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 08:03:50 +00:00
Add /logout chat command
This commit is contained in:
parent
b758f45a9f
commit
0ef0a9e028
3 changed files with 25 additions and 0 deletions
|
|
@ -58,6 +58,7 @@ public:
|
||||||
// Single-player mode
|
// Single-player mode
|
||||||
void startSinglePlayer();
|
void startSinglePlayer();
|
||||||
bool isSinglePlayer() const { return singlePlayerMode; }
|
bool isSinglePlayer() const { return singlePlayerMode; }
|
||||||
|
void logoutToLogin();
|
||||||
|
|
||||||
// Weapon loading (called at spawn and on equipment change)
|
// Weapon loading (called at spawn and on equipment change)
|
||||||
void loadEquippedWeapons();
|
void loadEquippedWeapons();
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
#include "rendering/wmo_renderer.hpp"
|
#include "rendering/wmo_renderer.hpp"
|
||||||
#include "rendering/minimap.hpp"
|
#include "rendering/minimap.hpp"
|
||||||
#include "rendering/loading_screen.hpp"
|
#include "rendering/loading_screen.hpp"
|
||||||
|
#include "audio/music_manager.hpp"
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include "pipeline/m2_loader.hpp"
|
#include "pipeline/m2_loader.hpp"
|
||||||
#include "pipeline/wmo_loader.hpp"
|
#include "pipeline/wmo_loader.hpp"
|
||||||
|
|
@ -346,6 +347,23 @@ void Application::setState(AppState newState) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::logoutToLogin() {
|
||||||
|
LOG_INFO("Logout requested");
|
||||||
|
if (gameHandler) {
|
||||||
|
gameHandler->disconnect();
|
||||||
|
gameHandler->setSinglePlayerMode(false);
|
||||||
|
}
|
||||||
|
singlePlayerMode = false;
|
||||||
|
npcsSpawned = false;
|
||||||
|
world.reset();
|
||||||
|
if (renderer) {
|
||||||
|
if (auto* music = renderer->getMusicManager()) {
|
||||||
|
music->stopMusic(0.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setState(AppState::AUTHENTICATION);
|
||||||
|
}
|
||||||
|
|
||||||
void Application::update(float deltaTime) {
|
void Application::update(float deltaTime) {
|
||||||
// Update based on current state
|
// Update based on current state
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
|
|
||||||
|
|
@ -650,6 +650,12 @@ void GameScreen::sendChatMessage(game::GameHandler& gameHandler) {
|
||||||
// Convert to lowercase
|
// Convert to lowercase
|
||||||
for (char& c : command) c = std::tolower(c);
|
for (char& c : command) c = std::tolower(c);
|
||||||
|
|
||||||
|
if (command == "logout") {
|
||||||
|
core::Application::getInstance().logoutToLogin();
|
||||||
|
chatInputBuffer[0] = '\0';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::string emoteText = rendering::Renderer::getEmoteText(command);
|
std::string emoteText = rendering::Renderer::getEmoteText(command);
|
||||||
if (!emoteText.empty()) {
|
if (!emoteText.empty()) {
|
||||||
// Play the emote animation
|
// Play the emote animation
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue