mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 17:26:30 +00:00
A few more use cases working
This commit is contained in:
+48
-28
@@ -10095,7 +10095,6 @@ 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::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
|
void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
|
||||||
//Client* player_accepting_invite = entity_list.GetClientByName(raid_command_packet->player_name);
|
|
||||||
|
|
||||||
if (player_accepting_invite) {
|
if (player_accepting_invite) {
|
||||||
if (player_accepting_invite->IsRaidGrouped()) {
|
if (player_accepting_invite->IsRaidGrouped()) {
|
||||||
@@ -10103,9 +10102,12 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Raid* raid = entity_list.GetRaidByClient(b_owner);
|
Raid* raid = entity_list.GetRaidByClient(b_owner);
|
||||||
if (raid) { // Does a raid already exist?
|
|
||||||
|
// Check to see if a raid already exists.
|
||||||
|
if (raid) {
|
||||||
raid->VerifyRaid();
|
raid->VerifyRaid();
|
||||||
Group* group = player_accepting_invite->GetGroup();
|
Group* group = player_accepting_invite->GetGroup();
|
||||||
|
// A few checks here. If player is in a group, is there room for another group. If not in a group, is there room for one more player.
|
||||||
if (group) {
|
if (group) {
|
||||||
if (group->GroupCount() + raid->RaidCount() > MAX_RAID_MEMBERS) {
|
if (group->GroupCount() + raid->RaidCount() > MAX_RAID_MEMBERS) {
|
||||||
b_owner->Message(Chat::Red, "Invite failed, bot group invite would create a raid larger than the maximum number of members allowed.");
|
b_owner->Message(Chat::Red, "Invite failed, bot group invite would create a raid larger than the maximum number of members allowed.");
|
||||||
@@ -10118,8 +10120,9 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Usecase #3 - Raid already created, Bot is BotGroupLeader.
|
|
||||||
//UseCase #5 - Raid already created, Client is groupleader with at least one Bot in group
|
//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;
|
||||||
@@ -10190,6 +10193,7 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// No raid exists at this point
|
// No raid exists at this point
|
||||||
// Usecase #1 - Client invites another client. No groups involved. Handled by Raid Accept Invite routine
|
// 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 #2 - Client invites their own bot. No groups involved. Handled here.
|
||||||
@@ -10198,11 +10202,22 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
|
|||||||
// Usecase #6 - Client with a bot in a group 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
|
||||||
{
|
{
|
||||||
|
// No raid at this point.
|
||||||
|
// Several usecases here.
|
||||||
|
// 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
|
||||||
|
// 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
|
||||||
|
// 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
|
||||||
|
// 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
|
||||||
|
|
||||||
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();
|
||||||
|
// No raid. Check to see if Inviting client has a group?
|
||||||
if (group)
|
if (group)
|
||||||
// No raid. Invited member (Bot Owner) has a group. Member inviting does not have a group
|
// No raid. Inviting client has a group.
|
||||||
// Usecase #5
|
|
||||||
{
|
{
|
||||||
raid = new Raid(b_owner);
|
raid = new Raid(b_owner);
|
||||||
entity_list.AddRaid(raid);
|
entity_list.AddRaid(raid);
|
||||||
@@ -10210,8 +10225,9 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
|
|||||||
|
|
||||||
uint32 raid_free_group_id = raid->GetFreeGroup();
|
uint32 raid_free_group_id = raid->GetFreeGroup();
|
||||||
|
|
||||||
/* If we already have a group then cycle through adding us... */
|
// No raid. Inviting client has a group. Check to see if invited player has a group?
|
||||||
if (player_invited_group) {
|
if (player_invited_group) {
|
||||||
|
// No raid. Inviting client has a group. Invited client has a group.
|
||||||
Client* client_to_be_leader = nullptr;
|
Client* client_to_be_leader = nullptr;
|
||||||
for (int x = 0; x < 6; x++) {
|
for (int x = 0; x < 6; x++) {
|
||||||
if (player_invited_group->members[x]) {
|
if (player_invited_group->members[x]) {
|
||||||
@@ -10262,6 +10278,7 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
|
|||||||
raid->GroupUpdate(raid_free_group_id);
|
raid->GroupUpdate(raid_free_group_id);
|
||||||
raid_free_group_id = raid->GetFreeGroup();
|
raid_free_group_id = raid->GetFreeGroup();
|
||||||
}
|
}
|
||||||
|
// No raid. Inviting client has a group. Invited client DOES NOT HAVE a group.
|
||||||
else {
|
else {
|
||||||
// raid->SendRaidCreate(player_accepting_invite);
|
// raid->SendRaidCreate(player_accepting_invite);
|
||||||
// raid->AddMember(player_accepting_invite, 0xFFFFFFFF, true, false, true);
|
// raid->AddMember(player_accepting_invite, 0xFFFFFFFF, true, false, true);
|
||||||
@@ -10321,17 +10338,16 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
|
|||||||
|
|
||||||
raid->GroupUpdate(raid_free_group_id);
|
raid->GroupUpdate(raid_free_group_id);
|
||||||
}
|
}
|
||||||
/* Target does not have a group */
|
|
||||||
//No raid and bot owner does not have group. Now check for bot having a group
|
|
||||||
else {
|
else {
|
||||||
if (player_invited_group) {
|
if (player_invited_group) {
|
||||||
// No raid, No bot owner group, bot has group
|
// No raid. Inviting client DOES NOT HAVE a group. Invited client has a group.
|
||||||
|
// Usecase 4 - No raid, no inviter group, bot in a group of bots
|
||||||
|
// Usecase 5 - No raid, no inviter group, bot in a group of mixed players and bots
|
||||||
|
// Usecase 7 - No raid, no inviter group, client in a group of bots
|
||||||
|
// Usecase 8 - No raid, no inviter group, client in a group of mixed players and bots
|
||||||
raid = new Raid(b_owner);
|
raid = new Raid(b_owner);
|
||||||
entity_list.AddRaid(raid);
|
entity_list.AddRaid(raid);
|
||||||
raid->SetRaidDetails();
|
raid->SetRaidDetails();
|
||||||
raid->SendRaidCreate(b_owner);
|
|
||||||
raid->SendMakeLeaderPacketTo(raid->leadername, b_owner);
|
|
||||||
raid->AddMember(b_owner, 0xFFFFFFFF, true, false, true);
|
|
||||||
|
|
||||||
for (int x = 0; x < 6; x++) {
|
for (int x = 0; x < 6; x++) {
|
||||||
if (player_invited_group->members[x]) {
|
if (player_invited_group->members[x]) {
|
||||||
@@ -10347,8 +10363,8 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
|
|||||||
raid->AddBot(b, 0, false, false, false);
|
raid->AddBot(b, 0, false, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (group->members[x]->IsClient()) {
|
else if (player_invited_group->members[x]->IsClient()) {
|
||||||
c = group->members[x]->CastToClient();
|
c = player_invited_group->members[x]->CastToClient();
|
||||||
if (x == 0) {
|
if (x == 0) {
|
||||||
raid->SendRaidCreate(c);
|
raid->SendRaidCreate(c);
|
||||||
raid->SendMakeLeaderPacketTo(raid->leadername, c);
|
raid->SendMakeLeaderPacketTo(raid->leadername, c);
|
||||||
@@ -10363,6 +10379,10 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
raid->SendRaidCreate(b_owner);
|
||||||
|
raid->SendMakeLeaderPacketTo(raid->leadername, b_owner);
|
||||||
|
raid->SendBulkRaid(b_owner);
|
||||||
|
raid->AddMember(b_owner, 0xFFFFFFFF, true, false, true);
|
||||||
player_invited_group->JoinRaidXTarget(raid, true);
|
player_invited_group->JoinRaidXTarget(raid, true);
|
||||||
player_invited_group->DisbandGroup(true);
|
player_invited_group->DisbandGroup(true);
|
||||||
raid->GroupUpdate(0);
|
raid->GroupUpdate(0);
|
||||||
@@ -10370,22 +10390,22 @@ void Bot::ProcessRaidInvite(Bot* player_accepting_invite, Client* b_owner) {
|
|||||||
raid->SendRaidLockTo(b_owner);
|
raid->SendRaidLockTo(b_owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Usecase #2 - No raid, no bot owner group, no bot group. Working
|
// No raid. Inviting client DOES NOT HAVE a group. Invited client DOES NOT HAVE a group. Working?
|
||||||
else {
|
else {
|
||||||
raid = new Raid(b_owner);
|
raid = new Raid(b_owner);
|
||||||
entity_list.AddRaid(raid);
|
entity_list.AddRaid(raid);
|
||||||
raid->SetRaidDetails();
|
raid->SetRaidDetails();
|
||||||
raid->SendRaidCreate(b_owner);
|
raid->SendRaidCreate(b_owner);
|
||||||
raid->SendMakeLeaderPacketTo(raid->leadername, b_owner);
|
raid->SendMakeLeaderPacketTo(raid->leadername, b_owner);
|
||||||
raid->AddMember(b_owner, 0xFFFFFFFF, true, false, true);
|
raid->AddMember(b_owner, 0xFFFFFFFF, true, false, true);
|
||||||
raid->AddBot(player_accepting_invite);
|
raid->AddBot(player_accepting_invite);
|
||||||
if (raid->IsLocked()) {
|
if (raid->IsLocked()) {
|
||||||
raid->SendRaidLockTo(b_owner);
|
raid->SendRaidLockTo(b_owner);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+31
-22
@@ -11328,6 +11328,8 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app)
|
|||||||
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();
|
||||||
@@ -11337,17 +11339,22 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Group* player_to_invite_group = player_to_invite->GetGroup();
|
Group* player_to_invite_group = player_to_invite->GetGroup();
|
||||||
|
// Not allowed: Invite a bot that is not owned by the inviter and is not in a group. They could be in a group with their owner!
|
||||||
|
if (player_to_invite->GetOwnerID() != player_to_invite_owner->CharacterID() && !player_to_invite_group) {
|
||||||
|
Message(Chat::Red, "%s is not grouped and not your Bot. You can only invite your Bots, or Bots grouped with others.", player_to_invite->GetName());
|
||||||
|
}
|
||||||
|
|
||||||
|
//Not allowed: Invite a bot that is already within a raid.
|
||||||
if (player_to_invite->HasRaid()) {
|
if (player_to_invite->HasRaid()) {
|
||||||
Message(Chat::Red, "%s is already in a raid.", player_to_invite->GetName());
|
Message(Chat::Red, "%s is already in a raid.", player_to_invite->GetName());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// Not allowed: Invite a bot that is in a group that is already a member
|
||||||
if (player_to_invite_group && player_to_invite_group->IsGroupMember(this)) {
|
if (player_to_invite_group && player_to_invite_group->IsGroupMember(this)) {
|
||||||
MessageString(Chat::Red, ALREADY_IN_PARTY);
|
MessageString(Chat::Red, ALREADY_IN_PARTY);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// Not allowed: Invite a bot that is in a group but not the groupleader
|
||||||
if (player_to_invite_group && !player_to_invite_group->IsLeader(player_to_invite)) {
|
if (player_to_invite_group && !player_to_invite_group->IsLeader(player_to_invite)) {
|
||||||
Message(Chat::Red, "You can only invite an ungrouped player or group leader to join your raid.");
|
Message(Chat::Red, "You can only invite an ungrouped player or group leader to join your raid.");
|
||||||
break;
|
break;
|
||||||
@@ -11375,31 +11382,12 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app)
|
|||||||
MessageString(Chat::Red, ALREADY_IN_PARTY);
|
MessageString(Chat::Red, ALREADY_IN_PARTY);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// Not allowed: Invite a client that is in a group but not the groupleader
|
||||||
if (player_to_invite_group && !player_to_invite_group->IsLeader(player_to_invite)) {
|
if (player_to_invite_group && !player_to_invite_group->IsLeader(player_to_invite)) {
|
||||||
Message(Chat::Red, "You can only invite an ungrouped player or group leader to join your raid.");
|
Message(Chat::Red, "You can only invite an ungrouped player or group leader to join your raid.");
|
||||||
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;
|
||||||
@@ -11421,6 +11409,27 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
case RaidCommandAcceptInvite: {
|
case RaidCommandAcceptInvite: {
|
||||||
Client *player_accepting_invite = entity_list.GetClientByName(raid_command_packet->player_name);
|
Client *player_accepting_invite = entity_list.GetClientByName(raid_command_packet->player_name);
|
||||||
|
|
||||||
|
#ifdef BOTS
|
||||||
|
// If the accepting client is in a group with a Bot, send the invite to Bot:ProcessRaidInvite
|
||||||
|
// instead of remaining here.
|
||||||
|
Bot* b = nullptr;
|
||||||
|
Client* c = entity_list.GetClientByName(raid_command_packet->leader_name);
|
||||||
|
Group* g = c->GetGroup();
|
||||||
|
if (c->HasGroup() && g->IsLeader(c))
|
||||||
|
{
|
||||||
|
for (int x = 0; x < 6; x++)
|
||||||
|
{
|
||||||
|
if (g->members[x]->IsBot())
|
||||||
|
{
|
||||||
|
b = entity_list.GetBotByBotName(g->members[x]->GetName());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Bot::ProcessRaidInvite(b, player_accepting_invite);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (player_accepting_invite) {
|
if (player_accepting_invite) {
|
||||||
if (IsRaidGrouped()) {
|
if (IsRaidGrouped()) {
|
||||||
player_accepting_invite->MessageString(Chat::White, ALREADY_IN_RAID, GetName()); //group failed, must invite members not in raid...
|
player_accepting_invite->MessageString(Chat::White, ALREADY_IN_RAID, GetName()); //group failed, must invite members not in raid...
|
||||||
|
|||||||
Reference in New Issue
Block a user