Ejemplo n.º 1
0
def parseNPC(title, attributes, c, spells, getURL):
    name = title
    if 'name' in attributes:
        name = attributes['name']
    posx = None
    if 'posx' in attributes:
        try: posx = convert_x(attributes['posx'])
        except: pass
    posy = None
    if 'posy' in attributes:
        try: posy = convert_y(attributes['posy'])
        except: pass
    posz = None
    if 'posz' in attributes:
        try: posz = int(attributes['posz'])
        except: pass
    city = None
    if 'city' in attributes:
        city = attributes['city'].lower()
    if city == None:
        return False
    job = None
    if 'job2' in attributes:
        job = attributes['job2']
    if 'job' in attributes and (job == None or 'guild leader' in attributes['job'].lower()):
        job = attributes['job']
    url = "http://tibia.wikia.com/wiki/%s" % (title.replace(' ', '_'))
    image = getImage(url, getURL, imageRegex)
    if image == None or image == False:
        url = "http://tibia.wikia.com/wiki/File:%s.gif" % (title.replace(' ', '_'))
        image = getImage(url, getURL, imageRegex2)
        if image == None or image == False:
            print('failed to get image for npc', title)
            return False
    c.execute('INSERT INTO NPCs (title,name, city, job, x, y, z, image) VALUES (?,?,?,?,?,?,?,?)', (title,name, city, job, posx, posy, posz, image))
    npcid = c.lastrowid
    if 'sells' in attributes and 'teaches' in attributes['sells'].lower():
        spells[npcid] = parseSpells(attributes['sells'])
    if 'notes' in attributes:
        match = re.search('{{Transport([^}]+)', attributes['notes'])
        if match != None:
            splits = match.groups()[0].split('|')
            for spl in splits:
                spl = spl.strip()
                if ',' in spl:
                    splits2 = spl.split(',')
                    dest = splits2[0].strip()
                    notes = ""
                    if ';' in splits2[1]:
                        splits3 = splits2[1].split(';')
                        splits2[1] = splits3[0]
                        notes = splits3[1].replace('[', '').replace(']', '')
                    try: cost = int(splits2[1].strip())
                    except: continue
                    c.execute('INSERT INTO NPCDestinations(npcid, destination, cost, notes) VALUES (?,?,?,?)', (npcid, dest, cost, notes))
                        


    return True
Ejemplo n.º 2
0
def addChildren(parentNode, missionName):
    ordering = 0
    for instruction in parentNode.findall('Instruction'):
        if 'SamePage' in instruction.attrib and instruction.attrib[
                'SamePage'] == 'True':
            ordering -= 1
        beginx = None
        beginy = None
        beginz = None
        settings = ""
        if instruction.find('Markings') != None:
            averagex, averagey, averagez = (0, 0, None)
            count = 0
            for marking in instruction.find('Markings'):
                coordinate = marking.find('MarkLocation').text
                begin = coordinate.split(',')
                beginx = convert_x(begin[0])
                beginy = convert_y(begin[1])
                beginz = int(begin[2])

                settings = settings + "@Marking=" + str(beginx) + "," + str(
                    beginy) + "," + str(beginz)
                averagex += beginx
                averagey += beginy
                if averagez == None:
                    averagez = beginz
                elif averagez != beginz:
                    raise Exception("Markings on different floors.")
                count += 1
                if marking.find("MarkIcon") != None:
                    settings = settings + "@MarkIcon=" + marking.find(
                        'MarkIcon').text
                if marking.find("MarkSize") != None:
                    settings = settings + "@MarkSize=" + str(
                        int(marking.find('MarkSize').text))
            beginx = averagex / count
            beginy = averagey / count
            beginz = averagez
        if instruction.find("WalkableColor") != None:
            settings = settings + "@WalkableColor=" + instruction.find(
                "WalkableColor").text

        if instruction.find('BeginCoordinate') != None:
            begin = instruction.find('BeginCoordinate').text.split(',')
            beginx = convert_x(begin[0])
            beginy = convert_y(begin[1])
            beginz = int(begin[2])
            if instruction.find("BeginImage") != None:
                settings = settings + "@Marking=" + str(beginx) + "," + str(
                    beginy) + "," + str(
                        beginz) + "@MarkIcon=" + instruction.find(
                            "BeginImage").text
        if instruction.find('EndCoordinate') == None:
            endx = None
            endy = None
            endz = 90
            try:
                endz = int(instruction.find('RectangleSize').text)
            except:
                pass
        else:
            end = instruction.find('EndCoordinate').text.split(',')
            endx = convert_x(end[0])
            endy = convert_y(end[1])
            endz = int(end[2])
            if instruction.find("EndImage") != None:
                settings = settings + "@Marking=" + str(endx) + "," + str(
                    endy) + "," + str(endz) + "@MarkIcon=" + instruction.find(
                        "EndImage").text
        description = instruction.find('Text').text
        c.execute(
            'INSERT INTO QuestInstructions(questid, beginx, beginy, beginz, endx, endy, endz, description, ordering, missionname,settings) VALUES (?,?,?,?,?,?,?,?,?,?,?)',
            (questid, convert_x(begin[0]), convert_y(begin[1]), int(
                begin[2]), endx, endy, endz, description, ordering,
             missionName, settings[1:] + "@" if len(settings) > 0 else None))
        ordering += 1
Ejemplo n.º 3
0
c.execute(
    'CREATE TABLE HuntDirections(huntingplaceid INTEGER, beginx INTEGER, beginy INTEGER, beginz INTEGER, endx INTEGER, endy INTEGER, endz INTEGER, description STRING, ordering INTEGER, settings STRING)'
)
root = xml.etree.ElementTree.parse(huntdirections_xmlfile).getroot()
for child in root.getchildren():
    huntingplaceid = getHuntID(child.find('Name').text)
    ordering = 0
    for direction in child.find('Directions').getchildren():
        settings = ""
        if 'SamePage' in direction.attrib and direction.attrib[
                'SamePage'] == 'True':
            ordering -= 1
        begin = direction.find('BeginCoordinate').text.split(',')
        end = direction.find('EndCoordinate').text.split(',')
        if direction.find("BeginImage") != None:
            settings = settings + "@Marking=" + str(convert_x(
                begin[0])) + "," + str(convert_y(begin[1])) + "," + str(
                    int(begin[2])) + "@MarkIcon=" + direction.find(
                        "BeginImage").text
        if direction.find("EndImage") != None:
            settings = settings + "@Marking=" + str(convert_x(
                end[0])) + "," + str(convert_y(end[1])) + "," + str(int(
                    end[2])) + "@MarkIcon=" + direction.find("EndImage").text
        description = direction.find('Text').text
        c.execute(
            'INSERT INTO HuntDirections(huntingplaceid, beginx, beginy, beginz, endx, endy, endz, description, ordering, settings) VALUES (?,?,?,?,?,?,?,?,?,?)',
            (huntingplaceid, convert_x(begin[0]), convert_y(
                begin[1]), int(begin[2]), convert_x(end[0]), convert_y(
                    end[1]), int(end[2]), description, ordering, settings))
        ordering += 1

Ejemplo n.º 4
0
def parseHunt(title, attributes, c, content, huntcreatures, getURL):
    name = title.replace('<br>', ' ').strip()
    if 'name' in attributes:
        name = attributes['name'].replace('<br>', ' ').strip()
    image = None
    if 'image' in attributes:
        image = attributes['image']
    expstar = None
    if 'expstar' in attributes or 'exp' in attributes:
        try: expstar = int(attributes['expstar'])
        except: pass
        if expstar == None:
            try: expstar = ratingMap[attributes['exp'].lower().strip()]
            except: pass
    lootstar = None
    if 'lootstar' in attributes or 'loot' in attributes:
        try: lootstar = int(attributes['lootstar'])
        except:pass
        if lootstar == None:
            try: lootstar = ratingMap[attributes['loot'].lower().strip()]
            except: pass
    level = None
    if 'lvlknights' in attributes:
        try: level = int(attributes['lvlknights'])
        except: pass
    if 'lvlpaladins' in attributes and level==None:
        try: level = int(attributes['lvlpaladins'])
        except: pass
    if 'lvlmages' in attributes and level==None:
        try: level = int(attributes['lvlmages'])
        except: pass
    city = None
    if 'city' in attributes:
        city = attributes['city']
    if city == None and level == None:
        return False

    c.execute('SELECT * FROM HuntingPlaces WHERE LOWER(name)=?', (name.lower(),))
    results = c.fetchall()

    if len(results) > 0:
        huntattribs = [name, level, expstar, lootstar, image, city].count(None)
        otherAttributes = results[0].count(None)
        if otherAttributes > huntattribs:
            c.execute('DELETE FROM HuntingPlaces WHERE LOWER(name)=?', (name.lower(),))
        else:
            print(name, 'more null values than other hunt of the same name', huntattribs, otherAttributes)
            return True


    c.execute('INSERT INTO HuntingPlaces (name, level, exprating, lootrating, image, city) VALUES (?,?,?,?,?,?)', (name, level, expstar, lootstar, image, city))
    huntingid = c.lastrowid
    if 'location' in attributes:
        locstr = attributes['location']
        index = 0;
        while True:
            match = re.search(mapperRegex, locstr[index:])
            if match == None: 
                break
            x = convert_x(match.groups()[0])
            y = convert_y(match.groups()[1])
            z = int(match.groups()[2])
            c.execute('INSERT INTO HuntingPlaceCoordinates (huntingplaceid, x, y, z) VALUES (?,?,?,?)', (huntingid, x, y, z))
            index += match.end()
    index = 0;
    huntcreatures[huntingid] = list()
    while True:
        match = re.search(creatureRegex, content[index:])
        if match == None: break
        creature = match.groups()[0]
        if creature not in huntcreatures[huntingid]:
            huntcreatures[huntingid].append(creature)
        index += match.end()
    index = 0
    while True:
        match = re.search(creatureRegex2, content[index:])
        if match == None: break
        creatureList = match.groups()[0].split('|')[1:]
        for creature in creatureList:
            huntcreatures[huntingid].append(creature)
        index += match.end()
    return True
