*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
|
#ifndef DEF_HYJAL_H
|
||||||
#define 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_ANETHERON 1
|
||||||
#define DATA_ANETHERONEVENT 2
|
#define DATA_ANETHERONEVENT 2
|
||||||
#define DATA_ARCHIMONDE 3
|
#define DATA_ARCHIMONDE 3
|
||||||
@@ -21,5 +25,5 @@
|
|||||||
#define DATA_TRASH 14
|
#define DATA_TRASH 14
|
||||||
#define DATA_RESET_TRASH_COUNT 15
|
#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
|
#endif
|
||||||
|
|||||||
@@ -17,13 +17,12 @@
|
|||||||
/* ScriptData
|
/* ScriptData
|
||||||
SDName: HyjalAI
|
SDName: HyjalAI
|
||||||
SD%Complete: 90
|
SD%Complete: 90
|
||||||
SDComment: World Packet workaround for World States
|
SDComment:
|
||||||
SDCategory: Caverns of Time, Mount Hyjal
|
SDCategory: Caverns of Time, Mount Hyjal
|
||||||
EndScriptData */
|
EndScriptData */
|
||||||
|
|
||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
#include "hyjalAI.h"
|
#include "hyjalAI.h"
|
||||||
#include "WorldPacket.h"
|
|
||||||
|
|
||||||
// Locations for summoning waves in Alliance base
|
// Locations for summoning waves in Alliance base
|
||||||
float AllianceBase[4][3]=
|
float AllianceBase[4][3]=
|
||||||
@@ -99,9 +98,9 @@ void hyjalAI::Reset()
|
|||||||
memset(Spell, 0, sizeof(Spell));
|
memset(Spell, 0, sizeof(Spell));
|
||||||
|
|
||||||
//Reset World States
|
//Reset World States
|
||||||
UpdateWorldState(WORLDSTATE_WAVES, 0);
|
UpdateWorldState(WORLD_STATE_WAVES, 0);
|
||||||
UpdateWorldState(WORLDSTATE_ENEMY, 0);
|
UpdateWorldState(WORLD_STATE_ENEMY, 0);
|
||||||
UpdateWorldState(WORLDSTATE_ENEMYCOUNT, 0);
|
UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0);
|
||||||
|
|
||||||
//Reset Instance Data for trash count
|
//Reset Instance Data for trash count
|
||||||
if(pInstance)
|
if(pInstance)
|
||||||
@@ -204,22 +203,24 @@ void hyjalAI::SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3])
|
|||||||
uint32 stateValue = Count+1;
|
uint32 stateValue = Count+1;
|
||||||
if(FirstBossDead)
|
if(FirstBossDead)
|
||||||
stateValue -= 9; // Subtract 9 from it to give the proper wave number if we are greater than 8
|
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(WORLD_STATE_WAVES, stateValue); // Set world state to our current wave number
|
||||||
UpdateWorldState(WORLDSTATE_ENEMY, 1);
|
UpdateWorldState(WORLD_STATE_ENEMY, 1); // Enable world state
|
||||||
//UpdateWorldState(WORLDSTATE_ENEMYCOUNT, EnemyCount); // Let Instance Script handle this
|
|
||||||
pInstance->SetData(DATA_TRASH, EnemyCount);
|
pInstance->SetData(DATA_TRASH, EnemyCount); // Send data for instance script to update count
|
||||||
|
|
||||||
if(!Debug)
|
if(!Debug)
|
||||||
NextWaveTimer = wave[Count].WaveTimer;
|
NextWaveTimer = wave[Count].WaveTimer;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NextWaveTimer = 15000;
|
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
|
else
|
||||||
{
|
{
|
||||||
UpdateWorldState(WORLDSTATE_WAVES, 0); // Set world state for waves to 0 to disable it.
|
UpdateWorldState(WORLD_STATE_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_ENEMY, 1);
|
||||||
|
UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 1); // Set World State for enemies invading to 1.
|
||||||
Summon = false;
|
Summon = false;
|
||||||
}
|
}
|
||||||
CheckTimer = 5000;
|
CheckTimer = 5000;
|
||||||
@@ -241,9 +242,9 @@ void hyjalAI::StartEvent(Player* player)
|
|||||||
|
|
||||||
m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||||
|
|
||||||
UpdateWorldState(WORLDSTATE_WAVES, 0);
|
UpdateWorldState(WORLD_STATE_WAVES, 0);
|
||||||
UpdateWorldState(WORLDSTATE_ENEMY, 0);
|
UpdateWorldState(WORLD_STATE_ENEMY, 0);
|
||||||
UpdateWorldState(WORLDSTATE_ENEMYCOUNT, 0);
|
UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 hyjalAI::GetInstanceData(uint32 Event)
|
uint32 hyjalAI::GetInstanceData(uint32 Event)
|
||||||
@@ -291,20 +292,25 @@ void hyjalAI::Talk(uint32 id)
|
|||||||
DoScriptText(YellId, m_creature);
|
DoScriptText(YellId, m_creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slight workaround for now
|
void hyjalAI::UpdateWorldState(uint32 id, uint32 state)
|
||||||
void hyjalAI::UpdateWorldState(uint32 field, uint32 value)
|
|
||||||
{
|
{
|
||||||
Map * map = m_creature->GetMap();
|
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;
|
//remove everything above this line only when/if the core patch for this is accepted and needed
|
||||||
data << value;
|
|
||||||
|
|
||||||
map->SendToPlayers(&data);
|
|
||||||
|
|
||||||
// TODO: Uncomment and remove everything above this line only when the core patch for this is accepted
|
|
||||||
//m_creature->GetMap()->UpdateWorldState(field, value);
|
//m_creature->GetMap()->UpdateWorldState(field, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -420,7 +426,7 @@ void hyjalAI::UpdateAI(const uint32 diff)
|
|||||||
CheckTimer = 0;
|
CheckTimer = 0;
|
||||||
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||||
BossGUID[i] = 0;
|
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 SPELL_TELEPORT_VISUAL 41232
|
||||||
|
|
||||||
#define WORLDSTATE_WAVES 2842
|
|
||||||
#define WORLDSTATE_ENEMY 2453
|
|
||||||
#define WORLDSTATE_ENEMYCOUNT 2454
|
|
||||||
|
|
||||||
//Spells for Jaina
|
//Spells for Jaina
|
||||||
#define SPELL_BRILLIANCE_AURA 31260 // The database must handle this spell via creature_addon
|
#define SPELL_BRILLIANCE_AURA 31260 // The database must handle this spell via creature_addon
|
||||||
#define SPELL_BLIZZARD 31266
|
#define SPELL_BLIZZARD 31266
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ EndScriptData */
|
|||||||
|
|
||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
#include "def_hyjal.h"
|
#include "def_hyjal.h"
|
||||||
#include "WorldPacket.h"
|
|
||||||
|
|
||||||
#define ENCOUNTERS 5
|
#define ENCOUNTERS 5
|
||||||
|
|
||||||
@@ -121,7 +120,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
|
|||||||
case DATA_TRASH:
|
case DATA_TRASH:
|
||||||
if(data) Trash = data;
|
if(data) Trash = data;
|
||||||
else Trash--;
|
else Trash--;
|
||||||
UpdateWorldState(2453, data);
|
UpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,13 +144,18 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateWorldState(uint32 field, uint32 value)
|
void UpdateWorldState(uint32 id, uint32 state)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_UPDATE_WORLD_STATE, 8);
|
Map::PlayerList const& players = instance->GetPlayers();
|
||||||
data << field;
|
|
||||||
data << value;
|
if (!players.isEmpty())
|
||||||
|
{
|
||||||
instance->SendToPlayers(&data);
|
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()
|
const char* Save()
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ EndScriptData */
|
|||||||
#define SPELL_ENRAGE 33653
|
#define SPELL_ENRAGE 33653
|
||||||
#define SPELL_MARK_DEATH 37128
|
#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();}
|
boss_doomwalkerAI(Creature *c) : ScriptedAI(c) {Reset();}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user