mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Misc/Fixups
* vehicle accessories now get moved with their vehicle * try to account for multilevel zone offset nonsense * fixed some more typos and unaccounted null cases
This commit is contained in:
@@ -414,45 +414,50 @@ class AjaxAdmin extends AjaxHandler
|
||||
{
|
||||
if ($point = Game::worldPosToZonePos($wPos[$guid]['mapId'], $wPos[$guid]['posX'], $wPos[$guid]['posY'], $area, $floor))
|
||||
{
|
||||
$p = array(
|
||||
$updGUIDs = [$guid];
|
||||
$newPos = array(
|
||||
'posX' => $point[0]['posX'],
|
||||
'posY' => $point[0]['posY'],
|
||||
'areaId' => $point[0]['areaId'],
|
||||
'floor' => $point[0]['floor']
|
||||
);
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_spawns SET ?a WHERE `type` = ?d AND `guid` = ?d', $p, $type, $guid);
|
||||
|
||||
// if creature try for waypoints
|
||||
if ($type != TYPE_NPC)
|
||||
return '1';
|
||||
|
||||
$jobs = array(
|
||||
'SELECT -w.id AS `entry`, w.point AS `pointId`, w.position_y AS `posX`, w.position_x AS `posY` FROM creature_addon ca JOIN waypoint_data w ON w.id = ca.path_id WHERE ca.guid = ?d AND ca.path_id <> 0',
|
||||
'SELECT `entry`, `pointId`, `location_y` AS `posX`, `location_x` AS `posY` FROM `script_waypoint` WHERE `entry` = ?d',
|
||||
'SELECT `entry`, `pointId`, `position_y` AS `posX`, `position_x` AS `posY` FROM `waypoints` WHERE `entry` = ?d'
|
||||
);
|
||||
|
||||
foreach ($jobs as $idx => $job)
|
||||
if ($type == TYPE_NPC)
|
||||
{
|
||||
if ($swp = DB::World()->select($job, $idx ? $wPos['id'] : $guid))
|
||||
$jobs = array(
|
||||
'SELECT -w.id AS `entry`, w.point AS `pointId`, w.position_y AS `posX`, w.position_x AS `posY` FROM creature_addon ca JOIN waypoint_data w ON w.id = ca.path_id WHERE ca.guid = ?d AND ca.path_id <> 0',
|
||||
'SELECT `entry`, `pointId`, `location_y` AS `posX`, `location_x` AS `posY` FROM `script_waypoint` WHERE `entry` = ?d',
|
||||
'SELECT `entry`, `pointId`, `position_y` AS `posX`, `position_x` AS `posY` FROM `waypoints` WHERE `entry` = ?d'
|
||||
);
|
||||
|
||||
foreach ($jobs as $idx => $job)
|
||||
{
|
||||
foreach ($swp as $w)
|
||||
if ($swp = DB::World()->select($job, $idx ? $wPos[$guid]['id'] : $guid))
|
||||
{
|
||||
if ($point = Game::worldPosToZonePos($wPos[$guid]['mapId'], $w['posX'], $w['posY'], $area, $floor))
|
||||
foreach ($swp as $w)
|
||||
{
|
||||
$p = array(
|
||||
'posX' => $point[0]['posX'],
|
||||
'posY' => $point[0]['posY'],
|
||||
'areaId' => $point[0]['areaId'],
|
||||
'floor' => $point[0]['floor']
|
||||
);
|
||||
if ($point = Game::worldPosToZonePos($wPos[$guid]['mapId'], $w['posX'], $w['posY'], $area, $floor))
|
||||
{
|
||||
$p = array(
|
||||
'posX' => $point[0]['posX'],
|
||||
'posY' => $point[0]['posY'],
|
||||
'areaId' => $point[0]['areaId'],
|
||||
'floor' => $point[0]['floor']
|
||||
);
|
||||
}
|
||||
DB::Aowow()->query('UPDATE ?_creature_waypoints SET ?a WHERE `creatureOrPath` = ?d AND `point` = ?d', $p, $w['entry'], $w['pointId']);
|
||||
}
|
||||
DB::Aowow()->query('UPDATE ?_creature_waypoints SET ?a WHERE `creatureOrPath` = ?d AND `point` = ?d', $p, $w['entry'], $w['pointId']);
|
||||
}
|
||||
}
|
||||
|
||||
// also move linked vehicle accessories (on the very same position)
|
||||
$updGUIDs = array_merge($updGUIDs, DB::Aowow()->selectCol('SELECT s2.guid FROM ?_spawns s1 JOIN ?_spawns s2 ON s1.posX = s2.posX AND s1.posY = s2.posY AND
|
||||
s1.areaId = s2.areaId AND s1.floor = s2.floor AND s2.guid < 0 WHERE s1.guid = ?d', $guid));
|
||||
}
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_spawns SET ?a WHERE `type` = ?d AND `guid` IN (?a)', $newPos, $type, $updGUIDs);
|
||||
|
||||
return '1';
|
||||
}
|
||||
|
||||
|
||||
@@ -652,14 +652,14 @@ trait spawnHelper
|
||||
$info[5] = 'Orientation'.Lang::main('colon').$o[0].'° ('.$o[1].')';
|
||||
}
|
||||
|
||||
if (User::isInGroup(U_GROUP_MODERATOR))
|
||||
if (User::isInGroup(U_GROUP_MODERATOR) && $worldPos)
|
||||
{
|
||||
if ($points = Game::worldPosToZonePos($worldPos[$s['guid']]['mapId'], $worldPos[$s['guid']]['posX'], $worldPos[$s['guid']]['posY']))
|
||||
{
|
||||
$floors = [];
|
||||
foreach ($points as $p)
|
||||
{
|
||||
if ($p['floor'])
|
||||
if (isset(Game::$areaFloors[$p['areaId']]))
|
||||
$floors[$p['areaId']][] = $p['floor'];
|
||||
|
||||
if (isset($menu[$p['areaId']]))
|
||||
@@ -679,10 +679,16 @@ trait spawnHelper
|
||||
|
||||
foreach ($f as $n)
|
||||
{
|
||||
$jsRef = $n;
|
||||
if ($area != 4273) // Ulduar is weird maaaan.....
|
||||
$jsRef--;
|
||||
|
||||
// todo: 3959 (BT) and 4075 (Sunwell) start at level 0 or something
|
||||
|
||||
if ($n == $s['floor'])
|
||||
$menu[$area][3][] = [$n, '$g_zone_areas['.$area.']['.($n-1).']', '', null, ['class' => 'checked q0']];
|
||||
$menu[$area][3][] = [$jsRef, '$g_zone_areas['.$area.']['.$jsRef.']', '', null, ['class' => 'checked q0']];
|
||||
else
|
||||
$menu[$area][3][] = [$n, '$g_zone_areas['.$area.']['.($n-1).']', '$spawnposfix.bind(null, '.self::$type.', '.$s['guid'].', '.$area.', '.$n.')'];
|
||||
$menu[$area][3][] = [$jsRef, '$g_zone_areas['.$area.']['.$jsRef.']', '$spawnposfix.bind(null, '.self::$type.', '.$s['guid'].', '.$area.', '.$n.')'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,13 @@ class Game
|
||||
null, 4, 10, 9, 8, 6, 15, 11, 3, 5, null, 7
|
||||
);
|
||||
|
||||
public static $areaFloors = array(
|
||||
206 => 3, 209 => 7, 719 => 3, 721 => 4, 796 => 4, 1196 => 2, 1337 => 2, 1581 => 2, 1583 => 7, 1584 => 2,
|
||||
2017 => 2, 2057 => 4, 2100 => 2, 2557 => 6, 2677 => 4, 3428 => 3, 3457 => 17, 3790 => 2, 3791 => 2, 3959 => 8,
|
||||
3456 => 6, 3715 => 2, 3848 => 3, 3849 => 2, 4075 => 2, 4100 => 2, 4131 => 2, 4196 => 2, 4228 => 4, 4272 => 2,
|
||||
4273 => 6, 4277 => 3, 4395 => 2, 4494 => 2, 4722 => 2, 4812 => 8
|
||||
);
|
||||
|
||||
public static function itemModByRatingMask($mask)
|
||||
{
|
||||
if (($mask & 0x1C000) == 0x1C000) // special case resilience
|
||||
|
||||
@@ -116,7 +116,7 @@ class NpcPage extends GenericPage
|
||||
// Event (ignore events, where the object only gets removed)
|
||||
if ($_ = DB::World()->selectCol('SELECT DISTINCT ge.eventEntry FROM game_event ge, game_event_creature gec, creature c WHERE ge.eventEntry = gec.eventEntry AND c.guid = gec.guid AND c.id = ?d', $this->typeId))
|
||||
{
|
||||
$this->extendGlobalIds(TYPE_WORLDEVENT, $_);
|
||||
$this->extendGlobalIds(TYPE_WORLDEVENT, ...$_);
|
||||
$ev = [];
|
||||
foreach ($_ as $i => $e)
|
||||
$ev[] = ($i % 2 ? '[br]' : ' ') . '[event='.$e.']';
|
||||
|
||||
@@ -60,7 +60,7 @@ class ObjectPage extends GenericPage
|
||||
// Event (ignore events, where the object only gets removed)
|
||||
if ($_ = DB::World()->selectCol('SELECT DISTINCT ge.eventEntry FROM game_event ge, game_event_gameobject geg, gameobject g WHERE ge.eventEntry = geg.eventEntry AND g.guid = geg.guid AND g.id = ?d', $this->typeId))
|
||||
{
|
||||
$this->extendGlobalIds(TYPE_WORLDEVENT, $_);
|
||||
$this->extendGlobalIds(TYPE_WORLDEVENT, ...$_);
|
||||
$ev = [];
|
||||
foreach ($_ as $i => $e)
|
||||
$ev[] = ($i % 2 ? '[br]' : ' ') . '[event='.$e.']';
|
||||
|
||||
@@ -152,6 +152,7 @@ SqlGen::register(new class extends SetupScript
|
||||
else
|
||||
$queryResult = DB::World()->select($q[0]);
|
||||
|
||||
$doneGUID = 0;
|
||||
foreach ($queryResult as $spawn)
|
||||
{
|
||||
if (!$n)
|
||||
@@ -176,10 +177,15 @@ SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
$area = $overrideData[$q[2]][$spawn['guid']]['areaId'];
|
||||
$floor = $overrideData[$q[2]][$spawn['guid']]['floor'];
|
||||
CLI::write('GUID '.$spawn['guid'].' was manually moved [A:'.$spawn['areaId'].' => '.$area.'; F: '.$floor.']', CLI::LOG_INFO);
|
||||
if ($doneGUID != $spawn['guid'])
|
||||
{
|
||||
CLI::write('GUID '.$spawn['guid'].' was manually moved [A:'.$spawn['areaId'].' => '.$area.'; F: '.$floor.']', CLI::LOG_INFO);
|
||||
$doneGUID = $spawn['guid']; // do not spam on waypoints
|
||||
}
|
||||
}
|
||||
|
||||
$points = Game::worldPosToZonePos($spawn['map'], $spawn['posX'], $spawn['posY'], $area, $floor);
|
||||
|
||||
// cannot be placed, but we know the instanced map and can thus at least assign a zone
|
||||
if (!$points && !in_array($spawn['map'], [0, 1, 530, 571]) && $idx < 5)
|
||||
{
|
||||
@@ -197,7 +203,12 @@ SqlGen::register(new class extends SetupScript
|
||||
continue;
|
||||
}
|
||||
else // if areaId is set, area was determined by TC .. we're fine .. mostly
|
||||
{
|
||||
if (in_array($spawn['map'], [564, 580])) // Black Temple and Sunwell floor offset bullshit
|
||||
$points[0]['floor']++;
|
||||
|
||||
$final = $area ? $points[0] : $this->checkCoords($points);
|
||||
}
|
||||
|
||||
if ($idx < 5)
|
||||
{
|
||||
@@ -266,7 +277,7 @@ SqlGen::register(new class extends SetupScript
|
||||
for ($i = 0; $i < $data['nSeats']; $i++)
|
||||
DB::Aowow()->query('
|
||||
REPLACE INTO ?_spawns (`guid`, `type`, `typeId`, `respawn`, `spawnMask`, `phaseMask`, `areaId`, `floor`, `posX`, `posY`, `pathId`) VALUES
|
||||
(?d, ?d, ?d, 0, 0, 1, ?d, ?d, ?d, ?d, 0)', --$vGuid, TYPE_NPC, $data['typeId'], $v['areaId'], $v['floor'], $v['posX'], $v['posY']);
|
||||
(?d, ?d, ?d, 0, 0, 1, ?d, ?d, ?f, ?f, 0)', --$vGuid, TYPE_NPC, $data['typeId'], $v['areaId'], $v['floor'], $v['posX'], $v['posY']);
|
||||
|
||||
unset($accessories[$idx]);
|
||||
}
|
||||
|
||||
1
setup/updates/1590572038_01.sql
Normal file
1
setup/updates/1590572038_01.sql
Normal file
@@ -0,0 +1 @@
|
||||
UPDATE aowow_dbversion SET `sql` = CONCAT(IFNULL(`sql`, ''), ' spawns');
|
||||
Reference in New Issue
Block a user