Changeset 271 for trunk

Show
Ignore:
Timestamp:
11/21/08 23:30:19 (17 years ago)
Author:
yumileroy
Message:

*script for quest Recharging the Batteries. By Anubisss.
*script for quest The Road to Falcon Watch. By neo0608.

Original author: megamage
Date: 2008-11-21 17:29:05-06:00

Location:
trunk
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp

    r260 r271  
    1818SDName: Hellfire_Peninsula 
    1919SD%Complete: 100 
    20 SDComment: Quest support: 10129, 10146, 10162, 10163, 10340, 10346, 10347, 10382 (Special flight paths) 
     20SDComment: Quest support: 9375, 10129, 10146, 10162, 10163, 10340, 10346, 10347, 10382 (Special flight paths) 
    2121SDCategory: Hellfire Peninsula 
    2222EndScriptData */ 
     
    2626npc_gryphoneer_windbellow 
    2727npc_wing_commander_brack 
     28npc_wounded_blood_elf 
    2829EndContentData */ 
    2930 
    3031#include "precompiled.h" 
     32#include "../../npc/npc_escortAI.h" 
    3133 
    3234/*###### 
     
    158160    } 
    159161    return true; 
     162} 
     163 
     164/*###### 
     165## npc_wounded_blood_elf 
     166######*/ 
     167 
     168#define QUEST_THE_ROAD_TO_FALCON_WATCH 9375 
     169#define SAY1      "Thank you for agreeing to help. Now, let's get out of here $N." 
     170#define SAY2      "Over there! They're following us!" 
     171#define SAY3      "Allow me a moment to rest. The journey taxes what little strength I have." 
     172#define SAY4      "Did you hear something?" 
     173#define SAY5      "Falcon Watch, at last! Now, where's my... Oh no! My pack, it's missing! Where has -" 
     174#define SAYAGGRO  "You won't keep me from getting to Falcon Watch!" 
     175 
     176struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI 
     177{ 
     178    npc_wounded_blood_elfAI(Creature *c) : npc_escortAI(c) {Reset();} 
     179 
     180    void WaypointReached(uint32 i) 
     181    { 
     182        Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); 
     183 
     184        if (!player) 
     185            return; 
     186 
     187        switch (i) 
     188        { 
     189 
     190        case 0: 
     191            DoSay(SAY1, LANG_UNIVERSAL, player); 
     192            // Change faction, so mobs can attack 
     193            m_creature->setFaction(1610); 
     194            break; 
     195 
     196        case 9: 
     197            DoSay(SAY2, LANG_UNIVERSAL, player); 
     198            // Spawn two Haal'eshi Talonguard 
     199            { 
     200                Creature* temp1 = m_creature->SummonCreature(16967, m_creature->GetPositionX()-15, m_creature->GetPositionY()-15, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000); 
     201                if (temp1) temp1->AI()->AttackStart(m_creature); 
     202                Creature* temp2 = m_creature->SummonCreature(16967, m_creature->GetPositionX()-17, m_creature->GetPositionY()-17, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000); 
     203                if (temp2) temp2->AI()->AttackStart(m_creature); 
     204            } 
     205            break; 
     206 
     207        case 13: 
     208            DoSay(SAY3, LANG_UNIVERSAL, player); 
     209            // NPC "should" kneel 
     210            m_creature->HandleEmoteCommand(EMOTE_STATE_KNEEL); 
     211            break; 
     212 
     213        case 14: 
     214            DoSay(SAY4, LANG_UNIVERSAL, player); 
     215            // Spawn two Haal'eshi Windwalker 
     216            { 
     217                Creature* temp3 = m_creature->SummonCreature(16966, m_creature->GetPositionX()-15, m_creature->GetPositionY()-15, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000); 
     218                if (temp3) temp3->AI()->AttackStart(m_creature); 
     219                Creature* temp4 = m_creature->SummonCreature(16966, m_creature->GetPositionX()-17, m_creature->GetPositionY()-17, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000); 
     220                if (temp4) temp4->AI()->AttackStart(m_creature); 
     221            } 
     222            break; 
     223 
     224        case 27: 
     225            DoSay(SAY5, LANG_UNIVERSAL, player); 
     226            // Set faction back to normal 
     227            m_creature->setFaction(1604); 
     228            // Award quest credit 
     229            if( PlayerGUID ) 
     230            { 
     231                Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); 
     232                if( player && player->GetTypeId() == TYPEID_PLAYER ) 
     233                    ((Player*)player)->GroupEventHappens(9375,m_creature); 
     234            } 
     235            break; 
     236        } 
     237    } 
     238 
     239    void Aggro(Unit* who) 
     240    { 
     241        DoSay(SAYAGGRO, LANG_UNIVERSAL, who); 
     242    } 
     243 
     244    void Reset() { } 
     245 
     246    void JustDied(Unit* killer) 
     247        // If NPC dies, Quest fail 
     248    { 
     249        if (PlayerGUID) 
     250        { 
     251            Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); 
     252            if (player) 
     253                ((Player*)player)->FailQuest(QUEST_THE_ROAD_TO_FALCON_WATCH); 
     254        } 
     255    } 
     256 
     257    void UpdateAI(const uint32 diff) 
     258    { 
     259        npc_escortAI::UpdateAI(diff); 
     260    } 
     261}; 
     262 
     263bool QuestAccept_wounded_blood_elf(Player* player, Creature* creature, Quest const* quest) 
     264// Begin the escort quest 
     265{ 
     266    if (quest->GetQuestId() == QUEST_THE_ROAD_TO_FALCON_WATCH) 
     267    { 
     268        ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); 
     269    } 
     270    return true; 
     271} 
     272 
     273CreatureAI* GetAI_npc_wounded_blood_elf(Creature *_Creature) 
     274{ 
     275    npc_wounded_blood_elfAI* thisAI = new npc_wounded_blood_elfAI(_Creature); 
     276 
     277    thisAI->AddWaypoint(0, -1137.72, 4272.10, 14.04, 3000); 
     278    thisAI->AddWaypoint(1, -1141.34, 4232.42, 14.63); 
     279    thisAI->AddWaypoint(2, -1133.47, 4220.88, 11.78); 
     280    thisAI->AddWaypoint(3, -1126.18, 4213.26, 13.51); 
     281    thisAI->AddWaypoint(4, -1100.12, 4204.32, 16.41); 
     282    thisAI->AddWaypoint(5, -1063.68, 4197.92, 15.51); 
     283    thisAI->AddWaypoint(6, -1027.28, 4194.36, 15.52); 
     284    thisAI->AddWaypoint(7, -995.68, 4189.59, 19.84); 
     285    thisAI->AddWaypoint(8, -970.90, 4188.60, 24.61); 
     286    thisAI->AddWaypoint(9, -961.93, 4193.34, 26.11, 80000); // Summon 1 
     287    thisAI->AddWaypoint(10, -935.52, 4210.99, 31.98); 
     288    thisAI->AddWaypoint(11, -913.42, 4218.27, 37.29); 
     289    thisAI->AddWaypoint(12, -896.53, 4207.73, 43.23); 
     290    thisAI->AddWaypoint(13, -868.49, 4194.77, 46.75, 17000); // Kneel and Rest Here 
     291    thisAI->AddWaypoint(14, -852.83, 4198.29, 47.28, 80000); // Summon 2 
     292    thisAI->AddWaypoint(15, -819.85, 4200.50, 46.37); 
     293    thisAI->AddWaypoint(16, -791.92, 4201.96, 44.19); 
     294    thisAI->AddWaypoint(17, -774.42, 4202.46, 47.41); 
     295    thisAI->AddWaypoint(18, -762.90, 4202.17, 48.81); 
     296    thisAI->AddWaypoint(19, -728.25, 4195.35, 50.68); 
     297    thisAI->AddWaypoint(20, -713.58, 4192.07, 53.98); 
     298    thisAI->AddWaypoint(21, -703.09, 4189.74, 56.96); 
     299    thisAI->AddWaypoint(22, -693.70, 4185.43, 57.06); 
     300    thisAI->AddWaypoint(23, -686.38, 4159.81, 60.26); 
     301    thisAI->AddWaypoint(24, -679.88, 4147.04, 64.20); 
     302    thisAI->AddWaypoint(25, -656.74, 4147.72, 64.11); 
     303    thisAI->AddWaypoint(26, -652.22, 4137.50, 64.58); 
     304    thisAI->AddWaypoint(27, -649.99, 4136.38, 64.63, 20000); // Award Quest Credit 
     305 
     306    return (CreatureAI*)thisAI; 
    160307} 
    161308 
     
    185332    newscript->pGossipSelect =  &GossipSelect_npc_wing_commander_brack; 
    186333    newscript->RegisterSelf(); 
    187 } 
     334         
     335    newscript = new Script; 
     336    newscript->Name="npc_wounded_blood_elf"; 
     337    newscript->GetAI = &GetAI_npc_wounded_blood_elf; 
     338    newscript->pQuestAccept = &QuestAccept_wounded_blood_elf; 
     339    newscript->RegisterSelf(); 
     340} 
  • trunk/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp

    r260 r271  
    391391 
    392392/*###### 
     393## mob_phase_hunter 
     394######*/ 
     395 
     396#define SUMMONED_MOB        19595 
     397#define EMOTE_WEAK          "is very weak" 
     398 
     399// Spells 
     400#define SPELL_PHASE_SLIP    36574 
     401#define SPELL_MANA_BURN     13321 
     402 
     403struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI 
     404{ 
     405 
     406    mob_phase_hunterAI(Creature *c) : ScriptedAI(c) {Reset();} 
     407     
     408    bool Weak; 
     409    int WeakPercent; 
     410    uint32 PlayerGUID; 
     411    uint32 Health; 
     412    uint32 Level; 
     413    uint32 PhaseSlipVulnerabilityTimer; 
     414    uint32 ManaBurnTimer; 
     415 
     416    void Reset() 
     417    { 
     418        Weak = false; 
     419        WeakPercent = 25 + (rand()%16); // 25-40 
     420        PlayerGUID = 0; 
     421        ManaBurnTimer = 5000 + (rand()%3 * 1000); // 5-8 sec cd 
     422    } 
     423 
     424    void Aggro(Unit *who) 
     425    { 
     426        PlayerGUID = who->GetGUID(); 
     427    } 
     428 
     429    void UpdateAI(const uint32 diff) 
     430    { 
     431 
     432        Player* target = NULL; 
     433        target = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID)); 
     434         
     435        if(!target) 
     436            return; 
     437 
     438        if(m_creature->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || m_creature->hasUnitState(UNIT_STAT_ROOT)) // if the mob is rooted/slowed by spells eg.: Entangling Roots, Frost Nova, Hamstring, Crippling Poison, etc. => remove it 
     439            DoCast(m_creature, SPELL_PHASE_SLIP); 
     440        if(ManaBurnTimer < diff) // cast Mana Burn 
     441        { 
     442            if(target->GetCreateMana() > 0) 
     443            { 
     444                DoCast(target, SPELL_MANA_BURN); 
     445                ManaBurnTimer = 8000 + (rand()%10 * 1000); // 8-18 sec cd 
     446            } 
     447        } 
     448        else ManaBurnTimer -= diff; 
     449 
     450        if(!Weak && m_creature->GetHealth() < (m_creature->GetMaxHealth() / 100 * WeakPercent) && target->GetQuestStatus(10190) == QUEST_STATUS_INCOMPLETE) // start: support for quest 10190 
     451        { 
     452            DoTextEmote(EMOTE_WEAK, 0); 
     453            Weak = true; 
     454        } 
     455        if(Weak && m_creature->HasAura(34219, 0)) 
     456        { 
     457            Health = m_creature->GetHealth(); // get the normal mob's data 
     458            Level = m_creature->getLevel(); 
     459 
     460            m_creature->AttackStop(); // delete the normal mob 
     461            m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); 
     462            m_creature->RemoveCorpse(); 
     463             
     464            Creature* DrainedPhaseHunter = NULL; 
     465             
     466            if(!DrainedPhaseHunter) 
     467                DrainedPhaseHunter = m_creature->SummonCreature(SUMMONED_MOB, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); // summon the mob 
     468             
     469            if(DrainedPhaseHunter) 
     470            { 
     471                DrainedPhaseHunter->SetLevel(Level); // set the summoned mob's data 
     472                DrainedPhaseHunter->SetHealth(Health); 
     473                DrainedPhaseHunter->AI()->AttackStart(target); 
     474            } 
     475        } // end: support for quest 10190 
     476    } 
     477 
     478}; 
     479 
     480CreatureAI* GetAI_mob_phase_hunter(Creature *_Creature) 
     481{ 
     482    return new mob_phase_hunterAI (_Creature); 
     483} 
     484 
     485/*###### 
    393486## 
    394487######*/ 
     
    419512    newscript->pGossipSelect =  &GossipSelect_npc_veronia; 
    420513    newscript->RegisterSelf(); 
    421 } 
     514 
     515    newscript = new Script; 
     516    newscript->Name = "mob_phase_hunter"; 
     517    newscript->GetAI = GetAI_mob_phase_hunter; 
     518    newscript->RegisterSelf(); 
     519}