I have azh code, it's similar to gl codes. The issue I have is with the travel map. Cities are lined up in a diagonal line. I have 23 cities, I might add more later. i would like to get them so they are randomly placed throughout the map. was wondering how i could go about that. Already figured out how to change the spacing placement so it would show all 23, but making it random, I am unsure.
This is the section of code I am dealing with.
$locationsCount = count($locations);
foreach ($locations as $key => $location) {
$hook = new Hook("alterModuleData");
$hookData = array(
"module" => "travel",
"user" => $this->user,
"data" => $location
);
$location = $hook->run($hookData, 1)["data"];
if (!isset($location['L_map']) || !file_exists($location['L_map'])) {
$map = "themes/"._setting('theme')."/assets/img/pages/travel/map.png";
}else{
$map = $location['L_map'];
}
list($width, $height) = getimagesize($map);
if ($location['L_leader'] > 0) {
$gang = new Gang($location['L_leader']);
$gangs = $gang->getGang();
$leader = $gangs['name'];
}else{
$leader = "None";
}
$data[] = array(
"location" => $location["L_name"],
"color" => $location['L_color'],
"x" => ($width / $locationsCount) * ($location['L_id'] / $locationsCount) + (75 * ($key + 1)),
"y" => ($height / ($locationsCount)) * ($location['L_id'] / $locationsCount) + (35 * ($key + 1)),
"cost" => $location["L_cost"],
"id" => $location["L_id"],
"leader" => $leader,
"cooldown" => $this->timeLeft($location["L_cooldown"])
);
}
I changed the 75 to 40 and the 35 to 20 in these lines
"x" => ($width / $locationsCount) * ($location['L_id'] / $locationsCount) + (75 * ($key + 1)),
"y" => ($height / ($locationsCount)) * ($location['L_id'] / $locationsCount) + (35 * ($key + 1)),