To activate this a GM must drop an item of "Gods Favor" (ID 1062) onto the ground into a new dropped items bag. That tunnel will then get filled in on the next server restart.
- Code: Select all
CREATE DEFINER=`root`@`localhost` PROCEDURE `p_deleteTunnel`(IN `geoDataID` INT, IN `altitude` INT)
LANGUAGE SQL
NOT DETERMINISTIC
MODIFIES SQL DATA
SQL SECURITY DEFINER
COMMENT 'Experimental procedure to undo tunnels in terrain'
BEGIN
IF true THEN
UPDATE geo_patch gp SET gp.IsServerOnly = 1 WHERE gp.GeoDataID = geoDataID AND gp.IsServerOnly = 0;
SET @terID = 0;
SET @newAltitude = 0;
SELECT gp.TerID, gp.Altitude FROM geo_patch gp WHERE gp.GeoDataID = geoDataID AND ChangeIndex = 1 GROUP BY Altitude LIMIT 1 INTO @terID, @newAltitude;
IF altitude > 0 THEN
SET @newAltitude = altitude;
END IF;
SET @result = f_addGeoPatch(1, 0, @terID, 1, geoDataID, @newAltitude, 3, 128, 60000, 42);
END IF;
END
CREATE DEFINER=`root`@`localhost` TRIGGER `t_adminUndoTunnel` AFTER UPDATE ON `items` FOR EACH ROW BEGIN
IF NEW.ObjectTypeID = 1062 THEN
SET @ownerID = (SELECT OwnerID FROM movable_objects mo JOIN containers con ON con.ID = mo.RootContainerID WHERE con.ID = NEW.ContainerID);
SET @location = (SELECT GeoID FROM `character` WHERE ID = @ownerID);
SET @altitude = (SELECT GeoAlt FROM `character` WHERE ID = @ownerID);
SET @tunnelCount = (SELECT COUNT(*) FROM geo_patch gp WHERE gp.GeoDataID = @location AND gp.Substance = 0 AND gp.LevelFlags & 1 = 0);
IF @tunnelCount > 0 THEN
CALL p_deleteTunnel(@location, 0);
END IF;
END IF;
END
Known Issues:
- Server restart is required
- Terraforming will not work at all until server restart is completed