From 4c201cb62652f95c6a37f5ceed975184fe9e96a7 Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Thu, 1 Jan 2009 18:21:38 +0100 Subject: *Missed World.cpp changes in 729 *Try to fix a crash in eversong_woods.cpp --HG-- branch : trunk --- .../scripts/zone/eversong_woods/eversong_woods.cpp | 39 ++++++++++++---------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'src/bindings/scripts') diff --git a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp index bfd8a5d51ce..be74291fe3d 100644 --- a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp +++ b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp @@ -604,8 +604,9 @@ struct TRINITY_DLL_DECL npc_apprentice_mirvedaAI : public ScriptedAI { if (PlayerGUID) { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - ((Player*)player)->GroupEventHappens(QUEST_UNEXPECTED_RESULT, m_creature); + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if(player) + ((Player*)player)->CompleteQuest(QUEST_UNEXPECTED_RESULT); } } @@ -671,22 +672,18 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI void Reset() { - EndTimer = 0; - WaveTimer = 0; - PlayerGUID = 0; + EndTimer = 60000; Completed = false; - Progress = false; + Progress = true; + PlayerGUID = 0; + WaveTimer = 1000; } void Aggro(Unit* who){} - void JustSummoned(Creature *summoned) - { - summoned->AI()->AttackStart(m_creature); - } - void MoveInLineOfSight(Unit* who) { + PlayerGUID = who->GetGUID(); error_log("MoveLos"); if( who->GetTypeId() == TYPEID_PLAYER && !m_creature->canStartAttack(who) ) { @@ -705,6 +702,11 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI } } } + } + + void JustSummoned(Creature *summoned) + { + summoned->AI()->AttackStart(m_creature); } void JustDied(Unit* killer) @@ -726,7 +728,9 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI if (PlayerGUID) { Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - ((Player*)player)->GroupEventHappens(QUEST_POWERING_OUR_DEFENSES, m_creature); + if(player) + ((Player*)player)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES); + error_log("quest complete"); } m_creature->DealDamage(m_creature,m_creature->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); m_creature->RemoveCorpse(); @@ -735,17 +739,18 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI if(WaveTimer < diff && !Completed && Progress) { - uint32 ran = rand()%8; - DoSpawnCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran].x, SpawnLocations[ran].y, SpawnLocations[ran].z, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); - DoSpawnCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran].x, SpawnLocations[ran].y, SpawnLocations[ran].z, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); - DoSpawnCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran].x, SpawnLocations[ran].y, SpawnLocations[ran].z, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + uint32 ran1 = rand()%8; + uint32 ran2 = rand()%8; + uint32 ran3 = rand()%8; + m_creature->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran1].x, SpawnLocations[ran1].y, SpawnLocations[ran1].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + m_creature->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran2].x, SpawnLocations[ran2].y, SpawnLocations[ran2].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + m_creature->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran3].x, SpawnLocations[ran3].y, SpawnLocations[ran3].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); WaveTimer = 30000; error_log("Wave summon"); }else WaveTimer -= diff; } }; - CreatureAI* GetAI_npc_infused_crystalAI(Creature *_Creature) { return new npc_infused_crystalAI (_Creature); -- cgit v1.2.3 From 95d6015cb0b4801fca2a617d5d2209091433f750 Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Thu, 1 Jan 2009 20:53:49 +0100 Subject: *Support for quest 8490 --HG-- branch : trunk --- sql/updates/748_world_scripts.sql | 3 +++ .../scripts/zone/eversong_woods/eversong_woods.cpp | 16 ++++------------ 2 files changed, 7 insertions(+), 12 deletions(-) create mode 100644 sql/updates/748_world_scripts.sql (limited to 'src/bindings/scripts') diff --git a/sql/updates/748_world_scripts.sql b/sql/updates/748_world_scripts.sql new file mode 100644 index 00000000000..484c71f3199 --- /dev/null +++ b/sql/updates/748_world_scripts.sql @@ -0,0 +1,3 @@ +update creature_template set scriptname='npc_infused_crystal', flags_extra=0 where entry=16364; +update quest_template set specialflags=2, reqcreatureorgoid1=1, reqcreatureorgocount1=1 where entry=8490; +delete from creature where id=17086; \ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp index be74291fe3d..1126352de8c 100644 --- a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp +++ b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp @@ -672,25 +672,21 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI void Reset() { - EndTimer = 60000; + EndTimer = 0; Completed = false; - Progress = true; + Progress = false; PlayerGUID = 0; - WaveTimer = 1000; + WaveTimer = 0; } void Aggro(Unit* who){} void MoveInLineOfSight(Unit* who) { - PlayerGUID = who->GetGUID(); - error_log("MoveLos"); - if( who->GetTypeId() == TYPEID_PLAYER && !m_creature->canStartAttack(who) ) + if( who->GetTypeId() == TYPEID_PLAYER && !m_creature->canStartAttack(who) && !Progress) { - error_log("TypeId check"); if( ((Player*)who)->GetQuestStatus(QUEST_POWERING_OUR_DEFENSES) == QUEST_STATUS_INCOMPLETE ) { - error_log("Queststaus"); float Radius = 10.0; if( m_creature->IsWithinDistInMap(who, Radius) ) { @@ -698,7 +694,6 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI WaveTimer = 1000; EndTimer = 60000; Progress = true; - error_log("Event started"); } } } @@ -730,11 +725,9 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); if(player) ((Player*)player)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES); - error_log("quest complete"); } m_creature->DealDamage(m_creature,m_creature->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); m_creature->RemoveCorpse(); - error_log("EndTimer done"); }else EndTimer -= diff; if(WaveTimer < diff && !Completed && Progress) @@ -746,7 +739,6 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI m_creature->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran2].x, SpawnLocations[ran2].y, SpawnLocations[ran2].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); m_creature->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran3].x, SpawnLocations[ran3].y, SpawnLocations[ran3].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); WaveTimer = 30000; - error_log("Wave summon"); }else WaveTimer -= diff; } }; -- cgit v1.2.3