scriptdev2 / scriptdev2

Replacement for the Script Library that comes with MaNGOS, written in C++ and is compatible with both Windows and Linux. SQL supports MySQL and PGSql.
http://www.scriptdev2.com/
GNU General Public License v2.0
228 stars 206 forks source link

The Sleeper has Awakened across all cores. #169

Open scotty0100 opened 9 years ago

scotty0100 commented 9 years ago

Kerlonian Evershade (ID: 11218) is using the wrong model of bear form when you are not on the quest, he should be sleeping in the model of the druid class bear form (currently he has a normal bear model).

I believe the model ID is 2281.

After you start the quest he should shapeshift into his normal form and stay like that until reaching to the end of the destination of the quest. http://s.cdn.wowinterface.com/preview/pvw28517.jpg http://old.wowdata.ru/data/userimg/3/3077.jpg

When you wake him up using the Horn of Awakening (ID: 13536) a voice sound should be played saying "I'm awake, I'm awake" or "The sleeper has awakened!" and written so in the chat too.

There should be 2 scripted encounters while moving on the road (only on the road). one encounter is with 3 furbolgs, the other is with 2 undead (Forsaken Scout).

Tagging @cala just in case the scripted road events could possibly be done via DB :)

scotty0100 commented 9 years ago

Note: Currently you CAN complete the quest. Just that none of the scripted road events work & model is wrong.

cala commented 9 years ago

Model is probably a DB issue. The NPCs audio and text emotes can be handled in various way. I'll look at it.

Thanks for your report. :)

xfurry commented 8 years ago

@cala can you find any video of this event, so we can check and correct it?

Grz3s commented 8 years ago

https://www.youtube.com/watch?v=sx8a-iu17NI starts at 0:46

xfurry commented 8 years ago

Does this patch help? I know that the road events are not scripted, but this should help with the model on evade.

DELETE FROM creature_template_addon WHERE entry=11218;
INSERT INTO creature_template_addon VALUES
(11218, 0, 3, 1, 1, 0, 0, '');
diff --git a/src/scriptdev2/scripts/kalimdor/darkshore.cpp b/src/scriptdev2/scripts/kalimdor/darkshore.cpp
index f5507fc..7bab514 100644
--- a/src/scriptdev2/scripts/kalimdor/darkshore.cpp
+++ b/src/scriptdev2/scripts/kalimdor/darkshore.cpp
@@ -58,16 +58,23 @@ enum

     SAY_KER_END                 = -1000444,

+    SPELL_BEAR_FORM             = 18309,
     SPELL_SLEEP_VISUAL          = 25148,
     SPELL_AWAKEN                = 17536,
+
     QUEST_SLEEPER_AWAKENED      = 5321,
+
     NPC_LILADRIS                = 11219                     // attackers entries unknown
 };

 // TODO: make concept similar as "ringo" -escort. Find a way to run the scripted attacks, _if_ player are choosing road.
 struct npc_kerlonianAI : public FollowerAI
 {
-    npc_kerlonianAI(Creature* pCreature) : FollowerAI(pCreature) { Reset(); }
+    npc_kerlonianAI(Creature* pCreature) : FollowerAI(pCreature)
+    {
+        DoCastSpellIfCan(m_creature, SPELL_BEAR_FORM);
+        Reset();
+    }

     uint32 m_uiFallAsleepTimer;

@@ -97,12 +104,16 @@ struct npc_kerlonianAI : public FollowerAI
         }
     }

-    void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) override
+    void ReceiveAIEvent(AIEventType eventType, Creature* /*pSender*/, Unit* pInvoker, uint32 uiMiscValue) override
     {
-        if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_AWAKEN)
-            ClearSleeping();
+        if (eventType == AI_EVENT_CUSTOM_A && pInvoker->GetTypeId() == TYPEID_PLAYER)
+        {
+            if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED))
+                ClearSleeping();
+        }
     }

+    // Function to set npc to sleep mode
     void SetSleeping()
     {
         SetFollowPaused(true);
@@ -122,10 +133,11 @@ struct npc_kerlonianAI : public FollowerAI
             case 3: DoScriptText(SAY_KER_SLEEP_4, m_creature); break;
         }

