diff options
Diffstat (limited to 'src/net/manaserv/generalhandler.cpp')
-rw-r--r-- | src/net/manaserv/generalhandler.cpp | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp index e1559d16..6fbbb954 100644 --- a/src/net/manaserv/generalhandler.cpp +++ b/src/net/manaserv/generalhandler.cpp @@ -22,6 +22,7 @@ #include "net/manaserv/generalhandler.h" #include "client.h" +#include "event.h" #include "gui/changeemaildialog.h" #include "gui/charselectdialog.h" @@ -90,6 +91,9 @@ GeneralHandler::GeneralHandler(): chatServerConnection = getConnection(); generalHandler = this; + + listen("Client"); + listen("Game"); } void GeneralHandler::load() @@ -163,37 +167,40 @@ void GeneralHandler::flushNetwork() } } -void GeneralHandler::guiWindowsLoaded() -{ - inventoryWindow->setSplitAllowed(true); - skillDialog->loadSkills("mana-skills.xml"); - - PlayerInfo::setAttribute(EXP_NEEDED, 100); - - Stats::informStatusWindow(); -} - -void GeneralHandler::guiWindowsUnloaded() -{ - // TODO -} - void GeneralHandler::clearHandlers() { clearNetworkHandlers(); } -void GeneralHandler::stateChanged(State oldState, State newState) +void GeneralHandler::event(const std::string &channel, + const Mana::Event &event) { - if (newState == STATE_GAME) + if (channel == "Client") { - GameHandler *game = static_cast<GameHandler*>(Net::getGameHandler()); - game->gameLoading(); + int newState = event.getInt("newState"); + + if (newState == STATE_GAME) + { + GameHandler *game = static_cast<GameHandler*>(Net::getGameHandler()); + game->gameLoading(); + } + else if (newState == STATE_LOAD_DATA) + { + Stats::load(); + Stats::informItemDB(); + } } - else if (newState == STATE_LOAD_DATA) + else if (channel == "Game") { - Stats::load(); - Stats::informItemDB(); + if (event.getName() == "GuiWindowsLoaded") + { + inventoryWindow->setSplitAllowed(true); + skillDialog->loadSkills("mana-skills.xml"); + + PlayerInfo::setAttribute(EXP_NEEDED, 100); + + Stats::informStatusWindow(); + } } } |