EQEMU Database

From EQArchives
Revision as of 14:35, 10 May 2023 by Nazwahdi (talk | contribs) (Created page with "This page is intended to provide information regarding Database Administration for an EQEMU Database. ==SQL Snippets== === Disable merchantlist entries by item === <pre> UPDATE `merchantlist` SET probability = 0 WHERE item = 38399 </pre> === Get all loottable entry fields for all npc_types with enabled spawns === <pre> SELECT lte.loottable_id, lte.lootdrop_id, lte.multiplier, lte.droplimit, lte.mindrop, lte.probability, n.name, lt.name FROM loottable_entries AS lte INN...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This page is intended to provide information regarding Database Administration for an EQEMU Database.

SQL Snippets

Disable merchantlist entries by item

UPDATE `merchantlist`
SET probability = 0
WHERE item = 38399

Get all loottable entry fields for all npc_types with enabled spawns

SELECT lte.loottable_id, lte.lootdrop_id, lte.multiplier, lte.droplimit, lte.mindrop, lte.probability, n.name, lt.name
FROM loottable_entries AS lte
INNER JOIN loottable AS lt
ON lt.id = lte.loottable_id
INNER JOIN npc_types AS n
ON lte.loottable_id = n.loottable_id
INNER JOIN spawnentry AS se
ON n.id = se.npcID
INNER JOIN spawn2 AS s
on se.spawngroupID = s.spawngroupID
INNER JOIN zone AS z
ON s.zone = z.short_name
WHERE z.short_name = "ecommons" AND n.loottable_id > 0

Check where tradeskills are at

SELECT cs.id, cd.name, cs.skill_id, cs.value
FROM character_skills AS cs
INNER JOIN character_data AS cd ON cs.id = cd.id
INNER JOIN account AS a ON cd.account_id = a.id
WHERE a.status = 0
AND (cs.skill_id = 60 -- 60 - Baking
OR cs.skill_id = 61 -- 61 - Tailoring
OR cs.skill_id = 63 -- 63 - Blacksmithing
OR cs.skill_id = 64 -- 64 - Fletching
OR cs.skill_id = 65 -- 65 - Brewing
OR cs.skill_id = 68 -- 68 - Jewelry Making
OR cs.skill_id = 69) -- 69 - Pottery
ORDER BY 4 DESC

Inventory by Item Name (partial)

SELECT
    cd.name AS "Player",
    inv.itemid AS "Item ID",
    i.Name AS "Item Name",
    inv.charges AS "Stacked",
    COUNT(*) AS "Count"
FROM character_data AS cd
INNER JOIN inventory AS inv
ON inv.charid = cd.id
INNER JOIN items AS i
ON inv.itemid = i.id
WHERE i.Name LIKE "%item name%"
GROUP BY cd.name
ORDER BY 5 DESC

Drop chance of item by item ID

SELECT ld.item_id, i.name, s.zone, npc.name, lte.mindrop, lte.droplimit, ld.chance
FROM lootdrop_entries AS ld
INNER JOIN items AS i
ON ld.item_id = i.id
INNER JOIN loottable_entries AS lte
ON ld.lootdrop_id = lte.lootdrop_id
INNER JOIN npc_types AS npc
ON lte.loottable_id = npc.loottable_id
INNER JOIN spawnentry AS se
ON npc.id = se.npcID
INNER JOIN spawn2 AS s
ON se.spawngroupID = s.spawngroupID
INNER JOIN zone AS z
ON s.zone = z.short_name
WHERE s.enabled = "1" AND i.id = "intid" AND z.min_status < "1"
ORDER BY 7 DESC

List who killed a mob

SELECT cd.name, kre.event_id, kr.fight_id, npc.name
FROM character_data AS cd
INNER JOIN qs_player_npc_kill_record_entries AS kre
ON kre.char_id = cd.id
INNER JOIN qs_player_npc_kill_record AS kr
ON kre.event_id = kr.fight_id
INNER JOIN npc_types AS npc
ON kr.npc_id = npc.id
WHERE cd.name = "stringname"