Core/SAI: Implemented Gameobject action allowing to send SMSG_GAMEOBJECT_CUSTOM_ANIM with parameter set in param1

This commit is contained in:
Shauren
2011-03-02 16:50:09 +01:00
parent 2b9346e5a0
commit 6c020c72cc
7 changed files with 28 additions and 9 deletions
@@ -1453,6 +1453,18 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
(*itr)->ToUnit()->InterruptNonMeleeSpells(e.action.interruptSpellCasting.withDelayed,e.action.interruptSpellCasting.spell_id,e.action.interruptSpellCasting.withInstant);
}
break;
}
case SMART_ACTION_SEND_GO_CUSTOM_ANIM:
{
ObjectList* targets = GetTargets(e, unit);
if (!targets)
return;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); itr++)
if (IsGameObject((*itr)))
(*itr)->ToGameObject()->SendCustomAnim(e.action.sendGoCustomAnim.anim);
break;
}
default:
@@ -769,6 +769,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
case SMART_ACTION_SET_UNIT_FIELD_BYTES_1:
case SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1:
case SMART_ACTION_INTERRUPT_SPELL:
case SMART_ACTION_SEND_GO_CUSTOM_ANIM:
break;
default:
sLog->outErrorDb("SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
@@ -445,12 +445,13 @@ enum SMART_ACTION
SMART_ACTION_RANDOM_MOVE = 89, // maxDist
SMART_ACTION_SET_UNIT_FIELD_BYTES_1 = 90, // bytes, target
SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1 = 91, // bytes, target
SMART_ACTION_INTERRUPT_SPELL = 92,
SMART_ACTION_END = 93,
SMART_ACTION_SEND_GO_CUSTOM_ANIM = 93, // anim id
SMART_ACTION_END = 94,
};
struct SmartAction
@@ -829,6 +830,11 @@ struct SmartAction
uint32 spell_id;
bool withInstant;
} interruptSpellCasting;
struct
{
uint32 anim;
} sendGoCustomAnim;
struct
{
uint32 param1;
@@ -306,7 +306,7 @@ void GameObject::Update(uint32 diff)
udata.BuildPacket(&packet);
caster->ToPlayer()->GetSession()->SendPacket(&packet);
SendCustomAnim();
SendCustomAnim(GetGoAnimProgress());
}
m_lootState = GO_READY; // can be successfully open with some chance
@@ -1212,7 +1212,7 @@ void GameObject::Use(Unit* user)
// this appear to be ok, however others exist in addition to this that should have custom (ex: 190510, 188692, 187389)
if (time_to_restore && info->goober.customAnim)
SendCustomAnim();
SendCustomAnim(GetGoAnimProgress());
else
SetGoState(GO_STATE_ACTIVE);
@@ -1637,11 +1637,11 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
//trigger->RemoveCorpse();
}
void GameObject::SendCustomAnim()
void GameObject::SendCustomAnim(uint32 anim)
{
WorldPacket data(SMSG_GAMEOBJECT_CUSTOM_ANIM,8+4);
data << GetGUID();
data << uint32(GetGoAnimProgress());
data << uint32(anim);
SendMessageToSet(&data, true);
}
@@ -748,7 +748,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
GameObject* LookupFishingHoleAround(float range);
void CastSpell(Unit *target, uint32 spell);
void SendCustomAnim();
void SendCustomAnim(uint32 anim);
bool IsInRange(float x, float y, float z, float radius) const;
void TakenDamage(uint32 damage, Unit* who = NULL);
void Rebuild();
@@ -114,7 +114,7 @@ public:
{
//THIS GOB IS A TRAP - What shall i do? =(
//Cast it spell? Copyed Heigan method
pFloorEruption->SendCustomAnim();
pFloorEruption->SendCustomAnim(pFloorEruption->GetGoAnimProgress());
pFloorEruption->CastSpell(NULL, Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId
//Get all immediatly nearby floors
@@ -335,7 +335,7 @@ public:
{
if (GameObject* pHeiganEruption = instance->GetGameObject(*itr))
{
pHeiganEruption->SendCustomAnim();
pHeiganEruption->SendCustomAnim(pHeiganEruption->GetGoAnimProgress());
pHeiganEruption->CastSpell(NULL, SPELL_ERUPTION);
}
}