2009-02-17 18:08:26 +01:00
|
|
|
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
|
2008-10-21 13:19:26 -05:00
|
|
|
* 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
|
|
|
|
|
*/
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
/* ScriptData
|
|
|
|
|
SDName: Zulaman
|
|
|
|
|
SD%Complete: 90
|
|
|
|
|
SDComment: Forest Frog will turn into different NPC's. Workaround to prevent new entry from running this script
|
|
|
|
|
SDCategory: Zul'Aman
|
|
|
|
|
EndScriptData */
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
/* ContentData
|
|
|
|
|
npc_forest_frog
|
|
|
|
|
EndContentData */
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-01-19 11:36:05 +01:00
|
|
|
#include "ScriptedPch.h"
|
2009-10-22 12:51:05 +02:00
|
|
|
#include "zulaman.h"
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
/*######
|
|
|
|
|
## npc_forest_frog
|
|
|
|
|
######*/
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
#define SPELL_REMOVE_AMANI_CURSE 43732
|
|
|
|
|
#define SPELL_PUSH_MOJO 43923
|
|
|
|
|
#define ENTRY_FOREST_FROG 24396
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-02-05 00:31:28 +01:00
|
|
|
struct npc_forest_frogAI : public ScriptedAI
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
|
|
|
|
npc_forest_frogAI(Creature* c) : ScriptedAI(c)
|
2009-02-04 10:33:18 -06:00
|
|
|
{
|
2009-06-16 11:45:33 -05:00
|
|
|
pInstance = c->GetInstanceData();
|
2008-10-21 13:19:26 -05:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
ScriptedInstance *pInstance;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-18 16:07:41 -07:00
|
|
|
void Reset() {}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-18 16:07:41 -07:00
|
|
|
void EnterCombat(Unit *who) {}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
void DoSpawnRandom()
|
|
|
|
|
{
|
2009-08-14 00:02:13 +02:00
|
|
|
if (pInstance)
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
|
|
|
|
uint32 cEntry = 0;
|
|
|
|
|
switch(rand()%11)
|
|
|
|
|
{
|
|
|
|
|
case 0: cEntry = 24024; break; //Kraz
|
|
|
|
|
case 1: cEntry = 24397; break; //Mannuth
|
|
|
|
|
case 2: cEntry = 24403; break; //Deez
|
|
|
|
|
case 3: cEntry = 24404; break; //Galathryn
|
|
|
|
|
case 4: cEntry = 24405; break; //Adarrah
|
|
|
|
|
case 5: cEntry = 24406; break; //Fudgerick
|
|
|
|
|
case 6: cEntry = 24407; break; //Darwen
|
|
|
|
|
case 7: cEntry = 24445; break; //Mitzi
|
|
|
|
|
case 8: cEntry = 24448; break; //Christian
|
|
|
|
|
case 9: cEntry = 24453; break; //Brennan
|
|
|
|
|
case 10: cEntry = 24455; break; //Hollee
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-08-14 00:02:13 +02:00
|
|
|
if (!pInstance->GetData(TYPE_RAND_VENDOR_1))
|
|
|
|
|
if (rand()%10 == 1) cEntry = 24408; //Gunter
|
|
|
|
|
if (!pInstance->GetData(TYPE_RAND_VENDOR_2))
|
|
|
|
|
if (rand()%10 == 1) cEntry = 24409; //Kyren
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-08-14 00:02:13 +02:00
|
|
|
if (cEntry) m_creature->UpdateEntry(cEntry);
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-08-14 00:02:13 +02:00
|
|
|
if (cEntry == 24408) pInstance->SetData(TYPE_RAND_VENDOR_1,DONE);
|
|
|
|
|
if (cEntry == 24409) pInstance->SetData(TYPE_RAND_VENDOR_2,DONE);
|
2008-10-21 13:19:26 -05:00
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
void SpellHit(Unit *caster, const SpellEntry *spell)
|
|
|
|
|
{
|
2009-08-14 00:02:13 +02:00
|
|
|
if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->GetTypeId() == TYPEID_PLAYER && m_creature->GetEntry() == ENTRY_FOREST_FROG)
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
|
|
|
|
//increase or decrease chance of mojo?
|
2009-11-11 13:47:21 -08:00
|
|
|
if (rand()%99 == 50) DoCast(caster, SPELL_PUSH_MOJO, true);
|
2008-10-21 13:19:26 -05:00
|
|
|
else DoSpawnRandom();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2009-08-14 00:39:07 +02:00
|
|
|
CreatureAI* GetAI_npc_forest_frog(Creature* pCreature)
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
2009-08-14 00:39:07 +02:00
|
|
|
return new npc_forest_frogAI (pCreature);
|
2008-10-21 13:19:26 -05:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
/*######
|
|
|
|
|
## npc_zulaman_hostage
|
|
|
|
|
######*/
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
#define GOSSIP_HOSTAGE1 "I am glad to help you."
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-12-02 18:12:39 -06:00
|
|
|
static uint32 HostageEntry[] = {23790, 23999, 24024, 24001};
|
|
|
|
|
static uint32 ChestEntry[] = {186648, 187021, 186672, 186667};
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-02-05 00:31:28 +01:00
|
|
|
struct npc_zulaman_hostageAI : public ScriptedAI
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
|
|
|
|
npc_zulaman_hostageAI(Creature *c) : ScriptedAI(c) {IsLoot = false;}
|
|
|
|
|
bool IsLoot;
|
|
|
|
|
uint64 PlayerGUID;
|
|
|
|
|
void Reset() {}
|
2009-04-27 21:23:42 -05:00
|
|
|
void EnterCombat(Unit *who) {}
|
2009-06-04 17:42:48 -05:00
|
|
|
void JustDied(Unit* who)
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
2009-08-14 00:02:13 +02:00
|
|
|
Player* pPlayer = Unit::GetPlayer(PlayerGUID);
|
|
|
|
|
if (pPlayer) pPlayer->SendLoot(m_creature->GetGUID(), LOOT_CORPSE);
|
2008-10-21 13:19:26 -05:00
|
|
|
}
|
|
|
|
|
void UpdateAI(const uint32 diff)
|
|
|
|
|
{
|
2009-11-11 13:47:21 -08:00
|
|
|
if (IsLoot)
|
|
|
|
|
DoCast(m_creature, 7, false);
|
2008-10-21 13:19:26 -05:00
|
|
|
}
|
|
|
|
|
};
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-08-14 00:39:07 +02:00
|
|
|
bool GossipHello_npc_zulaman_hostage(Player* pPlayer, Creature* pCreature)
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
2009-08-14 00:02:13 +02:00
|
|
|
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HOSTAGE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
|
2009-12-20 13:35:08 +02:00
|
|
|
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
|
2008-10-21 13:19:26 -05:00
|
|
|
return true;
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-08-15 00:32:04 +02:00
|
|
|
bool GossipSelect_npc_zulaman_hostage(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
2009-08-15 00:32:04 +02:00
|
|
|
if (uiAction == GOSSIP_ACTION_INFO_DEF + 1)
|
2009-08-14 00:02:13 +02:00
|
|
|
pPlayer->CLOSE_GOSSIP_MENU();
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-08-14 00:39:07 +02:00
|
|
|
if (!pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
|
2008-10-21 13:19:26 -05:00
|
|
|
return true;
|
2009-08-14 00:39:07 +02:00
|
|
|
pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-08-22 03:05:26 +02:00
|
|
|
ScriptedInstance* pInstance = pCreature->GetInstanceData();
|
2009-08-14 00:02:13 +02:00
|
|
|
if (pInstance)
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
2008-12-02 18:12:39 -06:00
|
|
|
//uint8 progress = pInstance->GetData(DATA_CHESTLOOTED);
|
2008-10-21 13:19:26 -05:00
|
|
|
pInstance->SetData(DATA_CHESTLOOTED, 0);
|
|
|
|
|
float x, y, z;
|
2009-08-14 00:39:07 +02:00
|
|
|
pCreature->GetPosition(x, y, z);
|
|
|
|
|
uint32 entry = pCreature->GetEntry();
|
2009-10-17 16:20:24 -07:00
|
|
|
for (uint8 i = 0; i < 4; ++i)
|
2008-12-02 18:12:39 -06:00
|
|
|
{
|
2009-08-14 00:02:13 +02:00
|
|
|
if (HostageEntry[i] == entry)
|
2008-12-02 18:12:39 -06:00
|
|
|
{
|
2009-08-14 00:39:07 +02:00
|
|
|
pCreature->SummonGameObject(ChestEntry[i], x-2, y, z, 0, 0, 0, 0, 0, 0);
|
2008-12-02 18:12:39 -06:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-08-14 00:39:07 +02:00
|
|
|
/*Creature* summon = pCreature->SummonCreature(HostageInfo[progress], x-2, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 0);
|
2009-08-14 00:02:13 +02:00
|
|
|
if (summon)
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
2009-08-14 00:02:13 +02:00
|
|
|
CAST_AI(npc_zulaman_hostageAI, summon->AI())->PlayerGUID = pPlayer->GetGUID();
|
2009-06-04 17:03:43 -05:00
|
|
|
CAST_AI(npc_zulaman_hostageAI, summon->AI())->IsLoot = true;
|
2008-10-21 13:19:26 -05:00
|
|
|
summon->SetDisplayId(10056);
|
|
|
|
|
summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
|
|
|
|
summon->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
2008-12-02 18:12:39 -06:00
|
|
|
}*/
|
2008-10-21 13:19:26 -05:00
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-08-14 00:39:07 +02:00
|
|
|
CreatureAI* GetAI_npc_zulaman_hostage(Creature* pCreature)
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
2009-08-14 00:39:07 +02:00
|
|
|
return new npc_zulaman_hostageAI(pCreature);
|
2008-10-21 13:19:26 -05:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
void AddSC_zulaman()
|
|
|
|
|
{
|
|
|
|
|
Script *newscript;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
newscript = new Script;
|
2009-10-17 04:23:24 -07:00
|
|
|
newscript->Name = "npc_forest_frog";
|
2008-12-22 23:11:25 +01:00
|
|
|
newscript->GetAI = &GetAI_npc_forest_frog;
|
2008-11-20 16:16:57 -06:00
|
|
|
newscript->RegisterSelf();
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
newscript = new Script;
|
|
|
|
|
newscript->Name = "npc_zulaman_hostage";
|
2008-12-22 23:11:25 +01:00
|
|
|
newscript->GetAI = &GetAI_npc_zulaman_hostage;
|
|
|
|
|
newscript->pGossipHello = &GossipHello_npc_zulaman_hostage;
|
|
|
|
|
newscript->pGossipSelect = &GossipSelect_npc_zulaman_hostage;
|
2008-11-20 16:16:57 -06:00
|
|
|
newscript->RegisterSelf();
|
2008-10-21 13:19:26 -05:00
|
|
|
}
|
2009-02-17 20:07:49 -06:00
|
|
|
|