} $tp->assign('chestdrop', $dropTP); // Vendor $vendor = $mysql->getRows("SELECT creature_template.name,creature_template.entry,creature_template.minlevel,creature_template.maxlevel\nFROM `creature_template`,`npc_vendor`\nWHERE creature_template.entry = npc_vendor.entry and npc_vendor.item = ?1 limit 20", $itemData['entry'], 'world'); if ($vendor) { $vendorTP = '<div class="rel-tab"><p class="rel-drop"/><h3>Sold by:</h3></div> <div class="data" style="clear: both;"> <table class="data-table"><tbody><tr class="masthead"><td><a class="noLink">Name</a></td><td align="center"><a class="noLink">Level</a></td><td align="center"><a class="noLink">Location</a></td></tr>'; foreach ($vendor as $mob) { $vendorTP .= '<tr><td><strong>' . $mob['name'] . '</strong></td><td class="centeralign">' . ($mob['minlevel'] == $mob['maxlevel'] ? $mob['minlevel'] : $mob['minlevel'] . '-' . $mob['maxlevel']) . '</td> <td>'; $mapsQ = $mysql->getRows("select map,position_x as x, position_y as y from creature where id = ?1", $mob['entry'], 'world'); $maps = array(); if ($mapsQ) { foreach ($mapsQ as $creature) { $zoneID = getZone($creature['map'], $creature['x'], $creature['y']); $maps[$zoneID]++; } $ct = 0; foreach ($maps as $id => $map) { $ct++; if ($ct > 6) { break; } $vendorTP .= getZoneName($id) . ', '; } $vendorTP = substr($vendorTP, 0, -2); } $vendorTP .= '</td></tr>'; } $vendorTP .= '</tbody></table></div>';
function getZones() { return [['id' => getZone('INTERNATIONAL'), 'name' => 'International'], ['id' => getZone('NATIONAL'), 'name' => 'National']]; }
function createXML() { // Add trace level $paramServerIrrigationXML[] = array("name" => "verbose", "level" => $GLOBALS['PLUGIN_irrigation']['TRACE_LEVEL']); // Add every parameters of the database $ltList = getLT(); foreach ($ltList as $k => $lt) { foreach ($lt as $key => $value) { $paramServerIrrigationXML[] = array("key" => "localtechnique," . $key, "value" => $value); } } $engraisList = getEngrais(); // We add number of engrais $paramServerIrrigationXML[] = array("key" => "nbEngrais", "value" => count($engraisList)); foreach ($engraisList as $k => $engrais) { foreach ($engrais as $key => $value) { $paramServerIrrigationXML[] = array("key" => "engrais," . $engrais["engraisId"] . "," . $key, "value" => $value); } } $plateformeList = getPlateforme(); // We add numer of plateforme $paramServerIrrigationXML[] = array("key" => "nbPlateforme", "value" => count($plateformeList)); foreach ($plateformeList as $k => $plateforme) { foreach ($plateforme as $key => $value) { $paramServerIrrigationXML[] = array("key" => "plateforme," . $plateforme["idPlateforme"] . "," . $key, "value" => $value); } // Foreach plateforme, we add zones $zoneList = getZone($plateforme["idPlateforme"]); // We add numer of zone $paramServerIrrigationXML[] = array("key" => "plateforme," . $plateforme["idPlateforme"] . ",nbZone", "value" => count($zoneList)); foreach ($zoneList as $key => $zone) { foreach ($zone as $key => $value) { $paramServerIrrigationXML[] = array("key" => "plateforme," . $plateforme["idPlateforme"] . ",zone," . $zone["zoneId"] . "," . $key, "value" => $value); } } } // Save it \create_conf_XML($GLOBALS['CULTIPI_CONF_TEMP_PATH'] . "/serverIrrigation/conf.xml", $paramServerIrrigationXML); return 0; }
function changeZone($sValue) { // decode submitted data $sValue_array = explode("~~|~~", $sValue); $sZone = $sValue_array[0]; // strip bad stuff // create string to return to the page $errText = ""; if ($err != 0) { $errText = "MySQL Error: " . mysql_error(); } $newText = getZone($sZone) . "~~|~~" . $zone . '~~|~~' . $errText; return $newText; }