From 8fc3ac1e504464a08723d82c7d313414543a2f61 Mon Sep 17 00:00:00 2001 From: neckkola <65987027+neckkola@users.noreply.github.com> Date: Sat, 8 Jan 2022 10:06:36 -0400 Subject: [PATCH] Work on usecase 5 --- zone/bot.cpp | 15 +++++++++++---- zone/client_packet.cpp | 24 +++++++++++++++++++++++- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index d1b1ec6f9..fae13abe9 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -10119,6 +10119,7 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) { } } //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 uint32 free_group_id = raid->GetFreeGroup(); 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 - { // A raid does not already exist. One needs to be created before going forward + { Group* player_invited_group = 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); entity_list.AddRaid(raid); raid->SetRaidDetails(); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index e06610fbb..6f036e096 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -11326,7 +11326,9 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) #ifdef BOTS Bot* player_to_invite = 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); 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); + break; } else { @@ -11378,6 +11381,25 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) 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 */ auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); RaidGeneral_Struct* raid_command = (RaidGeneral_Struct*)outapp->pBuffer;