mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 13:16:39 +00:00
Issue with Bot Death in raid when casted upon. 1741 raid.cpp
This commit is contained in:
+117
-6
@@ -5028,8 +5028,9 @@ 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())
|
||||||
|
entity_list.RemoveBot(this->GetID());
|
||||||
|
|
||||||
entity_list.RemoveBot(this->GetID());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8403,8 +8404,11 @@ void Bot::Camp(bool databaseSave) {
|
|||||||
|
|
||||||
//Mitch
|
//Mitch
|
||||||
Raid* bot_raid = entity_list.GetRaidByBotName(this->GetName());
|
Raid* bot_raid = entity_list.GetRaidByBotName(this->GetName());
|
||||||
if (bot_raid)
|
if (bot_raid) {
|
||||||
|
bot_raid->SendRaidGroupRemove(this->GetName(), bot_raid->GetGroup(this->GetName()));
|
||||||
bot_raid->RemoveMember(this->GetName());
|
bot_raid->RemoveMember(this->GetName());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// RemoveBotFromGroup() code is too complicated for this to work as-is (still needs to be addressed to prevent memory leaks)
|
// RemoveBotFromGroup() code is too complicated for this to work as-is (still needs to be addressed to prevent memory leaks)
|
||||||
//if (group->GroupCount() < 2)
|
//if (group->GroupCount() < 2)
|
||||||
@@ -9230,11 +9234,49 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef BOTS
|
||||||
|
else if (caster->IsRaidGrouped())
|
||||||
|
{
|
||||||
|
//added raid check
|
||||||
|
Raid* raid = entity_list.GetRaidByBotName(caster->GetName());
|
||||||
|
uint32 g = raid->GetGroup(caster->GetName());
|
||||||
|
if (g < 12) {
|
||||||
|
for (RaidMember& iter : raid->GetRaidGroupMembers(g)) {
|
||||||
|
if (iter.member && !iter.member->qglobal) {
|
||||||
|
if (iter.member->IsClient() && iter.member->GetHPRatio() < 90) {
|
||||||
|
if (caster->AICastSpell(iter.member, 100, SpellType_Heal))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if ((iter.member->GetClass() == WARRIOR || iter.member->GetClass() == PALADIN || iter.member->GetClass() == SHADOWKNIGHT) && iter.member->GetHPRatio() < 95) {
|
||||||
|
if (caster->AICastSpell(iter.member, 100, SpellType_Heal))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (iter.member->GetClass() == ENCHANTER && iter.member->GetHPRatio() < 80) {
|
||||||
|
if (caster->AICastSpell(iter.member, 100, SpellType_Heal))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (iter.member->GetHPRatio() < 70) {
|
||||||
|
if (caster->AICastSpell(iter.member, 100, SpellType_Heal))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iter.member && !iter.member->qglobal && iter.member->HasPet() && iter.member->GetPet()->GetHPRatio() < 50) {
|
||||||
|
if (iter.member->GetPet()->GetOwner() != caster && caster->IsEngaged() && iter.member->IsCasting() && iter.member->GetClass() != ENCHANTER)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (caster->AICastSpell(iter.member->GetPet(), 100, SpellType_Heal))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if( botCasterClass == PALADIN || botCasterClass == BEASTLORD || botCasterClass == RANGER) {
|
if( botCasterClass == PALADIN || botCasterClass == BEASTLORD || botCasterClass == RANGER) {
|
||||||
if(caster->HasGroup()) {
|
if(caster->HasGroup() || caster->IsRaidGrouped()) {
|
||||||
Group *g = caster->GetGroup();
|
|
||||||
float hpRatioToHeal = 25.0f;
|
float hpRatioToHeal = 25.0f;
|
||||||
switch(caster->GetBotStance()) {
|
switch(caster->GetBotStance()) {
|
||||||
case EQ::constants::stanceReactive:
|
case EQ::constants::stanceReactive:
|
||||||
@@ -9251,6 +9293,9 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl
|
|||||||
hpRatioToHeal = 25.0f;
|
hpRatioToHeal = 25.0f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Group* g = caster->GetGroup();
|
||||||
|
Raid* raid = entity_list.GetRaidByBotName(caster->GetName());
|
||||||
|
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++) {
|
||||||
@@ -9279,6 +9324,37 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (gid < 12)
|
||||||
|
{
|
||||||
|
for (RaidMember& iter : raid->GetRaidGroupMembers(gid)) {
|
||||||
|
if (iter.member && !iter.member->qglobal) {
|
||||||
|
if (iter.member->IsClient() && iter.member->GetHPRatio() < hpRatioToHeal) {
|
||||||
|
if (caster->AICastSpell(iter.member, 100, SpellType_Heal))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if ((iter.member->GetClass() == WARRIOR || iter.member->GetClass() == PALADIN || iter.member->GetClass() == SHADOWKNIGHT) && iter.member->GetHPRatio() < hpRatioToHeal) {
|
||||||
|
if (caster->AICastSpell(iter.member, 100, SpellType_Heal))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (iter.member->GetClass() == ENCHANTER && iter.member->GetHPRatio() < hpRatioToHeal) {
|
||||||
|
if (caster->AICastSpell(iter.member, 100, SpellType_Heal))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (iter.member->GetHPRatio() < hpRatioToHeal / 2) {
|
||||||
|
if (caster->AICastSpell(iter.member, 100, SpellType_Heal))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iter.member && !iter.member->qglobal && iter.member->HasPet() && iter.member->GetPet()->GetHPRatio() < 25) {
|
||||||
|
if (iter.member->GetPet()->GetOwner() != caster && caster->IsEngaged() && iter.member->IsCasting() && iter.member->GetClass() != ENCHANTER)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (caster->AICastSpell(iter.member->GetPet(), 100, SpellType_Heal))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9291,6 +9367,7 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl
|
|||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#ifdef BOTS
|
||||||
//added raid check
|
//added raid check
|
||||||
if (caster->IsRaidGrouped()) {
|
if (caster->IsRaidGrouped()) {
|
||||||
Raid* raid = entity_list.GetRaidByBotName(caster->GetName());
|
Raid* raid = entity_list.GetRaidByBotName(caster->GetName());
|
||||||
@@ -9304,6 +9381,7 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if(caster->HasGroup()) {
|
if(caster->HasGroup()) {
|
||||||
Group *g = caster->GetGroup();
|
Group *g = caster->GetGroup();
|
||||||
if(g) {
|
if(g) {
|
||||||
@@ -9336,6 +9414,26 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (caster->IsRaidGrouped())
|
||||||
|
{
|
||||||
|
Raid* raid = entity_list.GetRaidByBotName(caster->GetName());
|
||||||
|
uint32 gid = raid->GetGroup(caster->GetName());
|
||||||
|
if (gid < 12) {
|
||||||
|
for (RaidMember& iter : raid->GetRaidGroupMembers(gid)) {
|
||||||
|
if (iter.member && caster->GetNeedsCured(iter.member)) {
|
||||||
|
if (caster->AICastSpell(iter.member, caster->GetChanceToCastBySpellType(SpellType_Cure), SpellType_Cure))
|
||||||
|
return true;
|
||||||
|
else if (botCasterClass == BARD)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iter.member && iter.member->GetPet() && caster->GetNeedsCured(iter.member->GetPet())) {
|
||||||
|
if (caster->AICastSpell(iter.member->GetPet(), (int)caster->GetChanceToCastBySpellType(SpellType_Cure) / 4, SpellType_Cure))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iSpellTypes == SpellType_HateRedux) {
|
if (iSpellTypes == SpellType_HateRedux) {
|
||||||
@@ -9353,6 +9451,20 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (caster->IsRaidGrouped())
|
||||||
|
{
|
||||||
|
Raid* raid = entity_list.GetRaidByBotName(caster->GetName());
|
||||||
|
uint32 gid = raid->GetGroup(caster->GetName());
|
||||||
|
if (gid < 12) {
|
||||||
|
for (RaidMember& iter : raid->GetRaidGroupMembers(gid)) {
|
||||||
|
if (iter.member && caster->GetNeedsHateRedux(iter.member)) {
|
||||||
|
if (caster->AICastSpell(iter.member, caster->GetChanceToCastBySpellType(SpellType_HateRedux), SpellType_HateRedux))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iSpellTypes == SpellType_PreCombatBuff) {
|
if (iSpellTypes == SpellType_PreCombatBuff) {
|
||||||
@@ -9371,8 +9483,7 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (caster->HasGroup()) {
|
||||||
if (caster->HasGroup()) {
|
|
||||||
Group *g = caster->GetGroup();
|
Group *g = caster->GetGroup();
|
||||||
if (g) {
|
if (g) {
|
||||||
for (int i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
for (int i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
||||||
|
|||||||
+1
-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) {
|
if(members[x].member && members[x].membername) {
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user