Ru-MaNGOS

Ru-MaNGOS (http://mangos.ytdb.ru/index.php)
-   Скрипты (http://mangos.ytdb.ru/forumdisplay.php?f=19)
-   -   [dev]Icecrown Citadel Quest (http://mangos.ytdb.ru/showthread.php?t=5097)

Mayss 03.10.2011 10:13

[dev]Icecrown Citadel Quest
 
Вложений: 1
Реализация скрипта задания, позже выложу всех остальных.

Код:

/* Copyright (C) 2006 - 2011 ScriptDev2 <http://www.scriptdev2.com/>
 * 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: Icecrown_Quests
SD%Complete: 10
SDComment: Quest support:
SDCategory: Icecrown Citadel Quests[Raid]
EndScriptData */

/* ContentData
npc_quest_raid_sylvana_icc
npc_quest_raid_uther_38608
npc_quest_raid_jaina_38606
npc_quest_raid_darion_mogrine_38610
EndContentData */

#include "precompiled.h"
#include "icecrown_citadel.h"

/*#####
# pc_quest_raid_sylvana_icc
#####*/

//[17376]Lady Sylvanas Windrunner says: So, it is done.
//[17377]Lady Sylvanas Windrunner says: I had not dared to trust my senses - too many times has the Lich King made me to be a fool.
//[17378]Lady Sylvanas Windrunner says: Finally, he has been made to pay for the atrocities he imposed upon my people.
//[17379]Lady Sylvanas Windrunner says: May Azeroth never fail to remember the terrible price we paid for our weakness... for our pride.
//[17380]Lady Sylvanas Windrunner says: But what now, hero? What of those freed from his grasp, but still shackled to their mortal coils?
//[17381]Lady Sylvanas Windrunner says: Leave me.
//[17382]Lady Sylvanas Windrunner says: I have much to ponder.

enum
{
        QUEST_FROM_VENGEANCE    = 24918,      //Sylvanas' Vengeance http://www.wowhead.com/quest=24918

        SAY_QUEST_DIALOGE_1      = -1580108,  //17376
        SAY_QUEST_DIALOGE_2      = -1580109,  //17377
        SAY_QUEST_DIALOGE_3      = -1580110,  //17378
        SAY_QUEST_DIALOGE_4      = -1580111,  //17379
        SAY_QUEST_DIALOGE_5      = -1580112,  //17380
        SAY_QUEST_DIALOGE_6      = -1580113,  //17381
        SAY_QUEST_DIALOGE_7      = -1580114    //17382
};

struct MANGOS_DLL_DECL npc_quest_raid_sylvana_iccAI : public ScriptedAI
{
    npc_quest_raid_sylvana_iccAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }

        bool m_bVengeanceEvent;

        uint32 m_uiDialogeTimer;
        uint32 m_uiDialogeEvent;

        void Reset()
        {
                m_bVengeanceEvent = false;

                m_uiDialogeTimer = 0;
                m_uiDialogeEvent = 0;
        }

    void UpdateAI(const uint32 uiDiff)
        {
                if (m_bVengeanceEvent)
                {
                        if (m_uiDialogeTimer < uiDiff)
                        {
                                switch (m_uiDialogeEvent)
                                {
                                case 0:
                                        DoScriptText(SAY_QUEST_DIALOGE_1, m_creature);
                                        m_uiDialogeTimer = 2500;
                                        ++m_uiDialogeEvent;
                                        break;
                                case 1:
                                        DoScriptText(SAY_QUEST_DIALOGE_2, m_creature);
                                        m_uiDialogeTimer = 12500;
                                        ++m_uiDialogeEvent;
                                        break;
                                case 2:
                                        DoScriptText(SAY_QUEST_DIALOGE_3, m_creature);
                                        m_uiDialogeTimer = 11000;
                                        ++m_uiDialogeEvent;
                                        break;
                                case 3:
                                        DoScriptText(SAY_QUEST_DIALOGE_4, m_creature);
                                        m_uiDialogeTimer = 13000;
                                        ++m_uiDialogeEvent;
                                        break;
                                case 4:
                                        DoScriptText(SAY_QUEST_DIALOGE_5, m_creature);
                                        m_uiDialogeTimer = 13500;
                                        ++m_uiDialogeEvent;
                                        break;
                                case 5:
                                        DoScriptText(SAY_QUEST_DIALOGE_6, m_creature);
                                        m_uiDialogeTimer = 2500;
                                        ++m_uiDialogeEvent;
                                        break;
                                case 6:
                                        DoScriptText(SAY_QUEST_DIALOGE_7, m_creature);
                                        m_uiDialogeTimer = 3500;
                                        ++m_uiDialogeEvent;
                                        break;
                                default:
                                        break;
                                }
                        }else
                                m_uiDialogeTimer -= uiDiff;
                }
        }
};

CreatureAI* GetAI_npc_quest_raid_sylvana_icc(Creature* pCreature)
{
    return new npc_quest_raid_sylvana_iccAI(pCreature);
}

bool QuestRewarded_npc_quest_raid_sylvana_icc(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
    if (pQuest->GetQuestId() == QUEST_FROM_VENGEANCE)
    {
        if (npc_quest_raid_sylvana_iccAI* pSylvanaAI = dynamic_cast<npc_quest_raid_sylvana_iccAI*>(pCreature->AI()))
                        pSylvanaAI->m_bVengeanceEvent = true;
    }
    return true;
}

void AddSC_icecrown_quests()
{
    Script *newscript;

    newscript = new Script;
    newscript->Name = "npc_quest_raid_sylvana_icc";
    newscript->GetAI = &GetAI_npc_quest_raid_sylvana_icc;
        newscript->pQuestRewardedNPC = &QuestRewarded_npc_quest_raid_sylvana_icc;
    newscript->RegisterSelf();
};

SQL.
Код:

-- Icecrown Citadel Raid Quest
DELETE FROM `script_texts` WHERE `entry` BETWEEN -1580108 AND -1580114;
INSERT INTO `script_texts` (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES
-- Lady Sylvanas Windrunner
(-1580108,'So, it is done.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17376,1,0,0,'Sylvana SAY_QUEST_DIALOGE_1'),
(-1580109,'I had not dared to trust my senses - too many times has the Lich King made me to be a fool.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17377,1,0,0,'Sylvana SAY_QUEST_DIALOGE_2'),
(-1580110,'Finally, he has been made to pay for the atrocities he imposed upon my people.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17378,1,0,0,'Sylvana SAY_QUEST_DIALOGE_3'),
(-1580111,'May Azeroth never fail to remember the terrible price we paid for our weakness... for our pride.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17379,1,0,0,'Sylvana SAY_QUEST_DIALOGE_4'),
(-1580112,'But what now, hero? What of those freed from his grasp, but still shackled to their mortal coils?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17380,1,0,0,'Sylvana SAY_QUEST_DIALOGE_5'),
(-1580113,'Leave me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17381,1,0,0,'Sylvana SAY_QUEST_DIALOGE_6'),
(-1580114,'I have much to ponder.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17382,1,0,0,'Sylvana SAY_QUEST_DIALOGE_7');


MaxXx2021 03.10.2011 18:30

Код:

/* Copyright (C) 2006 - 2011 ScriptDev2 <http://www.scriptdev2.com/>
 * 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: Icecrown_Quests
SD%Complete: 10
SDComment: Quest support:
SDCategory: Icecrown Citadel Quests[Raid]
EndScriptData */

/* ContentData
npc_quest_raid_sylvana_icc
npc_quest_raid_uther_38608
npc_quest_raid_jaina_38606
npc_quest_raid_darion_mogrine_38610
EndContentData */

#include "precompiled.h"
#include "icecrown_citadel.h"

/*#####
# pc_quest_raid_sylvana_icc
#####*/

//[17376]Lady Sylvanas Windrunner says: So, it is done.
//[17377]Lady Sylvanas Windrunner says: I had not dared to trust my senses - too many times has the Lich King made me to be a fool.
//[17378]Lady Sylvanas Windrunner says: Finally, he has been made to pay for the atrocities he imposed upon my people.
//[17379]Lady Sylvanas Windrunner says: May Azeroth never fail to remember the terrible price we paid for our weakness... for our pride.
//[17380]Lady Sylvanas Windrunner says: But what now, hero? What of those freed from his grasp, but still shackled to their mortal coils?
//[17381]Lady Sylvanas Windrunner says: Leave me.
//[17382]Lady Sylvanas Windrunner says: I have much to ponder.

enum
{
    QUEST_FROM_VENGEANCE    = 24918,      //Sylvanas' Vengeance http://www.wowhead.com/quest=24918

    SAY_QUEST_DIALOGE_1      = -1580108,  //17376
    SAY_QUEST_DIALOGE_2      = -1580109,  //17377
    SAY_QUEST_DIALOGE_3      = -1580110,  //17378
    SAY_QUEST_DIALOGE_4      = -1580111,  //17379
    SAY_QUEST_DIALOGE_5      = -1580112,  //17380
    SAY_QUEST_DIALOGE_6      = -1580113,  //17381
    SAY_QUEST_DIALOGE_7      = -1580114    //17382
};

struct MANGOS_DLL_DECL npc_quest_raid_sylvana_iccAI : public ScriptedAI
{
    npc_quest_raid_sylvana_iccAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }

    uint32 m_uiDialogeTimer;
    uint32 m_uiDialogeEvent;

    void Reset()
    {
        m_uiDialogeTimer = 0;
        m_uiDialogeEvent = 0;
    }

    void SylvanaEvent()
    {
        switch (m_uiDialogeEvent)
        {
            case 0:
                DoScriptText(SAY_QUEST_DIALOGE_1, m_creature);
                m_uiDialogeTimer = 2500;
                ++m_uiDialogeEvent;
                break;
            case 1:
                DoScriptText(SAY_QUEST_DIALOGE_2, m_creature);
                m_uiDialogeTimer = 12500;
                ++m_uiDialogeEvent;
                break;
            case 2:
                DoScriptText(SAY_QUEST_DIALOGE_3, m_creature);
                m_uiDialogeTimer = 11000;
                ++m_uiDialogeEvent;
                break;
            case 3:
                DoScriptText(SAY_QUEST_DIALOGE_4, m_creature);
                m_uiDialogeTimer = 13000;
                ++m_uiDialogeEvent;
                break;
            case 4:
                DoScriptText(SAY_QUEST_DIALOGE_5, m_creature);
                m_uiDialogeTimer = 13500;
                ++m_uiDialogeEvent;
                break;
            case 5:
                DoScriptText(SAY_QUEST_DIALOGE_6, m_creature);
                m_uiDialogeTimer = 2500;
                ++m_uiDialogeEvent;
                break;
            case 6:
                DoScriptText(SAY_QUEST_DIALOGE_7, m_creature);
                Reset();
                break;
            default:
                Reset();
                break;
        }
    }

    void UpdateAI(const uint32 uiDiff)
    {
        if (m_uiDialogeTimer)
        {
            if (m_uiDialogeTimer <= uiDiff)
                SylvanaEvent();
            else
                m_uiDialogeTimer -= uiDiff;
        }
    }
};

CreatureAI* GetAI_npc_quest_raid_sylvana_icc(Creature* pCreature)
{
    return new npc_quest_raid_sylvana_iccAI(pCreature);
}

bool QuestRewarded_npc_quest_raid_sylvana_icc(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
    if (pQuest->GetQuestId() == QUEST_FROM_VENGEANCE)
    {
        if (npc_quest_raid_sylvana_iccAI* pSylvanaAI = dynamic_cast<npc_quest_raid_sylvana_iccAI*>(pCreature->AI()))
        {
            if (!pSylvanaAI->m_uiDialogeTimer)
                pSylvanaAI->m_uiDialogeTimer = 500;
        }
    }
    return true;
}

void AddSC_icecrown_quests()
{
    Script *pNewScript;

    pNewScript = new Script;
    pNewScript->Name = "npc_quest_raid_sylvana_icc";
    pNewScript->GetAI = &GetAI_npc_quest_raid_sylvana_icc;
    pNewScript->pQuestRewardedNPC = &QuestRewarded_npc_quest_raid_sylvana_icc;
    pNewScript->RegisterSelf();
};

Сделал по стандарту, убрал кое что лишнее. Поправил не возможность повторного проигрывания эвента.

П.С. отключите у себя табуляцию и соблюдайте стиль написания отступайте 4 пробела.

Sar 03.10.2011 19:46

Код:

-- Icecrown Citadel Raid Quest
DELETE FROM `script_texts` WHERE `entry` BETWEEN -1580108 AND -1580114;
INSERT INTO `script_texts` (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES
-- Lady Sylvanas Windrunner
(-1580108,'So, it is done.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Итак, все кончено.',17376,1,0,0,'Sylvana SAY_QUEST_DIALOGE_1'),
(-1580109,'I had not dared to trust my senses - too many times has the Lich King made me to be a fool.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Я чувствовала, но не могла поверить - слишком часто Король-лич оставлял меня в дураках.',17377,1,0,0,'Sylvana SAY_QUEST_DIALOGE_2'),
(-1580110,'Finally, he has been made to pay for the atrocities he imposed upon my people.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Наконец-то он поплатился за все страдания, на которые он обрек мой народ.',17378,1,0,0,'Sylvana SAY_QUEST_DIALOGE_3'),
(-1580111,'May Azeroth never fail to remember the terrible price we paid for our weakness... for our pride.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Пускай же грядущие поколения всегда помнят, какова цена слабости... цена гордыни.',17379,1,0,0,'Sylvana SAY_QUEST_DIALOGE_4'),
(-1580112,'But what now, hero? What of those freed from his grasp, but still shackled to their mortal coils?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Но что будет с теми, кто освободившись от его власти, остаются узниками своих бренных тел?',17380,1,0,0,'Sylvana SAY_QUEST_DIALOGE_5'),
(-1580113,'Leave me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Оставь меня.',17381,1,0,0,'Sylvana SAY_QUEST_DIALOGE_6'),
(-1580114,'I have much to ponder.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Мне нужно о многом подумать.',17382,1,0,0,'Sylvana SAY_QUEST_DIALOGE_7');

Можно и руссик сразу ;)

Vinolentus 03.10.2011 23:17

А зачем? Это можно сделать без сд2, см. quest_end_scripts
https://gist.github.com/1260363

MaxXx2021 04.10.2011 07:00

Цитата:

Сообщение от Vinolentus (Сообщение 25380)
А зачем? Это можно сделать без сд2, см. quest_end_scripts
https://gist.github.com/1260363

Ну человек хочет потренироваться на С++! :)

Mayss 04.10.2011 16:51

Цитата:

Сообщение от Sar (Сообщение 25377)
Можно и руссик сразу ;)

Sar а есть русский и на других? или он уже есть в русской локализации SD2, не смотрел если честно :mda:


Текущее время: 13:59. Часовой пояс GMT +3.

ru-mangos.ru - Русское сообщество MaNGOS