mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 06:21:28 +00:00
Fix a few things with auras
This commit is contained in:
parent
accc8aee57
commit
f917a38e1a
@ -683,6 +683,7 @@ void Mob::AddAura(Aura *aura, AuraRecord &record)
|
||||
assert(aura != nullptr);
|
||||
strn0cpy(aura_mgr.auras[aura_mgr.count].name, aura->GetCleanName(), 64);
|
||||
aura_mgr.auras[aura_mgr.count].spawn_id = aura->GetID();
|
||||
aura_mgr.auras[aura_mgr.count].aura = aura;
|
||||
if (record.icon == -1)
|
||||
aura_mgr.auras[aura_mgr.count].icon = spells[record.spell_id].new_icon;
|
||||
else
|
||||
@ -707,6 +708,7 @@ void Mob::AddTrap(Aura *aura, AuraRecord &record)
|
||||
assert(aura != nullptr);
|
||||
strn0cpy(trap_mgr.auras[trap_mgr.count].name, aura->GetCleanName(), 64);
|
||||
trap_mgr.auras[trap_mgr.count].spawn_id = aura->GetID();
|
||||
trap_mgr.auras[trap_mgr.count].aura = aura;
|
||||
if (record.icon == -1)
|
||||
trap_mgr.auras[trap_mgr.count].icon = spells[record.spell_id].new_icon;
|
||||
else
|
||||
@ -733,17 +735,15 @@ void Mob::RemoveAllAuras()
|
||||
// this is sent on camp/zone, so it just despawns?
|
||||
if (aura_mgr.count) {
|
||||
for (auto &e : aura_mgr.auras) {
|
||||
auto mob = entity_list.GetMob(e.spawn_id);
|
||||
if (mob)
|
||||
mob->Depop();
|
||||
if (e.aura)
|
||||
e.aura->Depop();
|
||||
}
|
||||
}
|
||||
|
||||
if (trap_mgr.count) {
|
||||
for (auto &e : trap_mgr.auras) {
|
||||
auto mob = entity_list.GetMob(e.spawn_id);
|
||||
if (mob)
|
||||
mob->Depop();
|
||||
if (e.aura)
|
||||
e.aura->Depop();
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -754,9 +754,8 @@ void Mob::RemoveAura(int spawn_id, bool expired)
|
||||
for (int i = 0; i < aura_mgr.count; ++i) {
|
||||
auto &aura = aura_mgr.auras[i];
|
||||
if (aura.spawn_id == spawn_id) {
|
||||
auto mob = entity_list.GetMob(aura.spawn_id);
|
||||
if (mob)
|
||||
mob->Depop();
|
||||
if (aura.aura)
|
||||
aura.aura->Depop();
|
||||
if (expired && IsClient())
|
||||
CastToClient()->SendColoredText(
|
||||
CC_Yellow, StringFormat("%s has expired.", aura.name)); // TODO: verify color
|
||||
@ -764,6 +763,8 @@ void Mob::RemoveAura(int spawn_id, bool expired)
|
||||
i++;
|
||||
aura.spawn_id = aura_mgr.auras[i].spawn_id;
|
||||
aura.icon = aura_mgr.auras[i].icon;
|
||||
aura.aura = aura_mgr.auras[i].aura;
|
||||
aura_mgr.auras[i].aura = nullptr;
|
||||
strn0cpy(aura.name, aura_mgr.auras[i].name, 64);
|
||||
}
|
||||
aura_mgr.count--;
|
||||
@ -773,20 +774,23 @@ void Mob::RemoveAura(int spawn_id, bool expired)
|
||||
|
||||
for (int i = 0; i < trap_mgr.count; ++i) {
|
||||
auto &aura = trap_mgr.auras[i];
|
||||
auto mob = entity_list.GetMob(aura.spawn_id);
|
||||
if (mob)
|
||||
mob->Depop();
|
||||
if (expired && IsClient())
|
||||
CastToClient()->SendColoredText(
|
||||
CC_Yellow, StringFormat("%s has expired.", aura.name)); // TODO: verify color
|
||||
while (trap_mgr.count - 1 > i) {
|
||||
i++;
|
||||
aura.spawn_id = trap_mgr.auras[i].spawn_id;
|
||||
aura.icon = trap_mgr.auras[i].icon;
|
||||
strn0cpy(aura.name, trap_mgr.auras[i].name, 64);
|
||||
if (aura.spawn_id == spawn_id) {
|
||||
if (aura.aura)
|
||||
aura.aura->Depop();
|
||||
if (expired && IsClient())
|
||||
CastToClient()->SendColoredText(
|
||||
CC_Yellow, StringFormat("%s has expired.", aura.name)); // TODO: verify color
|
||||
while (trap_mgr.count - 1 > i) {
|
||||
i++;
|
||||
aura.spawn_id = trap_mgr.auras[i].spawn_id;
|
||||
aura.icon = trap_mgr.auras[i].icon;
|
||||
aura.aura = trap_mgr.auras[i].aura;
|
||||
trap_mgr.auras[i].aura = nullptr;
|
||||
strn0cpy(aura.name, trap_mgr.auras[i].name, 64);
|
||||
}
|
||||
trap_mgr.count--;
|
||||
return;
|
||||
}
|
||||
trap_mgr.count--;
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@ -91,7 +91,8 @@ public:
|
||||
char name[64];
|
||||
int spawn_id;
|
||||
int icon;
|
||||
AuraInfo() : spawn_id(0), icon(0)
|
||||
Aura *aura;
|
||||
AuraInfo() : spawn_id(0), icon(0), aura(nullptr)
|
||||
{
|
||||
memset(name, 0, 64);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user