Skip to content

Commit da67042

Browse files
committed
Change roll to greed for inappropriate items
Change only applies to bots with real player master Config is added to restore old behavior
1 parent 9cc081c commit da67042

File tree

6 files changed

+30
-1
lines changed

6 files changed

+30
-1
lines changed

playerbot/PlayerbotAIConfig.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ bool PlayerbotAIConfig::Initialize()
162162
randomGearProgression = config.GetBoolDefault("AiPlayerbot.RandomGearProgression", true);
163163
randomGearLoweringChance = config.GetFloatDefault("AiPlayerbot.RandomGearLoweringChance", 0.15f);
164164
randomBotMaxLevelChance = config.GetFloatDefault("AiPlayerbot.RandomBotMaxLevelChance", 0.15f);
165+
rollBadItemsWithPlayer = config.GetBoolDefault("AiPlayerbot.RollBadItemsWithPlayer", false);
165166
randomBotRpgChance = config.GetFloatDefault("AiPlayerbot.RandomBotRpgChance", 0.35f);
166167
usePotionChance = config.GetFloatDefault("AiPlayerbot.UsePotionChance", 1.0f);
167168
attackEmoteChance = config.GetFloatDefault("AiPlayerbot.AttackEmoteChance", 0.0f);

playerbot/PlayerbotAIConfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ class PlayerbotAIConfig
153153
std::list<uint32> randomGearWhitelist;
154154
bool randomGearProgression;
155155
float randomGearLoweringChance;
156+
bool rollBadItemsWithPlayer;
156157
float randomBotMaxLevelChance;
157158
float randomBotRpgChance;
158159
float usePotionChance;

playerbot/aiplayerbot.conf.dist.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ AiPlayerbot.RandomGearTabardsUnobtainable = 0
128128
# List of item IDs to exclude from random gear, separated by comma
129129
AiPlayerbot.RandomGearBlacklist = 0
130130

131+
# Roll need on items if slot is empty or broken, even if not appropriate for bot's spec
132+
# Bots without real player master ignore this config and always roll need in that case
133+
# 1 - roll need on such items
134+
# 0 - roll greed on such items (Default)
135+
AiPlayerbot.RollBadItemsWithPlayer = 0
136+
131137
# Chance random bot has max level on first randomize (default 0.15)
132138
AiPlayerbot.RandomBotMaxLevelChance = 0.15
133139

playerbot/aiplayerbot.conf.dist.in.tbc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ AiPlayerbot.RandomGearTabardsUnobtainable = 0
132132
# List of item IDs to exclude from random gear, separated by comma
133133
AiPlayerbot.RandomGearBlacklist = 0
134134

135+
# Roll need on items if slot is empty or broken, even if not appropriate for bot's spec
136+
# Bots without real player master ignore this config and always roll need in that case
137+
# 1 - roll need on such items
138+
# 0 - roll greed on such items (Default)
139+
AiPlayerbot.RollBadItemsWithPlayer = 0
140+
135141
# Chance random bot has max level on first randomize (default 0.15)
136142
AiPlayerbot.RandomBotMaxLevelChance = 0.15
137143

playerbot/aiplayerbot.conf.dist.in.wotlk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ AiPlayerbot.RandomGearTabardsUnobtainable = 0
135135
# List of item IDs to exclude from random gear, separated by comma
136136
AiPlayerbot.RandomGearBlacklist = 0
137137

138+
# Roll need on items if slot is empty or broken, even if not appropriate for bot's spec
139+
# Bots without real player master ignore this config and always roll need in that case
140+
# 1 - roll need on such items
141+
# 0 - roll greed on such items (Default)
142+
AiPlayerbot.RollBadItemsWithPlayer = 0
143+
138144
# Chance random bot has max level on first randomize (default 0.15)
139145
AiPlayerbot.RandomBotMaxLevelChance = 0.15
140146

playerbot/strategy/actions/LootRollAction.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ RollVote RollAction::CalculateRollVote(ItemQualifier& itemQualifier)
186186
case ItemUsage::ITEM_USAGE_EQUIP:
187187
case ItemUsage::ITEM_USAGE_GUILD_TASK:
188188
case ItemUsage::ITEM_USAGE_FORCE_NEED:
189-
case ItemUsage::ITEM_USAGE_BAD_EQUIP:
190189
needVote = ROLL_NEED;
191190
break;
192191
case ItemUsage::ITEM_USAGE_SKILL:
@@ -206,6 +205,16 @@ RollVote RollAction::CalculateRollVote(ItemQualifier& itemQualifier)
206205
break;
207206
}
208207

208+
// special case for bad equip
209+
if (usage == ItemUsage::ITEM_USAGE_BAD_EQUIP)
210+
{
211+
bool shouldEquipBadItems = sPlayerbotAIConfig.rollBadItemsWithPlayer || !ai->HasRealPlayerMaster();
212+
if (shouldEquipBadItems)
213+
needVote == ROLL_NEED;
214+
else
215+
needVote = ROLL_GREED;
216+
}
217+
209218
bool canLoot = StoreLootAction::IsLootAllowed(itemQualifier, bot->GetPlayerbotAI());
210219

211220
if (AI_VALUE2(bool, "manual bool", "roll feedback"))

0 commit comments

Comments
 (0)