function TEST_Threat_AI.GetDBInfo(LuaAI) -- function to pull spell and spawnpoint info data = LuaAI:Data(); petcheck = TEST_Threat_AI.CheckPet(LuaAI); -- checks for pet/totem data["SpawnPosX"] = 0 data["SpawnPosY"] = 0 data["SpawnPosZ"] = 0 data["spellID1"] = 0 data["spellID2"] = 0 data["spellID3"] = 0 data["spellID4"] = 0 data["moblevel"] = 1 if petcheck == false then creatureGUID = LuaAI:GetCreature():GetGUIDLow(); --printf("/n/n"..tostring(creatureGUID)); queryString = "SELECT `id` , `spawn_position_x` , `spawn_position_y` , `spawn_position_z` FROM `creature` WHERE `guid`=" .. creatureGUID; nameid = sDatabase:Query(queryString) if nameid ~= nil then getcreatureID = nameid:Fetch() data["SpawnPosX"] = getcreatureID[1]:GetInt32() data["SpawnPosY"] = getcreatureID[2]:GetInt32() data["SpawnPosZ"] = getcreatureID[3]:GetInt32() local creatureID = getcreatureID[0]:GetString() queryString2 = "SELECT `maxlevel`, `spell1`, `spell2`, `spell3`, `spell4` FROM `creature_template` WHERE `entry`=" .. creatureID; result1 = sDatabase:Query(queryString2); result = result1:Fetch(); if result ~= nil then --Store in the data table so we can easily make use of it later data["moblevel"] = result[0]:GetInt32() data["spellID1"] = result[1]:GetInt32() data["spellID2"] = result[2]:GetInt32() data["spellID3"] = result[3]:GetInt32() data["spellID4"] = result[4]:GetInt32() end TEST_Threat_AI.CheckSpell(LuaAI, data["spellID1"], 1) TEST_Threat_AI.CheckSpell(LuaAI, data["spellID2"], 2) TEST_Threat_AI.CheckSpell(LuaAI, data["spellID3"], 3) TEST_Threat_AI.CheckSpell(LuaAI, data["spellID4"], 4) end end LuaAI:SetData(data) end