Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] Is there an existing script assigned to the encounter you’re working on?

[DiscordArchive] Is there an existing script assigned to the encounter you’re working on?

[DiscordArchive] Is there an existing script assigned to the encounter you’re working on?

Pages (4): Previous 1 2 3 4 Next
rektbyfaith
Administrator
0
10-29-2023, 10:04 PM
#21
Archived author: KJack • Posted: 2023-10-29T22:04:40.506000+00:00
Original source

I am starting to suspect a bug in ApplySpellImmune when `apply` is false. I added some (temporary, don't worry!) error debug commands to it and I don't think the else for loop is running correctly.

```c++
void Unit::ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType)
{
LOG_ERROR("scripts.ai", "Unit::ApplySpellImmune: {} {} {} {}", spellId, op, type, apply);

if (apply)
{
// xinef: immunities with spellId 0 are intended to be applied only once (script purposes mosty)
if (spellId == 0 && std::find_if(m_spellImmune[op].begin(), m_spellImmune[op].end(), spellIdImmunityPredicate(type)) != m_spellImmune[op].end())
return;

SpellImmune immune;
immune.spellId = spellId;
immune.type = type;
immune.blockType = blockType;
m_spellImmune[op].push_back(std::move(immune));
}
else
{
for (SpellImmuneList::iterator itr = m_spellImmune[op].begin(); itr != m_spellImmune[op].end(); ++itr)
{
LOG_ERROR("scripts.ai", "Should {} (type {}) be removed?", itr->spellId, itr->type);
if (itr->spellId == spellId && itr->type == type)
{
m_spellImmune[op].erase(itr);
LOG_ERROR("scripts.ai", "Yes!");
break;
}
else
{
LOG_ERROR("scripts.ai", "No...");
}
}
}
}
```

My code:
```c++
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FREEZE, false);
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SNARE, false);
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_ROOT, false);
```

Logging output:
```
npc_zealot_zathAI::Constructor
Unit::ApplySpellImmune: 0 5 13 false
Unit::ApplySpellImmune: 0 5 11 false
Unit::ApplySpellImmune: 0 5 7 false
```

So the function is getting the `apply` = `false` correctly, but no logging output from that loop...
rektbyfaith
10-29-2023, 10:04 PM #21

Archived author: KJack • Posted: 2023-10-29T22:04:40.506000+00:00
Original source

I am starting to suspect a bug in ApplySpellImmune when `apply` is false. I added some (temporary, don't worry!) error debug commands to it and I don't think the else for loop is running correctly.

```c++
void Unit::ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType)
{
LOG_ERROR("scripts.ai", "Unit::ApplySpellImmune: {} {} {} {}", spellId, op, type, apply);

if (apply)
{
// xinef: immunities with spellId 0 are intended to be applied only once (script purposes mosty)
if (spellId == 0 && std::find_if(m_spellImmune[op].begin(), m_spellImmune[op].end(), spellIdImmunityPredicate(type)) != m_spellImmune[op].end())
return;

SpellImmune immune;
immune.spellId = spellId;
immune.type = type;
immune.blockType = blockType;
m_spellImmune[op].push_back(std::move(immune));
}
else
{
for (SpellImmuneList::iterator itr = m_spellImmune[op].begin(); itr != m_spellImmune[op].end(); ++itr)
{
LOG_ERROR("scripts.ai", "Should {} (type {}) be removed?", itr->spellId, itr->type);
if (itr->spellId == spellId && itr->type == type)
{
m_spellImmune[op].erase(itr);
LOG_ERROR("scripts.ai", "Yes!");
break;
}
else
{
LOG_ERROR("scripts.ai", "No...");
}
}
}
}
```

My code:
```c++
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FREEZE, false);
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SNARE, false);
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_ROOT, false);
```

Logging output:
```
npc_zealot_zathAI::Constructor
Unit::ApplySpellImmune: 0 5 13 false
Unit::ApplySpellImmune: 0 5 11 false
Unit::ApplySpellImmune: 0 5 7 false
```

So the function is getting the `apply` = `false` correctly, but no logging output from that loop...

rektbyfaith
Administrator
0
10-29-2023, 10:04 PM
#22
Archived author: KJack • Posted: 2023-10-29T22:04:44.345000+00:00
Original source

sorry for wall of text
rektbyfaith
10-29-2023, 10:04 PM #22

Archived author: KJack • Posted: 2023-10-29T22:04:44.345000+00:00
Original source

sorry for wall of text

rektbyfaith
Administrator
0
10-29-2023, 10:07 PM
#23
Archived author: KJack • Posted: 2023-10-29T22:07:43.507000+00:00
Original source

there are no simple problems, i swear
rektbyfaith
10-29-2023, 10:07 PM #23

Archived author: KJack • Posted: 2023-10-29T22:07:43.507000+00:00
Original source

there are no simple problems, i swear

rektbyfaith
Administrator
0
10-29-2023, 10:15 PM
#24
Archived author: Kitzunu • Posted: 2023-10-29T22:15:05.560000+00:00
Original source

Lovely
rektbyfaith
10-29-2023, 10:15 PM #24

Archived author: Kitzunu • Posted: 2023-10-29T22:15:05.560000+00:00
Original source

Lovely

rektbyfaith
Administrator
0
10-29-2023, 10:15 PM
#25
Archived author: KJack • Posted: 2023-10-29T22:15:24.242000+00:00
Original source

https://tenor.com/view/wreckitralph-fixi...f-19395989
rektbyfaith
10-29-2023, 10:15 PM #25

Archived author: KJack • Posted: 2023-10-29T22:15:24.242000+00:00
Original source

https://tenor.com/view/wreckitralph-fixi...f-19395989

rektbyfaith
Administrator
0
10-29-2023, 10:15 PM
#26
Archived author: Kitzunu • Posted: 2023-10-29T22:15:48.019000+00:00
Original source

https://tenor.com/view/bob-the-builder-g...f-21863917
rektbyfaith
10-29-2023, 10:15 PM #26

Archived author: Kitzunu • Posted: 2023-10-29T22:15:48.019000+00:00
Original source

https://tenor.com/view/bob-the-builder-g...f-21863917

rektbyfaith
Administrator
0
10-29-2023, 10:16 PM
#27
Archived author: Kitzunu • Posted: 2023-10-29T22:16:44.681000+00:00
Original source

Why even have an option to remove in applyspellimmune
rektbyfaith
10-29-2023, 10:16 PM #27

Archived author: Kitzunu • Posted: 2023-10-29T22:16:44.681000+00:00
Original source

Why even have an option to remove in applyspellimmune

rektbyfaith
Administrator
0
10-29-2023, 10:16 PM
#28
Archived author: Kitzunu • Posted: 2023-10-29T22:16:48.876000+00:00
Original source

Doesnt make sense ngl
rektbyfaith
10-29-2023, 10:16 PM #28

Archived author: Kitzunu • Posted: 2023-10-29T22:16:48.876000+00:00
Original source

Doesnt make sense ngl

rektbyfaith
Administrator
0
10-29-2023, 10:16 PM
#29
Archived author: Kitzunu • Posted: 2023-10-29T22:16:58.920000+00:00
Original source

removespellimmune
rektbyfaith
10-29-2023, 10:16 PM #29

Archived author: Kitzunu • Posted: 2023-10-29T22:16:58.920000+00:00
Original source

removespellimmune

rektbyfaith
Administrator
0
10-29-2023, 10:17 PM
#30
Archived author: Kitzunu • Posted: 2023-10-29T22:17:00.229000+00:00
Original source

Pog
rektbyfaith
10-29-2023, 10:17 PM #30

Archived author: Kitzunu • Posted: 2023-10-29T22:17:00.229000+00:00
Original source

Pog

Pages (4): Previous 1 2 3 4 Next
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)