From 1a99d37d059df95f6a144c4f9e9fa85dacefd185 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 27 Apr 2013 16:43:59 +0200 Subject: Always read the attributes.xml file This way it can also be used when connecting to a tmwAthena server for customizing the min/max of attributes and the amount of starting points. Mantis-issue: 501 Reviewed-by: Ablu --- src/net/tmwa/charserverhandler.cpp | 6 +++++- src/net/tmwa/generalhandler.cpp | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index ce193821..cc242951 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -38,6 +38,7 @@ #include "net/tmwa/network.h" #include "net/tmwa/protocol.h" +#include "resources/attributes.h" #include "resources/hairdb.h" #include "utils/dtor.h" @@ -278,7 +279,10 @@ void CharServerHandler::setCharCreateDialog(CharCreateDialog *window) const Token &token = static_cast(Net::getLoginHandler())->getToken(); - mCharCreateDialog->setAttributes(attributes, 30, 1, 9); + mCharCreateDialog->setAttributes(attributes, + Attributes::getCreationPoints(), + Attributes::getAttributeMinimum(), + Attributes::getAttributeMaximum()); mCharCreateDialog->setFixedGender(true, token.sex); } diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 6c2bcddb..0ce16691 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -1,7 +1,7 @@ /* * The Mana Client * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2012 The Mana Developers + * Copyright (C) 2009-2013 The Mana Developers * * This file is part of The Mana Client. * @@ -57,11 +57,11 @@ #include "net/tmwa/gui/guildtab.h" #include "net/tmwa/gui/partytab.h" +#include "resources/attributes.h" #include "resources/itemdb.h" #include "utils/gettext.h" -#include #include extern Net::GeneralHandler *generalHandler; @@ -108,6 +108,7 @@ GeneralHandler::GeneralHandler(): setStatsList(stats); + listen(Event::ClientChannel); listen(Event::GameChannel); } @@ -185,12 +186,17 @@ void GeneralHandler::reload() static_cast(mLoginHandler.get())->clearWorlds(); static_cast(mCharHandler.get())->setCharCreateDialog(0); static_cast(mCharHandler.get())->setCharSelectDialog(0); + + Attributes::unload(); + Attributes::load(); } void GeneralHandler::unload() { if (mNetwork) mNetwork->clearHandlers(); + + Attributes::unload(); } void GeneralHandler::flushNetwork() @@ -220,7 +226,14 @@ void GeneralHandler::clearHandlers() void GeneralHandler::event(Event::Channel channel, const Event &event) { - if (channel == Event::GameChannel) + if (channel == Event::ClientChannel) + { + if (event.getType() == Event::LoadingDatabases) + { + Attributes::load(); + } + } + else if (channel == Event::GameChannel) { if (event.getType() == Event::GuiWindowsLoaded) { -- cgit v1.2.3-70-g09d2