diff options
Diffstat (limited to 'src/scripts')
| -rw-r--r-- | src/scripts/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/scripts/kalimdor/razorfen_downs/instance_razorfen_downs.cpp | 215 | ||||
| -rw-r--r-- | src/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp | 80 | ||||
| -rw-r--r-- | src/scripts/kalimdor/razorfen_downs/razorfen_downs.h | 45 | 
4 files changed, 342 insertions, 0 deletions
diff --git a/src/scripts/CMakeLists.txt b/src/scripts/CMakeLists.txt index 6fc29306a27..a94f6daafa2 100644 --- a/src/scripts/CMakeLists.txt +++ b/src/scripts/CMakeLists.txt @@ -253,6 +253,8 @@ SET(scripts_STAT_SRCS     kalimdor/onyxias_lair/boss_onyxia.cpp     kalimdor/razorfen_downs/boss_amnennar_the_coldbringer.cpp     kalimdor/razorfen_downs/razorfen_downs.cpp +   kalimdor/razorfen_downs/instance_razorfen_downs.cpp +   kalimdor/razorfen_downs/razorfen_downs.h     kalimdor/razorfen_kraul/razorfen_kraul.h     kalimdor/razorfen_kraul/instance_razorfen_kraul.cpp     kalimdor/razorfen_kraul/razorfen_kraul.cpp diff --git a/src/scripts/kalimdor/razorfen_downs/instance_razorfen_downs.cpp b/src/scripts/kalimdor/razorfen_downs/instance_razorfen_downs.cpp new file mode 100644 index 00000000000..8ac8073e1f1 --- /dev/null +++ b/src/scripts/kalimdor/razorfen_downs/instance_razorfen_downs.cpp @@ -0,0 +1,215 @@ +/* + * Copyright (C) 2010 Trinity <http://www.trinitycore.org/> + * + * 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 + */ + +#include "ScriptedPch.h" +#include "razorfen_downs.h" + +#define    MAX_ENCOUNTER  1 + +struct instance_razorfen_downs : public ScriptedInstance +{ +    instance_razorfen_downs(Map* pMap) : ScriptedInstance(pMap) +    { +        Initialize(); +    }; + +    uint64 uiGongGUID; + +    uint32 m_auiEncounter[MAX_ENCOUNTER]; + +    uint8 uiGongWaves; + +    std::string str_data; + +    void Initialize() +    { +        uiGongGUID = 0; + +        uiGongWaves = 0; + +        memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); +    } + +    std::string GetSaveData() +    { +        OUT_SAVE_INST_DATA; + +        std::ostringstream saveStream; + +        saveStream << "T C " << m_auiEncounter[0] +            << " " << uiGongWaves; + +        str_data = saveStream.str(); + +        OUT_SAVE_INST_DATA_COMPLETE; +        return str_data; +    } + +    void Load(const char* in) +    { +        if (!in) +        { +            OUT_LOAD_INST_DATA_FAIL; +            return; +        } + +        OUT_LOAD_INST_DATA(in); + +        char dataHead1, dataHead2; +        uint16 data0, data1; + +        std::istringstream loadStream(in); +        loadStream >> dataHead1 >> dataHead2 >> data0 >> data1; + +        if (dataHead1 == 'T' && dataHead2 == 'C') +        { +            m_auiEncounter[0] = data0; + +            for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) +                if (m_auiEncounter[i] == IN_PROGRESS) +                    m_auiEncounter[i] = NOT_STARTED; + +            uiGongWaves = data1; +        } else OUT_LOAD_INST_DATA_FAIL; + +        OUT_LOAD_INST_DATA_COMPLETE; +    } + +    void OnGameObjectCreate(GameObject* pGo, bool bAdd) +    { +        switch(pGo->GetEntry()) +        { +            case GO_GONG: +                uiGongGUID = pGo->GetGUID(); +                if (m_auiEncounter[0] == DONE) +                    pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); +                break; +            default: +                break; +        } +    } + +    void SetData(uint32 uiType, uint32 uiData) +    { +        if (uiType == DATA_GONG_WAVES) +        { +            uiGongWaves = uiData; +             +            switch(uiGongWaves) +            { +                case 9: +                case 14: +                    if (GameObject* pGo = instance->GetGameObject(uiGongGUID)) +                        pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); +                    break; +                case 1: +                case 10: +                case 16: +                { +                    GameObject* pGo = instance->GetGameObject(uiGongGUID); + +                    if (!pGo) +                        return; + +                    pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); +                     +                    uint32 uiCreature = 0; +                    uint8 uiSummonTimes = 0; +                     +                    switch(uiGongWaves) +                    { +                        case 1: +                            uiCreature = CREATURE_TOMB_FIEND; +                            uiSummonTimes = 7; +                            break; +                        case 10: +                            uiCreature = CREATURE_TOMB_REAVER; +                            uiSummonTimes = 3; +                            break; +                        case 16: +                            uiCreature = CREATURE_TUTEN_KASH; +                            break; +                        default: +                            break; +                    } +                     + +                    if (Creature* pCreature = pGo->SummonCreature(uiCreature,2502.635,844.140,46.896,0.633)) +                    { +                        if (uiGongWaves == 10 || uiGongWaves == 1) +                        { +                            for (uint8 i = 0; i < uiSummonTimes; ++i) +                            { +                                if (Creature* pSummon = pGo->SummonCreature(uiCreature,2502.635 + float(irand(-5,5)),844.140 + float(irand(-5,5)),46.896,0.633)) +                                    pSummon->GetMotionMaster()->MovePoint(0,2533.479 + float(irand(-5,5)),870.020 + float(irand(-5,5)),47.678); +                            } +                        } +                        pCreature->GetMotionMaster()->MovePoint(0,2533.479 + float(irand(-5,5)),870.020 + float(irand(-5,5)),47.678); +                    } +                    break; +                } +                default: +                    break; +            } +        } + +        if (uiType == BOSS_TUTEN_KASH) +        { +            m_auiEncounter[0] = uiData; + +            if (uiData == DONE) +                SaveToDB(); +        } +    } + +    uint32 GetData(uint32 uiType) +    { +        switch(uiType) +        { +            case DATA_GONG_WAVES: +                return uiGongWaves; +        } + +        return 0; +    } + +    uint64 GetData64(uint32 uiType) +    { +        switch(uiType) +        { +            case DATA_GONG: return uiGongGUID; +        } + +        return 0; +    } +}; + +InstanceData* GetInstanceData_instance_razorfen_downs(Map* pMap) +{ +    return new instance_razorfen_downs(pMap); +} + +void AddSC_instance_razorfen_downs() +{ +    Script* newscript; + +    newscript = new Script; +    newscript->Name = "instance_razorfen_downs"; +    newscript->GetInstanceData = &GetInstanceData_instance_razorfen_downs; +    newscript->RegisterSelf(); +} diff --git a/src/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp b/src/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp index 7160524ff65..d8ffb63a3a7 100644 --- a/src/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp +++ b/src/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp @@ -26,6 +26,7 @@ npc_henry_stern  EndContentData */  #include "ScriptedPch.h" +#include "razorfen_downs.h"  /*###  # npc_henry_stern @@ -73,6 +74,75 @@ bool GossipSelect_npc_henry_stern (Player* pPlayer, Creature* pCreature, uint32      return true;  } +/*###### +## go_gong +######*/ + +bool GOHello_go_gong(Player* pPlayer, GameObject* pGO) +{ +    //basic support, not blizzlike data is missing... +    ScriptedInstance* pInstance = pGO->GetInstanceData(); + +    if (pInstance) +    { +        pInstance->SetData(DATA_GONG_WAVES,pInstance->GetData(DATA_GONG_WAVES)+1); +        return true; +    } + +    return false; +} + +enum eTombCreature +{ +    SPELL_WEB                   = 745 +}; + +struct npc_tomb_creatureAI : public ScriptedAI +{ +    npc_tomb_creatureAI(Creature* pCreature) : ScriptedAI(pCreature) +    { +        pInstance = pCreature->GetInstanceData(); +    } + +    ScriptedInstance* pInstance; + +    uint32 uiWebTimer; + +    void Reset() +    { +        uiWebTimer = urand(5000,8000); +    } + +    void UpdateAI(const uint32 uiDiff) +    { +        if (!UpdateVictim()) +            return; +         +        //from acid +        if (m_creature->GetEntry() == CREATURE_TOMB_REAVER) +        { +            if (uiWebTimer <= uiDiff) +            { +                DoCast(m_creature->getVictim(), SPELL_WEB); +                uiWebTimer = urand(7000,16000); +            } else uiWebTimer -= uiDiff; +        } + +        DoMeleeAttackIfReady(); +    } + +    void JustDied(Unit* pKiller) +    { +        if (pInstance) +            pInstance->SetData(DATA_GONG_WAVES,pInstance->GetData(DATA_GONG_WAVES)+1); +    } +}; + +CreatureAI* GetAI_npc_tomb_creature(Creature* pCreature) +{ +    return new npc_tomb_creatureAI (pCreature); +} +  void AddSC_razorfen_downs()  {      Script* newscript; @@ -82,4 +152,14 @@ void AddSC_razorfen_downs()      newscript->pGossipHello = &GossipHello_npc_henry_stern;      newscript->pGossipSelect = &GossipSelect_npc_henry_stern;      newscript->RegisterSelf(); + +    newscript = new Script; +    newscript->Name = "go_gong"; +    newscript->pGOHello =           &GOHello_go_gong; +    newscript->RegisterSelf(); + +    newscript = new Script; +    newscript->Name = "npc_tomb_creature"; +    newscript->GetAI = &GetAI_npc_tomb_creature; +    newscript->RegisterSelf();  } diff --git a/src/scripts/kalimdor/razorfen_downs/razorfen_downs.h b/src/scripts/kalimdor/razorfen_downs/razorfen_downs.h new file mode 100644 index 00000000000..d1c95d3f305 --- /dev/null +++ b/src/scripts/kalimdor/razorfen_downs/razorfen_downs.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 Trinity <http://www.trinitycore.org/> + * + * 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 + */ + +#ifndef DEF_RAZORFEN_DOWNS_H +#define DEF_RAZORFEN_DOWNS_H + +enum eData +{ +    BOSS_TUTEN_KASH, +    DATA_GONG_WAVES +}; + +enum eData64 +{ +    DATA_GONG +}; + +enum eGameObject +{ +	GO_GONG										= 148917 +}; + +enum eCreature +{ +    CREATURE_TOMB_FIEND                         = 7349, +    CREATURE_TOMB_REAVER                        = 7351, +    CREATURE_TUTEN_KASH                         = 7355 +}; + +#endif  | 
