Bots will no longer crash when disbanding on death or normal disbanding.. HP values on bots will no longer roll over when checking STAMINA

This commit is contained in:
Natedog2012 2015-05-28 11:24:17 -07:00
parent dbd615572c
commit 22ef16947c
2 changed files with 22 additions and 9 deletions

View File

@ -751,9 +751,13 @@ void Bot::GenerateBaseStats() {
this->DR = DiseaseResist; this->DR = DiseaseResist;
this->PR = PoisonResist; this->PR = PoisonResist;
this->CR = ColdResist; this->CR = ColdResist;
this->PhR = 0;
this->Corrup = CorruptionResist; this->Corrup = CorruptionResist;
SetBotSpellID(BotSpellID); SetBotSpellID(BotSpellID);
this->size = BotSize; this->size = BotSize;
this->pAggroRange = 0;
this->pAssistRange = 0;
} }
void Bot::GenerateAppearance() { void Bot::GenerateAppearance() {
@ -1374,20 +1378,20 @@ int32 Bot::GenerateBaseHitPoints()
// Calc Base Hit Points // Calc Base Hit Points
int new_base_hp = 0; int new_base_hp = 0;
uint32 lm = GetClassLevelFactor(); uint32 lm = GetClassLevelFactor();
uint32 Post255; int32 Post255;
uint32 NormalSTA = GetSTA(); int32 NormalSTA = GetSTA();
if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd))
{ {
float SoDPost255; float SoDPost255;
if(((NormalSTA - 255) / 2) > 0) if(((NormalSTA - 255) / 2) > 0)
SoDPost255 = ((NormalSTA - 255) / 2); SoDPost255 = ((NormalSTA - 255) / 2);
else else
SoDPost255 = 0; SoDPost255 = 0;
int hp_factor = GetClassHPFactor(); int hp_factor = GetClassHPFactor();
if(level < 41) if(level < 41)
{ {
new_base_hp = (5 + (GetLevel() * hp_factor / 12) + ((NormalSTA - SoDPost255) * GetLevel() * hp_factor / 3600)); new_base_hp = (5 + (GetLevel() * hp_factor / 12) + ((NormalSTA - SoDPost255) * GetLevel() * hp_factor / 3600));
@ -1415,7 +1419,7 @@ int32 Bot::GenerateBaseHitPoints()
new_base_hp = (5)+(GetLevel()*lm/10) + (((NormalSTA-Post255)*GetLevel()*lm/3000)) + ((Post255*1)*lm/6000); new_base_hp = (5)+(GetLevel()*lm/10) + (((NormalSTA-Post255)*GetLevel()*lm/3000)) + ((Post255*1)*lm/6000);
} }
this->base_hp = new_base_hp; this->base_hp = new_base_hp;
return new_base_hp; return new_base_hp;
} }
@ -5913,7 +5917,12 @@ bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, SkillUseTypes att
g->members[j] = nullptr; g->members[j] = nullptr;
} }
} }
//Make sure group still exists if it doesnt they were already updated in RemoveBotFromGroup
g = GetGroup();
if (!g)
break;
// update the client group // update the client group
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct));
GroupJoin_Struct* gu = (GroupJoin_Struct*)outapp->pBuffer; GroupJoin_Struct* gu = (GroupJoin_Struct*)outapp->pBuffer;
@ -10196,7 +10205,6 @@ int32 Bot::CalcMaxHP() {
bot_hp += GenerateBaseHitPoints() + itembonuses.HP; bot_hp += GenerateBaseHitPoints() + itembonuses.HP;
nd += aabonuses.MaxHP; //Natural Durability, Physical Enhancement, Planar Durability nd += aabonuses.MaxHP; //Natural Durability, Physical Enhancement, Planar Durability
bot_hp = (float)bot_hp * (float)nd / (float)10000; //this is to fix the HP-above-495k issue bot_hp = (float)bot_hp * (float)nd / (float)10000; //this is to fix the HP-above-495k issue
bot_hp += spellbonuses.HP + aabonuses.HP; bot_hp += spellbonuses.HP + aabonuses.HP;

View File

@ -6362,7 +6362,12 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app)
} }
} }
} }
group = GetGroup();
if (!group) //We must recheck this here.. incase the final bot disbanded the party..otherwise we crash
return;
#endif #endif
if (group->GroupCount() < 3) if (group->GroupCount() < 3)
{ {
group->DisbandGroup(); group->DisbandGroup();