Open suencet opened 5 months ago
Replace this code in player.cpp:
if (convergence) {
firstForgedItem->setTier(tier + 1);
history.dustCost = dustCost;
setForgeDusts(getForgeDusts() - dustCost);
uint64_t cost = 0;
for (const auto* itemClassification : g_game().getItemsClassifications()) {
if (itemClassification->id != firstForgingItem->getClassification()) {
continue;
}
for (const auto &[mapTier, mapPrice] : itemClassification->tiers) {
if (mapTier == firstForgingItem->getTier()) {
cost = mapPrice.convergenceFusionPrice;
break;
}
}
for this one:
if (convergence) {
firstForgedItem->setTier(tier + 1);
history.dustCost = dustCost;
setForgeDusts(getForgeDusts() - dustCost);
uint64_t cost = 0;
for (const auto* itemClassification : g_game().getItemsClassifications()) {
if (itemClassification->id != firstForgingItem->getClassification()) {
continue;
}
for (const auto &[mapTier, mapPrice] : itemClassification->tiers) {
if (mapTier == firstForgingItem->getTier() + 1) {
cost = mapPrice.convergenceFusionPrice;
break;
}
}
It should fix it.
Replace this code in player.cpp:
if (convergence) { firstForgedItem->setTier(tier + 1); history.dustCost = dustCost; setForgeDusts(getForgeDusts() - dustCost); uint64_t cost = 0; for (const auto* itemClassification : g_game().getItemsClassifications()) { if (itemClassification->id != firstForgingItem->getClassification()) { continue; } for (const auto &[mapTier, mapPrice] : itemClassification->tiers) { if (mapTier == firstForgingItem->getTier()) { cost = mapPrice.convergenceFusionPrice; break; } }
for this one:
if (convergence) { firstForgedItem->setTier(tier + 1); history.dustCost = dustCost; setForgeDusts(getForgeDusts() - dustCost); uint64_t cost = 0; for (const auto* itemClassification : g_game().getItemsClassifications()) { if (itemClassification->id != firstForgingItem->getClassification()) { continue; } for (const auto &[mapTier, mapPrice] : itemClassification->tiers) { if (mapTier == firstForgingItem->getTier() + 1) { cost = mapPrice.convergenceFusionPrice; break; } }
It should fix it.
This one worked, thank you a lot sir!
The logic for Convergence Fusion in protocolgame.cpp accounts for the tier as tier - 1:
// Exalted core table per tier
msg.addByte(static_cast<uint8_t>(tierCorePrices.size()));
for (const auto &[tier, cores] : tierCorePrices) {
msg.addByte(tier);
msg.addByte(cores);
}
// Convergence fusion prices per tier
msg.addByte(static_cast<uint8_t>(convergenceFusionPrices.size()));
for (const auto &[tier, price] : convergenceFusionPrices) {
msg.addByte(tier - 1);
msg.add<uint64_t>(price);
}
// Convergence transfer prices per tier
msg.addByte(static_cast<uint8_t>(convergenceTransferPrices.size()));
for (const auto &[tier, price] : convergenceTransferPrices) {
msg.addByte(tier);
msg.add<uint64_t>(price);
}
This approach is likely adopted for client-side interpretation because removing the -1 caused the client to crash during a Convergence Fusion operation.
Thus, the logic behind the calculation was incorrect. Given that protocolgame.cpp handles Convergence Fusion with tier - 1, I had to adjust by adding +1 to account for the item as if it were tier 0.
Replace this code in player.cpp:
if (convergence) { firstForgedItem->setTier(tier + 1); history.dustCost = dustCost; setForgeDusts(getForgeDusts() - dustCost); uint64_t cost = 0; for (const auto* itemClassification : g_game().getItemsClassifications()) { if (itemClassification->id != firstForgingItem->getClassification()) { continue; } for (const auto &[mapTier, mapPrice] : itemClassification->tiers) { if (mapTier == firstForgingItem->getTier()) { cost = mapPrice.convergenceFusionPrice; break; } }
for this one:
if (convergence) { firstForgedItem->setTier(tier + 1); history.dustCost = dustCost; setForgeDusts(getForgeDusts() - dustCost); uint64_t cost = 0; for (const auto* itemClassification : g_game().getItemsClassifications()) { if (itemClassification->id != firstForgingItem->getClassification()) { continue; } for (const auto &[mapTier, mapPrice] : itemClassification->tiers) { if (mapTier == firstForgingItem->getTier() + 1) { cost = mapPrice.convergenceFusionPrice; break; } }
It should fix it.
It this working correctly according to Cip's behaviour? If yes, why you don't send a Pull Request?
Replace this code in player.cpp:
if (convergence) { firstForgedItem->setTier(tier + 1); history.dustCost = dustCost; setForgeDusts(getForgeDusts() - dustCost); uint64_t cost = 0; for (const auto* itemClassification : g_game().getItemsClassifications()) { if (itemClassification->id != firstForgingItem->getClassification()) { continue; } for (const auto &[mapTier, mapPrice] : itemClassification->tiers) { if (mapTier == firstForgingItem->getTier()) { cost = mapPrice.convergenceFusionPrice; break; } }
for this one:
if (convergence) { firstForgedItem->setTier(tier + 1); history.dustCost = dustCost; setForgeDusts(getForgeDusts() - dustCost); uint64_t cost = 0; for (const auto* itemClassification : g_game().getItemsClassifications()) { if (itemClassification->id != firstForgingItem->getClassification()) { continue; } for (const auto &[mapTier, mapPrice] : itemClassification->tiers) { if (mapTier == firstForgingItem->getTier() + 1) { cost = mapPrice.convergenceFusionPrice; break; } }
It should fix it.
It this working correctly according to Cip's behaviour? If yes, why you don't send a Pull Request?
Yes. I will do it tomorrow, sorry about that.
This issue is stale because it has been open 120 days with no activity.
Priority
Medium
Area
What happened?
It seems like Convergence Fusion price calculation is bugged. For example, making item from tier0 to tier1 is always free. Client is showing correct price but the amount taken from bank account is always lower than it's supposed to. Fusion of tier3 item will cost you as if you had tier2 item etc
What OS are you seeing the problem on?
Linux, Windows
Code of Conduct