summaryrefslogtreecommitdiff
path: root/src/net/tmwa/beinghandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa/beinghandler.cpp')
-rw-r--r--src/net/tmwa/beinghandler.cpp69
1 files changed, 47 insertions, 22 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 436b40d13..000941c30 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -167,6 +167,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
Being *srcBeing, *dstBeing;
int hairStyle, hairColor, flag;
int hp, maxHP, oldHP;
+ unsigned char colors[9];
switch (msg.getId())
{
@@ -289,7 +290,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
? GENDER_FEMALE : GENDER_MALE);
// Set these after the gender, as the sprites may be gender-specific
dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1,
- ColorDB::get(hairColor));
+ ColorDB::getHairColor(hairColor));
dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom);
dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid);
dstBeing->setSprite(SPRITE_HAT, headTop);
@@ -620,15 +621,21 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
int type = msg.readInt8();
int id = 0;
int id2 = 0;
+ std::string color;
if (msg.getId() == SMSG_BEING_CHANGE_LOOKS)
{
id = msg.readInt8();
+ id2 = 1; // default color
}
else
{ // SMSG_BEING_CHANGE_LOOKS2
id = msg.readInt16();
- id2 = msg.readInt16();
+ if (type == 2 || serverVersion > 0)
+ id2 = msg.readInt16();
+ else
+ id2 = 1;
+ color = "";
}
if (dstBeing->getType() == Being::PLAYER)
@@ -646,57 +653,57 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
dstBeing->setSpriteID(SPRITE_HAIR, id *-1);
break;
case 2: // Weapon ID in id, Shield ID in id2
- dstBeing->setSprite(SPRITE_WEAPON, id, "", true);
+ dstBeing->setSprite(SPRITE_WEAPON, id, "", 1, true);
if (!config.getBoolValue("hideShield"))
dstBeing->setSprite(SPRITE_SHIELD, id2);
player_node->imitateOutfit(dstBeing, SPRITE_SHIELD);
break;
case 3: // Change lower headgear for eAthena, pants for us
- dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, id);
+ dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, id, color, id2);
player_node->imitateOutfit(dstBeing, SPRITE_BOTTOMCLOTHES);
break;
case 4: // Change upper headgear for eAthena, hat for us
- dstBeing->setSprite(SPRITE_HAT, id);
+ dstBeing->setSprite(SPRITE_HAT, id, color, id2);
player_node->imitateOutfit(dstBeing, SPRITE_HAT);
break;
case 5: // Change middle headgear for eathena, armor for us
- dstBeing->setSprite(SPRITE_TOPCLOTHES, id);
+ dstBeing->setSprite(SPRITE_TOPCLOTHES, id, color, id2);
player_node->imitateOutfit(dstBeing, SPRITE_TOPCLOTHES);
break;
case 6: // eAthena LOOK_HAIR_COLOR
- dstBeing->setSpriteColor(SPRITE_HAIR, ColorDB::get(id));
+ dstBeing->setSpriteColor(SPRITE_HAIR, ColorDB::getHairColor(id));
break;
case 8: // eAthena LOOK_SHIELD
if (!config.getBoolValue("hideShield"))
- dstBeing->setSprite(SPRITE_SHIELD, id);
+ dstBeing->setSprite(SPRITE_SHIELD, id, color, id2);
player_node->imitateOutfit(dstBeing, SPRITE_SHIELD);
break;
case 9: // eAthena LOOK_SHOES
- dstBeing->setSprite(SPRITE_SHOE, id);
+ dstBeing->setSprite(SPRITE_SHOE, id, color, id2);
player_node->imitateOutfit(dstBeing, SPRITE_SHOE);
break;
case 10: // LOOK_GLOVES
- dstBeing->setSprite(SPRITE_GLOVES, id);
+ dstBeing->setSprite(SPRITE_GLOVES, id, color, id2);
player_node->imitateOutfit(dstBeing, SPRITE_GLOVES);
break;
case 11: // LOOK_CAPE
- dstBeing->setSprite(SPRITE_CAPE, id);
+ dstBeing->setSprite(SPRITE_CAPE, id, color, id2);
player_node->imitateOutfit(dstBeing, SPRITE_CAPE);
break;
case 12:
- dstBeing->setSprite(SPRITE_MISC1, id);
+ dstBeing->setSprite(SPRITE_MISC1, id, color, id2);
player_node->imitateOutfit(dstBeing, SPRITE_MISC1);
break;
case 13:
- dstBeing->setSprite(SPRITE_MISC2, id);
+ dstBeing->setSprite(SPRITE_MISC2, id, color, id2);
player_node->imitateOutfit(dstBeing, SPRITE_MISC2);
break;
case 14:
- dstBeing->setSprite(SPRITE_EVOL1, id);
+ dstBeing->setSprite(SPRITE_EVOL1, id, color, id2);
player_node->imitateOutfit(dstBeing, SPRITE_EVOL1);
break;
case 15:
- dstBeing->setSprite(SPRITE_EVOL2, id);
+ dstBeing->setSprite(SPRITE_EVOL2, id, color, id2);
player_node->imitateOutfit(dstBeing, SPRITE_EVOL2);
break;
default:
@@ -870,8 +877,17 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
headTop = msg.readInt16();
headMid = msg.readInt16();
hairColor = msg.readInt16();
- shoes = msg.readInt16();
- gloves = msg.readInt16(); //sd->head_dir
+
+ colors[0] = msg.readInt8();
+ colors[1] = msg.readInt8();
+ colors[2] = msg.readInt8();
+ logger->log("msg: %x", msg.getId());
+ logger->log("colors: %d, %d, %d", colors[0], colors[1], colors[2]);
+
+ msg.readInt8(); //unused
+// shoes = msg.readInt16();
+// gloves = msg.readInt16(); //sd->head_dir
+
guild = msg.readInt32(); // guild
if (guild == 0)
@@ -887,19 +903,28 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
? GENDER_FEMALE : GENDER_MALE);
// Set these after the gender, as the sprites may be gender-specific
- dstBeing->setSprite(SPRITE_WEAPON, weapon, "", true);
+ dstBeing->setSprite(SPRITE_WEAPON, weapon, "", 1, true);
if (!config.getBoolValue("hideShield"))
dstBeing->setSprite(SPRITE_SHIELD, shield);
//dstBeing->setSprite(SPRITE_SHOE, shoes);
- dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom);
- dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid);
- dstBeing->setSprite(SPRITE_HAT, headTop);
+ if (serverVersion > 0)
+ {
+ dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom, "", colors[0]);
+ dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid, "", colors[2]);
+ dstBeing->setSprite(SPRITE_HAT, headTop, "", colors[1]);
+ }
+ else
+ {
+ dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom);
+ dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid);
+ dstBeing->setSprite(SPRITE_HAT, headTop);
+ }
//dstBeing->setSprite(SPRITE_GLOVES, gloves);
//dstBeing->setSprite(SPRITE_CAPE, cape);
//dstBeing->setSprite(SPRITE_MISC1, misc1);
//dstBeing->setSprite(SPRITE_MISC2, misc2);
dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1,
- ColorDB::get(hairColor));
+ ColorDB::getHairColor(hairColor));
player_node->imitateOutfit(dstBeing);