What are the levels of the Gladiators of the players in my guild?

Several days ago my guild leader @xsuilx asked in our guild chat whether after getting our store to lvl 8, we should aim to upgrade our barracks to lvl 7. That would enable our guild members to use gladiators at gold lvl in brawls. Our guild [KoG] Guardians of Glory is currently brawling in tier 4 and we have been regularly placing among top 3 in brawls. As we all know the Gladiators are very important in brawls and being able to use them at the highest possible lvl is crucial. But the question is do we even have players with gold lvl Gladiators that would benefit from the barracks upgrade and if so how many?

In order to answer this question I wrote a simple python code. A big help came from the post written by @slobberchops a while ago, which introduced and opened the whole api world to me. From there on and by going through the Splinterlands discord developers-3rd-party channel, I was able to come up with the code below. Perhaps it could be useful to other guilds as well, just find your guild id and replace it in the second line of the code.

Getting the list of guild members

The first step is to figure out and get a list of the members in my guild. For this I used the guild api, where I had to find our guild id. Going into our guild page I was able to find it.

finding_guild_id.png

The Kingdom of Glory family of guilds has the following ids:

  • Guardians of Glory
    guild_id = "cb84ca426dcb7c8ba072c759b39cf459d4cf7669"
  • Shield of Glory
    guild_id = "e44cee2650de14f2cf00fa540ab6cdec32882271"
  • No Guts no Glory
    guild_id = "04928129f3011422ec7bcfd7ca59aa4beee920a5"
  • Aegis of Glory
    guild_id = "0f886154be77fbe157547c7058af16a501e0d614"
  • Cards of Fury
    guild_id = "58521eec4a0dec0feff365097e027c208f6f06ae"

For some reason the api returns more players than just the current ones, I guess the previous members are still kept in. Thus I just cut out the full list and keep the first 30 members. If your guild has x members just replace the number 30 with x. The following code does the job:


import json, requests

guild_id = "cb84ca426dcb7c8ba072c759b39cf459d4cf7669"
guild_url = "https://api2.splinterlands.com/guilds/members?guild_id=" + guild_id
guild_data = json.loads(requests.get(guild_url).text)

players = []
for data in guild_data:
    players.append(data["player"])

print(players[0:30])


And the output is:
['jayemm', 'demon19', 'idmr500', 'textcrawl', 'quasar007', 'choi2edge', 'shadowwolf888', 'jaminn', 'andrewyaplah', 'ding3435', 'jedielf', 'jayemm3', 'white-walker-13', 'flavianoramos', 'imperij4427', 'spiritblade', 'robo-mage', 'shirlsprint', 'donpapy', 'vmetelz2', 'tradyscho1', 'hyde-20', 'good-game', 'kimchiiiii', 'metafurico', 'cezbot', 'th13-fu', 'bandano', 'sleeper12go', 'arch-mage']

Gladiator card info, id and name

Next I want to get the information on the Gladiators. The following api gets the details on all the spl cards. After a quick look at Peakmonsters I was able to figure out that the gladiators are edition 6, so I only need those.


all_cards_url = "https://api.splinterlands.com/cards/get_details"
all_cards = json.loads(requests.get(all_cards_url).text)

glad_id = []
glad_name = []
for cards in all_cards:
    if cards["editions"] == '6':
       glad_id.append(cards["id"])
       glad_name.append(cards["name"])

print(glad_name)


And the output gives the order of the Gladiators:
['Chimney Wallstop', 'Krash Wanderford', 'Orella Abadon', 'Sarius', 'Gorth', 'Fina Voxom', 'Alva the Crusher', 'Isgald Vorst', 'Alfredo', 'Relenor Cleaver', 'Edith Emberstar', 'Flagulon Reine', 'Bertrol Gobson', 'Katrelba Gobson', 'Cutter Brieze', 'Palidon Rakk', 'Quora Towershead', 'Jini Guise', 'Helmet Kharafax', 'Hugo Strongsword', 'Ajax Lightfoot', 'Captain Katie', 'Marisol Contuma', 'Sola Ranjell', 'Whistling Damon', 'Witch of Warwick', 'Kotriphus Bayne', 'Liza Fox', 'Trapp Falloway', 'Xulax Nightwind', 'Larissa Kerato', 'Tatiana Blayde']

