Setup/Spawns:

* only priorize captials over their surrounding if there is no alphaMap present
  * Dalaran and Shattrath are capitals
  * truncate old data as it may not get overwitten
This commit is contained in:
Sarjuuk
2015-07-17 23:04:34 +02:00
parent 20732e38d8
commit c1f5d2ea9b
2 changed files with 20 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
<?php <?php
define('AOWOW_REVISION', 2); define('AOWOW_REVISION', 3);
define('CLI', PHP_SAPI === 'cli'); define('CLI', PHP_SAPI === 'cli');

View File

@@ -56,25 +56,26 @@ function spawns() // and waypoints
$result = []; $result = [];
$capitals = array( // capitals take precedence over their surroundings $capitals = array( // capitals take precedence over their surroundings
1497, 1637, 1638, 3487, // Undercity, Ogrimmar, Thunder Bluff, Silvermoon City 1497, 1637, 1638, 3487, // Undercity, Ogrimmar, Thunder Bluff, Silvermoon City
1519, 1537, 1657, 3557 // Stormwind City, Ironforge, Darnassus, The Exodar 1519, 1537, 1657, 3557, // Stormwind City, Ironforge, Darnassus, The Exodar
3703, 4395 // Shattrath City, Dalaran
); );
foreach ($points as $res) foreach ($points as $res)
{ {
// some rough measure how central the spawn is on the map (the lower the number, the better) if ($alphaMapCheck($res['areaId'], $res))
// 0: perfect center; 1: touches a border
$q = abs( (($res['posX'] - 50) / 50) * (($res['posY'] - 50) / 50) );
if (in_array($res['areaId'], $capitals)) // capitals may also be auto-discovered
return $res;
else if ($alphaMapCheck($res['areaId'], $res))
{ {
if (!$res) if (!$res)
continue; continue;
// some rough measure how central the spawn is on the map (the lower the number, the better)
// 0: perfect center; 1: touches a border
$q = abs( (($res['posX'] - 50) / 50) * (($res['posY'] - 50) / 50) );
if (empty($result) || $result[0] > $q) if (empty($result) || $result[0] > $q)
$result = [$q, $res]; $result = [$q, $res];
} }
else if (in_array($res['areaId'], $capitals)) // capitals (auto-discovered) and no hand-made alphaMap available
return $res;
else if (empty($result)) // add with lowest quality if alpha map is missing else if (empty($result)) // add with lowest quality if alpha map is missing
$result = [1.0, $res]; $result = [1.0, $res];
} }
@@ -121,6 +122,14 @@ function spawns() // and waypoints
'ORDER BY quality ASC'; 'ORDER BY quality ASC';
/*********************/
/* truncate old data */
/*********************/
DB::Aowow()->query('TRUNCATE TABLE ?_spawns');
DB::Aowow()->query('TRUNCATE TABLE ?_creature_waypoints');
/**************************/ /**************************/
/* offsets for transports */ /* offsets for transports */
/**************************/ /**************************/
@@ -205,6 +214,7 @@ function spawns() // and waypoints
} }
} }
/*****************************/ /*****************************/
/* spawn vehicle accessories */ /* spawn vehicle accessories */
/*****************************/ /*****************************/
@@ -248,6 +258,7 @@ function spawns() // and waypoints
if ($accessories) if ($accessories)
CLISetup::log(count($accessories).' accessories could not be fitted onto a spawned vehicle.', CLISetup::LOG_WARN); CLISetup::log(count($accessories).' accessories could not be fitted onto a spawned vehicle.', CLISetup::LOG_WARN);
/********************************/ /********************************/
/* restrict difficulty displays */ /* restrict difficulty displays */
/********************************/ /********************************/