Vanilla database search for drops

If you want to avoid having to click through Alla multiple times to get all the information on a spawn and drops (like Edge warning it's a dodgy site on *every* bloody page transition) **and** you're relatively confident it's the vanilla PEQ configuration (Ixi hasn't amended it) you can do the following:

1. Install MariaDB
2. Install HeidiSQL (or your DB IDE of choice for MySQL)
3. Get the latest PEQ DB
4. Fire up Heidi and create a new DB
5. Import at least the create\_tables\_content.sql file (File > Run SQLfile)
6. Copy the SQL below and save it locally with a .sql extension

```
# Optional - Set the item name (full or partial) or leave blank ('') to see all items the NPC can drop
SET @itemName = '<example item>';

SELECT nt.id AS npcId,
 nt.name AS npcName,
 sg.id AS spawnGroupId,
 sg.name AS spawnGroupName,
 CONCAT(se.chance,'%') AS spawnEntryChance,
 IFNULL(sq\_placeHolders.phNames,'') AS placeHolderNames,
 CASE WHEN s2.enabled = 0 THEN 'No' ELSE 'Yes' END AS spawnEnabled,
 CONCAT(zo.long\_name,' (',zo.short\_name,')') AS spawnZone,
 SEC\_TO\_TIME(s2.respawntime) AS respawnTime,
 SEC\_TO\_TIME(s2.variance) AS respawnVariance,
 CAST(s2.x AS INT) AS spawnX,
 CAST(s2.y AS INT) AS spawnY,
 CAST(s2.z AS INT) AS spawnZ,
 lt.loottable\_id AS lootTableId,
 CONCAT('x',lt.multiplier) AS lootTableMultiplier,
 CONCAT(lt.probability,'%') AS lootTableProbability,
 ld.lootdrop\_id AS lootDropId,
 CONCAT('x',ld.multiplier) AS lootDropMultiplier,
 CONCAT(ld.chance,'%') AS lootDropChance,
 it.id AS itemId,
 it.name AS itemName
FROM npc\_types nt
INNER JOIN spawnentry se
 ON nt.id = se.npcid
INNER JOIN spawngroup sg
 ON se.spawngroupid = sg.id
INNER JOIN spawn2 s2
 ON se.spawngroupid = s2.spawngroupid
INNER JOIN zone zo
 ON s2.zone = zo.short\_name
INNER JOIN loottable\_entries lt
 ON nt.loottable\_id = lt.loottable\_id
INNER JOIN lootdrop\_entries ld
 ON lt.lootdrop\_id = ld.lootdrop\_id
INNER JOIN items it
 ON ld.item\_id = it.id
LEFT OUTER JOIN
 (
 SELECT e.spawngroupid, GROUP\_CONCAT(DISTINCT REPLACE(n.name,'\_',' ') SEPARATOR ', ') AS phNames
 FROM spawnentry e
 INNER JOIN npc\_types n
 ON e.npcid = n.id
 WHERE e.spawngroupid IN (
 SELECT sub\_se.spawngroupid
 FROM npc\_types sub\_nt
 LEFT OUTER JOIN spawnentry sub\_se
 ON sub\_nt.id = sub\_se.npcid
 WHERE REPLACE(sub\_nt.name,'\_',' ') LIKE CONCAT('%',@npcName,'%')
 )
 AND e.npcid NOT IN (
 SELECT sub2\_se.npcid
 FROM spawnentry sub2\_se
 INNER JOIN npc\_types sub\_nt2
 ON sub2\_se.npcid = sub\_nt2.id
 WHERE REPLACE(sub\_nt2.name,'\_',' ') LIKE CONCAT('%',@npcName,'%')
 )
 GROUP BY e.spawngroupid
 ) AS sq\_placeHolders
 ON sg.id = sq\_placeHolders.spawngroupid
WHERE
 REPLACE(nt.name,'\_',' ') LIKE CONCAT('%',@npcName,'%')
 AND
 it.name LIKE CONCAT('%',@itemName,'%')
ORDER BY nt.id ASC, sg.id ASC, lt.loottable\_id ASC, ld.lootdrop\_id ASC, it.id ASC

```

Open this file in Heidi and complete the npc name and optionally, the item variable.

This will list all relevant data in on singular row.

For example if we're after the Robe of the Giant Panda from Giang Ying we'd put 'giang' as the @npcName variable and 'robe' for the @itemName variable and run the script. I'll transpose the output so it's easier to read vertically:

We can see in one row the spawn chance, all possible placeholders, respawn time and variance, spawn location, drop rate and probability.

Leave the item name blank to see all possible drops (one row per drop).

If multiple spawn groups exist for the NPC then you'll get multiple rows per spawn group and further multiplication by item drop.

The script is not well optimised, this was just me figuring out the PEQ schema. If you are too vague in the variables it will chug along for ages churning up your CPU and memory, just a quick sanity check up one-stop check of all the relevant info if you're camping a specific item.

That is, unless Ixi has customised it for this server, then you're SOL :)