mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-29 08:38:20 +00:00
[Crash] Add Checks for valid pointers or fix existing. (#3164)
This commit is contained in:
+20
-7
@@ -1888,11 +1888,15 @@ bool Bot::AIHealRotation(Mob* tar, bool useFastHeals) {
|
||||
std::list<BotSpell> Bot::GetBotSpellsForSpellEffect(Bot* botCaster, int spellEffect) {
|
||||
std::list<BotSpell> result;
|
||||
|
||||
if (!botCaster) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (auto bot_owner = botCaster->GetBotOwner(); !bot_owner) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (botCaster && botCaster->AI_HasSpells()) {
|
||||
if (botCaster->AI_HasSpells()) {
|
||||
std::vector<BotSpells_Struct> botSpellList = botCaster->AIBot_spells;
|
||||
|
||||
for (int i = botSpellList.size() - 1; i >= 0; i--) {
|
||||
@@ -1919,11 +1923,15 @@ std::list<BotSpell> Bot::GetBotSpellsForSpellEffect(Bot* botCaster, int spellEff
|
||||
std::list<BotSpell> Bot::GetBotSpellsForSpellEffectAndTargetType(Bot* botCaster, int spellEffect, SpellTargetType targetType) {
|
||||
std::list<BotSpell> result;
|
||||
|
||||
if (!botCaster) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (auto bot_owner = botCaster->GetBotOwner(); !bot_owner) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (botCaster && botCaster->AI_HasSpells()) {
|
||||
if (botCaster->AI_HasSpells()) {
|
||||
std::vector<BotSpells_Struct> botSpellList = botCaster->AIBot_spells;
|
||||
|
||||
for (int i = botSpellList.size() - 1; i >= 0; i--) {
|
||||
@@ -1955,11 +1963,15 @@ std::list<BotSpell> Bot::GetBotSpellsForSpellEffectAndTargetType(Bot* botCaster,
|
||||
std::list<BotSpell> Bot::GetBotSpellsBySpellType(Bot* botCaster, uint32 spellType) {
|
||||
std::list<BotSpell> result;
|
||||
|
||||
if (!botCaster) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (auto bot_owner = botCaster->GetBotOwner(); !bot_owner) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (botCaster && botCaster->AI_HasSpells()) {
|
||||
if (botCaster->AI_HasSpells()) {
|
||||
std::vector<BotSpells_Struct> botSpellList = botCaster->AIBot_spells;
|
||||
|
||||
for (int i = botSpellList.size() - 1; i >= 0; i--) {
|
||||
@@ -2694,21 +2706,22 @@ BotSpell Bot::GetBestBotSpellForResistDebuff(Bot* botCaster, Mob *tar) {
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
|
||||
if (!tar)
|
||||
if (!tar || !botCaster) {
|
||||
return result;
|
||||
}
|
||||
|
||||
int level_mod = (tar->GetLevel() - botCaster->GetLevel())* (tar->GetLevel() - botCaster->GetLevel()) / 2;
|
||||
if (tar->GetLevel() - botCaster->GetLevel() < 0)
|
||||
{
|
||||
if (tar->GetLevel() - botCaster->GetLevel() < 0) {
|
||||
level_mod = -level_mod;
|
||||
}
|
||||
|
||||
bool needsMagicResistDebuff = (tar->GetMR() + level_mod) > 100;
|
||||
bool needsColdResistDebuff = (tar->GetCR() + level_mod) > 100;
|
||||
bool needsFireResistDebuff = (tar->GetFR() + level_mod) > 100;
|
||||
bool needsPoisonResistDebuff = (tar->GetPR() + level_mod) > 100;
|
||||
bool needsDiseaseResistDebuff = (tar->GetDR() + level_mod) > 100;
|
||||
|
||||
if (botCaster && botCaster->AI_HasSpells()) {
|
||||
if (botCaster->AI_HasSpells()) {
|
||||
std::vector<BotSpells_Struct> botSpellList = botCaster->AIBot_spells;
|
||||
|
||||
for (int i = botSpellList.size() - 1; i >= 0; i--) {
|
||||
|
||||
Reference in New Issue
Block a user