Esempio n. 1
0
html_string += "</table>"

html_string += "<h1>Estimated total amounts collected next day</h1>\n"
html_string += "<table>\n"

for key in totals.keys():
    if key == "money":
        html_string += "<tr>\n<td>\n"+money_string+"\n</td>\n<td>\n"+"{:,}".format(totals[key]*12)+"\n</td>\n</tr>\n"
    else:
        html_string += "<tr>\n<td>\n<img src='"+img_dict[key]+"'>\n</td>\n<td>\n"+"{:,}".format(totals[key]*12)+"\n</td>\n</tr>\n"

html_string += "</table>"

total_money_value = totals['money']

for item_type in realstring_dict.keys():
    item_value = realstring_dict[item_type]
    trade_url = "https://politicsandwar.com/index.php?id=90&display=world&resource1="+item_value+"&buysell=buy&ob=price&od=DESC&maximum=15&minimum=0&search=Go"
    nationtable = pwc._retrieve_nationtable(trade_url, 0)
    trade_tr = nationtable.findall(".//tr")[1]
    trade_td = trade_tr.findall(".//td")[5]
    trade_text = trade_td[0].text
    trade_num = int(trade_text.split("/")[0].replace(",",""))
    total_money_value += trade_num * totals[item_type]

html_string += "\n<h1>Estimated total value collected this turn: "+money_string+"{:,}".format(total_money_value)+"</h1>\n"
html_string += "\n<h1>Estimated total value to collect today: "+money_string+"{:,}".format(total_money_value * 12)+"</h1>\n"
html_string += "<h4>Note: this value is calculated by taking the current 'buy' trading prices and multiplying them by the amount of resources collected this turn.</h4>"

print html_string