Skip to content

Commit

Permalink
resolved conversations.
Browse files Browse the repository at this point in the history
  • Loading branch information
elsongabriel committed Jul 5, 2024
1 parent 066edde commit 35970cd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
6 changes: 6 additions & 0 deletions src/creatures/players/cyclopedia/player_cyclopedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
PlayerCyclopedia::PlayerCyclopedia(Player &player) :
m_player(player) { }

Summary PlayerCyclopedia::getSummary() {
return { getAmount(Summary_t::PREY_CARDS),
getAmount(Summary_t::INSTANT_REWARDS),
getAmount(Summary_t::HIRELINGS) };
}

void PlayerCyclopedia::loadSummaryData() {
DBResult_ptr result = g_database().storeQuery(fmt::format("SELECT COUNT(*) as `count` FROM `player_hirelings` WHERE `player_id` = {}", m_player.getGUID()));
auto kvScoped = m_player.kv()->scoped("summary")->scoped(g_game().getSummaryKeyByType(static_cast<uint8_t>(Summary_t::HIRELINGS)));
Expand Down
8 changes: 2 additions & 6 deletions src/creatures/players/cyclopedia/player_cyclopedia.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,15 @@ struct Summary {
uint16_t m_instantRewards = 0;
uint16_t m_hirelings = 0;

Summary(uint16_t mPreyWildcards, uint16_t mInstantRewards, uint16_t mHirelings) :
[[maybe_unused]] Summary(uint16_t mPreyWildcards, uint16_t mInstantRewards, uint16_t mHirelings) :
m_preyWildcards(mPreyWildcards), m_instantRewards(mInstantRewards), m_hirelings(mHirelings) { }
};

class PlayerCyclopedia {
public:
explicit PlayerCyclopedia(Player &player);

Summary getSummary() {
return { getAmount(Summary_t::PREY_CARDS),
getAmount(Summary_t::INSTANT_REWARDS),
getAmount(Summary_t::HIRELINGS) };
}
Summary getSummary();

void loadSummaryData();
void loadDeathHistory(uint16_t page, uint16_t entriesPerPage);
Expand Down
4 changes: 4 additions & 0 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10667,6 +10667,10 @@ Title Game::getTitleByName(const std::string &name) {
return {};
}

const std::string &Game::getSummaryKeyByType(uint8_t type) {
return m_summaryCategories[type];
}

const std::map<uint8_t, std::string> &Game::getBlessingNames() {
return m_blessingNames;
}
Expand Down
4 changes: 1 addition & 3 deletions src/game/game.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,7 @@ class Game {
Title getTitleById(uint8_t id);
Title getTitleByName(const std::string &name);

const std::string &getSummaryKeyByType(uint8_t type) {
return m_summaryCategories[type];
}
const std::string &getSummaryKeyByType(uint8_t type);

const std::map<uint8_t, std::string> &getBlessingNames();
const std::unordered_map<uint16_t, std::string> &getHirelingSkills();
Expand Down

0 comments on commit 35970cd

Please sign in to comment.