· 5 years ago · Jun 14, 2020, 02:06 PM
1-- Run this once before working
2SET @refCounter = (SELECT MAX(entry) FROM reference_loot_template) + 1;
3
4
5-- Step 1, set the config and run it
6SET @creatureTemplateEntry = 31507;
7-- Config done
8SELECT * FROM creature_loot_template WHERE entry = (SELECT lootid FROM creature_template WHERE entry = @creatureTemplateEntry)
9
10
11-- Step 2, take the Entry column from results from Step 1 and identify which groupId from step 1 has the loot we wanna increase. Set the config and run it
12SET @creatureLootTemplateEntry = 31507;
13SET @creatureLootTemplateGroupId = 1;
14-- Config done
15SET @referenceEntry = @refCounter;
16SET @refCounter = @refCounter + 1;
17DROP TABLE IF EXISTS temp_table;
18CREATE TABLE temp_table (sql_statement VARCHAR(1024) NOT NULL) ENGINE = INNODB DEFAULT CHARSET = utf8;
19INSERT INTO temp_table VALUES (CONCAT("DELETE FROM reference_loot_template WHERE Entry = ", @referenceEntry, ";"));
20INSERT INTO temp_table SELECT CONCAT("INSERT INTO reference_loot_template VALUES(",
21 @referenceEntry, ", ", creature_loot_template.Item, ", 0, 0, 0, 1, 1, 1, 1, 'DungeonBossLootIncrease');")
22 FROM creature_loot_template WHERE creature_loot_template.Entry = @creatureLootTemplateEntry AND creature_loot_template.GroupId = @creatureLootTemplateGroupId;
23INSERT INTO temp_table VALUES (CONCAT("DELETE FROM creature_loot_template WHERE Entry = ", @creatureLootTemplateEntry, " AND GroupId = ", @creatureLootTemplateGroupId, ";"));
24INSERT INTO temp_table VALUES (CONCAT("DELETE FROM creature_loot_template WHERE Entry = ", @creatureLootTemplateEntry, " AND Reference = ", @referenceEntry, ";"));
25INSERT INTO temp_table VALUES (CONCAT("INSERT INTO creature_loot_template VALUES(", @creatureLootTemplateEntry, ", ", @referenceEntry, ", ", @referenceEntry, ", 100, 0, 1, 0, 1, @dungeonBossDropRate, 'DungeonBossLootIncrease');"));
26SET @sqlStatement = (SELECT GROUP_CONCAT(sql_statement SEPARATOR "\n") FROM temp_table);
27SELECT @sqlStatement;