@@ -5370,7 +5370,8 @@ void ProtocolGame::sendForgingData() {
53705370void ProtocolGame::sendOpenForge () {
53715371 // We will use it when sending the bytes to send the item information to the client
53725372 std::map<uint16_t , std::map<uint8_t , uint16_t >> fusionItemsMap;
5373- std::map<int32_t , std::map<uint16_t , std::map<uint8_t , uint16_t >>> convergenceItemsMap;
5373+ std::map<int32_t , std::map<uint16_t , std::map<uint8_t , uint16_t >>> convergenceFusionItemsMap;
5374+ std::map<int32_t , std::map<uint16_t , std::map<uint8_t , uint16_t >>> convergenceTransferItemsMap;
53745375 std::map<uint16_t , std::map<uint8_t , uint16_t >> donorTierItemMap;
53755376 std::map<uint16_t , std::map<uint8_t , uint16_t >> receiveTierItemMap;
53765377
@@ -5405,15 +5406,20 @@ void ProtocolGame::sendOpenForge() {
54055406 getForgeInfoMap (item, receiveTierItemMap);
54065407 }
54075408 if (itemClassification == 4 ) {
5408- getForgeInfoMap (item, convergenceItemsMap[item->getClassification ()]);
5409+ auto slotPosition = item->getSlotPosition ();
5410+ if ((slotPosition & SLOTP_TWO_HAND ) != 0 ) {
5411+ slotPosition = SLOTP_HAND ;
5412+ }
5413+ getForgeInfoMap (item, convergenceFusionItemsMap[slotPosition]);
5414+ getForgeInfoMap (item, convergenceTransferItemsMap[item->getClassification ()]);
54095415 }
54105416 }
54115417 }
54125418
54135419 // Checking size of map to send in the addByte (total fusion items count)
54145420 uint8_t fusionTotalItemsCount = 0 ;
54155421 for (const auto &[itemId, tierAndCountMap] : fusionItemsMap) {
5416- for (const auto [itemTier, itemCount] : tierAndCountMap) {
5422+ for (const auto & [itemTier, itemCount] : tierAndCountMap) {
54175423 if (itemCount >= 2 ) {
54185424 fusionTotalItemsCount++;
54195425 }
@@ -5430,7 +5436,7 @@ void ProtocolGame::sendOpenForge() {
54305436
54315437 msg.add <uint16_t >(fusionTotalItemsCount);
54325438 for (const auto &[itemId, tierAndCountMap] : fusionItemsMap) {
5433- for (const auto [itemTier, itemCount] : tierAndCountMap) {
5439+ for (const auto & [itemTier, itemCount] : tierAndCountMap) {
54345440 if (itemCount >= 2 ) {
54355441 msg.addByte (0x01 ); // Number of friend items?
54365442 msg.add <uint16_t >(itemId);
@@ -5452,12 +5458,12 @@ void ProtocolGame::sendOpenForge() {
54525458 1 byte: tier
54535459 2 bytes: count
54545460 */
5455- for (const auto &[slot, itemMap] : convergenceItemsMap ) {
5461+ for (const auto &[slot, itemMap] : convergenceFusionItemsMap ) {
54565462 uint8_t totalItemsCount = 0 ;
54575463 auto totalItemsCountPosition = msg.getBufferPosition ();
54585464 msg.skipBytes (1 ); // Total items count
54595465 for (const auto &[itemId, tierAndCountMap] : itemMap) {
5460- for (const auto [tier, itemCount] : tierAndCountMap) {
5466+ for (const auto & [tier, itemCount] : tierAndCountMap) {
54615467 if (tier >= maxConfigTier) {
54625468 continue ;
54635469 }
@@ -5488,11 +5494,15 @@ void ProtocolGame::sendOpenForge() {
54885494 // Let's access the itemType to check the item's (donator of tier) classification level
54895495 // Must be the same as the item that will receive the tier
54905496 const ItemType &donorType = Item::items[itemId];
5497+ auto donorSlotPosition = donorType.slotPosition ;
5498+ if ((donorSlotPosition & SLOTP_TWO_HAND ) != 0 ) {
5499+ donorSlotPosition = SLOTP_HAND ;
5500+ }
54915501
54925502 // Total count of item (donator of tier)
54935503 auto donorTierTotalItemsCount = getIterationIncreaseCount (tierAndCountMap);
54945504 msg.add <uint16_t >(donorTierTotalItemsCount);
5495- for (const auto [donorItemTier, donorItemCount] : tierAndCountMap) {
5505+ for (const auto & [donorItemTier, donorItemCount] : tierAndCountMap) {
54965506 msg.add <uint16_t >(itemId);
54975507 msg.addByte (donorItemTier);
54985508 msg.add <uint16_t >(donorItemCount);
@@ -5502,7 +5512,11 @@ void ProtocolGame::sendOpenForge() {
55025512 for (const auto &[iteratorItemId, unusedTierAndCountMap] : receiveTierItemMap) {
55035513 // Let's access the itemType to check the item's (receiver of tier) classification level
55045514 const ItemType &receiveType = Item::items[iteratorItemId];
5505- if (donorType.upgradeClassification == receiveType.upgradeClassification ) {
5515+ auto receiveSlotPosition = receiveType.slotPosition ;
5516+ if ((receiveSlotPosition & SLOTP_TWO_HAND ) != 0 ) {
5517+ receiveSlotPosition = SLOTP_HAND ;
5518+ }
5519+ if (donorType.upgradeClassification == receiveType.upgradeClassification && donorSlotPosition == receiveSlotPosition) {
55065520 receiveTierTotalItemCount++;
55075521 }
55085522 }
@@ -5513,8 +5527,12 @@ void ProtocolGame::sendOpenForge() {
55135527 for (const auto &[receiveItemId, receiveTierAndCountMap] : receiveTierItemMap) {
55145528 // Let's access the itemType to check the item's (receiver of tier) classification level
55155529 const ItemType &receiveType = Item::items[receiveItemId];
5516- if (donorType.upgradeClassification == receiveType.upgradeClassification ) {
5517- for (const auto [receiveItemTier, receiveItemCount] : receiveTierAndCountMap) {
5530+ auto receiveSlotPosition = receiveType.slotPosition ;
5531+ if ((receiveSlotPosition & SLOTP_TWO_HAND ) != 0 ) {
5532+ receiveSlotPosition = SLOTP_HAND ;
5533+ }
5534+ if (donorType.upgradeClassification == receiveType.upgradeClassification && donorSlotPosition == receiveSlotPosition) {
5535+ for (const auto &[receiveItemTier, receiveItemCount] : receiveTierAndCountMap) {
55185536 msg.add <uint16_t >(receiveItemId);
55195537 msg.add <uint16_t >(receiveItemCount);
55205538 }
@@ -5540,7 +5558,7 @@ void ProtocolGame::sendOpenForge() {
55405558 2 bytes: item id
55415559 2 bytes: count
55425560 */
5543- for (const auto &[slot, itemMap] : convergenceItemsMap ) {
5561+ for (const auto &[slot, itemMap] : convergenceTransferItemsMap ) {
55445562 uint16_t donorCount = 0 ;
55455563 uint16_t receiverCount = 0 ;
55465564 auto donorCountPosition = msg.getBufferPosition ();
0 commit comments