diff options
| author | funjoker <funjoker109@gmail.com> | 2024-01-09 00:10:25 +0100 |
|---|---|---|
| committer | funjoker <funjoker109@gmail.com> | 2024-01-09 00:35:58 +0100 |
| commit | 2a8f1feef6dfd585bec3e1232888fb0807fcaf12 (patch) | |
| tree | c631a95cebd896bc8f05192843284870dfc04e46 /src | |
| parent | a08ab8364a12239c93a04efeb26002d2854d06f9 (diff) | |
Core/Misc: Build fixes
Closes #29572
Diffstat (limited to 'src')
27 files changed, 175 insertions, 91 deletions
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp index d1369d0024a..bb5f5018821 100644 --- a/src/server/game/DataStores/DB2Stores.cpp +++ b/src/server/game/DataStores/DB2Stores.cpp @@ -2101,7 +2101,7 @@ EmotesTextSoundEntry const* DB2Manager::GetTextSoundEmoteFor(uint32 emote, uint8 } -float DB2Manager::EvaluateExpectedStat(ExpectedStatType stat, uint32 level, int32 expansion, uint32 contentTuningId, Classes unitClass) const +float DB2Manager::EvaluateExpectedStat(ExpectedStatType stat, uint32 level, int32 expansion, uint32 /*contentTuningId*/, Classes unitClass) const { auto expectedStatItr = _expectedStatsByLevel.find(std::make_pair(level, expansion)); if (expectedStatItr == _expectedStatsByLevel.end()) @@ -2985,6 +2985,44 @@ bool DB2Manager::GetUiMapPosition(float x, float y, float z, int32 mapId, int32 return true; } +ContentLevels DB2Manager::GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId) +{ + if (mapid == 530 || mapid == 571) + { + switch (zoneId) + { + case 3430: // Eversong Woods + case 3433: // Ghostlands + case 3487: // SilvermoonCity + return CONTENT_1_60; + case 3524: // Azurmyst Isle + case 3557: // The Exodar + case 3525: // Bloodmyst Isle + return CONTENT_1_60; + default: + break; + } + } + + // Special Case + if (mapid == 609) // DeathknightStart Ebon Hold + return CONTENT_61_70; + + if (mapid < 2) + return CONTENT_1_60; + + MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); + if (!mapEntry) + return CONTENT_1_60; + + switch (mapEntry->Expansion()) + { + default: return CONTENT_1_60; + case 1: return CONTENT_61_70; + case 2: return CONTENT_71_80; + } +} + bool DB2Manager::Zone2MapCoordinates(uint32 areaId, float& x, float& y) const { AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId); diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h index 7365fa00ff0..736e9504c15 100644 --- a/src/server/game/DataStores/DB2Stores.h +++ b/src/server/game/DataStores/DB2Stores.h @@ -497,6 +497,7 @@ public: std::vector<TransmogSetItemEntry const*> const* GetTransmogSetItems(uint32 transmogSetId) const; static bool GetUiMapPosition(float x, float y, float z, int32 mapId, int32 areaId, int32 wmoDoodadPlacementId, int32 wmoGroupId, UiMapSystem system, bool local, int32* uiMapId = nullptr, DBCPosition2D* newPos = nullptr); + ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId); bool Zone2MapCoordinates(uint32 areaId, float& x, float& y) const; void Map2ZoneCoordinates(uint32 areaId, float& x, float& y) const; bool IsUiMapPhase(uint32 phaseId) const; diff --git a/src/server/game/DataStores/GameTables.cpp b/src/server/game/DataStores/GameTables.cpp index d220fe0445e..433c2de12fb 100644 --- a/src/server/game/DataStores/GameTables.cpp +++ b/src/server/game/DataStores/GameTables.cpp @@ -41,7 +41,6 @@ GameTable<GtRegenHPPerSptEntry> sRegenHPPerSptGameTable; GameTable<GtRegenMPPerSptEntry> sRegenMPPerSptGameTable; GameTable<GtShieldBlockRegularEntry> sShieldBlockRegularGameTable; GameTable<GtSpellScalingEntry> sSpellScalingGameTable; -GameTable<GtXpEntry> sXpGameTable; template<class T> inline uint32 LoadGameTable(std::vector<std::string>& errors, GameTable<T>& storage, boost::filesystem::path const& path) @@ -132,7 +131,6 @@ void LoadGameTables(std::string const& dataPath) LOAD_GT(sRegenMPPerSptGameTable, "RegenMPPerSpt.txt"); LOAD_GT(sShieldBlockRegularGameTable, "ShieldBlockRegular.txt"); LOAD_GT(sSpellScalingGameTable, "SpellScaling.txt"); - LOAD_GT(sXpGameTable, "xp.txt"); #undef LOAD_GT diff --git a/src/server/game/DataStores/GameTables.h b/src/server/game/DataStores/GameTables.h index 24ebda356da..d5d5df00479 100644 --- a/src/server/game/DataStores/GameTables.h +++ b/src/server/game/DataStores/GameTables.h @@ -223,15 +223,6 @@ struct GtStaminaMultByILvl float JewelryMultiplier = 0.0f; }; -struct GtXpEntry -{ - float Total = 0.0f; - float PerKill = 0.0f; - float Junk = 0.0f; - float Stats = 0.0f; - float Divisor = 0.0f; -}; - template<class T> class GameTable { @@ -268,7 +259,6 @@ TC_GAME_API extern GameTable<GtRegenHPPerSptEntry> sRegenHPPerS TC_GAME_API extern GameTable<GtRegenMPPerSptEntry> sRegenMPPerSptGameTable; TC_GAME_API extern GameTable<GtShieldBlockRegularEntry> sShieldBlockRegularGameTable; TC_GAME_API extern GameTable<GtSpellScalingEntry> sSpellScalingGameTable; -TC_GAME_API extern GameTable<GtXpEntry> sXpGameTable; TC_GAME_API void LoadGameTables(std::string const& dataPath); diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp index f6bcb29ad3b..c0f808748ed 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp @@ -144,6 +144,7 @@ bool AreaTrigger::Create(uint32 areaTriggerCreatePropertiesId, Unit* caster, Uni SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellID), spellInfo->Id); SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellForVisuals), spellInfo->Id); + SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellXSpellVisualID), spellVisual.SpellXSpellVisualID); SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::TimeToTargetScale), GetCreateProperties()->TimeToTargetScale != 0 ? GetCreateProperties()->TimeToTargetScale : *m_areaTriggerData->Duration); SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::BoundsRadius2D), GetCreateProperties()->GetMaxSearchRadius()); SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::DecalPropertiesID), GetCreateProperties()->DecalPropertiesId); diff --git a/src/server/game/Entities/Conversation/Conversation.cpp b/src/server/game/Entities/Conversation/Conversation.cpp index 8461f1f47e9..c2a3aa07e9e 100644 --- a/src/server/game/Entities/Conversation/Conversation.cpp +++ b/src/server/game/Entities/Conversation/Conversation.cpp @@ -264,7 +264,7 @@ Milliseconds Conversation::GetLastLineEndTime(LocaleConstant locale) const return _lastLineEndTimes[locale]; } -int32 Conversation::GetLineDuration(LocaleConstant locale, int32 lineId) +int32 Conversation::GetLineDuration(LocaleConstant /*locale*/, int32 lineId) { ConversationLineEntry const* convoLine = sConversationLineStore.LookupEntry(lineId); if (!convoLine) diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index 81956cf3945..d19a1f012d7 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -102,6 +102,7 @@ bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caste auto dynamicObjectData = m_values.ModifyValue(&DynamicObject::m_dynamicObjectData); SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::Caster), caster->GetGUID()); SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::Type), type); + SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::SpellXSpellVisualID), spellVisual.SpellXSpellVisualID); SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::SpellID), spell->Id); SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::Radius), radius); SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::CastTime), GameTime::GetGameTimeMS()); diff --git a/src/server/game/Entities/Player/CollectionMgr.cpp b/src/server/game/Entities/Player/CollectionMgr.cpp index a72e34d9460..4af10a500de 100644 --- a/src/server/game/Entities/Player/CollectionMgr.cpp +++ b/src/server/game/Entities/Player/CollectionMgr.cpp @@ -929,7 +929,7 @@ void CollectionMgr::SaveAccountTransmogIllusions(LoginDatabaseTransaction trans) })); } -void CollectionMgr::AddTransmogIllusion(uint32 transmogIllusionId) +void CollectionMgr::AddTransmogIllusion(uint32 /*transmogIllusionId*/) { } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f4aa5587b13..292c3373dda 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9083,9 +9083,6 @@ void Unit::UpdateResistances(uint32 school) float value = CalculatePct(GetFlatModifierValue(unitMod, BASE_VALUE), std::max(GetFlatModifierValue(unitMod, BASE_PCT_EXCLUDE_CREATE), -100.0f)); value *= GetPctModifierValue(unitMod, BASE_PCT); - - float baseValue = value; - value += GetFlatModifierValue(unitMod, TOTAL_VALUE); value *= GetPctModifierValue(unitMod, TOTAL_PCT); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index b86de3ae7a1..6918726cfb5 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -873,7 +873,7 @@ class TC_GAME_API Unit : public WorldObject float GetStat(Stats stat) const { return float(m_unitData->Stats[stat]); } void SetStat(Stats stat, int32 val) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Stats, stat), val); } uint32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL); } - void SetArmor(int32 val, int32 bonusVal) { SetResistance(SPELL_SCHOOL_NORMAL, val); } + void SetArmor(int32 val, int32 /*bonusVal*/) { SetResistance(SPELL_SCHOOL_NORMAL, val); } int32 GetResistance(SpellSchools school) const { return m_unitData->Resistances[school]; } int32 GetResistance(SpellSchoolMask mask) const; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index f4f3b539681..a0b0131d53b 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -4293,55 +4293,94 @@ void ObjectMgr::LoadPlayerInfo() { uint32 oldMSTime = getMSTime(); - _playerXPperLevel.resize(sXpGameTable.GetTableRowCount(), 0); + _playerXPperLevel.resize(sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)); + for (uint32 level = 0; level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level) + _playerXPperLevel[level] = 0; // 0 1 QueryResult result = WorldDatabase.Query("SELECT Level, Experience FROM player_xp_for_level"); - // load the DBC's levels at first... - for (uint32 level = 1; level < sXpGameTable.GetTableRowCount(); ++level) - _playerXPperLevel[level] = sXpGameTable.GetRow(level)->Total; + if (!result) + { + TC_LOG_ERROR("server.loading", ">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty."); + ABORT(); + } uint32 count = 0; - // ...overwrite if needed (custom values) - if (result) + do { - do - { - Field* fields = result->Fetch(); + Field* fields = result->Fetch(); - uint32 current_level = fields[0].GetUInt8(); - uint32 current_xp = fields[1].GetUInt32(); + uint32 current_level = fields[0].GetUInt8(); + uint32 current_xp = fields[1].GetUInt32(); - if (current_level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) + if (current_level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) + { + if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum + TC_LOG_ERROR("sql.sql", "Wrong (> {}) level {} in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level); + else { - if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum - TC_LOG_ERROR("sql.sql", "Wrong (> {}) level {} in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level); - else - { - TC_LOG_INFO("misc", "Unused (> MaxPlayerLevel in worldserver.conf) level {} in `player_xp_for_level` table, ignoring.", current_level); - ++count; // make result loading percent "expected" correct in case disabled detail mode for example. - } - continue; + TC_LOG_INFO("misc", "Unused (> MaxPlayerLevel in worldserver.conf) level {} in `player_xp_for_levels` table, ignoring.", current_level); + ++count; // make result loading percent "expected" correct in case disabled detail mode for example. } - //PlayerXPperLevel - _playerXPperLevel[current_level] = current_xp; - ++count; - } while (result->NextRow()); - } + continue; + } + //PlayerXPperLevel + _playerXPperLevel[current_level] = current_xp; + ++count; + } while (result->NextRow()); - // fill level gaps - only accounting levels > MAX_LEVEL + // fill level gaps for (uint8 level = 1; level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level) { if (_playerXPperLevel[level] == 0) { - TC_LOG_ERROR("sql.sql", "Level {} does not have XP for level data. Using data of level [{}] + 12000.", level + 1, level); - _playerXPperLevel[level] = _playerXPperLevel[level - 1] + 12000; - } - } - - TC_LOG_INFO("server.loading", ">> Loaded {} xp for level definition(s) from database in {} ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_ERROR("sql.sql", "Level {} does not have XP for level data. Using data of level [{}] + 100.", level + 1, level); + _playerXPperLevel[level] = _playerXPperLevel[level - 1] + 100; + } + } + + TC_LOG_INFO("server.loading", ">> Loaded {} xp for level definitions in {} ms", count, GetMSTimeDiffToNow(oldMSTime)); + + //// ...overwrite if needed (custom values) + //if (result) + //{ + // do + // { + // Field* fields = result->Fetch(); + // + // uint32 current_level = fields[0].GetUInt8(); + // uint32 current_xp = fields[1].GetUInt32(); + // + // if (current_level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) + // { + // if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum + // TC_LOG_ERROR("sql.sql", "Wrong (> {}) level {} in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level); + // else + // { + // TC_LOG_INFO("misc", "Unused (> MaxPlayerLevel in worldserver.conf) level {} in `player_xp_for_level` table, ignoring.", current_level); + // ++count; // make result loading percent "expected" correct in case disabled detail mode for example. + // } + // continue; + // } + // //PlayerXPperLevel + // _playerXPperLevel[current_level] = current_xp; + // ++count; + // } while (result->NextRow()); + //} + // + //// fill level gaps - only accounting levels > MAX_LEVEL + //for (uint8 level = 1; level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level) + //{ + // if (_playerXPperLevel[level] == 0) + // { + // TC_LOG_ERROR("sql.sql", "Level {} does not have XP for level data. Using data of level [{}] + 12000.", level + 1, level); + // _playerXPperLevel[level] = _playerXPperLevel[level - 1] + 12000; + // } + //} + // + //TC_LOG_INFO("server.loading", ">> Loaded {} xp for level definition(s) from database in {} ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -6842,7 +6881,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyardInZone(WorldLocation con // at entrance map for corpse map bool foundEntr = false; - float distEntr = 10000; + //float distEntr = 10000; WorldSafeLocsEntry const* entryEntr = nullptr; // some where other @@ -6898,13 +6937,13 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyardInZone(WorldLocation con // at entrance map calculate distance (2D); if (foundEntr) { - distEntr = 0.f; + //distEntr = 0.f; entryEntr = entry; } else { foundEntr = true; - distEntr = 0.f; + //distEntr = 0.f; entryEntr = entry; } } diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 7fb2b6b7d12..0954a3ec779 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -947,7 +947,7 @@ bool LootTemplate::isReference(uint32 id) } std::unordered_map<ObjectGuid, std::unique_ptr<Loot>> GenerateDungeonEncounterPersonalLoot(uint32 dungeonEncounterId, uint32 lootId, LootStore const& store, - LootType type, WorldObject const* lootOwner, uint32 minMoney, uint32 maxMoney, uint16 lootMode, MapDifficultyEntry const* mapDifficulty, + LootType type, WorldObject const* lootOwner, uint32 minMoney, uint32 maxMoney, uint16 lootMode, MapDifficultyEntry const* /*mapDifficulty*/, std::vector<Player*> const& tappers) { std::unordered_map<Player*, std::unique_ptr<Loot>> tempLoot; diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index beb84ff09e8..43dec1baa5a 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -3308,7 +3308,7 @@ bool Map::IsAlwaysActive() const return IsBattlegroundOrArena(); } -bool Map::GetEntrancePos(int32 &mapid, float &x, float &y) +bool Map::GetEntrancePos(int32& /*mapid*/ , float& /*x*/, float& /*y*/) { return false; } diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h index 6630602b026..eb9de41b51a 100644 --- a/src/server/game/Miscellaneous/Formulas.h +++ b/src/server/game/Miscellaneous/Formulas.h @@ -136,12 +136,27 @@ namespace Trinity return diff; } - inline uint32 BaseGain(uint8 pl_level, uint8 mob_level) + inline uint32 BaseGain(uint8 pl_level, uint8 mob_level, ContentLevels content) { uint32 baseGain; + uint32 nBaseExp; - GtXpEntry const* xpPlayer = sXpGameTable.GetRow(pl_level); - GtXpEntry const* xpMob = sXpGameTable.GetRow(mob_level); + switch (content) + { + case CONTENT_1_60: + nBaseExp = 45; + break; + case CONTENT_61_70: + nBaseExp = 235; + break; + case CONTENT_71_80: + nBaseExp = 580; + break; + default: + TC_LOG_ERROR("misc", "BaseGain: Unsupported content level {}", content); + nBaseExp = 45; + break; + } if (mob_level >= pl_level) { @@ -149,7 +164,7 @@ namespace Trinity if (nLevelDiff > 4) nLevelDiff = 4; - baseGain = uint32(round(xpPlayer->PerKill * (1 + 0.05f * nLevelDiff))); + baseGain = ((pl_level * 5 + nBaseExp) * (20 + nLevelDiff) / 10 + 1) / 2; } else { @@ -157,20 +172,20 @@ namespace Trinity if (mob_level > gray_level) { uint8 ZD = GetZeroDifference(pl_level); - baseGain = uint32(round(xpMob->PerKill * ((1 - ((pl_level - mob_level) / float(ZD))) * (xpMob->Divisor / xpPlayer->Divisor)))); + baseGain = (pl_level * 5 + nBaseExp) * (ZD + mob_level - pl_level) / ZD; } else baseGain = 0; } - if (sWorld->getIntConfig(CONFIG_MIN_CREATURE_SCALED_XP_RATIO) && pl_level != mob_level) + if (sWorld->getIntConfig(CONFIG_MIN_CREATURE_SCALED_XP_RATIO)) { // Use mob level instead of player level to avoid overscaling on gain in a min is enforced - uint32 baseGainMin = BaseGain(pl_level, pl_level) * sWorld->getIntConfig(CONFIG_MIN_CREATURE_SCALED_XP_RATIO) / 100; + uint32 baseGainMin = (mob_level * 5 + nBaseExp) * sWorld->getIntConfig(CONFIG_MIN_CREATURE_SCALED_XP_RATIO) / 100; baseGain = std::max(baseGainMin, baseGain); } - sScriptMgr->OnBaseGainCalculation(baseGain, pl_level, mob_level); + sScriptMgr->OnBaseGainCalculation(baseGain, pl_level, mob_level, content); return baseGain; } @@ -183,7 +198,7 @@ namespace Trinity { float xpMod = 1.0f; - gain = BaseGain(player->GetLevel(), u->GetLevelForTarget(player)); + gain = BaseGain(player->GetLevel(), u->GetLevel(), sDB2Manager.GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId())); if (gain && creature) { diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index fbd84473826..f9c8b69a155 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -8174,4 +8174,11 @@ enum WorldState : uint32 WS_WAR_MODE_ALLIANCE_BUFF_VALUE = 17043, }; +enum ContentLevels : uint8 +{ + CONTENT_1_60 = 0, + CONTENT_61_70, + CONTENT_71_80 +}; + #endif diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index fa219749f9b..703f5f0708b 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -389,21 +389,19 @@ uint32 Quest::XPValue(Player const* player) const if (!player) return 0; - QuestXPEntry const* questXp = sQuestXPStore.LookupEntry(questLevel); + int32 quest_level = (questLevel == -1 ? player->GetLevel() : questLevel); + + QuestXPEntry const* questXp = sQuestXPStore.LookupEntry(quest_level); if (!questXp || xpDifficulty >= 10) return 0; - float multiplier = 1.0f; - if (questLevel != player->GetLevel()) - multiplier = sXpGameTable.GetRow(std::min<int32>(player->GetLevel(), questLevel))->Divisor / sXpGameTable.GetRow(player->GetLevel())->Divisor; - - int32 diffFactor = 2 * (questLevel - player->GetLevel()) + 20; + int32 diffFactor = 2 * (quest_level - player->GetLevel()) + 20; if (diffFactor < 1) diffFactor = 1; else if (diffFactor > 10) diffFactor = 10; - uint32 xp = RoundXPValue(diffFactor * questXp->Difficulty[xpDifficulty] / 10 * multiplier); + uint32 xp = RoundXPValue(diffFactor * questXp->Difficulty[xpDifficulty] / 10); if (sWorld->getIntConfig(CONFIG_MIN_QUEST_SCALED_XP_RATIO)) { uint32 minScaledXP = RoundXPValue(questXp->Difficulty[xpDifficulty] * xpMultiplier) * sWorld->getIntConfig(CONFIG_MIN_QUEST_SCALED_XP_RATIO) / 100; diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 76a51e0795f..05a67a89597 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -1488,9 +1488,9 @@ void ScriptMgr::OnZeroDifferenceCalculation(uint8& diff, uint8 playerLevel) FOREACH_SCRIPT(FormulaScript)->OnZeroDifferenceCalculation(diff, playerLevel); } -void ScriptMgr::OnBaseGainCalculation(uint32& gain, uint8 playerLevel, uint8 mobLevel) +void ScriptMgr::OnBaseGainCalculation(uint32& gain, uint8 playerLevel, uint8 mobLevel, ContentLevels content) { - FOREACH_SCRIPT(FormulaScript)->OnBaseGainCalculation(gain, playerLevel, mobLevel); + FOREACH_SCRIPT(FormulaScript)->OnBaseGainCalculation(gain, playerLevel, mobLevel, content); } void ScriptMgr::OnGainCalculation(uint32& gain, Player* player, Unit* unit) @@ -2483,7 +2483,7 @@ void FormulaScript::OnZeroDifferenceCalculation(uint8& /*diff*/, uint8 /*playerL { } -void FormulaScript::OnBaseGainCalculation(uint32& /*gain*/, uint8 /*playerLevel*/, uint8 /*mobLevel*/) +void FormulaScript::OnBaseGainCalculation(uint32& /*gain*/, uint8 /*playerLevel*/, uint8 /*mobLevel*/, ContentLevels /*content*/) { } diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index fe3fb48df79..f714a33de85 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -300,7 +300,7 @@ class TC_GAME_API FormulaScript : public ScriptObject virtual void OnZeroDifferenceCalculation(uint8& diff, uint8 playerLevel); // Called after calculating base experience gain. - virtual void OnBaseGainCalculation(uint32& gain, uint8 playerLevel, uint8 mobLevel); + virtual void OnBaseGainCalculation(uint32& gain, uint8 playerLevel, uint8 mobLevel, ContentLevels content); // Called after calculating experience gain. virtual void OnGainCalculation(uint32& gain, Player* player, Unit* unit); @@ -1107,7 +1107,7 @@ class TC_GAME_API ScriptMgr void OnGrayLevelCalculation(uint8& grayLevel, uint8 playerLevel); void OnColorCodeCalculation(XPColorChar& color, uint8 playerLevel, uint8 mobLevel); void OnZeroDifferenceCalculation(uint8& diff, uint8 playerLevel); - void OnBaseGainCalculation(uint32& gain, uint8 playerLevel, uint8 mobLevel); + void OnBaseGainCalculation(uint32& gain, uint8 playerLevel, uint8 mobLevel, ContentLevels content); void OnGainCalculation(uint32& gain, Player* player, Unit* unit); void OnGroupRateCalculation(float& rate, uint32 count, bool isRaid); diff --git a/src/server/game/Server/Packets/CombatLogPacketsCommon.h b/src/server/game/Server/Packets/CombatLogPacketsCommon.h index 084d3851555..a7bad752d09 100644 --- a/src/server/game/Server/Packets/CombatLogPacketsCommon.h +++ b/src/server/game/Server/Packets/CombatLogPacketsCommon.h @@ -86,7 +86,7 @@ namespace WorldPackets struct SpellCastVisual { int32 SpellXSpellVisualID = 0; - int32 ScriptVisualID = 0; + //int32 ScriptVisualID = 0; }; struct SpellSupportInfo diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index fb748ebaf1b..22e1b910088 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -4017,7 +4017,7 @@ void AuraEffect::HandleAuraModIncreaseBaseManaPercent(AuraApplication const* aur } } -void AuraEffect::HandleModManaCostPct(AuraApplication const* aurApp, uint8 mode, bool apply) const +void AuraEffect::HandleModManaCostPct(AuraApplication const* /*aurApp*/, uint8 mode, bool apply) const { if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT))) return; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 1fe1c00303f..1f1c8f68c95 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -455,7 +455,7 @@ Aura* Aura::Create(AuraCreateInfo& createInfo) Aura::Aura(AuraCreateInfo const& createInfo) : m_spellInfo(createInfo._spellInfo), m_castDifficulty(createInfo._castDifficulty), m_castId(createInfo._castId), m_casterGuid(createInfo.CasterGUID), m_castItemGuid(createInfo.CastItemGUID), m_castItemId(createInfo.CastItemId), -m_castItemLevel(createInfo.CastItemLevel), m_spellVisual({ createInfo.Caster ? createInfo.Caster->GetCastSpellXSpellVisualId(createInfo._spellInfo) : createInfo._spellInfo->GetSpellXSpellVisualId(), 0 }), +m_castItemLevel(createInfo.CastItemLevel), m_spellVisual({ createInfo.Caster ? createInfo.Caster->GetCastSpellXSpellVisualId(createInfo._spellInfo) : createInfo._spellInfo->GetSpellXSpellVisualId() }), m_applyTime(GameTime::GetGameTime()), m_owner(createInfo._owner), m_timeCla(0), m_updateTargetMapInterval(0), m_casterLevel(createInfo.Caster ? createInfo.Caster->GetLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1), m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false), m_dropEvent(nullptr), diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index dbd215c35e6..65296e42063 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5389,7 +5389,7 @@ void Spell::TakePower() for (SpellPowerCost& cost : m_powerCost) { Powers powerType = Powers(cost.Power); - bool hit = true; + //bool hit = true; if (unitCaster->GetTypeId() == TYPEID_PLAYER) { if (m_spellInfo->HasAttribute(SPELL_ATTR1_DISCOUNT_POWER_ON_MISS)) @@ -5400,7 +5400,7 @@ void Spell::TakePower() auto ihit = std::find_if(std::begin(m_UniqueTargetInfo), std::end(m_UniqueTargetInfo), [&](TargetInfo const& targetInfo) { return targetInfo.TargetGUID == targetGUID && targetInfo.MissCondition != SPELL_MISS_NONE; }); if (ihit != std::end(m_UniqueTargetInfo)) { - hit = false; + //hit = false; //lower spell cost on fail (by talent aura) if (Player* modOwner = unitCaster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo, SpellModOp::PowerCostOnMiss, cost.Amount); @@ -5470,7 +5470,7 @@ SpellCastResult Spell::CheckRuneCost() const return SPELL_CAST_OK; } -void Spell::TakeRunePower(bool didHit) +void Spell::TakeRunePower(bool /*didHit*/) { /* if (m_caster->GetTypeId() != TYPEID_PLAYER || m_caster->ToPlayer()->GetClass() != CLASS_DEATH_KNIGHT) @@ -8065,7 +8065,7 @@ bool Spell::IsPositive() const bool Spell::IsNeedSendToClient() const { - return m_SpellVisual.SpellXSpellVisualID || m_SpellVisual.ScriptVisualID || m_spellInfo->IsChanneled() || + return m_SpellVisual.SpellXSpellVisualID || m_spellInfo->IsChanneled() || (m_spellInfo->HasAttribute(SPELL_ATTR8_AURA_POINTS_ON_CLIENT)) || m_spellInfo->HasHitDelay() || (!m_triggeredByAuraSpell && !IsTriggered()) || m_spellInfo->HasAttribute(SPELL_ATTR7_ALWAYS_CAST_LOG); } @@ -9276,5 +9276,5 @@ CastSpellExtraArgs& CastSpellExtraArgs::SetTriggeringAura(AuraEffect const* trig SpellCastVisual::operator WorldPackets::Spells::SpellCastVisual() const { - return { int32(SpellXSpellVisualID), int32(ScriptVisualID) }; + return { int32(SpellXSpellVisualID) }; } diff --git a/src/server/game/Spells/SpellDefines.h b/src/server/game/Spells/SpellDefines.h index 18fdef801e2..2bf41a44566 100644 --- a/src/server/game/Spells/SpellDefines.h +++ b/src/server/game/Spells/SpellDefines.h @@ -497,7 +497,6 @@ struct TC_GAME_API CastSpellExtraArgs struct SpellCastVisual { uint32 SpellXSpellVisualID = 0; - uint32 ScriptVisualID = 0; operator WorldPackets::Spells::SpellCastVisual() const; }; diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 3f304fcdaa5..9cad2f0642c 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -550,7 +550,7 @@ int32 SpellEffectInfo::CalcValue(WorldObject const* caster /*= nullptr*/, int32 return int32(round(value)); } -int32 SpellEffectInfo::CalcBaseValue(WorldObject const* caster, Unit const* target, uint32 itemId, int32 /*itemLevel*/) const +int32 SpellEffectInfo::CalcBaseValue(WorldObject const* caster, Unit const* target, uint32 /*itemId*/, int32 /*itemLevel*/) const { if (Scaling.Coefficient != 0.0f) { diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp index 239acc7505c..fa7e94b7502 100644 --- a/src/server/scripts/Commands/cs_learn.cpp +++ b/src/server/scripts/Commands/cs_learn.cpp @@ -181,7 +181,7 @@ public: return true; } - static bool HandleLearnAllTalentsCommand(ChatHandler* handler) + static bool HandleLearnAllTalentsCommand(ChatHandler* /*handler*/) { /* Player* player = handler->GetSession()->GetPlayer(); diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 3d1030eda32..a56d95eb7ff 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -963,7 +963,7 @@ public: if (Player* caster = handler->GetSession()->GetPlayer()) { ObjectGuid castId = ObjectGuid::Create<HighGuid::Cast>(SPELL_CAST_SOURCE_NORMAL, player->GetMapId(), SPELL_UNSTUCK_ID, player->GetMap()->GenerateLowGuid<HighGuid::Cast>()); - Spell::SendCastResult(caster, spellInfo, { SPELL_UNSTUCK_VISUAL, 0 }, castId, SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW); + Spell::SendCastResult(caster, spellInfo, { SPELL_UNSTUCK_VISUAL }, castId, SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW); } return false; @@ -2343,7 +2343,7 @@ public: // non-melee damage - SpellNonMeleeDamage damageInfo(attacker, target, *spellInfo, { (*spellInfo)->GetSpellXSpellVisualId(handler->GetSession()->GetPlayer()), 0 }, (*spellInfo)->SchoolMask); + SpellNonMeleeDamage damageInfo(attacker, target, *spellInfo, { (*spellInfo)->GetSpellXSpellVisualId(handler->GetSession()->GetPlayer()) }, (*spellInfo)->SchoolMask); damageInfo.damage = damage; Unit::DealDamageMods(damageInfo.attacker, damageInfo.target, damageInfo.damage, &damageInfo.absorb); target->DealSpellDamage(&damageInfo, true); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index f7ab1f1359c..a92b635db18 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -285,7 +285,7 @@ class spell_dk_dancing_rune_weapon : public AuraScript return; int32 amount = static_cast<int32>(damageInfo->GetDamage()) / 2; - SpellNonMeleeDamage log(drw, drw->GetVictim(), spellInfo, { spellInfo->GetSpellXSpellVisualId(drw), 0 }, spellInfo->GetSchoolMask()); + SpellNonMeleeDamage log(drw, drw->GetVictim(), spellInfo, { spellInfo->GetSpellXSpellVisualId(drw) }, spellInfo->GetSchoolMask()); log.damage = amount; Unit::DealDamage(drw, drw->GetVictim(), amount, nullptr, SPELL_DIRECT_DAMAGE, spellInfo->GetSchoolMask(), spellInfo, true); drw->SendSpellNonMeleeDamageLog(&log); |
