New work on Raid invite with a invitor having a group

This commit is contained in:
neckkola
2022-01-09 11:24:59 -04:00
parent 1c57e5b898
commit e5371253cb
3 changed files with 83 additions and 19 deletions
+59 -10
View File
@@ -10094,6 +10094,54 @@ void Bot::StopMoving(float new_heading)
uint8 Bot::spell_casting_chances[SPELL_TYPE_COUNT][PLAYER_CLASS_COUNT][EQ::constants::STANCE_TYPE_COUNT][cntHSND] = { 0 }; uint8 Bot::spell_casting_chances[SPELL_TYPE_COUNT][PLAYER_CLASS_COUNT][EQ::constants::STANCE_TYPE_COUNT][cntHSND] = { 0 };
void Bot::ProcessRaidInvite2(Client* invitee, Client* invitor) {
Raid* raid = entity_list.GetRaidByClient(invitor);
Group* g_invitee = invitee->GetGroup();
Group* g_invitor = invitor->GetGroup();
if (raid)
{
if (g_invitee)
{
//As there is already a raid, just add this group
}
else
{
//As there is already a raid and no group, just add this single client
}
}
else
{
//As there is no raid
//First, create the raid
if (g_invitor)
{
//Second, add the invitor group
if (g_invitee)
{
//Third, add the invitee group
}
else
{
//Third, no group so add the single client
}
}
else
{
//Second, add the single invitor
if (g_invitee)
{
//Third, add the invitee group
}
else
{
//Third, no group so add the single client
}
}
}
}
void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) { void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
if (player_accepting_invite) { if (player_accepting_invite) {
@@ -10123,7 +10171,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 //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) {
uint32 free_group_id = raid->GetFreeGroup(); uint32 free_group_id = raid->GetFreeGroup();
Client* addClient = nullptr; Client* addClient = nullptr;
Bot* addBot = nullptr; Bot* addBot = nullptr;
@@ -10204,14 +10252,14 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
{ {
// No raid at this point. // No raid at this point.
// Several usecases here. // Several usecases here.
// 1. Inviting Client does not have a group, invited player is a single client // Working from raids.cpp 1. Inviting Client does not have a group, invited player is a single client
// 2. Inviting Client does not have a group, invited player is a single bot that they own // Working 2. Inviting Client does not have a group, invited player is a single bot that they own
// 3. Inviting Client does not have a group, invited player is a single bot that they do not own // Working 3. Inviting Client does not have a group, invited player is a single bot that they do not own
// 4. Inviting Client does not have a group, invited player is a single bot in a group of other bots // Working 4. Inviting Client does not have a group, invited player is a single bot in a group of other bots
// 5. Inviting Client does not have a group, invited player is a single bot in a group of other mixed players and bots // Working 5. Inviting Client does not have a group, invited player is a single bot in a group of other mixed players and bots
// 6. Inviting Client does not have a group, invited player is a single client in a group of other players only // Working from raids.cpp 6. Inviting Client does not have a group, invited player is a single client in a group of other players only
// 7. Inviting Client does not have a group, invited player is a single client in a group of bots only // Working 7. Inviting Client does not have a group, invited player is a single client in a group of bots only
// 8. Inviting Client does not have a group, invited player is a single client in a group of mixed players and bots // Working 8. Inviting Client does not have a group, invited player is a single client in a group of mixed players and bots
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();
@@ -10390,7 +10438,8 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
raid->SendRaidLockTo(b_owner); raid->SendRaidLockTo(b_owner);
} }
} }
// No raid. Inviting client DOES NOT HAVE a group. Invited client DOES NOT HAVE a group. Working? // 2. Inviting Client does not have a group, invited player is a single bot that they own
// 3. Inviting Client does not have a group, invited player is a single bot that they do not own
else { else {
raid = new Raid(b_owner); raid = new Raid(b_owner);
entity_list.AddRaid(raid); entity_list.AddRaid(raid);
+1
View File
@@ -363,6 +363,7 @@ public:
static bool IsBotAttackAllowed(Mob* attacker, Mob* target, bool& hasRuleDefined); static bool IsBotAttackAllowed(Mob* attacker, Mob* target, bool& hasRuleDefined);
static Bot* GetBotByBotClientOwnerAndBotName(Client* c, std::string botName); static Bot* GetBotByBotClientOwnerAndBotName(Client* c, std::string botName);
static void ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner); //Mitch static void ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner); //Mitch
static void ProcessRaidInvite2(Client* invitee, Client* invitor); //Mitch
static void ProcessBotGroupInvite(Client* c, std::string botName); static void ProcessBotGroupInvite(Client* c, std::string botName);
static void ProcessBotGroupDisband(Client* c, std::string botName); static void ProcessBotGroupDisband(Client* c, std::string botName);
static void BotOrderCampAll(Client* c); static void BotOrderCampAll(Client* c);
+21 -7
View File
@@ -11414,20 +11414,34 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app)
// If the accepting client is in a group with a Bot, send the invite to Bot:ProcessRaidInvite // If the accepting client is in a group with a Bot, send the invite to Bot:ProcessRaidInvite
// instead of remaining here. // instead of remaining here.
Bot* b = nullptr; Bot* b = nullptr;
Client* c = entity_list.GetClientByName(raid_command_packet->leader_name); Client* invitee = entity_list.GetClientByName(raid_command_packet->leader_name);
Group* g = c->GetGroup(); Client* invitor = entity_list.GetClientByName(raid_command_packet->player_name);
if (c->HasGroup() && g->IsLeader(c)) Group* g_invitee = invitee->GetGroup();
Group* g_invitor = invitor->GetGroup();
if (invitee->HasGroup() && g_invitee->IsLeader(invitee))
{ {
for (int x = 0; x < 6; x++) for (int x = 0; x < 6; x++)
{ {
if (g->members[x]->IsBot()) if (g_invitee->members[x]->IsBot())
{ {
b = entity_list.GetBotByBotName(g->members[x]->GetName()); b = entity_list.GetBotByBotName(g_invitee->members[x]->GetName());
Bot::ProcessRaidInvite(b, player_accepting_invite);
break;
}
}
}
if (invitee && invitor->HasGroup() && g_invitor->IsLeader(invitor))
{
for (int x = 0; x < 6; x++)
{
if (g_invitor->members[x]->IsBot())
{
b = entity_list.GetBotByBotName(g_invitor->members[x]->GetName());
Bot::ProcessRaidInvite2(player_accepting_invite);
break; break;
} }
} }
Bot::ProcessRaidInvite(b, player_accepting_invite);
break;
} }
#endif #endif
if (player_accepting_invite) { if (player_accepting_invite) {