[svn] Send AttackStart package when update visibility.

Update DoMeleeAttackIfReady to support dual wield.
Show player modelid2 instead id3 of triggers. This should fix the bug that gameobject::castspell summon a human model.
Remove the correct flag to make creature attackable. This should fix the bug that Illidan and Magtheridon are unattackable.
Add NullCreatureAI for trinityscript.
Fix channeler's soul transfer.
Some update of black temple scripts.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-11-09 14:54:13 -06:00
parent 2c83fc42fc
commit ee02a2fc84
11 changed files with 82 additions and 62 deletions

View File

@@ -1,14 +1,15 @@
DELETE FROM spell_linked_spell WHERE `spell_trigger` IN (39992, 39835, 42052, -41914, 41126, -41376);
DELETE FROM spell_linked_spell WHERE `spell_trigger` IN (39992, 39835, 42052, -41914, -41917, 41126, -41376);
-- INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (39992, 39835, 1, 'Needle Spine');
INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (39835, 39968, 1, 'Needle Spine');
INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-41376, 41377, 0, 'Spite');
INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (41126, 41131, 1, 'Flame Crash');
INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-41914, 41915, 0, 'Summon Parasitic Shadowfiend');
INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-41917, 41915, 0, 'Summon Parasitic Shadowfiend');
INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (39908, 40017, 1, 'Eye Blast');
-- molten_flame
UPDATE creature_template SET flags_extra = 128, speed = 1.0 WHERE entry = 23095;
UPDATE creature_template SET spell1 = 40980, flags_extra = 128, speed = 1.0, scriptname = 'molten_flame' WHERE entry = 23095;
-- volcano
UPDATE creature_template SET spell1 = 40117, flags_extra = 128, scriptname = '' WHERE entry = 23085;
-- flame crash
@@ -16,4 +17,8 @@ update creature_template set spell1 = 40836, flags_extra = 128, scriptname = ''
-- blaze
update creature_template set spell1 = 40610, flags_extra = 128, scriptname = '' where entry = 23259;
-- glaive
update creature_template set scriptname = 'mob_blade_of_azzinoth' where entry = 22996;
update creature_template set scriptname = 'mob_blade_of_azzinoth' where entry = 22996;
-- parasitic shadowfiend
update creature_template set scriptname = 'mob_parasitic_shadowfiend' where entry = 23498;
-- Maiev
update creature_template set minlevel = 73, maxlevel = 73, minhealth = 500000, maxhealth = 500000, mindmg = 3000, maxdmg = 4000 where entry = 23197;

View File

@@ -202,6 +202,15 @@ void ScriptedAI::DoMeleeAttackIfReady()
m_creature->resetAttackTimer();
}
}
if (m_creature->haveOffhandWeapon() && m_creature->isAttackReady(OFF_ATTACK) && !m_creature->IsNonMeleeSpellCasted(false))
{
//If we are within range melee the target
if (m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
{
m_creature->AttackerStateUpdate(m_creature->getVictim(), OFF_ATTACK);
m_creature->resetAttackTimer(OFF_ATTACK);
}
}
}
void ScriptedAI::DoStopAttack()

View File

@@ -181,4 +181,20 @@ struct TRINITY_DLL_DECL Scripted_NoMovementAI : public ScriptedAI
//Called at each attack of m_creature by any victim
void AttackStart(Unit *);
};
struct TRINITY_DLL_DECL NullCreatureAI : public CreatureAI
{
NullCreatureAI(Creature* c) : m_creature(c) {}
~NullCreatureAI() {}
Creature *m_creature;
void MoveInLineOfSight(Unit *) {}
void AttackStart(Unit *) {}
void EnterEvadeMode() {}
bool IsVisible(Unit *) const { return false; }
void UpdateAI(const uint32) {}
};
#endif

View File

