Advertisement
nerfstuff123

Untitled

Nov 10th, 2021
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. CREATE
  2. DEFINER = `kalethuzad`@`%` PROCEDURE `updaterandomenchantment`(spell_id INT, with_returns INT)
  3. BEGIN
  4.  
  5. DECLARE HasRandomTier INT DEFAULT 0;
  6. DECLARE HasSpellItemEnchantment INT DEFAULT 0;
  7. DECLARE EnchID INT DEFAULT spell_id;
  8.  
  9. # Create Random Tier
  10. SET HasRandomTier = (SELECT COUNT(*) FROM item_enchantment_random_tiers WHERE spellid = spell_id);
  11. IF (HasRandomTier = 0) THEN
  12. INSERT INTO item_enchantment_random_tiers
  13. SELECT spell_id,
  14. 1,
  15. 'ANY',
  16. NULL,
  17. spell_id,
  18. SpellName0,
  19. 0,
  20. 100,
  21. 0
  22. FROM spell
  23. WHERE ID = spell_id;
  24. END IF;
  25. SET EnchID = (SELECT enchantID FROM item_enchantment_random_tiers WHERE spellid = spell_id);
  26.  
  27. # Create Spell Item Enchantment
  28. SET HasSpellItemEnchantment = (SELECT COUNT(*) FROM dbc_spell_item_enchantment WHERE EffectArg_1 = EnchID);
  29. IF (HasSpellItemEnchantment = 0) THEN
  30. INSERT INTO `dbc_spell_item_enchantment`
  31. VALUES (EnchID, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, spell_id, 0, 0, '', '', '', '', '', '', '', '', '', '', '', '',
  32. '', '', '', '', 16712190, 0, 0, 0, 0, 0, 0, 0, 0);
  33. END IF;
  34.  
  35. # Update Spell Item Enchantment
  36. UPDATE dbc_spell_item_enchantment sie
  37. INNER JOIN spell s ON s.ID = spell_id
  38. SET sie.Name_Lang_enUS = CONCAT('Equip: ', SpellName0, ' - ', REPLACE(
  39. REPLACE(REPLACE(SpellDescription0, '$s1', EffectBasePoints1 + 1), '$s2', EffectBasePoints2 + 1), '$s3',
  40. EffectBasePoints3 + 1)),
  41. sie.Name_Lang_enGB = sie.Name_Lang_enUS,
  42. sie.Name_Lang_koKR = sie.Name_Lang_enUS,
  43. sie.Name_Lang_frFR = sie.Name_Lang_enUS,
  44. sie.Name_Lang_deDE = sie.Name_Lang_enUS,
  45. sie.Name_Lang_enCN = sie.Name_Lang_enUS,
  46. sie.Name_Lang_zhCN = sie.Name_Lang_enUS,
  47. sie.Name_Lang_enTW = sie.Name_Lang_enUS,
  48. sie.Name_Lang_zhTW = sie.Name_Lang_enUS,
  49. sie.Name_Lang_esES = sie.Name_Lang_enUS,
  50. sie.Name_Lang_esMX = sie.Name_Lang_enUS,
  51. sie.Name_Lang_ruRU = sie.Name_Lang_enUS,
  52. sie.Name_Lang_ptPT = sie.Name_Lang_enUS,
  53. sie.Name_Lang_ptBR = sie.Name_Lang_enUS,
  54. sie.Name_Lang_itIT = sie.Name_Lang_enUS
  55. WHERE sie.ID = EnchID;
  56.  
  57. # Select Data
  58. IF (with_returns = 1) THEN
  59. SELECT * FROM item_enchantment_random_tiers WHERE enchantID = EnchID;
  60. SELECT * FROM dbc_spell_item_enchantment WHERE ID = EnchID;
  61. SELECT spell_id, HasRandomTier, HasSpellItemEnchantment, EnchID;
  62. END IF;
  63. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement