[Python] creature_loot_template sql builder #31339
Replies: 8 comments 34 replies
-
|
Update: Script updated, it now parses proper data using WH.Gatherer.addData(1, 1, { -- NPC Data 3,1, case -- there are usually 2 on wowhead and the first one throws incorrect item data, no idea why "Warglaive of Azinoth" exists under hoggers data to begin with? lol it also properly parses array data (3 or more npc ID's in the cli) now, makes it super easy to look up dungeon NPC's on wowhead and filter the hostility to hostile A H, copy the array of ID's wowhead provides, replace the , with a blank space and paste the array into your cli then let it roll with a custom filename Example array usage for stockades: Output: |
Beta Was this translation helpful? Give feedback.
-
|
Update: Script now parses Item data for each NPC, it currently only utilizes the drop rates but can be expanded. it grabs the accurate rates for each drop an npc has, converts them to decimal and rounds them up or down (wasnt sure if decimal entries were accepted in the db), adds the rate to Chance. Also builds It is working pretty good thus far imo im solely testing on deadmines entries and its putting loot on all the creatures, etc. We can probably turn this into a full database building automation system if we work it out properly, complete with NPC's, Spells, Items, etc. as well as all the data needed for each. Output (Creature ID 2): @Naddley This is something I think everyone should see. kind of revolutionary lol |
Beta Was this translation helpful? Give feedback.
-
|
Update: Parsed a 1.7Gb file of all NPC loot data, has some duplicates but not a big deal, script can be tweaked for that. This is All NPC ID's from 1 to 255,xxx (even the 12.0 beta ID's) that HAVE drops listed in the drops section on wowhead, all information is verified via their json data on each npc/item page. TODO:: |
Beta Was this translation helpful? Give feedback.
-
|
You should change the REPLACE INTO to a DELETE + INSERT query to fit TC sql standards. if you look at my Loot commits, thats how the querys are generated with the Tool I use. |
Beta Was this translation helpful? Give feedback.
-
|
If I can read your screenshots right, then this one looks better yes. |
Beta Was this translation helpful? Give feedback.
-
|
@Naddley The loot seems (so far) pretty blizz-like, the script groups items by quality (1-15, though there may not be 15 different quality types, added extra to be safe) and links each creature to each item in creature_loot_template. When NPC's get scraped using this, it adds the NPC and the corresponding Entry to the item (from reference) for each item thus linking all of their loot properly. I am on a 6 core 16Gb VPS running this, the script ETA is 9-24 hours (it fluctuates depending on how many NPC's/Items its scraping + how many fail) failed NPC's get added to failed.log and get retried at the end of the scraping cycle, ensuring it didnt just accidentally miss any lootable NPC's, just as well it does a retry during the process, too.
When an NPC is added, if the item Id already exists in reference_loot, it automatically links the new NPC to that drop item if that item is part of that NPC's drop loot and if the item doesn't exist, it give it a new entry ID (never duplicates them) and adds the item, then links to the npc. This also automatically calculates chance based on quality from 1-15 (1-6, the rest are low chance rates if applicable) I went against using the chance rates on wowhead (though they are in there if its something someone wants to use, don't recommend it because a lot of chance rates are 0) Scraper (Python3, ensure you install the dependencies it needs): SHOULD work on Windows/Linux alike |
Beta Was this translation helpful? Give feedback.
-
|
@Naddley Can you give me some tips on how/where i could locate all the proper data for inserting data to the creatures table? I noticed your latest few PR's had to do with world sql im just wondering how you obtained the data for the NPC's. |
Beta Was this translation helpful? Give feedback.
-
|
@Naddley @mdX7 |
Beta Was this translation helpful? Give feedback.









Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
mentioned in #31337
Scraper (Python3, ensure you install the dependencies it needs): SHOULD work on Windows/Linux alike
npc_drops_scraper(final).py
(Updated 10/9/25 2:40AM EST)
Description
Using wowhead, i was able to create a scraper of sorts that can iterate through all, 1 or a custom range of NPC ID's which grabs all the loot that NPC may have and outputs directly to your existing TrinityCore world database. Not sure why anyone has not done this yet, but this can be expanded for Items, NPC's, Loot, Quests and whatever else TrinityCore is missing or may need for 11.2.0.63305 and beyond. Since this scraper uses wowhead, it likely also includes the 12.0 beta NPC's and loot as well.
THIS DOES NOT ADD NPC'S THEMSELVES -- ONLY NPC LOOT DATA
I believe I have finished this script if you'd like to try it out. It DOES NOT handle the QuestRequired field at all (this is being left to the quest scraper script I am going to finish working on which will update the items accordingly)
The loot seems (so far) pretty blizz-like, the script groups items by quality (1-15, though there may not be 15 different quality types, added extra to be safe) and links each creature to each item in creature_loot_template. When NPC's get scraped using this, it adds the NPC and the corresponding Entry to the item (from reference) for each item thus linking all of their loot properly.
I am on a 6 core 16Gb VPS running this, the script ETA is 9-24 hours (it fluctuates depending on how many NPC's/Items its scraping + how many fail)
failed NPC's get added to failed.log and get retried at the end of the scraping cycle, ensuring it didnt just accidentally miss any lootable NPC's, just as well it does a retry during the process, too.
When an NPC is added, if the item Id already exists in reference_loot, it automatically links the new NPC to that drop item if that item is part of that NPC's drop loot and if the item doesn't exist, it give it a new entry ID (never duplicates them) and adds the item, then links to the npc. This also automatically calculates chance based on quality from 1-15 (1-6, the rest are low chance rates if applicable) I went against using the chance rates on wowhead (though they are in there if its something someone wants to use, don't recommend it because a lot of chance rates are 0)
Also updates the creature_template_difficulty table to link every existing creature to their appropriate LootID's
Beta Was this translation helpful? Give feedback.
All reactions