SteamWar/BungeeCore
Archiviert
13
2

Add new rank system #303

Zusammengeführt
Lixfel hat 3 Commits von Ranked nach master 2022-03-10 11:45:39 +01:00 zusammengeführt
Besitzer
Keine Beschreibung angegeben.
YoyoNow hat 1 Commit 2022-03-09 15:32:56 +01:00 hinzugefügt
Add new rank system
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
d29ef7749d
YoyoNow hat eine neue Abhängigkeit 2022-03-09 15:33:18 +01:00 hinzugefügt
YoyoNow hat 1 Commit 2022-03-09 20:43:11 +01:00 hinzugefügt
Add FightEndsHandler
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
9ec6ea5090
Add FightEndsPacket
Autor
Besitzer
private void calculateEloIfNeeded(Integer blueSchemRank, Integer redSchemRank, double blueResult, String gameMode) {
        if (!Config.RankedEnabled) {
            return;
        }

        if (blueSchemRank == null || redSchemRank == null) { // Schematics are not ranked
            return;
        }

        if (blueSchemRank != redSchemRank) { // Different schematics ranks are not worth elo change
            return;
        }

        Collection<FightPlayer> bluePlayers = Fight.getBlueTeam().getPlayers();
        Collection<FightPlayer> redPlayers = Fight.getRedTeam().getPlayers();
        double playerDiff = 1 - (Math.min(bluePlayers.size(), redPlayers.size()) / (double) Math.max(bluePlayers.size(), redPlayers.size()));
        if (playerDiff >= 0.4) { // Too many players, not worth elo change
            return;
        }

        int blueElo = 0;
        int redElo = 0;
        Map<FightPlayer, Integer> blueElos = new HashMap<>();
        Map<FightPlayer, Integer> redElos = new HashMap<>();
        for (FightPlayer fp : bluePlayers) {
            int elo = Elo.getElo(SteamwarUser.get(fp.getPlayer()).getId(), gameMode);
            blueElo += elo;
            blueElos.put(fp, elo);
        }
        for (FightPlayer fp : redPlayers) {
            int elo = Elo.getElo(SteamwarUser.get(fp.getPlayer()).getId(), gameMode);
            redElo += elo;
            redElos.put(fp, elo);
        }

        double redWinExpectation = 1 / (1 + Math.pow(10, (blueElo - redElo) / 600f));
        double blueWinExpectation = 1 / (1 + Math.pow(10, (redElo - blueElo) / 600f));
        double diffBlueElo = K * (blueResult - blueWinExpectation);
        double diffRedElo = K * (1 - blueResult - redWinExpectation);

        for (FightPlayer fp : bluePlayers) {
            int nElo = (int) Math.round(blueElos.get(fp) + diffBlueElo / bluePlayers.size());
            Elo.setElo(SteamwarUser.get(fp.getPlayer()).getId(), gameMode, nElo);
            FightSystem.getMessage().send("UI_ELO_PLAYER", fp.getPlayer(), redElos.get(fp), nElo);
        }
        for (FightPlayer fp : redPlayers) {
            int nElo = (int) Math.round(redElos.get(fp) + diffRedElo / redPlayers.size());
            Elo.setElo(SteamwarUser.get(fp.getPlayer()).getId(), gameMode, nElo);
            FightSystem.getMessage().send("UI_ELO_PLAYER", fp.getPlayer(), redElos.get(fp), nElo);
        }
    }
```java private void calculateEloIfNeeded(Integer blueSchemRank, Integer redSchemRank, double blueResult, String gameMode) { if (!Config.RankedEnabled) { return; } if (blueSchemRank == null || redSchemRank == null) { // Schematics are not ranked return; } if (blueSchemRank != redSchemRank) { // Different schematics ranks are not worth elo change return; } Collection<FightPlayer> bluePlayers = Fight.getBlueTeam().getPlayers(); Collection<FightPlayer> redPlayers = Fight.getRedTeam().getPlayers(); double playerDiff = 1 - (Math.min(bluePlayers.size(), redPlayers.size()) / (double) Math.max(bluePlayers.size(), redPlayers.size())); if (playerDiff >= 0.4) { // Too many players, not worth elo change return; } int blueElo = 0; int redElo = 0; Map<FightPlayer, Integer> blueElos = new HashMap<>(); Map<FightPlayer, Integer> redElos = new HashMap<>(); for (FightPlayer fp : bluePlayers) { int elo = Elo.getElo(SteamwarUser.get(fp.getPlayer()).getId(), gameMode); blueElo += elo; blueElos.put(fp, elo); } for (FightPlayer fp : redPlayers) { int elo = Elo.getElo(SteamwarUser.get(fp.getPlayer()).getId(), gameMode); redElo += elo; redElos.put(fp, elo); } double redWinExpectation = 1 / (1 + Math.pow(10, (blueElo - redElo) / 600f)); double blueWinExpectation = 1 / (1 + Math.pow(10, (redElo - blueElo) / 600f)); double diffBlueElo = K * (blueResult - blueWinExpectation); double diffRedElo = K * (1 - blueResult - redWinExpectation); for (FightPlayer fp : bluePlayers) { int nElo = (int) Math.round(blueElos.get(fp) + diffBlueElo / bluePlayers.size()); Elo.setElo(SteamwarUser.get(fp.getPlayer()).getId(), gameMode, nElo); FightSystem.getMessage().send("UI_ELO_PLAYER", fp.getPlayer(), redElos.get(fp), nElo); } for (FightPlayer fp : redPlayers) { int nElo = (int) Math.round(redElos.get(fp) + diffRedElo / redPlayers.size()); Elo.setElo(SteamwarUser.get(fp.getPlayer()).getId(), gameMode, nElo); FightSystem.getMessage().send("UI_ELO_PLAYER", fp.getPlayer(), redElos.get(fp), nElo); } } ```
YoyoNow hat 1 Commit 2022-03-09 20:56:06 +01:00 hinzugefügt
Remove RankCommand.java
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
750cf0ee97
Lixfel hat die Änderungen 2022-03-09 20:58:48 +01:00 genehmigt
Lixfel hat eine Abhängigkeit 2022-03-10 11:45:33 +01:00 entfernt
Lixfel hat Commit 9cb0378346 in master 2022-03-10 11:45:39 +01:00 gemerged
Lixfel löschte die Branch Ranked 2022-03-10 11:45:39 +01:00
Dieses Repo ist archiviert. Du kannst Pull-Requests nicht kommentieren.
Keine Beschreibung angegeben.