def main(cursor): equipment_dict = equipment_q.get_equipment_of_type(cursor, equipment.cat_list.index('Boat hull')) count = -1 output = [""" <table border="0" cellspacing="0" cellpadding="5"> <tr class="row2"> <th>Hull</th> <th>Material cost</th> <th>Point cost</th> <th>Crew</th> <th>Transport capacity</th> </tr> """] for e, the_equipment in equipment_dict.items(): if the_equipment.public == False: continue count+=1 the_cost = res_dict.Res_dict(the_equipment.cost) # Equipment output output.append(""" <tr class="row%(count)s"> <td>%(hull)s</td> <td>%(materials)s</td> <td>%(points)s</td> <td>%(crew)s</td> <td>%(transport)s</td> </tr>""" % { "count": count%2, "hull": the_equipment.name, "materials": the_cost.get("Materials"), "points": the_cost.get("Ship points"), "crew": the_equipment.crew, "transport": the_equipment.transport, }) output.append("</table>") return "".join(output)
def main(cursor): category = common.get_val("category", "Beast") equipment_dict = equipment_q.get_equipment_of_type(cursor, equipment.cat_list.index(category)) output = [] for e, the_eq in equipment_dict.items(): if the_eq.description == "": continue location = "" if the_eq.continent > 0: if the_eq.terrain > 0: location = "<br /><em>Found on %s in %s terrain</em>" % (continent_list.data_list[the_eq.continent], map_data.terrain[the_eq.terrain]) else: location = "<br /><em>Found on %s</em>" % continent_list.data_list[the_eq.continent].name else: if the_eq.terrain > 0: location = "<br /><em>Found in %s terrain</em>" % map_data.terrain[the_eq.terrain] output.append(""" <span class="stitle">%(name)s</span> - Cost: %(cost)s<br /> %(description)s %(location)s <br /><br /> """ % { "name": the_eq.name, "cost": res_dict.Res_dict(the_eq.cost).get("Materials"), "description": the_eq.description.replace("\n", "<br />"), "location": location, }) return "".join(output)