Counting the bcx of all the Gladiators of Guardians of Glory

Now we are ready for the final step, which is counting the bcx of the gladiator cards of all the players in the guild. The following api: https://api2.splinterlands.com/cards/collection/@white-walker-13 gives all the cards of a player named @white-walker-13 . So I loop over all the players in my guild and sum the bcx values of each of the Gladiator card (golds and regulars). The bcx of each card in cards is given as cards["xp"]. This part can take a bit of time, because it goes through the whole card collection of each player. So for the OGs it might take a minute or a few. For my guild it takes about 30 seconds. Perhaps there is a faster way to do it, so feel free to write it in the comments if you know it.


for player in players[0:30]:
    cards_collection_url = "https://api2.splinterlands.com/cards/collection/" + player
    cards_data = json.loads(requests.get(cards_collection_url).text)

    gold_gladiators = [0 for x in range(len(glad_id))]
    reg_gladiators = [0 for x in range(len(glad_id))]

    for cards in cards_data["cards"]:
       for i, gid in enumerate(glad_id):
          if cards["card_detail_id"] == gid:
             if cards["gold"] == True:
                gold_gladiators[i] += cards["xp"]
             else:
                reg_gladiators[i] += cards["xp"]

    print(player)
    print(gold_gladiators)
    print(reg_gladiators)


The Result

After a short while we get the result. After the name of the player, there is a list of the total bcx of the gold Gladiators and then the regular Gladiators. The presentation here is not sexy, but the basic task is done. From here on I let the eager readers play with it.

jayemm
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
[7, 10, 7, 1, 1, 0, 9, 7, 3, 2, 2, 0, 7, 13, 6, 3, 1, 1, 9, 3, 6, 5, 1, 0, 12, 10, 3, 2, 0, 1, 0, 0]
demon19
[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
[17, 9, 6, 7, 5, 0, 15, 19, 7, 6, 5, 0, 13, 9, 2, 4, 3, 0, 19, 14, 1, 7, 4, 0, 12, 17, 2, 7, 1, 1, 1, 0]
idmr500
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[8, 9, 2, 3, 1, 0, 10, 6, 3, 3, 1, 0, 3, 7, 4, 1, 4, 0, 1, 8, 5, 1, 0, 0, 7, 7, 4, 2, 0, 0, 0, 0]
textcrawl
[2, 3, 0, 1, 1, 0, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0]
[67, 60, 19, 23, 8, 5, 60, 75, 23, 15, 8, 0, 77, 80, 31, 34, 10, 2, 73, 61, 20, 32, 8, 3, 82, 64, 15, 16, 10, 5, 4, 4]
quasar007
[0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0]
[37, 43, 16, 18, 4, 1, 41, 41, 24, 18, 9, 0, 48, 47, 21, 12, 6, 0, 45, 42, 11, 17, 3, 0, 54, 41, 13, 18, 3, 2, 1, 0]
choi2edge
[2, 2, 1, 0, 1, 0, 3, 6, 2, 1, 0, 0, 5, 4, 0, 1, 0, 0, 4, 3, 1, 2, 0, 0, 1, 5, 0, 2, 1, 0, 0, 0]
[66, 63, 24, 26, 10, 0, 60, 63, 31, 35, 10, 1, 68, 55, 29, 14, 3, 2, 74, 76, 24, 19, 11, 1, 54, 64, 25, 31, 6, 4, 2, 2]
shadowwolf888
[1, 4, 0, 0, 0, 0, 2, 4, 2, 2, 0, 0, 2, 4, 2, 1, 1, 0, 5, 3, 0, 1, 1, 0, 3, 5, 2, 0, 4, 1, 1, 0]
[120, 136, 49, 49, 19, 3, 135, 124, 50, 40, 20, 4, 135, 120, 50, 42, 15, 8, 130, 109, 48, 51, 23, 4, 128, 109, 45, 42, 17, 6, 4, 4]
jaminn
[0, 0, 1, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[28, 41, 15, 8, 2, 1, 34, 38, 14, 7, 0, 3, 32, 31, 9, 18, 2, 0, 32, 30, 15, 12, 2, 2, 36, 29, 10, 14, 2, 0, 0, 1]
andrewyaplah
[2, 0, 1, 0, 0, 0, 5, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 3, 3, 1, 0, 0, 0, 0, 0]
[61, 64, 15, 21, 8, 2, 63, 54, 25, 26, 7, 2, 69, 67, 20, 18, 4, 3, 51, 58, 30, 19, 8, 2, 59, 52, 32, 19, 5, 1, 3, 0]
ding3435
[0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0]
[17, 24, 8, 11, 2, 0, 20, 23, 7, 10, 4, 0, 25, 24, 11, 11, 2, 0, 18, 22, 4, 7, 3, 1, 21, 21, 7, 3, 6, 1, 1, 1]
jedielf
[0, 0, 1, 0, 0, 0, 2, 1, 0, 1, 0, 0, 2, 3, 0, 0, 1, 0, 3, 4, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 1, 0]
[71, 62, 25, 23, 6, 4, 67, 62, 24, 20, 9, 4, 61, 64, 30, 25, 6, 4, 71, 49, 24, 25, 10, 5, 63, 70, 28, 20, 7, 1, 3, 3]
jayemm3
[2, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 3, 3, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 3, 0, 0, 1, 0, 0, 0]
[68, 61, 34, 25, 12, 1, 69, 74, 29, 19, 13, 2, 67, 81, 27, 25, 3, 1, 77, 75, 28, 21, 3, 0, 69, 74, 25, 25, 9, 1, 2, 1]
white-walker-13
[2, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 2, 3, 0, 0, 0, 0, 0, 0]
[63, 51, 29, 25, 6, 0, 51, 58, 24, 32, 7, 0, 69, 68, 26, 25, 9, 1, 48, 73, 28, 21, 5, 1, 49, 60, 19, 22, 5, 1, 0, 2]
flavianoramos
[2, 2, 0, 2, 1, 0, 2, 0, 0, 0, 0, 0, 3, 0, 0, 2, 0, 0, 3, 2, 1, 1, 0, 0, 1, 3, 2, 1, 0, 0, 0, 0]
[62, 69, 25, 31, 8, 0, 85, 64, 26, 25, 8, 6, 65, 70, 27, 20, 7, 1, 61, 73, 13, 29, 7, 2, 75, 68, 25, 20, 7, 2, 2, 4]
imperij4427
[2, 2, 0, 0, 0, 0, 2, 1, 1, 0, 0, 0, 2, 0, 0, 1, 0, 0, 1, 2, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0]
[53, 48, 14, 19, 13, 0, 54, 46, 26, 12, 5, 1, 65, 42, 17, 24, 10, 0, 45, 51, 23, 11, 8, 0, 52, 49, 17, 21, 3, 0, 3, 1]
spiritblade
[0, 1, 1, 0, 0, 0, 2, 3, 1, 0, 0, 0, 3, 2, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0]
[41, 29, 13, 11, 4, 1, 30, 30, 13, 10, 4, 0, 30, 30, 12, 16, 2, 0, 41, 37, 16, 8, 3, 0, 30, 36, 13, 11, 4, 0, 0, 1]
robo-mage
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 2, 3, 0, 0, 2, 0, 0, 2, 0, 0, 1, 0, 1, 2, 0, 0, 0, 0]
[49, 38, 19, 10, 7, 0, 39, 47, 18, 17, 5, 1, 50, 37, 20, 15, 2, 1, 47, 43, 21, 22, 6, 2, 49, 45, 17, 18, 4, 0, 1, 0]
shirlsprint
[1, 3, 1, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0]
[39, 43, 20, 12, 7, 0, 42, 43, 8, 7, 5, 0, 43, 46, 15, 19, 7, 3, 37, 52, 12, 16, 5, 0, 47, 48, 14, 12, 5, 0, 2, 0]
donpapy
[2, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 5, 0, 0, 1, 0, 0, 4, 1, 0, 2, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0]
[68, 61, 27, 21, 8, 1, 61, 66, 21, 24, 14, 3, 87, 78, 33, 27, 8, 1, 71, 77, 22, 29, 8, 2, 60, 69, 19, 32, 9, 0, 4, 1]
vmetelz2
[0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]
[45, 30, 19, 13, 3, 2, 37, 41, 17, 9, 6, 0, 38, 45, 11, 20, 6, 1, 41, 36, 11, 18, 6, 0, 43, 41, 14, 18, 1, 1, 0, 1]
tradyscho1
[2, 1, 0, 0, 0, 0, 0, 4, 0, 1, 0, 0, 2, 2, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0]
[39, 35, 9, 12, 3, 1, 41, 42, 16, 17, 2, 1, 39, 27, 18, 16, 5, 1, 35, 30, 14, 12, 4, 0, 41, 34, 7, 14, 5, 0, 1, 1]
hyde-20
[1, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 3, 5, 0, 0, 0, 0, 2, 1, 1, 0, 0, 0, 0, 0]
[51, 54, 16, 19, 5, 0, 57, 43, 20, 16, 11, 3, 50, 51, 15, 18, 9, 0, 55, 42, 14, 15, 9, 2, 48, 46, 22, 19, 6, 1, 2, 1]
good-game
[1, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[44, 41, 24, 17, 6, 1, 40, 57, 27, 20, 10, 2, 47, 38, 18, 24, 9, 2, 35, 42, 11, 17, 2, 1, 43, 49, 12, 17, 11, 2, 0, 0]
kimchiiiii
[1, 2, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 3, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
[55, 54, 24, 19, 6, 2, 60, 50, 22, 17, 7, 1, 51, 50, 24, 13, 7, 1, 57, 57, 18, 17, 7, 1, 54, 52, 20, 17, 0, 2, 0, 0]
metafurico
[0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 3, 1, 0, 1, 0, 0, 0, 1]
[66, 68, 21, 24, 4, 1, 70, 54, 22, 21, 5, 0, 56, 56, 24, 27, 6, 0, 78, 48, 16, 15, 11, 1, 52, 56, 24, 24, 6, 3, 1, 0]
cezbot
[1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0]
[46, 46, 20, 16, 5, 0, 43, 42, 10, 9, 10, 2, 43, 43, 24, 18, 4, 1, 57, 42, 21, 12, 6, 1, 43, 37, 15, 11, 7, 4, 1, 1]
th13-fu
[2, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 2, 3, 1, 1, 0, 0, 1, 2, 0, 0, 1, 0, 3, 1, 0, 2, 1, 0, 0, 0]
[78, 74, 25, 32, 12, 1, 79, 71, 20, 27, 6, 2, 80, 70, 35, 30, 16, 3, 69, 80, 19, 27, 6, 1, 70, 75, 30, 15, 1, 0, 4, 3]
bandano
[1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 0, 0, 0, 1, 0, 0]
[63, 68, 23, 23, 6, 1, 75, 67, 29, 26, 5, 1, 66, 56, 14, 27, 13, 1, 63, 59, 28, 29, 7, 1, 65, 70, 29, 20, 14, 1, 0, 2]
sleeper12go
[0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0]
[28, 25, 8, 5, 1, 0, 18, 21, 11, 7, 4, 0, 21, 28, 6, 6, 3, 0, 20, 19, 7, 5, 3, 0, 25, 17, 17, 6, 6, 1, 0, 1]
arch-mage
[1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
[56, 52, 18, 18, 8, 0, 61, 55, 22, 32, 7, 2, 58, 62, 19, 20, 8, 2, 55, 54, 18, 24, 9, 0, 51, 65, 20, 16, 5, 0, 2, 0]



0
0
0.000
3 comments
avatar

I need to do some more of this. These days I'm constantly coding all day at work, which leaves me with little appetite to do more in my own time. Good that my little bit of code got you started, it's not so hard is it?

0
0
0.000
avatar

You should, such small projects are fun and finished quite fast. But I hear you on coding at work and lack of appetite. I have been using python for a good 5 years, so the coding part is not hard at all, but finding a good question to answer, that would actually make me sit down and do it, is. It took me since that post of yours to find it. Now I could finally close the tab with that post, now I have it linked here for the reference 😅

0
0
0.000