FIX Random Bot Guilds not initialising random emblem, colors, etc #1636 (#1650)

* FIX Random Bot Guilds not initialising random emblem, colors, etc #1636

FIX Random Bot Guilds not initialising random emblem, colors, etc #1636

* Update RandomPlayerbotFactory.cpp

* Add sql patch an remove FixEmptyGuildEmblems() function
This commit is contained in:
Alex Dcnh
2025-09-25 21:42:34 +02:00
committed by GitHub
parent 0b74820f80
commit fc69dd5ddd
3 changed files with 65 additions and 7 deletions

View File

@@ -12,6 +12,7 @@
#include "Playerbots.h"
#include "RandomPlayerbotFactory.h"
#include "ServerFacade.h"
#include "SharedDefines.h" // GOLD
bool BuyPetitionAction::Execute(Event event)
{
@@ -237,6 +238,15 @@ bool PetitionTurnInAction::Execute(Event event)
if (bot->GetGuildId())
{
// Ensure that bot has at least 10g for HandleSetEmblem can be managed core side
// (EMBLEM_PRICE = 10 * GOLD in core)
static constexpr uint32 REQUIRED = 10 * GOLD;
uint32 have = bot->GetMoney(); // actual money earned by bot in copper
if (have < REQUIRED)
{
bot->ModifyMoney(int32(REQUIRED - have)); // add only the missing amount to bot to reach 10g
}
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());
uint32 st, cl, br, bc, bg;
@@ -247,7 +257,7 @@ bool PetitionTurnInAction::Execute(Event event)
st = urand(0, 180);
EmblemInfo emblemInfo(st, cl, br, bc, bg);
guild->HandleSetEmblem(emblemInfo);
guild->HandleSetEmblem(emblemInfo); // official core handling
// LANG_GUILD_VETERAN -> can invite
guild->HandleSetRankInfo(2, GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK | GR_RIGHT_INVITE);