Skip to content

Commit

Permalink
BREAKING CHANGE(Core/Config): Individual XP rate per bg (azerothcore#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Nefertumm authored Mar 4, 2022
1 parent 88a9277 commit 680e60c
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 6 deletions.
13 changes: 13 additions & 0 deletions doc/changelog/pendings/changes_1646261203127755100.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Changed
Removed Rate.XP.BattlegroundKill, added one rate config for each bg.

### How to upgrade

Delete Rate.XP.BattlegroundKill, and then set all the battlegroundkill rate for each bg.
Rate.XP.BattlegroundKillAV = 1
Rate.XP.BattlegroundKillWSG = 1
Rate.XP.BattlegroundKillAB = 1
Rate.XP.BattlegroundKillEOTS = 1
Rate.XP.BattlegroundKillSOTA = 1
Rate.XP.BattlegroundKillIC = 1

10 changes: 10 additions & 0 deletions src/server/game/Battlegrounds/Battleground.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ enum BattlegroundDesertionType
BG_DESERTION_TYPE_INVITE_LOGOUT = 4, // player is invited to join and logs out
};

enum BattlegroundMaps
{
MAP_BG_ALTERAC_VALLEY = 30,
MAP_BG_WARSONG_GULCH = 489,
MAP_BG_ARATHI_BASIN = 529,
MAP_BG_EYE_OF_THE_STORM = 566,
MAP_BG_STRAND_OF_THE_ANCIENTS = 607,
MAP_BG_ISLE_OF_CONQUEST = 628
};

enum BattlegroundBroadcastTexts
{
BG_TEXT_ALLIANCE_WINS = 10633,
Expand Down
30 changes: 29 additions & 1 deletion src/server/game/Miscellaneous/Formulas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include "Formulas.h"
#include "Battleground.h"
#include "Creature.h"
#include "Log.h"
#include "Player.h"
Expand Down Expand Up @@ -93,7 +94,34 @@ uint32 Acore::XP::Gain(Player* player, Unit* unit, bool isBattleGround /*= false
xpMod *= creature->GetCreatureTemplate()->ModExperience;
}

xpMod *= isBattleGround ? sWorld->getRate(RATE_XP_BG_KILL) : sWorld->getRate(RATE_XP_KILL);
if (isBattleGround)
{
switch (player->GetMapId())
{
case MAP_BG_ALTERAC_VALLEY:
xpMod *= sWorld->getRate(RATE_XP_BG_KILL_AV);
break;
case MAP_BG_WARSONG_GULCH:
xpMod *= sWorld->getRate(RATE_XP_BG_KILL_WSG);
break;
case MAP_BG_ARATHI_BASIN:
xpMod *= sWorld->getRate(RATE_XP_BG_KILL_AB);
break;
case MAP_BG_EYE_OF_THE_STORM:
xpMod *= sWorld->getRate(RATE_XP_BG_KILL_EOTS);
break;
case MAP_BG_STRAND_OF_THE_ANCIENTS:
xpMod *= sWorld->getRate(RATE_XP_BG_KILL_SOTA);
break;
case MAP_BG_ISLE_OF_CONQUEST:
xpMod *= sWorld->getRate(RATE_XP_BG_KILL_IC);
break;
}
}
else
{
xpMod *= sWorld->getRate(RATE_XP_KILL);
}

// if players dealt less than 50% of the damage and were credited anyway (due to CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ), scale XP gained appropriately (linear scaling)
if (creature && creature->m_PlayerDamageReq)
Expand Down
7 changes: 6 additions & 1 deletion src/server/game/World/IWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,12 @@ enum Rates
RATE_DROP_MONEY,
RATE_REWARD_BONUS_MONEY,
RATE_XP_KILL,
RATE_XP_BG_KILL,
RATE_XP_BG_KILL_AV,
RATE_XP_BG_KILL_WSG,
RATE_XP_BG_KILL_AB,
RATE_XP_BG_KILL_EOTS,
RATE_XP_BG_KILL_SOTA,
RATE_XP_BG_KILL_IC,
RATE_XP_QUEST,
RATE_XP_QUEST_DF,
RATE_XP_EXPLORE,
Expand Down
7 changes: 6 additions & 1 deletion src/server/game/World/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,12 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_DROP_MONEY] = sConfigMgr->GetOption<float>("Rate.Drop.Money", 1.0f);
rate_values[RATE_REWARD_BONUS_MONEY] = sConfigMgr->GetOption<float>("Rate.RewardBonusMoney", 1.0f);
rate_values[RATE_XP_KILL] = sConfigMgr->GetOption<float>("Rate.XP.Kill", 1.0f);
rate_values[RATE_XP_BG_KILL] = sConfigMgr->GetOption<float>("Rate.XP.BattlegroundKill", 1.0f);
rate_values[RATE_XP_BG_KILL_AV] = sConfigMgr->GetOption<float>("Rate.XP.BattlegroundKillAV", 1.0f);
rate_values[RATE_XP_BG_KILL_WSG] = sConfigMgr->GetOption<float>("Rate.XP.BattlegroundKillWSG", 1.0f);
rate_values[RATE_XP_BG_KILL_AB] = sConfigMgr->GetOption<float>("Rate.XP.BattlegroundKillAB", 1.0f);
rate_values[RATE_XP_BG_KILL_EOTS] = sConfigMgr->GetOption<float>("Rate.XP.BattlegroundKillEOTS", 1.0f);
rate_values[RATE_XP_BG_KILL_SOTA] = sConfigMgr->GetOption<float>("Rate.XP.BattlegroundKillSOTA", 1.0f);
rate_values[RATE_XP_BG_KILL_IC] = sConfigMgr->GetOption<float>("Rate.XP.BattlegroundKillIC", 1.0f);
rate_values[RATE_XP_QUEST] = sConfigMgr->GetOption<float>("Rate.XP.Quest", 1.0f);
rate_values[RATE_XP_QUEST_DF] = sConfigMgr->GetOption<float>("Rate.XP.Quest.DF", 1.0f);
rate_values[RATE_XP_EXPLORE] = sConfigMgr->GetOption<float>("Rate.XP.Explore", 1.0f);
Expand Down
11 changes: 8 additions & 3 deletions src/server/worldserver/worldserver.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2291,12 +2291,17 @@ Rate.XP.Explore = 1
Rate.XP.Pet = 1

#
# Rate.XP.BattlegroundKill
# Description: Experience rate for honorable kills in battlegrounds. Not affected by Rate.XP.Kill
# Rate.XP.BattlegroundKill...
# Description: Experience rate for honorable kills in battlegrounds. Not affected by Rate.XP.Kill. Defined for each battleground.
# Only works if Battleground.GiveXPForKills = 1
# Default: 1

Rate.XP.BattlegroundKill = 1
Rate.XP.BattlegroundKillAV = 1
Rate.XP.BattlegroundKillWSG = 1
Rate.XP.BattlegroundKillAB = 1
Rate.XP.BattlegroundKillEOTS = 1
Rate.XP.BattlegroundKillSOTA = 1
Rate.XP.BattlegroundKillIC = 1

#
# Rate.RepairCost
Expand Down

0 comments on commit 680e60c

Please sign in to comment.