Merge [SD2]

r1009 Restore compile. RecieveEmote function moved to creature AI.

--HG--
branch : trunk
This commit is contained in:
Kudlaty
2009-06-15 02:52:06 +02:00
parent a9b3be8c99
commit 678fffd492
7 changed files with 102 additions and 65 deletions
@@ -170,3 +170,27 @@ void guardAI::UpdateAI(const uint32 diff)
} }
} }
void guardAI::DoReplyToTextEmote(uint32 em)
{
switch(em)
{
case TEXTEMOTE_KISS: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break;
case TEXTEMOTE_WAVE: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break;
case TEXTEMOTE_SALUTE: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); break;
case TEXTEMOTE_SHY: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_FLEX); break;
case TEXTEMOTE_RUDE:
case TEXTEMOTE_CHICKEN: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_POINT); break;
}
}
void guardAI_orgrimmar::ReceiveEmote(Player *player, uint32 text_emote)
{
if (player->GetTeam()==HORDE)
DoReplyToTextEmote(text_emote);
}
void guardAI_stormwind::ReceiveEmote(Player *player, uint32 text_emote)
{
if (player->GetTeam() == ALLIANCE)
DoReplyToTextEmote(text_emote);
}
@@ -21,6 +21,23 @@ struct TRINITY_DLL_DECL guardAI : public ScriptedAI
void JustDied(Unit *Killer); void JustDied(Unit *Killer);
void UpdateAI(const uint32 diff); void UpdateAI(const uint32 diff);
//common used for guards in main cities
void DoReplyToTextEmote(uint32 em);
};
struct TRINITY_DLL_DECL guardAI_orgrimmar : public guardAI
{
guardAI_orgrimmar(Creature *c) : guardAI(c) {}
void ReceiveEmote(Player *player, uint32 text_emote);
};
struct TRINITY_DLL_DECL guardAI_stormwind : public guardAI
{
guardAI_stormwind(Creature *c) : guardAI(c) {}
void ReceiveEmote(Player *player, uint32 text_emote);
}; };
#endif #endif
+2 -32
View File
@@ -79,20 +79,6 @@ EndContentData */
#define GOSSIP_TEXT_INN_SILVERMOON_1 "Silvermoon City Inn" #define GOSSIP_TEXT_INN_SILVERMOON_1 "Silvermoon City Inn"
#define GOSSIP_TEXT_INN_SILVERMOON_2 "Wayfarer's Rest tavern" #define GOSSIP_TEXT_INN_SILVERMOON_2 "Wayfarer's Rest tavern"
//common used for guards in main cities
void DoReplyToTextEmote(Creature *_Creature,uint32 em)
{
switch(em)
{
case TEXTEMOTE_KISS: _Creature->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break;
case TEXTEMOTE_WAVE: _Creature->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break;
case TEXTEMOTE_SALUTE: _Creature->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); break;
case TEXTEMOTE_SHY: _Creature->HandleEmoteCommand(EMOTE_ONESHOT_FLEX); break;
case TEXTEMOTE_RUDE:
case TEXTEMOTE_CHICKEN: _Creature->HandleEmoteCommand(EMOTE_ONESHOT_POINT); break;
}
}
/******************************************************* /*******************************************************
* guard_azuremyst start * guard_azuremyst start
*******************************************************/ *******************************************************/
@@ -2220,20 +2206,13 @@ bool GossipSelect_guard_orgrimmar(Player *player, Creature *_Creature, uint32 se
return true; return true;
} }
bool ReceiveEmote_guard_orgrimmar(Player *player, Creature *_Creature, uint32 emote)
{
if( player->GetTeam() == HORDE )
DoReplyToTextEmote(_Creature,emote);
return true;
}
/******************************************************* /*******************************************************
* guard_orgrimmar end * guard_orgrimmar end
*******************************************************/ *******************************************************/
CreatureAI* GetAI_guard_orgrimmar(Creature *_Creature) CreatureAI* GetAI_guard_orgrimmar(Creature *_Creature)
{ {
return new guardAI (_Creature); return new guardAI_orgrimmar (_Creature);
} }
/******************************************************* /*******************************************************
@@ -3384,20 +3363,13 @@ bool GossipSelect_guard_stormwind(Player *player, Creature *_Creature, uint32 se
return true; return true;
} }
bool ReceiveEmote_guard_stormwind(Player *player, Creature *_Creature, uint32 emote)
{
if( player->GetTeam() == ALLIANCE )
DoReplyToTextEmote(_Creature,emote);
return true;
}
/******************************************************* /*******************************************************
* guard_stormwind end * guard_stormwind end
*******************************************************/ *******************************************************/
CreatureAI* GetAI_guard_stormwind(Creature *_Creature) CreatureAI* GetAI_guard_stormwind(Creature *_Creature)
{ {
return new guardAI (_Creature); return new guardAI_stormwind (_Creature);
} }
/******************************************************* /*******************************************************
@@ -4010,7 +3982,6 @@ void AddSC_guards()
newscript->Name="guard_orgrimmar"; newscript->Name="guard_orgrimmar";
newscript->pGossipHello = &GossipHello_guard_orgrimmar; newscript->pGossipHello = &GossipHello_guard_orgrimmar;
newscript->pGossipSelect = &GossipSelect_guard_orgrimmar; newscript->pGossipSelect = &GossipSelect_guard_orgrimmar;
//newscript->pReceiveEmote = &ReceiveEmote_guard_orgrimmar;
newscript->GetAI = &GetAI_guard_orgrimmar; newscript->GetAI = &GetAI_guard_orgrimmar;
newscript->RegisterSelf(); newscript->RegisterSelf();
@@ -4046,7 +4017,6 @@ void AddSC_guards()
newscript->Name="guard_stormwind"; newscript->Name="guard_stormwind";
newscript->pGossipHello = &GossipHello_guard_stormwind; newscript->pGossipHello = &GossipHello_guard_stormwind;
newscript->pGossipSelect = &GossipSelect_guard_stormwind; newscript->pGossipSelect = &GossipSelect_guard_stormwind;
//newscript->pReceiveEmote = &ReceiveEmote_guard_stormwind;
newscript->GetAI = &GetAI_guard_stormwind; newscript->GetAI = &GetAI_guard_stormwind;
newscript->RegisterSelf(); newscript->RegisterSelf();
@@ -98,9 +98,12 @@ struct TRINITY_DLL_DECL npc_chicken_cluckAI : public ScriptedAI
DoScriptText(EMOTE_A_HELLO, m_creature); DoScriptText(EMOTE_A_HELLO, m_creature);
} }
} }
} else DoScriptText(EMOTE_H_HELLO,m_creature); }
else
DoScriptText(EMOTE_H_HELLO,m_creature);
} }
if( emote == TEXTEMOTE_CHEER && player->GetTeam() == ALLIANCE ) if( emote == TEXTEMOTE_CHEER && player->GetTeam() == ALLIANCE )
{
if( player->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_COMPLETE ) if( player->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_COMPLETE )
{ {
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
@@ -108,6 +111,7 @@ struct TRINITY_DLL_DECL npc_chicken_cluckAI : public ScriptedAI
DoScriptText(EMOTE_CLUCK_TEXT2, m_creature); DoScriptText(EMOTE_CLUCK_TEXT2, m_creature);
} }
} }
}
}; };
CreatureAI* GetAI_npc_chicken_cluck(Creature *_Creature) CreatureAI* GetAI_npc_chicken_cluck(Creature *_Creature)
@@ -167,7 +167,7 @@ struct TRINITY_DLL_DECL npc_taskmaster_fizzuleAI : public ScriptedAI
{ {
if (m_creature->getFaction() == FACTION_FRIENDLY_F) if (m_creature->getFaction() == FACTION_FRIENDLY_F)
return; return;
else
DoFriend(); DoFriend();
} }
} }
@@ -69,7 +69,10 @@ bool GossipSelect_npc_neeru_fireblade(Player *player, Creature *_Creature, uint3
## npc_shenthul ## npc_shenthul
######*/ ######*/
#define QUEST_2460 2460 enum
{
QUEST_SHATTERED_SALUTE = 2460
};
struct TRINITY_DLL_DECL npc_shenthulAI : public ScriptedAI struct TRINITY_DLL_DECL npc_shenthulAI : public ScriptedAI
{ {
@@ -95,21 +98,27 @@ struct TRINITY_DLL_DECL npc_shenthulAI : public ScriptedAI
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
{ {
if( CanEmote ) if( CanEmote )
{
if (Reset_Timer < diff) if (Reset_Timer < diff)
{ {
if( Unit* temp = Unit::GetUnit((*m_creature),playerGUID) ) if (Player* pPlayer = (Player*)Unit::GetUnit((*m_creature),playerGUID))
if( temp->GetTypeId() == TYPEID_PLAYER ) {
CAST_PLR(temp)->FailQuest(QUEST_2460); if (pPlayer->GetTypeId() == TYPEID_PLAYER && pPlayer->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE)
pPlayer->FailQuest(QUEST_SHATTERED_SALUTE);
}
Reset(); Reset();
} else Reset_Timer -= diff; } else Reset_Timer -= diff;
}
if( CanTalk && !CanEmote ) if( CanTalk && !CanEmote )
{
if (Salute_Timer < diff) if (Salute_Timer < diff)
{ {
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
CanEmote = true; CanEmote = true;
Reset_Timer = 60000; Reset_Timer = 60000;
} else Salute_Timer -= diff; } else Salute_Timer -= diff;
}
if (!UpdateVictim()) if (!UpdateVictim())
return; return;
@@ -119,13 +128,15 @@ struct TRINITY_DLL_DECL npc_shenthulAI : public ScriptedAI
void ReciveEmote_npc_shenthul(Player *player, uint32 emote) void ReciveEmote_npc_shenthul(Player *player, uint32 emote)
{ {
if( emote == TEXTEMOTE_SALUTE && player->GetQuestStatus(QUEST_2460) == QUEST_STATUS_INCOMPLETE ) if( emote == TEXTEMOTE_SALUTE && player->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE )
{
if(CanEmote) if(CanEmote)
{ {
player->AreaExploredOrEventHappens(QUEST_2460); player->AreaExploredOrEventHappens(QUEST_SHATTERED_SALUTE);
Reset(); Reset();
} }
} }
}
}; };
CreatureAI* GetAI_npc_shenthul(Creature *_Creature) CreatureAI* GetAI_npc_shenthul(Creature *_Creature)
@@ -135,7 +146,7 @@ CreatureAI* GetAI_npc_shenthul(Creature *_Creature)
bool QuestAccept_npc_shenthul(Player* player, Creature* creature, Quest const* quest) bool QuestAccept_npc_shenthul(Player* player, Creature* creature, Quest const* quest)
{ {
if( quest->GetQuestId() == QUEST_2460 ) if( quest->GetQuestId() == QUEST_SHATTERED_SALUTE )
{ {
CAST_AI(npc_shenthulAI, creature->AI())->CanTalk = true; CAST_AI(npc_shenthulAI, creature->AI())->CanTalk = true;
CAST_AI(npc_shenthulAI, creature->AI())->playerGUID = player->GetGUID(); CAST_AI(npc_shenthulAI, creature->AI())->playerGUID = player->GetGUID();
@@ -179,21 +179,32 @@ CreatureAI* GetAI_npc_dashel_stonefist(Creature* pCreature)
#define SAY_GREETING -1000005 #define SAY_GREETING -1000005
bool ReceiveEmote_npc_general_marcus_jonathan(Player *player, Creature *_Creature, uint32 emote) struct TRINITY_DLL_DECL npc_general_marcus_jonathanAI : public ScriptedAI
{
npc_general_marcus_jonathanAI(Creature *c) : ScriptedAI(c) { }
void Reset() {}
void Aggro(Unit*) {}
void ReceiveEmote(Player *player, uint32 emote)
{ {
if (player->GetTeam() == ALLIANCE) if (player->GetTeam() == ALLIANCE)
{ {
if (emote == TEXTEMOTE_SALUTE) if (emote == TEXTEMOTE_SALUTE)
{ {
_Creature->SetOrientation(_Creature->GetAngle(player)); m_creature->SetOrientation(m_creature->GetAngle(player));
_Creature->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
} }
if (emote == TEXTEMOTE_WAVE) if (emote == TEXTEMOTE_WAVE)
DoScriptText(SAY_GREETING, m_creature, player);
}
}
};
CreatureAI* GetAI_npc_general_marcus_jonathan(Creature* pCreature)
{ {
DoScriptText(SAY_GREETING, _Creature, player); return new npc_general_marcus_jonathanAI(pCreature);
}
}
return true;
} }
/*###### /*######
@@ -266,7 +277,7 @@ void AddSC_stormwind_city()
newscript = new Script; newscript = new Script;
newscript->Name = "npc_general_marcus_jonathan"; newscript->Name = "npc_general_marcus_jonathan";
//newscript->pReceiveEmote = &ReceiveEmote_npc_general_marcus_jonathan; newscript->GetAI = &GetAI_npc_general_marcus_jonathan;
newscript->RegisterSelf(); newscript->RegisterSelf();
newscript = new Script; newscript = new Script;