fix skin id assignment

This commit is contained in:
Agus 2026-03-06 00:58:14 -03:00
parent 72186375ea
commit 9408afe98a
2 changed files with 10 additions and 13 deletions

View file

@ -126,7 +126,7 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason)
send( shared_ptr<DisconnectPacket>( new DisconnectPacket(reason) )); send( shared_ptr<DisconnectPacket>( new DisconnectPacket(reason) ));
connection->sendAndQuit(); connection->sendAndQuit();
// 4J-PB - removed, since it needs to be localised in the language the client is in // 4J-PB - removed, since it needs to be localised in the language the client is in
//server->players->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(L"§e" + player->name + L" left the game.") ) ); //server->players->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(L"<EFBFBD>e" + player->name + L" left the game.") ) );
if(getWasKicked()) if(getWasKicked())
{ {
server->getPlayers()->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) ); server->getPlayers()->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) );
@ -569,7 +569,7 @@ void PlayerConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason,
if( done ) return; if( done ) return;
// logger.info(player.name + " lost connection: " + reason); // logger.info(player.name + " lost connection: " + reason);
// 4J-PB - removed, since it needs to be localised in the language the client is in // 4J-PB - removed, since it needs to be localised in the language the client is in
//server->players->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(L"§e" + player->name + L" left the game.") ) ); //server->players->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(L"<EFBFBD>e" + player->name + L" left the game.") ) );
if(getWasKicked()) if(getWasKicked())
{ {
server->getPlayers()->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) ); server->getPlayers()->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) );
@ -740,13 +740,13 @@ int PlayerConnection::countDelayedPackets()
void PlayerConnection::info(const wstring& string) void PlayerConnection::info(const wstring& string)
{ {
// 4J-PB - removed, since it needs to be localised in the language the client is in // 4J-PB - removed, since it needs to be localised in the language the client is in
//send( shared_ptr<ChatPacket>( new ChatPacket(L"§7" + string) ) ); //send( shared_ptr<ChatPacket>( new ChatPacket(L"<EFBFBD>7" + string) ) );
} }
void PlayerConnection::warn(const wstring& string) void PlayerConnection::warn(const wstring& string)
{ {
// 4J-PB - removed, since it needs to be localised in the language the client is in // 4J-PB - removed, since it needs to be localised in the language the client is in
//send( shared_ptr<ChatPacket>( new ChatPacket(L"§9" + string) ) ); //send( shared_ptr<ChatPacket>( new ChatPacket(L"<EFBFBD>9" + string) ) );
} }
wstring PlayerConnection::getConsoleName() wstring PlayerConnection::getConsoleName()
@ -1000,14 +1000,7 @@ void PlayerConnection::handleTextureAndGeometryChange(shared_ptr<TextureAndGeome
} }
else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path))
{ {
// Update the ref count on the memory texture data
app.AddMemoryTextureFile(packet->path,NULL,0); app.AddMemoryTextureFile(packet->path,NULL,0);
player->setCustomSkin(packet->dwSkinID);
// If we already have the texture, then we already have the model parts too
//app.SetAdditionalSkinBoxes(packet->dwSkinID,)
//DebugBreak();
} }
server->getPlayers()->broadcastAll( shared_ptr<TextureAndGeometryChangePacket>( new TextureAndGeometryChangePacket(player,packet->path) ), player->dimension ); server->getPlayers()->broadcastAll( shared_ptr<TextureAndGeometryChangePacket>( new TextureAndGeometryChangePacket(player,packet->path) ), player->dimension );
} }

View file

@ -22,9 +22,13 @@ TextureAndGeometryChangePacket::TextureAndGeometryChangePacket(shared_ptr<Entity
wstring skinValue = path.substr(7,path.size()); wstring skinValue = path.substr(7,path.size());
skinValue = skinValue.substr(0,skinValue.find_first_of(L'.')); skinValue = skinValue.substr(0,skinValue.find_first_of(L'.'));
std::wstringstream ss; std::wstringstream ss;
ss << std::dec << skinValue.c_str(); bool isDlcSkin = (path.size() >= 3) && (path.substr(0, 3).compare(L"dlc") == 0);
if (isDlcSkin)
ss << std::dec << skinValue.c_str();
else
ss << std::hex << skinValue.c_str();
ss >> dwSkinID; ss >> dwSkinID;
dwSkinID = MAKE_SKIN_BITMASK(true, dwSkinID); dwSkinID = MAKE_SKIN_BITMASK(isDlcSkin, dwSkinID);
} }