diff --git a/src/server/game/AI/NpcBots/botmgr.cpp b/src/server/game/AI/NpcBots/botmgr.cpp index 748b686dd1213..67753a2184343 100644 --- a/src/server/game/AI/NpcBots/botmgr.cpp +++ b/src/server/game/AI/NpcBots/botmgr.cpp @@ -84,6 +84,8 @@ uint32 _targetBGPlayersPerTeamCount_SA; uint32 _targetBGPlayersPerTeamCount_IC; bool _enableNpcBots; bool _logToDB; +bool _xpReductionBlizzlikeEnable; +bool _xpReductionBlizzlikeGroupOnly; bool _enableNpcBotsDungeons; bool _enableNpcBotsRaids; bool _enableNpcBotsBGs; @@ -331,6 +333,8 @@ void BotMgr::LoadConfig(bool reload) _basefollowdist = sConfigMgr->GetIntDefault("NpcBot.BaseFollowDistance", 30); _xpReductionAmount = sConfigMgr->GetIntDefault("NpcBot.XpReduction.Amount", 0); _xpReductionStartingNumber = sConfigMgr->GetIntDefault("NpcBot.XpReduction.StartingNumber", 2); + _xpReductionBlizzlikeEnable = sConfigMgr->GetBoolDefault("NpcBot.XpReduction.Blizzlike.Enable", true); + _xpReductionBlizzlikeGroupOnly = sConfigMgr->GetBoolDefault("NpcBot.XpReduction.Blizzlike.GroupOnly", false); _mountLevel60 = sConfigMgr->GetIntDefault("NpcBot.MountLevel.60", 20); _mountLevel100 = sConfigMgr->GetIntDefault("NpcBot.MountLevel.100", 40); _healTargetIconFlags = sConfigMgr->GetIntDefault("NpcBot.HealTargetIconMask", 0); @@ -1104,6 +1108,14 @@ uint8 BotMgr::GetNpcBotXpReductionStartingNumber() { return _xpReductionStartingNumber; } +bool BotMgr::GetNpcBotXpReductionBlizzlikeEnabled() +{ + return _xpReductionBlizzlikeEnable; +} +bool BotMgr::GetNpcBotXpReductionBlizzlikeGroupOnly() +{ + return _xpReductionBlizzlikeGroupOnly; +} uint8 BotMgr::GetNpcBotMountLevel60() { diff --git a/src/server/game/AI/NpcBots/botmgr.h b/src/server/game/AI/NpcBots/botmgr.h index ea06ad8440454..f5ea93d1251ac 100644 --- a/src/server/game/AI/NpcBots/botmgr.h +++ b/src/server/game/AI/NpcBots/botmgr.h @@ -241,6 +241,8 @@ class TC_GAME_API BotMgr static uint8 GetMaxNpcBots(uint8 level); static uint8 GetNpcBotXpReduction(); static uint8 GetNpcBotXpReductionStartingNumber(); + static bool GetNpcBotXpReductionBlizzlikeEnabled(); + static bool GetNpcBotXpReductionBlizzlikeGroupOnly(); static uint8 GetNpcBotMountLevel60(); static uint8 GetNpcBotMountLevel100(); static int32 GetBotInfoPacketsLimit(); diff --git a/src/server/game/Entities/Player/KillRewarder.cpp b/src/server/game/Entities/Player/KillRewarder.cpp index 3450733a27fd1..458f769707e3b 100644 --- a/src/server/game/Entities/Player/KillRewarder.cpp +++ b/src/server/game/Entities/Player/KillRewarder.cpp @@ -114,6 +114,34 @@ inline void KillRewarder::_InitGroupData() if (_victim->GetLevel() > grayLevel && (!_maxNotGrayMember || _maxNotGrayMember->GetLevel() < lvl)) _maxNotGrayMember = member; } + + //npcbot + if (BotMgr::GetNpcBotXpReductionBlizzlikeEnabled()) + { + for (GroupReference* itr = _group->GetFirstMember(); itr != nullptr; itr = itr->next()) + { + Player* member = itr->GetSource(); + if (!member || !member->IsInMap(_victim) || !member->HaveBot()) + continue; + + BotMap const* botMap = member->GetBotMgr()->GetBotMap(); + for (auto const& kv : *botMap) + { + Creature const* bot = kv.second; + if (bot && bot->IsAlive() && bot->IsInMap(_victim) && (_group->IsMember(kv.first) || !BotMgr::GetNpcBotXpReductionBlizzlikeGroupOnly()) && + (member->GetMap()->IsDungeon() || _victim->GetDistance(bot) <= sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE))) + { + const uint8 lvl = bot->GetLevel(); + ++_count; + _sumLevel += lvl; + if (_maxLevel < lvl) + _maxLevel = lvl; + } + } + } + } + //end npcbot + // 2.5. _isFullXP - flag identifying that for all group members victim is not gray, // so 100% XP will be rewarded (50% otherwise). _isFullXP = _maxNotGrayMember && (_maxLevel == _maxNotGrayMember->GetLevel()); diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index ee15db5604bce..49d1471026647 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -4213,14 +4213,23 @@ NpcBot.BaseFollowDistance = 30 # # NpcBot.XpReduction.Amount # NpcBot.XpReduction.StartingNumber +# NpcBot.XpReduction.Blizzlike.Enable +# NpcBot.XpReduction.Blizzlike.GroupOnly # Description: XP percent penalty for each bot used starting with . -# Example: 3 bots, reduction is 20, start is 2: ((3-(2-1))*20) = 40%, 60% exp gained. +# enables group size based XP reduction counting either any bots +# or bots in group only, combines multiplicatively +# Example: Group of 4, 3 bots, reduction is 20, start is 2, blizzlike enabled: +# (100 - ((3-(2-1))*20)) * 1.3 / 4 = 19.5% exp gained. # Note: Maximum overall xp reduction is 90%. # Default: 0 - (NpcBot.XpReduction.Amount) # 2 - (NpcBot.XpReduction.StartingNumber) +# 1 - (NpcBot.XpReduction.Blizzlike.Enable) +# 0 - (NpcBot.XpReduction.Blizzlike.GroupOnly) -NpcBot.XpReduction.Amount = 0 -NpcBot.XpReduction.StartingNumber = 2 +NpcBot.XpReduction.Amount = 0 +NpcBot.XpReduction.StartingNumber = 2 +NpcBot.XpReduction.Blizzlike.Enable = 1 +NpcBot.XpReduction.Blizzlike.GroupOnly = 0 # # NpcBot.MountLevel.60