Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: forge cores consumption #3001

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7477,7 +7477,9 @@ void Player::forgeTransferItemTier(ForgeAction_t actionType, uint16_t donorItemI
sendForgeError(RETURNVALUE_CONTACTADMINISTRATOR);
break;
}
auto tierPriecs = itemClassification->tiers.at(donorItem->getTier());

const uint8_t toTier = convergence ? donorItem->getTier() : donorItem->getTier() - 1;
auto tierPriecs = itemClassification->tiers.at(toTier);
cost = convergence ? tierPriecs.convergenceTransferPrice : tierPriecs.regularPrice;
coresAmount = tierPriecs.corePrice;
break;
Expand Down
23 changes: 16 additions & 7 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5595,14 +5595,23 @@ void ProtocolGame::parseForgeEnter(NetworkMessage &msg) {
}

// 0xBF -> 0 = fusion, 1 = transfer, 2 = dust to sliver, 3 = sliver to core, 4 = increase dust limit
auto actionType = static_cast<ForgeAction_t>(msg.getByte());
bool convergence = msg.getByte();
uint16_t firstItem = msg.get<uint16_t>();
uint8_t tier = msg.getByte();
uint16_t secondItem = msg.get<uint16_t>();
bool usedCore = msg.getByte();
bool reduceTierLoss = msg.getByte();
const auto actionType = static_cast<ForgeAction_t>(msg.getByte());

bool convergence = false;
uint16_t firstItem = 0;
uint8_t tier = 0;
uint16_t secondItem = 0;

if (actionType == ForgeAction_t::FUSION || actionType == ForgeAction_t::TRANSFER) {
convergence = msg.getByte();
firstItem = msg.get<uint16_t>();
tier = msg.getByte();
secondItem = msg.get<uint16_t>();
}

if (actionType == ForgeAction_t::FUSION) {
const bool usedCore = convergence ? false : msg.getByte();
const bool reduceTierLoss = convergence ? false : msg.getByte();
g_game().playerForgeFuseItems(player->getID(), actionType, firstItem, tier, secondItem, usedCore, reduceTierLoss, convergence);
} else if (actionType == ForgeAction_t::TRANSFER) {
g_game().playerForgeTransferItemTier(player->getID(), actionType, firstItem, tier, secondItem, convergence);
Expand Down
Loading