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->PR = PoisonResist;
this->CR = ColdResist;
this->PhR = 0;
this->Corrup = CorruptionResist;
SetBotSpellID(BotSpellID);
this->size = BotSize;
this->pAggroRange = 0;
this->pAssistRange = 0;
}
void Bot::GenerateAppearance() {
@ -1374,8 +1378,8 @@ int32 Bot::GenerateBaseHitPoints()
// Calc Base Hit Points
int new_base_hp = 0;
uint32 lm = GetClassLevelFactor();
uint32 Post255;
uint32 NormalSTA = GetSTA();
int32 Post255;
int32 NormalSTA = GetSTA();
if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd))
{
@ -5914,6 +5918,11 @@ bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, SkillUseTypes att
}
}
//Make sure group still exists if it doesnt they were already updated in RemoveBotFromGroup
g = GetGroup();
if (!g)
break;
// update the client group
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct));
GroupJoin_Struct* gu = (GroupJoin_Struct*)outapp->pBuffer;
@ -10196,7 +10205,6 @@ int32 Bot::CalcMaxHP() {
bot_hp += GenerateBaseHitPoints() + itembonuses.HP;
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 += 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
if (group->GroupCount() < 3)
{
group->DisbandGroup();