@@ -71,6 +71,7 @@ EndScriptData */
#define SPELL_FLAME_CRASH 40832 // Summons an invis/unselect passive mob that has an aura of flame in a circle around him.
#define SPELL_DRAW_SOUL 40904 // 5k Shadow Damage in front of him. Heals Illidan for 100k health (script effect)
#define SPELL_PARASITIC_SHADOWFIEND 41917 // DoT of 3k Shadow every 2 seconds. Lasts 10 seconds. (Script effect: Summon 2 parasites once the debuff has ticked off)
#define SPELL_PARASITIC_SHADOWFIEND2 41914 // Used by Parasitic
#define SPELL_SUMMON_PARASITICS 41915 // Summons 2 Parasitic Shadowfiends on the target. It's supposed to be cast as soon as the Parasitic Shadowfiend debuff is gone, but the spells aren't linked :(
#define SPELL_AGONIZING_FLAMES 40932 // 4k fire damage initial to target and anyone w/i 5 yards. PHASE 3 ONLY
#define SPELL_ENRAGE 40683 // Increases damage by 50% and attack speed by 30%. 20 seconds, PHASE 5 ONLY
@@ -553,7 +554,7 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
if(Glaive)
{
GlaiveGUID[i] = Glaive->GetGUID();
Glaive->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
Glaive->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Glaive->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686);
Glaive->setFaction(m_creature->getFaction());
DoCast(Glaive, SPELL_THROW_GLAIVE2);
@@ -570,7 +571,7 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
if(Glaive)
{
GlaiveGUID[i] = Glaive->GetGUID();
Glaive->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
Glaive->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Glaive->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686);
Glaive->setFaction(m_creature->getFaction());
DoCast(Glaive, SPELL_THROW_GLAIVE, true);
@@ -1337,6 +1338,7 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI
Elite->AI()->AttackStart(m_creature);
Elite->AddThreat(m_creature, 1000000.0f);
AttackStart(Elite);
m_creature->AddThreat(Elite, 1000000.0f);
}
Timer = 10000 + rand()%6000;
GETUNIT(Illidan, IllidanGUID);
@@ -1349,7 +1351,7 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI
}
}
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim())
if(!m_creature->SelectHostilTarget() && !m_creature->getVictim())
return;
if(m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 20)
@@ -1741,9 +1743,9 @@ struct TRINITY_DLL_DECL mob_parasitic_shadowfiendAI : public ScriptedAI
{
if( m_creature->isAttackReady() && m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
{
if(!m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND, 0))
if(!m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND, 0) && !m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND2, 0))
{
m_creature->getVictim()->CastSpell(m_creature->getVictim(), SPELL_PARASITIC_SHADOWFIEND, true, 0, 0, IllidanGUID); //do not stack
m_creature->CastSpell(m_creature->getVictim(), SPELL_PARASITIC_SHADOWFIEND2, true, 0, 0, IllidanGUID); //do not stack
}
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
@@ -1912,6 +1914,7 @@ void boss_illidan_stormrageAI::Reset()
TransformCount = 0;
m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, 21135);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN2);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 0);
@@ -1926,6 +1929,7 @@ void boss_illidan_stormrageAI::JustSummoned(Creature* summon)
{
switch(summon->GetEntry())
{
case PARASITIC_SHADOWFIEND:
case SHADOW_DEMON:
{
if(Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0, 999, true)) // only on players.
@@ -2158,7 +2162,7 @@ void boss_illidan_stormrageAI::EnterPhase(PhaseIllidan NextPhase)
Timer[EVENT_FLIGHT_SEQUENCE] = 1;
m_creature->RemoveAllAuras();
m_creature->InterruptNonMeleeSpells(false);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->GetMotionMaster()->Clear(false);
m_creature->AttackStop();
}

View File

@@ -27,7 +27,7 @@ EndScriptData */
//Spells
#define SPELL_MOLTEN_PUNCH 40126
#define SPELL_HURTFUL_STRIKE 41926
#define SPELL_MOLTEN_FLAME 40253
#define SPELL_MOLTEN_FLAME 40980
#define SPELL_VOLCANIC_ERUPTION 40117
#define SPELL_VOLCANIC_SUMMON 40276
#define SPELL_BERSERK 45078
@@ -35,47 +35,14 @@ EndScriptData */
#define CREATURE_VOLCANO 23085
#define CREATURE_STALKER 23095
struct TRINITY_DLL_DECL molten_flameAI : public ScriptedAI
struct TRINITY_DLL_DECL molten_flameAI : public NullCreatureAI
{
molten_flameAI(Creature *c) : ScriptedAI(c)
molten_flameAI(Creature *c) : NullCreatureAI(c)
{
FlameTimer = 0;
float x, y, z;
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->GetNearPoint(m_creature, x, y, z, 1, 50, M_PI*2*rand_norm());
m_creature->GetMotionMaster()->MovePoint(0, x, y, z);
}
uint32 FlameTimer;
void Reset() {}
void Aggro(Unit *who) {}
void AttackStart(Unit* who) {}
void MoveInLineOfSight(Unit *who) {}
void UpdateAI(const uint32 diff)
{
if(FlameTimer < diff)
{
m_creature->CastSpell(m_creature, SPELL_MOLTEN_FLAME, true);
FlameTimer = 1000;
}else FlameTimer -= diff;
}
};
struct TRINITY_DLL_DECL npc_volcanoAI : public ScriptedAI
{
npc_volcanoAI(Creature *c) : ScriptedAI(c)
{
m_creature->CastSpell(m_creature, SPELL_VOLCANIC_ERUPTION, false);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
void Reset() {}
void Aggro(Unit *who) {}
void AttackStart(Unit* who) {}
void MoveInLineOfSight(Unit* who) {}
void UpdateAI(const uint32 diff) {}
};
struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI
@@ -263,11 +230,6 @@ CreatureAI* GetAI_molten_flame(Creature *_Creature)
return new molten_flameAI (_Creature);
}
CreatureAI* GetAI_npc_volcano(Creature *_Creature)
{
return new npc_volcanoAI (_Creature);
}
void AddSC_boss_supremus()
{
Script *newscript;
@@ -280,9 +242,4 @@ void AddSC_boss_supremus()
newscript->Name="molten_flame";
newscript->GetAI = GetAI_molten_flame;
m_scripts[nrscripts++] = newscript;
newscript = new Script;
newscript->Name="npc_volcano";
newscript->GetAI = GetAI_npc_volcano;
m_scripts[nrscripts++] = newscript;
}

View File

@@ -227,6 +227,7 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN2);
m_creature->addUnitState(UNIT_STAT_STUNNED);
m_creature->CastSpell(m_creature, SPELL_SHADOW_CAGE_C, true);
}

