Skip to content

Commit 469e09a

Browse files
authored
fix: forge cores consumption (#3001)
Fixes the exalted core consumption between normal and convergence transfers.
1 parent 7684026 commit 469e09a

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

src/creatures/players/player.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -7484,7 +7484,9 @@ void Player::forgeTransferItemTier(ForgeAction_t actionType, uint16_t donorItemI
74847484
sendForgeError(RETURNVALUE_CONTACTADMINISTRATOR);
74857485
break;
74867486
}
7487-
auto tierPriecs = itemClassification->tiers.at(donorItem->getTier());
7487+
7488+
const uint8_t toTier = convergence ? donorItem->getTier() : donorItem->getTier() - 1;
7489+
auto tierPriecs = itemClassification->tiers.at(toTier);
74887490
cost = convergence ? tierPriecs.convergenceTransferPrice : tierPriecs.regularPrice;
74897491
coresAmount = tierPriecs.corePrice;
74907492
break;

src/server/network/protocol/protocolgame.cpp

+16-7
Original file line numberDiff line numberDiff line change
@@ -5595,14 +5595,23 @@ void ProtocolGame::parseForgeEnter(NetworkMessage &msg) {
55955595
}
55965596

55975597
// 0xBF -> 0 = fusion, 1 = transfer, 2 = dust to sliver, 3 = sliver to core, 4 = increase dust limit
5598-
auto actionType = static_cast<ForgeAction_t>(msg.getByte());
5599-
bool convergence = msg.getByte();
5600-
uint16_t firstItem = msg.get<uint16_t>();
5601-
uint8_t tier = msg.getByte();
5602-
uint16_t secondItem = msg.get<uint16_t>();
5603-
bool usedCore = msg.getByte();
5604-
bool reduceTierLoss = msg.getByte();
5598+
const auto actionType = static_cast<ForgeAction_t>(msg.getByte());
5599+
5600+
bool convergence = false;
5601+
uint16_t firstItem = 0;
5602+
uint8_t tier = 0;
5603+
uint16_t secondItem = 0;
5604+
5605+
if (actionType == ForgeAction_t::FUSION || actionType == ForgeAction_t::TRANSFER) {
5606+
convergence = msg.getByte();
5607+
firstItem = msg.get<uint16_t>();
5608+
tier = msg.getByte();
5609+
secondItem = msg.get<uint16_t>();
5610+
}
5611+
56055612
if (actionType == ForgeAction_t::FUSION) {
5613+
const bool usedCore = convergence ? false : msg.getByte();
5614+
const bool reduceTierLoss = convergence ? false : msg.getByte();
56065615
g_game().playerForgeFuseItems(player->getID(), actionType, firstItem, tier, secondItem, usedCore, reduceTierLoss, convergence);
56075616
} else if (actionType == ForgeAction_t::TRANSFER) {
56085617
g_game().playerForgeTransferItemTier(player->getID(), actionType, firstItem, tier, secondItem, convergence);

0 commit comments

Comments
 (0)