Ejemplo n.º 5
0
def parseHunt(title, attributes, c, content, huntcreatures, getURL):
    name = title.replace('<br>', ' ').strip()
    if 'name' in attributes:
        name = attributes['name'].replace('<br>', ' ').strip()
    image = None
    if 'image' in attributes:
        image = attributes['image']
    expstar = None
    if 'expstar' in attributes or 'exp' in attributes:
        try:
            expstar = int(attributes['expstar'])
        except:
            pass
        if expstar == None:
            try:
                expstar = ratingMap[attributes['exp'].lower().strip()]
            except:
                pass
    lootstar = None
    if 'lootstar' in attributes or 'loot' in attributes:
        try:
            lootstar = int(attributes['lootstar'])
        except:
            pass
        if lootstar == None:
            try:
                lootstar = ratingMap[attributes['loot'].lower().strip()]
            except:
                pass
    level = None
    if 'lvlknights' in attributes:
        try:
            level = int(attributes['lvlknights'])
        except:
            pass
    if 'lvlpaladins' in attributes and level == None:
        try:
            level = int(attributes['lvlpaladins'])
        except:
            pass
    if 'lvlmages' in attributes and level == None:
        try:
            level = int(attributes['lvlmages'])
        except:
            pass
    city = None
    if 'city' in attributes:
        city = attributes['city']
    if city == None and level == None:
        return False

    c.execute('SELECT * FROM HuntingPlaces WHERE LOWER(name)=?',
              (name.lower(), ))
    results = c.fetchall()

    if len(results) > 0:
        huntattribs = [name, level, expstar, lootstar, image, city].count(None)
        otherAttributes = results[0].count(None)
        if otherAttributes > huntattribs:
            c.execute('DELETE FROM HuntingPlaces WHERE LOWER(name)=?',
                      (name.lower(), ))
        else:
            print(name, 'more null values than other hunt of the same name',
                  huntattribs, otherAttributes)
            return True

    c.execute(
        'INSERT INTO HuntingPlaces (name, level, exprating, lootrating, image, city) VALUES (?,?,?,?,?,?)',
        (name, level, expstar, lootstar, image, city))
    huntingid = c.lastrowid
    if 'location' in attributes:
        locstr = attributes['location']
        index = 0
        while True:
            match = re.search(mapperRegex, locstr[index:])
            if match == None:
                break
            x = convert_x(match.groups()[0])
            y = convert_y(match.groups()[1])
            z = int(match.groups()[2])
            c.execute(
                'INSERT INTO HuntingPlaceCoordinates (huntingplaceid, x, y, z) VALUES (?,?,?,?)',
                (huntingid, x, y, z))
            index += match.end()
    index = 0
    huntcreatures[huntingid] = list()
    while True:
        match = re.search(creatureRegex, content[index:])
        if match == None: break
        creature = match.groups()[0]
        if creature not in huntcreatures[huntingid]:
            huntcreatures[huntingid].append(creature)
        index += match.end()
    index = 0
    while True:
        match = re.search(creatureRegex2, content[index:])
        if match == None: break
        creatureList = match.groups()[0].split('|')[1:]
        for creature in creatureList:
            huntcreatures[huntingid].append(creature)
        index += match.end()
    return True
