Work on usecase 5

This commit is contained in:
neckkola
2022-01-08 10:06:36 -04:00
parent 947fb239a9
commit 8fc3ac1e50
2 changed files with 34 additions and 5 deletions
+11 -4
View File
@@ -10119,6 +10119,7 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
} }
} }
//Usecase #3 - Raid already created, Bot is BotGroupLeader. //Usecase #3 - Raid already created, Bot is BotGroupLeader.
//UseCase #5 - Raid already created, Client is groupleader with at least one Bot in group
if (group) {//add us all // Is the player already in a group? If yes, add all players from the group if (group) {//add us all // Is the player already in a group? If yes, add all players from the group
uint32 free_group_id = raid->GetFreeGroup(); uint32 free_group_id = raid->GetFreeGroup();
Client* addClient = nullptr; Client* addClient = nullptr;
@@ -10189,14 +10190,20 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
} }
} }
} }
//No raid exists. // No raid exists at this point
// Usecase #1 - Client invites another client. No groups involved. Handled by Raid Accept Invite routine
// Usecase #2 - Client invites their own bot. No groups involved. Handled here.
// Usecase #4 - Client invites their own bot to a group then to raid. Handled here.
// Usecase #5 - Client invites another client that is in a group with their own bot. Handled here.
// Usecase #6 - Client with a bot in a group invites another client that is in a group with their own bot. Handled here.
else else
{ // A raid does not already exist. One needs to be created before going forward {
Group* player_invited_group = player_accepting_invite->GetGroup(); Group* player_invited_group = player_accepting_invite->GetGroup();
Group* group = entity_list.GetGroupByClient(b_owner); // player_accepting_invite->GetGroup(); Group* group = entity_list.GetGroupByClient(b_owner); // player_accepting_invite->GetGroup();
if (group) //if our target has a group if (group)
// No raid. Invited member (Bot Owner) has a group. Member inviting does not have a group
// Usecase #5
{ {
// raid = new Raid(player_accepting_invite);
raid = new Raid(b_owner); raid = new Raid(b_owner);
entity_list.AddRaid(raid); entity_list.AddRaid(raid);
raid->SetRaidDetails(); raid->SetRaidDetails();
+23 -1
View File
@@ -11326,7 +11326,9 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app)
#ifdef BOTS #ifdef BOTS
Bot* player_to_invite = nullptr; Bot* player_to_invite = nullptr;
Client* player_to_invite_owner = nullptr; Client* player_to_invite_owner = nullptr;
if (entity_list.GetBotByBotName(raid_command_packet->player_name)) {
if (entity_list.GetBotByBotName(raid_command_packet->player_name) ) {
Bot* player_to_invite = entity_list.GetBotByBotName(raid_command_packet->player_name); Bot* player_to_invite = entity_list.GetBotByBotName(raid_command_packet->player_name);
Client* player_to_invite_owner = player_to_invite->GetOwner()->CastToClient(); Client* player_to_invite_owner = player_to_invite->GetOwner()->CastToClient();
@@ -11352,6 +11354,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app)
} }
Bot::ProcessRaidInvite(player_to_invite, player_to_invite_owner); Bot::ProcessRaidInvite(player_to_invite, player_to_invite_owner);
break;
} }
else else
{ {
@@ -11378,6 +11381,25 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app)
break; break;
} }
// bool player_accepting_invite_has_bots_in_group = false;
Bot* b = nullptr;
Group* g = player_to_invite->GetGroup();
if (player_to_invite->HasGroup() && g->IsLeader(player_to_invite))
{
for (int x = 0; x < 6; x++)
{
if (g->members[x]->IsBot())
{
b = entity_list.GetBotByBotName(g->members[x]->GetName());
// player_accepting_invite_has_bots_in_group = true;
break;
}
}
Bot::ProcessRaidInvite(b, player_to_invite);
break;
}
/* Send out invite to the client */ /* Send out invite to the client */
auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct));
RaidGeneral_Struct* raid_command = (RaidGeneral_Struct*)outapp->pBuffer; RaidGeneral_Struct* raid_command = (RaidGeneral_Struct*)outapp->pBuffer;