Skip to content
Permalink
Browse files

Quest. 11479 scripted

- Add conditions to "Crow"leg Dan's gossip
- Event scripted
- Added kill a credit entry for "Crow"leg Dan.
- Updated Quest template to reflect the Kill credit NPC
  • Loading branch information...
Necrovoice committed May 13, 2019
1 parent 9cc072f commit 76b3bf45b0fedf3c6f43cd1994bf96eeb90cbd18
Showing with 133 additions and 0 deletions.
  1. +133 −0 World/Updates/Rel21/Rel21_10_061_q.11479_scripted.sql
@@ -0,0 +1,133 @@
-- --------------------------------------------------------------------------------
-- 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 = '10';
SET @cOldContent = '060';

-- New Values
SET @cNewVersion = '21';
SET @cNewStructure = '10';
SET @cNewContent = '061';
-- DESCRIPTION IS 30 Characters MAX
SET @cNewDescription = 'q.11479 scripted';

-- COMMENT is 150 Characters MAX
SET @cNewComment = 'q.11479 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 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -

SET @dbstring := (SELECT MAX(entry) FROM `db_script_string`);
SET @con_entry := (SELECT MAX(condition_entry) FROM `conditions`);

-- Add conditions to "Crow"leg Dan's gossip
-- Event scripted
-- Added kill a credit entry for "Crow"leg Dan.
-- Updated Quest template to reflect the Kill credit NPC

DELETE FROM `conditions` WHERE `type` = 9 AND `value1` = 11479;
INSERT INTO `conditions` VALUES
(@con_entry+1,9,11479,0,'Crowleg Dan gossip with quest');

INSERT INTO `db_script_string` (`entry`,`content_default`,`comment`) VALUES
(@dbstring+1,'Curse that frog! Yes, I joined the Southsea crew - you want to make something of it, mate? I\'ll cut you down here and now!', 'Crowleg script text.');


DELETE FROM `db_scripts` WHERE `id` = 9335;
INSERT INTO `db_scripts` (`script_type`, `id`, `delay`, `command`, `datalong`, `datalong2`, `buddy_entry`, `search_radius`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES
(2,9335,0,0,0,0,0,0,0,@dbstring+1,0,0,0,0,0,0,0,'Crowleg say'),
(2,9335,6,26,0,0,0,0,0,0,0,0,0,0,0,0,0,'Crowleg attack'),
(2,9335,7,29,1,2,0,0,0,0,0,0,0,0,0,0,0,'Crowleg NpcFlag change');

UPDATE `gossip_menu_option` SET `action_menu_id` = -1, `action_script_id` = 9335, `condition_id` = @con_entry+1 WHERE `menu_id` = 9335 and `id` = 0;

UPDATE `creature_template` SET `AIName` = 'EventAI' WHERE `Entry` = 24713;

INSERT INTO `creature_template` (`Entry`, `Name`, `SubName`, `IconName`, `MinLevel`, `MaxLevel`, `DifficultyEntry1`, `DifficultyEntry2`, `DifficultyEntry3`, `ModelId1`, `ModelId2`, `ModelId3`, `ModelId4`, `FactionAlliance`, `FactionHorde`, `Scale`, `Family`, `CreatureType`, `InhabitType`, `RegenerateStats`, `RacialLeader`, `NpcFlags`, `UnitFlags`, `DynamicFlags`, `ExtraFlags`, `CreatureTypeFlags`, `SpeedWalk`, `SpeedRun`, `UnitClass`, `Rank`, `Expansion`, `HealthMultiplier`, `PowerMultiplier`, `DamageMultiplier`, `DamageVariance`, `ArmorMultiplier`, `ExperienceMultiplier`, `MinLevelHealth`, `MaxLevelHealth`, `MinLevelMana`, `MaxLevelMana`, `MinMeleeDmg`, `MaxMeleeDmg`, `MinRangedDmg`, `MaxRangedDmg`, `Armor`, `MeleeAttackPower`, `RangedAttackPower`, `MeleeBaseAttackTime`, `RangedBaseAttackTime`, `DamageSchool`, `MinLootGold`, `MaxLootGold`, `LootId`, `PickpocketLootId`, `SkinningLootId`, `KillCredit1`, `KillCredit2`, `QuestItem1`, `QuestItem2`, `QuestItem3`, `QuestItem4`, `QuestItem5`, `QuestItem6`, `MechanicImmuneMask`, `ResistanceHoly`, `ResistanceFire`, `ResistanceNature`, `ResistanceFrost`, `ResistanceShadow`, `ResistanceArcane`, `PetSpellDataId`, `MovementType`, `MovementTemplateId`, `TrainerType`, `TrainerSpell`, `TrainerClass`, `TrainerRace`, `TrainerTemplateId`, `VendorTemplateId`, `EquipmentTemplateId`, `VehicleTemplateId`, `GossipMenuId`, `AIName`) VALUES
(@entry+1,'\"Crowleg\" Dan Kill credit','','',70,70,0,0,0,22505,0,0,0,1888,1888,1,0,7,3,3,0,1,32768,0,0,0,1,1.14286,1,0,-1,1,1,1,1,1,1,8982,8982,0,0,252,357,215,320,6719,304,44,2000,0,0,999,1665,24713,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,734,0,9335,'');

delete from `creature_ai_scripts` where `creature_id` = 24713;
insert into `creature_ai_scripts` (`creature_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_type`, `action1_param1`, `action1_param2`, `action1_param3`, `action2_type`, `action2_param1`, `action2_param2`, `action2_param3`, `action3_type`, `action3_param1`, `action3_param2`, `action3_param3`, `comment`) values(24713,6,0,100,0,0,0,0,0,33,@entry+1,1,0,0,0,0,0,0,0,0,0,'kill credit');

UPDATE `quest_template` SET `ReqCreatureOrGOId1` = @entry+1 WHERE `entry` = 11479;


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
-- -- 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`;


0 comments on commit 76b3bf4

Please sign in to comment.
You can’t perform that action at this time.