mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/game/Entities/Unit/Unit.cpp
This commit is contained in:
3
sql/updates/world/2014_06_17_00_world_spell_group.sql
Normal file
3
sql/updates/world/2014_06_17_00_world_spell_group.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
DELETE FROM spell_group WHERE id=1059 AND spell_id=58180;
|
||||
DELETE FROM spell_group WHERE id=1059 AND spell_id=58181;
|
||||
@@ -80,12 +80,11 @@ void BattlegroundIC::DoAction(uint32 action, uint64 var)
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
player->SetTransport(player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde);
|
||||
(player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->AddPassenger(player);
|
||||
|
||||
player->m_movementInfo.transport.pos.m_positionX = TransportMovementInfo.GetPositionX();
|
||||
player->m_movementInfo.transport.pos.m_positionY = TransportMovementInfo.GetPositionY();
|
||||
player->m_movementInfo.transport.pos.m_positionZ = TransportMovementInfo.GetPositionZ();
|
||||
player->m_movementInfo.transport.guid = (player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->GetGUID();
|
||||
|
||||
if (player->TeleportTo(GetMapId(), TeleportToTransportPosition.GetPositionX(),
|
||||
TeleportToTransportPosition.GetPositionY(),
|
||||
|
||||
@@ -1876,6 +1876,8 @@ bool Pet::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint3
|
||||
if (!InitEntry(Entry))
|
||||
return false;
|
||||
|
||||
// Force regen flag for player pets, just like we do for players themselves
|
||||
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
|
||||
SetSheath(SHEATH_STATE_MELEE);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -6292,7 +6292,7 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons
|
||||
{
|
||||
Powers powerType = Powers(GetMiscValue());
|
||||
|
||||
if (target->getPowerType() != powerType && !(m_spellInfo->AttributesEx7 & SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
|
||||
if (target->GetTypeId() == TYPEID_PLAYER && target->getPowerType() != powerType && !(m_spellInfo->AttributesEx7 & SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
|
||||
return;
|
||||
|
||||
if (!target->IsAlive() || !target->GetMaxPower(powerType))
|
||||
|
||||
@@ -1594,7 +1594,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
|
||||
|
||||
Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue);
|
||||
|
||||
if (unitTarget->getPowerType() != power && !(m_spellInfo->AttributesEx7 & SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
|
||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->getPowerType() != power && !(m_spellInfo->AttributesEx7 & SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
|
||||
return;
|
||||
|
||||
if (unitTarget->GetMaxPower(power) == 0)
|
||||
@@ -1703,7 +1703,7 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex)
|
||||
|
||||
Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue);
|
||||
|
||||
if (unitTarget->getPowerType() != power && !(m_spellInfo->AttributesEx7 & SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
|
||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->getPowerType() != power && !(m_spellInfo->AttributesEx7 & SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
|
||||
return;
|
||||
|
||||
uint32 maxPower = unitTarget->GetMaxPower(power);
|
||||
|
||||
@@ -334,7 +334,7 @@ class boss_algalon_the_observer : public CreatureScript
|
||||
{
|
||||
case ACTION_START_INTRO:
|
||||
{
|
||||
me->SetFlag(UNIT_FIELD_FLAGS_2, 0x20);
|
||||
me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_INSTANTLY_APPEAR_MODEL);
|
||||
me->SetDisableGravity(true);
|
||||
DoCast(me, SPELL_ARRIVAL, true);
|
||||
DoCast(me, SPELL_RIDE_THE_LIGHTNING, true);
|
||||
|
||||
@@ -1517,7 +1517,10 @@ class npc_brewfest_reveler : public CreatureScript
|
||||
enum TrainingDummy
|
||||
{
|
||||
NPC_ADVANCED_TARGET_DUMMY = 2674,
|
||||
NPC_TARGET_DUMMY = 2673
|
||||
NPC_TARGET_DUMMY = 2673,
|
||||
|
||||
EVENT_TD_CHECK_COMBAT = 1,
|
||||
EVENT_TD_DESPAWN = 2
|
||||
};
|
||||
|
||||
class npc_training_dummy : public CreatureScript
|
||||
@@ -1530,20 +1533,22 @@ public:
|
||||
npc_training_dummyAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
SetCombatMovement(false);
|
||||
entry = creature->GetEntry();
|
||||
}
|
||||
|
||||
uint32 entry;
|
||||
uint32 resetTimer;
|
||||
uint32 despawnTimer;
|
||||
EventMap _events;
|
||||
std::unordered_map<uint64, time_t> _damageTimes;
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
me->SetControlled(true, UNIT_STATE_STUNNED);//disable rotate
|
||||
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);//imune to knock aways like blast wave
|
||||
|
||||
resetTimer = 5000;
|
||||
despawnTimer = 15000;
|
||||
_events.Reset();
|
||||
_damageTimes.clear();
|
||||
if (me->GetEntry() != NPC_ADVANCED_TARGET_DUMMY && me->GetEntry() != NPC_TARGET_DUMMY)
|
||||
_events.ScheduleEvent(EVENT_TD_CHECK_COMBAT, 1000);
|
||||
else
|
||||
_events.ScheduleEvent(EVENT_TD_DESPAWN, 15000);
|
||||
}
|
||||
|
||||
void EnterEvadeMode() override
|
||||
@@ -1554,37 +1559,52 @@ public:
|
||||
Reset();
|
||||
}
|
||||
|
||||
void DamageTaken(Unit* /*doneBy*/, uint32& damage) override
|
||||
void DamageTaken(Unit* doneBy, uint32& damage) override
|
||||
{
|
||||
resetTimer = 5000;
|
||||
me->AddThreat(doneBy, float(damage)); // just to create threat reference
|
||||
_damageTimes[doneBy->GetGUID()] = time(NULL);
|
||||
damage = 0;
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
if (!me->IsInCombat())
|
||||
return;
|
||||
|
||||
if (!me->HasUnitState(UNIT_STATE_STUNNED))
|
||||
me->SetControlled(true, UNIT_STATE_STUNNED);//disable rotate
|
||||
|
||||
if (entry != NPC_ADVANCED_TARGET_DUMMY && entry != NPC_TARGET_DUMMY)
|
||||
_events.Update(diff);
|
||||
|
||||
if (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
if (resetTimer <= diff)
|
||||
switch (eventId)
|
||||
{
|
||||
EnterEvadeMode();
|
||||
resetTimer = 5000;
|
||||
case EVENT_TD_CHECK_COMBAT:
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
for (std::unordered_map<uint64, time_t>::iterator itr = _damageTimes.begin(); itr != _damageTimes.end();)
|
||||
{
|
||||
// If unit has not dealt damage to training dummy for 5 seconds, remove him from combat
|
||||
if (itr->second < now - 5)
|
||||
{
|
||||
if (Unit* unit = ObjectAccessor::GetUnit(*me, itr->first))
|
||||
unit->getHostileRefManager().deleteReference(me);
|
||||
|
||||
itr = _damageTimes.erase(itr);
|
||||
}
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_TD_CHECK_COMBAT, 1000);
|
||||
break;
|
||||
}
|
||||
case EVENT_TD_DESPAWN:
|
||||
me->DespawnOrUnsummon(1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
else
|
||||
resetTimer -= diff;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (despawnTimer <= diff)
|
||||
me->DespawnOrUnsummon();
|
||||
else
|
||||
despawnTimer -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user