summaryrefslogtreecommitdiff
path: root/src/net/tmwa/charserverhandler.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2013-04-27 21:43:32 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2013-04-27 22:07:06 +0200
commit4b0da49b28bb64d2da293ca90fec63079c2c5849 (patch)
tree7cf17967002737836199966e6e123de417943d4d /src/net/tmwa/charserverhandler.cpp
parent1a99d37d059df95f6a144c4f9e9fa85dacefd185 (diff)
downloadmana-client-4b0da49b28bb64d2da293ca90fec63079c2c5849.tar.gz
mana-client-4b0da49b28bb64d2da293ca90fec63079c2c5849.tar.bz2
mana-client-4b0da49b28bb64d2da293ca90fec63079c2c5849.tar.xz
mana-client-4b0da49b28bb64d2da293ca90fec63079c2c5849.zip
Added support for charcreation.xml settings
This file was introduced by ManaPlus as a way of configuring the character creation process. It defines the number of hair styles and colors, how stat points should be divided and what the starting equipment of the player is. The minimum and maximum hair color/style IDs are not supported at the moment. This is mostly a backport of ManaPlus commits 10cf52b5 and dcc18eba, with some style changes. Mantis-issue: 501 Reviewed-by: Ablu
Diffstat (limited to 'src/net/tmwa/charserverhandler.cpp')
-rw-r--r--src/net/tmwa/charserverhandler.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index cc242951..7c5f5c88 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -39,6 +39,7 @@
#include "net/tmwa/protocol.h"
#include "resources/attributes.h"
+#include "resources/chardb.h"
#include "resources/hairdb.h"
#include "utils/dtor.h"
@@ -279,10 +280,17 @@ void CharServerHandler::setCharCreateDialog(CharCreateDialog *window)
const Token &token =
static_cast<LoginHandler*>(Net::getLoginHandler())->getToken();
- mCharCreateDialog->setAttributes(attributes,
- Attributes::getCreationPoints(),
- Attributes::getAttributeMinimum(),
- Attributes::getAttributeMaximum());
+ unsigned minStat = CharDB::getMinStat();
+ if (minStat == 0)
+ minStat = Attributes::getAttributeMinimum();
+ unsigned maxStat = CharDB::getMaxStat();
+ if (maxStat == 0)
+ maxStat = Attributes::getAttributeMaximum();
+ unsigned sumStat = CharDB::getSumStat();
+ if (sumStat == 0)
+ sumStat = Attributes::getCreationPoints();
+
+ mCharCreateDialog->setAttributes(attributes, sumStat, minStat, maxStat);
mCharCreateDialog->setFixedGender(true, token.sex);
}
@@ -346,6 +354,18 @@ unsigned int CharServerHandler::maxSprite() const
return SPRITE_VECTOREND;
}
+int CharServerHandler::getCharCreateMaxHairColorId() const
+{
+ const int max = CharDB::getMaxHairColor();
+ return max ? max : 11; // default maximum
+}
+
+int CharServerHandler::getCharCreateMaxHairStyleId() const
+{
+ const int max = CharDB::getMaxHairStyle();
+ return max ? max : 19; // default maximum
+}
+
void CharServerHandler::connect()
{
const Token &token =