from coordinates import convert_x, convert_y
# hunt directions
c.execute('DROP TABLE IF EXISTS HuntDirections')
c.execute('CREATE TABLE HuntDirections(huntingplaceid INTEGER, beginx INTEGER, beginy INTEGER, beginz INTEGER, endx INTEGER, endy INTEGER, endz INTEGER, description STRING, ordering INTEGER, settings STRING)')
root = xml.etree.ElementTree.parse(huntdirections_xmlfile).getroot()
for child in root.getchildren():
    huntingplaceid = getHuntID(child.find('Name').text)
    ordering = 0
    for direction in child.find('Directions').getchildren():
        settings = ""
        if 'SamePage' in direction.attrib and direction.attrib['SamePage'] == 'True':
            ordering -= 1
        begin = direction.find('BeginCoordinate').text.split(',')
        end = direction.find('EndCoordinate').text.split(',')
        if direction.find("BeginImage") != None:
            settings = settings + "@Marking=" + str(convert_x(begin[0])) + "," + str(convert_y(begin[1])) + "," + str(int(begin[2])) + "@MarkIcon=" + direction.find("BeginImage").text
        if direction.find("EndImage") != None:
            settings = settings + "@Marking=" + str(convert_x(end[0])) + "," + str(convert_y(end[1])) + "," + str(int(end[2])) + "@MarkIcon=" + direction.find("EndImage").text
        description = direction.find('Text').text
        c.execute('INSERT INTO HuntDirections(huntingplaceid, beginx, beginy, beginz, endx, endy, endz, description, ordering, settings) VALUES (?,?,?,?,?,?,?,?,?,?)', 
            (huntingplaceid, convert_x(begin[0]), convert_y(begin[1]), int(begin[2]), convert_x(end[0]), convert_y(end[1]), int(end[2]), description, ordering, settings))
        ordering += 1

def addChildren(parentNode, missionName):
    ordering = 0
    for instruction in parentNode.findall('Instruction'):
        if 'SamePage' in instruction.attrib and instruction.attrib['SamePage'] == 'True':
            ordering -= 1
        beginx = None
        beginy = None
        beginz = None
def addChildren(parentNode, missionName):
    ordering = 0
    for instruction in parentNode.findall('Instruction'):
        if 'SamePage' in instruction.attrib and instruction.attrib['SamePage'] == 'True':
            ordering -= 1
        beginx = None
        beginy = None
        beginz = None
        settings = ""
        if instruction.find('Markings') != None:
            averagex, averagey, averagez = (0, 0, None)
            count = 0
            for marking in instruction.find('Markings'):
                coordinate = marking.find('MarkLocation').text
                begin = coordinate.split(',')
                beginx = convert_x(begin[0])
                beginy = convert_y(begin[1])
                beginz = int(begin[2])

                settings = settings + "@Marking=" + str(beginx) + "," + str(beginy) + "," + str(beginz)
                averagex += beginx
                averagey += beginy
                if averagez == None:
                    averagez = beginz
                elif averagez != beginz:
                    raise Exception("Markings on different floors.")
                count += 1
                if marking.find("MarkIcon") != None:
                    settings = settings + "@MarkIcon=" + marking.find('MarkIcon').text
                if marking.find("MarkSize") != None:
                    settings = settings + "@MarkSize=" + str(int(marking.find('MarkSize').text))
            beginx = averagex / count
            beginy = averagey / count
            beginz = averagez
        if instruction.find("WalkableColor") != None:
            settings = settings + "@WalkableColor=" + instruction.find("WalkableColor").text

        if instruction.find('BeginCoordinate') != None:
            begin = instruction.find('BeginCoordinate').text.split(',')
            beginx = convert_x(begin[0])
            beginy = convert_y(begin[1])
            beginz = int(begin[2])
            if instruction.find("BeginImage") != None:
                settings = settings + "@Marking=" + str(beginx) + "," + str(beginy) + "," + str(beginz) + "@MarkIcon=" + instruction.find("BeginImage").text
        if instruction.find('EndCoordinate') == None:
            endx = None
            endy = None
            endz = 90
            try: endz = int(instruction.find('RectangleSize').text)
            except: pass
        else: 
            end = instruction.find('EndCoordinate').text.split(',')
            endx = convert_x(end[0])
            endy = convert_y(end[1])
            endz = int(end[2])
            if instruction.find("EndImage") != None:
                settings = settings + "@Marking=" + str(endx) + "," + str(endy) + "," + str(endz) + "@MarkIcon=" + instruction.find("EndImage").text
        description = instruction.find('Text').text
        c.execute('INSERT INTO QuestInstructions(questid, beginx, beginy, beginz, endx, endy, endz, description, ordering, missionname,settings) VALUES (?,?,?,?,?,?,?,?,?,?,?)', 
            (questid, convert_x(begin[0]), convert_y(begin[1]), int(begin[2]), endx, endy, endz, description, ordering, missionName,settings[1:] + "@" if len(settings) > 0 else None))
        ordering += 1