View File

@@ -1282,4 +1282,6 @@ void GameObject::CastSpell(Unit* target, uint32 spell)
trigger->setFaction(14);
trigger->CastSpell(target, spell, true);
}
//trigger->setDeathState(JUST_DIED);
//trigger->RemoveCorpse();
}

View File

@@ -601,9 +601,19 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
if(cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
{
if(target->isGameMaster())
*data << cinfo->Modelid1;
{
if(cinfo->Modelid2)
*data << cinfo->Modelid1;
else
*data << 17519; // world invisible trigger's model
}
else
*data << cinfo->Modelid3;
{
if(cinfo->Modelid2)
*data << cinfo->Modelid2;
else
*data << 11686; // world invisible trigger's model
}
}
else
*data << m_uint32Values[ index ];

View File

@@ -16406,7 +16406,16 @@ void Player::HandleStealthedUnitsDetection()
// target aura duration for caster show only if target exist at caster client
// send data at target visibility change (adding to client)
if((*i)!=this && (*i)->isType(TYPEMASK_UNIT))
{
SendAuraDurationsForTarget(*i);
//if(((Unit*)(*i))->isAlive()) //should be always alive
{
if((*i)->GetTypeId()==TYPEID_UNIT)
((Creature*)(*i))->SendMonsterMoveWithSpeedToCurrentDestination(this);
if(((Unit*)(*i))->getVictim())
((Unit*)(*i))->SendAttackStart(((Unit*)(*i))->getVictim());
}
}
i = stealthedUnits.erase(i);
continue;
@@ -17386,10 +17395,16 @@ void Player::UpdateVisibilityOf(WorldObject* target)
// target aura duration for caster show only if target exist at caster client
// send data at target visibility change (adding to client)
if(target!=this && target->isType(TYPEMASK_UNIT))
{
SendAuraDurationsForTarget((Unit*)target);
if(target->GetTypeId()==TYPEID_UNIT && ((Creature*)target)->isAlive())
((Creature*)target)->SendMonsterMoveWithSpeedToCurrentDestination(this);
if(((Unit*)target)->isAlive())
{
if(target->GetTypeId()==TYPEID_UNIT)
((Creature*)target)->SendMonsterMoveWithSpeedToCurrentDestination(this);
if(((Unit*)target)->getVictim())
((Unit*)target)->SendAttackStart(((Unit*)target)->getVictim());
}
}
}
}
}

View File

@@ -1012,7 +1012,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
{
// for delayed spells ignore negative spells (after duel end) for friendly targets
// TODO: this cause soul transfer bugged
if(m_spellInfo->speed > 0.0f && !IsPositiveSpell(m_spellInfo->Id))
if(m_spellInfo->speed > 0.0f && unit->GetTypeId() == TYPEID_PLAYER && !IsPositiveSpell(m_spellInfo->Id))
{
m_caster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE);
return;

View File

@@ -942,6 +942,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void DeMorph();
void SendAttackStart(Unit* pVictim);
void SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount);
void SendSpellNonMeleeDamageLog(Unit *target,uint32 SpellID,uint32 Damage, SpellSchoolMask damageSchoolMask,uint32 AbsorbedDamage, uint32 Resist,bool PhysicalDamage, uint32 Blocked, bool CriticalHit = false);
void SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo);
@@ -1352,7 +1353,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
private:
void SendAttackStop(Unit* victim); // only from AttackStop(Unit*)
void SendAttackStart(Unit* pVictim); // only from Unit::AttackStart(Unit*)
//void SendAttackStart(Unit* pVictim); // only from Unit::AttackStart(Unit*)
void ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag, AuraTypeSet const& procAuraTypes, WeaponAttackType attType, SpellEntry const * procSpell, uint32 damage, SpellSchoolMask damageSchoolMask );
bool HandleDummyAuraProc(Unit *pVictim, SpellEntry const *spellProto, uint32 effIndex, uint32 damage, Aura* triggredByAura, SpellEntry const * procSpell, uint32 procFlag,uint32 cooldown);