azerothcore - Azerothcore - Autobalance DungeonScaleDownXP 为单人玩家添加额外检查
问题描述
我目前正在我的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;
}
}
}
}
现在我可以在配置中调整 xp 速率。
推荐阅读
- javascript - 在 WebStorm 中使用 require() 后 - 未解析的函数或方法
- c# - Asp.Net MVC 根据另一个表中的设置显示索引列表
- r - 类似于 R 中的 Pandas Series.value_counts()?
- r - 提取字符串中的所有单词和字母簇,然后使用 R 中的 gsub() 使每个单词成为单独的数据片段
- python - Flask SQLAlchemy - 如何在数据库中查询匹配相关对象属性的对象?
- android - 在颤振中使用底部导航在 dart 文件之间切换
- python - 组合多个字符串列以创建新的 Pandas 系列的最 Pythonic 方式是什么?
- python - 使用 pipenv 在 PyCharm 中未解决的引用`flask_sqlachemy`
- datetime - 如何从两个 3D 数据集(时间、纬度、经度)的同一日期提取数据?
- c++ - 将值设置为枚举