Big update InviteToGroupAction.cpp (#1154)

* Group improvement: Bots will no longer auto-invite players who have DND enabled.

* Group fix: Bots will no longer invite self-bots to groups with dnd enabled.

* Invite fix: Bots will no longer invite DnD players from their guild.

* Guild group invite improvement: Lower level guildmembers may now invite higher level players to help them out.

* Crash fix: Bots inviting players into a group that are being teleported.

* Invite fix: Bots will no longer automatically convert to raid when inviting real players.

* Group fix: Bots now properly group up automatically again.

* Group fix: Bots no longer invite themselves to groups from the guild.

* Fix

* Fix build

* New Fix

* .

* ..
This commit is contained in:
EricksOliveira
2025-04-11 18:42:29 -03:00
committed by GitHub
parent 287875c436
commit 6ae96f19b9

View File

@@ -32,8 +32,11 @@ bool InviteToGroupAction::Invite(Player* player)
return false;
if (Group* group = player->GetGroup())
if (!group->isRaidGroup() && group->GetMembersCount() > 4)
group->ConvertToRaid();
{
if(GET_PLAYERBOT_AI(player) && !GET_PLAYERBOT_AI(player)->IsRealPlayer())
if (!group->isRaidGroup() && group->GetMembersCount() > 4)
group->ConvertToRaid();
}
WorldPacket p;
uint32 roles_mask = 0;
@@ -53,29 +56,29 @@ bool InviteNearbyToGroupAction::Execute(Event event)
if (!player)
continue;
if (!player->GetMapId() != bot->GetMapId())
continue;
if (player == bot)
continue;
if (player->GetMapId() != bot->GetMapId())
continue;
if (player->GetGroup())
continue;
if (player == bot)
if (player->isDND())
continue;
if (player->IsBeingTeleported())
continue;
if (botAI)
{
if (botAI->GetGrouperType() == GrouperType::SOLO &&
!botAI->HasRealPlayerMaster()) // Do not invite solo players.
if (botAI->GetGrouperType() == GrouperType::SOLO && !botAI->HasRealPlayerMaster()) // Do not invite solo players.
continue;
if (botAI->HasActivePlayerMaster()) // Do not invite alts of active players.
continue;
}
else
{
if (!sPlayerbotAIConfig->randomBotGroupNearby)
return false;
}
if (abs(int32(player->GetLevel() - bot->GetLevel())) > 2)
continue;
@@ -161,26 +164,32 @@ bool InviteGuildToGroupAction::Execute(Event event)
if (!player)
continue;
if (player == bot)
continue;
if (player->GetGroup())
continue;
PlayerbotAI* botAI = GET_PLAYERBOT_AI(player);
if (player->isDND())
continue;
if (botAI)
if (player->IsBeingTeleported())
continue;
PlayerbotAI* playerAi = GET_PLAYERBOT_AI(player);
if (playerAi)
{
if (botAI->GetGrouperType() == GrouperType::SOLO &&
!botAI->HasRealPlayerMaster()) // Do not invite solo players.
if (playerAi->GetGrouperType() == GrouperType::SOLO &&
!playerAi->HasRealPlayerMaster()) // Do not invite solo players.
continue;
if (botAI->HasActivePlayerMaster()) // Do not invite alts of active players.
if (playerAi->HasActivePlayerMaster()) // Do not invite alts of active players.
continue;
if (player->GetLevel() >
bot->GetLevel() + 5) // Only invite higher levels that need money so they can grind money and help out.
if (player->GetLevel() > bot->GetLevel() + 5) // Invite higher levels that need money so they can grind money and help out.
{
AiObjectContext* botContext = botAI->GetAiObjectContext();
if (!botContext->GetValue<bool>("should get money")->Get())
if (!PAI_VALUE(bool,"should get money"))
continue;
}
}
@@ -190,10 +199,10 @@ bool InviteGuildToGroupAction::Execute(Event event)
return false;
}
if (abs(int32(player->GetLevel() - bot->GetLevel())) > 4)
if (bot->GetLevel() > player->GetLevel() + 5) // Do not invite members that too low level or risk dragging them to deadly places.
continue;
if (!botAI && sServerFacade->GetDistance2d(bot, player) > sPlayerbotAIConfig->sightDistance)
if (!playerAi && sServerFacade->GetDistance2d(bot, player) > sPlayerbotAIConfig->sightDistance)
continue;
Group* group = bot->GetGroup();