Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def besteAngreiferJedesTypsUpdaten():
- #Aktualisiert die besten Angreifer jedes Typs (https://pokefans.net/spiele/pokemon-go/beste-angreifer-jedes-typs)
- daten = jsonOeffnen()
- besteAngreifer = ""
- for typ in ["Boden","Drache","Eis","Elektro","Fee","Feuer","Flug","Geist","Gift","Gestein","Kampf","Käfer","Normal","Pflanze","Psycho","Stahl","Unlicht","Wasser"]:
- movesetsDesTypen = []
- for p in pokemon:
- for m in daten["pokemon"][p]["movesetsZweier"]:
- if (daten["attacken"][m[2]]["typ"] == slugify(typ) and daten["attacken"][m[3]]["typ"] == slugify(typ)):
- movesetsDesTypen.append([p]+m)
- movesetsDesTypen = sorted(movesetsDesTypen,key=lambda x: x[8], reverse=True)
- i = 1
- if len(movesetsDesTypen) < 20:
- anzahl = len(movesetsDesTypen)
- else:
- anzahl = 20
- besteAngreifer += "<h2 id=\""+slugify(typ)+"\">Die "+str(anzahl)+" besten "+typ+"-Angreifer</h2>\n<div class=\"table-responsive\">\n\t<table class=\"centered-v\">\n\t\t<tr class=\"head\">\n\t\t\t<td>Rang</td>\n\t\t\t<td colspan=\"2\">Pokémon</td>\n\t\t\t<td>Sofort-Attacke</td>\n\t\t\t<td>Lade-Attacke</td>\n\t\t\t<td>Potenzial</td>\n\t\t\t<td>Def.</td>\n\t\t</tr>"
- while i < 21:
- if i == 1:
- firstPlace = movesetsDesTypen[i-1][8]
- if len(movesetsDesTypen) >= i:
- percent = str(int(((movesetsDesTypen[i-1][8] / firstPlace) * 100)))
- stats = daten["pokemon"][movesetsDesTypen[i-1][0]]["statuswerte"]
- tankiness = stats["kp"] * stats["vert"]
- if tankiness > 35000: farbe = "gruen"
- else:
- if tankiness > 25000: farbe = "gelb"
- else: farbe = "rot"
- besteAngreifer += "\t\t<tr>\n\t\t\t<td>"+str(i)+"</td>\n\t\t\t<td>{icon:"+iconify(movesetsDesTypen[i-1][0])+";}</td>\n\t\t\t<td>{pokemongo:"+movesetsDesTypen[i-1][0]+";}</td>\n\t\t\t<td><a href=\"https://pokefans.net/spiele/pokemon-go/attacken/"+slugify(movesetsDesTypen[i-1][1])+"\">"+movesetsDesTypen[i-1][1]+"</a></td>\n\t\t\t<td><a href=\"https://pokefans.net/spiele/pokemon-go/attacken/"+slugify(movesetsDesTypen[i-1][2])+"\">"+movesetsDesTypen[i-1][2]+"</a></td>\n\t\t\t<td>"+percent+"%</td>\n\t\t\t<td><span class=\"point point-"+farbe+"\"></span></td>\n\t\t</tr>"
- i += 1
- besteAngreifer += "\n\t</table>\n</div>\n\n"
- content = Content(id=6333)
- content.code = re.sub("<!--Begin List-->(.*?)<!--End List-->","<!--Begin List-->"+besteAngreifer+"<!--End List-->",content.code,flags=re.DOTALL)
- content.save()
- print("Liste der besten Angreifer je Typ erfolgreich aktualisiert.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement