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"]))
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"]))
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"]))
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"]))