-        m_creature->SetStandState(UNIT_STAND_STATE_SLEEP);
-        m_creature->CastSpell(m_creature, SPELL_SLEEP_VISUAL, false);
+        if (DoCastSpellIfCan(m_creature, SPELL_SLEEP_VISUAL) == CAST_OK)
+            m_creature->SetStandState(UNIT_STAND_STATE_SLEEP);
     }

+    // Function to clear sleep mode
     void ClearSleeping()
     {
         m_creature->RemoveAurasDueToSpell(SPELL_SLEEP_VISUAL);
@@ -172,6 +184,7 @@ bool QuestAccept_npc_kerlonian(Player* pPlayer, Creature* pCreature, const Quest
     {
         if (npc_kerlonianAI* pKerlonianAI = dynamic_cast<npc_kerlonianAI*>(pCreature->AI()))
         {
+            pCreature->RemoveAurasDueToSpell(SPELL_BEAR_FORM);
             pCreature->SetStandState(UNIT_STAND_STATE_STAND);
             DoScriptText(SAY_KER_START, pCreature, pPlayer);
             pKerlonianAI->StartFollow(pPlayer, FACTION_ESCORT_N_FRIEND_PASSIVE, pQuest);
@@ -181,6 +194,17 @@ bool QuestAccept_npc_kerlonian(Player* pPlayer, Creature* pCreature, const Quest
     return true;
 }

+bool EffectDummyCreature_awaken_kerlonian(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Creature* pCreatureTarget, ObjectGuid /*originalCasterGuid*/)
+{
+    if (uiSpellId == SPELL_AWAKEN && uiEffIndex == EFFECT_INDEX_0)
+    {
+        pCreatureTarget->AI()->SendAIEvent(AI_EVENT_CUSTOM_A, pCaster, pCreatureTarget);
+        return true;
+    }
+
+    return false;
+}
+
 /*####
 # npc_prospector_remtravel
 ####*/
@@ -748,6 +772,7 @@ void AddSC_darkshore()
     pNewScript->Name = "npc_kerlonian";
     pNewScript->GetAI = &GetAI_npc_kerlonian;
     pNewScript->pQuestAcceptNPC = &QuestAccept_npc_kerlonian;
+    pNewScript->pEffectDummyNPC = &EffectDummyCreature_awaken_kerlonian;
     pNewScript->RegisterSelf();

     pNewScript = new Script;
cala commented 8 years ago

Nice! I will test this, but expect some delay in the feedback: my todo list is very long at the moment.

Grz3s commented 8 years ago

hi @xfurry just tested your patch....

but :)

Also... we still missing both sounds for him... and that 2-part event with ambush...(i have an idea how to do it...and will try soon* thank you.

Udpate: 13/12/15 Script should do a check... if player has quest available...(if not ... druid should despawn) Currently... player can easy abandon quest (during it) ... and keep druid forever (like a pet).. we need to prevent this somehow.. Also: good news: I have found both missing voices for him:

-- sound_id = 6209 -- The sleeper has aweken ( this sound comes only when quest starts) -- sound_id = 6700 -- using the Horn of Awakening (ID: 13536) - this one is 4 random voices... -- and you can hear on vid i gave above.. 2 voices from it.

Grz3s commented 8 years ago

hi small update to this: correct sound on quest start added: https://github.com/unified-db/Database/commit/62b958ffb0b21b079441486d265119a8771ef327

Grz3s commented 8 years ago

@xfurry As i said before... I made all missing stuff working:

unfortunately this req. Both sd2_script and EAI (ACID) to work together You said once that is possible.. to make it work (in special ocasions) ... Can u show me how to? or give me example... So i could make more tests... and maybe finally finish this quest ;)

BTW this a sample for 1st ambush (made only for tests) https://www.youtube.com/watch?v=FCynFo4PTFE&feature=youtu.be

xfurry commented 8 years ago

@Grz3s You can try this for the sound: http://paste2.org/xse5UWJ1 However it's kind of tricky to find a way to trigger the ambush. Since this is a "follower" quest, the only way to do this, is to constantly check for map coords. Unless you know something which I don't (like some hidden map trigger. I noticed that for the Furbolg ambush the event starts around this location: X: 4493.221680 Y: 275.150818 Z: 58.861740

Grz3s commented 8 years ago

tested new patch - sound works fine ;) :+1: About ambush: Few facts:

my plan was to use .. not used by anything - trigger: npc:14495 spawn him in both locations:

You can check how working script looked like: (only for first ambush)

DELETE FROM creature WHERE guid=151050;
INSERT INTO creature VALUES (151050,14495,1,1,1,0,0,4484.9,270.564,59.4335,0.237152,120,0,0,64,0,0,0);
--
UPDATE creature SET MovementType = 2, spawndist = 0 WHERE guid IN (151050);
DELETE FROM creature_movement WHERE id IN (151050);
INSERT INTO creature_movement (id, point, position_x, position_y, position_z, waittime, script_id, orientation, model1, model2) VALUES
(151050,1,4484.9,270.564,59.4335,5000,1449501,0.237152,0,0);
DELETE FROM dbscripts_on_creature_movement WHERE id = 1449501; 
INSERT INTO dbscripts_on_creature_movement (id, delay, command, datalong, datalong2, buddy_entry, search_radius, data_flags, dataint, dataint2, dataint3, dataint4, x, y, z, o, comments) VALUES  
(1449501,1,35,5,30,0,0,0,0,0,0,0,0,0,0,0,'SEND_AI_EVENT'),
(1449501,3,31,11218,30,0,0,0,0,0,0,0,0,0,0,0,'search for 11218'), -- desp only if 11218 has been found
(1449501,4,18,0,0,0,0,0x04,0,0,0,0,0,0,0,0,'desp');

-- npc_kerlonian
-- http://www.wowhead.com/spell=17536/awaken-kerlonian#used-by-item
DELETE FROM `creature_ai_scripts` WHERE `creature_id` = 11218;
INSERT INTO `creature_ai_scripts` VALUES
('1121801','11218','11','0','100','0','0','0','0','0','22','0','0','0','0','0','0','0','0','0','0','0','Kerlonian Evershade - Set Phase 0 on Spawn'),
('1121802','11218','8','0','100','1','17536','-1','0','0','4','6700','0','0','0','0','0','0','0','0','0','0','Kerlonian Evershade - play sound on SpellHIT'),
('1121803','11218','30','0','100','1','5','14495','0','0','1','-10000','0','0','22','1','0','0','0','0','0','0','Kerlonian Evershade - Say and set PHASE 1 on Receive AI Event A'),
('1121804','11218','29','1','100','1','2000','2000','0','0','32','2169','0','29','32','2169','0','30','32','2171','0','31','Kerlonian Evershade - summon first ambush(Phase1)'),
('1121805','11218','29','1','100','1','3000','3000','0','0','22','0','0','0','0','0','0','0','0','0','0','0','Kerlonian Evershade - set PHASE 0(Phase1)'),
('1121806','11218','7','0','100','1','0','0','0','0','22','0','0','0','0','0','0','0','0','0','0','0','Shadow Council Warlock - Set Phase to 0 on Evade');
UPDATE creature_template SET AIName = 'EventAI' WHERE `entry` = '11218';

-- texts
DELETE FROM `creature_ai_texts` WHERE `entry` IN ('-10000','-10001');
INSERT into `creature_ai_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`,`emote`) VALUES
('-10000','Be on the alert! The Blackwood furbolgs are numerous in this area...','0','0','0','11218','0'), -- first ambush
('-10001','It\'s quiet... Too quiet...','0','0','0','11218','0'); -- second ambush
-- summons
Delete from `creature_ai_summons` where `id` IN (29,30,31);
Insert into `creature_ai_summons` values 
('29','4480.79','248.848','60.5918','1.06','300000','2169'),  -- correct xyz
('30','4470.68','260.508','59.0824','0.59','300000','2169'),  -- correct xyz
('31','4461.42','271.358,','61.7843','6.22188','300000','2171');  -- correct xyz