Fixed a display problem in refine UI (#6535)

Fixes #6528

Thanks to @idk-whoami, @zdurexz @secretdataz
This commit is contained in:
Lemongrass3110 2022-01-20 14:51:23 +01:00 committed by GitHub
parent 9d324ba077
commit 9ccdfe9d17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22115,27 +22115,18 @@ void clif_refineui_info( struct map_session_data* sd, uint16 index ){
return;
}
std::shared_ptr<s_refine_level_info> info = refine_db.findLevelInfo( *id, *item );
// No refine possible
if( info == nullptr ){
return;
}
// No possibilities were found
if( info->costs.empty() ){
return;
}
uint16 length = (uint16)( sizeof( struct PACKET_ZC_REFINE_ADD_ITEM ) + REFINE_COST_MAX * sizeof( struct PACKET_ZC_REFINE_ADD_ITEM_SUB ) );
// Preallocate the size
WFIFOHEAD( fd, length );
struct PACKET_ZC_REFINE_ADD_ITEM* p = (struct PACKET_ZC_REFINE_ADD_ITEM*)WFIFOP( fd, 0 );
struct PACKET_ZC_REFINE_ADD_ITEM* p = (struct PACKET_ZC_REFINE_ADD_ITEM*)packet_buffer;
p->packetType = HEADER_ZC_REFINE_ADD_ITEM;
p->packtLength = sizeof( struct PACKET_ZC_REFINE_ADD_ITEM );
p->itemIndex = client_index( index );
std::shared_ptr<s_refine_level_info> info = refine_db.findLevelInfo( *id, *item );
// No possibilities were found
if( info == nullptr ){
p->blacksmithBlessing = 0;
}else{
p->blacksmithBlessing = (uint8)info->blessing_amount;
uint16 count = 0;
@ -22147,13 +22138,13 @@ void clif_refineui_info( struct map_session_data* sd, uint16 index ){
p->req[count].itemId = client_nameid( cost->nameid );
p->req[count].chance = (uint8)( cost->chance / 100 );
p->req[count].zeny = cost->zeny;
p->packtLength += sizeof( struct PACKET_ZC_REFINE_ADD_ITEM_SUB );
count++;
}
}
}
p->packtLength = (uint16)( sizeof( struct PACKET_ZC_REFINE_ADD_ITEM ) + count * sizeof( struct PACKET_ZC_REFINE_ADD_ITEM_SUB ) );
WFIFOSET( fd, p->packtLength );
clif_send( p, p->packtLength, &sd->bl, SELF );
#endif
}