void MoveInLineOfSight(Unit* pWho) override { // Cosmetic spell if (m_sWretchedGuids.find(pWho->GetObjectGuid()) == m_sWretchedGuids.end() && pWho->IsWithinDist(m_creature, 5.0f) && pWho->isAlive() && (pWho->GetEntry() == NPC_SKULER || pWho->GetEntry() == NPC_BRUISER || pWho->GetEntry() == NPC_HUSK)) { pWho->CastSpell(m_creature, SPELL_FEL_CRYSTAL_COSMETIC, false); m_sWretchedGuids.insert(pWho->GetObjectGuid()); } }
void MoveInLineOfSight(Unit* pWho) override { ScriptedAI::MoveInLineOfSight(pWho); if (pWho->GetEntry() == NPC_BURNING_SPIRIT && pWho->isAlive() && m_sSpiritsGuidsSet.find(pWho->GetObjectGuid()) != m_sSpiritsGuidsSet.end() && pWho->IsWithinDistInMap(m_creature, 2 * CONTACT_DISTANCE)) { pWho->CastSpell(m_creature, SPELL_BURNING_SPIRIT, TRIGGERED_OLD_TRIGGERED); m_sSpiritsGuidsSet.erase(pWho->GetObjectGuid()); } }
void MoveInLineOfSight(Unit* pWho) override { // Note: this implementation is not the best; It should be better handled by the guard script if (m_bCanGuardSalute && (pWho->GetEntry() == NPC_GUARD_CITY || pWho->GetEntry() == NPC_GUARD_ROYAL || pWho->GetEntry() == NPC_GUARD_PATROLLER) && pWho->IsWithinDistInMap(m_creature, 15.0f) && m_sGuardsSalutedGuidSet.find(pWho->GetObjectGuid()) == m_sGuardsSalutedGuidSet.end() && pWho->IsWithinLOSInMap(m_creature)) { DoScriptText(aGuardSalute[urand(0, MAX_GUARD_SALUTES - 1)], pWho); m_sGuardsSalutedGuidSet.insert(pWho->GetObjectGuid()); } }
void CLogSerializer::loadSendLogs(GuidSet& ackSet, GuidMap& missedLogs, unsigned long& total_missed)// { try { Close(); //release old file io, if any m_file = createIFile(m_FilePath.str()); m_fileio = m_file->open(IFOread); if (m_fileio == 0) throw MakeStringException(-1, "Unable to open logging file %s",m_FilePath.str()); offset_t finger = 0; total_missed = 0; while(true) { char dataSize[9]; memset(dataSize, 0, 9); size32_t bytesRead = m_fileio->read(finger,8,dataSize); if(bytesRead==0) break; MemoryBuffer data; int dataLen = atoi(dataSize); finger+=9; bytesRead = m_fileio->read(finger,dataLen,data.reserveTruncate(dataLen)); if(bytesRead==0) break; StringBuffer GUID,lostlogStr; splitLogRecord(data,GUID,lostlogStr); if (ackSet.find(GUID.str())==ackSet.end() && missedLogs.find(GUID.str()) == missedLogs.end()) { if(total_missed % TRACE_INTERVAL == 0) DBGLOG("Miss #%lu GUID: <%s>", total_missed, GUID.str()); missedLogs[GUID.str()] = lostlogStr.str(); total_missed++; } finger+=dataLen; } } catch(IException* ex) { StringBuffer errorStr; ex->errorMessage(errorStr); ERRLOG("Exception caught within CSendLogSerializer::LoadDataMap: %s",errorStr.str()); ex->Release(); } catch(...) { DBGLOG("Unknown Exception thrown in CSendLogSerializer::LoadDataMap"); } Close(); }
void UpdateAI(uint32 diff) override { //Return since we have no target if (!UpdateVictim()) return; //Earthquake_Timer if (Earthquake_Timer <= diff) { if (!Earthquake) { DoCastVictim(SPELL_EARTHQUAKE); Earthquake = true; Earthquake_Timer = 10000; } else { Talk(SAY_SUMMON); for (uint8 i = 0; i < 10; ++i) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) if (Creature* Murloc = me->SummonCreature(NPC_TIDEWALKER_LURKER, MurlocCords[i][0], MurlocCords[i][1], MurlocCords[i][2], MurlocCords[i][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000)) Murloc->AI()->AttackStart(target); } Talk(EMOTE_EARTHQUAKE); Earthquake = false; Earthquake_Timer = 40000 + rand32() % 5000; } } else Earthquake_Timer -= diff; //TidalWave_Timer if (TidalWave_Timer <= diff) { DoCastVictim(SPELL_TIDAL_WAVE); TidalWave_Timer = 20000; } else TidalWave_Timer -= diff; if (!Phase2) { //WateryGrave_Timer if (WateryGrave_Timer <= diff) { //Teleport 4 players under the waterfalls GuidSet targets; GuidSet::const_iterator itr; for (uint8 i = 0; i < 4; ++i) { counter = 0; Unit* target; do { target = SelectTarget(SELECT_TARGET_RANDOM, 1, 50, true); //target players only if (counter < Playercount) break; if (target) itr = targets.find(target->GetGUID()); ++counter; } while (itr != targets.end()); if (target) { targets.insert(target->GetGUID()); ApplyWateryGrave(target, i); } } Talk(SAY_SUMMON_BUBL); Talk(EMOTE_WATERY_GRAVE); WateryGrave_Timer = 30000; } else WateryGrave_Timer -= diff; //Start Phase2 if (HealthBelowPct(25)) Phase2 = true; } else { //WateryGlobules_Timer if (WateryGlobules_Timer <= diff) { GuidSet globules; GuidSet::const_iterator itr; for (uint8 g = 0; g < 4; g++) //one unit can't cast more than one spell per update, so some players have to cast for us XD { counter = 0; Unit* pGlobuleTarget; do { pGlobuleTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true); if (pGlobuleTarget) itr = globules.find(pGlobuleTarget->GetGUID()); if (counter > Playercount) break; ++counter; } while (itr != globules.end()); if (pGlobuleTarget) { globules.insert(pGlobuleTarget->GetGUID()); pGlobuleTarget->CastSpell(pGlobuleTarget, globulespell[g], true); } } Talk(EMOTE_WATERY_GLOBULES); WateryGlobules_Timer = 25000; } else WateryGlobules_Timer -= diff; } DoMeleeAttackIfReady(); }