Merge remote-tracking branch 'origin/master' into mmaps

Conflicts:
	src/server/game/Movement/Spline/MoveSplineInit.cpp
This commit is contained in:
Nay
2012-09-07 03:34:23 +01:00
19 changed files with 149 additions and 33 deletions
@@ -0,0 +1,4 @@
SET @Spell := 28715; -- Flamecap Fire
DELETE FROM `spell_bonus_data` WHERE `entry`=@Spell;
INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`ap_dot_bonus`,`comments`) VALUES
(@Spell,0,0,0,0, 'Flamecap Fire');
+5
View File
@@ -111,6 +111,11 @@ void CombatAI::UpdateAI(const uint32 diff)
DoMeleeAttackIfReady();
}
void CombatAI::SpellInterrupted(uint32 spellId, uint32 unTimeMs)
{
events.RescheduleEvent(spellId, unTimeMs);
}
/////////////////
//CasterAI
/////////////////
+1
View File
@@ -46,6 +46,7 @@ class CombatAI : public CreatureAI
void EnterCombat(Unit* who);
void JustDied(Unit* killer);
void UpdateAI(const uint32 diff);
void SpellInterrupted(uint32 spellId, uint32 unTimeMs);
static int Permissible(const Creature*);
protected:
EventMap events;
+4
View File
@@ -242,6 +242,10 @@ class UnitAI
// Called when the unit heals
virtual void HealDone(Unit* /*done_to*/, uint32& /*addhealth*/) {}
/// Called when a spell is interrupted by Spell::EffectInterruptCast
/// Use to reschedule next planned cast of spell.
virtual void SpellInterrupted(uint32 /*spellId*/, uint32 /*unTimeMs*/) {}
void AttackStartCaster(Unit* victim, float dist);
void DoAddAuraToAllHostilePlayers(uint32 spellid);
@@ -1317,6 +1317,10 @@ bool CreatureEventAI::CanCast(Unit* target, SpellInfo const* spell, bool trigger
if (!me->IsInRange(target, spell->GetMinRange(false), spell->GetMaxRange(false)))
return false;
//Spell is on cooldown
if (me->HasSpellCooldown(spell->Id))
return false;
return true;
}
+1 -1
View File
@@ -634,7 +634,7 @@ void SmartAI::SpellHitTarget(Unit* target, const SpellInfo* spellInfo)
void SmartAI::DamageTaken(Unit* doneBy, uint32& damage)
{
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage);
if ((damage >= me->GetHealth() - mInvincibilityHpLevel) && (mInvincibilityHpLevel > 0))
if (mInvincibilityHpLevel && (damage >= me->GetHealth() - mInvincibilityHpLevel))
{
damage = 0;
me->SetHealth(mInvincibilityHpLevel);
@@ -2231,6 +2231,38 @@ bool Creature::HasSpellCooldown(uint32 spell_id) const
return (itr != m_CreatureSpellCooldowns.end() && itr->second > time(NULL)) || HasCategoryCooldown(spell_id);
}
void Creature::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
{
time_t curTime = time(NULL);
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
{
if (m_spells[i] == 0)
continue;
uint32 unSpellId = m_spells[i];
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(unSpellId);
if (!spellInfo)
{
ASSERT(spellInfo);
continue;
}
// Not send cooldown for this spells
if (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
continue;
if (spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE)
continue;
if ((idSchoolMask & spellInfo->GetSchoolMask()) && GetCreatureSpellCooldownDelay(unSpellId) < unTimeMs)
{
_AddCreatureSpellCooldown(unSpellId, curTime + unTimeMs/IN_MILLISECONDS);
if (UnitAI* ai = GetAI())
ai->SpellInterrupted(unSpellId, unTimeMs);
}
}
}
bool Creature::HasSpell(uint32 spellID) const
{
uint8 i;
@@ -540,6 +540,13 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
void AddCreatureSpellCooldown(uint32 spellid);
bool HasSpellCooldown(uint32 spell_id) const;
bool HasCategoryCooldown(uint32 spell_id) const;
uint32 GetCreatureSpellCooldownDelay(uint32 spellId) const
{
CreatureSpellCooldowns::const_iterator itr = m_CreatureSpellCooldowns.find(spellId);
time_t t = time(NULL);
return uint32(itr != m_CreatureSpellCooldowns.end() && itr->second > t ? itr->second - t : 0);
}
virtual void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs);
bool HasSpell(uint32 spellID) const;
+37
View File
@@ -2033,3 +2033,40 @@ void Pet::SynchronizeLevelWithOwner()
break;
}
}
void Pet::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
{
WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+m_spells.size()*8);
data << uint64(GetGUID());
data << uint8(0x0); // flags (0x1, 0x2)
time_t curTime = time(NULL);
for (PetSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
{
if (itr->second.state == PETSPELL_REMOVED)
continue;
uint32 unSpellId = itr->first;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(unSpellId);
if (!spellInfo)
{
ASSERT(spellInfo);
continue;
}
// Not send cooldown for this spells
if (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
continue;
if (spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE)
continue;
if ((idSchoolMask & spellInfo->GetSchoolMask()) && GetCreatureSpellCooldownDelay(unSpellId) < unTimeMs)
{
data << uint32(unSpellId);
data << uint32(unTimeMs); // in m.secs
_AddCreatureSpellCooldown(unSpellId, curTime + unTimeMs/IN_MILLISECONDS);
}
}
if (Player* owner = GetOwner())
owner->GetSession()->SendPacket(&data);
}
+1
View File
@@ -200,6 +200,7 @@ class Pet : public Guardian
bool unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab = true);
bool removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab = true);
void CleanupActionBar();
virtual void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs);
PetSpellMap m_spells;
AutoSpellList m_autospells;
+3 -3
View File
@@ -24502,11 +24502,11 @@ bool Player::canSeeSpellClickOn(Creature const* c) const
ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(c->GetEntry(), itr->second.spellId);
ConditionSourceInfo info = ConditionSourceInfo(const_cast<Player*>(this), const_cast<Creature*>(c));
if (!sConditionMgr->IsObjectMeetToConditions(info, conds))
return false;
if (sConditionMgr->IsObjectMeetToConditions(info, conds))
return true;
}
return true;
return false;
}
void Player::BuildPlayerTalentsInfoData(WorldPacket* data)
+26 -12
View File
@@ -405,6 +405,7 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
pos.m_positionY = loc.y;
pos.m_positionZ = loc.z;
pos.m_orientation = loc.orientation;
if (Unit* vehicle = GetVehicleBase())
{
loc.x += vehicle->GetPositionX();
@@ -861,17 +862,24 @@ void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32
values.AddSpellMod(SPELLVALUE_BASE_POINT1, *bp1);
if (bp2)
values.AddSpellMod(SPELLVALUE_BASE_POINT2, *bp2);
CastCustomSpell(spellId, values, target, triggered, castItem, triggeredByAura, originalCaster);
CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
{
CustomSpellValues values;
values.AddSpellMod(mod, value);
CastCustomSpell(spellId, values, target, triggered, castItem, triggeredByAura, originalCaster);
CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
{
CustomSpellValues values;
values.AddSpellMod(mod, value);
CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster);
}
void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
@@ -882,7 +890,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit*
SpellCastTargets targets;
targets.SetUnitTarget(victim);
CastSpell(targets, spellInfo, &value, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
CastSpell(targets, spellInfo, &value, triggerFlags, castItem, triggeredByAura, originalCaster);
}
void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
@@ -6728,7 +6736,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!victim)
return false;
// 2% of base mana
// 2% of maximum health
basepoints0 = int32(victim->CountPctFromMaxHealth(2));
victim->CastCustomSpell(victim, 20267, &basepoints0, 0, 0, true, 0, triggeredByAura);
return true;
@@ -16968,19 +16976,20 @@ void Unit::JumpTo(WorldObject* obj, float speedZ)
bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
{
bool result = false;
uint32 spellClickEntry = GetVehicleKit() ? GetVehicleKit()->GetCreatureEntry() : GetEntry();
SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(spellClickEntry);
for (SpellClickInfoContainer::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
{
//! First check simple relations from clicker to clickee
if (!itr->second.IsFitToRequirements(clicker, this))
return false;
continue;
//! Check database conditions
ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(spellClickEntry, itr->second.spellId);
ConditionSourceInfo info = ConditionSourceInfo(clicker, this);
if (!sConditionMgr->IsObjectMeetToConditions(info, conds))
return false;
continue;
Unit* caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this;
Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this;
@@ -17006,11 +17015,11 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
if (!valid)
{
sLog->outError(LOG_FILTER_SQL, "Spell %u specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId);
return false;
continue;
}
if (IsInMap(caster))
caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, false, NULL, NULL, origCasterGUID);
caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, NULL, NULL, origCasterGUID);
else // This can happen during Player::_LoadAuras
{
int32 bp0 = seatId;
@@ -17020,22 +17029,27 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
else
{
if (IsInMap(caster))
caster->CastSpell(target, spellEntry, false, NULL, NULL, origCasterGUID);
caster->CastSpell(target, spellEntry, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, NULL, NULL, origCasterGUID);
else
Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, NULL, NULL, origCasterGUID);
}
result = true;
}
if (result)
{
Creature* creature = ToCreature();
if (creature && creature->IsAIEnabled)
creature->AI()->OnSpellClick(clicker);
}
return true;
return result;
}
void Unit::EnterVehicle(Unit* base, int8 seatId)
{
CastCustomSpell(VEHICLE_SPELL_RIDE_HARDCODED, SPELLVALUE_BASE_POINT0, seatId+1, base, false);
CastCustomSpell(VEHICLE_SPELL_RIDE_HARDCODED, SPELLVALUE_BASE_POINT0, seatId+1, base, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE);
}
void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* aurApp)
+6 -5
View File
@@ -1569,13 +1569,14 @@ class Unit : public WorldObject
void CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* Victim = NULL, bool triggered = true, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(Unit* victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
Aura* AddAura(uint32 spellId, Unit* target);
Aura* AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target);
void SetAuraStack(uint32 spellId, Unit* target, uint32 stack);
@@ -71,10 +71,10 @@ namespace Movement
real_position.z = unit->GetTransOffsetZ();
real_position.orientation = unit->GetTransOffsetO();
}
// there is a big chance that current position is unknown if current state is not finalized, need compute it
// this also allows CalculatePath spline position and update map position in much greater intervals
if (!move_spline.Finalized())
// Don't compute for transport movement. The unit could be in a motion between two transports, thus having transport moveflag but is resulting in regular positions
else if (!move_spline.Finalized())
real_position = move_spline.ComputePosition();
// should i do the things that user should do? - no.
@@ -283,6 +283,12 @@ public:
DoScriptText(SAY_WH_KILL, me);
}
void DamageTaken(Unit* /*attacker*/, uint32& damage)
{
if (!_bCanResurrectCheck && damage >= me->GetHealth())
damage = me->GetHealth() - 1;
}
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
@@ -2112,7 +2112,7 @@ class spell_the_lich_king_necrotic_plague : public SpellScriptLoader
CustomSpellValues values;
//values.AddSpellMod(SPELLVALUE_AURA_STACK, 2);
values.AddSpellMod(SPELLVALUE_MAX_TARGETS, 1);
GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID());
GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID());
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
}
@@ -2204,7 +2204,7 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount());
GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID());
GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID());
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
}
@@ -2223,7 +2223,7 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount());
values.AddSpellMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1)
GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID());
GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID());
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
+1 -1
View File
@@ -913,7 +913,7 @@ class spell_gen_profession_research : public SpellScriptLoader
uint32 spellId = GetSpellInfo()->Id;
// learn random explicit discovery recipe (if any)
if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster->ToPlayer()))
if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster))
caster->learnSpell(discoveredSpellId, false);
caster->UpdateCraftSkill(spellId);
+1 -1
View File
@@ -842,7 +842,7 @@ class spell_item_book_of_glyph_mastery : public SpellScriptLoader
uint32 spellId = GetSpellInfo()->Id;
// learn random explicit discovery recipe (if any)
if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster->ToPlayer()))
if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster))
caster->learnSpell(discoveredSpellId, false);
}