mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +01:00
*Remove use of worldpacket and send expected world state update for enemies left (per wave) in hyjal - by nofantasy
--HG-- branch : trunk
This commit is contained in:
@@ -5,6 +5,10 @@
|
||||
#ifndef DEF_HYJAL_H
|
||||
#define DEF_HYJAL_H
|
||||
|
||||
#define WORLD_STATE_WAVES 2842
|
||||
#define WORLD_STATE_ENEMY 2453
|
||||
#define WORLD_STATE_ENEMYCOUNT 2454
|
||||
|
||||
#define DATA_ANETHERON 1
|
||||
#define DATA_ANETHERONEVENT 2
|
||||
#define DATA_ARCHIMONDE 3
|
||||
@@ -21,5 +25,5 @@
|
||||
#define DATA_TRASH 14
|
||||
#define DATA_RESET_TRASH_COUNT 15
|
||||
|
||||
#define ERROR_INST_DATA "SD2: Instance data not set properly for Mount Hyjal. Encounters will be buggy"
|
||||
#define ERROR_INST_DATA "TSCR: Instance data not set properly for Mount Hyjal. Encounters will be buggy"
|
||||
#endif
|
||||
|
||||
@@ -17,13 +17,12 @@
|
||||
/* ScriptData
|
||||
SDName: HyjalAI
|
||||
SD%Complete: 90
|
||||
SDComment: World Packet workaround for World States
|
||||
SDComment:
|
||||
SDCategory: Caverns of Time, Mount Hyjal
|
||||
EndScriptData */
|
||||
|
||||
#include "precompiled.h"
|
||||
#include "hyjalAI.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
// Locations for summoning waves in Alliance base
|
||||
float AllianceBase[4][3]=
|
||||
@@ -99,9 +98,9 @@ void hyjalAI::Reset()
|
||||
memset(Spell, 0, sizeof(Spell));
|
||||
|
||||
//Reset World States
|
||||
UpdateWorldState(WORLDSTATE_WAVES, 0);
|
||||
UpdateWorldState(WORLDSTATE_ENEMY, 0);
|
||||
UpdateWorldState(WORLDSTATE_ENEMYCOUNT, 0);
|
||||
UpdateWorldState(WORLD_STATE_WAVES, 0);
|
||||
UpdateWorldState(WORLD_STATE_ENEMY, 0);
|
||||
UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0);
|
||||
|
||||
//Reset Instance Data for trash count
|
||||
if(pInstance)
|
||||
@@ -204,22 +203,24 @@ void hyjalAI::SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3])
|
||||
uint32 stateValue = Count+1;
|
||||
if(FirstBossDead)
|
||||
stateValue -= 9; // Subtract 9 from it to give the proper wave number if we are greater than 8
|
||||
UpdateWorldState(WORLDSTATE_WAVES, stateValue); // Set world state to our current wave number
|
||||
UpdateWorldState(WORLDSTATE_ENEMY, 1);
|
||||
//UpdateWorldState(WORLDSTATE_ENEMYCOUNT, EnemyCount); // Let Instance Script handle this
|
||||
pInstance->SetData(DATA_TRASH, EnemyCount);
|
||||
UpdateWorldState(WORLD_STATE_WAVES, stateValue); // Set world state to our current wave number
|
||||
UpdateWorldState(WORLD_STATE_ENEMY, 1); // Enable world state
|
||||
|
||||
pInstance->SetData(DATA_TRASH, EnemyCount); // Send data for instance script to update count
|
||||
|
||||
if(!Debug)
|
||||
NextWaveTimer = wave[Count].WaveTimer;
|
||||
else
|
||||
{
|
||||
NextWaveTimer = 15000;
|
||||
DoTextEmote(": Debug Mode is enabled. Next Wave in 15 seconds", NULL);
|
||||
debug_log("TSCR: HyjalAI: debug mode is enabled. Next Wave in 15 seconds");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateWorldState(WORLDSTATE_WAVES, 0); // Set world state for waves to 0 to disable it.
|
||||
UpdateWorldState(WORLDSTATE_ENEMYCOUNT, 1); // Set World State for enemies invading to 1.
|
||||
UpdateWorldState(WORLD_STATE_WAVES, 0); // Set world state for waves to 0 to disable it.
|
||||
UpdateWorldState(WORLD_STATE_ENEMY, 1);
|
||||
UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 1); // Set World State for enemies invading to 1.
|
||||
Summon = false;
|
||||
}
|
||||
CheckTimer = 5000;
|
||||
@@ -241,9 +242,9 @@ void hyjalAI::StartEvent(Player* player)
|
||||
|
||||
m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
|
||||
UpdateWorldState(WORLDSTATE_WAVES, 0);
|
||||
UpdateWorldState(WORLDSTATE_ENEMY, 0);
|
||||
UpdateWorldState(WORLDSTATE_ENEMYCOUNT, 0);
|
||||
UpdateWorldState(WORLD_STATE_WAVES, 0);
|
||||
UpdateWorldState(WORLD_STATE_ENEMY, 0);
|
||||
UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0);
|
||||
}
|
||||
|
||||
uint32 hyjalAI::GetInstanceData(uint32 Event)
|
||||
@@ -291,20 +292,25 @@ void hyjalAI::Talk(uint32 id)
|
||||
DoScriptText(YellId, m_creature);
|
||||
}
|
||||
|
||||
// Slight workaround for now
|
||||
void hyjalAI::UpdateWorldState(uint32 field, uint32 value)
|
||||
void hyjalAI::UpdateWorldState(uint32 id, uint32 state)
|
||||
{
|
||||
Map * map = m_creature->GetMap();
|
||||
if(!map->IsDungeon()) return;
|
||||
|
||||
if(!map->IsDungeon())
|
||||
return;
|
||||
|
||||
WorldPacket data(SMSG_UPDATE_WORLD_STATE, 8);
|
||||
Map::PlayerList const& players = map->GetPlayers();
|
||||
|
||||
if (!players.isEmpty())
|
||||
{
|
||||
for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
{
|
||||
if (Player* player = itr->getSource())
|
||||
player->SendUpdateWorldState(id,state);
|
||||
}
|
||||
}else debug_log("TSCR: HyjalAI: UpdateWorldState, but PlayerList is empty");
|
||||
|
||||
data << field;
|
||||
data << value;
|
||||
|
||||
map->SendToPlayers(&data);
|
||||
|
||||
// TODO: Uncomment and remove everything above this line only when the core patch for this is accepted
|
||||
//remove everything above this line only when/if the core patch for this is accepted and needed
|
||||
//m_creature->GetMap()->UpdateWorldState(field, value);
|
||||
}
|
||||
|
||||
@@ -420,7 +426,7 @@ void hyjalAI::UpdateAI(const uint32 diff)
|
||||
CheckTimer = 0;
|
||||
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
BossGUID[i] = 0;
|
||||
UpdateWorldState(WORLDSTATE_ENEMY, 0); // Reset world state for enemies to disable it
|
||||
UpdateWorldState(WORLD_STATE_ENEMY, 0); // Reset world state for enemies to disable it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,10 +27,6 @@
|
||||
|
||||
#define SPELL_TELEPORT_VISUAL 41232
|
||||
|
||||
#define WORLDSTATE_WAVES 2842
|
||||
#define WORLDSTATE_ENEMY 2453
|
||||
#define WORLDSTATE_ENEMYCOUNT 2454
|
||||
|
||||
//Spells for Jaina
|
||||
#define SPELL_BRILLIANCE_AURA 31260 // The database must handle this spell via creature_addon
|
||||
#define SPELL_BLIZZARD 31266
|
||||
|
||||
@@ -23,7 +23,6 @@ EndScriptData */
|
||||
|
||||
#include "precompiled.h"
|
||||
#include "def_hyjal.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
#define ENCOUNTERS 5
|
||||
|
||||
@@ -121,7 +120,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
|
||||
case DATA_TRASH:
|
||||
if(data) Trash = data;
|
||||
else Trash--;
|
||||
UpdateWorldState(2453, data);
|
||||
UpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -145,13 +144,18 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
|
||||
return 0;
|
||||
}
|
||||
|
||||
void UpdateWorldState(uint32 field, uint32 value)
|
||||
void UpdateWorldState(uint32 id, uint32 state)
|
||||
{
|
||||
WorldPacket data(SMSG_UPDATE_WORLD_STATE, 8);
|
||||
data << field;
|
||||
data << value;
|
||||
|
||||
instance->SendToPlayers(&data);
|
||||
Map::PlayerList const& players = instance->GetPlayers();
|
||||
|
||||
if (!players.isEmpty())
|
||||
{
|
||||
for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
{
|
||||
if (Player* player = itr->getSource())
|
||||
player->SendUpdateWorldState(id,state);
|
||||
}
|
||||
}else debug_log("TSCR: Instance Hyjal: UpdateWorldState, but PlayerList is empty!");
|
||||
}
|
||||
|
||||
const char* Save()
|
||||
|
||||
@@ -40,7 +40,7 @@ EndScriptData */
|
||||
#define SPELL_ENRAGE 33653
|
||||
#define SPELL_MARK_DEATH 37128
|
||||
|
||||
struct MANGOS_DLL_DECL boss_doomwalkerAI : public ScriptedAI
|
||||
struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI
|
||||
{
|
||||
boss_doomwalkerAI(Creature *c) : ScriptedAI(c) {Reset();}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user