Ejemplo n.º 8
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import urllib.request
import sqlite3
from coordinates import convert_x, convert_y

database_file = 'database.db'

conn = sqlite3.connect(database_file)
c = conn.cursor()

c.execute('DROP TABLE IF EXISTS RashidPositions')
c.execute('CREATE TABLE RashidPositions(day STRING, city STRING, x INTEGER, y INTEGER, z INTEGER)')

x,y,z = convert_x('125.210'),convert_y('121.182'),7
c.execute('INSERT INTO RashidPositions(day, city, x, y, z) VALUES (?,?,?,?,?)', 
    ['Monday', 'Svargrond', x, y, z])

x,y,z = convert_x('126.47'),convert_y('128.67'),7
c.execute('INSERT INTO RashidPositions(day, city, x, y, z) VALUES (?,?,?,?,?)', 
    ['Tuesday', 'Liberty Bay', x, y, z])

x,y,z = convert_x('127.65'),convert_y('127.241'),7
c.execute('INSERT INTO RashidPositions(day, city, x, y, z) VALUES (?,?,?,?,?)', 
    ['Wednesday', 'Port Hope', x, y, z])

x,y,z = convert_x('129.47'),convert_y('128.117'),6
c.execute('INSERT INTO RashidPositions(day, city, x, y, z) VALUES (?,?,?,?,?)', 
    ['Thursday', 'Ankrahmun', x, y, z])
