// Here we have "somepath/roster/" // Include roster's settings file include_once $roster_dir . 'settings.php'; unset($roster_dir); // Include gatherer's conf and locale files include_once $gatherer_dir . 'conf.php'; include_once $gatherer_dir . 'localization.php'; unset($gatherer_dir); $gatherwords =& $wordings[$roster_conf['roster_lang']]; error_reporting(E_ALL); ini_set('display_errors', 1); $query = "SELECT `map`,`xPos`,`yPos`, `nodeType`, `nodeNumber` FROM `" . GATHERER_TABLE . "`;"; $oldinfo = $wowdb->query($query) or die_quietly($wowdb->error(), 'Database Error', basename(__FILE__), __LINE__, $query); if ($wowdb->num_rows($oldinfo) > 0) { while ($row = $wowdb->fetch_assoc($oldinfo)) { $convert = toID($row['xPos'], $row['yPos']); $type = isset($gatherwords['node_names'][$row['nodeType']][$row['nodeNumber']]) ? $gatherwords['node_names'][$row['nodeType']][$row['nodeNumber']] : ''; if ($type == '') { continue; } $dbData[$row['map']][$convert][$row['nodeNumber']] = $row['nodeType']; } } unset($oldinfo); $sql = 'DROP TABLE IF EXISTS `' . GATHERER_TABLE . '`;'; $drop = $wowdb->query($sql) or die_quietly($wowdb->error(), 'Database Error', basename(__FILE__), __LINE__, $sql); if ($drop == TRUE) { echo "Drop Successful"; } else { echo "Drop didn't work"; }
function processCartoMine($luaData, $gatherwords) { global $wowdb; $query = "SELECT `map`,`number` FROM `" . GATHERER_TABLE . "` where `nodeType` = 'MINE';"; $result = $wowdb->query($query) or die_quietly($wowdb->error(), 'Database Error', basename(__FILE__), __LINE__, $query); if ($wowdb->num_rows($result) > 0) { $dbData = array(); while ($row = $wowdb->fetch_assoc($result)) { $coords = toXY($row['number']); $xPos = $coords['xPos']; $yPos = $coords['yPos']; $dbData[$row['map']]['x'] = $xPos; $dbData[$row['map']]['y'] = $yPos; $dbData[$row['map']]['id'] = $row['number']; } } $wowdb->free_result($result); $wowdb->resetMessages(); $inserts = ''; foreach ($luaData as $zone => $data) { $old = array("'", ' ', 'SHATTERAH_CITY', 'SHATTRATH_CITY', 'THE_BARRENS', 'BLADES_EDGE_MOUNTAINS', 'NETHERSTORM', 'THE_HINTERLANDS', 'GHOSTLANDS'); $new = array('', '_', 'SHATTRATH', 'SHATTRATH', 'BARRENS', 'BLADES_EDGE_MOUNTAINS', 'NETHERSTORM', 'HINTERLANDS', 'GHOSTLANDS'); $map = str_replace($old, $new, strtoupper($zone)); if (is_array($data)) { foreach ($data as $number => $mine) { $coords = toXY($number); $xPos = $coords['xPos']; $yPos = $coords['yPos']; $id = toID($xPos, $yPos); $gtype = 'MINE'; $index = $gatherwords['zonecont'][$map]; $nodeNumber = array_search($mine, $gatherwords['node_names']['MINE']); if (isset($dbData) && isset($dbData[$map]) && (isset($dbData[$map]['id']) && $dbData[$map]['id'] != $id || $dbData[$map]['y'] != $yPos && $dbData[$map]['x'] != $xPos)) { continue; } else { if (!empty($inserts)) { $inserts .= ", "; } $inserts .= "( '" . $id . "', '" . $nodeNumber . "', '" . $wowdb->escape($map) . "', '" . $wowdb->escape($gtype) . "', '" . $index . "' )"; } } } } if (!empty($inserts)) { $query = "INSERT INTO `" . GATHERER_TABLE . "` (`number`, `nodeNumber`, `map`, `nodeType`, `continent`) VALUES "; $query = $query . $inserts . ';'; $result = $wowdb->query($query) or die_quietly($wowdb->error(), 'Database Error', basename(__FILE__), __LINE__, $query); } }