diff options
| author | megamage <none@none> | 2008-12-31 10:03:07 -0600 |
|---|---|---|
| committer | megamage <none@none> | 2008-12-31 10:03:07 -0600 |
| commit | ba58ddac9c302953fc15987bc84d5f858a011e56 (patch) | |
| tree | 5bafa1aa17b64d7e325a347f4538eb8402b222a3 /src/bindings/scripts | |
| parent | aa3b89d7764c093ba87ee2cf99775e3aedc37637 (diff) | |
| parent | 3885ce94d9be86616bb01e660a70087fcbfc6ffd (diff) | |
*Update to HG 730.
--HG--
branch : trunk
Diffstat (limited to 'src/bindings/scripts')
| -rw-r--r-- | src/bindings/scripts/ScriptMgr.cpp | 20 | ||||
| -rw-r--r-- | src/bindings/scripts/docs/Text-tables.txt | 1 | ||||
| -rw-r--r-- | src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp | 217 | ||||
| -rw-r--r-- | src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp | 28 |
4 files changed, 248 insertions, 18 deletions
diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 5d78d40030d..0dc71482df8 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -29,6 +29,7 @@ struct StringTextData uint32 SoundId; uint8 Type; uint32 Language; + uint32 Emote; }; // Enums used by StringTextData::Type @@ -654,7 +655,7 @@ void LoadDatabase() LoadTrinityStrings(TScriptDB,"eventai_texts",-1,1+(TEXT_SOURCE_RANGE)); // Gather Additional data from EventAI Texts - result = TScriptDB.PQuery("SELECT entry, sound, type, language FROM eventai_texts"); + result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM eventai_texts"); outstring_log("TSCR: Loading EventAI Texts additional data..."); if (result) @@ -672,6 +673,7 @@ void LoadDatabase() temp.SoundId = fields[1].GetInt32(); temp.Type = fields[2].GetInt32(); temp.Language = fields[3].GetInt32(); + temp.Emote = fields[4].GetInt32(); if (i >= 0) { @@ -736,6 +738,7 @@ void LoadDatabase() temp.SoundId = fields[1].GetInt32(); temp.Type = fields[2].GetInt32(); temp.Language = fields[3].GetInt32(); + temp.Emote = fields[4].GetInt32(); if (i >= 0) { @@ -782,7 +785,7 @@ void LoadDatabase() LoadTrinityStrings(TScriptDB,"custom_texts",TEXT_SOURCE_RANGE*2,1+(TEXT_SOURCE_RANGE*3)); // Gather Additional data from Custom Texts - result = TScriptDB.PQuery("SELECT entry, sound, type, language FROM custom_texts"); + result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM custom_texts"); outstring_log("TSCR: Loading Custom Texts additional data..."); if (result) @@ -800,6 +803,7 @@ void LoadDatabase() temp.SoundId = fields[1].GetInt32(); temp.Type = fields[2].GetInt32(); temp.Language = fields[3].GetInt32(); + temp.Emote = fields[4].GetInt32(); if (i >= 0) { @@ -1838,7 +1842,7 @@ void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target) return; } - debug_log("TSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u",textEntry,(*i).second.SoundId,(*i).second.Type,(*i).second.Language); + debug_log("TSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u",textEntry,(*i).second.SoundId,(*i).second.Type,(*i).second.Language,(*i).second.Emote); if((*i).second.SoundId) { @@ -1850,6 +1854,16 @@ void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target) error_log("TSCR: DoScriptText entry %i tried to process invalid sound id %u.",textEntry,(*i).second.SoundId); } + if((*i).second.Emote) + { + if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER) + { + ((Unit*)pSource)->HandleEmoteCommand((*i).second.Emote); + } + else + error_log("TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).",textEntry,pSource->GetTypeId()); + } + switch((*i).second.Type) { case CHAT_TYPE_SAY: diff --git a/src/bindings/scripts/docs/Text-tables.txt b/src/bindings/scripts/docs/Text-tables.txt index c335ce41d58..6db1ce9d852 100644 --- a/src/bindings/scripts/docs/Text-tables.txt +++ b/src/bindings/scripts/docs/Text-tables.txt @@ -37,6 +37,7 @@ content_loc8 This is the actual text presented in the Localization #8 C sound This value is the Sound ID that corresponds to the actual text used (Defined in SoundEntries.dbc). type Variables used to define type of text (Say/Yell/Textemote/Whisper). language This value is the Language that the text is native in (Defined in Languages.dbc). +emote Value from enum Emote (defined in Emotes.dbc). Only source of text will play this emote (not target, if target are defined in DoScriptText) comment This is a comment regarding the text entry (For ACID, accepted format is to use Creature ID of NPC using it). Note: Fields `content_loc1` to `content_loc8` are NULL values by default and are handled by seperate localization projects. diff --git a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp index 30292d37c72..bfd8a5d51ce 100644 --- a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp +++ b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp @@ -17,13 +17,15 @@ /* ScriptData SDName: Eversong_Woods SD%Complete: 100 -SDComment: Quest support: 8346, 8483 +SDComment: Quest support: 8346, 8483, 8488, 8490 SDCategory: Eversong Woods EndScriptData */ /* ContentData mobs_mana_tapped npc_prospector_anvilward +npc_apprentice_mirveda +npc_infused_crystal EndContentData */ #include "precompiled.h" @@ -547,6 +549,208 @@ bool GOHello_go_second_trial(Player *player, GameObject* _GO) return true; } +/*###### +## npc_apprentice_mirveda +######*/ + +#define QUEST_UNEXPECTED_RESULT 8488 +#define MOB_GHARZUL 15958 +#define MOB_ANGERSHADE 15656 + +struct TRINITY_DLL_DECL npc_apprentice_mirvedaAI : public ScriptedAI +{ + npc_apprentice_mirvedaAI(Creature* c) : ScriptedAI(c), Summons(m_creature) {Reset();} + + uint32 KillCount; + uint64 PlayerGUID; + bool Summon; + SummonList Summons; + + void Reset() + { + KillCount = 0; + PlayerGUID = 0; + Summons.DespawnAll(); + Summon = false; + } + + void Aggro(Unit* who){} + + void JustSummoned(Creature *summoned) + { + summoned->AI()->AttackStart(m_creature); + Summons.Summon(summoned); + } + + void SummonedCreatureDespawn(Creature* summoned) + { + Summons.Despawn(summoned); + ++KillCount; + } + + void JustDied(Unit* killer) + { + if (PlayerGUID) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if (player) + ((Player*)player)->FailQuest(QUEST_UNEXPECTED_RESULT); + } + } + + void UpdateAI(const uint32 diff) + { + if(KillCount >= 3) + { + if (PlayerGUID) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + ((Player*)player)->GroupEventHappens(QUEST_UNEXPECTED_RESULT, m_creature); + } + } + + if(Summon) + { + m_creature->SummonCreature(MOB_GHARZUL, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + m_creature->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + m_creature->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + Summon = false; + } + } +}; + +bool QuestAccept_npc_apprentice_mirveda(Player* player, Creature* creature, Quest const* quest) +{ + if (quest->GetQuestId() == QUEST_UNEXPECTED_RESULT) + { + ((npc_apprentice_mirvedaAI*)creature->AI())->Summon = true; + ((npc_apprentice_mirvedaAI*)creature->AI())->PlayerGUID = player->GetGUID(); + } + return true; +} + +CreatureAI* GetAI_npc_apprentice_mirvedaAI(Creature *_Creature) +{ + return new npc_apprentice_mirvedaAI (_Creature); +} + +/*###### +## npc_infused_crystal not working yet. +######*/ + +#define MOB_ENRAGED_WRAITH 17086 +#define EMOTE "releases the last of its energies into the nerarby runestone, succesfully reactivating it." +#define QUEST_POWERING_OUR_DEFENSES 8490 + +struct Location +{ + float x, y, z; +}; + +static Location SpawnLocations[]= +{ + {8270.68, -7188.53, 139.619}, + {8284.27, -7187.78, 139.603}, + {8297.43, -7193.53, 139.603}, + {8303.5, -7201.96, 139.577}, + {8273.22, -7241.82, 139.382}, + {8254.89, -7222.12, 139.603}, + {8278.51, -7242.13, 139.162}, + {8267.97, -7239.17, 139.517} +}; + +struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI +{ + npc_infused_crystalAI(Creature* c) : Scripted_NoMovementAI(c) {Reset();} + + uint32 EndTimer; + uint32 WaveTimer; + bool Completed; + bool Progress; + uint64 PlayerGUID; + + void Reset() + { + EndTimer = 0; + WaveTimer = 0; + PlayerGUID = 0; + Completed = false; + Progress = false; + } + + void Aggro(Unit* who){} + + void JustSummoned(Creature *summoned) + { + summoned->AI()->AttackStart(m_creature); + } + + void MoveInLineOfSight(Unit* who) + { + error_log("MoveLos"); + if( who->GetTypeId() == TYPEID_PLAYER && !m_creature->canStartAttack(who) ) + { + error_log("TypeId check"); + if( ((Player*)who)->GetQuestStatus(QUEST_POWERING_OUR_DEFENSES) == QUEST_STATUS_INCOMPLETE ) + { + error_log("Queststaus"); + float Radius = 10.0; + if( m_creature->IsWithinDistInMap(who, Radius) ) + { + PlayerGUID = who->GetGUID(); + WaveTimer = 1000; + EndTimer = 60000; + Progress = true; + error_log("Event started"); + } + } + } + } + + void JustDied(Unit* killer) + { + if (PlayerGUID && !Completed) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if (player) + ((Player*)player)->FailQuest(QUEST_POWERING_OUR_DEFENSES); + } + } + + void UpdateAI(const uint32 diff) + { + if(EndTimer < diff && Progress) + { + DoTextEmote(EMOTE, NULL); + Completed = true; + if (PlayerGUID) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + ((Player*)player)->GroupEventHappens(QUEST_POWERING_OUR_DEFENSES, m_creature); + } + m_creature->DealDamage(m_creature,m_creature->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->RemoveCorpse(); + error_log("EndTimer done"); + }else EndTimer -= diff; + + if(WaveTimer < diff && !Completed && Progress) + { + uint32 ran = rand()%8; + DoSpawnCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran].x, SpawnLocations[ran].y, SpawnLocations[ran].z, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + DoSpawnCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran].x, SpawnLocations[ran].y, SpawnLocations[ran].z, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + DoSpawnCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran].x, SpawnLocations[ran].y, SpawnLocations[ran].z, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + WaveTimer = 30000; + error_log("Wave summon"); + }else WaveTimer -= diff; + } +}; + + +CreatureAI* GetAI_npc_infused_crystalAI(Creature *_Creature) +{ + return new npc_infused_crystalAI (_Creature); +} + void AddSC_eversong_woods() { Script *newscript; @@ -579,4 +783,15 @@ void AddSC_eversong_woods() newscript->Name="go_second_trial"; newscript->pGOHello = &GOHello_go_second_trial; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_apprentice_mirveda"; + newscript->GetAI = &GetAI_npc_apprentice_mirvedaAI; + newscript->pQuestAccept = &QuestAccept_npc_apprentice_mirveda; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_infused_crystal"; + newscript->GetAI = &GetAI_npc_infused_crystalAI; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp index ca9c9c6bf44..b38e21687da 100644 --- a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp +++ b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp @@ -131,13 +131,13 @@ bool GOHello_gilded_brazier(Player *player, GameObject* _GO) ## npc_ranger_lilatha ######*/ -#define SAY_START "Let's go." -#define SAY_PROGRESS1 "$N, let's use the antechamber to the right." -#define SAY_PROGRESS2 "I can see the light at the end of the tunnel!" -#define SAY_PROGRESS3 "There's Farstrider Enclave now, $C. Not far to go... Look out! Troll ambush!!" -#define SAY_END1 "Thank you for saving my life and bringing me back to safety, $N" -#define SAY_END2 "Captain Helios, I've been rescued from the Amani Catacombs. Reporting for duty, sir!" -#define CAPTAIN_ANSWER "Liatha, get someone to look at those injuries. Thank you for bringing her back safely." +#define SAY_START -1000140 +#define SAY_PROGRESS1 -1000141 +#define SAY_PROGRESS2 -1000142 +#define SAY_PROGRESS3 -1000143 +#define SAY_END1 -1000144 +#define SAY_END2 -1000145 +#define SAY_CAPTAIN_ANSWER -1000146 #define QUEST_ESCAPE_FROM_THE_CATACOMBS 9212 #define GO_CAGE 181152 @@ -164,18 +164,18 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI GameObject* Cage = FindGameObject(GO_CAGE); if(Cage) Cage->SetGoState(0); - DoSay(SAY_START, LANG_UNIVERSAL, player); + DoScriptText(SAY_START, m_creature, player); break; } case 5: - DoSay(SAY_PROGRESS1, LANG_UNIVERSAL, player); break; + DoScriptText(SAY_PROGRESS1, m_creature, player); case 11: - DoSay(SAY_PROGRESS2, LANG_UNIVERSAL, player); + DoScriptText(SAY_PROGRESS2, m_creature, player); m_creature->SetOrientation(4.762841); break; case 18: { - DoSay(SAY_PROGRESS3, LANG_UNIVERSAL, player); + DoScriptText(SAY_PROGRESS3, m_creature, player); Creature* Summ1 = m_creature->SummonCreature(16342, 7627.083984, -7532.538086, 152.128616, 1.082733, TEMPSUMMON_DEAD_DESPAWN, 0); Creature* Summ2 = m_creature->SummonCreature(16343, 7620.432129, -7532.550293, 152.454865, 0.827478, TEMPSUMMON_DEAD_DESPAWN, 0); Summ1->Attack(m_creature, true); @@ -193,14 +193,14 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI break; case 32: m_creature->SetOrientation(2.978281); - DoSay(SAY_END1, LANG_UNIVERSAL, player); + DoScriptText(SAY_END1, m_creature, player); break; case 33: m_creature->SetOrientation(5.858011); - DoSay(SAY_END2, LANG_UNIVERSAL, player); + DoScriptText(SAY_END2, m_creature, player); Unit* CaptainHelios = FindCreature(NPC_CAPTAIN_HELIOS, 50); if(CaptainHelios) - ((Creature*)CaptainHelios)->Say(CAPTAIN_ANSWER, LANG_UNIVERSAL, PlayerGUID); + DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, player); break; } } |
