summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp9
-rw-r--r--src/gui/charcreatedialog.cpp33
-rw-r--r--src/net/charserverhandler.h1
-rw-r--r--src/net/eathena/charserverhandler.cpp1
-rw-r--r--src/net/eathena/charserverhandler.h1
-rw-r--r--src/net/tmwa/beinghandler.cpp3
-rw-r--r--src/net/tmwa/charserverhandler.cpp6
-rw-r--r--src/net/tmwa/charserverhandler.h1
-rw-r--r--src/resources/iteminfo.cpp12
-rw-r--r--src/resources/iteminfo.h2
10 files changed, 52 insertions, 17 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 37a1cb84d..e0d849ce3 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -280,15 +280,20 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look)
id = -100;
// TRANSLATORS: default race name
setRaceName(_("Human"));
+ if (Net::getCharServerHandler())
+ setSprite(Net::getCharServerHandler()->baseSprite(), id);
}
else
{
const ItemInfo &info = ItemDB::get(id);
setRaceName(info.getName());
+ if (Net::getCharServerHandler())
+ {
+ setSprite(Net::getCharServerHandler()->baseSprite(),
+ id, info.getColor(mLook));
+ }
}
- if (Net::getCharServerHandler())
- setSprite(Net::getCharServerHandler()->baseSprite(), id);
}
}
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index f9dd1e675..c32098b63 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -174,7 +174,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
mRaceLabel = new Label(this, _("Race:"));
mRaceNameLabel = new Label(this, "");
}
- if (mMinLook < mMaxLook)
+ if (serverVersion >= 9 && mMinLook < mMaxLook)
{
// TRANSLATORS: char create dialog button
mNextLookButton = new Button(this, _(">"), "nextlook", this);
@@ -230,7 +230,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
mHairStyleLabel->setPosition(labelX, y);
mHairStyleNameLabel->setPosition(nameX, y);
- if (mMinLook < mMaxLook)
+ if (serverVersion >= 9 && mMinLook < mMaxLook)
{
y += 24;
mPrevLookButton->setPosition(leftX, y);
@@ -270,7 +270,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
add(mActionButton);
add(mRotateButton);
- if (mMinLook < mMaxLook)
+ if (serverVersion >= 9 && mMinLook < mMaxLook)
{
add(mNextLookButton);
add(mPrevLookButton);
@@ -301,7 +301,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
updateHair();
if (serverVersion >= 2)
updateRace();
- if (mMinLook < mMaxLook)
+ if (serverVersion >= 9 && mMinLook < mMaxLook)
updateLook();
updatePlayer();
@@ -349,7 +349,7 @@ void CharCreateDialog::action(const gcn::ActionEvent &event)
Net::getCharServerHandler()->newCharacter(getName(), characterSlot,
mFemale->isSelected(), mHairStyle, mHairColor,
- static_cast<unsigned char>(mRace), atts);
+ static_cast<unsigned char>(mRace), mLook, atts);
}
else
{
@@ -613,32 +613,37 @@ void CharCreateDialog::updateRace()
else if (mRace >= Being::getNumOfRaces())
mRace = 0;
- mPlayer->setSubtype(static_cast<uint16_t>(mRace), mLook);
- const ItemInfo &item = ItemDB::get(-100 - mRace);
- mRaceNameLabel->setCaption(item.getName());
- mRaceNameLabel->adjustSize();
+ updateLook();
}
void CharCreateDialog::updateLook()
{
const ItemInfo &item = ItemDB::get(-100 - mRace);
const int sz = item.getColorsSize();
- if (sz > 0)
+ if (sz > 0 && serverVersion >= 9)
{
if (mLook < 0)
mLook = sz - 1;
if (mLook > mMaxLook)
- mLook = mMaxLook;
+ mLook = mMinLook;
if (mLook >= sz)
- mLook = 0;
+ mLook = mMinLook;
}
else
{
mLook = 0;
}
mPlayer->setSubtype(static_cast<uint16_t>(mRace), mLook);
- mLookNameLabel->setCaption(item.getColorName(mLook));
- mLookNameLabel->adjustSize();
+ if (mRaceNameLabel)
+ {
+ mRaceNameLabel->setCaption(item.getName());
+ mRaceNameLabel->adjustSize();
+ }
+ if (mLookNameLabel)
+ {
+ mLookNameLabel->setCaption(item.getColorName(mLook));
+ mLookNameLabel->adjustSize();
+ }
}
void CharCreateDialog::logic()
diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h
index 2722d833a..2dee5c05e 100644
--- a/src/net/charserverhandler.h
+++ b/src/net/charserverhandler.h
@@ -83,6 +83,7 @@ class CharServerHandler
const bool gender, const int hairstyle,
const int hairColor,
const unsigned char race,
+ const unsigned char look,
const std::vector<int> &stats) const = 0;
virtual void deleteCharacter(Net::Character *const character) = 0;
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index 8c82ed85d..1d4928bc9 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -214,6 +214,7 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot,
const bool gender A_UNUSED,
const int hairstyle, const int hairColor,
const unsigned char race A_UNUSED,
+ const unsigned char look A_UNUSED,
const std::vector<int> &stats) const
{
MessageOut outMsg(CMSG_CHAR_CREATE);
diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h
index 2dfdff8c1..215e14235 100644
--- a/src/net/eathena/charserverhandler.h
+++ b/src/net/eathena/charserverhandler.h
@@ -54,6 +54,7 @@ class CharServerHandler final : public MessageHandler,
void newCharacter(const std::string &name, const int slot,
const bool gender, const int hairstyle,
const int hairColor, const unsigned char race,
+ const unsigned char look,
const std::vector<int> &stats) const override;
void deleteCharacter(Net::Character *const character) override;
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index e68e9f80b..70e57c9a4 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -380,6 +380,9 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg,
static_cast<unsigned char>(id2));
player_node->imitateOutfit(dstBeing, SPRITE_EVOL2);
break;
+ case 16:
+ dstBeing->setLook(id);
+ break;
default:
logger->log("QQQ3 CHANGE_LOOKS: unsupported type: "
"%d, id: %d", type, id);
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 68699e327..64626becb 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -248,6 +248,7 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot,
const int hairstyle,
const int hairColor,
const unsigned char race,
+ const unsigned char look,
const std::vector<int> &stats) const
{
MessageOut outMsg(CMSG_CHAR_CREATE);
@@ -259,7 +260,10 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot,
outMsg.writeInt8(static_cast<int8_t>(hairColor));
outMsg.writeInt8(0); // unused
outMsg.writeInt8(static_cast<int8_t>(hairstyle));
- outMsg.writeInt8(123); // look
+ if (serverVersion >= 9)
+ outMsg.writeInt8(look);
+ else
+ outMsg.writeInt8(0);
if (serverVersion >= 2)
outMsg.writeInt8(race);
}
diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h
index 156302c80..412c77385 100644
--- a/src/net/tmwa/charserverhandler.h
+++ b/src/net/tmwa/charserverhandler.h
@@ -54,6 +54,7 @@ class CharServerHandler final : public MessageHandler,
void newCharacter(const std::string &name, const int slot,
const bool gender, const int hairstyle,
const int hairColor, const unsigned char race,
+ const unsigned char look,
const std::vector<int> &stats) const override;
void deleteCharacter(Net::Character *const character) override;
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 78740522f..9ca3f4f1e 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -321,3 +321,15 @@ std::string ItemInfo::getColorName(const int idx) const
return std::string();
return it->second.name;
}
+
+std::string ItemInfo::getColor(const int idx) const
+{
+ if (!mColors)
+ return std::string();
+
+ const std::map <int, ColorDB::ItemColor>::const_iterator
+ it = mColors->find(idx);
+ if (it == mColors->end())
+ return std::string();
+ return it->second.color;
+}
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 3e6d0d249..e3dfe29d7 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -297,6 +297,8 @@ class ItemInfo final
std::string getColorName(const int idx) const;
+ std::string getColor(const int idx) const;
+
int mDrawBefore[10];
int mDrawAfter[10];
int mDrawPriority[10];