summaryrefslogtreecommitdiff
path: root/src/net/manaserv/generalhandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/manaserv/generalhandler.cpp')
-rw-r--r--src/net/manaserv/generalhandler.cpp64
1 files changed, 36 insertions, 28 deletions
diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp
index 4f6ade4e..a1ba746f 100644
--- a/src/net/manaserv/generalhandler.cpp
+++ b/src/net/manaserv/generalhandler.cpp
@@ -46,7 +46,7 @@
#include "net/manaserv/partyhandler.h"
#include "net/manaserv/playerhandler.h"
#include "net/manaserv/specialhandler.h"
-#include "net/manaserv/stats.h"
+#include "net/manaserv/attributes.h"
#include "net/manaserv/tradehandler.h"
#include "utils/gettext.h"
@@ -90,6 +90,9 @@ GeneralHandler::GeneralHandler():
chatServerConnection = getConnection();
generalHandler = this;
+
+ listen(Event::ClientChannel);
+ listen(Event::GameChannel);
}
void GeneralHandler::load()
@@ -127,9 +130,9 @@ void GeneralHandler::reload()
gameServer.clear();
chatServer.clear();
- Stats::unload();
- Stats::load();
- Stats::informItemDB();
+ Attributes::unload();
+ Attributes::load();
+ Attributes::informItemDB();
}
void GeneralHandler::unload()
@@ -147,7 +150,7 @@ void GeneralHandler::unload()
delete gameServerConnection;
delete chatServerConnection;
- Stats::unload();
+ Attributes::unload();
finalize();
}
@@ -163,38 +166,43 @@ void GeneralHandler::flushNetwork()
}
}
-void GeneralHandler::guiWindowsLoaded()
-{
- inventoryWindow->setSplitAllowed(true);
- skillDialog->loadSkills();
- specialsWindow->loadSpecials("specials.xml");
-
- player_node->setExpNeeded(100);
-
- Stats::informStatusWindow();
-}
-
-void GeneralHandler::guiWindowsUnloaded()
-{
- // TODO
-}
-
void GeneralHandler::clearHandlers()
{
clearNetworkHandlers();
}
-void GeneralHandler::stateChanged(State oldState, State newState)
+void GeneralHandler::event(Event::Channel channel,
+ const Event &event)
{
- if (newState == STATE_GAME)
+ if (channel == Event::ClientChannel)
{
- GameHandler *game = static_cast<GameHandler*>(Net::getGameHandler());
- game->gameLoading();
+ if (event.getType() == Event::StateChange)
+ {
+ int newState = event.getInt("newState");
+
+ if (newState == STATE_GAME)
+ {
+ GameHandler *game = static_cast<GameHandler*>(Net::getGameHandler());
+ game->gameLoading();
+ }
+ }
+ else if (event.getType() == Event::LoadingDatabases)
+ {
+ Attributes::load();
+ Attributes::informItemDB();
+ }
}
- else if (newState == STATE_LOAD_DATA)
+ else if (channel == Event::GameChannel)
{
- Stats::load();
- Stats::informItemDB();
+ if (event.getType() == Event::GuiWindowsLoaded)
+ {
+ inventoryWindow->setSplitAllowed(true);
+ skillDialog->loadSkills();
+
+ PlayerInfo::setAttribute(EXP_NEEDED, 100);
+
+ Attributes::informStatusWindow();
+ }
}
}