[9644] Changes in emotes work.

Waypoint/db script/event ai/'.npc playemote' emote data now auto select by emote id way to execute:
oneshot or persistent state

So if in referenced DB data wrongly used state emote as oneshot case this will work in different way now.
This commit is contained in:
VladimirMangos 2010-03-30 22:06:20 +04:00
parent bf1903345b
commit 5c7f6356d6
9 changed files with 35 additions and 8 deletions

View file

@ -424,7 +424,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_creature->PlayDirectSound(action.sound.soundId); m_creature->PlayDirectSound(action.sound.soundId);
break; break;
case ACTION_T_EMOTE: case ACTION_T_EMOTE:
m_creature->HandleEmoteCommand(action.emote.emoteId); m_creature->HandleEmote(action.emote.emoteId);
break; break;
case ACTION_T_RANDOM_SOUND: case ACTION_T_RANDOM_SOUND:
{ {
@ -437,7 +437,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{ {
int32 temp = GetRandActionParam(rnd, action.random_emote.emoteId1, action.random_emote.emoteId2, action.random_emote.emoteId3); int32 temp = GetRandActionParam(rnd, action.random_emote.emoteId1, action.random_emote.emoteId2, action.random_emote.emoteId3);
if (temp >= 0) if (temp >= 0)
m_creature->HandleEmoteCommand(temp); m_creature->HandleEmote(temp);
break; break;
} }
case ACTION_T_CAST: case ACTION_T_CAST:
@ -1314,7 +1314,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
{ {
if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER) if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER)
{ {
((Unit*)pSource)->HandleEmoteCommand((*i).second.Emote); ((Unit*)pSource)->HandleEmote((*i).second.Emote);
} }
else else
sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process emote for invalid TypeId (%u).",textEntry,pSource->GetTypeId()); sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process emote for invalid TypeId (%u).",textEntry,pSource->GetTypeId());

View file

@ -3659,7 +3659,11 @@ bool ChatHandler::HandleModifyStandStateCommand(const char* args)
return false; return false;
uint32 anim_id = atoi((char*)args); uint32 anim_id = atoi((char*)args);
m_session->GetPlayer( )->SetUInt32Value( UNIT_NPC_EMOTESTATE , anim_id );
if (!sEmotesStore.LookupEntry(anim_id))
return false;
m_session->GetPlayer()->HandleEmoteState(anim_id);
return true; return true;
} }

View file

@ -3857,7 +3857,7 @@ bool ChatHandler::HandleNpcPlayEmoteCommand(const char* args)
return false; return false;
} }
target->SetUInt32Value(UNIT_NPC_EMOTESTATE,emote); target->HandleEmote(emote);
return true; return true;
} }

View file

@ -2973,7 +2973,7 @@ void Map::ScriptsProcess()
break; break;
} }
((Creature *)source)->HandleEmoteCommand(step.script->datalong); ((Creature *)source)->HandleEmote(step.script->datalong);
break; break;
case SCRIPT_COMMAND_FIELD_SET: case SCRIPT_COMMAND_FIELD_SET:
if(!source) if(!source)

View file

@ -854,7 +854,10 @@ void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entry
} }
if (!sEmotesStore.LookupEntry(addon->emote)) if (!sEmotesStore.LookupEntry(addon->emote))
{
sLog.outErrorDb("Creature (%s %u) have invalid emote (%u) defined in `%s`.", entryName, addon->guidOrEntry, addon->emote, creatureaddons.GetTableName()); sLog.outErrorDb("Creature (%s %u) have invalid emote (%u) defined in `%s`.", entryName, addon->guidOrEntry, addon->emote, creatureaddons.GetTableName());
const_cast<CreatureDataAddon*>(addon)->emote = 0;
}
if (addon->splineFlags & (SPLINEFLAG_TRAJECTORY|SPLINEFLAG_UNKNOWN3)) if (addon->splineFlags & (SPLINEFLAG_TRAJECTORY|SPLINEFLAG_UNKNOWN3))
{ {

View file

@ -1744,6 +1744,24 @@ void Unit::HandleEmoteCommand(uint32 anim_id)
SendMessageToSet(&data, true); SendMessageToSet(&data, true);
} }
void Unit::HandleEmoteState(uint32 anim_id)
{
SetUInt32Value(UNIT_NPC_EMOTESTATE, anim_id);
}
void Unit::HandleEmote(uint32 anim_id)
{
if (!anim_id)
HandleEmoteState(0);
else if (EmotesEntry const* emoteEntry = sEmotesStore.LookupEntry(anim_id))
{
if (emoteEntry->EmoteType) // 1,2 states, 0 command
HandleEmoteState(anim_id);
else
HandleEmoteCommand(anim_id);
}
}
uint32 Unit::CalcNotIgnoreAbsorbDamage( uint32 damage, SpellSchoolMask damageSchoolMask, SpellEntry const* spellInfo /*= NULL*/) uint32 Unit::CalcNotIgnoreAbsorbDamage( uint32 damage, SpellSchoolMask damageSchoolMask, SpellEntry const* spellInfo /*= NULL*/)
{ {
float absorb_affected_rate = 1.0f; float absorb_affected_rate = 1.0f;

View file

@ -1241,7 +1241,9 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellEntry const *procSpell = NULL); void ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellEntry const *procSpell = NULL);
void ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const * procSpell, uint32 damage ); void ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const * procSpell, uint32 damage );
void HandleEmote(uint32 anim_id); // auto-select command/state
void HandleEmoteCommand(uint32 anim_id); void HandleEmoteCommand(uint32 anim_id);
void HandleEmoteState(uint32 anim_id);
void AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType = BASE_ATTACK, bool extra = false ); void AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType = BASE_ATTACK, bool extra = false );
float MeleeMissChanceCalc(const Unit *pVictim, WeaponAttackType attType) const; float MeleeMissChanceCalc(const Unit *pVictim, WeaponAttackType attType) const;

View file

@ -174,7 +174,7 @@ bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint3
if (WaypointBehavior *behavior = i_path->at(idx).behavior) if (WaypointBehavior *behavior = i_path->at(idx).behavior)
{ {
if (behavior->emote != 0) if (behavior->emote != 0)
creature.SetUInt32Value(UNIT_NPC_EMOTESTATE, behavior->emote); creature.HandleEmote(behavior->emote);
if (behavior->spell != 0) if (behavior->spell != 0)
{ {

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9643" #define REVISION_NR "9644"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__