Ejemplo n.º 9
0
     name = creatures.split(';')[0] + " Task"
 count = int(task.find('Count').text)
 taskpoints = int(
     task.find('Points').text) if task.find('Points') != None else None
 boss = task.find(
     'Boss').text.strip().lower() if task.find('Boss') != None else None
 bossid = None
 if boss != None:
     c.execute(
         'SELECT id FROM Creatures WHERE LOWER(name)=? OR LOWER(title)=?',
         (boss, boss))
     bossid = c.fetchall()[0][0]
 uloc = task.find('BossLocation').text.split(
     ',') if task.find('BossLocation') != None else (None, None, None)
 if uloc[0] != None:
     uloc[0] = convert_x(uloc[0])
     uloc[1] = convert_y(uloc[1])
     uloc[2] = int(uloc[2])
 c.execute(
     'INSERT INTO Tasks(name,groupid, count, taskpoints, bossid, bossx, bossy, bossz) VALUES (?,?,?,?,?,?,?,?)',
     (name, bracketid, count, taskpoints, bossid, uloc[0], uloc[1],
      uloc[2]))
 taskid = c.lastrowid
 for creature in creatures.split(';'):
     creature = creature.strip().lower()
     print(creature)
     c.execute(
         'SELECT id FROM Creatures WHERE LOWER(name)=? OR LOWER(title)=?',
         (creature, creature))
     creatureid = c.fetchall()[0][0]
     c.execute(
Ejemplo n.º 10
0
# cities
c.execute('DROP TABLE IF EXISTS Cities')
c.execute('DROP TABLE IF EXISTS CityUtilities')
c.execute(
    'CREATE TABLE Cities(id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING, x INTEGER, y INTEGER, z INTEGER)'
)
c.execute(
    'CREATE TABLE CityUtilities(cityid INTEGER, name STRING, x INTEGER, y INTEGER, z INTEGER)'
)
root = xml.etree.ElementTree.parse(cities_xmlfile).getroot()
for child in root.getchildren():
    cityname = child.find('Name').text
    location = child.find('Location').text.split(',')
    c.execute('INSERT INTO Cities(name, x, y, z) VALUES (?,?,?,?)',
              (cityname, convert_x(location[0]), convert_y(
                  location[1]), int(location[2])))
    cityid = c.lastrowid
    utilities = child.find('Utilities')
    for utility in utilities.getchildren():
        utilityname = utility.find('Name').text
        uloc = utility.find('Location').text.split(',')
        c.execute(
            'INSERT INTO CityUtilities(cityid, name, x, y, z) VALUES (?,?,?,?,?)',
            (cityid, utilityname, convert_x(uloc[0]), convert_y(
                uloc[1]), int(uloc[2])))
    c.execute(
        'SELECT x, y, z FROM NPCs INNER JOIN BuyItems ON BuyItems.vendorid=NPCs.id AND BuyItems.itemid=? AND LOWER(city)=?',
        (parcelid, cityname.lower()))
    results = c.fetchall()
    if len(results) > 0:
Ejemplo n.º 11
0
conn = sqlite3.connect(database_file)
c = conn.cursor()

# parcel id
c.execute('SELECT id FROM Items WHERE LOWER(name)="parcel"')
parcelid = c.fetchall()[0][0]

# cities
c.execute('DROP TABLE IF EXISTS Cities');
c.execute('DROP TABLE IF EXISTS CityUtilities');
c.execute('CREATE TABLE Cities(id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING, x INTEGER, y INTEGER, z INTEGER)')
c.execute('CREATE TABLE CityUtilities(cityid INTEGER, name STRING, x INTEGER, y INTEGER, z INTEGER)')
root = xml.etree.ElementTree.parse(cities_xmlfile).getroot()
for child in root.getchildren():
    cityname = child.find('Name').text
    location = child.find('Location').text.split(',')
    c.execute('INSERT INTO Cities(name, x, y, z) VALUES (?,?,?,?)', (cityname, convert_x(location[0]), convert_y(location[1]), int(location[2])))
    cityid = c.lastrowid
    utilities = child.find('Utilities')
    for utility in utilities.getchildren():
        utilityname = utility.find('Name').text
        uloc = utility.find('Location').text.split(',')
        c.execute('INSERT INTO CityUtilities(cityid, name, x, y, z) VALUES (?,?,?,?,?)', (cityid, utilityname, convert_x(uloc[0]), convert_y(uloc[1]), int(uloc[2])))
    c.execute('SELECT x, y, z FROM NPCs INNER JOIN BuyItems ON BuyItems.vendorid=NPCs.id AND BuyItems.itemid=? AND LOWER(city)=?', (parcelid, cityname.lower()))
    results = c.fetchall()
    if len(results) > 0:
        c.execute('INSERT INTO CityUtilities(cityid, name, x, y, z) VALUES (?,?,?,?,?)', (cityid, "Post Office", results[0][0] * 2048, results[0][1] * 2304, results[0][2]))

conn.commit()
Ejemplo n.º 12
0
 name = None
 creatures = task.find('Creature').text
 if task.find('Name') != None:
     name = task.find('Name').text
 else:
     name = creatures.split(';')[0] + " Task"
 count = int(task.find('Count').text)
 taskpoints =  int(task.find('Points').text) if task.find('Points') != None else None
 boss = task.find('Boss').text.strip().lower() if task.find('Boss') != None else None
 bossid = None
 if boss != None:
     c.execute('SELECT id FROM Creatures WHERE LOWER(name)=? OR LOWER(title)=?', (boss, boss))
     bossid = c.fetchall()[0][0]
 uloc = task.find('BossLocation').text.split(',') if task.find('BossLocation') != None else (None, None, None)
 if uloc[0] != None:
     uloc[0] = convert_x(uloc[0])
     uloc[1] = convert_y(uloc[1])
     uloc[2] = int(uloc[2])
 c.execute('INSERT INTO Tasks(name,groupid, count, taskpoints, bossid, bossx, bossy, bossz) VALUES (?,?,?,?,?,?,?,?)', (name,bracketid, count, taskpoints, bossid, uloc[0], uloc[1], uloc[2]))
 taskid = c.lastrowid
 for creature in creatures.split(';'):
     creature = creature.strip().lower()
     print(creature)
     c.execute('SELECT id FROM Creatures WHERE LOWER(name)=? OR LOWER(title)=?', (creature, creature))
     creatureid = c.fetchall()[0][0]
     c.execute('INSERT INTO TaskCreatures(taskid, creatureid) VALUES (?,?)', (taskid, creatureid))
 hunts = task.find('Hunts')
 for huntchild in hunts.getchildren():
     huntname = huntchild.text.replace("_", " ").lower().strip()
     c.execute('SELECT id FROM HuntingPlaces WHERE LOWER(name)=?', (huntname,))
     results = c.fetchall()