fix set outfit functionality

This commit is contained in:
ErikasKontenis 2019-11-11 20:21:51 +02:00
parent 5535e50562
commit 527debe319
5 changed files with 24 additions and 77 deletions

View File

@ -16,44 +16,6 @@
<outfit type="0" looktype="156" name="Assassin" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="157" name="Beggar" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="158" name="Shaman" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="270" name="Jester" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="288" name="Demon Hunter" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="324" name="Yalaharian" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="329" name="Newly Wed" premium="no" unlocked="no" enabled="yes" />
<outfit type="0" looktype="336" name="Warmaster" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="366" name="Wayfarer" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="431" name="Afflicted" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="433" name="Elementalist" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="464" name="Deepling" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="466" name="Insectoid" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="471" name="Entrepreneur" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="513" name="Crystal Warlord" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="514" name="Soil Guardian" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="542" name="Demon Outfit" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="575" name="Cave Explorer" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="578" name="Dream Warden" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="618" name="Glooth Engineer" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="620" name="Jersey" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="632" name="Champion" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="635" name="Conjurer" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="636" name="Beastmaster" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="664" name="Chaos Acolyte" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="666" name="Death Herald" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="683" name="Ranger" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="694" name="Ceremonial Garb" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="696" name="Puppeteer" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="698" name="Spirit Caller" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="724" name="Evoker" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="732" name="Seaweaver" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="745" name="Recruiter" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="749" name="Sea Dog" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="759" name="Royal Pumpkin" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="845" name="Rift Warrior" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="852" name="Winter Warden" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="874" name="Philosopher" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="885" name="Arena Champion" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="900" name="Lupine Warden" premium="yes" unlocked="no" enabled="yes" />
<!-- Male outfits -->
<outfit type="1" looktype="128" name="Citizen" premium="no" unlocked="yes" enabled="yes" />
<outfit type="1" looktype="129" name="Hunter" premium="no" unlocked="yes" enabled="yes" />
@ -70,41 +32,4 @@
<outfit type="1" looktype="152" name="Assassin" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="153" name="Beggar" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="154" name="Shaman" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="273" name="Jester" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="289" name="Demon Hunter" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="325" name="Yalaharian" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="328" name="Newly Wed" premium="no" unlocked="no" enabled="yes" />
<outfit type="1" looktype="335" name="Warmaster" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="367" name="Wayfarer" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="430" name="Afflicted" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="432" name="Elementalist" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="463" name="Deepling" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="465" name="Insectoid" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="472" name="Entrepreneur" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="512" name="Crystal Warlord" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="516" name="Soil Guardian" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="541" name="Demon Outfit" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="574" name="Cave Explorer" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="577" name="Dream Warden" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="610" name="Glooth Engineer" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="619" name="Jersey" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="633" name="Champion" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="634" name="Conjurer" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="637" name="Beastmaster" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="665" name="Chaos Acolyte" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="667" name="Death Herald" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="684" name="Ranger" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="695" name="Ceremonial Garb" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="697" name="Puppeteer" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="699" name="Spirit Caller" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="725" name="Evoker" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="733" name="Seaweaver" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="746" name="Recruiter" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="750" name="Sea Dog" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="760" name="Royal Pumpkin" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="846" name="Rift Warrior" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="853" name="Winter Warden" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="873" name="Philosopher" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="884" name="Arena Champion" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="899" name="Lupine Warden" premium="yes" unlocked="no" enabled="yes" />
</outfits>

View File

@ -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

View File

@ -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") {

View File

@ -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 {

View File

@ -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<uint16_t>(outfit.lookType);
msg.addString(outfit.name);
msg.addByte(outfit.addons);
}