Jump to content
Korean Random
Sign in to follow this  

Suggestion for sorting Carousel by Battles Played

Recommended Posts

Dear XVM Community,


Here is a small tweak to the carousel code in XVM that allows sorting of the carousel by battles played (battlecount). Would it be worth adding this as an XVM capability? Nothing is lost and the code is right here.






This mod allows the addition of “battlesCount” to sort criteria:




In the section:

if sort_criterion in ['winRate', 'markOfMastery']: 

                (down to just before elif statement)



Make this change

            if sort_criterion in ['winRate', 'markOfMastery', 'battlesCount']:

                itemsCache = dependency.instance(IItemsCache)

                vehicles_stats = itemsCache.items.getAccountDossier().getRandomStats().getVehicles() # battlesCount, wins, markOfMastery, xp

                stats = vehicles_stats.get(vehicle.intCD)

                comparisonKey.append(factor if stats else 0)

                if stats:

                    if sort_criterion == 'winRate':

                        comparisonKey.append(float(stats.wins) / stats.battlesCount * factor)

                    elif sort_criterion == 'markOfMastery':

                        comparisonKey.append(stats.markOfMastery * factor)

                    elif sort_criterion == 'battlesCount':

                        comparisonKey.append(stats.battlesCount * factor) 




This mod sorts the carousel by winrate or battles played




Set the sort order from:


     "sorting_criteria": ["nation", "type", "level"],


To one of the following:


     Games played low to high

     "sorting_criteria": ["battlesCount", "level"],


     Games played high to low

     "sorting_criteria": ["-battlesCount", "level"],


     Winrate High to Low

     "sorting_criteria": ["-winRate"],


     Winrate Low to High

     "sorting_criteria": ["winRate"],



Share this post

Link to post

Short link
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.