mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 04:56:20 +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);
|
this->SendWearChange(materialFromSlot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Raid* raid = entity_list.GetRaidByBotName(this->GetName());
|
||||||
|
|
||||||
|
if (raid)
|
||||||
|
{
|
||||||
|
raid->VerifyRaid();
|
||||||
|
this->SetRaidGrouped(true);
|
||||||
|
}
|
||||||
return 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()) {
|
if ((GetPullingFlag() || GetReturningFlag()) && my_owner && my_owner->IsClient()) {
|
||||||
my_owner->CastToClient()->SetBotPulling(false);
|
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());
|
entity_list.RemoveBot(this->GetID());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -9294,8 +9315,10 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Group* g = caster->GetGroup();
|
Group* g = caster->GetGroup();
|
||||||
|
uint32 gid = 0xff;
|
||||||
Raid* raid = entity_list.GetRaidByBotName(caster->GetName());
|
Raid* raid = entity_list.GetRaidByBotName(caster->GetName());
|
||||||
uint32 gid = raid->GetGroup(caster->GetName());
|
if (raid)
|
||||||
|
uint32 gid = raid->GetGroup(caster->GetName());
|
||||||
|
|
||||||
if(g) {
|
if(g) {
|
||||||
for(int i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
for(int i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "../common/global_define.h"
|
#include "../common/global_define.h"
|
||||||
#include "guild_mgr.h"
|
#include "guild_mgr.h"
|
||||||
#include "worldserver.h"
|
#include "worldserver.h"
|
||||||
|
#include "raids.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
|||||||
+11
-17
@@ -19,7 +19,6 @@
|
|||||||
#ifdef BOTS
|
#ifdef BOTS
|
||||||
|
|
||||||
#include "bot.h"
|
#include "bot.h"
|
||||||
#include "bot_raid.h"
|
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "raids.h"
|
#include "raids.h"
|
||||||
#include "doors.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)
|
// We also need a leash owner and follow mob (subset of primary AI criteria)
|
||||||
Client* leash_owner = nullptr;
|
Client* leash_owner = nullptr;
|
||||||
if (r_group < 12) {
|
if (r_group < 12 && !leash_owner) {
|
||||||
leash_owner = raid->GetGroupLeader(r_group);
|
leash_owner = raid->GetGroupLeader(r_group);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -314,8 +313,6 @@ void Bot::AI_Process_Raid()
|
|||||||
std::vector<RaidMember> raid_group_members = raid->GetRaidGroupMembers(r_group);
|
std::vector<RaidMember> raid_group_members = raid->GetRaidGroupMembers(r_group);
|
||||||
for (RaidMember iter : raid_group_members) {
|
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];
|
Mob* bg_member = iter.member;// bot_group->members[counter];
|
||||||
if (!bg_member) {
|
if (!bg_member) {
|
||||||
continue;
|
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
|
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
|
// Raid Group roles can be expounded upon in the future
|
||||||
Group* bot_group = this->GetGroup(); //Mitch
|
//r_group is the uint32 group id
|
||||||
auto assist_mob = entity_list.GetMob(bot_group->GetMainAssistName());
|
auto assist_mob = raid->GetRaidMainAssistOneByName(this->GetName());
|
||||||
bool find_target = true;
|
bool find_target = true;
|
||||||
|
|
||||||
if (assist_mob) {
|
if (assist_mob) {
|
||||||
@@ -1540,6 +1537,7 @@ bool Bot::AICastSpell_Raid(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
|||||||
// Bot AI Raid
|
// Bot AI Raid
|
||||||
|
|
||||||
Raid* raid = entity_list.GetRaidByBotName(this->GetName());
|
Raid* raid = entity_list.GetRaidByBotName(this->GetName());
|
||||||
|
uint32 r_group = raid->GetGroup(GetName());
|
||||||
if (!raid)
|
if (!raid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -2424,7 +2422,7 @@ bool Bot::AICastSpell_Raid(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SpellType_Cure: {
|
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);
|
botSpell = GetBestBotSpellForCure(this, tar);
|
||||||
|
|
||||||
@@ -2438,16 +2436,12 @@ bool Bot::AICastSpell_Raid(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
|||||||
if (castedSpell) {
|
if (castedSpell) {
|
||||||
if (botClass != BARD) {
|
if (botClass != BARD) {
|
||||||
if (IsGroupSpell(botSpell.SpellId)) {
|
if (IsGroupSpell(botSpell.SpellId)) {
|
||||||
Group* g;
|
if (this->IsRaidGrouped()) {
|
||||||
|
if (r_group) {
|
||||||
if (this->HasGroup()) {
|
for (RaidMember iter : raid->GetRaidGroupMembers(r_group)) {
|
||||||
Group* g = this->GetGroup();
|
if (iter.member && !iter.member->qglobal) {
|
||||||
|
|
||||||
if (g) {
|
|
||||||
for (int i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
|
||||||
if (g->members[i] && !g->members[i]->qglobal) {
|
|
||||||
if (TempDontCureMeBeforeTime != tar->DontCureMeBefore())
|
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
|
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
|
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,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
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
|
// todo: save packets for later use
|
||||||
AddPacket(app, ack_req);
|
AddPacket(app, ack_req);
|
||||||
}
|
}
|
||||||
else
|
else if (eqs && !IsBot()) //Mitch added the BoTcheck for a fail safe on trying to send a packet to a BoT!
|
||||||
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);
|
eqs->QueuePacket(app, ack_req);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::FastQueuePacket(EQApplicationPacket** app, bool ack_req, CLIENT_CONN_STATUS required_state) {
|
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);
|
mob->CreateHPPacket(&hpapp);
|
||||||
|
|
||||||
for(int x = 0; x < MAX_RAID_MEMBERS; x++) {
|
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))) {
|
if(!mob->IsClient() || ((members[x].member != mob->CastToClient()) && (members[x].GroupNumber == group_id))) {
|
||||||
members[x].member->QueuePacket(&hpapp, false);
|
members[x].member->QueuePacket(&hpapp, false);
|
||||||
if (members[x].member->IsClient() && members[x].member->ClientVersion() >= EQ::versions::ClientVersion::SoD) { //Mitch
|
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);
|
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
|
#ifdef BOTS
|
||||||
void AddBot(Bot* b, uint32 group = 0xFFFFFFFF, bool rleader=false, bool groupleader=false, bool looter=false); //Mitch
|
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
|
void RaidBotGroupSay(Bot* b, uint8 language, uint8 lang_skill, const char* msg, ...); //Mitch
|
||||||
|
static Mob* GetRaidMainAssistOneByName(const char* name);
|
||||||
#endif
|
#endif
|
||||||
void RemoveMember(const char *c);
|
void RemoveMember(const char *c);
|
||||||
void DisbandRaid();
|
void DisbandRaid();
|
||||||
|
|||||||
Reference in New Issue
Block a user