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

feat: cyclopedia #4

Closed
wants to merge 6 commits into from
Closed
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
12 changes: 12 additions & 0 deletions data/modules/scripts/gamestore/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,17 @@ function parseRequestStoreOffers(playerId, msg)
end
end

-- Used on cyclopedia store summary
local function insertPlayerTransactionSummary(player, offer)
local offerId = offer.id
if offer.type == GameStore.OfferTypes.OFFER_TYPE_HIRELING_SKILL then
offerId = offerId - HIRELING_STORAGE.SKILL
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_HIRELING_OUTFIT then
offerId = offerId - HIRELING_STORAGE.OUTFIT
end
player:createTransactionSummary(offer.type, math.max(1, offer.count), offer.itemtype or 0, offerId, offer.blessid or 0)
end

function parseBuyStoreOffer(playerId, msg)
local player = Player(playerId)
local id = msg:getU32()
Expand Down Expand Up @@ -522,6 +533,7 @@ function parseBuyStoreOffer(playerId, msg)
return queueSendStoreAlertToUser(alertMessage, 500, playerId)
end

insertPlayerTransactionSummary(player, offer)
local configure = useOfferConfigure(offer.type)
if configure ~= GameStore.ConfigureOffers.SHOW_CONFIGURE then
if not player:makeCoinTransaction(offer) then
Expand Down
1 change: 1 addition & 0 deletions src/creatures/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ target_sources(${PROJECT_NAME}_lib PRIVATE
players/player.cpp
players/achievement/player_achievement.cpp
players/cyclopedia/player_badge.cpp
players/cyclopedia/player_cyclopedia.cpp
players/cyclopedia/player_title.cpp
players/wheel/player_wheel.cpp
players/wheel/wheel_gems.cpp
Expand Down
4 changes: 1 addition & 3 deletions src/creatures/creatures_definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,7 @@
};

enum PlayerAsyncOngoingTaskFlags : uint64_t {
PlayerAsyncTask_Highscore = 1 << 0,
PlayerAsyncTask_RecentDeaths = 1 << 1,
PlayerAsyncTask_RecentPvPKills = 1 << 2
PlayerAsyncTask_Highscore = 1 << 0
};

