Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE
- DEFINER = `kalethuzad`@`%` PROCEDURE `updaterandomenchantment`(spell_id INT, with_returns INT)
- BEGIN
- DECLARE HasRandomTier INT DEFAULT 0;
- DECLARE HasSpellItemEnchantment INT DEFAULT 0;
- DECLARE EnchID INT DEFAULT spell_id;
- # Create Random Tier
- SET HasRandomTier = (SELECT COUNT(*) FROM item_enchantment_random_tiers WHERE spellid = spell_id);
- IF (HasRandomTier = 0) THEN
- INSERT INTO item_enchantment_random_tiers
- SELECT spell_id,
- 1,
- 'ANY',
- NULL,
- spell_id,
- SpellName0,
- 0,
- 100,
- 0
- FROM spell
- WHERE ID = spell_id;
- END IF;
- SET EnchID = (SELECT enchantID FROM item_enchantment_random_tiers WHERE spellid = spell_id);
- # Create Spell Item Enchantment
- SET HasSpellItemEnchantment = (SELECT COUNT(*) FROM dbc_spell_item_enchantment WHERE EffectArg_1 = EnchID);
- IF (HasSpellItemEnchantment = 0) THEN
- INSERT INTO `dbc_spell_item_enchantment`
- VALUES (EnchID, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, spell_id, 0, 0, '', '', '', '', '', '', '', '', '', '', '', '',
- '', '', '', '', 16712190, 0, 0, 0, 0, 0, 0, 0, 0);
- END IF;
- # Update Spell Item Enchantment
- UPDATE dbc_spell_item_enchantment sie
- INNER JOIN spell s ON s.ID = spell_id
- SET sie.Name_Lang_enUS = CONCAT('Equip: ', SpellName0, ' - ', REPLACE(
- REPLACE(REPLACE(SpellDescription0, '$s1', EffectBasePoints1 + 1), '$s2', EffectBasePoints2 + 1), '$s3',
- EffectBasePoints3 + 1)),
- sie.Name_Lang_enGB = sie.Name_Lang_enUS,
- sie.Name_Lang_koKR = sie.Name_Lang_enUS,
- sie.Name_Lang_frFR = sie.Name_Lang_enUS,
- sie.Name_Lang_deDE = sie.Name_Lang_enUS,
- sie.Name_Lang_enCN = sie.Name_Lang_enUS,
- sie.Name_Lang_zhCN = sie.Name_Lang_enUS,
- sie.Name_Lang_enTW = sie.Name_Lang_enUS,
- sie.Name_Lang_zhTW = sie.Name_Lang_enUS,
- sie.Name_Lang_esES = sie.Name_Lang_enUS,
- sie.Name_Lang_esMX = sie.Name_Lang_enUS,
- sie.Name_Lang_ruRU = sie.Name_Lang_enUS,
- sie.Name_Lang_ptPT = sie.Name_Lang_enUS,
- sie.Name_Lang_ptBR = sie.Name_Lang_enUS,
- sie.Name_Lang_itIT = sie.Name_Lang_enUS
- WHERE sie.ID = EnchID;
- # Select Data
- IF (with_returns = 1) THEN
- SELECT * FROM item_enchantment_random_tiers WHERE enchantID = EnchID;
- SELECT * FROM dbc_spell_item_enchantment WHERE ID = EnchID;
- SELECT spell_id, HasRandomTier, HasSpellItemEnchantment, EnchID;
- END IF;
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement