diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/bindings/scripts/Makefile.am | 2 | ||||
| -rw-r--r-- | src/bindings/scripts/VC71/71ScriptDev2.vcproj | 8 | ||||
| -rw-r--r-- | src/bindings/scripts/VC80/80ScriptDev2.vcproj | 8 | ||||
| -rw-r--r-- | src/bindings/scripts/VC90/90ScriptDev2.vcproj | 8 | ||||
| -rw-r--r-- | src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp | 582 | ||||
| -rw-r--r-- | src/bindings/scripts/scripts/zone/blackrock_depths/def_blackrock_depths.h | 35 | ||||
| -rw-r--r-- | src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp | 238 | ||||
| -rw-r--r-- | src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp | 213 | ||||
| -rw-r--r-- | src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp | 74 | ||||
| -rw-r--r-- | src/game/Chat.cpp | 19 | ||||
| -rw-r--r-- | src/game/Chat.h | 4 | ||||
| -rw-r--r-- | src/game/Language.h | 6 | ||||
| -rw-r--r-- | src/game/Level1.cpp | 36 | ||||
| -rw-r--r-- | src/game/Level3.cpp | 118 | ||||
| -rw-r--r-- | src/game/World.cpp | 71 | ||||
| -rw-r--r-- | src/game/World.h | 2 | 
16 files changed, 1362 insertions, 62 deletions
diff --git a/src/bindings/scripts/Makefile.am b/src/bindings/scripts/Makefile.am index 991a575704a..2789b2a51b7 100644 --- a/src/bindings/scripts/Makefile.am +++ b/src/bindings/scripts/Makefile.am @@ -100,6 +100,8 @@ scripts/zone/black_temple/def_black_temple.h \  scripts/zone/black_temple/illidari_council.cpp \  scripts/zone/black_temple/instance_black_temple.cpp \  scripts/zone/blackrock_depths/blackrock_depths.cpp \ +scripts/zone/blackrock_depths/instance_blackrock_depths.cpp \ +scripts/zone/blackrock_depths/def_blackrock_depths.h \  scripts/zone/blackrock_depths/boss_ambassador_flamelash.cpp \  scripts/zone/blackrock_depths/boss_angerrel.cpp \  scripts/zone/blackrock_depths/boss_anubshiah.cpp \ diff --git a/src/bindings/scripts/VC71/71ScriptDev2.vcproj b/src/bindings/scripts/VC71/71ScriptDev2.vcproj index 91606be6e0e..8eb464b81c8 100644 --- a/src/bindings/scripts/VC71/71ScriptDev2.vcproj +++ b/src/bindings/scripts/VC71/71ScriptDev2.vcproj @@ -2085,6 +2085,14 @@  						>  					</File>  					<File +						RelativePath="..\scripts\zone\blackrock_depths\def_blackrock_depths.h" +						> +					</File> +					<File +						RelativePath="..\scripts\zone\blackrock_depths\instance_blackrock_depths.cpp" +						> +					</File> +					<File  						RelativePath="..\scripts\zone\blackrock_depths\boss_ambassador_flamelash.cpp"  						>  					</File> diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index c6f4bea7154..f07fc80900e 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -2262,6 +2262,14 @@  						>  					</File>  					<File +						RelativePath="..\scripts\zone\blackrock_depths\def_blackrock_depths.h" +						> +					</File> +					<File +						RelativePath="..\scripts\zone\blackrock_depths\instance_blackrock_depths.cpp" +						> +					</File> +					<File  						RelativePath="..\scripts\zone\blackrock_depths\boss_ambassador_flamelash.cpp"  						>  					</File> diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj index 101f967c012..613ba6fa3c8 100644 --- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj +++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj @@ -2318,6 +2318,14 @@  						RelativePath="..\scripts\zone\blackrock_depths\boss_vilerel.cpp"  						>  					</File> +					<File +						RelativePath="..\scripts\zone\blackrock_depths\def_blackrock_depths.h" +						> +					</File> +					<File +						RelativePath="..\scripts\zone\blackrock_depths\instance_blackrock_depths.cpp" +						> +					</File>  				</Filter>  				<Filter  					Name="Loch Modan" diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp index 04e14a2efd3..08afd55c98b 100644 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp +++ b/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp @@ -28,6 +28,9 @@ npc_lokhtos_darkbargainer  EndContentData */  #include "precompiled.h" +#include "../../npc/npc_escortAI.h" +#include "def_blackrock_depths.h" +#include "GameObject.h"  /*######  ## mob_phalanx @@ -211,6 +214,560 @@ bool GossipSelect_npc_lokhtos_darkbargainer(Player *player, Creature *_Creature,  }  /*###### +## npc_dughal_stormwing +######*/ + +#define QUEST_JAIL_BREAK		4322 +#define SAY_DUGHAL_FREE			"Thank you, $N! I'm free!!!" +#define GOSSIP_DUGHAL			"You're free, Dughal! Get out of here!" + +ScriptedInstance *pInstance; + +struct TRINITY_DLL_DECL npc_dughal_stormwingAI : public npc_escortAI +{ +    npc_dughal_stormwingAI(Creature *c) : npc_escortAI(c) { Reset(); } + +    void WaypointReached(uint32 i) +    { +	switch(i) +		{ +		case 0:m_creature->Say(SAY_DUGHAL_FREE, LANG_UNIVERSAL, PlayerGUID); break; +		case 1:pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; +		case 2: +			m_creature->SetVisibility(VISIBILITY_OFF); +			m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +			m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); +			pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); +			break; +		} +	} + +    void Aggro(Unit* who) { } +	void Reset() {} + +    void JustDied(Unit* killer) +    { +        if (IsBeingEscorted && killer == m_creature) +        { +			m_creature->SetVisibility(VISIBILITY_OFF); +			m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +			m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); +			pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); +        } +    } + +    void UpdateAI(const uint32 diff) +    { +		if(pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; +		if( (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_ENDED ) +		{ +			m_creature->SetVisibility(VISIBILITY_OFF); +			m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +			m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); +		} +		else +		{ +			m_creature->SetVisibility(VISIBILITY_ON); +			m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +			m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); +		} +		npc_escortAI::UpdateAI(diff); +    } +}; +CreatureAI* GetAI_npc_dughal_stormwing(Creature *_Creature) +{     +    npc_dughal_stormwingAI* dughal_stormwingAI = new npc_dughal_stormwingAI(_Creature); + +    dughal_stormwingAI->AddWaypoint(0, 280.42,-82.86, -77.12,0); +    dughal_stormwingAI->AddWaypoint(1, 287.64,-87.01, -76.79,0); +    dughal_stormwingAI->AddWaypoint(2, 354.63,-64.95, -67.53,0); +    return (CreatureAI*)dughal_stormwingAI; +} +bool GossipHello_npc_dughal_stormwing(Player *player, Creature *_Creature) +{ +  	if(player->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS ) +    { +        player->ADD_GOSSIP_ITEM(0, GOSSIP_DUGHAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + 		player->SEND_GOSSIP_MENU(2846, _Creature->GetGUID()); +    } +    return true; +} + +bool GossipSelect_npc_dughal_stormwing(Player *player, Creature *_Creature, uint32 sender, uint32 action ) +{ +    if (action == GOSSIP_ACTION_INFO_DEF + 1) +    { +        player->CLOSE_GOSSIP_MENU(); +        ((npc_escortAI*)(_Creature->AI()))->Start(false, false, true, player->GetGUID()); +		_Creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); +		pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); +    } +    return true; +} + +/*###### +## npc_marshal_windsor +######*/ + +#define SAY_WINDSOR_AGGRO1			"You locked up the wrong Marshal. Prepare to be destroyed!" +#define SAY_WINDSOR_AGGRO2			"I bet you're sorry now, aren't you !?!!" +#define SAY_WINDSOR_AGGRO3			"You better hold me back $N or they are going to feel some prison house beatings." +#define SAY_WINDSOR_1				"Let's get a move on. My gear should be in the storage area up this way..." +#define SAY_WINDSOR_4_1				"Check that cell, $N. If someone is alive in there, we need to get them out." +#define SAY_WINDSOR_4_2				"Get him out of there!" +#define SAY_WINDSOR_4_3				"Good work! We're almost there, $N. This way." +#define SAY_WINDSOR_6				"This is it, $N. My stuff should be in that room. Cover me, I'm going in!" +#define SAY_WINDSOR_9				"Ah, there it is!" +#define MOB_ENTRY_REGINALD_WINDSOR	9682     + +Player* PlayerStart; + +struct TRINITY_DLL_DECL npc_marshal_windsorAI : public npc_escortAI +{ +	npc_marshal_windsorAI(Creature *c) : npc_escortAI(c)  +	{  +		pInstance = ((ScriptedInstance*)c->GetInstanceData()); +		Reset();  +	} +	   +	void WaypointReached(uint32 i) +    { +	switch( i ) +        { +		case 1: +			m_creature->Say(SAY_WINDSOR_1, LANG_UNIVERSAL, PlayerGUID); +			break; +		case 7: +			m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); +			m_creature->Say(SAY_WINDSOR_4_1, LANG_UNIVERSAL, PlayerGUID); +			IsOnHold=true; +			break; +		case 10: +			m_creature->setFaction(534); +			break; +		case 12: +			m_creature->Say(SAY_WINDSOR_6, LANG_UNIVERSAL, PlayerGUID); +			pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_IN_PROGRESS); +			break; +		case 13: +			m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING);/*EMOTE_STATE_WORK*/ +			break; +		case 14: +			pInstance->SetData(DATA_GATE_SR,0); +			m_creature->setFaction(11); +			break; +		case 16: +			m_creature->Say(SAY_WINDSOR_9, LANG_UNIVERSAL, PlayerGUID);  +			break; +		case 17:  +			m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING);/*EMOTE_STATE_WORK*/ +			break; +		case 18: +			pInstance->SetData(DATA_GATE_SC,0); +			break; +		case 19: +			m_creature->SetVisibility(VISIBILITY_OFF); +			m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +			m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); +			m_creature->SummonCreature(MOB_ENTRY_REGINALD_WINDSOR,403.61,-51.71,-63.92,3.600434,TEMPSUMMON_DEAD_DESPAWN ,0); +			pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_ENDED); +			break; +		} +	} + +    void Aggro(Unit* who)  +		{ +		switch(rand()%3) +			{ +			case 0:m_creature->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID);break; +			case 1:m_creature->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID);break; +			case 2:m_creature->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID);break; +			} +		} + +    void Reset() {} + +	void JustDied(Unit *slayer) +    { +		pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); +    } + +    void UpdateAI(const uint32 diff) +    { +		if(pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; +		if(pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) +			IsOnHold = false; +		if(!pInstance->GetData(DATA_GATE_D) && pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_NOT_STARTED ) +			{ +			m_creature->Say(SAY_WINDSOR_4_2, LANG_UNIVERSAL, PlayerGUID);     +			pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_BEFORE_START); +			}	 +		if( pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED ) +			{ +			m_creature->Say(SAY_WINDSOR_4_3, LANG_UNIVERSAL, PlayerGUID); +			pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED); +			} +		if( (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_SUPPLY_ROOM) == ENCOUNTER_STATE_ENDED ) +		{ +			m_creature->SetVisibility(VISIBILITY_OFF); +			m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +			m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); +		} +		else +		{ +			m_creature->SetVisibility(VISIBILITY_ON); +			m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +			m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); +		} +		npc_escortAI::UpdateAI(diff); +    } +}; +CreatureAI* GetAI_npc_marshal_windsor(Creature *_Creature) +{     +    npc_marshal_windsorAI* marshal_windsorAI = new npc_marshal_windsorAI(_Creature); +    marshal_windsorAI->AddWaypoint(0, 316.336,-225.528, -77.7258,7000); +    marshal_windsorAI->AddWaypoint(1, 316.336,-225.528, -77.7258,2000); +	marshal_windsorAI->AddWaypoint(2, 322.96,-207.13, -77.87,0); +    marshal_windsorAI->AddWaypoint(3, 281.05,-172.16, -75.12,0); +    marshal_windsorAI->AddWaypoint(4, 272.19,-139.14, -70.61,0); +    marshal_windsorAI->AddWaypoint(5, 283.62,-116.09, -70.21,0); +    marshal_windsorAI->AddWaypoint(6, 296.18,-94.30, -74.08,0); +    marshal_windsorAI->AddWaypoint(7, 294.57,-93.11, -74.08,0); +    marshal_windsorAI->AddWaypoint(8, 314.31,-74.31, -76.09,0); +    marshal_windsorAI->AddWaypoint(9, 360.22,-62.93, -66.77,0); +    marshal_windsorAI->AddWaypoint(10, 383.38,-69.40, -63.25,0); +    marshal_windsorAI->AddWaypoint(11, 389.99,-67.86, -62.57,0); +    marshal_windsorAI->AddWaypoint(12, 400.98,-72.01, -62.31,0); +    marshal_windsorAI->AddWaypoint(13, 404.22,-62.30, -63.50,2300); +    marshal_windsorAI->AddWaypoint(14, 404.22,-62.30, -63.50,1500); +	marshal_windsorAI->AddWaypoint(154, 407.65,-51.86, -63.96,0); +    marshal_windsorAI->AddWaypoint(16, 403.61,-51.71, -63.92,1000); +    marshal_windsorAI->AddWaypoint(17, 403.61,-51.71, -63.92,2000); +    marshal_windsorAI->AddWaypoint(18, 403.61,-51.71, -63.92,1000); +    marshal_windsorAI->AddWaypoint(19, 403.61,-51.71, -63.92,0); +    return (CreatureAI*)marshal_windsorAI; +} + +bool QuestAccept_npc_marshal_windsor(Player *player, Creature *creature, Quest const *quest ) +{ +    if( quest->GetQuestId() == 4322 )                      +		{PlayerStart = player; +		if( pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED ) +		{ +				((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); +				pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); +				creature->setFaction(11);  +		} + +		} +    return false; +} + +/*###### +## npc_marshal_reginald_windsor +######*/ + +#define SAY_REGINALD_WINDSOR_0_1	"Can you feel the power, $N??? It's time to ROCK!" +#define SAY_REGINALD_WINDSOR_0_2	"Now we just have to free Tobias and we can get out of here. This way!" +#define SAY_REGINALD_WINDSOR_5_1	"Open it." +#define SAY_REGINALD_WINDSOR_5_2	"I never did like those two. Let's get moving." +#define SAY_REGINALD_WINDSOR_7_1	"Open it and be careful this time!" +#define SAY_REGINALD_WINDSOR_7_2	"That intolerant dirtbag finally got what was coming to him. Good riddance!" +#define SAY_REGINALD_WINDSOR_7_3	"Alright, let's go." +#define SAY_REGINALD_WINDSOR_13_1	"Open it. We need to hurry up. I can smell those Dark Irons coming a mile away and I can tell you one thing, they're COMING!" +#define SAY_REGINALD_WINDSOR_13_2	"Administering fists of fury on Crest Killer!" +#define SAY_REGINALD_WINDSOR_13_3	"He has to be in the last cell. Unless... they killed him." +#define SAY_REGINALD_WINDSOR_14_1	"Get him out of there!" +#define SAY_REGINALD_WINDSOR_14_2	"Excellent work, $N. Let's find the exit. I think I know the way. Follow me!" +#define SAY_REGINALD_WINDSOR_20_1	"We made it!" +#define SAY_REGINALD_WINDSOR_20_2	"Meet me at Maxwell's encampment. We'll go over the next stages of the plan there and figure out a way to decode my tablets without the decryption ring." +#define MOB_ENTRY_SHILL_DINGER		9678     +#define MOB_ENTRY_CREST_KILLER		9680     + +int wp = 0; + +struct TRINITY_DLL_DECL npc_marshal_reginald_windsorAI : public npc_escortAI +{ +	npc_marshal_reginald_windsorAI(Creature *c) : npc_escortAI(c)  +	{  +		Reset();  +	} +	   +	void WaypointReached(uint32 i) +    { +	wp=i; +	switch( i ) +        { +		case 0: +			m_creature->setFaction(11);  +			m_creature->Say(SAY_REGINALD_WINDSOR_0_1, LANG_UNIVERSAL, PlayerGUID); +			break; +		case 1: +			m_creature->Say(SAY_REGINALD_WINDSOR_0_2, LANG_UNIVERSAL, PlayerGUID); +			break; +		case 7: +			m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); +			m_creature->Say(SAY_REGINALD_WINDSOR_5_1, LANG_UNIVERSAL, PlayerGUID); +			IsOnHold=true; +			break; +		case 8: +			m_creature->Say(SAY_REGINALD_WINDSOR_5_2, LANG_UNIVERSAL, PlayerGUID); +			break; +		case 11: +			m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); +			m_creature->Say(SAY_REGINALD_WINDSOR_7_1, LANG_UNIVERSAL, PlayerGUID); +			IsOnHold=true; +			break; +		case 12: +			m_creature->Say(SAY_REGINALD_WINDSOR_7_2, LANG_UNIVERSAL, PlayerGUID); +			break; +		case 13: +			m_creature->Say(SAY_REGINALD_WINDSOR_7_3, LANG_UNIVERSAL, PlayerGUID); +			break; +		case 20: +			m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); +			m_creature->Say(SAY_REGINALD_WINDSOR_13_1, LANG_UNIVERSAL, PlayerGUID); +			IsOnHold=true; +			break; +		case 21: +			m_creature->Say(SAY_REGINALD_WINDSOR_13_3, LANG_UNIVERSAL, PlayerGUID); +			break; +		case 23: +			m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); +			m_creature->Say(SAY_REGINALD_WINDSOR_14_1, LANG_UNIVERSAL, PlayerGUID); +			IsOnHold=true; +			break; +		case 24: +			m_creature->Say(SAY_REGINALD_WINDSOR_14_2, LANG_UNIVERSAL, PlayerGUID); +			break; +		case 31: +			m_creature->Say(SAY_REGINALD_WINDSOR_20_1, LANG_UNIVERSAL, PlayerGUID); +			break; +		case 32: +			m_creature->Say(SAY_REGINALD_WINDSOR_20_2, LANG_UNIVERSAL, PlayerGUID); +			PlayerStart->GroupEventHappens(QUEST_JAIL_BREAK,m_creature); +			pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_ENDED); +			break; +		} +	} + +    void MoveInLineOfSight(Unit *who) +    { +        if( IsBeingEscorted ) +            return; + +        if( who->GetTypeId() == TYPEID_PLAYER ) +        { +            if( ((Player*)who)->GetQuestStatus(4322) == QUEST_STATUS_INCOMPLETE ) +            { +                float Radius = 10.0; +                if( m_creature->IsWithinDistInMap(who, Radius) ) +                { +                    IsOnHold = false; +					((npc_escortAI*)(m_creature->AI()))->Start(true, true, false, who->GetGUID()); +                } +            } +        } +    } + +    void Aggro(Unit* who)  +		{ +		switch(rand()%3) +			{ +			case 0:m_creature->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID);break; +			case 1:m_creature->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID);break; +			case 2:m_creature->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID);break; +			} +		} +    void Reset() {} + +	void JustDied(Unit *slayer) +    { +		pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); +    } + +    void UpdateAI(const uint32 diff) +    { +		if(pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; +		if(wp==7) +			{ +			if(!pInstance->GetData(DATA_GATE_J) && pInstance->GetData(DATA_JAZ) == ENCOUNTER_STATE_NOT_STARTED ) +				{ +					pInstance->SetData(DATA_CREATURE_JAZ,1); +					pInstance->SetData(DATA_JAZ,ENCOUNTER_STATE_IN_PROGRESS); +				} +			if( pInstance->GetData(DATA_CREATURE_JAZ) && pInstance->GetData(DATA_CREATURE_OGRABISI) && pInstance->GetData(DATA_JAZ) == ENCOUNTER_STATE_IN_PROGRESS ) +				{ +					IsOnHold = false; +					pInstance->SetData(DATA_JAZ,ENCOUNTER_STATE_ENDED); +				} +			} +		else if(wp==11) +			{ +			if(!pInstance->GetData(DATA_GATE_S) && pInstance->GetData(DATA_SHILL) == ENCOUNTER_STATE_NOT_STARTED ) +				{ +					pInstance->SetData(DATA_CREATURE_SHILL,1); +					pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_IN_PROGRESS); +				} +			if( pInstance->GetData(DATA_CREATURE_SHILL) && pInstance->GetData(DATA_SHILL) == ENCOUNTER_STATE_IN_PROGRESS ) +				{ +					pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_ENDED); +					IsOnHold = false; +				} +			} +		else if(wp==20) +			{ +			if(!pInstance->GetData(DATA_GATE_C) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_NOT_STARTED) +				{ +					pInstance->SetData(DATA_CREATURE_CREST,1); +					m_creature->Say(SAY_REGINALD_WINDSOR_13_2, LANG_UNIVERSAL, PlayerGUID); +					pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_IN_PROGRESS); +				} +			if( pInstance->GetData(DATA_CREATURE_CREST) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_IN_PROGRESS ) +				{ +					IsOnHold = false; +					pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_ENDED); +				} +			} +		if( pInstance->GetData(DATA_TOBIAS)==ENCOUNTER_STATE_OBJECTIVE_COMPLETED ) IsOnHold = false; +		npc_escortAI::UpdateAI(diff); +    } +}; +CreatureAI* GetAI_npc_marshal_reginald_windsor(Creature *_Creature) +{     +    npc_marshal_reginald_windsorAI* marshal_reginald_windsorAI = new npc_marshal_reginald_windsorAI(_Creature); +    marshal_reginald_windsorAI->AddWaypoint(0, 403.61,-52.71, -63.92,4000); +    marshal_reginald_windsorAI->AddWaypoint(1, 403.61,-52.71, -63.92,4000); +    marshal_reginald_windsorAI->AddWaypoint(2, 406.33,-54.87, -63.95,0); +    marshal_reginald_windsorAI->AddWaypoint(3, 407.99,-73.91, -62.26,0); +    marshal_reginald_windsorAI->AddWaypoint(4, 557.03,-119.71, -61.83,0); +    marshal_reginald_windsorAI->AddWaypoint(5, 573.40,-124.39, -65.07,0); +	marshal_reginald_windsorAI->AddWaypoint(6, 593.91,-130.29, -69.25,0); +	marshal_reginald_windsorAI->AddWaypoint(7, 593.21,-132.16, -69.25,0); +	marshal_reginald_windsorAI->AddWaypoint(8, 593.21,-132.16, -69.25,3000); +    marshal_reginald_windsorAI->AddWaypoint(9, 622.81,-135.55, -71.92,0); +    marshal_reginald_windsorAI->AddWaypoint(10, 634.68,-151.29, -70.32,0); +    marshal_reginald_windsorAI->AddWaypoint(11, 635.06,-153.25, -70.32,0); +    marshal_reginald_windsorAI->AddWaypoint(12, 635.06,-153.25, -70.32,3000); +    marshal_reginald_windsorAI->AddWaypoint(13, 635.06,-153.25, -70.32,1500); +    marshal_reginald_windsorAI->AddWaypoint(14, 655.25,-172.39, -73.72,0); +    marshal_reginald_windsorAI->AddWaypoint(15, 654.79,-226.30, -83.06,0); +    marshal_reginald_windsorAI->AddWaypoint(16, 622.85,-268.85, -83.96,0); +	marshal_reginald_windsorAI->AddWaypoint(17, 579.45,-275.56, -80.44,0); +    marshal_reginald_windsorAI->AddWaypoint(18, 561.19,-266.85, -75.59,0); +	marshal_reginald_windsorAI->AddWaypoint(19, 547.91,-253.92, -70.34,0); +	marshal_reginald_windsorAI->AddWaypoint(20, 549.20,-252.40, -70.34,0); +	marshal_reginald_windsorAI->AddWaypoint(21, 549.20,-252.40, -70.34,4000); +    marshal_reginald_windsorAI->AddWaypoint(22, 555.33,-269.16, -74.40,0); +    marshal_reginald_windsorAI->AddWaypoint(23, 554.31,-270.88, -74.40,0); +    marshal_reginald_windsorAI->AddWaypoint(24, 554.31,-270.88, -74.40,4000); +	marshal_reginald_windsorAI->AddWaypoint(25, 536.10,-249.60, -67.47,0); +    marshal_reginald_windsorAI->AddWaypoint(26, 520.94,-216.65, -59.28,0); +	marshal_reginald_windsorAI->AddWaypoint(27, 505.99,-148.74, -62.17,0); +    marshal_reginald_windsorAI->AddWaypoint(28, 484.21,-56.24, -62.43,0); +	marshal_reginald_windsorAI->AddWaypoint(29, 470.39,-6.01, -70.10,0); +    marshal_reginald_windsorAI->AddWaypoint(30, 451.27,30.85, -70.07,0); +    marshal_reginald_windsorAI->AddWaypoint(31, 452.45,29.85, -70.37,1500); //tezi trqbva da se opravqt +    marshal_reginald_windsorAI->AddWaypoint(32, 452.45,29.85, -70.37,7000); +    marshal_reginald_windsorAI->AddWaypoint(33, 452.45,29.85, -70.37,10000); +    marshal_reginald_windsorAI->AddWaypoint(34, 451.27,31.85, -70.07,0); +	return (CreatureAI*)marshal_reginald_windsorAI; +} + +/*###### +## npc_tobias_seecher +######*/ + +#define SAY_TOBIAS_FREE			"Thank you! I will run for safety immediately!" + +struct TRINITY_DLL_DECL npc_tobias_seecherAI : public npc_escortAI +{ +    npc_tobias_seecherAI(Creature *c) :npc_escortAI(c) {Reset();} +     +    void Aggro(Unit* who) { } +    void Reset() {} + +    void JustDied(Unit* killer) +    { +        if (IsBeingEscorted && killer == m_creature) +        { +			m_creature->SetVisibility(VISIBILITY_OFF); +			m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +			m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); +			pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); +        } +    } + +	void WaypointReached(uint32 i) +    { +	switch(i) +		{ +		case 0:m_creature->Say(SAY_TOBIAS_FREE, LANG_UNIVERSAL, PlayerGUID); break; +		case 2: +			pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; +		case 4: +			m_creature->SetVisibility(VISIBILITY_OFF); +			m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +			m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); +			pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); +			break; +		} +	} + +    void UpdateAI(const uint32 diff) +    { +		if(pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; +		if( (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_TOBIAS) == ENCOUNTER_STATE_ENDED ) +		{ +			m_creature->SetVisibility(VISIBILITY_OFF); +			m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +			m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); +		} +		else +		{ +			m_creature->SetVisibility(VISIBILITY_ON); +			m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +			m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); +		} +		npc_escortAI::UpdateAI(diff); +    } +}; + +CreatureAI* GetAI_npc_tobias_seecher(Creature *_Creature) +{     +    npc_tobias_seecherAI* tobias_seecherAI = new npc_tobias_seecherAI(_Creature); + +    tobias_seecherAI->AddWaypoint(0, 549.21, -281.07, -75.27); +    tobias_seecherAI->AddWaypoint(1, 554.39, -267.39, -73.68); +    tobias_seecherAI->AddWaypoint(2, 533.59, -249.38, -67.04); +    tobias_seecherAI->AddWaypoint(3, 519.44, -217.02, -59.34); +    tobias_seecherAI->AddWaypoint(4, 506.55, -153.49, -62.34); +    return (CreatureAI*)tobias_seecherAI; +} + +bool GossipHello_npc_tobias_seecher(Player *player, Creature *_Creature) +{ +  	if(player->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS ) +    { +        player->ADD_GOSSIP_ITEM(0, "Get out of here, Tobias, you're free!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + 		player->SEND_GOSSIP_MENU(2847, _Creature->GetGUID()); +    } +    return true; +} + +bool GossipSelect_npc_tobias_seecher(Player *player, Creature *_Creature, uint32 sender, uint32 action ) +{ +    if (action == GOSSIP_ACTION_INFO_DEF + 1) +    { +        player->CLOSE_GOSSIP_MENU(); +        ((npc_escortAI*)(_Creature->AI()))->Start(false, false, true, player->GetGUID()); +		_Creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); +		pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_IN_PROGRESS); +    } +    return true; +} + +/*######  ##  ######*/ @@ -234,4 +791,29 @@ void AddSC_blackrock_depths()      newscript->pGossipHello =  &GossipHello_npc_lokhtos_darkbargainer;      newscript->pGossipSelect = &GossipSelect_npc_lokhtos_darkbargainer;      newscript->RegisterSelf(); + +	newscript = new Script; +	newscript->Name="npc_dughal_stormwing"; +	newscript->pGossipHello =  &GossipHello_npc_dughal_stormwing; +	newscript->pGossipSelect = &GossipSelect_npc_dughal_stormwing; +	newscript->GetAI = &GetAI_npc_dughal_stormwing; +	newscript->RegisterSelf(); + +	newscript = new Script; +	newscript->Name="npc_tobias_seecher"; +    newscript->pGossipHello =  &GossipHello_npc_tobias_seecher; +    newscript->pGossipSelect = &GossipSelect_npc_tobias_seecher; +	newscript->GetAI = &GetAI_npc_tobias_seecher; +	newscript->RegisterSelf(); + +	newscript = new Script; +    newscript->Name="npc_marshal_windsor"; +    newscript->pQuestAccept = &QuestAccept_npc_marshal_windsor; +	newscript->GetAI = &GetAI_npc_marshal_windsor; +    newscript->RegisterSelf(); + +	newscript = new Script; +    newscript->Name="npc_marshal_reginald_windsor"; +	newscript->GetAI = &GetAI_npc_marshal_reginald_windsor; +	newscript->RegisterSelf();  } diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/def_blackrock_depths.h b/src/bindings/scripts/scripts/zone/blackrock_depths/def_blackrock_depths.h new file mode 100644 index 00000000000..f6da69c8044 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/blackrock_depths/def_blackrock_depths.h @@ -0,0 +1,35 @@ +/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef DEF_BLACKROCK_DEPTHS_H +#define DEF_BLACKROCK_DEPTHS_H + +#define DATA_DUGHAL						0 +#define DATA_SUPPLY_ROOM				1 +#define DATA_JAZ						2 +#define DATA_SHILL						3 +#define DATA_CREST						4 +#define DATA_TOBIAS						5 +#define DATA_QUEST_JAIL_BREAK			6 + +#define ENCOUNTER_STATE_NOT_STARTED			100 +#define ENCOUNTER_STATE_BEFORE_START		101 +#define ENCOUNTER_STATE_IN_PROGRESS			102 +#define ENCOUNTER_STATE_OBJECTIVE_COMPLETED	103 +#define ENCOUNTER_STATE_ENDED				104 +#define ENCOUNTER_STATE_FAILED				105 + +#define DATA_GATE_D							111 +#define DATA_GATE_SR						112 +#define DATA_GATE_J							113 +#define DATA_GATE_S							114 +#define DATA_GATE_C							115 +#define DATA_GATE_T							116 +#define DATA_GATE_SC						117 +#define DATA_CREATURE_JAZ					118 +#define DATA_CREATURE_OGRABISI				119 +#define DATA_CREATURE_CREST					120 +#define DATA_CREATURE_SHILL					121 + +#endif
\ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp new file mode 100644 index 00000000000..4538127664c --- /dev/null +++ b/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp @@ -0,0 +1,238 @@ +/* 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: Instance_Blackrock_Depths +SD%Complete: 100 +SDComment:  +SDCategory: Blackrock Depths +EndScriptData */ + +/* +update `creature_template` set `npcflag`='1',`ScriptName`='npc_dughal_stormwing' where `entry`='9022'; +update `creature_template` set `ScriptName`='npc_marshal_windsor' where `entry`='9023'; +update `creature_template` set `ScriptName`='npc_marshal_reginald_windsor' where `entry`='9682'; +update `creature_template` set `npcflag`='1',`ScriptName`='npc_tobias_seecher' where `entry`='9679'; +update `instance_template` set `script`='instance_blackrock_depths' where `map`='230'; +*/ + +#include "GameObject.h" +#include "precompiled.h" +#include "def_blackrock_depths.h" + +#define ENCOUNTERS 7 + +struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance +{ +	instance_blackrock_depths(Map *map) : ScriptedInstance(map) {Initialize();}; + +	uint64 GateDughal; +	uint64 SupplyRoomGate; +	uint64 GateJaz; +	uint64 GateShill; +	uint64 GateCrest; +	uint64 GateTobias; +	uint64 SupplyCrate; + +	uint64 Jaz; +	uint64 Ograbisi; +	uint64 ShillDinger; +	uint64 CrestKiller; + +	bool Encounters[ENCOUNTERS]; + +	void Initialize() +    {    +	 +		GateDughal = 0; +		SupplyRoomGate = 0; +		GateJaz = 0; +		GateShill = 0; +		GateCrest = 0; +		GateTobias = 0; +		SupplyCrate = 0; + +		Jaz = 0; +		Ograbisi = 0; +		ShillDinger = 0; +		CrestKiller = 0; + +		for(uint8 i = 0; i < ENCOUNTERS; i++) +			Encounters[i] = false; +    } +	 +	bool IsEncounterInProgress() const +	{ +		for(uint8 i = 0; i < ENCOUNTERS; i++) +            if(Encounters[i]) return true; + +        return false; +    } + +	void OpenGO(uint64 DoorGUID, bool open) +    { +        if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID)) +            Door->SetUInt32Value(GAMEOBJECT_STATE, open ? 0 : 1); +    } + +    void CloseGO(uint64 DoorGUID, bool close) +    { +        if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID)) +            Door->SetUInt32Value(GAMEOBJECT_STATE, close ? 1 : 0); +    } + +	uint32 GetData(uint32 type) +	{ +		uint32 state = 0; +		switch(type) +		{ +		case DATA_DUGHAL:			return Encounters[0];break; +		case DATA_SUPPLY_ROOM:		return Encounters[1];break; +		case DATA_JAZ:				return Encounters[2];break; +		case DATA_SHILL:			return Encounters[3];break; +		case DATA_CREST:			return Encounters[4];break; +		case DATA_TOBIAS:			return Encounters[5];break; +		case DATA_QUEST_JAIL_BREAK: return Encounters[6];break; +		case DATA_GATE_D:			return GateDughal;	break; +		case DATA_GATE_T:			return GateTobias;	break; +		case DATA_GATE_C:			return GateCrest;	break; +		case DATA_GATE_J:			return GateJaz;		break; +		case DATA_GATE_S:			return GateShill;	break; +		case DATA_CREATURE_JAZ: +			if((((Creature*)Jaz)->isDead())) +			//	state = 1; +			//else +			//	state = 0; +			break; +		case DATA_CREATURE_OGRABISI: +			if((((Creature*)Ograbisi)->isDead())) +			//	state = 1; +			//else +			//	state = 0; +			break; +		case DATA_CREATURE_CREST: +			if((((Creature*)CrestKiller)->isDead())) +			//	state = 1; +			//else +			//	state = 0; +			break; +		case DATA_CREATURE_SHILL: +			if((((Creature*)ShillDinger)->isDead())) +			//	state = 1; +			//else +			//	state = 0; +			break; +		} +		return state; +	} + +	void OnObjectCreate(GameObject *go) +	{ +		switch(go->GetEntry()) +		{ +		case 170561: SupplyRoomGate = go->GetGUID(); go->GetUInt32Value(GAMEOBJECT_STATE); break;  +		case 170562: GateDughal = go->GetGUID();	break; +		case 170566: GateTobias = go->GetGUID();	break; +		case 170567: GateCrest = go->GetGUID(); break; +		case 170568: GateJaz = go->GetGUID(); break; +		case 170569: GateShill = go->GetGUID(); break; +		case 166872: SupplyCrate = go->GetGUID(); break; +		} +	} + +    void OnCreatureCreate(Creature *creature, uint32 creature_entry)  +	{ +		switch(creature_entry) +        { +         case 9680: CrestKiller = creature->GetGUID(); break;  +		 case 9677: Ograbisi = creature->GetGUID(); break; +         case 9681: Jaz = creature->GetGUID(); break; +         case 9678: ShillDinger = creature->GetGUID(); break; +        }		 +	} + +    void SetData(uint32 type, uint32 data) +    { +        switch(type) +        { +        case DATA_DUGHAL: Encounters[0] = data; break; +        case DATA_SUPPLY_ROOM: Encounters[1] = data; break; +        case DATA_JAZ: Encounters[2] = data; break; +        case DATA_SHILL: Encounters[3] = data; break; +        case DATA_CREST: Encounters[4] = data; break; +        case DATA_TOBIAS: Encounters[5] = data; break; +        case DATA_QUEST_JAIL_BREAK: Encounters[6] = data; break; +		case DATA_GATE_SR: +            if(SupplyRoomGate) +            { +               if(data == NOT_STARTED) +					OpenGO(SupplyRoomGate, true); +			   else +					CloseGO(SupplyRoomGate, true); +            } +	        break; +         case DATA_GATE_SC: +            if(SupplyCrate) +            { +               if(data == NOT_STARTED) +					OpenGO(SupplyCrate, true); +			   else +					CloseGO(SupplyCrate, true); +            } +	        break; +		 case DATA_CREATURE_JAZ: +			 if(data) +			 { +				 (((Creature*)Jaz)->setFaction(54)); +				 (((Creature*)Ograbisi)->setFaction(54)); +				 (((Creature*)Ograbisi)->Say("Ograbisi needs new hat", LANG_UNIVERSAL, NULL)); +			 } +			 else +			 { +				 (((Creature*)Jaz)->setFaction(35)); +				 (((Creature*)Ograbisi)->setFaction(35)); +			 } +			 break; + 		 case DATA_CREATURE_SHILL: +			 if(data) +				(((Creature*)ShillDinger)->setFaction(54)); +			 else +				(((Creature*)ShillDinger)->setFaction(35)); +			 break; + 		 case DATA_CREATURE_CREST: +			 if(data) +				(((Creature*)CrestKiller)->setFaction(54)); +			 else +				(((Creature*)CrestKiller)->setFaction(35)); +			 break; +        } +    } + +}; + +InstanceData* GetInstanceData_instance_blackrock_depths(Map* map) +{ +    return new instance_blackrock_depths(map); +} + +void AddSC_instance_blackrock_depths() +{ +    Script *newscript; +    newscript = new Script; +    newscript->Name = "instance_blackrock_depths"; +    newscript->GetInstanceData = &GetInstanceData_instance_blackrock_depths; +    newscript->RegisterSelf(); +}
\ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp index ade3931c75d..1eff1d97606 100644 --- a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp +++ b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp @@ -17,7 +17,7 @@  /* ScriptData  SDName: Ghostlands  SD%Complete: 100 -SDComment: Quest support: 9692. Obtain Budd's Guise of Zul'aman. Vendor Rathis Tomber +SDComment: Quest support: 9692, 9212. Obtain Budd's Guise of Zul'aman. Vendor Rathis Tomber  SDCategory: Ghostlands  EndScriptData */ @@ -25,9 +25,11 @@ EndScriptData */  npc_blood_knight_dawnstar  npc_budd_nedreck  npc_rathis_tomber +npc_ranger_lilatha  EndContentData */  #include "precompiled.h" +#include "../../npc/npc_escortAI.h"  /*######  ## npc_blood_knight_dawnstar @@ -125,6 +127,209 @@ bool GOHello_gilded_brazier(Player *player, GameObject* _GO)      return true;  }; +/*###### +## npc_ranger_lilatha +######*/ +  +#define SAY_START                                                       "Let's go." +#define SAY_PROGRESS1                                           "$N, let's use the antechamber to the right." +#define SAY_PROGRESS2                                           "I can see the light at the end of the tunnel!" +#define SAY_PROGRESS3                                           "There's Farstrider Enclave now, $C. Not far to go... Look out! Troll ambush!!" +#define SAY_END1                                                        "Thank you for saving my life and bringing me back to safety, $N" +#define SAY_END2                                                        "Captain Helios, I've been rescued from the Amani Catacombs. Reporting for duty, sir!" +#define CAPTAIN_ANSWER                                          "Liatha, get someone to look at those injuries. Thank you for bringing her back safely." +  +#define QUEST_ESCAPE_FROM_THE_CATACOMBS         9212 +#define GO_CAGE                                                         181152 +#define NPC_CAPTAIN_HELIOS                                      16220 + +struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI +{ +	npc_ranger_lilathaAI(Creature *c) : npc_escortAI(c) {Reset();} + +	std::list<GameObject*> CageList; +  +	void WaypointReached(uint32 i) +	{ +		Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + +		if (!player) +            return; + +        switch(i) +		{ +		case 0:			 +			{ +			m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); +			setCage(true); +			DoSay(SAY_START, LANG_UNIVERSAL, player); +			break; +			} +		case 5: +			DoSay(SAY_PROGRESS1, LANG_UNIVERSAL, player); break; +		case 11:			 +			DoSay(SAY_PROGRESS2, LANG_UNIVERSAL, player);  +			m_creature->SetOrientation(4.762841); +			break;			 +		case 18: +			{ +			DoSay(SAY_PROGRESS3, LANG_UNIVERSAL, player); +			Creature* Summ1 = m_creature->SummonCreature(16342, 7627.083984, -7532.538086, 152.128616, 1.082733, TEMPSUMMON_DEAD_DESPAWN, 0); +			Creature* Summ2 = m_creature->SummonCreature(16343, 7620.432129, -7532.550293, 152.454865, 0.827478, TEMPSUMMON_DEAD_DESPAWN, 0); +			Summ1->Attack(m_creature, true); +			Summ2->Attack(player, true); +			m_creature->AI()->AttackStart(Summ1); +			break;			 +			} +		case 19: +			m_creature->SetSpeed(MOVE_RUN, 1.5f); break; +		case 25: +			m_creature->SetSpeed(MOVE_WALK, 1.0f); break; +		case 30: +			if (player && player->GetTypeId() == TYPEID_PLAYER) +				((Player*)player)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS,m_creature);                 +			break; +		case 32:			 +			m_creature->SetOrientation(2.978281); +			DoSay(SAY_END1, LANG_UNIVERSAL, player); +			break;                                 +		case 33: +			m_creature->SetOrientation(5.858011); +			DoSay(SAY_END2, LANG_UNIVERSAL, player); +			captainAnswer(); +			break;                         +		} +	} +  +    void Aggro(Unit* who) {} +  +	void Reset() +	{ +		if (!IsBeingEscorted) +			m_creature->setFaction(1602); +		setCage(false); +	} +  +	void JustDied(Unit* killer) +	{ +		if (PlayerGUID) +		{ +			Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); +			if (player) +				((Player*)player)->FailQuest(QUEST_ESCAPE_FROM_THE_CATACOMBS); +		} +	} +  +	void UpdateAI(const uint32 diff) +    { +        npc_escortAI::UpdateAI(diff); +    } +  +	void setCage(bool open) +	{ +		CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); +		Cell cell(pair); +		cell.data.Part.reserved = ALL_DISTRICT; +		cell.SetNoCreate(); +  +		Trinity::AllGameObjectsWithEntryInGrid go_check(GO_CAGE); +		Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInGrid> go_search(CageList, go_check); +		TypeContainerVisitor +			<Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInGrid>, GridTypeMapContainer> go_visit(go_search); +		CellLock<GridReadGuard> cell_lock(cell, pair); +		cell_lock->Visit(cell_lock, go_visit, *(m_creature->GetMap())); +  +		if (!CageList.empty()) +		{ +			for(std::list<GameObject*>::iterator itr = CageList.begin(); itr != CageList.end(); ++itr) +			{ +				if( open ) +					(*itr)->SetGoState(0); +				else +					(*itr)->SetGoState(1); +			} +		} else error_log("SD2 ERROR: CageList is empty!"); +	} +  +	void captainAnswer() +	{ +		CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); +		Cell cell(pair); +		cell.data.Part.reserved = ALL_DISTRICT; +		cell.SetNoCreate(); +  +		std::list<Creature*> NPCList; + +		Trinity::AllCreaturesOfEntryInRange check(m_creature, NPC_CAPTAIN_HELIOS, 100); +		Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(NPCList, check); +		TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher); +  +		CellLock<GridReadGuard> cell_lock(cell, pair); +		cell_lock->Visit(cell_lock, visitor, *(m_creature->GetMap())); +  +		if (!NPCList.empty()) +		{ +			for(std::list<Creature*>::iterator itr = NPCList.begin(); itr != NPCList.end(); ++itr) +			{ +				(*itr)->Say(CAPTAIN_ANSWER, LANG_UNIVERSAL, PlayerGUID); +			} +		}else error_log("SD2 ERROR: Captain Helios not found!"); +	} +}; +  +bool QuestAccept_npc_ranger_lilatha(Player* player, Creature* creature, Quest const* quest) +{ +    if (quest->GetQuestId() == QUEST_ESCAPE_FROM_THE_CATACOMBS) +    { +        creature->setFaction(1603); +        ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); +    } +    return true; +} +  +CreatureAI* GetAI_npc_ranger_lilathaAI(Creature *_Creature) +{ +    npc_ranger_lilathaAI* ranger_lilathaAI = new npc_ranger_lilathaAI(_Creature); +  +	ranger_lilathaAI->AddWaypoint(0, 7545.07, -7359.87, 162.354, 4000); // Say0 +	ranger_lilathaAI->AddWaypoint(1, 7550.048340, -7362.237793, 162.235657); +	ranger_lilathaAI->AddWaypoint(2, 7566.976074, -7364.315430, 161.738770); +	ranger_lilathaAI->AddWaypoint(3, 7578.830566, -7361.677734, 161.738770); +	ranger_lilathaAI->AddWaypoint(4, 7590.969238, -7359.053711, 162.257660); +	ranger_lilathaAI->AddWaypoint(5, 7598.354004, -7362.815430, 162.256683, 4000); // Say1 +	ranger_lilathaAI->AddWaypoint(6, 7605.861328, -7380.424316, 161.937073); +	ranger_lilathaAI->AddWaypoint(7, 7605.295410, -7387.382813, 157.253998); +	ranger_lilathaAI->AddWaypoint(8, 7606.131836, -7393.893555, 156.941925); +	ranger_lilathaAI->AddWaypoint(9, 7615.207520, -7400.187012, 157.142639); +	ranger_lilathaAI->AddWaypoint(10, 7618.956543, -7402.652832, 158.202042); +	ranger_lilathaAI->AddWaypoint(11, 7636.850586, -7401.756836, 162.144791); +	ranger_lilathaAI->AddWaypoint(12, 7637.058105, -7404.944824, 162.206970, 4000);// Say2 +	ranger_lilathaAI->AddWaypoint(13, 7636.910645, -7412.585449, 162.366425); +	ranger_lilathaAI->AddWaypoint(14, 7637.607910, -7425.591797, 162.630661); +	ranger_lilathaAI->AddWaypoint(15, 7637.816895, -7459.057129, 163.302704); +	ranger_lilathaAI->AddWaypoint(16, 7638.859863, -7470.902344, 162.517059); +	ranger_lilathaAI->AddWaypoint(17, 7641.395996, -7488.217285, 157.381287); +	ranger_lilathaAI->AddWaypoint(18, 7634.455566, -7505.451660, 154.682159); +	ranger_lilathaAI->AddWaypoint(19, 7631.906738, -7516.948730, 153.597382); // say3 +	ranger_lilathaAI->AddWaypoint(20, 7622.231445, -7537.037598, 151.587112); +	ranger_lilathaAI->AddWaypoint(21, 7610.921875, -7550.670410, 149.639374); +	ranger_lilathaAI->AddWaypoint(22, 7598.229004, -7562.551758, 145.953888); +	ranger_lilathaAI->AddWaypoint(23, 7588.509277, -7577.755371, 148.294479); +	ranger_lilathaAI->AddWaypoint(24, 7567.339355, -7608.456055, 146.006485); +	ranger_lilathaAI->AddWaypoint(25, 7562.547852, -7617.417969, 148.097504); +	ranger_lilathaAI->AddWaypoint(26, 7561.508789, -7645.064453, 151.245163); +	ranger_lilathaAI->AddWaypoint(27, 7563.337402, -7654.652344, 151.227158); +	ranger_lilathaAI->AddWaypoint(28, 7565.533691, -7658.296387, 151.248886); +	ranger_lilathaAI->AddWaypoint(29, 7571.155762, -7659.118652, 151.244568); +	ranger_lilathaAI->AddWaypoint(30, 7579.119629, -7662.213867, 151.651505); +	ranger_lilathaAI->AddWaypoint(31, 7603.768066, -7667.000488, 153.997726); +	ranger_lilathaAI->AddWaypoint(32, 7603.768066, -7667.000488, 153.997726, 4000);  // Say4 & Set orientation +	ranger_lilathaAI->AddWaypoint(33, 7603.768066, -7667.000488, 153.997726, 8000);  // Say5 & Set orientation +	ranger_lilathaAI->AddWaypoint(34, 7603.768066, -7667.000488, 153.997726);  +  +	return (CreatureAI*)ranger_lilathaAI; +} +   void AddSC_ghostlands()  {      Script *newscript; @@ -151,4 +356,10 @@ void AddSC_ghostlands()      newscript->Name = "go_gilded_brazier";      newscript->pGOHello = &GOHello_gilded_brazier;      newscript->RegisterSelf(); + +	newscript = new Script; +	newscript->Name = "npc_ranger_lilatha"; +	newscript->GetAI = &GetAI_npc_ranger_lilathaAI; +	newscript->pQuestAccept = &QuestAccept_npc_ranger_lilatha; +	newscript->RegisterSelf();  } diff --git a/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp b/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp index d51ee3039d7..935aeea6c4c 100644 --- a/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp +++ b/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp @@ -17,12 +17,14 @@  /* ScriptData  SDName: Tirisfal_Glades  SD%Complete: 100 -SDComment: Quest support: 590 +SDComment: Quest support: 590, 1819  SDCategory: Tirisfal Glades  EndScriptData */  /* ContentData  npc_calvin_montague +go_mausoleum_door +go_mausoleum_trigger  EndContentData */  #include "precompiled.h" @@ -76,6 +78,66 @@ bool QuestAccept_npc_calvin_montague(Player* player, Creature* creature, Quest c      return true;  } +/*###### +## go_mausoleum_door +## go_mausoleum_trigger +######*/ + +#define QUEST_ULAG      1819 +#define C_ULAG          6390 +#define GO_TRIGGER      104593 +#define GO_DOOR         176594 + +GameObject* SearchMausoleumGo(Unit *source, uint32 entry, float range) +{ +    GameObject* pGo = NULL; +     +    CellPair pair(Trinity::ComputeCellPair(source->GetPositionX(), source->GetPositionY())); +    Cell cell(pair); +    cell.data.Part.reserved = ALL_DISTRICT; +    cell.SetNoCreate(); +      +    Trinity::NearestGameObjectEntryInObjectRangeCheck go_check(*source, entry, range); +    Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> searcher(pGo, go_check); +      +    TypeContainerVisitor<Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer> go_searcher(searcher); +     +    CellLock<GridReadGuard> cell_lock(cell, pair); +    cell_lock->Visit(cell_lock, go_searcher,*(source->GetMap())); +     +    return pGo; +} + +bool GOHello_go_mausoleum_door(Player *player, GameObject* _GO) +{ +    if (player->GetQuestStatus(QUEST_ULAG) != QUEST_STATUS_INCOMPLETE) +        return false; +     +    if (GameObject *trigger = SearchMausoleumGo(player, GO_TRIGGER, 30)) +    { +        trigger->SetGoState(1); +        player->SummonCreature(C_ULAG, 2390.26, 336.47, 40.01, 2.26, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300000); +        return false; +    } +     +    return false; +} + +bool GOHello_go_mausoleum_trigger(Player *player, GameObject* _GO) +{ +    if (player->GetQuestStatus(QUEST_ULAG) != QUEST_STATUS_INCOMPLETE) +        return false; +     +    if (GameObject *door = SearchMausoleumGo(player, GO_DOOR, 30)) +    { +        _GO->SetGoState(0); +        door->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); +        return true; +    } +     +    return false; +} +  void AddSC_tirisfal_glades()  {      Script *newscript; @@ -85,4 +147,14 @@ void AddSC_tirisfal_glades()      newscript->GetAI = &GetAI_npc_calvin_montague;      newscript->pQuestAccept = &QuestAccept_npc_calvin_montague;      newscript->RegisterSelf(); + +	newscript = new Script; +    newscript->Name = "go_mausoleum_door"; +    newscript->pGOHello = &GOHello_go_mausoleum_door; +    newscript->RegisterSelf(); + +    newscript = new Script; +    newscript->Name = "go_mausoleum_trigger"; +    newscript->pGOHello = &GOHello_go_mausoleum_trigger; +    newscript->RegisterSelf();  } diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 0a646c93e83..203f8f6c624 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -532,8 +532,11 @@ ChatCommand * ChatHandler::getCommandTable()          { "aura",           SEC_ADMINISTRATOR,  false, &ChatHandler::HandleAuraCommand,                "", NULL },          { "unaura",         SEC_ADMINISTRATOR,  false, &ChatHandler::HandleUnAuraCommand,              "", NULL },          { "nameannounce",   SEC_MODERATOR,      false, &ChatHandler::HandleNameAnnounceCommand,        "", NULL },  +        { "gmnameannounce", SEC_MODERATOR,      false, &ChatHandler::HandleGMNameAnnounceCommand,      "", NULL },          { "announce",       SEC_MODERATOR,      true,  &ChatHandler::HandleAnnounceCommand,            "", NULL }, +        { "gmannounce",     SEC_MODERATOR,      true,  &ChatHandler::HandleGMAnnounceCommand,          "", NULL },          { "notify",         SEC_MODERATOR,      true,  &ChatHandler::HandleNotifyCommand,              "", NULL }, +        { "gmnotify",       SEC_MODERATOR,      true,  &ChatHandler::HandleGMNotifyCommand,            "", NULL },          { "goname",         SEC_MODERATOR,      false, &ChatHandler::HandleGonameCommand,              "", NULL },          { "namego",         SEC_MODERATOR,      false, &ChatHandler::HandleNamegoCommand,              "", NULL },          { "groupgo",        SEC_MODERATOR,      false, &ChatHandler::HandleGroupgoCommand,             "", NULL }, @@ -722,6 +725,22 @@ void ChatHandler::SendGlobalSysMessage(const char *str)      free(buf);  } +void ChatHandler::SendGlobalGMSysMessage(const char *str) +{ +    // Chat output +    WorldPacket data; + +    // need copy to prevent corruption by strtok call in LineFromMessage original string +    char* buf = strdup(str); +    char* pos = buf; + +    while(char* line = LineFromMessage(pos)) +    { +        FillSystemMessageData(&data, line); +        sWorld.SendGlobalGMMessage(&data); +     } +} +  void ChatHandler::SendSysMessage(int32 entry)  {      SendSysMessage(GetTrinityString(entry)); diff --git a/src/game/Chat.h b/src/game/Chat.h index 7356835bfb8..16f764366ac 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -81,6 +81,7 @@ class ChatHandler          virtual bool needReportToTarget(Player* chr) const;          void SendGlobalSysMessage(const char *str); +        void SendGlobalGMSysMessage(const char *str);          bool ExecuteCommandInTable(ChatCommand *table, const char* text, const std::string& fullcommand);          bool ShowHelpForCommand(ChatCommand *table, const char* cmd); @@ -109,8 +110,11 @@ class ChatHandler          bool HandleGroupgoCommand(const char* args);          bool HandleRecallCommand(const char* args);          bool HandleNameAnnounceCommand(const char* args); +        bool HandleGMNameAnnounceCommand(const char* args);          bool HandleAnnounceCommand(const char* args); +        bool HandleGMAnnounceCommand(const char* args);          bool HandleNotifyCommand(const char* args); +        bool HandleGMNotifyCommand(const char* args);          bool HandleGMmodeCommand(const char* args);          bool HandleGMChatCommand(const char* args);          bool HandleVisibleCommand(const char* args); diff --git a/src/game/Language.h b/src/game/Language.h index 0adaabea88c..be6401596ea 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -776,7 +776,11 @@ enum TrinityStrings      LANG_INSTANCE_MUST_RAID_GRP         = 5007,      LANG_INSTANCE_NOT_AS_GHOST          = 5008,      LANG_COMMAND_PLAYED_TO_ALL          = 5009, -    // Room for more Trinity strings      5009-9999 +    // Room for more Trinity strings      5010-9999 +    // Used for GM Announcements         +    LANG_GM_BROADCAST                    = 6613, +    LANG_GM_NOTIFY                       = 6614, +    LANG_GM_ANNOUNCE_COLOR               = 6615,      // Use for not-in-offcial-sources patches      //                                    10000-10999 diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 002b7c9aa3a..000c7bc241e 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -129,6 +129,16 @@ bool ChatHandler::HandleNameAnnounceCommand(const char* args)      return true;  } +bool ChatHandler::HandleGMNameAnnounceCommand(const char* args) +{ +    WorldPacket data; +    if(!*args) +        return false; +    +    sWorld.SendGMText(LANG_GM_ANNOUNCE_COLOR, m_session->GetPlayer()->GetName(), args); +    return true; +} +  // global announce  bool ChatHandler::HandleAnnounceCommand(const char* args)  { @@ -139,6 +149,16 @@ bool ChatHandler::HandleAnnounceCommand(const char* args)      return true;  } +// announce to logged in GMs +bool ChatHandler::HandleGMAnnounceCommand(const char* args) +{ +    if(!*args) +        return false; + +    sWorld.SendGMText(LANG_GM_BROADCAST,args); +    return true; +} +  //notification player at the screen  bool ChatHandler::HandleNotifyCommand(const char* args)  { @@ -155,6 +175,22 @@ bool ChatHandler::HandleNotifyCommand(const char* args)      return true;  } +//notification GM at the screen +bool ChatHandler::HandleGMNotifyCommand(const char* args) +{ +    if(!*args) +        return false; + +    std::string str = GetTrinityString(LANG_GM_NOTIFY); +    str += args; + +    WorldPacket data(SMSG_NOTIFICATION, (str.size()+1)); +    data << str; +    sWorld.SendGlobalGMMessage(&data); + +    return true; +} +  //Enable\Dissable GM Mode  bool ChatHandler::HandleGMmodeCommand(const char* args)  { diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 34a3592db8e..c507df4c858 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -95,7 +95,7 @@ bool ChatHandler::HandleReloadAllLootCommand(const char*)  {      sLog.outString( "Re-Loading Loot Tables..." );      LoadLootTables(); -    SendGlobalSysMessage("DB tables `*_loot_template` reloaded."); +    SendGlobalGMSysMessage("DB tables `*_loot_template` reloaded.");      return true;  } @@ -115,7 +115,7 @@ bool ChatHandler::HandleReloadAllQuestCommand(const char* /*args*/)      sLog.outString( "Re-Loading Quests Relations..." );      objmgr.LoadQuestRelations(); -    SendGlobalSysMessage("DB tables `*_questrelation` and `*_involvedrelation` reloaded."); +    SendGlobalGMSysMessage("DB tables `*_questrelation` and `*_involvedrelation` reloaded.");      return true;  } @@ -134,7 +134,7 @@ bool ChatHandler::HandleReloadAllScriptsCommand(const char*)      HandleReloadQuestEndScriptsCommand("a");      HandleReloadQuestStartScriptsCommand("a");      HandleReloadSpellScriptsCommand("a"); -    SendGlobalSysMessage("DB tables `*_scripts` reloaded."); +    SendGlobalGMSysMessage("DB tables `*_scripts` reloaded.");      HandleReloadDbScriptStringCommand("a");      HandleReloadWpScriptsCommand("a");  	return true; @@ -179,7 +179,7 @@ bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/)  {      sLog.outString( "Re-Loading config settings..." );      sWorld.LoadConfigSettings(true); -    SendGlobalSysMessage("World config settings reloaded."); +    SendGlobalGMSysMessage("World config settings reloaded.");      return true;  } @@ -187,7 +187,7 @@ bool ChatHandler::HandleReloadAreaTriggerTavernCommand(const char*)  {      sLog.outString( "Re-Loading Tavern Area Triggers..." );      objmgr.LoadTavernAreaTriggers(); -    SendGlobalSysMessage("DB table `areatrigger_tavern` reloaded."); +    SendGlobalGMSysMessage("DB table `areatrigger_tavern` reloaded.");      return true;  } @@ -195,14 +195,14 @@ bool ChatHandler::HandleReloadAreaTriggerTeleportCommand(const char*)  {      sLog.outString( "Re-Loading AreaTrigger teleport definitions..." );      objmgr.LoadAreaTriggerTeleports(); -    SendGlobalSysMessage("DB table `areatrigger_teleport` reloaded."); +    SendGlobalGMSysMessage("DB table `areatrigger_teleport` reloaded.");      return true;  }  bool ChatHandler::HandleReloadCommandCommand(const char*)  {      load_command_table = true; -    SendGlobalSysMessage("DB table `command` will be reloaded at next chat command use."); +    SendGlobalGMSysMessage("DB table `command` will be reloaded at next chat command use.");      return true;  } @@ -210,7 +210,7 @@ bool ChatHandler::HandleReloadCreatureQuestRelationsCommand(const char*)  {      sLog.outString( "Loading Quests Relations... (`creature_questrelation`)" );      objmgr.LoadCreatureQuestRelations(); -    SendGlobalSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded."); +    SendGlobalGMSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded.");      return true;  } @@ -218,7 +218,7 @@ bool ChatHandler::HandleReloadCreatureQuestInvRelationsCommand(const char*)  {      sLog.outString( "Loading Quests Relations... (`creature_involvedrelation`)" );      objmgr.LoadCreatureInvolvedRelations(); -    SendGlobalSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded."); +    SendGlobalGMSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded.");      return true;  } @@ -226,7 +226,7 @@ bool ChatHandler::HandleReloadGOQuestRelationsCommand(const char*)  {      sLog.outString( "Loading Quests Relations... (`gameobject_questrelation`)" );      objmgr.LoadGameobjectQuestRelations(); -    SendGlobalSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded."); +    SendGlobalGMSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded.");      return true;  } @@ -234,7 +234,7 @@ bool ChatHandler::HandleReloadGOQuestInvRelationsCommand(const char*)  {      sLog.outString( "Loading Quests Relations... (`gameobject_involvedrelation`)" );      objmgr.LoadGameobjectInvolvedRelations(); -    SendGlobalSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded."); +    SendGlobalGMSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded.");      return true;  } @@ -242,7 +242,7 @@ bool ChatHandler::HandleReloadQuestAreaTriggersCommand(const char*)  {      sLog.outString( "Re-Loading Quest Area Triggers..." );      objmgr.LoadQuestAreaTriggers(); -    SendGlobalSysMessage("DB table `areatrigger_involvedrelation` (quest area triggers) reloaded."); +    SendGlobalGMSysMessage("DB table `areatrigger_involvedrelation` (quest area triggers) reloaded.");      return true;  } @@ -250,7 +250,7 @@ bool ChatHandler::HandleReloadQuestTemplateCommand(const char*)  {      sLog.outString( "Re-Loading Quest Templates..." );      objmgr.LoadQuests(); -    SendGlobalSysMessage("DB table `quest_template` (quest definitions) reloaded."); +    SendGlobalGMSysMessage("DB table `quest_template` (quest definitions) reloaded.");      return true;  } @@ -259,7 +259,7 @@ bool ChatHandler::HandleReloadLootTemplatesCreatureCommand(const char*)      sLog.outString( "Re-Loading Loot Tables... (`creature_loot_template`)" );      LoadLootTemplates_Creature();      LootTemplates_Creature.CheckLootRefs(); -    SendGlobalSysMessage("DB table `creature_loot_template` reloaded."); +    SendGlobalGMSysMessage("DB table `creature_loot_template` reloaded.");      return true;  } @@ -268,7 +268,7 @@ bool ChatHandler::HandleReloadLootTemplatesDisenchantCommand(const char*)      sLog.outString( "Re-Loading Loot Tables... (`disenchant_loot_template`)" );      LoadLootTemplates_Disenchant();      LootTemplates_Disenchant.CheckLootRefs(); -    SendGlobalSysMessage("DB table `disenchant_loot_template` reloaded."); +    SendGlobalGMSysMessage("DB table `disenchant_loot_template` reloaded.");      return true;  } @@ -277,7 +277,7 @@ bool ChatHandler::HandleReloadLootTemplatesFishingCommand(const char*)      sLog.outString( "Re-Loading Loot Tables... (`fishing_loot_template`)" );      LoadLootTemplates_Fishing();      LootTemplates_Fishing.CheckLootRefs(); -    SendGlobalSysMessage("DB table `fishing_loot_template` reloaded."); +    SendGlobalGMSysMessage("DB table `fishing_loot_template` reloaded.");      return true;  } @@ -286,7 +286,7 @@ bool ChatHandler::HandleReloadLootTemplatesGameobjectCommand(const char*)      sLog.outString( "Re-Loading Loot Tables... (`gameobject_loot_template`)" );      LoadLootTemplates_Gameobject();      LootTemplates_Gameobject.CheckLootRefs(); -    SendGlobalSysMessage("DB table `gameobject_loot_template` reloaded."); +    SendGlobalGMSysMessage("DB table `gameobject_loot_template` reloaded.");      return true;  } @@ -295,7 +295,7 @@ bool ChatHandler::HandleReloadLootTemplatesItemCommand(const char*)      sLog.outString( "Re-Loading Loot Tables... (`item_loot_template`)" );      LoadLootTemplates_Item();      LootTemplates_Item.CheckLootRefs(); -    SendGlobalSysMessage("DB table `item_loot_template` reloaded."); +    SendGlobalGMSysMessage("DB table `item_loot_template` reloaded.");      return true;  } @@ -304,7 +304,7 @@ bool ChatHandler::HandleReloadLootTemplatesPickpocketingCommand(const char*)      sLog.outString( "Re-Loading Loot Tables... (`pickpocketing_loot_template`)" );      LoadLootTemplates_Pickpocketing();      LootTemplates_Pickpocketing.CheckLootRefs(); -    SendGlobalSysMessage("DB table `pickpocketing_loot_template` reloaded."); +    SendGlobalGMSysMessage("DB table `pickpocketing_loot_template` reloaded.");      return true;  } @@ -313,7 +313,7 @@ bool ChatHandler::HandleReloadLootTemplatesProspectingCommand(const char*)      sLog.outString( "Re-Loading Loot Tables... (`prospecting_loot_template`)" );      LoadLootTemplates_Prospecting();      LootTemplates_Prospecting.CheckLootRefs(); -    SendGlobalSysMessage("DB table `prospecting_loot_template` reloaded."); +    SendGlobalGMSysMessage("DB table `prospecting_loot_template` reloaded.");      return true;  } @@ -322,7 +322,7 @@ bool ChatHandler::HandleReloadLootTemplatesQuestMailCommand(const char*)      sLog.outString( "Re-Loading Loot Tables... (`quest_mail_loot_template`)" );      LoadLootTemplates_QuestMail();      LootTemplates_QuestMail.CheckLootRefs(); -    SendGlobalSysMessage("DB table `quest_mail_loot_template` reloaded."); +    SendGlobalGMSysMessage("DB table `quest_mail_loot_template` reloaded.");      return true;  } @@ -330,7 +330,7 @@ bool ChatHandler::HandleReloadLootTemplatesReferenceCommand(const char*)  {      sLog.outString( "Re-Loading Loot Tables... (`reference_loot_template`)" );      LoadLootTemplates_Reference(); -    SendGlobalSysMessage("DB table `reference_loot_template` reloaded."); +    SendGlobalGMSysMessage("DB table `reference_loot_template` reloaded.");      return true;  } @@ -339,7 +339,7 @@ bool ChatHandler::HandleReloadLootTemplatesSkinningCommand(const char*)      sLog.outString( "Re-Loading Loot Tables... (`skinning_loot_template`)" );      LoadLootTemplates_Skinning();      LootTemplates_Skinning.CheckLootRefs(); -    SendGlobalSysMessage("DB table `skinning_loot_template` reloaded."); +    SendGlobalGMSysMessage("DB table `skinning_loot_template` reloaded.");      return true;  } @@ -347,7 +347,7 @@ bool ChatHandler::HandleReloadTrinityStringCommand(const char*)  {      sLog.outString( "Re-Loading trinity_string Table!" );      objmgr.LoadTrinityStrings(); -    SendGlobalSysMessage("DB table `trinity_string` reloaded."); +    SendGlobalGMSysMessage("DB table `trinity_string` reloaded.");      return true;  } @@ -355,7 +355,7 @@ bool ChatHandler::HandleReloadNpcOptionCommand(const char*)  {      sLog.outString( "Re-Loading `npc_option` Table!" );      objmgr.LoadNpcOptions(); -    SendGlobalSysMessage("DB table `npc_option` reloaded."); +    SendGlobalGMSysMessage("DB table `npc_option` reloaded.");      return true;  } @@ -363,7 +363,7 @@ bool ChatHandler::HandleReloadNpcGossipCommand(const char*)  {      sLog.outString( "Re-Loading `npc_gossip` Table!" );      objmgr.LoadNpcTextId(); -    SendGlobalSysMessage("DB table `npc_gossip` reloaded."); +    SendGlobalGMSysMessage("DB table `npc_gossip` reloaded.");      return true;  } @@ -371,7 +371,7 @@ bool ChatHandler::HandleReloadNpcTrainerCommand(const char*)  {      sLog.outString( "Re-Loading `npc_trainer` Table!" );      objmgr.LoadTrainerSpell(); -    SendGlobalSysMessage("DB table `npc_trainer` reloaded."); +    SendGlobalGMSysMessage("DB table `npc_trainer` reloaded.");      return true;  } @@ -379,7 +379,7 @@ bool ChatHandler::HandleReloadNpcVendorCommand(const char*)  {      sLog.outString( "Re-Loading `npc_vendor` Table!" );      objmgr.LoadVendors(); -    SendGlobalSysMessage("DB table `npc_vendor` reloaded."); +    SendGlobalGMSysMessage("DB table `npc_vendor` reloaded.");      return true;  } @@ -387,7 +387,7 @@ bool ChatHandler::HandleReloadReservedNameCommand(const char*)  {      sLog.outString( "Loading ReservedNames... (`reserved_name`)" );      objmgr.LoadReservedPlayersNames(); -    SendGlobalSysMessage("DB table `reserved_name` (player reserved names) reloaded."); +    SendGlobalGMSysMessage("DB table `reserved_name` (player reserved names) reloaded.");      return true;  } @@ -395,7 +395,7 @@ bool ChatHandler::HandleReloadSkillDiscoveryTemplateCommand(const char* /*args*/  {      sLog.outString( "Re-Loading Skill Discovery Table..." );      LoadSkillDiscoveryTable(); -    SendGlobalSysMessage("DB table `skill_discovery_template` (recipes discovered at crafting) reloaded."); +    SendGlobalGMSysMessage("DB table `skill_discovery_template` (recipes discovered at crafting) reloaded.");      return true;  } @@ -403,7 +403,7 @@ bool ChatHandler::HandleReloadSkillExtraItemTemplateCommand(const char* /*args*/  {      sLog.outString( "Re-Loading Skill Extra Item Table..." );      LoadSkillExtraItemTable(); -    SendGlobalSysMessage("DB table `skill_extra_item_template` (extra item creation when crafting) reloaded."); +    SendGlobalGMSysMessage("DB table `skill_extra_item_template` (extra item creation when crafting) reloaded.");      return true;  } @@ -411,7 +411,7 @@ bool ChatHandler::HandleReloadSkillFishingBaseLevelCommand(const char* /*args*/)  {      sLog.outString( "Re-Loading Skill Fishing base level requirements..." );      objmgr.LoadFishingBaseSkillLevel(); -    SendGlobalSysMessage("DB table `skill_fishing_base_level` (fishing base level for zone/subzone) reloaded."); +    SendGlobalGMSysMessage("DB table `skill_fishing_base_level` (fishing base level for zone/subzone) reloaded.");      return true;  } @@ -419,7 +419,7 @@ bool ChatHandler::HandleReloadSpellAffectCommand(const char*)  {      sLog.outString( "Re-Loading SpellAffect definitions..." );      spellmgr.LoadSpellAffects(); -    SendGlobalSysMessage("DB table `spell_affect` (spell mods apply requirements) reloaded."); +    SendGlobalGMSysMessage("DB table `spell_affect` (spell mods apply requirements) reloaded.");      return true;  } @@ -427,7 +427,7 @@ bool ChatHandler::HandleReloadSpellRequiredCommand(const char*)  {      sLog.outString( "Re-Loading Spell Required Data... " );      spellmgr.LoadSpellRequired(); -    SendGlobalSysMessage("DB table `spell_required` reloaded."); +    SendGlobalGMSysMessage("DB table `spell_required` reloaded.");      return true;  } @@ -435,7 +435,7 @@ bool ChatHandler::HandleReloadSpellElixirCommand(const char*)  {      sLog.outString( "Re-Loading Spell Elixir types..." );      spellmgr.LoadSpellElixirs(); -    SendGlobalSysMessage("DB table `spell_elixir` (spell elixir types) reloaded."); +    SendGlobalGMSysMessage("DB table `spell_elixir` (spell elixir types) reloaded.");      return true;  } @@ -443,7 +443,7 @@ bool ChatHandler::HandleReloadSpellLearnSpellCommand(const char*)  {      sLog.outString( "Re-Loading Spell Learn Spells..." );      spellmgr.LoadSpellLearnSpells(); -    SendGlobalSysMessage("DB table `spell_learn_spell` reloaded."); +    SendGlobalGMSysMessage("DB table `spell_learn_spell` reloaded.");      return true;  } @@ -451,7 +451,7 @@ bool ChatHandler::HandleReloadSpellProcEventCommand(const char*)  {      sLog.outString( "Re-Loading Spell Proc Event conditions..." );      spellmgr.LoadSpellProcEvents(); -    SendGlobalSysMessage("DB table `spell_proc_event` (spell proc trigger requirements) reloaded."); +    SendGlobalGMSysMessage("DB table `spell_proc_event` (spell proc trigger requirements) reloaded.");      return true;  } @@ -459,7 +459,7 @@ bool ChatHandler::HandleReloadSpellScriptTargetCommand(const char*)  {      sLog.outString( "Re-Loading SpellsScriptTarget..." );      spellmgr.LoadSpellScriptTarget(); -    SendGlobalSysMessage("DB table `spell_script_target` (spell targets selection in case specific creature/GO requirements) reloaded."); +    SendGlobalGMSysMessage("DB table `spell_script_target` (spell targets selection in case specific creature/GO requirements) reloaded.");      return true;  } @@ -467,7 +467,7 @@ bool ChatHandler::HandleReloadSpellTargetPositionCommand(const char*)  {      sLog.outString( "Re-Loading Spell target coordinates..." );      spellmgr.LoadSpellTargetPositions(); -    SendGlobalSysMessage("DB table `spell_target_position` (destination coordinates for spell targets) reloaded."); +    SendGlobalGMSysMessage("DB table `spell_target_position` (destination coordinates for spell targets) reloaded.");      return true;  } @@ -475,7 +475,7 @@ bool ChatHandler::HandleReloadSpellThreatsCommand(const char*)  {      sLog.outString( "Re-Loading Aggro Spells Definitions...");      spellmgr.LoadSpellThreats(); -    SendGlobalSysMessage("DB table `spell_threat` (spell aggro definitions) reloaded."); +    SendGlobalGMSysMessage("DB table `spell_threat` (spell aggro definitions) reloaded.");      return true;  } @@ -483,7 +483,7 @@ bool ChatHandler::HandleReloadSpellPetAurasCommand(const char*)  {      sLog.outString( "Re-Loading Spell pet auras...");      spellmgr.LoadSpellPetAuras(); -    SendGlobalSysMessage("DB table `spell_pet_auras` reloaded."); +    SendGlobalGMSysMessage("DB table `spell_pet_auras` reloaded.");      return true;  } @@ -491,7 +491,7 @@ bool ChatHandler::HandleReloadPageTextsCommand(const char*)  {      sLog.outString( "Re-Loading Page Texts..." );      objmgr.LoadPageTexts(); -    SendGlobalSysMessage("DB table `page_texts` reloaded."); +    SendGlobalGMSysMessage("DB table `page_texts` reloaded.");      return true;  } @@ -499,7 +499,7 @@ bool ChatHandler::HandleReloadItemEnchantementsCommand(const char*)  {      sLog.outString( "Re-Loading Item Random Enchantments Table..." );      LoadRandomEnchantmentsTable(); -    SendGlobalSysMessage("DB table `item_enchantment_template` reloaded."); +    SendGlobalGMSysMessage("DB table `item_enchantment_template` reloaded.");      return true;  } @@ -518,7 +518,7 @@ bool ChatHandler::HandleReloadGameObjectScriptsCommand(const char* arg)      objmgr.LoadGameObjectScripts();      if(*arg!='a') -        SendGlobalSysMessage("DB table `gameobject_scripts` reloaded."); +        SendGlobalGMSysMessage("DB table `gameobject_scripts` reloaded.");      return true;  } @@ -538,7 +538,7 @@ bool ChatHandler::HandleReloadEventScriptsCommand(const char* arg)      objmgr.LoadEventScripts();      if(*arg!='a') -        SendGlobalSysMessage("DB table `event_scripts` reloaded."); +        SendGlobalGMSysMessage("DB table `event_scripts` reloaded.");      return true;  } @@ -558,7 +558,7 @@ bool ChatHandler::HandleReloadWpScriptsCommand(const char* arg)  	objmgr.LoadWaypointScripts();  	if(*arg!='a') -        SendGlobalSysMessage("DB table `waypoint_scripts` reloaded."); +        SendGlobalGMSysMessage("DB table `waypoint_scripts` reloaded.");      return true;  } @@ -578,7 +578,7 @@ bool ChatHandler::HandleReloadQuestEndScriptsCommand(const char* arg)      objmgr.LoadQuestEndScripts();      if(*arg!='a') -        SendGlobalSysMessage("DB table `quest_end_scripts` reloaded."); +        SendGlobalGMSysMessage("DB table `quest_end_scripts` reloaded.");      return true;  } @@ -598,7 +598,7 @@ bool ChatHandler::HandleReloadQuestStartScriptsCommand(const char* arg)      objmgr.LoadQuestStartScripts();      if(*arg!='a') -        SendGlobalSysMessage("DB table `quest_start_scripts` reloaded."); +        SendGlobalGMSysMessage("DB table `quest_start_scripts` reloaded.");      return true;  } @@ -618,7 +618,7 @@ bool ChatHandler::HandleReloadSpellScriptsCommand(const char* arg)      objmgr.LoadSpellScripts();      if(*arg!='a') -        SendGlobalSysMessage("DB table `spell_scripts` reloaded."); +        SendGlobalGMSysMessage("DB table `spell_scripts` reloaded.");      return true;  } @@ -627,7 +627,7 @@ bool ChatHandler::HandleReloadDbScriptStringCommand(const char* arg)  {      sLog.outString( "Re-Loading Script strings from `db_script_string`...");      objmgr.LoadDbScriptStrings(); -    SendGlobalSysMessage("DB table `db_script_string` reloaded."); +    SendGlobalGMSysMessage("DB table `db_script_string` reloaded.");      return true;  } @@ -637,7 +637,7 @@ bool ChatHandler::HandleReloadGameGraveyardZoneCommand(const char* /*arg*/)      objmgr.LoadGraveyardZones(); -    SendGlobalSysMessage("DB table `game_graveyard_zone` reloaded."); +    SendGlobalGMSysMessage("DB table `game_graveyard_zone` reloaded.");      return true;  } @@ -648,7 +648,7 @@ bool ChatHandler::HandleReloadGameTeleCommand(const char* /*arg*/)      objmgr.LoadGameTele(); -    SendGlobalSysMessage("DB table `game_tele` reloaded."); +    SendGlobalGMSysMessage("DB table `game_tele` reloaded.");      return true;  } @@ -659,7 +659,7 @@ bool ChatHandler::HandleReloadSpellDisabledCommand(const char* /*arg*/)      objmgr.LoadSpellDisabledEntrys(); -    SendGlobalSysMessage("DB table `spell_disabled` reloaded."); +    SendGlobalGMSysMessage("DB table `spell_disabled` reloaded.");      return true;  } @@ -668,7 +668,7 @@ bool ChatHandler::HandleReloadLocalesCreatureCommand(const char* /*arg*/)  {      sLog.outString( "Re-Loading Locales Creature ...");      objmgr.LoadCreatureLocales(); -    SendGlobalSysMessage("DB table `locales_creature` reloaded."); +    SendGlobalGMSysMessage("DB table `locales_creature` reloaded.");      return true;  } @@ -676,7 +676,7 @@ bool ChatHandler::HandleReloadLocalesGameobjectCommand(const char* /*arg*/)  {      sLog.outString( "Re-Loading Locales Gameobject ... ");      objmgr.LoadGameObjectLocales(); -    SendGlobalSysMessage("DB table `locales_gameobject` reloaded."); +    SendGlobalGMSysMessage("DB table `locales_gameobject` reloaded.");      return true;  } @@ -684,7 +684,7 @@ bool ChatHandler::HandleReloadLocalesItemCommand(const char* /*arg*/)  {      sLog.outString( "Re-Loading Locales Item ... ");      objmgr.LoadItemLocales(); -    SendGlobalSysMessage("DB table `locales_item` reloaded."); +    SendGlobalGMSysMessage("DB table `locales_item` reloaded.");      return true;  } @@ -692,7 +692,7 @@ bool ChatHandler::HandleReloadLocalesNpcTextCommand(const char* /*arg*/)  {      sLog.outString( "Re-Loading Locales NPC Text ... ");      objmgr.LoadNpcTextLocales(); -    SendGlobalSysMessage("DB table `locales_npc_text` reloaded."); +    SendGlobalGMSysMessage("DB table `locales_npc_text` reloaded.");      return true;  } @@ -700,7 +700,7 @@ bool ChatHandler::HandleReloadLocalesPageTextCommand(const char* /*arg*/)  {      sLog.outString( "Re-Loading Locales Page Text ... ");      objmgr.LoadPageTextLocales(); -    SendGlobalSysMessage("DB table `locales_page_text` reloaded."); +    SendGlobalGMSysMessage("DB table `locales_page_text` reloaded.");      return true;  } @@ -708,7 +708,7 @@ bool ChatHandler::HandleReloadLocalesQuestCommand(const char* /*arg*/)  {      sLog.outString( "Re-Loading Locales Quest ... ");      objmgr.LoadQuestLocales(); -    SendGlobalSysMessage("DB table `locales_quest` reloaded."); +    SendGlobalGMSysMessage("DB table `locales_quest` reloaded.");      return true;  } diff --git a/src/game/World.cpp b/src/game/World.cpp index 47598dafc65..5b36e3d4d9c 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -2273,6 +2273,23 @@ void World::SendGlobalMessage(WorldPacket *packet, WorldSession *self, uint32 te      }  } +void World::SendGlobalGMMessage(WorldPacket *packet, WorldSession *self, uint32 team) +{ +    SessionMap::iterator itr; +    for (itr = m_sessions.begin(); itr != m_sessions.end(); itr++) +    { +        if (itr->second && +            itr->second->GetPlayer() && +            itr->second->GetPlayer()->IsInWorld() && +            itr->second != self && +            itr->second->GetSecurity() >SEC_PLAYER && +            (team == 0 || itr->second->GetPlayer()->GetTeam() == team) ) +        { +            itr->second->SendPacket(packet); +        } +    } +} +  /// Send a System Message to all players (except self if mentioned)  void World::SendWorldText(int32 string_id, ...)  { @@ -2327,6 +2344,60 @@ void World::SendWorldText(int32 string_id, ...)              delete data_cache[i][j];  } +void World::SendGMText(int32 string_id, ...) +{ +    std::vector<std::vector<WorldPacket*> > data_cache;     // 0 = default, i => i-1 locale index + +    for(SessionMap::iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) +    { +        if(!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld() ) +            continue; + +        uint32 loc_idx = itr->second->GetSessionDbLocaleIndex(); +        uint32 cache_idx = loc_idx+1; + +        std::vector<WorldPacket*>* data_list; + +        // create if not cached yet +        if(data_cache.size() < cache_idx+1 || data_cache[cache_idx].empty()) +        { +            if(data_cache.size() < cache_idx+1) +                data_cache.resize(cache_idx+1); + +            data_list = &data_cache[cache_idx]; + +            char const* text = objmgr.GetTrinityString(string_id,loc_idx); + +            char buf[1000]; + +            va_list argptr; +            va_start( argptr, string_id ); +            vsnprintf( buf,1000, text, argptr ); +            va_end( argptr ); + +            char* pos = &buf[0]; + +            while(char* line = ChatHandler::LineFromMessage(pos)) +            { +                WorldPacket* data = new WorldPacket(); +                ChatHandler::FillMessageData(data, NULL, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, NULL, 0, line, NULL); +                data_list->push_back(data); +            } +        } +        else +            data_list = &data_cache[cache_idx]; + +        for(int i = 0; i < data_list->size(); ++i) +            if(itr->second->GetSecurity()>0) +            itr->second->SendPacket((*data_list)[i]); +    } + +    // free memory +    for(int i = 0; i < data_cache.size(); ++i) +        for(int j = 0; j < data_cache[i].size(); ++j) +            delete data_cache[i][j]; +} +  /// Send a System Message to all players (except self if mentioned)  void World::SendGlobalText(const char* text, WorldSession *self)  { diff --git a/src/game/World.h b/src/game/World.h index 2edbf7669f9..edf5e22850b 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -419,7 +419,9 @@ class World          void SendWorldText(int32 string_id, ...);          void SendGlobalText(const char* text, WorldSession *self); +        void SendGMText(int32 string_id, ...);          void SendGlobalMessage(WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); +        void SendGlobalGMMessage(WorldPacket *packet, WorldSession *self = 0, uint32 team = 0);          void SendZoneMessage(uint32 zone, WorldPacket *packet, WorldSession *self = 0, uint32 team = 0);          void SendZoneText(uint32 zone, const char *text, WorldSession *self = 0, uint32 team = 0);          void SendServerMessage(uint32 type, const char *text = "", Player* player = NULL);  | 
