--HG--
branch : trunk
This commit is contained in:
megamage
2009-06-16 00:07:17 -05:00
12 changed files with 2575 additions and 20 deletions

View File

@@ -0,0 +1,3 @@
-- Razorfen Kraul
UPDATE `instance_template` SET `script` = 'instance_razorfen_kraul' WHERE `map` = '47' LIMIT 1;
UPDATE `creature_template` SET `ScriptName` = 'npc_deaths_head_ward_keeper' WHERE `entry` = '4625' LIMIT 1;

View File

@@ -248,6 +248,8 @@ SET(trinityscript_LIB_SRCS
scripts/zone/orgrimmar/orgrimmar.cpp
scripts/zone/razorfen_downs/boss_amnennar_the_coldbringer.cpp
scripts/zone/razorfen_downs/razorfen_downs.cpp
scripts/zone/razorfen_kraul/def_razorfen_kraul.h
scripts/zone/razorfen_kraul/instance_razorfen_kraul.cpp
scripts/zone/razorfen_kraul/razorfen_kraul.cpp
scripts/zone/ruins_of_ahnqiraj/boss_ayamiss.cpp
scripts/zone/ruins_of_ahnqiraj/boss_buru.cpp

File diff suppressed because it is too large Load Diff

View File

@@ -834,6 +834,14 @@
RelativePath="..\scripts\zone\razorfen_kraul\razorfen_kraul.cpp"
>
</File>
<File
RelativePath="..\scripts\zone\razorfen_kraul\instance_razorfen_kraul.cpp"
>
</File>
<File
RelativePath="..\scripts\zone\razorfen_kraul\def_razorfen_kraul.h"
>
</File>
</Filter>
<Filter
Name="Ruins of Ahn&apos;Qiraj"

View File

@@ -833,6 +833,14 @@
RelativePath="..\scripts\zone\razorfen_kraul\razorfen_kraul.cpp"
>
</File>
<File
RelativePath="..\scripts\zone\razorfen_kraul\instance_razorfen_kraul.cpp"
>
</File>
<File
RelativePath="..\scripts\zone\razorfen_kraul\def_razorfen_kraul.h"
>
</File>
</Filter>
<Filter
Name="Ruins of Ahn&apos;Qiraj"

View File

@@ -0,0 +1,21 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* 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_KRAUL_H
#define DEF_RAZORFEN_KRAUL_H
#define TYPE_WARD_KEEPERS 1
#endif

View File

@@ -0,0 +1,119 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* 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: Instance_Razorfen_Kraul
SD%Complete:
SDComment:
SDCategory: Razorfen Kraul
EndScriptData */
#include "precompiled.h"
#include "def_razorfen_kraul.h"
#define WARD_KEEPERS_NR 2
struct TRINITY_DLL_DECL instance_razorfen_kraul : public ScriptedInstance
{
instance_razorfen_kraul(Map *map) : ScriptedInstance(map) {Initialize();};
uint64 DoorWardGUID;
uint32 WardCheck_Timer;
int WardKeeperAlive;
void Initialize()
{
WardKeeperAlive = 1;
WardCheck_Timer = 4000;
DoorWardGUID = 0;
}
Player* GetPlayerInMap()
{
Map::PlayerList const& players = instance->GetPlayers();
if (!players.isEmpty())
{
for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
if (Player* plr = itr->getSource())
return plr;
}
}
debug_log("TSCR: Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!");
return NULL;
}
void OnGameObjectCreate(GameObject *go, bool apply)
{
switch(go->GetEntry())
{
case 21099: DoorWardGUID = go->GetGUID(); break;
}
}
void HandleGameObject(uint64 guid, uint32 state)
{
Player *player = GetPlayerInMap();
if (!player || !guid)
{
debug_log("SD2: Instance Razorfen Kraul: HandleGameObject fail");
return;
}
if (GameObject *go = GameObject::GetGameObject(*player,guid))
go->SetGoState(GOState(state));
}
void Update(uint32 diff)
{
if (WardCheck_Timer < diff)
{
HandleGameObject(DoorWardGUID, WardKeeperAlive);
WardKeeperAlive = 0;
WardCheck_Timer = 4000;
}else
WardCheck_Timer -= diff;
}
void SetData(uint32 type, uint32 data)
{
switch(type)
{
case TYPE_WARD_KEEPERS:
if (data == NOT_STARTED)
WardKeeperAlive = 1;
break;
}
}
};
InstanceData* GetInstanceData_instance_razorfen_kraul(Map* map)
{
return new instance_razorfen_kraul(map);
}
void AddSC_instance_razorfen_kraul()
{
Script *newscript;
newscript = new Script;
newscript->Name = "instance_razorfen_kraul";
newscript->GetInstanceData = &GetInstanceData_instance_razorfen_kraul;
newscript->RegisterSelf();
}

