Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scourging Crystals can now be destroyed, allowing for the quest "Bring Down Those Shields" to be completed.
- Loading branch information
1 parent
6ab9586
commit b8494eb
Showing
1 changed file
with
103 additions
and
0 deletions.
There are no files selected for viewing
103 changes: 103 additions & 0 deletions
103
World/Updates/Rel21/Rel21_11_020_NPC_24464_scripted.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
-- -------------------------------------------------------------------------------- | ||
-- This is an attempt to create a full transactional MaNGOS update (v1.4) | ||
-- -------------------------------------------------------------------------------- | ||
DROP PROCEDURE IF EXISTS `update_mangos`; | ||
|
||
DELIMITER $$ | ||
|
||
CREATE DEFINER=`root`@`localhost` PROCEDURE `update_mangos`() | ||
BEGIN | ||
DECLARE bRollback BOOL DEFAULT FALSE ; | ||
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET `bRollback` = TRUE; | ||
|
||
-- Current Values (TODO - must be a better way to do this) | ||
SET @cCurVersion := (SELECT `version` FROM db_version ORDER BY `version` DESC, STRUCTURE DESC, CONTENT DESC LIMIT 0,1); | ||
SET @cCurStructure := (SELECT structure FROM db_version ORDER BY `version` DESC, STRUCTURE DESC, CONTENT DESC LIMIT 0,1); | ||
SET @cCurContent := (SELECT content FROM db_version ORDER BY `version` DESC, STRUCTURE DESC, CONTENT DESC LIMIT 0,1); | ||
|
||
-- Expected Values | ||
SET @cOldVersion = '21'; | ||
SET @cOldStructure = '11'; | ||
SET @cOldContent = '019'; | ||
|
||
-- New Values | ||
SET @cNewVersion = '21'; | ||
SET @cNewStructure = '11'; | ||
SET @cNewContent = '020'; | ||
-- DESCRIPTION IS 30 Characters MAX | ||
SET @cNewDescription = 'NPC 24464 scripted'; | ||
|
||
-- COMMENT is 150 Characters MAX | ||
SET @cNewComment = 'NPC 24464 scripted'; | ||
|
||
-- Evaluate all settings | ||
SET @cCurResult := (SELECT description FROM db_version ORDER BY `version` DESC, STRUCTURE DESC, CONTENT DESC LIMIT 0,1); | ||
SET @cOldResult := (SELECT description FROM db_version WHERE `version`=@cOldVersion AND `structure`=@cOldStructure AND `content`=@cOldContent); | ||
SET @cNewResult := (SELECT description FROM db_version WHERE `version`=@cNewVersion AND `structure`=@cNewStructure AND `content`=@cNewContent); | ||
|
||
IF (@cCurResult = @cOldResult) THEN -- Does the current version match the expected version | ||
-- APPLY UPDATE | ||
START TRANSACTION; | ||
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - | ||
-- -- PLACE UPDATE SQL BELOW -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | ||
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - | ||
|
||
UPDATE `creature_template` SET `AIName` = 'EventAI' WHERE `Entry` = 24464; | ||
DELETE FROM `creature_ai_scripts` WHERE `creature_id` = 24464; | ||
INSERT INTO `creature_ai_scripts` (`id`, `creature_id`, `event_type`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_type`, `action1_param1`, `comment`) VALUES ('2446401', '24464', '27', '43874', '1', '700', '1500', '19', '256', 'Remove non target flag on debuff'); | ||
|
||
|
||
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - | ||
-- -- PLACE UPDATE SQL ABOVE -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | ||
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - | ||
|
||
-- If we get here ok, commit the changes | ||
IF bRollback = TRUE THEN | ||
ROLLBACK; | ||
SHOW ERRORS; | ||
SELECT '* UPDATE FAILED *' AS `===== Status =====`,@cCurResult AS `===== DB is on Version: =====`; | ||
ELSE | ||
COMMIT; | ||
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - | ||
-- UPDATE THE DB VERSION | ||
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - | ||
INSERT INTO `db_version` VALUES (@cNewVersion, @cNewStructure, @cNewContent, @cNewDescription, @cNewComment); | ||
SET @cNewResult := (SELECT description FROM db_version WHERE `version`=@cNewVersion AND `structure`=@cNewStructure AND `content`=@cNewContent); | ||
|
||
SELECT '* UPDATE COMPLETE *' AS `===== Status =====`,@cNewResult AS `===== DB is now on Version =====`; | ||
END IF; | ||
ELSE -- Current version is not the expected version | ||
IF (@cCurResult = @cNewResult) THEN -- Does the current version match the new version | ||
SELECT '* UPDATE SKIPPED *' AS `===== Status =====`,@cCurResult AS `===== DB is already on Version =====`; | ||
ELSE -- Current version is not one related to this update | ||
IF(@cCurResult IS NULL) THEN -- Something has gone wrong | ||
SELECT '* UPDATE FAILED *' AS `===== Status =====`,'Unable to locate DB Version Information' AS `============= Error Message =============`; | ||
ELSE | ||
IF(@cOldResult IS NULL) THEN -- Something has gone wrong | ||
SET @cCurVersion := (SELECT `version` FROM db_version ORDER BY `version` DESC, STRUCTURE DESC, CONTENT DESC LIMIT 0,1); | ||
SET @cCurStructure := (SELECT `STRUCTURE` FROM db_version ORDER BY `version` DESC, STRUCTURE DESC, CONTENT DESC LIMIT 0,1); | ||
SET @cCurContent := (SELECT `Content` FROM db_version ORDER BY `version` DESC, STRUCTURE DESC, CONTENT DESC LIMIT 0,1); | ||
SET @cCurOutput = CONCAT(@cCurVersion, '_', @cCurStructure, '_', @cCurContent, ' - ',@cCurResult); | ||
SET @cOldResult = CONCAT('Rel',@cOldVersion, '_', @cOldStructure, '_', @cOldContent, ' - ','IS NOT APPLIED'); | ||
SELECT '* UPDATE SKIPPED *' AS `===== Status =====`,@cOldResult AS `=== Expected ===`,@cCurOutput AS `===== Found Version =====`; | ||
ELSE | ||
SET @cCurVersion := (SELECT `version` FROM db_version ORDER BY `version` DESC, STRUCTURE DESC, CONTENT DESC LIMIT 0,1); | ||
SET @cCurStructure := (SELECT `STRUCTURE` FROM db_version ORDER BY `version` DESC, STRUCTURE DESC, CONTENT DESC LIMIT 0,1); | ||
SET @cCurContent := (SELECT `Content` FROM db_version ORDER BY `version` DESC, STRUCTURE DESC, CONTENT DESC LIMIT 0,1); | ||
SET @cCurOutput = CONCAT(@cCurVersion, '_', @cCurStructure, '_', @cCurContent, ' - ',@cCurResult); | ||
SELECT '* UPDATE SKIPPED *' AS `===== Status =====`,@cOldResult AS `=== Expected ===`,@cCurOutput AS `===== Found Version =====`; | ||
END IF; | ||
END IF; | ||
END IF; | ||
END IF; | ||
END $$ | ||
|
||
DELIMITER ; | ||
|
||
-- Execute the procedure | ||
CALL update_mangos(); | ||
|
||
-- Drop the procedure | ||
DROP PROCEDURE IF EXISTS `update_mangos`; | ||
|
||
|