Пример #1
0
async def StateWars(context):

    days = context.message.content
    days = days.replace("!StateWars", "")
    days = days.strip()
    days = int(days)

    parteiliste = await getPartys()

    stateschannel = discord.Object(id='533606135912071169')
    stateids = []
    async for n in client.logs_from(stateschannel, 100):
        n = n.content
        n = n.split(":")
        n = n[1].strip()
        stateids.append(n)

    warbase = "http://rivalregions.com/listed/partydamage/"

    TotalWars = 0
    Totalwarurllist = []

    for stateid in stateids:
        Totalwarurllist.extend(await rrDamage.getStateWars7d(stateid, days))
    # for id in stateids:
    #     warlist= await rrDamage.getStateWars(id,days)
    #     for war in warlist:
    #         warurl= warbase + war
    #         Totalwarurllist.append(warurl)
    #         TotalWars+=1

    for i, war in enumerate(Totalwarurllist):
        Totalwarurllist[i] = warbase + war

    GesamtDamage, partydictRawDmg, partydictPerDmg = await rrDamage.MultiWar(
        Totalwarurllist, parteiliste)

    #for x in partydictRawDmg:
    #    if partydictRawDmg[x] > 100000000:
    #        await client.say(x + ": " + rrDamage.MakeNumber2PrettyString(partydictRawDmg[x]) + "\n")
    Msg1 = "Gesamtschaden der Hanse in eigenen Kriegen(%d) während der letzten %d Tage: " % (
        TotalWars,
        days) + rrDamage.MakeNumber2PrettyString(GesamtDamage) + "\n\n"
    Msg2 = "Roher Schaden der Parteien:\n"
    Msg3 = "\nProzentualer Schaden der Parteien:\n"
    for j in partydictRawDmg:
        Msg2 += j + ": " + rrDamage.MakeNumber2PrettyString(
            partydictRawDmg[j]) + '\n'
    for i in partydictPerDmg:
        Msg3 += i + ": " + str(round(partydictPerDmg[i], 2)) + "%\n"
    await client.say(Msg1 + Msg2 + Msg3)
Пример #2
0
async def AllDonations(context):
    author = context.message.author

    days = context.message.content
    days = days.replace("!AllDonations", "")
    days = days.strip()
    days = int(days)
    parteiliste = await getPartys()

    stateschannel = discord.Object(id='533606135912071169')
    stateids = []
    async for n in client.logs_from(stateschannel, 100):
        n = n.content
        n = n.split(":")
        n = n[1].strip()
        stateids.append(n)

    partydon = {}
    counter = 1
    Gesamtspendenvolumen = 0

    marktdict = await rrDamage.getMarktPreise()
    await client.say("Starte Analyse")
    for state in stateids:
        await client.say("Analysiere Staat %d" % counter)
        print("Staat Nr.%d: " % counter + state)
        tempdict = await rrDamage.getStateDonations(state, parteiliste,
                                                    profildict, marktdict,
                                                    days)
        print("Staat beendet")
        counter += 1
        for p in tempdict:
            Gesamtspendenvolumen = Gesamtspendenvolumen + tempdict[p]
            if p in partydon:
                partydon[p] = partydon[p] + tempdict[p]
            else:
                partydon[p] = tempdict[p]
    await client.say("Analyse abgeschlossen")
    print("Alle Staaten beendet")
    partydonPro = {}

    Msg1 = "Gesamtspenden der Staaten während der letzten %d Tage: " % days + rrDamage.MakeNumber2PrettyString(
        Gesamtspendenvolumen) + "\n\n"
    Msg2 = "Spendenvolumen der Parteien:\n"
    for j in partydon:
        Msg2 += j + ": " + rrDamage.MakeNumber2PrettyString(partydon[j]) + '\n'

    await asyncio.shield(
        client.send_message(context.message.channel, Msg1 + Msg2))
Пример #3
0
async def WarListPlayerAnalyse(context):
    parteiliste = await getPartys()

    warchannel = discord.Object(id='505500419221618729')
    warliste = []
    async for n in client.logs_from(warchannel, 100):
        warliste.append(n.content)

    urlplayer = {}
    spielerdict, urlplayer = await rrDamage.MultiplayerDmg(
        warliste, profildict, parteiliste, urlplayer)

    # Msg2= "Roher Schaden der Spieler:\n"
    # for j in spielerdict:
    #     Msg2 += j + ": " + rrDamage.MakeNumber2PrettyString(spielerdict[j])+ '\n' + "SpielerURL: " + urlplayer[j] + '\n\n'
    # await client.say(Msg2)

    Msg3 = "\n \n Spieler:\n"
    for j in spielerdict:
        name = j.replace("[MSU]", "")
        name = name.strip()
        Msg3 += name + "\n"
    Msg3 = Msg3 + "\n" + "Schaden:\n"
    for j in spielerdict:
        Msg3 += rrDamage.MakeNumber2PrettyString(spielerdict[j]) + "\n"
    Msg3 = Msg3 + "\n" + "URL:\n"
    for j in spielerdict:
        Msg3 += urlplayer[j] + "\n"

    await client.say(Msg3)
Пример #4
0
async def WarListPartyAnalyse(context):
    parteiliste = await getPartys()

    warchannel = discord.Object(id='505500419221618729')
    warliste = []
    async for n in client.logs_from(warchannel, 100):
        warliste.append(n.content)

    GesamtDamage,partydictRawDmg,partydictPerDmg = await rrDamage.MultiWar(warliste,parteiliste)

    #for x in partydictRawDmg:
    #    if partydictRawDmg[x] > 100000000:
    #        await client.say(x + ": " + rrDamage.MakeNumber2PrettyString(partydictRawDmg[x]) + "\n")
    Msg1= "Gesamtschaden der Partei(en): " + rrDamage.MakeNumber2PrettyString(GesamtDamage) + "\n\n"
    Msg2= "Roher Schaden der Parteien:\n"
    for j in partydictRawDmg:
        Msg2 += j + ": " + rrDamage.MakeNumber2PrettyString(partydictRawDmg[j])+ '\n'
    await client.say(Msg1 + Msg2)
Пример #5
0
async def agnwarranking(context):
    war = context.message.content
    war = war.replace("!agnwarranking", "")
    war = war.strip()
    war = war.split(",")

    try:
        staaten = await getNations()

        partymember = await rrDamage.getNationPartys(staaten)

        gesamtdamage, partydamage, percentdmg = await rrDamage.MultiWar(
            war, partymember)
    except:
        print("exception occured")
        await client.say("Bad Connection. Versuche es nochmal.")
    #
    # u50partydict, u25partydict = []
    # for p in partymember:
    #     if int(partymember[p]) < 50:
    #         u50partydict.append(p)
    #     if int(partymember[p]) < 25:
    #         u25partydict.append(p)

    output1 = "Top Ten Parteien U20. \n"
    output2 = "---- \n Top Ten Parteien U35. \n"
    output3 = "---- \n Top Ten Parteien Overall. \n"
    c1 = 0
    c2 = 0
    c3 = 0

    listofTuples = sorted(partydamage.items(),
                          reverse=True,
                          key=operator.itemgetter(1))
    print("check")
    print(listofTuples)
    print(partymember)
    for e in listofTuples:
        if c1 < 16:
            output3 += str(
                c1 +
                1) + ". " + e[0] + ": " + rrDamage.MakeNumber2PrettyString(
                    e[1]) + "--- Mitglieder: " + str(partymember[e[0]]) + "\n"
            c1 += 1
        if c2 < 16 and partymember[e[0]] < 35:
            output2 += str(
                c2 +
                1) + ". " + e[0] + ": " + rrDamage.MakeNumber2PrettyString(
                    e[1]) + "--- Mitglieder: " + str(partymember[e[0]]) + "\n"
            c2 += 1
        if c3 < 16 and partymember[e[0]] < 20:
            output1 += str(
                c3 +
                1) + ". " + e[0] + ": " + rrDamage.MakeNumber2PrettyString(
                    e[1]) + "--- Mitglieder: " + str(partymember[e[0]]) + "\n"
            c3 += 1
        if c3 == 16:
            output1 += "\n\n"
            output2 += "\n\n"
            output3 += "\n\n"
            break
    print("cheko")
    await client.say(output1)
    await client.say(output2)
    await client.say(output3)
Пример #6
0
async def agnwartabelle(context):

    spieltag = 1

    blacklist = []
    blacklist.append("Army of Farmers")

    war = context.message.content
    war = war.replace("!agnwartabelle", "")
    war = war.strip()
    war = war.split(",")

    #try:
    staaten = await getNations()

    partymember = await rrDamage.getNationPartys(staaten)

    gesamtdamage, partydamage, percentdmg = await rrDamage.MultiWar(
        war, partymember)
    #except:
    #    print("exception occured")
    #    await client.say ("Bad Connection. Versuche es nochmal.")
    #
    # u50partydict, u25partydict = []
    # for p in partymember:
    #     if int(partymember[p]) < 50:
    #         u50partydict.append(p)
    #     if int(partymember[p]) < 25:
    #         u25partydict.append(p)

    x = 0
    for o in partydamage:
        if x < len(o):
            x = len(o)

    head = "  Team   " + (
        " " * x) + "   | 1 | 2 | 3 | 4 | 5 || Punkte | Gesamtschaden \n"
    seperator = ("-" * x) + "+---+---+---+---++---------+-----\n"

    output1 = "Top Ten Parteien U20. \n" + head + seperator
    output2 = "---- \n Top Ten Parteien U35. \n" + head + seperator
    output3 = "---- \n Top Ten Parteien Overall. \n" + head + seperator
    c1 = 0
    c2 = 0
    c3 = 0

    listofTuples = sorted(partydamage.items(),
                          reverse=True,
                          key=operator.itemgetter(1))
    print("check")
    print(listofTuples)
    print(partymember)

    for e in listofTuples:
        if c1 < 10 and e[0] not in blacklist:
            #abstand = x - len(e[0])
            output3 += str(c1 + 1) + ". " + e[0] + "\n" + (" " * (
                x + 16)) + "| " + str(10 - c1) + " | x | x | x | x ||  " + str(
                    10 - c1) + "    | " + rrDamage.MakeNumber2PrettyString(
                        e[1]) + "\n" + seperator
            c1 += 1
        if c2 < 10 and partymember[e[0]] < 35 and e[0] not in blacklist:
            #abstand = x - len(e[0])
            output2 += str(c2 + 1) + ". " + e[0] + "\n" + (" " * (
                x + 16)) + "| " + str(10 - c2) + " | x | x | x | x ||  " + str(
                    10 - c2) + "    | " + rrDamage.MakeNumber2PrettyString(
                        e[1]) + "\n" + seperator
            c2 += 1
        if c3 < 10 and partymember[e[0]] < 20 and e[0] not in blacklist:
            #abstand = x - len(e[0])
            output1 += str(c3 + 1) + ". " + e[0] + "\n" + (" " * (
                x + 16)) + "| " + str(10 - c3) + " | x | x | x | x ||  " + str(
                    10 - c3) + "    | " + rrDamage.MakeNumber2PrettyString(
                        e[1]) + "\n" + seperator
            c3 += 1
        if c3 == 13:
            output1 += "\n\n"
            output2 += "\n\n"
            output3 += "\n\n"
            break
    print("cheko")
    await client.say(output1)
    await client.say(output2)
    await client.say(output3)