View File

@@ -27,6 +27,7 @@ EndContentData */
#include "precompiled.h"
#include "../../npc/npc_escortAI.h"
#include "def_razorfen_kraul.h"
#define SAY_READY -1047000
#define SAY_POINT -10470001
@@ -42,10 +43,11 @@ EndContentData */
#define QUEST_WILLIX_THE_IMPORTER 1144
#define ENTRY_BOAR 4514
#define SPELL_QUILLBOAR_CHANNELING 7083
struct TRINITY_DLL_DECL npc_willixAI : public npc_escortAI
{
npc_willixAI(Creature *c) : npc_escortAI(c) {}
npc_willixAI(Creature *c) : npc_escortAI(c) {}
void WaypointReached(uint32 i)
{
@@ -137,6 +139,50 @@ bool QuestAccept_npc_willix(Player* player, Creature* creature, Quest const* que
return true;
}
struct TRINITY_DLL_DECL npc_deaths_head_ward_keeperAI : public ScriptedAI
{
npc_deaths_head_ward_keeperAI(Creature *c) : ScriptedAI(c)
{
pInstance = ((ScriptedInstance*)c->GetInstanceData());
Reset();
}
ScriptedInstance *pInstance;
uint32 QuillboarChanneling_Timer;
void Reset()
{
QuillboarChanneling_Timer = 1500;
}
void Aggro(Unit *who)
{
}
void UpdateAI(const uint32 diff)
{
if (!m_creature->isAlive())
return;
if (pInstance)
pInstance->SetData(TYPE_WARD_KEEPERS, NOT_STARTED);
if (QuillboarChanneling_Timer < diff)
{
if( m_creature->IsNonMeleeSpellCasted(false) )
m_creature->InterruptNonMeleeSpells(true);
DoCast(m_creature, SPELL_QUILLBOAR_CHANNELING);
QuillboarChanneling_Timer = 1100;
}else QuillboarChanneling_Timer -= diff;
}
};
CreatureAI* GetAI_npc_deaths_head_ward_keeper(Creature *_Creature)
{
return new npc_deaths_head_ward_keeperAI(_Creature);
}
CreatureAI* GetAI_npc_willix(Creature *_Creature)
{
npc_willixAI* thisAI = new npc_willixAI(_Creature);
@@ -201,5 +247,10 @@ void AddSC_razorfen_kraul()
newscript->GetAI = &GetAI_npc_willix;
newscript->pQuestAccept = &QuestAccept_npc_willix;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "npc_deaths_head_ward_keeper";
newscript->GetAI = &GetAI_npc_deaths_head_ward_keeper;
newscript->RegisterSelf();
}

View File

@@ -73,6 +73,7 @@ class ChatHandler
int ParseCommands(const char* text);
static ChatCommand* getCommandTable();
protected:
explicit ChatHandler() : m_session(NULL) {} // for CLI subclass
@@ -91,13 +92,11 @@ class ChatHandler
void SendGlobalSysMessage(const char *str);
void SendGlobalGMSysMessage(const char *str);
bool SetDataForCommandInTable(ChatCommand *table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand );
static bool SetDataForCommandInTable(ChatCommand *table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand );
bool ExecuteCommandInTable(ChatCommand *table, const char* text, const std::string& fullcommand);
bool ShowHelpForCommand(ChatCommand *table, const char* cmd);
bool ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd);
ChatCommand* getCommandTable();
bool HandleAccountCommand(const char* args);
bool HandleAccountCreateCommand(const char* args);
bool HandleAccountDeleteCommand(const char* args);

View File

@@ -3506,7 +3506,6 @@ bool ChatHandler::HandleCharacterRenameCommand(const char* args)
PSendSysMessage(LANG_RENAME_PLAYER, GetNameLink(target).c_str());
target->SetAtLoginFlag(AT_LOGIN_RENAME);
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '1' WHERE guid = '%u'", target->GetGUIDLow());
}
else
{

View File

@@ -44,6 +44,7 @@ trinityconfig
vmaps
ZThread
g3dlite
readline
${SCRIPT_LIB}
${MYSQL_LIBRARIES}
${POSTGRE_LIBS}

View File

@@ -38,6 +38,56 @@
#include "ScriptCalls.h"
#include "Util.h"
#if PLATFORM != WINDOWS
#include <readline/readline.h>
#include <readline/history.h>
char * command_finder(const char* text, int state)
{
static int idx,len;
const char* ret;
ChatCommand *cmd = ChatHandler::getCommandTable();
if(!state)
{
idx = 0;
len = strlen(text);
}
while(ret = cmd[idx].Name)
{
if(!cmd[idx].AllowConsole)
{
idx++;
continue;
}
idx++;
//printf("Checking %s \n", cmd[idx].Name);
if (strncmp(ret, text, len) == 0)
return strdup(ret);
if(cmd[idx].Name == NULL)
break;
}
return ((char*)NULL);
}
char ** cli_completion(const char * text, int start, int end)
{
char ** matches;
matches = (char**)NULL;
if(start == 0)
matches = rl_completion_matches((char*)text,&command_finder);
else
rl_bind_key('\t',rl_abort);
return (matches);
}
#endif
void utf8print(const char* str)
{
#if PLATFORM == PLATFORM_WINDOWS
@@ -325,10 +375,12 @@ void CliRunnable::run()
WorldDatabase.ThreadStart(); // let thread do safe mySQL requests
char commandbuf[256];
bool canflush = true;
///- Display the list of available CLI functions then beep
sLog.outString("");
#if PLATFORM != WINDOWS
rl_attempted_completion_function = cli_completion;
#endif
if(sConfig.GetBoolDefault("BeepAtStart", true))
printf("\a"); // \a = Alert
@@ -340,15 +392,16 @@ void CliRunnable::run()
while (!World::IsStopped())
{
fflush(stdout);
#ifdef linux
while (!kb_hit_return() && !World::IsStopped())
// With this, we limit CLI to 10commands/second
usleep(100);
if (World::IsStopped())
break;
#endif
char *command_str = fgets(commandbuf,sizeof(commandbuf),stdin);
if (command_str != NULL)
char *command_str ; // = fgets(commandbuf,sizeof(commandbuf),stdin);
#if PLATFORM == WINDOWS
command_str = fgets(commandbuf,sizeof(commandbuf),stdin);
#else
command_str = readline("TC>");
rl_bind_key('\t',rl_complete);
#endif
if (command_str != NULL)
{
for(int x=0;command_str[x];x++)
if(command_str[x]=='\r'||command_str[x]=='\n')
@@ -360,23 +413,32 @@ void CliRunnable::run()
if(!*command_str)
{
printf("TC>");
#if PLATFORM == WINDOWS
printf("TC>");
#endif
continue;
}
std::string command;
if(!consoleToUtf8(command_str,command)) // convert from console encoding to utf8
{
printf("TC>");
#if PLATFORM == WINDOWS
printf("TC>");
#endif
continue;
}
fflush(stdout);
#if PLATFORM != WINDOWS
sWorld.QueueCliCommand(&utf8print,command.c_str());
}
add_history(command.c_str());
#endif
}
else if (feof(stdin))
{
World::StopNow(SHUTDOWN_EXIT_CODE);
}
}
///- End the database thread