Exemple #1
0
def pz_locked(pageContext):
    curtime = int(time.time())
    #curtime = 1267240000
    world = pageContext.get_selected_world()
    doc = pageContext.htmldoc
    with doc.open_tag("table"):
        with doc.open_tag("tr", inline=False):
            if not world:
                doc.add_tag("th", "World")
            doc.add_tag("th", "PZL left")
            doc.add_tag("th", "Killer")
            doc.add_tag("th", "Level")
            doc.add_tag("th", "Vocation")
            doc.add_tag("th", "Guild")
            doc.add_tag("th", "Last Victim")
        for pzlock in dbiface.get_pzlocks(curtime=curtime):
            killerInfo = dbiface.get_char(pzlock["killer"])
            if world is None or killerInfo["world"] == world:
                with doc.open_tag("tr", inline=False):
                    assert killerInfo["name"] == pzlock["killer"]
                    if not world:
                        doc.add_tag("td", killerInfo["world"])
                    doc.add_tag("td", "{0} mins".format((dbiface.pz_end(pzlock) - curtime) // 60))
                    doc.add_tag("td", char_link(pzlock["killer"]))
                    for field in ("level", "vocation"):
                        doc.add_tag("td", killerInfo[field])
                    doc.add_tag("td", pageContext.guild_link(killerInfo["guild"]))
                    doc.add_tag("td", char_link(pzlock["victim"]))
Exemple #2
0
def pz_locked(pageContext):
    curtime = int(time.time())
    #curtime = 1267240000
    world = pageContext.get_selected_world()
    doc = pageContext.htmldoc
    with doc.open_tag("table"):
        with doc.open_tag("tr", inline=False):
            if not world:
                doc.add_tag("th", "World")
            doc.add_tag("th", "PZL left")
            doc.add_tag("th", "Killer")
            doc.add_tag("th", "Level")
            doc.add_tag("th", "Vocation")
            doc.add_tag("th", "Guild")
            doc.add_tag("th", "Last Victim")
        for pzlock in dbiface.get_pzlocks(curtime=curtime):
            killerInfo = dbiface.get_char(pzlock["killer"])
            if world is None or killerInfo["world"] == world:
                with doc.open_tag("tr", inline=False):
                    assert killerInfo["name"] == pzlock["killer"]
                    if not world:
                        doc.add_tag("td", killerInfo["world"])
                    doc.add_tag(
                        "td", "{0} mins".format(
                            (dbiface.pz_end(pzlock) - curtime) // 60))
                    doc.add_tag("td", char_link(pzlock["killer"]))
                    for field in ("level", "vocation"):
                        doc.add_tag("td", killerInfo[field])
                    doc.add_tag("td",
                                pageContext.guild_link(killerInfo["guild"]))
                    doc.add_tag("td", char_link(pzlock["victim"]))
Exemple #3
0
def pz_locked(doc, pageContext):
    world = pageContext.get_selected_world()
    curtime = int(time.time())
    limits = (0, 30)
    #limits = (0, 200)
    doc.add_tag(
        "p",
        data=
        "Players sorted by descending protection zone lock time remaining. Also shown is their level, vocation, guild, and most recent victim. Shown first are those that are still PZL'd. The second table contains those that should have lost their PZL by now."
    )
    column_count = 6
    if not world:
        column_count += 1
    with stattab_table_tag(doc.open_tag):

        def add_header_row():
            with doc.open_tag("tr", inline=False):
                if not world:
                    doc.add_tag("th", "World")
                doc.add_tag("th", "PZ Lock End")
                doc.add_tag("th", "Killer")
                doc.add_tag("th", "Level")
                doc.add_tag("th", "Vocation")
                doc.add_tag("th", "Guild")
                doc.add_tag("th", "Last Victim")

        add_header_row()
        rowColor = stattab_row_class()
        doing_still_pzlocked_rows = True
        for pzlock in dbiface.get_last_pzlocks(world, limits):
            killerInfo = dbiface.get_char(pzlock["killer"])
            #pdb.set_trace()
            pzEndStamp = dbiface.pz_end(pzlock)
            if doing_still_pzlocked_rows:
                if pzEndStamp < int(time.time()):
                    doing_still_pzlocked_rows = False
                    with doc.open_tag("tr"):
                        with doc.open_tag("td",
                                          attrs={"colspan": column_count}):
                            doc.add_tag("hr")
                    add_header_row()
            if world is None or killerInfo["world"] == world:
                rowAttrs = {"class": rowColor.next()}
                if not doing_still_pzlocked_rows:
                    rowAttrs["class"] += " greyed"
                with doc.open_tag("tr", attrs=rowAttrs, inline=False):
                    assert killerInfo["name"] == pzlock["killer"]
                    if not world:
                        doc.add_tag("td", killerInfo["world"])
                    doc.add_tag("td", human_time_diff(pzEndStamp))
                    doc.add_tag("td", char_link(pzlock["killer"]))
                    for field in ("level", "vocation"):
                        doc.add_tag("td", killerInfo[field])
                    doc.add_tag("td",
                                pageContext.guild_link(killerInfo["guild"]))
                    doc.add_tag("td", char_link(pzlock["victim"]))
Exemple #4
0
def pz_locked(doc, pageContext):
    world = pageContext.get_selected_world()
    curtime = int(time.time())
    limits = (0, 30)
    #limits = (0, 200)
    doc.add_tag("p", data="Players sorted by descending protection zone lock time remaining. Also shown is their level, vocation, guild, and most recent victim. Shown first are those that are still PZL'd. The second table contains those that should have lost their PZL by now.")
    column_count = 6
    if not world:
        column_count += 1
    with stattab_table_tag(doc.open_tag):
        def add_header_row():
            with doc.open_tag("tr", inline=False):
                if not world:
                    doc.add_tag("th", "World")
                doc.add_tag("th", "PZ Lock End")
                doc.add_tag("th", "Killer")
                doc.add_tag("th", "Level")
                doc.add_tag("th", "Vocation")
                doc.add_tag("th", "Guild")
                doc.add_tag("th", "Last Victim")
        add_header_row()
        rowColor = stattab_row_class()
        doing_still_pzlocked_rows = True
        for pzlock in dbiface.get_last_pzlocks(world, limits):
            killerInfo = dbiface.get_char(pzlock["killer"])
            #pdb.set_trace()
            pzEndStamp = dbiface.pz_end(pzlock)
            if doing_still_pzlocked_rows:
                if pzEndStamp < int(time.time()):
                    doing_still_pzlocked_rows = False
                    with doc.open_tag("tr"):
                        with doc.open_tag("td", attrs={"colspan": column_count}):
                            doc.add_tag("hr")
                    add_header_row()
            if world is None or killerInfo["world"] == world:
                rowAttrs = {"class": rowColor.next()}
                if not doing_still_pzlocked_rows:
                    rowAttrs["class"] += " greyed"
                with doc.open_tag("tr", attrs=rowAttrs, inline=False):
                    assert killerInfo["name"] == pzlock["killer"]
                    if not world:
                        doc.add_tag("td", killerInfo["world"])
                    doc.add_tag("td", human_time_diff(pzEndStamp))
                    doc.add_tag("td", char_link(pzlock["killer"]))
                    for field in ("level", "vocation"):
                        doc.add_tag("td", killerInfo[field])
                    doc.add_tag("td", pageContext.guild_link(killerInfo["guild"]))
                    doc.add_tag("td", char_link(pzlock["victim"]))
Exemple #5
0
def update_incomplete_chars(world=None):
    for char in dbiface.get_all_chars(world):
        #print char
        charName = char["name"]
        assert charName
        if _char_incomplete(char):
            logging.info("Updating %r", charName)
            try:
                newCharName = dbiface.update_char(charName)
            except tibiacom.CharDoesNotExist as e:
                assert e.args[0] == charName
                logging.warning("Character %r does not exist", charName)
            else:
                newCharRow = dbiface.get_char(newCharName)
                #print newCharRow
                assert not _char_incomplete(newCharRow), newCharRow
Exemple #6
0
def update_incomplete_chars(world=None):
    for char in dbiface.get_all_chars(world):
        #print char
        charName = char["name"]
        assert charName
        if _char_incomplete(char):
            logging.info("Updating %r", charName)
            try:
                newCharName = dbiface.update_char(charName)
            except tibiacom.CharDoesNotExist as e:
                assert e.args[0] == charName
                logging.warning("Character %r does not exist", charName)
            else:
                newCharRow = dbiface.get_char(newCharName)
                #print newCharRow
                assert not _char_incomplete(newCharRow), newCharRow