diff options
Diffstat (limited to 'src')
8 files changed, 193 insertions, 48 deletions
diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt index 4e2d4aa4de0..2dbf2545d3b 100644 --- a/src/bindings/scripts/CMakeLists.txt +++ b/src/bindings/scripts/CMakeLists.txt @@ -149,6 +149,7 @@ SET(trinityscript_LIB_SRCS scripts/zone/darkshore/darkshore.cpp scripts/zone/deadmines/def_deadmines.h scripts/zone/deadmines/deadmines.cpp + scripts/zone/desolace/desolace.cpp scripts/zone/dragonblight/dragonblight.cpp scripts/zone/dun_morogh/dun_morogh.cpp scripts/zone/dustwallow_marsh/dustwallow_marsh.cpp diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 24e0c488825..fadadda7246 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -255,6 +255,8 @@ extern void AddSC_instance_deadmines(); //Deadwind pass //Desolace +extern void AddSC_desolace(); + //Dire Maul extern void AddSC_dragonblight(); @@ -1149,6 +1151,8 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf") //Deadwind pass //Desolace + AddSC_desolace(); + //Dire Maul AddSC_dragonblight(); diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index b3eb1437c02..5885b5de607 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -718,8 +718,10 @@ > </Filter> <Filter - Name="Desolace" - > + Name="Desolace"> + <File + RelativePath="..\scripts\zone\desolace\desolace.cpp"> + </File> </Filter> <Filter Name="Dire Maul" diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj index 95f44bd2275..97d0da3ceea 100644 --- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj +++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj @@ -717,8 +717,10 @@ > </Filter> <Filter - Name="Desolace" - > + Name="Desolace"> + <File + RelativePath="..\scripts\zone\desolace\desolace.cpp"> + </File> </Filter> <Filter Name="Dire Maul" diff --git a/src/bindings/scripts/scripts/zone/blasted_lands/blasted_lands.cpp b/src/bindings/scripts/scripts/zone/blasted_lands/blasted_lands.cpp index 432633e90fe..be0c9c0d57c 100644 --- a/src/bindings/scripts/scripts/zone/blasted_lands/blasted_lands.cpp +++ b/src/bindings/scripts/scripts/zone/blasted_lands/blasted_lands.cpp @@ -50,7 +50,7 @@ bool GossipHello_npc_deathly_usher(Player *player, Creature *_Creature) bool GossipSelect_npc_deathly_usher(Player *player, Creature *_Creature, uint32 sender, uint32 action) { - if(action = GOSSIP_ACTION_INFO_DEF) + if(action == GOSSIP_ACTION_INFO_DEF) { player->CLOSE_GOSSIP_MENU(); _Creature->CastSpell(player, SPELL_TELEPORT_SINGLE, true); diff --git a/src/bindings/scripts/scripts/zone/desolace/desolace.cpp b/src/bindings/scripts/scripts/zone/desolace/desolace.cpp new file mode 100644 index 00000000000..e1366d51727 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/desolace/desolace.cpp @@ -0,0 +1,174 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Desolace +SD%Complete: 100 +SDComment: Quest support: 5561 +SDCategory: Desolace +EndScriptData */ + +/* ContentData +npc_aged_dying_ancient_kodo +EndContentData */ + +#include "precompiled.h" + +enum +{ + SAY_SMEED_HOME_1 = -1000428, + SAY_SMEED_HOME_2 = -1000429, + SAY_SMEED_HOME_3 = -1000430, + + QUEST_KODO = 5561, + + NPC_SMEED = 11596, + NPC_AGED_KODO = 4700, + NPC_DYING_KODO = 4701, + NPC_ANCIENT_KODO = 4702, + NPC_TAMED_KODO = 11627, + + SPELL_KODO_KOMBO_ITEM = 18153, + SPELL_KODO_KOMBO_PLAYER_BUFF = 18172, //spells here have unclear function, but using them at least for visual parts and checks + SPELL_KODO_KOMBO_DESPAWN_BUFF = 18377, + SPELL_KODO_KOMBO_GOSSIP = 18362 + +}; + +struct TRINITY_DLL_DECL npc_aged_dying_ancient_kodoAI : public ScriptedAI +{ + npc_aged_dying_ancient_kodoAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } + + uint32 m_uiDespawnTimer; + + void Reset() + { + m_uiDespawnTimer = 0; + } + + void MoveInLineOfSight(Unit* pWho) + { + if (pWho->GetEntry() == NPC_SMEED) + { + if (m_creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + return; + + if (m_creature->IsWithinDistInMap(pWho, 10.0f)) + { + switch(rand()%3) + { + case 0: DoScriptText(SAY_SMEED_HOME_1, pWho); break; + case 1: DoScriptText(SAY_SMEED_HOME_2, pWho); break; + case 2: DoScriptText(SAY_SMEED_HOME_3, pWho); break; + } + + //spell have no implemented effect (dummy), so useful to notify spellHit + m_creature->CastSpell(m_creature,SPELL_KODO_KOMBO_GOSSIP,true); + } + } + } + + void SpellHit(Unit* pCaster, SpellEntry const* pSpell) + { + if (pSpell->Id == SPELL_KODO_KOMBO_GOSSIP) + { + m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + m_uiDespawnTimer = 60000; + } + } + + void UpdateAI(const uint32 diff) + { + //timer should always be == 0 unless we already updated entry of creature. Then not expect this updated to ever be in combat. + if (m_uiDespawnTimer && m_uiDespawnTimer <= diff) + { + if (!m_creature->getVictim() && m_creature->isAlive()) + { + Reset(); + m_creature->setDeathState(JUST_DIED); + m_creature->Respawn(); + return; + } + } else m_uiDespawnTimer -= diff; + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_npc_aged_dying_ancient_kodo(Creature* pCreature) +{ + return new npc_aged_dying_ancient_kodoAI(pCreature); +} + +bool EffectDummyCreature_npc_aged_dying_ancient_kodo(Unit *pCaster, uint32 spellId, uint32 effIndex, Creature *pCreatureTarget) +{ + //always check spellid and effectindex + if (spellId == SPELL_KODO_KOMBO_ITEM && effIndex == 0) + { + //no effect if player/creature already have aura from spells + if (pCaster->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) || pCreatureTarget->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) + return true; + + if (pCreatureTarget->GetEntry() == NPC_AGED_KODO || + pCreatureTarget->GetEntry() == NPC_DYING_KODO || + pCreatureTarget->GetEntry() == NPC_ANCIENT_KODO) + { + pCaster->CastSpell(pCaster,SPELL_KODO_KOMBO_PLAYER_BUFF,true); + + pCreatureTarget->UpdateEntry(NPC_TAMED_KODO); + pCreatureTarget->CastSpell(pCreatureTarget,SPELL_KODO_KOMBO_DESPAWN_BUFF,false); + + if (pCreatureTarget->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) + pCreatureTarget->GetMotionMaster()->MoveIdle(); + + pCreatureTarget->GetMotionMaster()->MoveFollow(pCaster, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + } + + //always return true when we are handling this spell and effect + return true; + } + return false; +} + +bool GossipHello_npc_aged_dying_ancient_kodo(Player* pPlayer, Creature* pCreature) +{ + if (pPlayer->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) && pCreature->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) + { + //the expected quest objective + pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + + pPlayer->RemoveAurasDueToSpell(SPELL_KODO_KOMBO_PLAYER_BUFF); + pCreature->GetMotionMaster()->MoveIdle(); + } + + pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + return true; +} + +void AddSC_desolace() +{ + Script *newscript; + + newscript = new Script; + newscript->Name = "npc_aged_dying_ancient_kodo"; + newscript->GetAI = GetAI_npc_aged_dying_ancient_kodo; + newscript->pEffectDummyCreature = &EffectDummyCreature_npc_aged_dying_ancient_kodo; + newscript->pGossipHello = &GossipHello_npc_aged_dying_ancient_kodo; + newscript->RegisterSelf(); +} diff --git a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp index 51b22fd934a..d358fbc2a86 100644 --- a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp +++ b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp @@ -62,8 +62,10 @@ struct TRINITY_DLL_DECL npc_converted_sentryAI : public ScriptedAI if( Timer <= diff ) { uint32 i = urand(1,2); - if( i=1 ) DoScriptText(SAY_CONVERTED_1, m_creature); - else DoScriptText(SAY_CONVERTED_2, m_creature); + if( i==1 ) + DoScriptText(SAY_CONVERTED_1, m_creature); + else + DoScriptText(SAY_CONVERTED_2, m_creature); DoCast(m_creature, SPELL_CONVERT_CREDIT); if(m_creature->isPet()) diff --git a/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp b/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp index 563b4d64558..3182a56926c 100644 --- a/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp +++ b/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Stormwind_City SD%Complete: 100 -SDComment: Quest support: 1640, 1447, 4185, 11223. Receive emote General Marcus +SDComment: Quest support: 1640, 1447, 4185, 11223 SDCategory: Stormwind City EndScriptData */ @@ -25,7 +25,6 @@ EndScriptData */ npc_archmage_malin npc_bartleby npc_dashel_stonefist -npc_general_marcus_jonathan npc_lady_katrana_prestor EndContentData */ @@ -174,40 +173,6 @@ CreatureAI* GetAI_npc_dashel_stonefist(Creature* pCreature) } /*###### -## npc_general_marcus_jonathan -######*/ - -#define SAY_GREETING -1000005 - -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 (emote == TEXTEMOTE_SALUTE) - { - m_creature->SetOrientation(m_creature->GetAngle(player)); - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); - } - - if (emote == TEXTEMOTE_WAVE) - DoScriptText(SAY_GREETING, m_creature, player); - } - } -}; - -CreatureAI* GetAI_npc_general_marcus_jonathan(Creature* pCreature) -{ - return new npc_general_marcus_jonathanAI(pCreature); -} - -/*###### ## npc_lady_katrana_prestor ######*/ @@ -276,11 +241,6 @@ void AddSC_stormwind_city() newscript->RegisterSelf(); newscript = new Script; - newscript->Name = "npc_general_marcus_jonathan"; - newscript->GetAI = &GetAI_npc_general_marcus_jonathan; - newscript->RegisterSelf(); - - newscript = new Script; newscript->Name="npc_lady_katrana_prestor"; newscript->pGossipHello = &GossipHello_npc_lady_katrana_prestor; newscript->pGossipSelect = &GossipSelect_npc_lady_katrana_prestor; |