mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[Bug Fix] Fix Bots/Bot Pets ending up on XTargets (#4132)
* [XTargets] * Update eqemu_logsys.h * Update client.cpp * Update table column * Undo unnecessary commit
This commit is contained in:
parent
398ecbc8cf
commit
1aa3a4b11a
@ -141,6 +141,7 @@ namespace Logs {
|
|||||||
Zoning,
|
Zoning,
|
||||||
EqTime,
|
EqTime,
|
||||||
Corpses,
|
Corpses,
|
||||||
|
XTargets,
|
||||||
MaxCategoryID /* Don't Remove this */
|
MaxCategoryID /* Don't Remove this */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -241,6 +242,7 @@ namespace Logs {
|
|||||||
"Zoning",
|
"Zoning",
|
||||||
"EqTime",
|
"EqTime",
|
||||||
"Corpses",
|
"Corpses",
|
||||||
|
"XTargets"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -834,6 +834,16 @@
|
|||||||
OutF(LogSys, Logs::Detail, Logs::Corpses, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
OutF(LogSys, Logs::Detail, Logs::Corpses, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define LogXTargets(message, ...) do {\
|
||||||
|
if (LogSys.IsLogEnabled(Logs::General, Logs::XTargets))\
|
||||||
|
OutF(LogSys, Logs::General, Logs::XTargets, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define LogXTargetsDetail(message, ...) do {\
|
||||||
|
if (LogSys.IsLogEnabled(Logs::Detail, Logs::XTargets))\
|
||||||
|
OutF(LogSys, Logs::Detail, Logs::XTargets, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define Log(debug_level, log_category, message, ...) do {\
|
#define Log(debug_level, log_category, message, ...) do {\
|
||||||
if (LogSys.IsLogEnabled(debug_level, log_category))\
|
if (LogSys.IsLogEnabled(debug_level, log_category))\
|
||||||
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
|
|||||||
@ -6765,23 +6765,36 @@ void Client::UpdateClientXTarget(Client *c)
|
|||||||
// IT IS NOT SAFE TO CALL THIS IF IT'S NOT INITIAL AGGRO
|
// IT IS NOT SAFE TO CALL THIS IF IT'S NOT INITIAL AGGRO
|
||||||
void Client::AddAutoXTarget(Mob *m, bool send)
|
void Client::AddAutoXTarget(Mob *m, bool send)
|
||||||
{
|
{
|
||||||
|
if (m->IsBot() || (m->IsPet() && m->IsPetOwnerBot())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_activeautohatermgr->increment_count(m);
|
m_activeautohatermgr->increment_count(m);
|
||||||
|
|
||||||
if (!XTargettingAvailable() || !XTargetAutoAddHaters || IsXTarget(m))
|
if (!XTargettingAvailable() || !XTargetAutoAddHaters || IsXTarget(m)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for(int i = 0; i < GetMaxXTargets(); ++i)
|
for (int i = 0; i < GetMaxXTargets(); ++i) {
|
||||||
{
|
if (XTargets[i].Type == Auto && XTargets[i].ID == 0) {
|
||||||
if((XTargets[i].Type == Auto) && (XTargets[i].ID == 0))
|
|
||||||
{
|
|
||||||
XTargets[i].ID = m->GetID();
|
XTargets[i].ID = m->GetID();
|
||||||
if (send) // if we don't send we're bulk sending updates later on
|
|
||||||
|
if (send) { // if we don't send we're bulk sending updates later on
|
||||||
SendXTargetPacket(i, m);
|
SendXTargetPacket(i, m);
|
||||||
else
|
} else {
|
||||||
XTargets[i].dirty = true;
|
XTargets[i].dirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogXTargets(
|
||||||
|
"Adding [{}] to [{}] ({}) XTargets",
|
||||||
|
m->GetCleanName(),
|
||||||
|
GetCleanName(),
|
||||||
|
GetID()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::RemoveXTarget(Mob *m, bool OnlyAutoSlots)
|
void Client::RemoveXTarget(Mob *m, bool OnlyAutoSlots)
|
||||||
@ -6790,15 +6803,23 @@ void Client::RemoveXTarget(Mob *m, bool OnlyAutoSlots)
|
|||||||
// now we may need to clean up our CurrentTargetNPC entries
|
// now we may need to clean up our CurrentTargetNPC entries
|
||||||
for (int i = 0; i < GetMaxXTargets(); ++i) {
|
for (int i = 0; i < GetMaxXTargets(); ++i) {
|
||||||
if (XTargets[i].Type == CurrentTargetNPC && XTargets[i].ID == m->GetID()) {
|
if (XTargets[i].Type == CurrentTargetNPC && XTargets[i].ID == m->GetID()) {
|
||||||
XTargets[i].Type = Auto;
|
XTargets[i].Type = Auto;
|
||||||
XTargets[i].ID = 0;
|
XTargets[i].ID = 0;
|
||||||
XTargets[i].dirty = true;
|
XTargets[i].dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto r = GetRaid();
|
auto r = GetRaid();
|
||||||
if (r) {
|
if (r) {
|
||||||
r->UpdateRaidXTargets();
|
r->UpdateRaidXTargets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogXTargets(
|
||||||
|
"Removing [{}] from [{}] ({}) XTargets",
|
||||||
|
m->GetCleanName(),
|
||||||
|
GetCleanName(),
|
||||||
|
GetID()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::UpdateXTargetType(XTargetType Type, Mob *m, const char *Name)
|
void Client::UpdateXTargetType(XTargetType Type, Mob *m, const char *Name)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user