Fixed all Warnings and added in advancement methods + material types loader

This commit is contained in:
2024-12-13 19:18:44 -05:00
parent 173d19bcd3
commit 4df7800afa
3 changed files with 14 additions and 36 deletions

View File

@@ -171,43 +171,26 @@ int32 AdvancementMgr::LoadPlayerAdvancements(Player* player) {
/**
* Load Material Types from the database into memory
*/
int32 AdvancementMgr::LoadPlayerAdvancements(Player* player) {
int32 AdvancementMgr::LoadMaterialTypes() {
constexpr std::string_view query = R"(
SELECT
guid,
advancementId,
bonus,
upgradeRank,
diceSpent
FROM mp_player_advancements
WHERE guid = {}
materialId,
entry
FROM mp_material_types
)";
QueryResult result = CharacterDatabase.Query(query, player->GetGUID().GetCounter());
// If the player does not have any upgrades just return not a problem until they purchase one.
if(!result) {
return 0;
}
QueryResult result = WorldDatabase.Query(query);
do {
Field* fields = result->Fetch();
uint32 guid = fields[0].Get<uint32>();
uint32 advancementId = fields[1].Get<uint32>();
float bonus = fields[2].Get<float>();
uint32 upgradeRank = fields[3].Get<uint32>();
uint32 diceSpent = fields[4].Get<uint32>();
uint32 materialId = fields[0].Get<uint32>();
uint32 entry = fields[1].Get<uint32>();
MpAdvancements advancement = static_cast<MpAdvancements>(advancementId);
MpPlayerRank playerRank = MpPlayerRank();
playerRank.rank = upgradeRank;
playerRank.advancementId = advancement;
playerRank.diceSpent = diceSpent;
playerRank.bonus = bonus;
// List of all ranks keyed by rank, advancementId
_playerAdvancements[guid][advancement] = playerRank;
if(!_materialTypes.contains(materialId)) {
_materialTypes.emplace(materialId,std::vector<uint32>());
}
_materialTypes.at(materialId).push_back(entry);
} while (result->NextRow());

View File

@@ -136,12 +136,10 @@ void MpDataStore::RemoveGroupData(Group *group) {
CharacterDatabase.Execute("DELETE FROM group_difficulty WHERE guid = {}) ", group->GetGUID().GetCounter());
}
// Adds PlayerData related to MythicRun Status to map
void MpDataStore::AddPlayerData(ObjectGuid guid, MpPlayerData* pd) {
MpLogger::debug("AddPlayerData for player {}", guid.GetCounter());
_playerData->emplace(guid, pd);
// get the player
Player* player = ObjectAccessor::FindPlayer(guid);
}
void MpDataStore::RemovePlayerData(ObjectGuid guid) {

View File

@@ -113,8 +113,6 @@ bool MythicPlus::EligibleDamageTarget(Unit* target)
bool MythicPlus::IsCreatureEligible(Creature* creature)
{
CreatureTemplate const * cInfo = creature->GetCreatureTemplate();
if (!creature) {
return false;
}
@@ -461,7 +459,6 @@ int32 MythicPlus::ScaleHealSpell(SpellInfo const * spellInfo, uint32 heal, MpCre
auto effects = spellInfo->GetEffects();
for (uint8 i = 0; i < effects.size(); ++i)
{
SpellEffectInfo effect = effects[i];
MpLogger::debug(" >>> Spell {} effect {} value: {} by creature {}", spellInfo->SpellName[i], effects[i].Effect, heal, creature->GetName());
}
@@ -476,8 +473,8 @@ int32 MythicPlus::ScaleHealSpell(SpellInfo const * spellInfo, uint32 heal, MpCre
return int32(heal * scalingFactor * healMultiplier);
}
void MythicPlus::GroupReset(Group* group, Map* map) {
MpLogger::info(" <<< Group Death Limit reached >>>>");
void MythicPlus::GroupReset(Group* /*group*/, Map* /* map */) {
// Stubbed out for later implementation
}