void BSWScriptedAI::doReset() { Map* pMap = m_creature->GetMap(); if (pMap) currentDifficulty = pMap->GetDifficulty(); else currentDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; m_BSWRecords.clear(); setStage(0); _loadFromDB(); _fillEmptyDataField(); resetTimers(); };
void BossSpellWorker::LoadSpellTable() { debug_log("BSW: Loading table of spells boss %u difficulty %u", bossID , currentDifficulty); char query[MAX_QUERY_LEN]; sprintf(query, "SELECT entry, spellID_N10, spellID_N25, spellID_H10, spellID_H25, timerMin_N10, timerMin_N25, timerMin_H10, timerMin_H25, timerMax_N10, timerMax_N25, timerMax_H10, timerMax_H25, data1, data2, data3, data4, locData_x, locData_y, locData_z, varData, StageMask_N, StageMask_H, CastType, isVisualEffect, isBugged, textEntry FROM `boss_spell_table` WHERE entry = %u;\r\n", bossID); QueryResult_AutoPtr Result = WorldDatabase.PQuery(query); if (Result) { uint32 uiCount = 0; do { Field* pFields = Result->Fetch(); m_BossSpell[uiCount].id = uiCount; int32 bossEntry = pFields[0].GetInt32(); for (uint8 j = 0; j < DIFFICULTY_LEVELS; ++j) m_BossSpell[uiCount].m_uiSpellEntry[j] = pFields[1+j].GetUInt32(); for (uint8 j = 0; j < DIFFICULTY_LEVELS; ++j) m_BossSpell[uiCount].m_uiSpellTimerMin[j] = pFields[1+DIFFICULTY_LEVELS+j].GetUInt32(); for (uint8 j = 0; j < DIFFICULTY_LEVELS; ++j) m_BossSpell[uiCount].m_uiSpellTimerMax[j] = pFields[1+DIFFICULTY_LEVELS*2+j].GetUInt32(); for (uint8 j = 0; j < DIFFICULTY_LEVELS; ++j) m_BossSpell[uiCount].m_uiSpellData[j] = pFields[1+DIFFICULTY_LEVELS*3+j].GetUInt32(); m_BossSpell[uiCount].LocData.x = pFields[1+DIFFICULTY_LEVELS*4].GetFloat(); m_BossSpell[uiCount].LocData.y = pFields[2+DIFFICULTY_LEVELS*4].GetFloat(); m_BossSpell[uiCount].LocData.z = pFields[3+DIFFICULTY_LEVELS*4].GetFloat(); m_BossSpell[uiCount].varData = pFields[4+DIFFICULTY_LEVELS*4].GetInt32(); m_BossSpell[uiCount].StageMaskN = pFields[5+DIFFICULTY_LEVELS*4].GetUInt32(); m_BossSpell[uiCount].StageMaskH = pFields[6+DIFFICULTY_LEVELS*4].GetUInt32(); m_BossSpell[uiCount].m_CastTarget = getBSWCastType(pFields[7+DIFFICULTY_LEVELS*4].GetUInt8()); m_BossSpell[uiCount].m_IsVisualEffect = (pFields[8+DIFFICULTY_LEVELS*4].GetUInt8() == 0) ? false : true ; m_BossSpell[uiCount].m_IsBugged = (pFields[9+DIFFICULTY_LEVELS*4].GetUInt8() == 0) ? false : true ; m_BossSpell[uiCount].textEntry = pFields[10+DIFFICULTY_LEVELS*4].GetInt32(); if (bossEntry != bossID) error_db_log("BSW: Unknown error while load boss_spell_table"); ++uiCount; } while (Result->NextRow()); _bossSpellCount = uiCount; _fillEmptyDataField(); debug_log("BSW: Loaded %u boss spell data records for boss %u", uiCount, bossID); } else { error_db_log("BSW: Boss spell table for boss %u is empty.", bossID); _bossSpellCount = 0; }; }
void BSWScriptedAI::_loadSpellTable() { // mutex block for process-safe request execute ACE_Process_Mutex mMutex = ACE_Process_Mutex("BSW_Lock"); debug_log("BSW: Loading table of creature %u spell on difficulty %u", m_creature->GetEntry(), currentDifficulty); char query[MAX_QUERY_LEN]; sprintf(query, "SELECT entry, spellID_N10, spellID_N25, spellID_H10, spellID_H25, timerMin_N10, timerMin_N25, timerMin_H10, timerMin_H25, timerMax_N10, timerMax_N25, timerMax_H10, timerMax_H25, data1, data2, data3, data4, locData_x, locData_y, locData_z, varData, StageMask_N, StageMask_H, CastType, isVisualEffect, isBugged, textEntry FROM `boss_spell_table` WHERE entry = %u;\r\n", m_creature->GetEntry()); mMutex.acquire(); QueryResult* Result = WorldDatabase.Query(query); mMutex.release(); if (Result) { uint32 uiCount = 0; do { Field* pFields = Result->Fetch(); m_BossSpell[uiCount].id = uiCount; uint32 m_creatureEntry = pFields[0].GetUInt32(); for (uint8 j = 0; j < DIFFICULTY_LEVELS; ++j) m_BossSpell[uiCount].m_uiSpellEntry[j] = pFields[1+j].GetUInt32(); for (uint8 j = 0; j < DIFFICULTY_LEVELS; ++j) m_BossSpell[uiCount].m_uiSpellTimerMin[j] = pFields[1+DIFFICULTY_LEVELS+j].GetUInt32(); for (uint8 j = 0; j < DIFFICULTY_LEVELS; ++j) m_BossSpell[uiCount].m_uiSpellTimerMax[j] = pFields[1+DIFFICULTY_LEVELS*2+j].GetUInt32(); for (uint8 j = 0; j < DIFFICULTY_LEVELS; ++j) m_BossSpell[uiCount].m_uiSpellData[j] = pFields[1+DIFFICULTY_LEVELS*3+j].GetUInt32(); m_BossSpell[uiCount].LocData.x = pFields[1+DIFFICULTY_LEVELS*4].GetFloat(); m_BossSpell[uiCount].LocData.y = pFields[2+DIFFICULTY_LEVELS*4].GetFloat(); m_BossSpell[uiCount].LocData.z = pFields[3+DIFFICULTY_LEVELS*4].GetFloat(); m_BossSpell[uiCount].varData = pFields[4+DIFFICULTY_LEVELS*4].GetInt32(); m_BossSpell[uiCount].StageMaskN = pFields[5+DIFFICULTY_LEVELS*4].GetUInt32(); m_BossSpell[uiCount].StageMaskH = pFields[6+DIFFICULTY_LEVELS*4].GetUInt32(); m_BossSpell[uiCount].m_CastTarget = _getBSWCastType(pFields[7+DIFFICULTY_LEVELS*4].GetUInt8()); m_BossSpell[uiCount].m_IsVisualEffect = (pFields[8+DIFFICULTY_LEVELS*4].GetUInt8() == 0) ? false : true ; m_BossSpell[uiCount].m_IsBugged = (pFields[9+DIFFICULTY_LEVELS*4].GetUInt8() == 0) ? false : true ; m_BossSpell[uiCount].textEntry = pFields[10+DIFFICULTY_LEVELS*4].GetInt32(); if (m_creatureEntry != m_creature->GetEntry()) error_log("BSW: Unknown error while load boss_spell_table"); else ++uiCount; } while (Result->NextRow()); _bossSpellCount = uiCount; delete Result; _fillEmptyDataField(); debug_log("BSW: Loaded %u spell data records for creature %u", uiCount, m_creature->GetEntry()); } else { error_log("BSW: Boss spell table for creature %u is empty.", m_creature->GetEntry()); _bossSpellCount = 0; }; }