enum PartyAnalyzer_t : uint8_t {
Expand Down Expand Up @@ -1646,12 +1644,12 @@

struct ShopBlock {
uint16_t itemId;
std::string itemName;

Check warning on line 1647 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘std::string ShopBlock::itemName’ [-Wreorder]

Check warning on line 1647 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘std::string ShopBlock::itemName’ [-Wreorder]

Check warning on line 1647 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘std::string ShopBlock::itemName’ [-Wreorder]

Check warning on line 1647 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

‘std::string ShopBlock::itemName’ [-Wreorder]

Check warning on line 1647 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

‘std::string ShopBlock::itemName’ [-Wreorder]

Check warning on line 1647 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

‘std::string ShopBlock::itemName’ [-Wreorder]
int32_t itemSubType;
uint32_t itemBuyPrice;
uint32_t itemSellPrice;
int32_t itemStorageKey;
int32_t itemStorageValue;

Check warning on line 1652 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘ShopBlock::itemStorageValue’ will be initialized after [-Wreorder]

Check warning on line 1652 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘ShopBlock::itemStorageValue’ will be initialized after [-Wreorder]

Check warning on line 1652 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘ShopBlock::itemStorageValue’ will be initialized after [-Wreorder]

Check warning on line 1652 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘ShopBlock::itemStorageValue’ will be initialized after [-Wreorder]

Check warning on line 1652 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

‘ShopBlock::itemStorageValue’ will be initialized after [-Wreorder]

Check warning on line 1652 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

‘ShopBlock::itemStorageValue’ will be initialized after [-Wreorder]

Check warning on line 1652 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

‘ShopBlock::itemStorageValue’ will be initialized after [-Wreorder]

Check warning on line 1652 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

‘ShopBlock::itemStorageValue’ will be initialized after [-Wreorder]

std::vector<ShopBlock> childShop;
ShopBlock() {
Expand All @@ -1664,7 +1662,7 @@
itemStorageValue = 0;
}

explicit ShopBlock(uint16_t newItemId, int32_t newSubType = 0, uint32_t newBuyPrice = 0, uint32_t newSellPrice = 0, int32_t newStorageKey = 0, int32_t newStorageValue = 0, std::string newName = "") :

Check warning on line 1665 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 1665 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 1665 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 1665 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 1665 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 1665 in src/creatures/creatures_definitions.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

when initialized here [-Wreorder]
itemId(newItemId), itemSubType(newSubType), itemBuyPrice(newBuyPrice), itemSellPrice(newSellPrice), itemStorageKey(newStorageKey), itemStorageValue(newStorageValue), itemName(std::move(newName)) { }

bool operator==(const ShopBlock &other) const {
Expand Down
119 changes: 119 additions & 0 deletions src/creatures/players/cyclopedia/player_cyclopedia.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/**
* Canary - A free and open-source MMORPG server emulator
* Copyright (©) 2019-2024 OpenTibiaBR <[email protected]>
* Repository: https://github.com/opentibiabr/canary
* License: https://github.com/opentibiabr/canary/blob/main/LICENSE
* Contributors: https://github.com/opentibiabr/canary/graphs/contributors
* Website: https://docs.opentibiabr.com/
*/

#include "pch.hpp"

#include "player_cyclopedia.hpp"

#include "creatures/players/player.hpp"
#include "game/game.hpp"
#include "kv/kv.hpp"

PlayerCyclopedia::PlayerCyclopedia(Player &player) :
m_player(player) { }

void PlayerCyclopedia::loadSummaryData() {

loadRecentKills();
loadDeathHistory();
}

void PlayerCyclopedia::loadRecentKills() {
Benchmark bm_check;

Database &db = Database::getInstance();
const std::string &escapedName = db.escapeString(m_player.getName());
DBResult_ptr result = db.storeQuery(fmt::format("SELECT `d`.`time`, `d`.`killed_by`, `d`.`mostdamage_by`, `d`.`unjustified`, `d`.`mostdamage_unjustified`, `p`.`name` FROM `player_deaths` AS `d` INNER JOIN `players` AS `p` ON `d`.`player_id` = `p`.`id` WHERE ((`d`.`killed_by` = {} AND `d`.`is_player` = 1) OR (`d`.`mostdamage_by` = {} AND `d`.`mostdamage_is_player` = 1))", escapedName, escapedName));
if (result) {
do {
std::string cause1 = result->getString("killed_by");
std::string cause2 = result->getString("mostdamage_by");
std::string name = result->getString("name");

uint8_t status = CYCLOPEDIA_CHARACTERINFO_RECENTKILLSTATUS_JUSTIFIED;
if (m_player.getName() == cause1) {
if (result->getNumber<uint32_t>("unjustified") == 1) {
status = CYCLOPEDIA_CHARACTERINFO_RECENTKILLSTATUS_UNJUSTIFIED;
}
} else if (m_player.getName() == cause2) {
if (result->getNumber<uint32_t>("mostdamage_unjustified") == 1) {
status = CYCLOPEDIA_CHARACTERINFO_RECENTKILLSTATUS_UNJUSTIFIED;
}
}

std::ostringstream description;
description << "Killed " << name << '.';
insertPvpKillOnHistory(std::move(description.str()), result->getNumber<uint32_t>("time"), status);
} while (result->next());
}

g_logger().debug("Checking and updating recent kill of player {} took {} milliseconds.", m_player.getName(), bm_check.duration());
}

void PlayerCyclopedia::loadDeathHistory() {
Benchmark bm_check;

Database &db = Database::getInstance();
DBResult_ptr result = db.storeQuery(fmt::format("SELECT `time`, `level`, `killed_by`, `mostdamage_by` FROM `player_deaths` WHERE `player_id` = {} ORDER BY `time` DESC", m_player.getGUID()));
if (result) {
do {
std::string cause1 = result->getString("killed_by");
std::string cause2 = result->getString("mostdamage_by");
std::ostringstream description;
description << "Died at Level " << result->getNumber<uint32_t>("level") << " by";
if (!cause1.empty()) {
description << getArticle(cause1) << cause1;
}

if (!cause2.empty()) {
if (!cause1.empty()) {
description << " and";
}
description << getArticle(cause2) << cause2;
}
description << '.';

insertDeathOnHistory(std::move(description.str()), result->getNumber<uint32_t>("time"));
} while (result->next());
}

g_logger().debug("Checking and updating death history of player {} took {} milliseconds.", m_player.getName(), bm_check.duration());
}

std::vector<RecentDeathEntry> PlayerCyclopedia::getDeathHistory() const {
return m_deathHistory;
}

void PlayerCyclopedia::insertDeathOnHistory(std::string cause, uint32_t timestamp) {
m_deathHistory.emplace_back(std::move(cause), timestamp);
}

std::vector<RecentPvPKillEntry> PlayerCyclopedia::getPvpKillsHistory() const {
return m_pvpKillsHistory;
}

void PlayerCyclopedia::insertPvpKillOnHistory(std::string cause, uint32_t timestamp, uint8_t status) {
m_pvpKillsHistory.emplace_back(std::move(cause), timestamp, status);
}

void PlayerCyclopedia::updateStoreSummary(uint8_t type, uint16_t count, uint8_t itemType, uint8_t offerId, uint8_t blessId) {
}

// const std::shared_ptr<KV> &PlayerTitle::getSummary(std::string &key) {
// return m_player.kv()->scoped("titles")->scoped("summary")->get(key);
// }
//
// uint16_t PlayerAchievement::getPoints() const {
// return m_player.kv()->scoped("achievements")->get("points")->getNumber();
// }
//
// void PlayerAchievement::addPoints(uint16_t toAddPoints) {
// auto oldPoints = getPoints();
// m_player.kv()->scoped("achievements")->set("points", oldPoints + toAddPoints);
// }
76 changes: 76 additions & 0 deletions src/creatures/players/cyclopedia/player_cyclopedia.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* Canary - A free and open-source MMORPG server emulator
* Copyright (©) 2019-2024 OpenTibiaBR <[email protected]>
* Repository: https://github.com/opentibiabr/canary
* License: https://github.com/opentibiabr/canary/blob/main/LICENSE
* Contributors: https://github.com/opentibiabr/canary/graphs/contributors
* Website: https://docs.opentibiabr.com/
*/

#pragma once

class Player;
class KV;

struct Summary {
uint16_t m_storeXpBoosts = 0;
uint16_t m_dailyRewardCollections = 0;
uint16_t m_hirelings = 0;
uint16_t m_preyCards = 0;
uint16_t m_charms = 0;
uint16_t m_goshnar = 0;
uint16_t m_drome = 0;
uint16_t m_loginStreak = 0;
uint16_t m_taskHuntingPoints = 0;
uint16_t m_mapAreaDiscoveredPercentage = 0;

std::vector<uint16_t> m_hirelingOutfits;
std::vector<uint8_t> m_hirelingJobs;
std::map<Blessings_t, uint16_t> m_blessings;

Check failure on line 29 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘Blessings_t’ was not declared in this scope

Check failure on line 29 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

template argument 1 is invalid

Check failure on line 29 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

template argument 3 is invalid

Check failure on line 29 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

template argument 4 is invalid

Check failure on line 29 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘<expression error>’ in namespace ‘std’ does not name a type

Check failure on line 29 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

‘Blessings_t’ was not declared in this scope

Check failure on line 29 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

template argument 1 is invalid

Check failure on line 29 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

template argument 3 is invalid

Check failure on line 29 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

template argument 4 is invalid

Check failure on line 29 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

‘<expression error>’ in namespace ‘std’ does not name a type

Summary(uint16_t mStoreXpBoosts, uint16_t mDailyRewardCollections, uint16_t mHirelings, uint16_t mPreyCards, uint16_t mCharms, uint16_t mGoshnar, uint16_t mDrome, uint16_t mLoginStreak, uint16_t mTaskHuntingPoints, uint16_t mMapAreaDiscoveredPercentage, const std::vector<uint16_t> &mHirelingOutfits, const std::vector<uint8_t> &mHirelingJobs, const std::map<Blessings_t, uint16_t> &mBlessings) :

Check failure on line 31 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘Blessings_t’ was not declared in this scope

Check failure on line 31 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

template argument 1 is invalid

Check failure on line 31 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

template argument 3 is invalid

Check failure on line 31 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

template argument 4 is invalid

Check failure on line 31 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘<expression error>’ in namespace ‘std’ does not name a type

Check failure on line 31 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

‘Blessings_t’ was not declared in this scope

Check failure on line 31 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

template argument 1 is invalid

Check failure on line 31 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

template argument 3 is invalid

Check failure on line 31 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

template argument 4 is invalid

Check failure on line 31 in src/creatures/players/cyclopedia/player_cyclopedia.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-debug

‘<expression error>’ in namespace ‘std’ does not name a type
m_storeXpBoosts(mStoreXpBoosts), m_dailyRewardCollections(mDailyRewardCollections), m_hirelings(mHirelings), m_preyCards(mPreyCards), m_charms(mCharms), m_goshnar(mGoshnar), m_drome(mDrome), m_loginStreak(mLoginStreak), m_taskHuntingPoints(mTaskHuntingPoints), m_mapAreaDiscoveredPercentage(mMapAreaDiscoveredPercentage), m_hirelingOutfits(mHirelingOutfits), m_hirelingJobs(mHirelingJobs), m_blessings(mBlessings) { }
};

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

Summary getSummary() {
return Summary(m_storeXpBoosts, m_dailyRewardCollections, m_hirelings, m_preyCards, m_charms, m_goshnar, m_drome, m_loginStreak, m_taskHuntingPoints, m_mapAreaDiscoveredPercentage, m_hirelingOutfits, m_hirelingJobs, m_blessings);
}
void loadSummaryData();
void loadRecentKills();
void loadDeathHistory();

[[nodiscard]] std::vector<RecentDeathEntry> getDeathHistory() const;
void insertDeathOnHistory(std::string cause, uint32_t timestamp);
[[nodiscard]] std::vector<RecentPvPKillEntry> getPvpKillsHistory() const;
void insertPvpKillOnHistory(std::string cause, uint32_t timestamp, uint8_t status);

void updateStoreSummary(uint8_t type, uint16_t count = 1, uint8_t itemType = 0, uint8_t offerId = 0, uint8_t blessId = 0);

private:
uint16_t m_storeXpBoosts = 0;
uint16_t m_dailyRewardCollections = 0;
uint16_t m_hirelings = 0;
uint16_t m_preyCards = 0;
uint16_t m_charms = 0;
uint16_t m_goshnar = 0;
uint16_t m_drome = 0;
uint16_t m_loginStreak = 0;
uint16_t m_taskHuntingPoints = 0;
uint16_t m_mapAreaDiscoveredPercentage = 0;

std::vector<uint16_t> m_hirelingOutfits;
std::vector<uint8_t> m_hirelingJobs;
std::map<Blessings_t, uint16_t> m_blessings;

// StashItemList houseItems;
// std::map<uint8_t, std::vector<uint16_t>> m_accountLevelSummary;

std::vector<RecentDeathEntry> m_deathHistory;
std::vector<RecentPvPKillEntry> m_pvpKillsHistory;

Player &m_player;
};
33 changes: 33 additions & 0 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "creatures/players/wheel/player_wheel.hpp"
#include "creatures/players/achievement/player_achievement.hpp"
#include "creatures/players/cyclopedia/player_badge.hpp"
#include "creatures/players/cyclopedia/player_cyclopedia.hpp"
#include "creatures/players/cyclopedia/player_title.hpp"
#include "creatures/players/storages/storages.hpp"
#include "game/game.hpp"
Expand Down Expand Up @@ -52,6 +53,7 @@ Player::Player(ProtocolGame_ptr p) :
m_wheelPlayer = std::make_unique<PlayerWheel>(*this);
m_playerAchievement = std::make_unique<PlayerAchievement>(*this);
m_playerBadge = std::make_unique<PlayerBadge>(*this);
m_playerCyclopedia = std::make_unique<PlayerCyclopedia>(*this);
m_playerTitle = std::make_unique<PlayerTitle>(*this);
}

Expand Down Expand Up @@ -2863,6 +2865,28 @@ void Player::death(std::shared_ptr<Creature> lastHitCreature) {
}
sendTextMessage(MESSAGE_EVENT_ADVANCE, blessOutput.str());

// Pvp and pve death registration
std::ostringstream description;
if (pvpDeath) {
description << "Killed " << getName() << '.';
CyclopediaCharacterInfo_RecentKillStatus_t status = unfairFightReduction != 100 ? CYCLOPEDIA_CHARACTERINFO_RECENTKILLSTATUS_UNJUSTIFIED : CYCLOPEDIA_CHARACTERINFO_RECENTKILLSTATUS_JUSTIFIED;
if (lastHitCreature && lastHitCreature->getPlayer()) {
lastHitCreature->getPlayer()->cyclopedia()->insertPvpKillOnHistory(std::move(description.str()), OTSYS_TIME() / 1000, status);
} else if (lastHitCreature && lastHitCreature->getMaster() && lastHitCreature->getMaster()->getPlayer()) {
lastHitCreature->getMaster()->getPlayer()->cyclopedia()->insertPvpKillOnHistory(std::move(description.str()), OTSYS_TIME() / 1000, status);
}
} else {
description << "Died at Level " << getLevel() << " by";
if (lastHitCreature) {
description << getArticle(lastHitCreature->getName()) << lastHitCreature->getName();
} else {
description << " a field item";
}
description << '.';

cyclopedia()->insertDeathOnHistory(std::move(description.str()), OTSYS_TIME() / 1000);
}

sendStats();
sendSkills();
sendReLoginWindow(unfairFightReduction);
Expand Down Expand Up @@ -8050,6 +8074,15 @@ const std::unique_ptr<PlayerTitle> &Player::title() const {
return m_playerTitle;
}

// Cyclopedia
std::unique_ptr<PlayerCyclopedia> &Player::cyclopedia() {
return m_playerCyclopedia;
}

const std::unique_ptr<PlayerCyclopedia> &Player::cyclopedia() const {
return m_playerCyclopedia;
}

void Player::sendLootMessage(const std::string &message) const {
auto party = getParty();
if (!party) {
Expand Down
20 changes: 12 additions & 8 deletions src/creatures/players/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "enums/player_cyclopedia.hpp"
#include "creatures/players/cyclopedia/player_badge.hpp"
#include "creatures/players/cyclopedia/player_title.hpp"
#include "creatures/players/cyclopedia/player_cyclopedia.hpp"

class House;
class NetworkMessage;
Expand All @@ -53,6 +54,7 @@ class Spell;
class PlayerWheel;
class PlayerAchievement;
class PlayerBadge;
class PlayerCyclopedia;
class PlayerTitle;
class Spectators;
class Account;
Expand Down Expand Up @@ -1630,18 +1632,14 @@ class Player final : public Creature, public Cylinder, public Bankable {
client->sendCyclopediaCharacterCombatStats();
}
}
void sendCyclopediaCharacterRecentDeaths(uint16_t page, uint16_t pages, const std::vector<RecentDeathEntry> &entries) {
void sendCyclopediaCharacterRecentDeaths(uint16_t page, uint16_t entriesPerPage) {
if (client) {
client->sendCyclopediaCharacterRecentDeaths(page, pages, entries);
client->sendCyclopediaCharacterRecentDeaths(page, entriesPerPage);
}
}
void sendCyclopediaCharacterRecentPvPKills(
uint16_t page, uint16_t pages,
const std::vector<
RecentPvPKillEntry> &entries
) {
void sendCyclopediaCharacterRecentPvPKills(uint16_t page, uint16_t entriesPerPage) {
if (client) {
client->sendCyclopediaCharacterRecentPvPKills(page, pages, entries);
client->sendCyclopediaCharacterRecentPvPKills(page, entriesPerPage);
}
}
void sendCyclopediaCharacterAchievements(uint16_t secretsUnlocked, std::vector<std::pair<Achievement, uint32_t>> achievementsUnlocked);
Expand Down Expand Up @@ -2624,6 +2622,10 @@ class Player final : public Creature, public Cylinder, public Bankable {
std::unique_ptr<PlayerTitle> &title();
const std::unique_ptr<PlayerTitle> &title() const;

// Player summary interface
std::unique_ptr<PlayerCyclopedia> &cyclopedia();
const std::unique_ptr<PlayerCyclopedia> &cyclopedia() const;

void sendLootMessage(const std::string &message) const;

std::shared_ptr<Container> getLootPouch();
Expand Down Expand Up @@ -3019,11 +3021,13 @@ class Player final : public Creature, public Cylinder, public Bankable {
friend class IOLoginDataSave;
friend class PlayerAchievement;
friend class PlayerBadge;
friend class PlayerCyclopedia;
friend class PlayerTitle;

std::unique_ptr<PlayerWheel> m_wheelPlayer;
std::unique_ptr<PlayerAchievement> m_playerAchievement;
std::unique_ptr<PlayerBadge> m_playerBadge;
std::unique_ptr<PlayerCyclopedia> m_playerCyclopedia;
std::unique_ptr<PlayerTitle> m_playerTitle;

std::mutex quickLootMutex;
Expand Down
Loading
Loading