mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 11:48:37 +00:00
Bot Death fixed and few other crashes
This commit is contained in:
+25
-2
@@ -4049,7 +4049,13 @@ bool Bot::Spawn(Client* botCharacterOwner) {
|
||||
this->SendWearChange(materialFromSlot);
|
||||
}
|
||||
}
|
||||
Raid* raid = entity_list.GetRaidByBotName(this->GetName());
|
||||
|
||||
if (raid)
|
||||
{
|
||||
raid->VerifyRaid();
|
||||
this->SetRaidGrouped(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5028,8 +5034,23 @@ bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, EQ::skills::Skill
|
||||
if ((GetPullingFlag() || GetReturningFlag()) && my_owner && my_owner->IsClient()) {
|
||||
my_owner->CastToClient()->SetBotPulling(false);
|
||||
}
|
||||
if (!this->IsRaidGrouped())
|
||||
|
||||
Raid* raid = entity_list.GetRaidByBotName(this->GetName());
|
||||
uint32 gid = raid->GetGroup(this->GetName());
|
||||
if (raid)
|
||||
{
|
||||
for (int x = 0; x < MAX_RAID_MEMBERS; x++)
|
||||
{
|
||||
if (strcmp(raid->members[x].membername, this->GetName()) == 0)
|
||||
{
|
||||
raid->members[x].member = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entity_list.RemoveBot(this->GetID());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -9294,8 +9315,10 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl
|
||||
break;
|
||||
}
|
||||
Group* g = caster->GetGroup();
|
||||
uint32 gid = 0xff;
|
||||
Raid* raid = entity_list.GetRaidByBotName(caster->GetName());
|
||||
uint32 gid = raid->GetGroup(caster->GetName());
|
||||
if (raid)
|
||||
uint32 gid = raid->GetGroup(caster->GetName());
|
||||
|
||||
if(g) {
|
||||
for(int i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "../common/global_define.h"
|
||||
#include "guild_mgr.h"
|
||||
#include "worldserver.h"
|
||||
#include "raids.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
+12
-18
@@ -19,7 +19,6 @@
|
||||
#ifdef BOTS
|
||||
|
||||
#include "bot.h"
|
||||
#include "bot_raid.h"
|
||||
#include "object.h"
|
||||
#include "raids.h"
|
||||
#include "doors.h"
|
||||
@@ -75,7 +74,7 @@ void Bot::AI_Process_Raid()
|
||||
|
||||
// We also need a leash owner and follow mob (subset of primary AI criteria)
|
||||
Client* leash_owner = nullptr;
|
||||
if (r_group < 12) {
|
||||
if (r_group < 12 && !leash_owner) {
|
||||
leash_owner = raid->GetGroupLeader(r_group);
|
||||
}
|
||||
else {
|
||||
@@ -313,9 +312,7 @@ void Bot::AI_Process_Raid()
|
||||
|
||||
std::vector<RaidMember> raid_group_members = raid->GetRaidGroupMembers(r_group);
|
||||
for (RaidMember iter : raid_group_members) {
|
||||
|
||||
// for (int counter = 0; counter < raid->GroupCount(r_group); counter++) {
|
||||
// Group* bot_group = this->GetGroup();
|
||||
|
||||
Mob* bg_member = iter.member;// bot_group->members[counter];
|
||||
if (!bg_member) {
|
||||
continue;
|
||||
@@ -422,9 +419,9 @@ void Bot::AI_Process_Raid()
|
||||
|
||||
else if (bo_alt_combat && m_alt_combat_hate_timer.Check()) { // Find a mob from hate list to target
|
||||
|
||||
// Group roles can be expounded upon in the future
|
||||
Group* bot_group = this->GetGroup(); //Mitch
|
||||
auto assist_mob = entity_list.GetMob(bot_group->GetMainAssistName());
|
||||
// Raid Group roles can be expounded upon in the future
|
||||
//r_group is the uint32 group id
|
||||
auto assist_mob = raid->GetRaidMainAssistOneByName(this->GetName());
|
||||
bool find_target = true;
|
||||
|
||||
if (assist_mob) {
|
||||
@@ -1540,6 +1537,7 @@ bool Bot::AICastSpell_Raid(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
||||
// Bot AI Raid
|
||||
|
||||
Raid* raid = entity_list.GetRaidByBotName(this->GetName());
|
||||
uint32 r_group = raid->GetGroup(GetName());
|
||||
if (!raid)
|
||||
return false;
|
||||
|
||||
@@ -2424,7 +2422,7 @@ bool Bot::AICastSpell_Raid(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
||||
break;
|
||||
}
|
||||
case SpellType_Cure: {
|
||||
if (GetNeedsCured(tar) && (tar->DontCureMeBefore() < Timer::GetCurrentTime()) && !(GetNumberNeedingHealedInGroup(25, false) > 0) && !(GetNumberNeedingHealedInGroup(40, false) > 2))
|
||||
if (GetNeedsCured(tar) && (tar->DontCureMeBefore() < Timer::GetCurrentTime()) && !(GetNumberNeedingHealedInRaidGroup(25, false) > 0) && !(GetNumberNeedingHealedInRaidGroup(40, false) > 2))
|
||||
{
|
||||
botSpell = GetBestBotSpellForCure(this, tar);
|
||||
|
||||
@@ -2438,16 +2436,12 @@ bool Bot::AICastSpell_Raid(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
||||
if (castedSpell) {
|
||||
if (botClass != BARD) {
|
||||
if (IsGroupSpell(botSpell.SpellId)) {
|
||||
Group* g;
|
||||
|
||||
if (this->HasGroup()) {
|
||||
Group* g = this->GetGroup();
|
||||
|
||||
if (g) {
|
||||
for (int i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
||||
if (g->members[i] && !g->members[i]->qglobal) {
|
||||
if (this->IsRaidGrouped()) {
|
||||
if (r_group) {
|
||||
for (RaidMember iter : raid->GetRaidGroupMembers(r_group)) {
|
||||
if (iter.member && !iter.member->qglobal) {
|
||||
if (TempDontCureMeBeforeTime != tar->DontCureMeBefore())
|
||||
g->members[i]->SetDontCureMeBefore(Timer::GetCurrentTime() + 4000);
|
||||
iter.member->SetDontCureMeBefore(Timer::GetCurrentTime() + 4000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
the Free Software Foundation; version 2 ogroupf the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
|
||||
+4
-3
@@ -812,9 +812,10 @@ void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req, CLIENT_CO
|
||||
// todo: save packets for later use
|
||||
AddPacket(app, ack_req);
|
||||
}
|
||||
else
|
||||
if(eqs && !IsBot()) //Mitch added the BoTcheck for a fail safe on trying to send a packet to a BoT!
|
||||
eqs->QueuePacket(app, ack_req);
|
||||
else if (eqs && !IsBot()) //Mitch added the BoTcheck for a fail safe on trying to send a packet to a BoT!
|
||||
{
|
||||
eqs->QueuePacket(app, ack_req);
|
||||
}
|
||||
}
|
||||
|
||||
void Client::FastQueuePacket(EQApplicationPacket** app, bool ack_req, CLIENT_CONN_STATUS required_state) {
|
||||
|
||||
+12
-1
@@ -1738,7 +1738,7 @@ void Raid::SendHPManaEndPacketsFrom(Mob *mob)
|
||||
mob->CreateHPPacket(&hpapp);
|
||||
|
||||
for(int x = 0; x < MAX_RAID_MEMBERS; x++) {
|
||||
if(members[x].member && members[x].membername) {
|
||||
if(members[x].member) {
|
||||
if(!mob->IsClient() || ((members[x].member != mob->CastToClient()) && (members[x].GroupNumber == group_id))) {
|
||||
members[x].member->QueuePacket(&hpapp, false);
|
||||
if (members[x].member->IsClient() && members[x].member->ClientVersion() >= EQ::versions::ClientVersion::SoD) { //Mitch
|
||||
@@ -1988,3 +1988,14 @@ bool Raid::DoesAnyMemberHaveExpeditionLockout(
|
||||
return Expedition::HasLockoutByCharacterName(raid_member.membername, expedition_name, event_name);
|
||||
});
|
||||
}
|
||||
Mob* Raid::GetRaidMainAssistOneByName(const char* name)
|
||||
{
|
||||
Raid* raid = entity_list.GetRaidByBotName(name);
|
||||
std::vector<RaidMember> raid_members = raid->GetMembers();
|
||||
|
||||
for (RaidMember& iter : raid_members)
|
||||
{
|
||||
if (iter.IsRaidMainAssistOne)
|
||||
return iter.member->CastToMob();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +124,7 @@ public:
|
||||
#ifdef BOTS
|
||||
void AddBot(Bot* b, uint32 group = 0xFFFFFFFF, bool rleader=false, bool groupleader=false, bool looter=false); //Mitch
|
||||
void RaidBotGroupSay(Bot* b, uint8 language, uint8 lang_skill, const char* msg, ...); //Mitch
|
||||
static Mob* GetRaidMainAssistOneByName(const char* name);
|
||||
#endif
|
||||
void RemoveMember(const char *c);
|
||||
void DisbandRaid();
|
||||
|
||||
Reference in New Issue
Block a user