[11358] Add script effect of spell 45713

DB devs should note the special design for this spell, as it will set proper model for creatures when used from *_addon tables. See code comments.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2011-04-15 12:27:45 +02:00
parent 2c09c11091
commit 1523cf5ae3
2 changed files with 55 additions and 1 deletions

View file

@ -6532,6 +6532,60 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
return;
}
case 45713: // Naked Caravan Guard - Master Transform
{
if (m_caster->GetTypeId() != TYPEID_UNIT)
return;
const CreatureInfo* cTemplate = NULL;
switch(m_caster->GetEntry())
{
case 25342: cTemplate = ObjectMgr::GetCreatureTemplate(25340); break;
case 25343: cTemplate = ObjectMgr::GetCreatureTemplate(25341); break;
}
if (!cTemplate)
return;
uint32 display_id = 0;
// Spell is designed to be used in creature addon.
// This makes it possible to set proper model before adding to map.
// For later, spell is used in gossip (with following despawn,
// so addon can reload the default model and data again).
// It should be noted that additional spell id's have been seen in relation
// to this spell, but those does not exist in client (45701 (regular spell), 45706 (aura)).
// not in map yet OR no npc flags yet (restored after LoadCreatureAddon for respawn cases)
if (!m_caster->IsInMap(m_caster) || m_caster->GetUInt32Value(UNIT_NPC_FLAGS) == UNIT_NPC_FLAG_NONE)
{
display_id = Creature::ChooseDisplayId(cTemplate);
((Creature*)m_caster)->LoadEquipment(((Creature*)m_caster)->GetEquipmentId());
}
else
{
m_caster->SetUInt32Value(UNIT_NPC_FLAGS, cTemplate->npcflag);
((Creature*)m_caster)->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, 0);
((Creature*)m_caster)->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, 0);
switch(m_caster->GetDisplayId())
{
case 23246: display_id = 23245; break;
case 23247: display_id = 23250; break;
case 23248: display_id = 23251; break;
case 23249: display_id = 23252; break;
case 23124: display_id = 23253; break;
case 23125: display_id = 23254; break;
case 23126: display_id = 23255; break;
case 23127: display_id = 23256; break;
}
}
m_caster->SetDisplayId(display_id);
return;
}
case 46203: // Goblin Weather Machine
{
if (!unitTarget)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11357"
#define REVISION_NR "11358"
#endif // __REVISION_NR_H__