[Tasks] Implement alternate currency rewards (#2827)

* Reward currency on task completion

* Handle reward window

* Tweaks
This commit is contained in:
Chris Miles
2023-02-06 17:24:13 -06:00
committed by GitHub
parent 404f7cada8
commit d369b47ef4
3 changed files with 57 additions and 12 deletions
+10
View File
@@ -1072,6 +1072,16 @@ void ClientTaskState::RewardTask(Client *c, const TaskInformation *ti, ClientTas
c->AddCrystals(ti->reward_points, 0);
} else if (ti->reward_point_type == static_cast<int32_t>(zone->GetCurrencyID(EBON_CRYSTAL))) {
c->AddCrystals(0, ti->reward_points);
} else {
for (const auto& ac : zone->AlternateCurrencies) {
if (ti->reward_point_type == ac.id) {
const EQ::ItemData *item = database.GetItem(ac.item_id);
if (item) {
c->AddAlternateCurrencyValue(ti->reward_point_type, ti->reward_points);
c->Message(Chat::Yellow, fmt::format("You have received ({}) {}!", ti->reward_points, item->Name).c_str());
}
}
}
}
}
}