Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(NpcBots/bot_ai): Fixed gold looted by bots to be correctly modified by scripts and modules #9

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/server/game/AI/NpcBots/bot_ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "TemporarySummon.h"
#include "Transport.h"
#include "World.h"
#include "ScriptMgr.h"
/*
NpcBot System by Trickerer (https://github.com/trickerer/Trinity-Bots; [email protected])
Version 5.2.77a
Expand Down Expand Up @@ -11528,6 +11529,9 @@ void bot_ai::_autoLootCreatureGold(Creature* creature) const
Group const* gr = master->GetGroup();
if (!gr)
{
// Modify gold in scripts/modules
sScriptMgr->OnBeforeLootMoney(master, loot);

master->ModifyMoney(loot->gold);
master->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, loot->gold);

Expand All @@ -11545,6 +11549,9 @@ void bot_ai::_autoLootCreatureGold(Creature* creature) const
if (p && p->IsAtGroupRewardDistance(creature))
players.push_back(p);
}

// Modify gold in scripts/modules
sScriptMgr->OnBeforeLootMoney(master, loot);

uint32 goldPerPlayer = uint32(loot->gold / uint32(players.size()));

Expand Down
Loading