Permalink
Browse files

Added: support for scripted Areatrigger. Requires Mangos rev.6673++

git-svn-id: https://scriptdev2.svn.sourceforge.net/svnroot/scriptdev2@665 5f9c896b-1e26-0410-94da-f77f675e2462
  • Loading branch information...
nofantasy
nofantasy committed Sep 26, 2008
1 parent c0b0613 commit e6ebfcf848d5fb57bf76ec42811418aff1026be6
Showing with 73 additions and 11 deletions.
  1. +1 −0 Makefile.am
  2. +11 −7 ScriptMgr.cpp
  3. +2 −1 ScriptMgr.h
  4. +5 −1 VC71/71ScriptDev2.vcproj
  5. +5 −1 VC80/80ScriptDev2.vcproj
  6. +5 −1 VC90/90ScriptDev2.vcproj
  7. +44 −0 scripts/areatrigger/areatrigger_scripts.cpp
View
@@ -39,6 +39,7 @@ include/sc_gossip.h \
include/sc_grid_searchers.h \
include/sc_instance.h \
include/sc_item.h \
+scripts/areatrigger/areatrigger_scripts.cpp \
scripts/boss/boss_emeriss.cpp \
scripts/boss/boss_lethon.cpp \
scripts/boss/boss_taerar.cpp \
View
@@ -7,6 +7,7 @@
#include "ProgressBar.h"
#include "Database/DBCStores.h"
#include "Database/DatabaseMysql.h"
+#include "ObjectMgr.h"
#include "config.h"
#include "scripts/creature/mob_event_ai.h"
@@ -78,7 +79,8 @@ void FillSpellSummary();
// -- Scripts to be added --
-// -- Area --
+// -- Areatrigger --
+extern void AddSC_areatrigger_scripts();
// -- Boss --
extern void AddSC_boss_emeriss();
@@ -1180,7 +1182,8 @@ void ScriptsInit()
// -- Scripts to be added --
- // -- Area --
+ // -- Areatrigger --
+ AddSC_areatrigger_scripts();
// -- Boss --
AddSC_boss_emeriss();
@@ -1892,6 +1895,9 @@ void ProcessScriptText(uint32 id, WorldObject* pSource, Unit* target)
Script* GetScriptByName(std::string Name)
{
+ if(Name.empty())
+ return NULL;
+
for(int i=0;i<MAX_SCRIPTS;i++)
{
if( m_scripts[i] && m_scripts[i]->Name == Name )
@@ -2048,16 +2054,14 @@ bool GOChooseReward( Player *player, GameObject *_GO, Quest const *_Quest, uint3
}
MANGOS_DLL_EXPORT
-bool AreaTrigger( Player *player, Quest const *_Quest, uint32 triggerID )
+bool AreaTrigger( Player *player, AreaTriggerEntry * atEntry)
{
Script *tmpscript = NULL;
- // TODO: load a script name for the areatriggers
- //tmpscript = GetScriptByName();
+ tmpscript = GetScriptByName(GetAreaTriggerScriptNameById(atEntry->id));
if(!tmpscript || !tmpscript->pAreaTrigger) return false;
- player->PlayerTalkClass->ClearMenus();
- return tmpscript->pAreaTrigger(player,_Quest,triggerID);
+ return tmpscript->pAreaTrigger(player, atEntry);
}
MANGOS_DLL_EXPORT
View
@@ -6,6 +6,7 @@
#define SCRIPTMGR_H
#include "Common.h"
+#include "../shared/Database/DBCStructure.h"
class Player;
class Creature;
@@ -50,7 +51,7 @@ uint32 (*pGODialogStatus )(Player *player, GameObject * _GO );
bool (*pChooseReward )(Player*, Creature*, Quest const*, uint32 );
bool (*pItemHello )(Player*, Item*, Quest const* );
bool (*pGOHello )(Player*, GameObject* );
-bool (*pAreaTrigger )(Player*, Quest const*, uint32 );
+bool (*pAreaTrigger )(Player*, AreaTriggerEntry* );
bool (*pItemQuestAccept )(Player*, Item *, Quest const* );
bool (*pGOQuestAccept )(Player*, GameObject*, Quest const* );
bool (*pGOChooseReward )(Player*, GameObject*_GO, Quest const*, uint32 );
View
@@ -231,8 +231,12 @@
</File>
</Filter>
<Filter
- Name="area"
+ Name="areatrigger"
>
+ <File
+ RelativePath="..\scripts\areatrigger\areatrigger_scripts.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="go"
View
@@ -470,8 +470,12 @@
</File>
</Filter>
<Filter
- Name="area"
+ Name="areatrigger"
>
+ <File
+ RelativePath="..\scripts\areatrigger\areatrigger_scripts.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="go"
View
@@ -469,8 +469,12 @@
</File>
</Filter>
<Filter
- Name="area"
+ Name="areatrigger"
>
+ <File
+ RelativePath="..\scripts\areatrigger\areatrigger_scripts.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="go"
@@ -0,0 +1,44 @@
+/* Copyright (C) 2006 - 2008 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: Areatrigger_Scripts
+SD%Complete: 100
+SDComment: Scripts for areatriggers
+SDCategory: Areatrigger
+EndScriptData */
+
+/* ContentData
+at_test script test only
+EndContentData */
+
+#include "precompiled.h"
+
+bool ATtest(Player *player, AreaTriggerEntry *at)
+{
+ player->Say("Hi!",LANG_UNIVERSAL);
+ return true;
+}
+
+void AddSC_areatrigger_scripts()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="at_test";
+ newscript->pAreaTrigger = ATtest;
+ m_scripts[nrscripts++] = newscript;
+}

0 comments on commit e6ebfcf

Please sign in to comment.