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); } }
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); // Get our map and continent if they exist $continent = isset($_GET['continent']) ? $_GET['continent'] : ''; $map = isset($_GET['map']) ? $_GET['map'] : ''; // Grab our data $query = "SELECT * FROM `" . GATHERER_TABLE . "` WHERE `continent` = '{$continent}' AND `map` = '{$map}' ORDER BY `nodeType` DESC;"; $result = $wowdb->query($query) or die_quietly($wowdb->error(), 'Database Error', basename(__FILE__), __LINE__, $query); header('Content-type: text/xml'); echo "<map>\n <a_map continent=\"" . $gatherwords['continents'][$continent] . "\" map=\"" . $gatherwords['zones'][$continent][$map] . "\" image=\"" . ROSTER_URL . "/images/MAP/{$continent}/{$map}.jpg\"> \n"; while ($row = mysql_fetch_array($result)) { $nodeName = isset($gatherwords['node_names'][$row['nodeType']]) ? $gatherwords['node_names'][$row['nodeType']] : $row['nodeType']; $coords = toXY($row['number']); $xPos = $coords['xPos']; $yPos = $coords['yPos']; echo "<Gatherable Gtype=\"" . $row['nodeType'] . "\" XPos=\"" . $xPos * 1000 . "\" YPos=\"" . $yPos * 668 . "\" Icon=\"" . ROSTER_URL . "/images/" . $row['nodeType'] . "/" . $row['nodeNumber'] . ".png\" GatherableName=\"" . $gatherwords['node_names'][$row['nodeType']][$row['nodeNumber']] . "\" />"; } echo "</a_map> \n </map> \n"; function toID($xPos, $yPos) { return round($xPos * 10000, 0) + round($yPos * 10000, 0) * 10001; } function toXY($num) { $return['xPos'] = $num % 10001 / 10000; $return['yPos'] = floor($num / 10001) / 10000; return $return; }