Beispiel #1
0
  void AIUpdate()
  {
    bool auraOk = false;
    const uint32 auras[] = {118, 12824, 12825, 12826}; // Polymorph rank 1,2,3,4
    
    for(int i = 0; i<4; i++)
    {   
      if(_unit->HasAura(auras[i]))
      {
        current_aura = auras[i];
        auraOk = true;
        
        break;
      }
    }
    
    if(!auraOk)
      return;

    bool casterOk = false;
    Player *p_caster;

    for(int i = MAX_TOTAL_AURAS_START; i<MAX_TOTAL_AURAS_END; i++)
    {
      if(_unit->m_auras[i] == NULL)
        continue;

      if(_unit->m_auras[i]->GetSpellId() == current_aura)
      {
        if(!_unit->m_auras[i]->GetCaster()->IsPlayer())
          break;

        p_caster = (Player*)_unit->m_auras[i]->GetCaster();

        if(p_caster == NULL)
          break;

        casterOk = true;

        break;
      }
    }

    if(!casterOk)
      return;

    QuestLogEntry *qle = p_caster->GetQuestLogForEntry(9364);
    if(qle == NULL)
      return;

    _unit->Despawn(0, 1*60*1000);

    uint8 num = RandomUInt(5);
    for(int i=0; i<num; i++)
    {
      Creature *cr = sEAS.SpawnCreature(p_caster, 16479, _unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), 0, 1*60*1000);
      SetWander(cr, p_caster);
    }
  }
Beispiel #2
0
		void AIUpdate()
		{
			bool auraOk = false;
			const uint32 auras[] = {118, 12824, 12825, 12826}; // Polymorph rank 1,2,3,4

			for(int i = 0; i < 4; i++)
			{
				if(_unit->HasAura(auras[i]))
				{
					current_aura = auras[i];
					auraOk = true;

					break;
				}
			}

			if(!auraOk)
				return;

			bool casterOk = false;
			Player* p_caster;

			for(int i = 0; i < 100; i++) //random number - azolex(should be max aura fields, no idea and dont care)
			{
				if(_unit->m_auras[i] == NULL)
					continue;

				if(_unit->m_auras[i]->GetSpellId() == current_aura)
				{
					if(!_unit->m_auras[i]->GetCaster()->IsPlayer())
						break;

					p_caster = TO_PLAYER(_unit->m_auras[i]->GetCaster());

					if(p_caster == NULL)
						break;

					casterOk = true;

					break;
				}
			}

			if(!casterOk)
				return;

			QuestLogEntry* qle = p_caster->GetQuestLogForEntry(9364);
			if(qle == NULL)
				return;

			_unit->Despawn(1, 1 * 60 * 1000);

			uint8 num = RandomUInt(5);
			for(int i = 0; i < num; i++)
			{
				Creature* cr = sEAS.SpawnCreature(p_caster, 16479, _unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), 0, 1 * 60 * 1000);
				SetWander(cr, p_caster);
			}
		}
Beispiel #3
0
		void AIUpdate()
		{
			// search for the one of the polymorph auras and its caster
			Player* p_caster = NULL;
			for(uint32 i = MAX_TOTAL_AURAS_START; i < MAX_TOTAL_AURAS_END; i++)
			{
				if(_unit->m_auras[i] != NULL)
				{
					if(_unit->m_auras[i]->GetSpellId() == SPELL_POLYMORPH_1 ||
					   _unit->m_auras[i]->GetSpellId() == SPELL_POLYMORPH_2 ||
					   _unit->m_auras[i]->GetSpellId() == SPELL_POLYMORPH_3 ||
					   _unit->m_auras[i]->GetSpellId() == SPELL_POLYMORPH_4)
					{
						if(p_caster = _unit->m_auras[i]->GetPlayerCaster())
						{
							// wanted aura and its caster have been found.
							break;
						}
						else
						{
							// so the caster was not a player. Should there be searched more? Does this ever happen?
							// For now just return
							return;
						}
					}
				}
			}

			if( p_caster == NULL )
				return;

			if(!p_caster->HasQuest(9364))
				return;

			_unit->Despawn(1, 1 * 60 * 1000);

			uint8 num = RandomUInt(5);
			for(int i = 0; i < num; i++)
			{
				Creature* cr = sEAS.SpawnCreature(p_caster, 16479, _unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), 0, 1 * 60 * 1000);
				SetWander(cr, p_caster);
			}
		}