function row_deployable($row, $chbox, $world) { $Worldspace = str_replace("[", "", $row['Worldspace']); $Worldspace = str_replace("]", "", $Worldspace); $Worldspace = explode(",", $Worldspace); $x = 0; if (array_key_exists(1, $Worldspace)) { $x = $Worldspace[1]; } $y = 0; if (array_key_exists(2, $Worldspace)) { $y = $Worldspace[2]; } $InventoryPreview = ''; $Inventory = $row['Inventory']; $Inventory = json_decode($Inventory); $limit = 6; if (count($Inventory) > 0) { $bpweapons = array(); if (array_key_exists(0, $Inventory)) { $bpweaponscount = count($Inventory[0][0]); for ($m = 0; $m < $bpweaponscount; $m++) { for ($mi = 0; $mi < $Inventory[0][1][$m]; $mi++) { $bpweapons[] = $Inventory[0][0][$m]; } } } $bpitems = array(); if (array_key_exists(1, $Inventory)) { $bpitemscount = count($Inventory[1][0]); for ($m = 0; $m < $bpitemscount; $m++) { for ($mi = 0; $mi < $Inventory[1][1][$m]; $mi++) { $bpitems[] = $Inventory[1][0][$m]; } } } $bpacks = array(); if (array_key_exists(2, $Inventory)) { $bpackscount = count($Inventory[2][0]); for ($m = 0; $m < $bpackscount; $m++) { for ($mi = 0; $mi < $Inventory[2][1][$m]; $mi++) { $bpacks[] = $Inventory[2][0][$m]; } } } $Inventory = array_merge($bpweapons, $bpacks, $bpitems); } else { $Inventory = array(); } for ($i = 0; $i < $limit; $i++) { if (array_key_exists($i, $Inventory)) { $curitem = $Inventory[$i]; $icount = ''; if (is_array($curitem)) { if ($i != 0) { $curitem = $Inventory[$i][0]; $icount = ' - ' . $Inventory[$i][1] . ' rounds'; } } $InventoryPreview .= '<div class="preview_gear_slot" style="margin-top: 0px; width: 47px; height: 47px; min-width: 47px; min-height: 47px;"><img style="width: 43px; height: 43px;" src="images/thumbs/' . $curitem . '.png" title="' . $curitem . $icount . '" alt="' . $curitem . $icount . '" /></div>'; } else { $InventoryPreview .= '<div class="preview_gear_slot" style="margin-top: 0px; width: 47px; height: 47px; min-width: 47px; min-height: 47px;"><img style="width: 43px; height: 43px;" src="images/forms/blank.gif" alt="" /></div>'; } } require_once 'modules/calc.php'; $tablerow = '<tr>' . $chbox . ' <td align="center" class="gear_preview"><a href="index.php?view=info&show=5&id=' . $row['ObjectID'] . '">' . $row['ObjectID'] . '</a></td> <td align="center" class="gear_preview"><a href="index.php?view=info&show=5&id=' . $row['ObjectID'] . '">' . $row['ObjectUID'] . '</a></td> <td align="center" class="gear_preview">' . $row['Classname'] . '</td> <td align="center" class="gear_preview">' . (sprintf("%03d", round(world_x($x, $world))) . sprintf("%03d", round(world_y($y, $world)))) . '</td> <td align="center" class="gear_preview">' . $InventoryPreview . '</td> </tr>'; return $tablerow; }
function markers_wreck($lines, $world) { $markers = array(); foreach ($lines as $line) { $matches = array(); //$sectionpattern = "/((?<=\sat\s\[)[0-9]{0,20}+\.+[0-9]{0,10}+\,+[0-9]{0,20}+\.+[0-9]{0,10})/x"; // Only helicopter crashsites: "/((?<=[a-z]{10}\s[a-z]{2}\s\[)[0-9]{0,20}+\.+[0-9]{0,10}+\,+[0-9]{0,20}+\.+[0-9]{0,10})/x" $sectionpattern = "/\\b([0-9\\:]+)\\s\"CRASHSPAWNER:\\s\\w+\\s'(Crashed\\s.+)'\\s[\\w]+\\s[\\w]+\\s[\\w]+\\s'(\\w+)'\\s\\w+\\!\\s\\(([0-9.]+)\\)\\s\\w+:\\s\\[([0-9.,]+)\\]\"/"; if (preg_match($sectionpattern, $line, $matches)) { //print_r($matches); $Worldspace = explode(",", $matches[5]); $x = 0; if (array_key_exists(0, $Worldspace)) { $x = $Worldspace[0]; } $y = 0; if (array_key_exists(1, $Worldspace)) { $y = $Worldspace[1]; } $tmp = array(); require_once 'modules/calc.php'; if (strpos($line, "Misc_cargo_cont_net") !== false) { $description = '<h2>Care</h2><table><tr><td><img style="width: 100px;" src="images/vehicles/care.png"></td><td> </td><td style="vertical-align: top;"><h2>Position:</h2>Left: ' . round(world_x($x, $world)) . '<br />Top: ' . round(world_y($y, $world)) . '</td></tr></table>'; $tmp["icon"] = "Care"; $tmp["title"] = "Care"; } else { // Edits by SilveShot to differ between helicopter crashsites and other wrecks if (strpos($line, "CRASHSPAWNER:") !== false) { $description = '<h2>Crashed Helicopter</h2><table><tr><td><img src="images/vehicles/crashsite.png" alt="" style="width: 100px;" /></td><td> </td><td style="vertical-align: top;"><h2>Position:</h2>Left: ' . round(world_x($x, $world)) . '<br />Top: ' . round(world_y($y, $world)) . '</td></tr></table>'; $tmp["icon"] = "Crashsite"; $tmp["title"] = "Crashed Helicopter"; } else { $description = '<h2>Wreck</h2><table><tr><td><img src="images/vehicles/wreck.png" alt="" style="width: 100px;" /></td><td> </td><td style="vertical-align: top;"><h2>Position:</h2>Left: ' . round(world_x($x, $world)) . '<br />Top: ' . round(world_y($y, $world)) . '</td></tr></table>'; $tmp["icon"] = "Wreck"; $tmp["title"] = "Wreck"; } } $tmp["lat"] = world_y($y, $world) / 10; $tmp["lng"] = world_x($x, $world) / 10; $tmp["description"] = $description; $markers[] = $tmp; } } return $markers; }
?> </div> <div class="gpstext" style="font-size: 22px; width: 60px; text-align: left; margin-left: 47px; margin-top: 34px"> <?php if (array_key_exists(3, $Worldspace)) { echo round($Worldspace[3] / 100); } else { echo "0"; } ?> </div> <div class="gpstext" style="width: 120px; margin-left: 13px; margin-top: 61px"> <?php require_once 'modules/calc.php'; if (array_key_exists(1, $Worldspace) && array_key_exists(2, $Worldspace)) { echo sprintf("%03d", round(world_x($Worldspace[1], $serverworld))) . sprintf("%03d", round(world_y($Worldspace[2], $serverworld))); } else { echo "000000"; } ?> </div> </div> <div class="statstext" style="width: 180px; margin-left: 205px; margin-top: -135px"> <?php echo 'Humanity: ' . $row['Humanity']; ?> </div> <div class="statstext" style="width: 180px; margin-left: 205px; margin-top: -115px"> <?php echo 'Zombie kills: ' . $row['KillsZ']; ?>
function markers_buildable($res, $world) { global $security; $markers = array(); $xml = file_get_contents('vehicles.xml', true); require_once 'modules/xml2array.php'; $vehicles_xml = XML2Array::createArray($xml); foreach ($res as $row) { $Worldspace = str_replace("[", "", $row['Worldspace']); $Worldspace = str_replace("]", "", $Worldspace); $Worldspace = explode(",", $Worldspace); $x = 0; if (array_key_exists(1, $Worldspace)) { $x = $Worldspace[1]; } $y = 0; if (array_key_exists(2, $Worldspace)) { $y = $Worldspace[2]; } $class = $row['Classname']; $type = $row['Type']; require_once 'modules/calc.php'; $maintenance = $row['Hitpoints'] == "[\"Maintenance\"]" ? "Yes" : "No"; $description = '<strong>' . $class . ' (' . $row['ObjectID'] . ') - ' . htmlspecialchars($row['playerName']) . '</strong><br><strong>Last updated:</strong> ' . $row['last_updated'] . '<br><table><tr><td><img style="width: 100px;" src="images/vehicles/' . $class . '.png"\\></td><td> </td><td style="vertical-align: top;"><strong>Position:</strong> ' . sprintf("%03d%03d", round(world_x($x, $world)), round(world_y($y, $world))) . '<br><strong>Needs Maintenance:</strong> ' . $maintenance . '</td></tr></table><br>'; $tmp = array(); $tmp["id"] = $row['ObjectUID']; $tmp["lat"] = world_y($y, $world) / 10; $tmp["lng"] = world_x($x, $world) / 10; $tmp["icon"] = $type; $tmp["title"] = $class . " (" . $row['ObjectID'] . ") - " . htmlspecialchars($row['playerName']); $tmp["description"] = $description; $tmp["zIndexOffset"] = 20000; $markers[] = $tmp; } return $markers; }