Merge commit 'origin/master' into 320

Conflicts:
	src/game/BattleGround.cpp
This commit is contained in:
tomrus88 2009-09-28 19:52:54 +04:00
commit 546f7a7fe5
47 changed files with 985 additions and 1264 deletions

View file

@ -37,6 +37,7 @@
#include "WaypointMovementGenerator.h"
#include "InstanceData.h"
#include "BattleGroundMgr.h"
#include "Spell.h"
#include "Util.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
@ -160,7 +161,11 @@ void Creature::RemoveCorpse()
setDeathState(DEAD);
ObjectAccessor::UpdateObjectVisibility(this);
loot.clear();
m_respawnTime = time(NULL) + m_respawnDelay;
uint32 respawnDelay = m_respawnDelay;
if (AI())
AI()->CorpseRemoved(respawnDelay);
m_respawnTime = time(NULL) + respawnDelay;
float x,y,z,o;
GetRespawnCoord(x, y, z, &o);
@ -327,6 +332,15 @@ void Creature::Update(uint32 diff)
break;
case DEAD:
{
if (isSpiritService())
{
Unit::Update( diff );
// do not allow the AI to be changed during update
m_AI_locked = true;
i_AI->UpdateAI(diff);
m_AI_locked = false;
break; // they don't should respawn
}
if( m_respawnTime <= time(NULL) )
{
DEBUG_LOG("Respawning...");
@ -1450,6 +1464,7 @@ void Creature::DeleteFromDB()
WorldDatabase.PExecuteLog("DELETE FROM creature_movement WHERE id = '%u'", m_DBTableGuid);
WorldDatabase.PExecuteLog("DELETE FROM game_event_creature WHERE guid = '%u'", m_DBTableGuid);
WorldDatabase.PExecuteLog("DELETE FROM game_event_model_equip WHERE guid = '%u'", m_DBTableGuid);
WorldDatabase.PExecuteLog("DELETE FROM creature_battleground WHERE guid = '%u'", m_DBTableGuid);
WorldDatabase.CommitTransaction();
}
@ -1528,12 +1543,15 @@ void Creature::setDeathState(DeathState s)
{
SetHealth(GetMaxHealth());
SetLootRecipient(NULL);
Unit::setDeathState(ALIVE);
CreatureInfo const *cinfo = GetCreatureInfo();
SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
AddMonsterMoveFlag(MONSTER_MOVE_WALK);
SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag);
if (!isSpiritService())
Unit::setDeathState(ALIVE);
else
Unit::setDeathState(DEAD);
clearUnitState(UNIT_STAT_ALL_STATE);
i_motionMaster.Clear();
SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool));
@ -2308,3 +2326,13 @@ void Creature::SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transi
//float orientation = (float)atan2((double)dy, (double)dx);
SendMonsterMove(x, y, z, 0, GetMonsterMoveFlags(), transitTime, player);
}
void Creature::SendAreaSpiritHealerQueryOpcode(Player *pl)
{
uint32 next_resurrect = 0;
if (Spell* pcurSpell = GetCurrentSpell(CURRENT_CHANNELED_SPELL))
next_resurrect = pcurSpell->GetCastedTime();
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 8 + 4);
data << GetGUID() << next_resurrect;
pl->SendDirectMessage(&data);
}