summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2012-01-18 19:20:34 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2012-02-02 15:31:41 +0100
commitf5de9ae444f1bca1f6ba6969214e9a8cacb15f68 (patch)
treef9b9c699c52d279cdc4d93b09f48dd3b24403f5b /src/net/tmwa
parent7cc504d993fa948ae2e10848993f4552b2d6daaa (diff)
downloadmana-client-f5de9ae444f1bca1f6ba6969214e9a8cacb15f68.tar.gz
mana-client-f5de9ae444f1bca1f6ba6969214e9a8cacb15f68.tar.bz2
mana-client-f5de9ae444f1bca1f6ba6969214e9a8cacb15f68.tar.xz
mana-client-f5de9ae444f1bca1f6ba6969214e9a8cacb15f68.zip
Fix to the hair colors and styles handling.
- I made the charCreatedialog handle a possible max permitted color Id and a minimum hair style id for tA. - Added a foundation to later load the styles and colors from the same file, to handle the Mana-issue #224 for manaserv. - Support for non-contiguous hair color and style ids has also been added. - I also replaced the < and > arrow signs with images. Reviewed-by: Ben Longbons, Thorbjørn Lindeijer
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/beinghandler.cpp9
-rw-r--r--src/net/tmwa/charserverhandler.cpp3
-rw-r--r--src/net/tmwa/charserverhandler.h10
3 files changed, 18 insertions, 4 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index bcfb335f..c94e08df 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -245,7 +245,8 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
dstBeing->setGender((gender == 0)
? GENDER_FEMALE : GENDER_MALE);
// Set these after the gender, as the sprites may be gender-specific
- dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1, HairDB::get(hairColor));
+ dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1,
+ hairDB.getHairColor(hairColor));
dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom);
dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid);
dstBeing->setSprite(SPRITE_HAT, headTop);
@@ -486,7 +487,8 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
dstBeing->setSprite(SPRITE_TOPCLOTHES, id);
break;
case 6: // eAthena LOOK_HAIR_COLOR
- dstBeing->setSpriteColor(SPRITE_HAIR, HairDB::get(id));
+ dstBeing->setSpriteColor(SPRITE_HAIR,
+ hairDB.getHairColor(id));
break;
case 8: // eAthena LOOK_SHIELD
dstBeing->setSprite(SPRITE_SHIELD, id);
@@ -613,7 +615,8 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
//dstBeing->setSprite(SPRITE_CAPE, cape);
//dstBeing->setSprite(SPRITE_MISC1, misc1);
//dstBeing->setSprite(SPRITE_MISC2, misc2);
- dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1, HairDB::get(hairColor));
+ dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1,
+ hairDB.getHairColor(hairColor));
if (msg.getId() == SMSG_PLAYER_MOVE)
{
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index d794f2cf..8834798f 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -240,7 +240,8 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, Net::Character *char
tempPlayer->setSprite(SPRITE_SHIELD, msg.readInt16());
tempPlayer->setSprite(SPRITE_HAT, msg.readInt16()); // head option top
tempPlayer->setSprite(SPRITE_TOPCLOTHES, msg.readInt16()); // head option mid
- tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1, HairDB::get(msg.readInt16()));
+ tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1,
+ hairDB.getHairColor(msg.readInt16()));
tempPlayer->setSprite(SPRITE_MISC2, msg.readInt16());
tempPlayer->setName(msg.readString(24));
diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h
index 7a7b6a67..31b2ba8e 100644
--- a/src/net/tmwa/charserverhandler.h
+++ b/src/net/tmwa/charserverhandler.h
@@ -69,6 +69,16 @@ class CharServerHandler : public MessageHandler, public Net::CharHandler
unsigned int maxSprite() const;
+ // Must be < 12 at character creation time, but can be higher
+ // after that.
+ int getCharCreateMaxHairColorId() const
+ { return 11; }
+
+ // Must be < 20 at character creation time, but can be higher
+ // after that.
+ int getCharCreateMaxHairStyleId() const
+ { return 19; }
+
void connect();
private: