Last active
August 29, 2015 14:01
-
-
Save mackal/be454f65f30e40db8506 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# vim:fenc=utf-8 | |
# | |
# Copyright © 2014 Michael Cook <mcook@mackal.net> | |
# | |
""" | |
Processes an eqlog file and generates SQL to update factions | |
Should work with a full log, but cleaning up the log will be quicker | |
The file needs at least the zone enter messages, faction messages, | |
and slain messages in their full to work | |
IMPORTANT: faction messages from non-kills should be filtered out ... | |
File prep: | |
I just did a $ grep 'faction\\|slain\\|entered' on the log file | |
to clean up the log for processing | |
""" | |
import re, sys, os | |
import collections | |
# str to str so we don't have to worry about string cat | |
factiontable = { | |
"Agents of Dreadspire": "396", | |
"Agents of Mistmoore": "1", | |
"Agnarr": "2", | |
"Ak'Anon Strike Force V": "497", | |
"Akheva": "3", | |
"Allize Taeew": "4", | |
"Allize Volew": "5", | |
"Ancestors of the Crypt": "499", | |
"Ancestors of Valdeholm": "498", | |
"Anchorites of Brell Serilis": "6", | |
"Ancient Cyclops": "481", | |
"Ankhefenmut": "397", | |
"Anti-mage": "8", | |
"Antonius Bayle": "9", | |
"Arboreans of Faydark": "10", | |
"Arcane Scientists": "11", | |
"Army of Light": "494", | |
"Ashen Order": "12", | |
"Askr the Lost": "13", | |
"Aviak": "14", | |
"Banker": "15", | |
"Battalion of Marr": "16", | |
"Beetle": "457", | |
"Befallen Inhabitants": "17", | |
"Bertoxxulous": "382", | |
"Beta Neutral": "18", | |
"Betrayers of Di`Zok": "19", | |
"Bloodgills": "20", | |
"Bloodsabers": "21", | |
"Broken Skull Clan": "22", | |
"Brood of Di`Zok": "23", | |
"Brood of Kotiz": "24", | |
"Brood of Ssraeshza": "25", | |
"Brownie": "26", | |
"Burning Dead": "27", | |
"Burynai Legion": "28", | |
"Butcherblock Bandits": "29", | |
"Cabilis Residents": "30", | |
"Carson McCabe": "31", | |
"Cazic Thule": "368", | |
"Chetari": "32", | |
"Children of Dranik": "398", | |
"Circle of Unseen Hands": "33", | |
"Citizens of Froststone": "399", | |
"Citizens of Gukta": "35", | |
"Citizens of Qeynos": "36", | |
"Citizens of Seru": "37", | |
"Citizens of Sharvahl": "483", | |
"Citizens of Takish-Hiz": "38", | |
"Clan Grikbar": "39", | |
"Clan Kolbok": "40", | |
"Clan RunnyEye": "41", | |
"Class 41": "377", | |
"Claws of Veeshan": "42", | |
"Cleaving Tooth Clan": "383", | |
"Clerics of Tunare": "43", | |
"Clerics of Underfoot": "44", | |
"Clockwork Gnome": "45", | |
"Clurg": "46", | |
"Coalition of Trade Folk": "47", | |
"Coalition of TradeFolk III": "369", | |
"Coalition of Tradefolk Underground": "48", | |
"Coldain": "49", | |
"Combine Empire": "50", | |
"Commons Residents": "51", | |
"Concillium Universus": "52", | |
"Corrupt Qeynos Guards": "53", | |
"Coterie Elite": "54", | |
"Coterie of the Eternal Night": "55", | |
"Craftkeepers": "56", | |
"Craknek Warriors": "57", | |
"Creatures of Darkhollow": "400", | |
"Creatures of Gloomingdeep": "401", | |
"Creatures of Justice": "58", | |
"Creatures of Taelosia": "59", | |
"Creep Reapers": "402", | |
"Crescent Guards": "493", | |
"Crimson Hands": "60", | |
"Critters of Jaggedpine": "61", | |
"Crusaders of Greenmist": "62", | |
"Crushbone Orcs": "63", | |
"Crystal Caverns Terrors/Spiders/Crawlers": "395", | |
"Cult of the Arisen": "64", | |
"Cult of the Great Saprophyte": "65", | |
"Cursed Drakes": "403", | |
"Da Bashers": "66", | |
"Dain Frostreaver IV": "67", | |
"Dar Khura": "68", | |
"Dark Bargainers": "69", | |
"Dark Ones": "70", | |
"Dark Reflection": "71", | |
"Dark Reign": "404", | |
"Dark Sendings": "72", | |
"Darkpaws of Jaggedpine": "73", | |
"Dawnhoppers": "74", | |
"Death Fist Orcs": "405", | |
"Deathfist Orcs": "75", | |
"Deep Muses": "76", | |
"Deep Sporali": "406", | |
"Deeppockets": "77", | |
"Deepshade Collective": "78", | |
"Deepwater Knights": "79", | |
"Defective Clockwork": "80", | |
"Defenders of the Broodlands": "407", | |
"Defenders of the Haven": "81", | |
"Deklean Korgad": "408", | |
"Denizens of Discord": "409", | |
"Denizens of Fear": "82", | |
"Denizens of Mischief": "391", | |
"Dervish Cutthroats": "83", | |
"Disciples of Kerafyrm": "84", | |
"Disciples of Rhag`Zadune": "85", | |
"Dismal Rage": "86", | |
"Dranik Loyalists": "410", | |
"Dreadguard Inner": "87", | |
"Dreadguard Outer": "88", | |
"Drusella Sathir": "89", | |
"Dulaks Clan": "459", | |
"Ebon Mask": "90", | |
"Eldritch Collective": "91", | |
"Elementals": "374", | |
"Emerald Warriors": "92", | |
"Emperor Ssraeshza": "93", | |
"Erudite Citizen": "380", | |
"Evil Eye": "94", | |
"Exiled Frogloks": "95", | |
"Expedition 328": "411", | |
"Eye of Seru": "96", | |
"Faerie": "97", | |
"Fallen Guard of Illsalin": "412", | |
"Fallen of Bloody Kithicor": "98", | |
"Faydark's Champions": "99", | |
"FelGuard": "100", | |
"Firiona Vie": "101", | |
"Fizzlethorp": "414", | |
"Fizzlethorpe": "102", | |
"Followers of Korucust": "103", | |
"Forgotten Guktan Spirits": "104", | |
"Free Traders of Malgrinnor": "415", | |
"Freeport Militia": "105", | |
"Frogloks of Guk": "106", | |
"Frogloks of Krup": "107", | |
"Frogloks of Kunark": "108", | |
"Frogloks of Sebilis": "109", | |
"Frostfoot Goblins": "110", | |
"Fungus Man": "111", | |
"Gate Callers": "112", | |
"Gate Keepers": "113", | |
"Gelistial": "114", | |
"Gem Choppers": "115", | |
"Geonid Collective": "116", | |
"Ghouls of Neriak": "117", | |
"Giant Spider": "386", | |
"Gladiators of Mata Muram": "416", | |
"Goblin": "118", | |
"Goblins of Cleaving Tooth": "119", | |
"Goblins of Fire Peak": "120", | |
"Goblins of Mountain Death": "121", | |
"Gor Taku": "122", | |
"Gralloks": "123", | |
"Greater Brann Giants": "124", | |
"Greater Jord Giants": "125", | |
"Greater Vann Giants": "126", | |
"Greater Vind Giants": "127", | |
"Green Blood Knights": "128", | |
"Greenfoot Goblins": "417", | |
"Grieg": "129", | |
"Grimlings of the Forest": "392", | |
"Grimlings of the Moor": "130", | |
"Grobb Merchants": "131", | |
"Guardians of Shar Vahl": "132", | |
"Guardians of the Vale": "133", | |
"Guardians of Veeshan": "134", | |
"Guards of Gloomingdeep": "475", | |
"Guards of Qeynos": "135", | |
"Guktan Elders": "136", | |
"Guktan Suppliers": "484", | |
"Gunthaks Clan": "458", | |
"Hall of the Ebon Mask": "137", | |
"Hand Legionnaries": "138", | |
"Hand of Seru": "139", | |
"Harbingers Clan": "373", | |
"Haven Defenders": "140", | |
"Haven Smugglers": "141", | |
"Heart of Seru": "142", | |
"Heretics": "143", | |
"Hexxt": "144", | |
"High Council of Erudin": "145", | |
"High Council of Gukta": "146", | |
"High Guard of Erudin": "147", | |
"HighHold Citizens": "148", | |
"Highpass Guards": "149", | |
"HoHMaiden": "471", | |
"Holgresh": "150", | |
"Horde of Xalgoz": "151", | |
"House of Fordel": "152", | |
"House of Midst": "153", | |
"House of Stout": "154", | |
"Iksar": "371", | |
"Indifferent": "463", | |
"Indigo Brotherhood": "155", | |
"Inhabitants of Air": "464", | |
"Inhabitants of Firiona Vie": "418", | |
"Inhabitants of Hate": "156", | |
"Inhabitants of Tanaan": "157", | |
"Innoruuk's Curse of the Cauldron": "158", | |
"Invaders of the Moor": "503", | |
"Jaggedpine Treefolk": "159", | |
"Jaled-Dar": "160", | |
"Johanius Barleou": "161", | |
"Kaladim Citizens": "162", | |
"Kaladim Merchants": "419", | |
"Kane Bayle": "164", | |
"Karana": "165", | |
"Karana Bandits": "166", | |
"Karana Residents": "167", | |
"Katta Castellum Citizens": "168", | |
"Kazon Stormhammer": "169", | |
"Kedge": "420", | |
"Keepers of the Art": "170", | |
"Keepers of the Claw": "171", | |
"Kejek Village": "172", | |
"Kejekan": "173", | |
"Kelethin Merchants": "174", | |
"Kerra": "421", | |
"Kerra Isle": "175", | |
"Kessdona": "422", | |
"Khati Sha": "423", | |
"King Ak'Anon": "176", | |
"King Aythox Thex": "379", | |
"King Naythox Thex": "177", | |
"King Tearis Thex": "178", | |
"King Tormax": "179", | |
"King Xorbb": "180", | |
"Kingdom of Above and Below": "181", | |
"Kithicor Residents": "182", | |
"Knights of Thunder": "183", | |
"Knights of Truth": "184", | |
"Kobold": "185", | |
"Kobolds of Fire Pit": "186", | |
"Kobolds of Gloomingdeep": "424", | |
"Koka'Vor Tribe": "501", | |
"KOS": "366", | |
"KOS Inhabitants of Air": "465", | |
"KOS Plane of Disease": "466", | |
"KOS Plane of Innovation": "468", | |
"KOS Plane of Nightmare": "467", | |
"KOS Plane of Storms": "489", | |
"KOS Plane of Time": "469", | |
"KOS_animal": "367", | |
"Krag": "187", | |
"Kromrif": "188", | |
"Kromzek": "189", | |
"Kunark Fire Giants": "190", | |
"Lake Recondite Bandits": "191", | |
"Lanys T`Vyl": "425", | |
"League of Antonican Bards": "192", | |
"Legion of Cabilis": "193", | |
"Legion of Mata Muram": "194", | |
"Lesser Brann Giants": "195", | |
"Lesser Jord Giants": "196", | |
"Lesser Vann Giants": "197", | |
"Lesser Vind Giants": "198", | |
"Lithiniath": "199", | |
"Lizard Man": "200", | |
"Lodikai": "201", | |
"Lorekeepers of Gukta": "202", | |
"Lost Kingdom of Lok": "203", | |
"Lost Minions of Miragul": "204", | |
"Loyals": "454", | |
"Luclin": "205", | |
"Madmen": "480", | |
"Magus Conlegium": "206", | |
"Mayong Mistmoore": "207", | |
"Mayor Gubbin": "208", | |
"Meldrath": "209", | |
"Merchants of Ak'Anon": "210", | |
"Merchants of Erudin": "211", | |
"Merchants of Felwithe": "212", | |
"Merchants of Halas": "213", | |
"Merchants of Highpass": "214", | |
"Merchants of Kaladim": "215", | |
"Merchants of Ogguk": "216", | |
"Merchants of Qeynos": "217", | |
"Merchants of Rivervale": "218", | |
"Mermaid": "426", | |
"Mermaids": "375", | |
"Miners Guild 249": "219", | |
"Miners Guild 628": "220", | |
"Minions of Scale": "221", | |
"Minions of the Sunlord": "222", | |
"Minions of Tirranun": "427", | |
"Minions of Underfoot": "223", | |
"Mountain Death Clan": "384", | |
"Mucktail Gnolls": "224", | |
"Murrissa Sandwhisper": "372", | |
"Nadox Clan": "472", | |
"Nadox Initiate": "225", | |
"Nagafen": "226", | |
"Najena": "227", | |
"Nathyn Illuminious": "228", | |
"Needlite": "460", | |
"Neriak Merchants": "486", | |
"Neriak Ogre": "378", | |
"Neriak Trolls": "229", | |
"Nest Guardians": "428", | |
"New Alliance of Stone": "230", | |
"Nihil": "231", | |
"Nitram": "474", | |
"Noobie Monsters KOS to Guards": "394", | |
"Norrath's Keepers": "429", | |
"Oggok Citizens": "233", | |
"Oggok Guards": "232", | |
"Ogguk Residents": "430", | |
"Ogre": "431", | |
"Ogre Warriors": "234", | |
"OmensBatRat": "485", | |
"OmensMurks": "487", | |
"Opal Dark Briar": "235", | |
"Oracle of Karnon": "236", | |
"Oracle of Marud": "237", | |
"Orc": "238", | |
"Order of Autarkic Umbrage": "239", | |
"Order of Three": "240", | |
"Orphans": "452", | |
"Othmir": "241", | |
"Outcasts and Mutants": "242", | |
"Overlord Mata Muram": "432", | |
"Owlbears of the Moor": "505", | |
"Pack of Tomar": "243", | |
"Paebala": "244", | |
"Paladins of Gukta": "245", | |
"Paladins of Underfoot": "246", | |
"Paludal_Mushrooms": "490", | |
"Paludal_Underbulk": "491", | |
"Peace Keepers": "247", | |
"Phingel Autropos": "433", | |
"Phinigel Autropos": "248", | |
"Pickclaw Goblins": "249", | |
"Pirates of Gunthak": "250", | |
"Pirates of Iceclad": "251", | |
"Pirates of the Pine": "252", | |
"Pixie": "253", | |
"Pixtt": "254", | |
"Planar Collective": "455", | |
"Planes_Neutral": "488", | |
"Prexuz": "255", | |
"Priests of Innoruuk": "256", | |
"Priests of Life": "257", | |
"Priests of Marr": "258", | |
"Priests of Mischief": "259", | |
"Primordial Malice": "260", | |
"Prisoners of Justice": "261", | |
"Progeny": "262", | |
"Protectors of Growth": "263", | |
"Protectors of Gukta": "264", | |
"Protectors of Pine": "265", | |
"Qeynos Citizens": "434", | |
"QRG Protected Animals": "267", | |
"Queen Cristanos Thex": "268", | |
"Rallos Zek": "269", | |
"Rav": "270", | |
"Residents of Gloomingdeep": "476", | |
"Residents of Jaggedpine": "271", | |
"Residents of Karanas": "272", | |
"Riftseekers": "435", | |
"Rikkukin": "436", | |
"Ring of Scale": "273", | |
"Riptide Goblins": "274", | |
"Rogues of the White Rose": "275", | |
"Root of Innuruuk": "276", | |
"Rujarkian Slavers": "277", | |
"Rygorr Clan Snow Orcs": "278", | |
"Sabertooths of Blackburrow": "279", | |
"Sandworkers": "280", | |
"Sarnak Collective": "281", | |
"Scaled Mystics": "282", | |
"Scions of Dreadspire": "437", | |
"Scorchclaw Goblins": "438", | |
"Seru": "284", | |
"Servants of Aero": "285", | |
"Servants of Hydro": "286", | |
"Servants of Inferno": "287", | |
"Servants of Saryrn": "288", | |
"Servants of Terra": "289", | |
"Servants of Tunare": "290", | |
"Shadowed Men": "291", | |
"Shadowknights of Night Keep": "292", | |
"Shak Dratha": "293", | |
"Shamen of Justice": "294", | |
"Shamen of War": "295", | |
"Shei Vinitras": "296", | |
"Shik Nar": "297", | |
"Shoulders of Seru": "298", | |
"Shralock Orcs": "299", | |
"Silent Fist Clan": "300", | |
"Silla Herald": "496", | |
"Sirens of the Grotto": "301", | |
"Sky Talons": "439", | |
"Skytalons": "302", | |
"Snowfang Gnolls": "303", | |
"Soldiers of Tunare": "304", | |
"Solusek Mining Co": "305", | |
"Song Weavers": "306", | |
"Spider": "500", | |
"Spire Spirits": "388", | |
"Spirits of Katta Castellum": "307", | |
"Spirocs of Timorous": "308", | |
"Splitpaw Clan": "309", | |
"Sporali": "310", | |
"Sporali Collective": "440", | |
"Steel Warriors": "311", | |
"Steelslaves": "312", | |
"Stillmoon Acolytes": "441", | |
"Stone Hive Bixies": "313", | |
"Storm Guard": "314", | |
"Storm Guardians": "315", | |
"Storm Reapers": "316", | |
"Sustainers": "453", | |
"Swamp Giants of Kunark": "370", | |
"Swift Tails": "317", | |
"Syrik Iceblood": "318", | |
"Tarmok Tribe": "390", | |
"Taruun": "319", | |
"Temple Of Sol Ro": "442", | |
"Temple of Solusek Ro": "320", | |
"The Bloodtribe": "389", | |
"The Cral Ligi Clan": "321", | |
"The Dark Alliance": "443", | |
"The Dead": "322", | |
"The Forsaken": "323", | |
"The Grol Baku Clan": "324", | |
"The Guardians": "444", | |
"The HotWingz": "325", | |
"The Kromdek": "326", | |
"The Kromdul": "327", | |
"The Rainkeeper": "328", | |
"The Recuso": "329", | |
"The Sambata Tribe": "330", | |
"The Spurned": "331", | |
"The Tro Jeg Clan": "332", | |
"The Truth": "333", | |
"The Vas Ren Clan": "334", | |
"The_Angry_Sambata": "492", | |
"Thought Leeches": "335", | |
"Thrall of Kly": "336", | |
"Thunder Guardians": "445", | |
"Tirranun": "446", | |
"TizmakClan": "337", | |
"Traders of the Haven": "338", | |
"Trakanon": "339", | |
"Treants of Jaggedpine": "340", | |
"Tribe Vrodak": "341", | |
"True Spirit": "342", | |
"Trusik Tribe": "447", | |
"Tserrina Syl'Tor": "343", | |
"Tunare's Scouts": "283", | |
"Tunarean Court": "344", | |
"Ulthork": "345", | |
"Undead Frogloks of Guk": "346", | |
"Undead Residents of Kithicor": "381", | |
"Underbulks": "461", | |
"Unkempt Druids": "347", | |
"Unrest Inhabitants": "376", | |
"VahShir Crusaders": "348", | |
"Valdanov Zevfeer": "349", | |
"Validus Custodus": "350", | |
"Veeshan": "351", | |
"Velketor": "352", | |
"Venril Sathir": "353", | |
"Verish Mal": "456", | |
"VillagerRoom": "482", | |
"Vishimtar": "448", | |
"Volkara": "449", | |
"Volkara's Brood": "450", | |
"Vornol Transon": "354", | |
"Vox": "355", | |
"Warlord Ngrub": "473", | |
"Wayfarers Brotherhood": "356", | |
"WehateThelin": "470", | |
"Werewolf": "357", | |
"Whisperling": "358", | |
"Whistling Fist Brotherhood": "359", | |
"Wisps": "462", | |
"Witnesses of Hate": "393", | |
"Wizards of Gukta": "360", | |
"Wolves of the Moor": "504", | |
"Wolves of the North": "361", | |
"Yar`lir": "451", | |
"Yelinak": "362", | |
"Yunjo Slave Resistance": "363", | |
"Zazamoukh": "364", | |
"Zlandicar": "365", | |
"Zordakalicus Ragefire": "385", | |
"Zun'Muram": "502", | |
} | |
# There are some duplicate keys here, too lazy for now .. | |
zonetable = { | |
"The Abysmal Sea": 279, | |
"The Acrylia Caverns": 154, | |
"The Plane of Sky": 71, | |
"Ak'Anon": 55, | |
"The Akheva Ruins": 179, | |
"Anguish, the Fallen Palace": 317, | |
"Designer Apprentice": 999, | |
"Arcstone, Isle of Spirits": 369, | |
"The Arena": 77, | |
"The Arena Two": 180, | |
"Art Testing Domain": 996, | |
"Ashengate, Reliquary of the Scale": 406, | |
"Jewel of Atiiki": 418, | |
"Aviak Village": 53, | |
"Barindu, Hanging Gardens": 283, | |
"Barren Coast": 422, | |
"The Barter Hall": 346, | |
"The Bazaar": 151, | |
"Befallen": 36, | |
"Befallen": 411, | |
"Gorge of King Xorbb": 16, | |
"Temple of Bertoxxulous": 469, | |
"Blackburrow": 17, | |
"Blacksail Folly": 428, | |
"The Bloodfields": 301, | |
"Bloodmoon Keep": 445, | |
"Bastion of Thunder": 209, | |
"The Broodlands": 337, | |
"The Buried Sea": 423, | |
"The Burning Wood": 87, | |
"Butcherblock Mountains": 68, | |
"Cabilis East": 106, | |
"Cabilis West": 82, | |
"Dagnor's Cauldron": 70, | |
"Nobles' Causeway": 303, | |
"Accursed Temple of CazicThule": 48, | |
"Muramite Proving Grounds": 304, | |
"Muramite Proving Grounds": 305, | |
"Muramite Proving Grounds": 306, | |
"Muramite Proving Grounds": 307, | |
"Muramite Proving Grounds": 308, | |
"Muramite Proving Grounds": 309, | |
"The Howling Stones": 105, | |
"Chardok": 103, | |
"Chardok: The Halls of Betrayal": 277, | |
"The City of Mist": 90, | |
"Loading": 190, | |
"Cobaltscar": 117, | |
"The Crypt of Decay": 200, | |
"The Commonlands": 408, | |
"West Commonlands": 21, | |
"Corathus Creep": 365, | |
"Sporali Caverns": 366, | |
"The Corathus Mines": 367, | |
"Crescent Reach": 394, | |
"Crushbone": 58, | |
"Crypt of Shade": 449, | |
"The Crystal Caverns": 121, | |
"Crystallos, Lair of the Awakened": 446, | |
"Sunset Home": 26, | |
"The Crypt of Dalnir": 104, | |
"The Dawnshroud Peaks": 174, | |
"Deadbone Reef": 427, | |
"Lavaspinner's Lair": 341, | |
"Tirranun's Delve": 342, | |
"The Seething Wall": 373, | |
"The Devastation": 372, | |
"Direwind Cliffs": 405, | |
"Korafax, Home of the Riders": 470, | |
"Citadel of the Worldslayer": 471, | |
"The Hive": 354, | |
"The Hatchery": 355, | |
"The Cocoons": 356, | |
"Queen Sendaii`s Lair": 357, | |
"Dragonscale Hills": 442, | |
"Deepscar's Den": 451, | |
"The Ruined City of Dranik": 336, | |
"Catacombs of Dranik": 328, | |
"Catacombs of Dranik": 329, | |
"Catacombs of Dranik": 330, | |
"Dranik's Hollows": 318, | |
"Dranik's Hollows": 319, | |
"Dranik's Hollows": 320, | |
"Sewers of Dranik": 331, | |
"Sewers of Dranik": 332, | |
"Sewers of Dranik": 333, | |
"Dranik's Scar": 302, | |
"The Dreadlands": 86, | |
"Dreadspire Keep": 351, | |
"The Temple of Droga": 81, | |
"Dulak's Harbor": 225, | |
"Eastern Plains of Karana": 15, | |
"The Undershore": 362, | |
"Snarlstone Dens": 363, | |
"Eastern Wastes": 116, | |
"The Echo Caverns": 153, | |
"East Commonlands": 22, | |
"The Elddar Forest": 378, | |
"Tunare's Shrine": 379, | |
"The Emerald Jungle": 94, | |
"Erudin": 24, | |
"The Erudin Palace": 23, | |
"Erud's Crossing": 98, | |
"Marauders Mire": 130, | |
"Everfrost Peaks": 30, | |
"The Plane of Fear": 72, | |
"The Feerrott": 47, | |
"Northern Felwithe": 61, | |
"Southern Felwithe": 62, | |
"Ferubi, Forgotten Temple of Taelosia": 284, | |
"The Forgotten Halls": 998, | |
"The Field of Bone": 78, | |
"Firiona Vie": 84, | |
"Academy of Arcane Sciences": 385, | |
"Arena": 388, | |
"City Hall": 389, | |
"East Freeport": 382, | |
"Hall of Truth: Bounty": 391, | |
"Freeport Militia House: My Precious": 387, | |
"Freeport Sewers": 384, | |
"Temple of Marr": 386, | |
"Theater of the Tranquil": 390, | |
"West Freeport": 383, | |
"East Freeport": 10, | |
"North Freeport": 8, | |
"West Freeport": 9, | |
"Frontier Mountains": 92, | |
"Frostcrypt, Throne of the Shade King": 402, | |
"The Tower of Frozen Shadow": 111, | |
"The Fungus Grove": 157, | |
"The Greater Faydark": 54, | |
"The Great Divide": 118, | |
"Grieg's End": 163, | |
"Grimling Forest": 167, | |
"Grobb": 52, | |
"The Plane of Growth": 127, | |
"The Mechamatic Guardian": 447, | |
"Guild Hall": 345, | |
"Guild Lobby": 344, | |
"Deepest Guk: Cauldron of Lost Souls": 229, | |
"The Drowning Crypt": 234, | |
"The Ruins of Old Guk": 66, | |
"Deepest Guk: Ancient Aqueducts": 239, | |
"The Mushroom Grove": 244, | |
"Deepest Guk: The Curse Reborn": 249, | |
"Deepest Guk: Chapel of the Witnesses": 254, | |
"The Root Garden": 259, | |
"Deepest Guk: Accursed Sanctuary": 264, | |
"The City of Guk": 65, | |
"The Gulf of Gunthak": 224, | |
"Gyrospire Beza": 440, | |
"Gyrospire Zeka": 441, | |
"Halas": 29, | |
"Harbinger's Spire": 335, | |
"Plane of Hate": 76, | |
"The Plane of Hate": 186, | |
"Hate's Fury": 228, | |
"High Keep": 6, | |
"Highpass Hold": 5, | |
"Highpass Hold": 407, | |
"HighKeep": 412, | |
"Hills of Shade": 444, | |
"The Halls of Honor": 211, | |
"The Temple of Marr": 220, | |
"The Hole": 39, | |
"Hollowshade Moor": 166, | |
"The Iceclad Ocean": 110, | |
"Icefall Glacier": 400, | |
"Ikkinz, Chambers of Transcendence": 294, | |
"Ruins of Illsalin": 347, | |
"Illsalin Marketplace": 348, | |
"Temple of Korlach": 349, | |
"The Nargil Pits": 350, | |
"Inktu'Ta, the Unmasked Chapel": 296, | |
"Innothule Swamp": 46, | |
"The Innothule Swamp": 413, | |
"The Jaggedpine Forest": 181, | |
"Jardel's Hook": 424, | |
"Kael Drakkel": 113, | |
"Kaesora": 88, | |
"South Kaladim": 60, | |
"North Kaladim": 67, | |
"Karnor's Castle": 102, | |
"Katta Castellum": 160, | |
"Katta Castrum": 416, | |
"Kedge Keep": 64, | |
"Kerra Isle": 74, | |
"Kithicor Forest": 410, | |
"Kithicor Forest": 20, | |
"Kod'Taz, Broken Trial Grounds": 293, | |
"Korascian Warrens": 476, | |
"Kurn's Tower": 97, | |
"Lake of Ill Omen": 85, | |
"Lake Rathetear": 51, | |
"The Lavastorm Mountains": 27, | |
"Mons Letalis": 169, | |
"The Lesser Faydark": 57, | |
"Loading Zone": 184, | |
"New Loading Zone": 185, | |
"Loping Plains": 443, | |
"The Maiden's Eye": 173, | |
"Maiden's Grave": 429, | |
"Meldrath's Majestic Mansion": 437, | |
"Fortress Mechanotus": 436, | |
"Goru`kar Mesa": 397, | |
"Miragul's Menagerie: Silent Gallery": 232, | |
"Miragul's Menagerie: Frozen Nightmare": 237, | |
"The Spider Den": 242, | |
"Miragul's Menagerie: Hushed Banquet": 247, | |
"The Frosted Halls": 252, | |
"The Forgotten Wastes": 257, | |
"Miragul's Menagerie: Heart of the Menagerie": 262, | |
"The Morbid Laboratory": 267, | |
"The Theater of Imprisoned Horror": 271, | |
"Miragul's Menagerie: Grand Library": 275, | |
"The Plane of Mischief": 126, | |
"The Castle of Mistmoore": 59, | |
"Misty Thicket": 33, | |
"The Misty Thicket": 415, | |
"Mistmoore's Catacombs: Forlorn Caverns": 233, | |
"Mistmoore's Catacombs: Dreary Grotto": 238, | |
"Mistmoore's Catacombs: Struggles within the Progeny": 243, | |
"Mistmoore's Catacombs: Chambers of Eternal Affliction": 248, | |
"Mistmoore's Catacombs: Sepulcher of the Damned": 253, | |
"Mistmoore's Catacombs: Scion Lair of Fury": 258, | |
"Mistmoore's Catacombs: Cesspits of Putrescence": 263, | |
"Mistmoore's Catacombs: Aisles of Blood": 268, | |
"Mistmoore's Catacombs: Halls of Sanguinary Rites": 272, | |
"Mistmoore's Catacombs: Infernal Sanctuary": 276, | |
"Monkey Rock": 425, | |
"Blightfire Moors": 395, | |
"Marus Seru": 168, | |
"The Crypt of Nadox": 227, | |
"Najena": 44, | |
"Natimbi, the Broken Shores": 280, | |
"Dragon Necropolis": 123, | |
"Nedaria's Landing": 182, | |
"Nektropos": 28, | |
"The Nektulos Forest": 25, | |
"Shadowed Grove": 368, | |
"Neriak - Foreign Quarter": 40, | |
"Neriak - Commons": 41, | |
"Neriak - 3rd Gate": 42, | |
"Neriak Palace": 43, | |
"Netherbian Lair": 161, | |
"Nexus": 152, | |
"The Lair of Terris Thule": 221, | |
"The Northern Plains of Karana": 13, | |
"North Desert of Ro": 392, | |
"Northern Desert of Ro": 34, | |
"The Mines of Nurga": 107, | |
"Oasis of Marr": 37, | |
"Oceangreen Hills": 466, | |
"Oceangreen Village": 467, | |
"The Ocean of Tears": 409, | |
"Oggok": 49, | |
"BlackBurrow": 468, | |
"Old Bloodfields": 472, | |
"Old Commonlands": 457, | |
"City of Dranik": 474, | |
"Field of Scale": 452, | |
"Highpass Hold": 458, | |
"Kaesora Library": 453, | |
"Kaesora Hatchery": 454, | |
"Bloody Kithicor": 456, | |
"Kurn's Tower": 455, | |
"Ocean of Tears": 69, | |
"The Overthere": 93, | |
"Paineel": 75, | |
"The Paludal Caverns": 156, | |
"The Lair of the Splitpaw": 18, | |
"The Permafrost Caverns": 73, | |
"The Plane of Air": 215, | |
"The Plane of Disease": 205, | |
"The Plane of Earth": 218, | |
"The Plane of Earth": 222, | |
"The Plane of Fire": 217, | |
"The Plane of Innovation": 206, | |
"The Plane of Justice": 201, | |
"The Plane of Knowledge": 202, | |
"The Plane of Nightmares": 204, | |
"The Plane of Storms": 210, | |
"Drunder, the Fortress of Zek": 214, | |
"The Plane of Time": 219, | |
"The Plane of Time": 223, | |
"Torment, the Plane of Pain": 207, | |
"The Plane of Tranquility": 203, | |
"The Plane of Valor": 208, | |
"Plane of War": 213, | |
"The Plane of Water": 216, | |
"The Precipice of War": 473, | |
"Muramite Provinggrounds": 316, | |
"The Qeynos Aqueduct System": 45, | |
"The Western Plains of Karana": 12, | |
"South Qeynos": 1, | |
"North Qeynos": 2, | |
"The Qeynos Hills": 4, | |
"Qinimi, Court of Nihilia": 281, | |
"The Surefall Glade": 3, | |
"Qvic, Prayer Grounds of Calling": 295, | |
"Qvic, the Hidden Vault": 299, | |
"Sverag, Stronghold of Rage": 374, | |
"Razorthorn, Tower of Sullon Zek": 375, | |
"Rathe Council Chamber": 477, | |
"The Rathe Mountains": 50, | |
"Redfeather Isle": 430, | |
"Relic, the Artifact City": 370, | |
"Riftseekers' Sanctum": 334, | |
"Rivervale": 19, | |
"Riwwi, Coliseum of Games": 282, | |
"Blackfeather Roost": 398, | |
"The Rujarkian Hills: Bloodied Quarries": 230, | |
"The Rujarkian Hills: Halls of War": 235, | |
"The Rujarkian Hills: Wind Bridges": 240, | |
"The Rujarkian Hills: Prison Break": 245, | |
"The Rujarkian Hills: Drudge Hollows": 250, | |
"The Rujarkian Hills: Fortified Lair of the Taskmasters": 255, | |
"The Rujarkian Hills: Hidden Vale of Deceit": 260, | |
"The Rujarkian Hills: Blazing Forge ": 265, | |
"The Rujarkian Hills: Arena of Chance": 269, | |
"The Rujarkian Hills: Barracks of War": 273, | |
"The Liberated Citadel of Runnyeye": 11, | |
"The Scarlet Desert": 175, | |
"The Ruins of Sebilis": 89, | |
"Shadeweaver's Thicket": 165, | |
"Shadow Haven": 150, | |
"Shadowrest": 187, | |
"Shadow Spine": 364, | |
"The City of Shar Vahl": 155, | |
"The Open Sea": 435, | |
"The Open Sea": 431, | |
"The Open Sea": 432, | |
"The Open Sea": 433, | |
"The Open Sea": 434, | |
"S.H.I.P. Workshop": 439, | |
"Silyssar, New Chelsith": 420, | |
"Siren's Grotto": 125, | |
"The Skyfire Mountains": 91, | |
"Skylance": 371, | |
"Skyshrine": 114, | |
"The Sleeper's Tomb": 128, | |
"Sewers of Nihilia, Emanating Cre": 288, | |
"Sewers of Nihilia, Lair of Trapp": 286, | |
"Sewers of Nihilia, Purifying Pla": 287, | |
"Sewers of Nihilia, Pool of Sludg": 285, | |
"Solusek's Eye": 31, | |
"Nagafen's Lair": 32, | |
"The Caverns of Exile": 278, | |
"The Tower of Solusek Ro": 212, | |
"The Temple of Solusek Ro": 80, | |
"Solteris, the Throne of Ro": 421, | |
"The Southern Plains of Karana": 14, | |
"South Desert of Ro": 393, | |
"Southern Desert of Ro": 35, | |
"Sanctus Seru": 159, | |
"Ssraeshza Temple": 162, | |
"The Steam Factory": 438, | |
"Steamfont Mountains": 56, | |
"The Steamfont Mountains": 448, | |
"The Steppes": 399, | |
"Stillmoon Temple": 338, | |
"The Ascent": 339, | |
"The Stonebrunt Mountains": 100, | |
"Stone Hive": 396, | |
"Suncrest Isle": 426, | |
"Sunderock Springs": 403, | |
"The Swamp of No Hope": 83, | |
"Tacvi, The Broken Temple": 298, | |
"Takish-Hiz: Sunken Library": 231, | |
"Takish-Hiz: Shifting Tower": 236, | |
"Takish-Hiz: Fading Temple": 241, | |
"Takish-Hiz: Royal Observatory": 246, | |
"Takish-Hiz: River of Recollection": 251, | |
"Takish-Hiz: Sandfall Corridors": 256, | |
"Takish-Hiz: Balancing Chamber": 261, | |
"Takish-Hiz: Sweeping Tides": 266, | |
"Takish-Hiz: Antiquated Palace": 270, | |
"Ruins of Takish-Hiz": 376, | |
"The Root of Ro": 377, | |
"Takish-Hiz: Prismatic Corridors": 274, | |
"The Temple of Veeshan": 124, | |
"The Tenebrous Mountains": 172, | |
"Thalassius, the Coral Keep": 417, | |
"Theater of Blood": 380, | |
"Deathknell, Tower of Dissonance": 381, | |
"The Deep": 164, | |
"The Grey": 171, | |
"The Nest": 343, | |
"The Void": 459, | |
"The Void": 460, | |
"The Void": 461, | |
"The Void": 462, | |
"The Void": 463, | |
"The Void": 464, | |
"The Void": 465, | |
"Thundercrest Isles": 340, | |
"The City of Thurgadin": 115, | |
"Icewell Keep": 129, | |
"Timorous Deep": 96, | |
"Tipt, Treacherous Crags": 289, | |
"The Torgiran Mines": 226, | |
"Toskirakk": 475, | |
"Toxxulia Forest": 38, | |
"Toxxulia Forest": 414, | |
"Trakanon's Teeth": 95, | |
"EverQuest Tutorial": 183, | |
"The Mines of Gloomingdeep": 188, | |
"The Mines of Gloomingdeep": 189, | |
"The Twilight Sea": 170, | |
"Txevu, Lair of the Elite": 297, | |
"The Umbral Plains": 176, | |
"The Estate of Unrest": 63, | |
"Uqua, the Ocean God Chantry": 292, | |
"Valdeholm": 401, | |
"Veeshan's Peak": 108, | |
"Veksar": 109, | |
"Velketor's Labyrinth": 112, | |
"Vergalid Mines": 404, | |
"Vex Thal": 158, | |
"Vxed, the Crumbling Caverns": 290, | |
"The Wakening Land": 119, | |
"Wall of Slaughter": 300, | |
"The Warrens": 101, | |
"The Warsliks Woods": 79, | |
"Stoneroot Falls": 358, | |
"Prince's Manor": 359, | |
"Caverns of the Lost": 360, | |
"Lair of the Korlach": 361, | |
"The Western Wastes": 120, | |
"Yxtta, Pulpit of Exiles ": 291, | |
"Zhisza, the Shissar Sanctuary": 419, | |
"The Nektulos Forest": 25, | |
"Brell's Rest": 480, | |
"The Cooling Chamber": 483, | |
"Pellucid Grotto": 488, | |
"Arthicrex": 485, | |
"The Foundation": 486, | |
"The Underquarry": 482, | |
"Brell's Arena": 492, | |
"Volska's Husk": 489, | |
"The Convorteum": 491, | |
"The Library": 704, | |
"Morell's Castle": 707, | |
"Al'Kabor's Nightmare": 709, | |
"Erudin Burning": 706, | |
"The Feerrott": 700, | |
"The Grounds": 703, | |
"Miragul's Nightmare": 710, | |
"Sanctum Somnium": 708, | |
"Fear Itself": 711, | |
"House of Thule": 701, | |
"House of Thule, Upper Floors": 702, | |
"The Well": 705, | |
"Sunrise Hills": 712, | |
"Argath, Bastion of Illdaera": 724, | |
"Valley of Lunanyn": 725, | |
"Sarith, City of Tides": 726, | |
"Rubak Oseka, Temple of the Sea": 727, | |
"Beasts' Domain": 728, | |
"The Resplendent Temple": 729, | |
"Pillars of Alra": 730, | |
"Windsong Sanctuary": 731, | |
"Erillion, City of Bronze": 732, | |
"Sepulcher of Order": 733, | |
"Sepulcher East": 734, | |
"Sepulcher West": 735, | |
"Wedding Chapel": 493, | |
"Wedding Chapel": 494, | |
"Lair of the Risen": 495, | |
"The Bazaar": 151, | |
"Brell's Temple": 490, | |
"Fungal Forest": 481, | |
"Lichen Creep": 487, | |
"Kernagir, the Shining City": 484, | |
"The Breeding Grounds": 757, | |
"Chapterhouse of the Fallen": 760, | |
"The Crystal Caverns: Fragment of Fear": 756, | |
"East Wastes: Zeixshi-Kar's Awakening": 755, | |
"Evantil, the Vile Oak": 758, | |
"Grelleth's Palace, the Chateau of Filth": 759, | |
"Kael Drakkel: The King's Madness": 754, | |
"Shard's Landing": 752, | |
"Valley of King Xorbb": 753, | |
} | |
def factionsetname(item): | |
"Generates faction set name" | |
return re.sub(' ', '', item[0]) + re.sub('-', '', item[1]) | |
def cleanmobname(name): | |
"Cleans mob name for DB look up" | |
return re.sub('`', '-', re.sub(' ', '_', name)) | |
class FactionSet(object): | |
""" | |
FactionSet class | |
name: name of the faction set | |
primary: primary faction ID | |
hits: faction hits assumes a dict like object | |
faction ID: hit value | |
""" | |
def __init__(self, name, primid, hits): | |
self.name = name | |
self.primary = primid | |
self.hits = hits.copy() | |
def __repr__(self): | |
return str((self.name, self.primary, self.hits)) | |
# factionsets[name].hits[key] == factionsets[name][key] | |
def __getitem__(self, key): | |
return self.hits[key] | |
# names need to be unique to the set to work | |
def __eq__(self, other): | |
return self.name == other.name | |
def has_key(self, key): | |
"Wrapper to hits.has_key" | |
return self.hits.has_key(key) | |
def generate_sql(self): | |
"Generates SQL statements" | |
statement = ('INSERT INTO npc_faction (name, primaryfaction) VALUES ' | |
'(\'{}\', \'{}\');\n'.format(self.name, self.primary) + | |
'SELECT id INTO @setid FROM npc_faction WHERE name = ' | |
'\'{}\' LIMIT 1;\n'.format(self.name)) | |
for hit in self.hits: | |
statement += ('INSERT INTO npc_faction_entries ' | |
'(npc_faction_id, faction_id, value, npc_value) ' | |
'VALUES (@setid, \'{}\', \'{}\', \'{}\');\n' | |
.format(hit, self.hits[hit], | |
1 if int(self.hits[hit]) < 0 else 0)) | |
return statement | |
class Mob(object): | |
""" | |
Mob class | |
name: name of mob | |
zone: zone ID for mob | |
faction: faction set name | |
""" | |
def __init__(self, name, zone, faction): | |
self.name = name | |
self.zone = zone | |
self.faction = faction | |
def __repr__(self): | |
return str((self.name, self.zone, self.faction)) | |
def __eq__(self, other): | |
return self.name == other.name and self.zone == other.zone | |
def generate_sql(self): | |
"Generaets SQL statements" | |
return ('UPDATE npc_types SET npc_faction_id = @{} WHERE ' | |
'name RLIKE \'{}\' AND id >= {} AND id <= {};' | |
.format(self.faction, cleanmobname(self.name), self.zone * 1000, | |
self.zone * 1000 + 999)) | |
def main(filename): | |
"Processes eqlog and generates SQL to update mob factions" | |
if not os.path.exists(filename): | |
print filename + ' not found' | |
exit(-1) | |
pfaction = re.compile(r'\[.*\] Your faction standing with (.*) has been ' | |
r'adjusted by (.*)\.') | |
pslain1 = re.compile(r'\[.*\] You have slain (.*)!') | |
pslain2 = re.compile(r'\[.*\] (.*) has been slain by .*!') | |
penter = re.compile(r'\[.*\] You have entered (.*)\.') | |
factions = {} # mob: mob object | |
factionsets = {} # set name: set object | |
hits = collections.OrderedDict() # faction ID: value | |
nohits = [] # mobs with no faction hits | |
setname = None | |
primary = None | |
zone = None | |
eqlog = open(filename, 'r') | |
for line in eqlog: | |
m = penter.match(line) | |
if m: | |
if not re.search('PvP|levitation', line): | |
zone = zonetable[m.group(1)] if zonetable.has_key(m.group(1)) \ | |
else m.group(1) | |
m = pfaction.match(line) | |
if m: | |
if not setname and not hits.items(): | |
setname = factionsetname(m.groups()) | |
primary = factiontable[m.group(1)] | |
hits[factiontable[m.group(1)]] = m.group(2) | |
continue | |
m = pslain1.match(line) | |
if not m: | |
m = pslain2.match(line) | |
if m: | |
# hits will be empty if no faction hits, so we skip it | |
if not factions.has_key(m.group(1)) and hits.items(): | |
factions[m.group(1)] = Mob(m.group(1), zone, setname) | |
if not factionsets.has_key(setname): | |
factionsets[setname] = FactionSet(setname, primary, hits) | |
elif not hits.items(): | |
nohits.append(m.group(1)) | |
hits.clear() | |
setname = None | |
primary = None | |
continue | |
eqlog.close() | |
print '-- Faction set entries' | |
for faction in factionsets: | |
print factionsets[faction].generate_sql() | |
print '-- Mob entries' | |
for setname in factionsets: | |
print('SELECT id INTO @{0} FROM npc_faction WHERE name = \'{0}\' ' | |
'LIMIT 1;'.format(setname)) | |
# The zone limiting assumes the mob ids follows PEQ's scheme | |
for mob in factions: | |
print factions[mob].generate_sql() | |
# This might output some pets | |
if len(nohits): | |
print '-- some of these might be pets' | |
for mob in nohits: | |
print '-- no faction hit {}'.format(mob) | |
return 0 | |
if __name__ == '__main__': | |
if len(sys.argv) != 2: | |
print 'Incorrect arguments. python ' + sys.argv[0] + ' filename' | |
exit(-1) | |
main(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment