diff --git a/data/XML/outfits.xml b/data/XML/outfits.xml
index fca7ddc..6fbd4f7 100644
--- a/data/XML/outfits.xml
+++ b/data/XML/outfits.xml
@@ -16,44 +16,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -70,41 +32,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/const.h b/src/const.h
index f596521..4a8caf6 100644
--- a/src/const.h
+++ b/src/const.h
@@ -343,4 +343,6 @@ static constexpr int32_t PSTRG_RESERVED_RANGE_SIZE = 10000000;
static constexpr int32_t PSTRG_OUTFITS_RANGE_START = (PSTRG_RESERVED_RANGE_START + 1000);
static constexpr int32_t PSTRG_OUTFITS_RANGE_SIZE = 500;
+#define IS_IN_KEYRANGE(key, range) (key >= PSTRG_##range##_START && ((key - PSTRG_##range##_START) <= PSTRG_##range##_SIZE))
+
#endif
diff --git a/src/otserv.cpp b/src/otserv.cpp
index e6762a4..ce6e996 100644
--- a/src/otserv.cpp
+++ b/src/otserv.cpp
@@ -220,6 +220,13 @@ void mainLoader(int, char*[], ServiceManager* services)
return;
}
+ std::cout << ">> Loading outfits" << std::endl;
+ auto& outfits = Outfits::getInstance();
+ if (!outfits.loadFromXml()) {
+ startupErrorMessage("Unable to load outfits!");
+ return;
+ }
+
std::cout << ">> Checking world type... " << std::flush;
std::string worldType = asLowerCaseString(g_config.getString(ConfigManager::WORLD_TYPE));
if (worldType == "pvp") {
diff --git a/src/player.cpp b/src/player.cpp
index 7d17518..29e66c7 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -509,6 +509,20 @@ uint16_t Player::getLookCorpse() const
void Player::addStorageValue(const uint32_t key, const int32_t value)
{
+ if (IS_IN_KEYRANGE(key, RESERVED_RANGE)) {
+ if (IS_IN_KEYRANGE(key, OUTFITS_RANGE)) {
+ outfits.emplace_back(
+ value >> 16,
+ value & 0xFF
+ );
+ return;
+ }
+ else {
+ std::cout << "Warning: unknown reserved key: " << key << " player: " << getName() << std::endl;
+ return;
+ }
+ }
+
if (value != -1) {
storageMap[key] = value;
} else {
diff --git a/src/protocolgame.cpp b/src/protocolgame.cpp
index d128c4f..b004596 100644
--- a/src/protocolgame.cpp
+++ b/src/protocolgame.cpp
@@ -1738,7 +1738,7 @@ void ProtocolGame::sendOutfitWindow()
}
protocolOutfits.emplace_back(outfit.name, outfit.lookType, addons);
- if (protocolOutfits.size() == 100) { // Game client doesn't allow more than 100 outfits
+ if (protocolOutfits.size() == 15) { // Game client doesn't allow more than 15 outfits
break;
}
}
@@ -1746,7 +1746,6 @@ void ProtocolGame::sendOutfitWindow()
msg.addByte(protocolOutfits.size());
for (const ProtocolOutfit& outfit : protocolOutfits) {
msg.add(outfit.lookType);
- msg.addString(outfit.name);
msg.addByte(outfit.addons);
}