Azerothcore - Autobalance DungeonScaleDownXP 为单人玩家添加额外检查
Azerothcore - Autobalance DungeonScaleDownXP add additional check for solo player
我目前 运行 我的 AzerothCore 服务器上的自动平衡模块。我想启用 DungeonScaleDownXP
:
#
# AutoBalance.DungeonScaleDownXP
# Decrease individual player's amount of XP gained during a dungeon to match the
# amount of XP gained during a full group run. Example: In a 5-man group, you
# earn 1/5 of the total XP per kill, but if you solo the dungeon with
# AutoBalance.DungeonScaleDownXP = 0, you will earn 5/5 of the total XP.
# With the option enabled, you will earn 1/5.
# Default: 0 (1 = ON, 0 = OFF)
AutoBalance.DungeonScaleDownXP = 0
但我想为单人玩家稍微修改一下。我想让他们获得 2.5 倍的 XP。但是如果它是两个或更多的一组使用正常的缩小版 XP。我相信这是我需要修改的部分:
void OnGiveXP(Player* player, uint32& amount, Unit* victim) override
{
if (victim && DungeonScaleDownXP)
{
Map* map = player->GetMap();
if (map->IsDungeon())
{
// Ensure that the players always get the same XP, even when entering the dungeon alone
uint32 maxPlayerCount = ((InstanceMap*)sMapMgr->FindMap(map->GetId(), map->GetInstanceId()))->GetMaxPlayers();
uint32 currentPlayerCount = map->GetPlayersCountExceptGMs();
amount *= (float)currentPlayerCount / maxPlayerCount;
}
}
}
只是不知道该怎么做。有什么建议吗?
最终找到了解决方案。首先,我在 conf 中添加了一个新选项:
#
# AutoBalance.DungeonScaleDownXP.rate.solo
# Set individual player's amount of XP gained during a dungeon run.
# AutoBalance.DungeonScaleDownXP = 1 you will earn 1/5 of the total XP as a solo player
# modifying this rate with allow you to set how much XP a solo player will receive
# Default: 1.0
AutoBalance.DungeonScaleDownXP.rate.solo = 1.0
接下来我向静态浮动添加了新选项:
static float globalRate, healthMultiplier, manaMultiplier, armorMultiplier, damageMultiplier, MinHPModifier, MinManaModifier, MinDamageModifier, DungeonScaleDownXPSoloRate,
InflectionPoint, InflectionPointRaid, InflectionPointRaid10M, InflectionPointRaid25M, InflectionPointHeroic, InflectionPointRaidHeroic, InflectionPointRaid10MHeroic, InflectionPointRaid25MHeroic, BossInflectionMult;
然后将新的浮动选项设置为从配置中读取:
DungeonScaleDownXPSoloRate = sConfigMgr->GetFloatDefault("AutoBalance.DungeonScaleDownXP.rate.solo", 1.0f);
然后添加一个 if 来检查 currentPlayerCount
:
void OnGiveXP(Player* player, uint32& amount, Unit* victim) override
{
if (victim && DungeonScaleDownXP)
{
Map* map = player->GetMap();
if (map->IsDungeon())
{
// Ensure that the players always get the same XP, even when entering the dungeon alone
uint32 maxPlayerCount = ((InstanceMap*)sMapMgr->FindMap(map->GetId(), map->GetInstanceId()))->GetMaxPlayers();
uint32 currentPlayerCount = map->GetPlayersCountExceptGMs();
if (currentPlayerCount == 1)
{
amount *= (float)currentPlayerCount / maxPlayerCount * DungeonScaleDownXPSoloRate;
}
else
{
amount *= (float)currentPlayerCount / maxPlayerCount;
}
}
}
}
现在我可以在配置中调整经验值了。
我目前 运行 我的 AzerothCore 服务器上的自动平衡模块。我想启用 DungeonScaleDownXP
:
#
# AutoBalance.DungeonScaleDownXP
# Decrease individual player's amount of XP gained during a dungeon to match the
# amount of XP gained during a full group run. Example: In a 5-man group, you
# earn 1/5 of the total XP per kill, but if you solo the dungeon with
# AutoBalance.DungeonScaleDownXP = 0, you will earn 5/5 of the total XP.
# With the option enabled, you will earn 1/5.
# Default: 0 (1 = ON, 0 = OFF)
AutoBalance.DungeonScaleDownXP = 0
但我想为单人玩家稍微修改一下。我想让他们获得 2.5 倍的 XP。但是如果它是两个或更多的一组使用正常的缩小版 XP。我相信这是我需要修改的部分:
void OnGiveXP(Player* player, uint32& amount, Unit* victim) override
{
if (victim && DungeonScaleDownXP)
{
Map* map = player->GetMap();
if (map->IsDungeon())
{
// Ensure that the players always get the same XP, even when entering the dungeon alone
uint32 maxPlayerCount = ((InstanceMap*)sMapMgr->FindMap(map->GetId(), map->GetInstanceId()))->GetMaxPlayers();
uint32 currentPlayerCount = map->GetPlayersCountExceptGMs();
amount *= (float)currentPlayerCount / maxPlayerCount;
}
}
}
只是不知道该怎么做。有什么建议吗?
最终找到了解决方案。首先,我在 conf 中添加了一个新选项:
#
# AutoBalance.DungeonScaleDownXP.rate.solo
# Set individual player's amount of XP gained during a dungeon run.
# AutoBalance.DungeonScaleDownXP = 1 you will earn 1/5 of the total XP as a solo player
# modifying this rate with allow you to set how much XP a solo player will receive
# Default: 1.0
AutoBalance.DungeonScaleDownXP.rate.solo = 1.0
接下来我向静态浮动添加了新选项:
static float globalRate, healthMultiplier, manaMultiplier, armorMultiplier, damageMultiplier, MinHPModifier, MinManaModifier, MinDamageModifier, DungeonScaleDownXPSoloRate,
InflectionPoint, InflectionPointRaid, InflectionPointRaid10M, InflectionPointRaid25M, InflectionPointHeroic, InflectionPointRaidHeroic, InflectionPointRaid10MHeroic, InflectionPointRaid25MHeroic, BossInflectionMult;
然后将新的浮动选项设置为从配置中读取:
DungeonScaleDownXPSoloRate = sConfigMgr->GetFloatDefault("AutoBalance.DungeonScaleDownXP.rate.solo", 1.0f);
然后添加一个 if 来检查 currentPlayerCount
:
void OnGiveXP(Player* player, uint32& amount, Unit* victim) override
{
if (victim && DungeonScaleDownXP)
{
Map* map = player->GetMap();
if (map->IsDungeon())
{
// Ensure that the players always get the same XP, even when entering the dungeon alone
uint32 maxPlayerCount = ((InstanceMap*)sMapMgr->FindMap(map->GetId(), map->GetInstanceId()))->GetMaxPlayers();
uint32 currentPlayerCount = map->GetPlayersCountExceptGMs();
if (currentPlayerCount == 1)
{
amount *= (float)currentPlayerCount / maxPlayerCount * DungeonScaleDownXPSoloRate;
}
else
{
amount *= (float)currentPlayerCount / maxPlayerCount;
}
}
}
}
现在我可以在配置中调整经验值了。