Skip to content

Commit

Permalink
fix choice nodes in base
Browse files Browse the repository at this point in the history
  • Loading branch information
hatersgit committed Jan 29, 2024
1 parent 57ac7e8 commit 70912f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions modules/mod-Forge/src/ForgeCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,7 @@ class ForgeCache : public DatabaseScript
uint8 row;
uint8 col;
uint8 pointReq;
uint8 nodeIndex;
std::vector<NodeMetaData*> unlocks;
};
struct TreeMetaData {
Expand Down Expand Up @@ -1561,6 +1562,7 @@ class ForgeCache : public DatabaseScript
node->pointReq = newTalent->TabPointReq;
node->col = newTalent->ColumnIndex;
node->row = newTalent->RowIndex;
node->nodeIndex = newTalent->nodeIndex;

data->nodes[node->row][node->col] = node;
data->nodeLocation[node->spellId] = node;
Expand Down
11 changes: 5 additions & 6 deletions modules/mod-Forge/src/TopicHandlers/LearnTalentHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,9 @@ class LearnTalentHandler : public ForgeTopicHandler
auto rankedSpell = ft->Ranks[ct->CurrentRank];
if (!iam.player->HasSpell(ct->SpellId)) {
if (choiceNode) {
iam.player->learnSpell(ct->SpellId);

uint32 choiceId = fc->GetChoiceNodeFromindex(ct->CurrentRank);
spec->ChoiceNodesChosen[ct->SpellId] = choiceId;
auto choice = fc->_choiceNodes[ct->SpellId][ct->CurrentRank - 1];
iam.player->learnSpell(choice);
spec->ChoiceNodesChosen[ct->SpellId] = choice;
}
else {
iam.player->learnSpell(rankedSpell);
Expand Down Expand Up @@ -217,8 +216,8 @@ class LearnTalentHandler : public ForgeTopicHandler
bool choiceNode = talent->nodeType == NodeType::CHOICE;
if (col.second > 0) {
if (choiceNode) {
uint32 choiceId = fc->GetChoiceNodeFromindex(col.second);
if (!choiceId) {
auto choiceId = fc->_choiceNodes.find(node->spellId);
if (choiceId == fc->_choiceNodes.end()) {
player->SendForgeUIMsg(ForgeTopic::LEARN_TALENT_ERROR, "Unknown choice node received.");
return false;
}
Expand Down

0 comments on commit 70912f6

Please sign in to comment.