skybaks / pyplanet-cup_manager Goto Github PK
View Code? Open in Web Editor NEWCompetition Management Plugin for Trackmania Pyplanet
License: GNU General Public License v3.0
Competition Management Plugin for Trackmania Pyplanet
License: GNU General Public License v3.0
Maybe add commands like //cup start
and //cup end
that would cause matches inbetween to be added to //cup results
.
Then print cup top 10 standings at the end of each map like in smurfscup
In addition to loading the new file it should also open the configuration GUI
If players are tied they should get equal planets. Pool the planets between them and then divide equally
req from plant
Add a GUI to manage and maintain overall cup information. Then this information can be sourced to other elements of the plugin such as announcements or export.
Information might include:
Should give it a better feeling for players. GUI wise in teams for instance like Match/Cup Starting in 5,4,3,2,1 where it counts down. That should give notice to players.
Hi,
I made a local.py with the following settings for maniaplanet and tm2020 not yet properly tested yet:
CUP_MANAGER_PRESETS = {
'rounds180': {
'aliases': [ 'smurfscup', 'sc' ],
'script': {
'tm': 'Rounds.Script.txt',
'tmnext': 'Trackmania/TurboRounds.Script.txt',
},
'settings': {
'S_FinishTimeout': 10,
'S_PointsLimit': 180,
'S_WarmUpNb': 1,
'S_WarmUpDuration': 0,
'S_PointsRepartition': '50,45,41,38,36,34,32,30,28,26,24,22,20,18,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,1,1',
'S_TurboFinishTime': True,
},
},
'rounds240': {
'aliases': [],
'script': {
'tm': 'Rounds.Script.txt',
'tmnext': 'Trackmania/TM_Rounds_Online.Script.txt',
},
'settings': {
'S_FinishTimeout': 10,
'S_PointsLimit': 240,
'S_WarmUpNb': 1,
'S_WarmUpDuration': 900,
'S_PointsRepartition': '50,45,41,38,36,34,32,30,28,26,24,22,20,18,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,1,1',
'S_TurboFinishTime': True,
},
},
'rounds480': {
'aliases': [ 'mxlc', 'mxvc', 'nac' ],
'script': {
'tm': 'Rounds.Script.txt',
'tmnext': 'Trackmania/TurboRounds.Script.txt',
},
'settings': {
'S_FinishTimeout': 10,
'S_PointsLimit': 480,
'S_WarmUpNb': 1,
'S_WarmUpDuration': 600,
'S_PointsRepartition': '50,45,41,38,36,34,32,30,28,26,24,22,20,18,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,1,1',
'S_TurboFinishTime': True,
},
},
'laps50': {
'aliases': [ 'hec' ],
'script': {
'tm': 'Laps.Script.txt',
'tmnext': 'Trackmania/TM_Laps_Online.Script.txt',
},
'settings': {
'S_FinishTimeout': 360,
'S_ForceLapsNb': 50,
'S_WarmUpNb': 1,
'S_WarmUpDuration': 600,
},
},
'timeattack': {
'aliases': [ 'ta' ],
'script': {
'tm': 'TimeAttack.Script.txt',
'tmnext': 'Trackmania/TM_TimeAttack_Online.Script.txt',
},
'settings': {
'S_TimeLimit': 360,
'S_WarmUpNb': 0,
'S_WarmUpDuration': 0,
},
},
'rounds480nadeo': {
'aliases': [ 'tmac', 'tmsc', 'tmic', 'rs' ],
'script': {
'tm': 'Rounds.Script.txt',
'tmnext': 'Trackmania/TurboRounds.Script.txt',
},
'settings': {
'S_FinishTimeout': 35,
'S_PointsLimit': 480,
'S_WarmUpNb': 1,
'S_WarmUpDuration': 600,
'S_PointsRepartition': '50,45,41,38,36,34,32,30,28,26,24,22,20,18,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,1,1',
},
},
'tvs': {
'aliases': [ 'tvs' ],
'script': {
'tm': 'Team.Script.txt',
'tmnext': 'Trackmania/TM_Teams_Online.Script.txt',
},
'settings': {
'S_FinishTimeout': 30,
'S_FinishTimeoutDivider': 3,
'S_MaxPointsPerRound': 6,
'S_PointsGap': 1,
'S_UseCustomPointsRepartition': 1,
'S_PointsRepartition2VS': '4,3,2,1',
'S_CumulatePoints': 0,
'S_RoundsPerMap': -1,
'S_MapsPerMatch': -1,
'S_UseTieBreak': 1,
'S_WarmUpTimeout': -1,
'S_PointsRepartition1VS': '2,1',
'S_UseAlternateRules': 0,
'S_NoRoundTie': 1,
'S_BalanceScore': 1,
'S_EarlyEndMatchCallback': 1,
'S_WarmUpNb': 1,
'S_WarmUpDuration': 30,
'S_PointsRepartition': '6,5,4,3,2,1',
},
},
}
# Use this to define planet reward payouts. Admins can select from these payout
# schemes from the match results view.
CUP_MANAGER_PAYOUTS = {
'hec': [
1000,
700,
500,
400,
300,
],
'smurfscup': [
6000,
4000,
3000,
2500,
1500,
1000,
800,
600,
400,
200,
],
}
# Use this to define the name and alias of cup.
CUP_MANAGER_NAMES = {
'mxlc': {
'name': 'ManiaExchange Lagoon Cup',
'preset_on': 'mxlc',
'preset_off': 'timeattack',
'map_count': 1,
},
'hec': {
'name': 'Hypeboys Endurance Cup',
'preset_on': 'laps50',
'preset_off': 'timeattack',
'map_count': 1,
'payout': 'hec',
},
'nac': {
'name': 'North America Cup',
'preset_on': 'nac',
'preset_off': 'timeattack',
'map_count': 1,
},
'tec': {
'name': 'Expedition Cup',
'preset_on': 'rounds180',
'preset_off': 'timeattack',
'map_count': 6,
},
'tmic': {
'name': 'TM2 Island Cup',
'preset_on': 'rounds480nadeo',
'preset_off': 'timeattack',
'map_count': 1,
},
'tmac': {
'name': 'TMOne Alpine Cup',
'preset_on': 'rounds480nadeo',
'preset_off': 'timeattack',
'map_count': 1,
},
'tmsc': {
'name': 'TMOne Speed Cup',
'preset_on': 'rounds480nadeo',
'preset_off': 'timeattack',
'map_count': 1,
},
'nafc': {
'name': 'NA Fun Cup',
'preset_off': 'timeattack',
},
'tvs': {
'name': 'Teams Versus Style like TM2020 Ranked',
'preset_on': 'tvs',
'preset_off': 'timeattack',
'map_count': 1,
},
}
Might have some issues as only one map is actually is being used like in tm2020 ranked.
Some issues:
In database in TM2020: country for player is World?! weird it might seem eventually.
<setting name="S_UseClublinks" type="boolean" value="0"/>
<setting name="S_UseClublinksSponsors" type="boolean" value="0"/>
<setting name="S_NeutralEmblemUrl" type="text" value=""/>
<setting name="S_ScriptEnvironment" type="text" value="development"/>
<setting name="S_IsChannelServer" type="boolean" value="0"/>
<setting name="S_DelayBeforeNextMap" type="integer" value="2000"/>
<setting name="S_RespawnBehaviour" type="integer" value="0"/>
<setting name="S_ForceLapsNb" type="integer" value="-1"/>
<setting name="S_InfiniteLaps" type="boolean" value="0"/>
<setting name="S_SeasonIds" type="text" value=""/>
<setting name="S_IsSplitScreen" type="boolean" value="0"/>
<setting name="S_DecoImageUrl_Checkpoint" type="text" value="file://Media/Manialinks/Nadeo/TMNext/Modes/Matchmaking/Decal_Matchmaking.dds"/>
<setting name="S_DecoImageUrl_DecalSponsor4x1" type="text" value=""/>
<setting name="S_DecoImageUrl_Screen16x9" type="text" value=""/>
<setting name="S_DecoImageUrl_Screen8x1" type="text" value=""/>
<setting name="S_DecoImageUrl_Screen16x1" type="text" value=""/>
<setting name="S_TrustClientSimu" type="boolean" value="1"/>
<setting name="S_UseCrudeExtrapolation" type="boolean" value="1"/>
<setting name="S_SynchronizePlayersAtMapStart" type="boolean" value="1"/>
<setting name="S_DisableGoToMap" type="boolean" value="0"/>
<setting name="S_PointsRepartition" type="text" value="6, 5, 4, 3, 2, 1"/>
<setting name="S_SynchronizePlayersAtRoundStart" type="boolean" value="1"/>
<setting name="S_PointsLimit" type="integer" value="5"/>
<setting name="S_FinishTimeout" type="integer" value="-1"/>
<setting name="S_FinishTimeoutDivider" type="integer" value="3"/>
<setting name="S_MaxPointsPerRound" type="integer" value="6"/>
<setting name="S_PointsGap" type="integer" value="1"/>
<setting name="S_UseCustomPointsRepartition" type="boolean" value="1"/>
<setting name="S_PointsRepartition2VS" type="text" value="4, 3, 2, 1"/>
<setting name="S_PointsRepartition1VS" type="text" value="2, 1"/>
<setting name="S_CumulatePoints" type="boolean" value="0"/>
<setting name="S_RoundsPerMap" type="integer" value="-1"/>
<setting name="S_MapsPerMatch" type="integer" value="-1"/>
<setting name="S_UseTieBreak" type="boolean" value="1"/>
<setting name="S_WarmUpNb" type="integer" value="0"/>
<setting name="S_WarmUpDuration" type="integer" value="0"/>
<setting name="S_WarmUpTimeout" type="integer" value="-1"/>
<setting name="S_UseAlternateRules" type="boolean" value="0"/>
<setting name="S_NoRoundTie" type="boolean" value="1"/>
<setting name="S_BalanceScore" type="boolean" value="1"/>
<setting name="S_EarlyEndMatchCallback" type="boolean" value="1"/>```
are the settings for TM2020.
``` <!-- Default : <setting name="S_ChatTime" type="integer" value="10"/> -->
<!-- Default : <setting name="S_UseClublinks" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_UseClublinksSponsors" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_NeutralEmblemUrl" type="text" value=""/> -->
<!-- Default : <setting name="S_ScriptEnvironment" type="text" value="production"/> -->
<!-- Default : <setting name="S_IsChannelServer" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_DelayBeforeNextMap" type="integer" value="2000"/> -->
<!-- Default : <setting name="S_Debug_DisplayChannelProgression" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_MatchmakingAPIUrl" type="text" value="https://v4.live.maniaplanet.com/ingame/public/matchmaking"/> -->
<!-- Default : <setting name="S_MatchmakingMatchServers" type="text" value=""/> -->
<!-- Default : <setting name="S_MatchmakingMode" type="integer" value="0"/> -->
<!-- Default : <setting name="S_MatchmakingRematchRatio" type="real" value="-1"/> -->
<!-- Default : <setting name="S_MatchmakingRematchNbMax" type="integer" value="2"/> -->
<!-- Default : <setting name="S_MatchmakingVoteForMap" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_MatchmakingProgressive" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_MatchmakingWaitingTime" type="integer" value="20"/> -->
<!-- Default : <setting name="S_MatchmakingEnablePenalty" type="boolean" value="1"/> -->
<!-- Default : <setting name="S_LobbyRoundPerMap" type="integer" value="6"/> -->
<!-- Default : <setting name="S_LobbyMatchmakerPerRound" type="integer" value="30"/> -->
<!-- Default : <setting name="S_LobbyMatchmakerWait" type="integer" value="2"/> -->
<!-- Default : <setting name="S_LobbyMatchmakerTime" type="integer" value="8"/> -->
<!-- Default : <setting name="S_LobbyDisplayMasters" type="boolean" value="1"/> -->
<!-- Default : <setting name="S_LobbyDisableUI" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_LobbyAggressiveTransfer" type="boolean" value="1"/> -->
<!-- Default : <setting name="S_KickTimedOutPlayers" type="boolean" value="1"/> -->
<!-- Default : <setting name="S_MatchmakingErrorMessage" type="text" value="�An error occured in the matchmaking API. If the problem persist please try to contact this server administrator."/> -->
<!-- Default : <setting name="S_MatchmakingLogAPIError" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_MatchmakingLogAPIDebug" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_MatchmakingLogMiscDebug" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_ProgressiveActivation_WaitingTime" type="integer" value="180000"/> -->
<!-- Default : <setting name="S_ProgressiveActivation_PlayersNbRatio" type="integer" value="1"/> -->
<!-- Default : <setting name="S_AllowRespawn" type="boolean" value="1"/> -->
<!-- Default : <setting name="S_RespawnBehaviour" type="integer" value="0"/> -->
<!-- Default : <setting name="S_HideOpponents" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_UseLegacyXmlRpcCallbacks" type="boolean" value="1"/> -->
<!-- Default : <setting name="S_PointsLimit" type="integer" value="5"/> -->
<!-- Default : <setting name="S_FinishTimeout" type="integer" value="-1"/> -->
<!-- Default : <setting name="S_UseAlternateRules" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_ForceLapsNb" type="integer" value="-1"/> -->
<!-- Default : <setting name="S_DisplayTimeDiff" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_PointsRepartition" type="text" value=""/> -->
<!-- Default : <setting name="S_MaxPointsPerRound" type="integer" value="6"/> -->
<!-- Default : <setting name="S_PointsGap" type="integer" value="1"/> -->
<!-- Default : <setting name="S_UseCustomPointsRepartition" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_CumulatePoints" type="boolean" value="0"/> -->
<!-- Default : <setting name="S_RoundsPerMap" type="integer" value="-1"/> -->
<!-- Default : <setting name="S_MapsPerMatch" type="integer" value="-1"/> -->
<!-- Default : <setting name="S_UseTieBreak" type="boolean" value="1"/> -->
<!-- Default : <setting name="S_WarmUpNb" type="integer" value="0"/> -->
<!-- Default : <setting name="S_WarmUpDuration" type="integer" value="0"/> -->
<!-- Default : <setting name="S_NbPlayersPerTeamMax" type="integer" value="3"/> -->
<!-- Default : <setting name="S_NbPlayersPerTeamMin" type="integer" value="3"/> -->```
Are the settings for ManiaPlanet TeamMode.
http://www.aropupu.fi/bracket/)](http://www.aropupu.fi/bracket/)](http://www.aropupu.fi/bracket/
if needed i have experience with it in using it in a judo tournament. (PHP based.)
From reaby, would like the ability for admins to edit cups from in game.
It would be nice if there was a way to add a column to the results exports with the planets rewards associated to the cup
(A lot of people don't know there are even payouts for HEC since it's not mentioned anywhere on the results)
Weird it seems not to the map page or so...
Add map information columns to the CSV export. Could be pretty much anything stored in the database. Map name + MX ID ...
When exporting the results there should be an option to exclude players who have 0 points. They usually only have 0 points if they joined last second or were afk/in spec.
The default behavior should be to leave these players out of the results. Additionally, if players are left out of the results the player count should be updated accordingly.
perhaps add an option on the export GUI to allow this to be toggled on or off?
Usage of multiple scripts/gamemodes in a cup for instance use TA, and then Cup or Rounds.
Hi,
Make a widget/window to gather data for instance that who hosted the last cup but also who hosted the most cups, won the most cups, who always ended as last in a certain cup name?
I have issue with the textedit fields, it doesn't keep newlines...
Would it be possible for you to automatically export the data to clipboard without ctrl-a ctrl-c from textfield ?
You can do this easily with templateview and a small maniascript:
<script><!--
main() {
System.ClipboardSet("""{{ str_data }}""");
}
--></script>
also google sheets export would be nice: it uses simple tab as column separator and newline as line separator
example:
for range(x,x):
strdata += f"{value1}\t{value2}\n"
If you sum the scores of players across multiple maps and the mode is time based, (Like TimeAttack) then it will sort players by shortest total time. If a player did not play all the maps then they will have a total overall shorter time than a player who did play all the maps. To counter this we should probably take into account some kind of "Maps Played" count and then sort off of that like we do for laps mode with checkpoint count.
#Pyplanet Cup Manager by skybaks \0/ in apps.py in settings folder.
'pyplanet.apps.contrib.cup_manager.cup_manager',
based on C:\tmn\pyplanet\env\Lib\site-packages\pyplanet\apps\contrib\cup_manager
Not sure if this will work properly for others, but it works for me.
Text editor method didn't appear to work when handling a non-trivial sized file. It would be good to make a UI that could at least view the contents of the loaded config.
As an additional bonus it would be cool to be able to edit the config from the UI and/or create new configs.
Consider escaping all markdown format characters in the discord export option.
Might need to rework the scores table to accept some new fields
When someone has a username with a $m in it, for example "Example$mExample", Maniaplanet ignores it and shows it as "ExampleExample" ingame. The plugin shows it a "Example$mExample" in the results export
Maybe there are other tags that glitch that way, but I didn't encounter them (yet !)
Consider adding a new field for custom things like this in local.py so it doesnt run all the time but only after you activate a specific setup preset. then you could turn it off by activating another setup preset.
As a subset of the current "Remove players with zero points" setting in export GUI there should be another check that will add them in as "Spec". They would all be at the end and would not add to the total player count.
Develop a system that allows for user control of score sorting when the mode is not recognized.
From Roche:
Add the following kind of header to export GUI:
[To type manually] - Edition #[To type manually] - [find the player number] players
[Gamemode (Rounds, laps...) on [Map Name, possible to autofill?] <https://tm.mania-exchange.com/s/tr/[Map ID, possible to autofill?]>
[autofind the flag id] Piotrunio [Just put the username, maybe will clean it up manually]
🥇 Quasar (Spectrum)
🥈 Arkes (hypeboys)
🥉 Roche (Smurf)
Full results (with points gained):
Hi,
When exporting results only the data is shown but not for instance mapImages: https://tm.mania-exchange.com/maps/screenshot/normal/228636
The filename is currently defined base only on the URL. This could be really bad for use with link shorteners because it could result in really arbitrary and hard to remember filenames.
Perhaps there is something in the response that we could look for to determine the filename and only use the URL as a fallback.
Add toggle-able setting to show ties. This would be done by making all the tied players have the same numeric place.
Suggested command: //cup pay
Functionality would be similar to existing command //pay <login> <amount>
but could be executing in batch and use results to determine who to pay.
I dont think it will work but it should. The preset might not be applied if the host is not there.
something that would turn "1" into "1st", "2" into "2nd", "3" into "3rd", etc
This could be used in numerous places to make the ingame messaging slightly nicer
If i use a empty database and set the plugin up, i can use /cup matches which gives none which is correct but /cup results shows a window/manialink and i can seem to press each thing.
[2022-09-16 23:11:34,456][DEBUG][default] peewee.async: ('SELECT `t1`.`id`, `t1`.`created_at`, `t1`.`updated_at`, `t1`.`cup_start_time`, `t1`.`map_start_time` FROM `cup_manager_cupmatch_v1` AS t1 ORDER BY `t1`.`cup_start_time` DESC', ([],), {}) (peewee_async.py:1534)
[2022-09-16 23:11:34,458][DEBUG][default] peewee.async: ('SELECT `t1`.`id`, `t1`.`created_at`, `t1`.`updated_at`, `t1`.`map_start_time`, `t1`.`mode_script`, `t1`.`map_name`, `t1`.`map_uid`, `t1`.`mx_id` FROM `cup_manager_matchinfo_v1` AS t1 ORDER BY `t1`.`map_start_time` DESC', ([],), {}) (peewee_async.py:1534)
[2022-09-16 23:16:09,070][DEBUG][default] peewee.async: ('SELECT `t1`.`id`, `t1`.`created_at`, `t1`.`updated_at`, `t1`.`cup_start_time`, `t1`.`cup_key`, `t1`.`cup_name`, `t1`.`cup_edition`, `t1`.`cup_host_login`, `t1`.`cup_host_nickname` FROM `cup_manager_cupinfo_v1` AS t1 ORDER BY `t1`.`cup_start_time` DESC', ([],), {}) (peewee_async.py:1534)
[2022-09-16 23:16:22,902][DEBUG][default] root: No callback registered for Script.Maniaplanet.EndMap_Start (manager.py:102)
Same goes for /cup cups
I know it seems weird behaviour.
As discussed in #32
The results text export could benefit from a table header row. This would have some preset data depending on the mode but not all modes would be supported probably. It would be able to be turned on in the export window via a switch of some kind.
Might be nice to be able to post on a map page or forum of TMX
From eyebo:
There is some issue we should investigate further. But basically, TM2020 doesn't apply the points partition properly when I apply the cup setup on the map. (edited)
It shows the points in pyplanet when I go into script settings, but they're not being used. It defaults to the 10,8,whatever points.
I've had the same issue myself when doing things manually if I apply the points partition before 3 2 1 countdown on a map.
Either a game bug or a pyplanet bug. Not sure.
But for NA Cup and Expedition Cup tonight I had to remove the points partition, apply, then add the correct points partition again, apply, and restart the map.
It sounds like there might be some problems with points repartition. Perhaps we do need to call that script command after all? Needs some looking into.
It might be nice for admins and debugging to be able to see the configured cups and their settings as read from the local.py. This could be a GUI or a chat command.
example:
# CP(s) Time Player Payout
====================================================
1 350 24:52.298 Ғ฿Ǐ»Huebi-Spectrum 1000
2 350 25:22.434 NoniSmurf 700
3 350 25:25.008 ad'ama! 500
4 350 25:32.003 RocheSmurf 400
5 350 25:49.724 ➟ water.H₂O 300
6 350 25:51.340 mx.X3kuba3XSmurf
7 350 25:54.855 HaagseSmurf
8 350 25:59.934 Ғ฿Ǐ»iceman
9 350 26:21.016 mxMazerSmurf32/50
10 350 26:22.711 NADEO mx.eyeboSmurf
11 350 27:09.737 TherionSmurf
12 350 29:20.990 Moggie68Smurf
13 302 21:27.601 hypeboys.Cloud (07/50)
14 267 18:58.474 hypeboys.Bull
15 216 28:29.562 [$00✘ion] Roro
16 140 10:16.348 SpectrumV!nce™
17 126 27:06.325 TCM/$mNσrdρlaý 06
18 29 9:58.854 OpsicSmurf
19 5 16:25.545 Earl Hickey
20 3 14:07.208 jmfranco
Hi,
Server Side Event could be used in webpages or discord. It can save data in database and can be read through webpages.
https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.