Пример #1
0
            virtual void Update(uint32 diff) override
            {
                if (!IronCladDoorGUID || !DefiasCannonGUID || !DoorLeverGUID)
                    return;

                GameObject* pIronCladDoor = instance->GetGameObject(IronCladDoorGUID);
                if (!pIronCladDoor)
                    return;

                switch (State)
                {
                    case CANNON_GUNPOWDER_USED:
                        CannonBlast_Timer = DATA_CANNON_BLAST_TIMER;
                        State = CANNON_BLAST_INITIATED;
                        break;
                    case CANNON_BLAST_INITIATED:
                        PiratesDelay_Timer = DATA_PIRATES_DELAY_TIMER;
                        SmiteAlarmDelay_Timer = DATA_SMITE_ALARM_DELAY_TIMER;
                        if (CannonBlast_Timer <= diff)
                        {
                            SummonCreatures();
                            ShootCannon();
                            BlastOutDoor();
                            LeverStucked();
                            instance->LoadGrid(-22.8f, -797.24f); // Loads Mr. Smite's grid.
                            if (Creature* smite = instance->GetCreature(MrSmiteGUID)) // goes off when door blows up
                                smite->AI()->Talk(SAY_ALARM1);
                            State = PIRATES_ATTACK;
                        } else CannonBlast_Timer -= diff;
                        break;
                    case PIRATES_ATTACK:
                        if (PiratesDelay_Timer <= diff)
                        {
                            MoveCreaturesInside();
                            State = SMITE_ALARMED;
                        } else PiratesDelay_Timer -= diff;
                        break;
                    case SMITE_ALARMED:
                        if (SmiteAlarmDelay_Timer <= diff)
                        {
                            if (Creature* smite = instance->GetCreature(MrSmiteGUID))
                                smite->AI()->Talk(SAY_ALARM2);
                            State = EVENT_DONE;
                        } else SmiteAlarmDelay_Timer -= diff;
                        break;
                }
            }
		virtual void Update(uint32 diff) {
			if (!IronCladDoorGUID || !DefiasCannonGUID || !DoorLeverGUID)
				return;

			GameObject *pIronCladDoor = instance->GetGameObject(
					IronCladDoorGUID);
			if (!pIronCladDoor)
				return;

			switch (State) {
			case CANNON_GUNPOWDER_USED:
				CannonBlast_Timer = DATA_CANNON_BLAST_TIMER;
				// it's a hack - Mr. Smite should do that but his too far away
				pIronCladDoor->SetName("Mr. Smite");
				pIronCladDoor->MonsterYell(SAY_MR_SMITE_ALARM1, LANG_UNIVERSAL,
						0);
				DoPlaySound(pIronCladDoor, SOUND_MR_SMITE_ALARM1);
				State = CANNON_BLAST_INITIATED;
				break;
			case CANNON_BLAST_INITIATED:
				PiratesDelay_Timer = DATA_PIRATES_DELAY_TIMER;
				if (CannonBlast_Timer <= diff) {
					SummonCreatures();
					ShootCannon();
					BlastOutDoor();
					LeverStucked();
					pIronCladDoor->MonsterYell(SAY_MR_SMITE_ALARM2,
							LANG_UNIVERSAL, 0);
					DoPlaySound(pIronCladDoor, SOUND_MR_SMITE_ALARM2);
					State = PIRATES_ATTACK;
				} else
					CannonBlast_Timer -= diff;
				break;
			case PIRATES_ATTACK:
				if (PiratesDelay_Timer <= diff) {
					MoveCreaturesInside();
					State = EVENT_DONE;
				} else
					PiratesDelay_Timer -= diff;
				break;
			}
		}