mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-16 05:11:29 +00:00
Merge pull request #606 from spdkils/master
** Fix for groups with multiple players and bots.
This commit is contained in:
commit
15f8683530
17
zone/bot.cpp
17
zone/bot.cpp
@ -2995,7 +2995,8 @@ void Bot::LoadAndSpawnAllZonedBots(Client* botOwner) {
|
|||||||
if(g) {
|
if(g) {
|
||||||
uint32 TempGroupId = g->GetID();
|
uint32 TempGroupId = g->GetID();
|
||||||
std::list<uint32> ActiveBots;
|
std::list<uint32> ActiveBots;
|
||||||
if (!botdb.LoadGroupedBotsByGroupID(TempGroupId, ActiveBots)) {
|
// Modified LoadGroupedBotsByGroupID to require a CharacterID
|
||||||
|
if (!botdb.LoadGroupedBotsByGroupID(botOwner->CharacterID(), TempGroupId, ActiveBots)) {
|
||||||
botOwner->Message(13, "%s", BotDatabase::fail::LoadGroupedBotsByGroupID());
|
botOwner->Message(13, "%s", BotDatabase::fail::LoadGroupedBotsByGroupID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3007,8 +3008,9 @@ void Bot::LoadAndSpawnAllZonedBots(Client* botOwner) {
|
|||||||
if(activeBot) {
|
if(activeBot) {
|
||||||
activeBot->Spawn(botOwner);
|
activeBot->Spawn(botOwner);
|
||||||
g->UpdatePlayer(activeBot);
|
g->UpdatePlayer(activeBot);
|
||||||
if(g->GetLeader())
|
// follow the bot owner, not the group leader we just zoned with our owner.
|
||||||
activeBot->SetFollowID(g->GetLeader()->GetID());
|
if(g->IsGroupMember(botOwner) && g->IsGroupMember(activeBot))
|
||||||
|
activeBot->SetFollowID(botOwner->GetID());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(activeBot && !botOwner->HasGroup())
|
if(activeBot && !botOwner->HasGroup())
|
||||||
@ -7297,10 +7299,11 @@ void Bot::ProcessClientZoneChange(Client* botOwner) {
|
|||||||
if(tempBot) {
|
if(tempBot) {
|
||||||
if(tempBot->HasGroup()) {
|
if(tempBot->HasGroup()) {
|
||||||
Group* g = tempBot->GetGroup();
|
Group* g = tempBot->GetGroup();
|
||||||
if(g && g->GetLeader()) {
|
if(g && g->IsGroupMember(botOwner)) {
|
||||||
Mob* tempGroupLeader = tempBot->GetGroup()->GetLeader();
|
if(botOwner && botOwner->IsClient()) {
|
||||||
if(tempGroupLeader && tempGroupLeader->IsClient()) {
|
// Modified to not only zone bots if you're the leader.
|
||||||
if(tempBot->GetBotOwnerCharacterID() == tempGroupLeader->CastToClient()->CharacterID())
|
// Also zone bots of the non-leader when they change zone.
|
||||||
|
if(tempBot->GetBotOwnerCharacterID() == botOwner->CharacterID() && g->IsGroupMember(botOwner))
|
||||||
tempBot->Zone();
|
tempBot->Zone();
|
||||||
else
|
else
|
||||||
tempBot->Camp();
|
tempBot->Camp();
|
||||||
|
|||||||
@ -2459,9 +2459,10 @@ bool BotDatabase::LoadBotGroupsListByOwnerID(const uint32 owner_id, std::list<st
|
|||||||
|
|
||||||
|
|
||||||
/* Bot owner group functions */
|
/* Bot owner group functions */
|
||||||
bool BotDatabase::LoadGroupedBotsByGroupID(const uint32 group_id, std::list<uint32>& group_list)
|
// added owner ID to this function to fix groups with mulitple players grouped with bots.
|
||||||
|
bool BotDatabase::LoadGroupedBotsByGroupID(const uint32 owner_id, const uint32 group_id, std::list<uint32>& group_list)
|
||||||
{
|
{
|
||||||
if (!group_id)
|
if (!group_id || !owner_id)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat(
|
query = StringFormat(
|
||||||
@ -2471,18 +2472,10 @@ bool BotDatabase::LoadGroupedBotsByGroupID(const uint32 group_id, std::list<uint
|
|||||||
" AND `charid` IN ("
|
" AND `charid` IN ("
|
||||||
" SELECT `bot_id`"
|
" SELECT `bot_id`"
|
||||||
" FROM `bot_data`"
|
" FROM `bot_data`"
|
||||||
" WHERE `owner_id` IN ("
|
" WHERE `owner_id` = '%u'"
|
||||||
" SELECT `charid`"
|
|
||||||
" FROM `group_id`"
|
|
||||||
" WHERE `groupid` = '%u'"
|
|
||||||
" AND `name` IN ("
|
|
||||||
" SELECT `name`"
|
|
||||||
" FROM `character_data`"
|
|
||||||
" )"
|
|
||||||
" )"
|
|
||||||
" )",
|
" )",
|
||||||
group_id,
|
group_id,
|
||||||
group_id
|
owner_id
|
||||||
);
|
);
|
||||||
|
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
|
|||||||
@ -169,7 +169,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
/* Bot group functions */
|
/* Bot group functions */
|
||||||
bool LoadGroupedBotsByGroupID(const uint32 group_id, std::list<uint32>& group_list);
|
bool LoadGroupedBotsByGroupID(const uint32 owner_id, const uint32 group_id, std::list<uint32>& group_list);
|
||||||
|
|
||||||
|
|
||||||
/* Bot heal rotation functions */
|
/* Bot heal rotation functions */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user