Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 10th, 2012  |  syntax: None  |  size: 16.93 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*######
  2. ## Quest: Escape From Silverbrook (12308)
  3. ## NPC: Ducal's Horse (27409)
  4. ## NPC: Freed Alliance Scout (27411)
  5. ######*/
  6.  
  7. enum eEscapeFromSilverbrook
  8. {
  9.     QUEST_ESCAPE_FROM_SILVERBROOK           = 12308,
  10.     SPELL_SUMMON_SILVERBROOK_WORGEN         = 48681,
  11.     SPELL_ESCAPE_FROM_SILVERBROOK_PERIODIC  = 48683,
  12.     SPELL_ESCAPE_FROM_SILVERBROOK_CREDIT    = 50473,
  13.     NPC_DUCAL_HORSE                         = 27409,
  14.     NPC_DUCAL_HORSE_PASSANGER               = 26430
  15. };
  16. class npc_ducal_horse : public CreatureScript
  17. {
  18. public:
  19.     npc_ducal_horse() : CreatureScript("npc_ducal_horse") { }
  20.  
  21.     struct npc_ducal_horseAI : public npc_escortAI
  22.     {
  23.         npc_ducal_horseAI(Creature* pCreature) : npc_escortAI(pCreature)
  24.         {
  25.             bSummon = false;
  26.             bNpcBoarded = false;
  27.         }
  28.  
  29.         bool bNpcBoarded;
  30.         bool bSummon;
  31.         uint64 uiPlayerGUID;
  32.         uint32 uiSummonTimer;
  33.  
  34.         void PassengerBoarded(Unit *who, int8 seatId, bool apply)
  35.         {
  36.             if (who->GetTypeId() == TYPEID_UNIT && seatId == 0)
  37.             {
  38.                 bNpcBoarded = apply;
  39.             }
  40.             if (bNpcBoarded)
  41.             {
  42.                 if (!HasEscortState(STATE_ESCORT_ESCORTING))
  43.                 {
  44.                     if (Unit* seat = me->GetVehicleKit()->GetPassenger(1))
  45.                     {
  46.                         if(!seat)
  47.                             return;
  48.  
  49.                         if (Unit* player = seat->GetVehicleKit()->GetPassenger(0))
  50.                         {
  51.                             uiPlayerGUID = player->GetGUID();
  52.                             bSummon = true;
  53.                             uiSummonTimer = urand(5000, 10000);
  54.                             Start(false, true, uiPlayerGUID, 0, true, true);
  55.                             DoCast(SPELL_ESCAPE_FROM_SILVERBROOK_PERIODIC);
  56.                         }
  57.                     }
  58.                 }
  59.             }
  60.             if (!bNpcBoarded && seatId == 0)
  61.                 if (who->GetTypeId() == TYPEID_UNIT)
  62.                     who->ToCreature()->DespawnOrUnsummon();
  63.         }
  64.  
  65.         void JustDied(Unit* pKiller)
  66.         {
  67.             if (Vehicle* pVehicle = me->GetVehicleKit())
  68.                 if (Unit* pPassenger = pVehicle->GetPassenger(0))
  69.                     if (pPassenger->GetTypeId() == TYPEID_UNIT)
  70.                         pPassenger->ToCreature()->DespawnOrUnsummon();
  71.         }
  72.  
  73.         void WaypointReached(uint32 uiWP)
  74.         {
  75.             switch (uiWP)
  76.             {
  77.             case 97:
  78.                 bSummon = false;
  79.                 break;
  80.             case 102:
  81.                 if (Vehicle* pVehicle = me->GetVehicleKit())
  82.                     if (Unit* pPassenger = pVehicle->GetPassenger(0))
  83.                         pPassenger->ExitVehicle();
  84.                 if (Player* pPlayer = GetPlayerForEscort())
  85.                 {
  86.                     pPlayer->ExitVehicle();
  87.                     pPlayer->CastSpell(pPlayer, SPELL_ESCAPE_FROM_SILVERBROOK_CREDIT, true);
  88.                 }
  89.                 break;
  90.             }
  91.         }
  92.  
  93.         void JustSummoned(Creature* pSummoned)
  94.         {
  95.             pSummoned->AI()->AttackStart(Player::GetPlayer(*me,uiPlayerGUID));
  96.         }
  97.  
  98.         void OnCharmed(bool /*apply*/)
  99.         {
  100.         }
  101.  
  102.         void UpdateAI(const uint32 uiDiff)
  103.         {
  104.             npc_escortAI::UpdateAI(uiDiff);
  105.  
  106.             if (bSummon)
  107.             {
  108.                 if (uiSummonTimer <= uiDiff)
  109.                 {
  110.                     DoCast(SPELL_SUMMON_SILVERBROOK_WORGEN);
  111.                     uiSummonTimer = urand(5000, 10000);
  112.                 } else uiSummonTimer -= uiDiff;
  113.             }
  114.         }
  115.     };
  116.  
  117.     CreatureAI* GetAI(Creature* pCreature) const
  118.     {
  119.         return new npc_ducal_horseAI (pCreature);
  120.     }
  121. };
  122.  
  123. class npc_freed_alliance_scout : public CreatureScript
  124. {
  125. public:
  126.     npc_freed_alliance_scout() : CreatureScript("npc_freed_alliance_scout") { }
  127.  
  128.     struct npc_freed_alliance_scoutAI : public npc_escortAI
  129.     {
  130.         npc_freed_alliance_scoutAI(Creature* pCreature) : npc_escortAI(pCreature)
  131.         {
  132.             uiDucalHorseGUID = 0;
  133.             uiPlayerGUID = 0;
  134.         }
  135.  
  136.         uint64 uiDucalHorseGUID;
  137.         uint64 uiPlayerGUID;
  138.         bool bTalk;
  139.         uint8 uiTalkStage;
  140.         uint32 uiTalkTimer;
  141.  
  142.         void WaypointReached(uint32 PointId)
  143.         {
  144.             if (PointId == 6)
  145.             {
  146.                if (Creature* pHorse = me->SummonCreature(NPC_DUCAL_HORSE, 4428.630371f, -2488.344238f, 246.493561f, 5.788373f, TEMPSUMMON_MANUAL_DESPAWN))
  147.                     uiDucalHorseGUID = pHorse->GetGUID();
  148.                 uiTalkTimer = 0;
  149.                 bTalk = true;
  150.             }
  151.         }
  152.  
  153.         void JustRespawned()
  154.         {
  155.             uiDucalHorseGUID = 0;
  156.         }
  157.  
  158.         void JustDied(Unit* pKiller)
  159.         {
  160.             if (Creature* pHorse = Unit::GetCreature(*me, uiDucalHorseGUID))
  161.                 pHorse->DespawnOrUnsummon();
  162.         }
  163.  
  164.         void UpdateAI(const uint32 uiDiff)
  165.         {
  166.             npc_escortAI::UpdateAI(uiDiff);
  167.  
  168.             if (bTalk)
  169.             {
  170.                 if (uiTalkTimer <= uiDiff)
  171.                 {
  172.                     switch (uiTalkStage)
  173.                     {
  174.                     case 0:
  175.                         Talk(0);
  176.                         uiTalkTimer = 5000;
  177.                         break;
  178.                     case 1:
  179.                         Talk(1);
  180.                         uiTalkTimer = 8000;
  181.                         break;
  182.                     case 2:
  183.                         Talk(2);
  184.                         Start(false, true, uiPlayerGUID, 0, true);
  185.                         SetDespawnAtEnd(false);
  186.                         bTalk = false;
  187.                         break;
  188.                     case 3:
  189.                         Talk(3);
  190.                         uiTalkTimer = 5000;
  191.                         break;
  192.                     case 4:
  193.                         Talk(4);
  194.                         uiTalkTimer = 5000;
  195.                         bTalk = false;
  196.                         if (Creature* pHorse = Unit::GetCreature(*me, uiDucalHorseGUID))
  197.                             me->EnterVehicle(pHorse, 0);
  198.                         break;
  199.                     }
  200.                     uiTalkStage++;
  201.                 } else uiTalkTimer -= uiDiff;
  202.             }
  203.  
  204.             if (!UpdateVictim())
  205.                 return;
  206.  
  207.             DoMeleeAttackIfReady();
  208.         }
  209.  
  210.         void IsSummonedBy(Unit* owner)
  211.         {
  212.             if (owner->GetEntry() == 27499)
  213.             {
  214.                 bTalk = true;
  215.                 uiTalkTimer = 0;
  216.                 uiTalkStage = 0;
  217.             }
  218.         }
  219.     };
  220.  
  221.     CreatureAI* GetAI(Creature* pCreature) const
  222.     {
  223.         return new npc_freed_alliance_scoutAI (pCreature);
  224.     }
  225. };
  226.  
  227.  
  228.     new npc_ducal_horse;
  229.     new npc_freed_alliance_scout;
  230.  
  231.  
  232. -- Escape from Silverbrook
  233. -- Caged Prisoner
  234. SET @ENTRY := 27499;
  235. SET @SOURCETYPE := 0;
  236.  
  237. UPDATE `creature_template` SET AIName='SmartAI' WHERE entry=@ENTRY;
  238. DELETE FROM `smart_scripts` WHERE entryorguid=@ENTRY AND `source_type`=@SOURCETYPE;
  239. DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY;
  240. INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`)VALUES
  241. (@ENTRY,@SOURCETYPE,0,1,19,0,100,0,12308,0,0,0,11,48710,0,0,0,0,0,19,24042,10,0,0,0,0,0,'Caged Prisoner - on quest accepted - summon Freed Alliance Scout'),
  242. (@ENTRY,@SOURCETYPE,1,2,61,0,100,0,0,0,0,0,9,0,0,0,0,0,0,15,188706,10,0,0,0,0,0,'Caged Prisoner - on quest accepted - summon Freed Alliance Scout'),
  243. (@ENTRY,@SOURCETYPE,2,0,61,0,100,0,0,0,0,0,41,500,0,0,0,0,0,1,0,0,0,0,0,0,0,'Caged Prisoner - on quest accepted - summon Freed Alliance Scout');
  244.  
  245. DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` = 27409;
  246. DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` = 26430;
  247. INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_start`, `quest_start_active`, `quest_end`, `cast_flags`, `aura_required`, `aura_forbidden`, `user_type`) VALUES
  248. (26430, 46598, 0, 0, 0, 1, 0, 0, 0),
  249. (27409, 48678, 0, 0, 0, 1, 0, 0, 0);
  250.  
  251. UPDATE `creature_template` SET `VehicleId` = 51, `IconName`= 'vehichleCursor', `npcflag` = `npcflag`|16777216, `unit_flags` = 0, `ScriptName` = "npc_ducal_horse", `spell1` = 48677, `spell2` = 48768, `spell3` = 48783 WHERE `entry` = 27409;
  252. UPDATE `creature_template` SET `VehicleId` = 52, `npcflag` = `npcflag`|16777216, `unit_flags` = `unit_flags`|256|512, `spell1` = 48677, `spell2` = 48768, `spell3` = 48783, `flags_extra` = 0 WHERE `entry` = 26430;
  253. UPDATE `creature_template` SET `ScriptName` = "npc_freed_alliance_scout" WHERE `entry` = 27411;
  254.  
  255. DELETE FROM `vehicle_template_accessory` WHERE `entry`=27409;
  256. INSERT INTO `vehicle_template_accessory` (`entry`, `accessory_entry`, `seat_id`, `minion`, `description`, `summontype`, `summontimer`) VALUES
  257. (27409,26430,0,0,'Ducal Horse',5,0);
  258.  
  259. UPDATE `creature_template` SET `faction_A` = 16, `faction_H` = 16 WHERE entry = 27417;
  260.  
  261. DELETE FROM `script_waypoint` WHERE entry = 27409;
  262. INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES
  263. (27409, 0, 4431.638672, -2481.546143, 245.497971, 0, ''),
  264. (27409, 1, 4449.238281, -2471.332031, 242.360382, 0, ''),
  265. (27409, 2, 4461.925293, -2462.848145, 239.519882, 0, ''),
  266. (27409, 3, 4462.994141, -2448.238037, 237.881256, 0, ''),
  267. (27409, 4, 4479.575684, -2434.093506, 235.040390, 0, ''),
  268. (27409, 5, 4488.495605, -2420.688477, 233.043091, 0, ''),
  269. (27409, 6, 4494.654785, -2414.143066, 230.241013, 0, ''),
  270. (27409, 7, 4499.730469, -2414.861572, 230.952850, 0, ''),
  271. (27409, 8, 4510.846191, -2401.806641, 226.618698, 0, ''),
  272. (27409, 9, 4517.005371, -2388.016357, 220.151077, 0, ''),
  273. (27409, 10, 4520.017578, -2373.915283, 213.041779, 0, ''),
  274. (27409, 11, 4524.577637, -2355.400391, 202.208481, 0, ''),
  275. (27409, 12, 4520.500977, -2332.202148, 190.853638, 0, ''),
  276. (27409, 13, 4509.677734, -2314.525635, 182.408096, 0, ''),
  277. (27409, 14, 4488.281250, -2309.130127, 184.351913, 0, ''),
  278. (27409, 15, 4480.724609, -2311.419434, 185.420715, 0, ''),
  279. (27409, 16, 4470.293457, -2314.579346, 183.929382, 0, ''),
  280. (27409, 17, 4453.349121, -2318.290771, 189.487000, 0, ''),
  281. (27409, 18, 4442.953613, -2311.859375, 192.656219, 0, ''),
  282. (27409, 19, 4414.564941, -2297.739258, 191.105362, 0, ''),
  283. (27409, 20, 4396.023438, -2286.889648, 192.638016, 0, ''),
  284. (27409, 21, 4383.112305, -2278.546631, 188.321487, 0, ''),
  285. (27409, 22, 4369.118652, -2256.089844, 187.592911, 0, ''),
  286. (27409, 23, 4339.653320, -2250.217529, 188.636993, 0, ''),
  287. (27409, 24, 4299.784180, -2260.091309, 205.303589, 0, ''),
  288. (27409, 25, 4292.068848, -2261.806885, 209.099808, 0, ''),
  289. (27409, 26, 4258.068359, -2270.728027, 212.053543, 0, ''),
  290. (27409, 27, 4224.148926, -2276.497559, 214.878052, 0, ''),
  291. (27409, 28, 4210.618652, -2280.829346, 214.910553, 0, ''),
  292. (27409, 29, 4193.759766, -2285.936035, 219.885529, 0, ''),
  293. (27409, 30, 4168.561523, -2272.436279, 221.375009, 0, ''),
  294. (27409, 31, 4151.019531, -2269.352783, 223.433472, 0, ''),
  295. (27409, 32, 4131.847168, -2271.157715, 221.920700, 0, ''),
  296. (27409, 33, 4112.480469, -2276.041748, 219.916550, 0, ''),
  297. (27409, 34, 4103.597656, -2274.198730, 219.276031, 0, ''),
  298. (27409, 35, 4093.837158, -2276.393066, 219.042526, 0, ''),
  299. (27409, 36, 4084.734375, -2272.286133, 217.870331, 0, ''),
  300. (27409, 37, 4063.238525, -2261.991211, 215.988922, 0, ''),
  301. (27409, 38, 4059.935547, -2260.473145, 216.993256, 0, ''),
  302. (27409, 39, 4028.185791, -2252.874512, 218.258530, 0, ''),
  303. (27409, 40, 4020.977539, -2249.354004, 217.129837, 0, ''),
  304. (27409, 41, 4005.426025, -2256.105957, 218.451675, 0, ''),
  305. (27409, 42, 3988.108398, -2262.058350, 217.109756, 0, ''),
  306. (27409, 43, 3968.364014, -2267.235840, 215.268341, 0, ''),
  307. (27409, 44, 3953.139893, -2268.633057, 212.391113, 0, ''),
  308. (27409, 45, 3935.732422, -2276.518066, 209.669937, 0, ''),
  309. (27409, 46, 3922.170898, -2282.024414, 211.200699, 0, ''),
  310. (27409, 47, 3913.766846, -2300.279541, 209.620239, 0, ''),
  311. (27409, 48, 3914.160156, -2317.614990, 208.949615, 0, ''),
  312. (27409, 49, 3911.533936, -2330.580078, 207.751999, 0, ''),
  313. (27409, 50, 3907.095947, -2346.107422, 204.630707, 0, ''),
  314. (27409, 51, 3901.425537, -2362.481201, 206.197708, 0, ''),
  315. (27409, 52, 3885.374756, -2368.482178, 202.270737, 0, ''),
  316. (27409, 53, 3871.682617, -2371.436035, 196.694305, 0, ''),
  317. (27409, 54, 3858.806396, -2374.236816, 194.038589, 0, ''),
  318. (27409, 55, 3833.323975, -2390.121582, 187.584473, 0, ''),
  319. (27409, 56, 3818.713379, -2403.767090, 183.718597, 0, ''),
  320. (27409, 57, 3812.403564, -2425.267334, 185.086273, 0, ''),
  321. (27409, 58, 3812.611328, -2432.785400, 186.023727, 0, ''),
  322. (27409, 59, 3812.221680, -2453.928711, 188.508041, 0, ''),
  323. (27409, 60, 3815.669189, -2479.355957, 192.388458, 0, ''),
  324. (27409, 61, 3819.468262, -2503.677002, 195.024658, 0, ''),
  325. (27409, 62, 3822.264648, -2517.937256, 194.068130, 0, ''),
  326. (27409, 63, 3825.485107, -2534.361572, 196.379684, 0, ''),
  327. (27409, 64, 3829.201660, -2554.680664, 196.714203, 0, ''),
  328. (27409, 65, 3836.672119, -2578.528076, 196.706253, 0, ''),
  329. (27409, 66, 3847.536133, -2609.345459, 200.060410, 0, ''),
  330. (27409, 67, 3861.525879, -2624.756592, 202.314850, 0, ''),
  331. (27409, 68, 3882.063232, -2655.939209, 203.425415, 0, ''),
  332. (27409, 69, 3886.698975, -2663.550293, 208.091705, 0, ''),
  333. (27409, 70, 3900.575928, -2672.409912, 212.662750, 0, ''),
  334. (27409, 71, 3909.817383, -2687.583008, 217.098572, 0, ''),
  335. (27409, 72, 3911.782959, -2695.853027, 220.364487, 0, ''),
  336. (27409, 73, 3916.008301, -2703.185791, 221.175446, 0, ''),
  337. (27409, 74, 3912.544678, -2712.180420, 221.059509, 0, ''),
  338. (27409, 75, 3900.396484, -2743.329346, 219.152481, 0, ''),
  339. (27409, 76, 3889.821777, -2751.587646, 221.798737, 0, ''),
  340. (27409, 77, 3883.421875, -2756.963379, 223.885544, 0, ''),
  341. (27409, 78, 3851.103027, -2769.906494, 227.460480, 0, ''),
  342. (27409, 79, 3837.903076, -2769.537842, 226.115402, 0, ''),
  343. (27409, 80, 3813.292725, -2770.593018, 220.927460, 0, ''),
  344. (27409, 81, 3801.162109, -2771.017578, 219.535080, 0, ''),
  345. (27409, 82, 3780.501709, -2772.391602, 213.905884, 0, ''),
  346. (27409, 83, 3767.551025, -2775.388672, 211.281708, 0, ''),
  347. (27409, 84, 3759.778320, -2782.290771, 209.165924, 0, ''),
  348. (27409, 85, 3752.759277, -2787.596436, 206.495926, 0, ''),
  349. (27409, 86, 3729.982422, -2803.813721, 210.023056, 0, ''),
  350. (27409, 87, 3723.949951, -2808.085693, 211.655594, 0, ''),
  351. (27409, 88, 3705.986328, -2819.675537, 215.066315, 0, ''),
  352. (27409, 89, 3685.556152, -2832.987549, 217.602127, 0, ''),
  353. (27409, 90, 3674.411377, -2843.797852, 217.875214, 0, ''),
  354. (27409, 91, 3662.455811, -2853.292480, 216.581512, 0, ''),
  355. (27409, 92, 3647.392822, -2857.280518, 213.150558, 0, ''),
  356. (27409, 93, 3630.625977, -2860.268555, 214.962250, 0, ''),
  357. (27409, 94, 3610.744141, -2858.618164, 208.903931, 0, ''),
  358. (27409, 95, 3587.919189, -2854.562500, 203.447754, 0, ''),
  359. (27409, 96, 3562.793213, -2842.607666, 197.044495, 0, ''),
  360. (27409, 97, 3534.265625, -2828.214600, 197.154617, 0, ''),
  361. (27409, 98, 3515.692871, -2829.376709, 201.276230, 0, ''),
  362. (27409, 99, 3487.658691, -2829.192871, 202.143524, 0, ''),
  363. (27409, 100, 3472.460693, -2821.599365, 201.429428, 0, ''),
  364. (27409, 101, 3460.582031, -2817.212402, 201.804962, 0, ''),
  365. (27409, 102, 3443.644531, -2811.332520, 202.097687, 0, '');
  366.  
  367. DELETE FROM script_waypoint WHERE entry = 27411;
  368. INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES
  369. (27411, 0, 4394.648438, -2502.304688, 252.802429, 0, ''),
  370. (27411, 1, 4389.777832, -2502.323242, 252.251602, 0, ''),
  371. (27411, 2, 4382.442383, -2501.507080, 246.809448, 0, ''),
  372. (27411, 3, 4381.006836, -2497.183838, 247.235260, 0, ''),
  373. (27411, 4, 4393.843750, -2484.841553, 248.717392, 0, ''),
  374. (27411, 5, 4416.043457, -2481.504150, 247.175400, 0, ''),
  375. (27411, 6, 4425.312500, -2486.656006, 246.555176, 0, '');
  376.  
  377. DELETE FROM creature_text WHERE entry = 27411;
  378. INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES
  379. (27411, 0, 0, 'Were you bitten?', 12, 0, 100, 6, 0, 0, 'Freed Alliance Scout Say1'),
  380. (27411, 1, 0, 'Answer me! Were you bloody bitten?', 14, 0, 100, 22, 0, 0, 'Freed Alliance Scout Yell'),
  381. (27411, 2, 0, 'You don\'t even know, do you? The trappers? They\'re not human... we have to get out of here! Come, quick!', 12, 0, 100, 0, 0, 0, 'Freed Alliance Scout Say2'),
  382. (27411, 3, 0, 'Take Ducal\'s horse, he\'s one of them now!', 12, 0, 100, 0, 0, 0, 'Freed Alliance Scout Say3'),
  383. (27411, 4, 0, 'There\'s lamp oil in the back - make use of it. The fiends hate fire!', 12, 0, 100, 0, 0, 0, 'Freed Alliance Scout Say4');