Skip to content

Commit

Permalink
Max.players up to 12. Some minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cesar-rgon committed Sep 23, 2019
1 parent 806c1c3 commit e02433a
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 27 deletions.
18 changes: 12 additions & 6 deletions scripts/sql/script.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ INSERT INTO KF2DATABASE.LENGTHS VALUES (1002, '2');
-----------------------------------
-- MAX PLAYERS
-----------------------------------
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1000, '6');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1001, '5');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1002, '4');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1003, '3');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1004, '2');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1005, '1');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1000, '12');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1001, '11');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1002, '10');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1003, '9');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1004, '8');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1005, '7');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1006, '6');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1007, '5');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1008, '4');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1009, '3');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1010, '2');
INSERT INTO KF2DATABASE.MAX_PLAYERS VALUES (1011, '1');

-----------------------------------
-- OFFICIAL MAPS
Expand Down
23 changes: 21 additions & 2 deletions src/main/java/daos/MaxPlayersDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

public class MaxPlayersDao extends CommonDao<MaxPlayers> {

Expand All @@ -26,8 +27,26 @@ public static MaxPlayersDao getInstance() {
}

public List<MaxPlayers> listAll() throws SQLException {
String query="select mp from entities.MaxPlayers mp order by mp.code desc";
return list(query, null);
String query="select mp from entities.MaxPlayers mp";
List<MaxPlayers> playerList = list(query, null);

List<MaxPlayers> sortedPlayerList = playerList.stream().sorted((o1, o2) -> {
String code1;
if (o1.getCode().length() == 1) {
code1 = "0" + o1.getCode();
} else {
code1 = o1.getCode();
}
String code2;
if (o2.getCode().length() == 1) {
code2 = "0" + o2.getCode();
} else {
code2 = o2.getCode();
}
return code2.compareTo(code1);
}).collect(Collectors.toList());

return sortedPlayerList;
}

public Optional<MaxPlayers> findByCode(String code) throws SQLException {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/stories/maincontent/MainContentFacadeImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public ObservableList<SelectDto> listAllLengths() throws SQLException {

@Override
public ObservableList<SelectDto> listAllPlayers() throws SQLException {
List<MaxPlayers> players = MaxPlayersDao.getInstance().listAll();
return maxPlayersDtoFactory.newDtos(players);
List<MaxPlayers> playerList = MaxPlayersDao.getInstance().listAll();
return maxPlayersDtoFactory.newDtos(playerList);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import dtos.factories.ProfileToDisplayDtoFactory;
import entities.*;
import javafx.collections.ObservableList;
import javafx.scene.control.ButtonType;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
Expand Down Expand Up @@ -60,14 +61,15 @@ public ProfileDto createNewProfile(String profileName) throws Exception {
firstOfficialMap = officialMaps.get(0);
}

Optional<MaxPlayers> defaultMaxPlayers = MaxPlayersDao.getInstance().findByCode("6");
Profile newProfile = new Profile(
profileName,
LanguageDao.getInstance().listAll().get(0),
GameTypeDao.getInstance().listAll().get(0),
firstOfficialMap,
DifficultyDao.getInstance().listAll().get(0),
LengthDao.getInstance().listAll().get(0),
MaxPlayersDao.getInstance().listAll().get(0),
defaultMaxPlayers.isPresent()? defaultMaxPlayers.get(): null,
StringUtils.isNotBlank(defaultServername) ? defaultServername: "Killing Floor 2 Server",
Integer.parseInt(defaultWebPort),
Integer.parseInt(defaultGamePort),
Expand Down Expand Up @@ -423,6 +425,26 @@ public ObservableList<ProfileDto> importProfilesFromFile(File file, String messa
Properties properties = propertyService.loadPropertiesFromFile(file);
List<Language> languageList = LanguageDao.getInstance().listAll();

String languageCode = propertyService.getPropertyValue("properties/config.properties", "prop.config.selectedLanguageCode");
String headerText = propertyService.getPropertyValue("properties/languages/" + languageCode + ".properties",
"prop.message.proceed");
String contentText = propertyService.getPropertyValue("properties/languages/" + languageCode + ".properties",
"prop.message.importItems");

String gameTypesText = propertyService.getPropertyValue("properties/languages/" + languageCode + ".properties",
"prop.menu.configuration.gameTypes");
String difficultiesText = propertyService.getPropertyValue("properties/languages/" + languageCode + ".properties",
"prop.menu.configuration.difficulties");
String lengthText = propertyService.getPropertyValue("properties/languages/" + languageCode + ".properties",
"prop.menu.configuration.length");
String maxPlayersText = propertyService.getPropertyValue("properties/languages/" + languageCode + ".properties",
"prop.menu.configuration.maxPlayers");

Optional<ButtonType> result = Utils.questionDialog(headerText, contentText + ":\n\n" + gameTypesText + "\n" + difficultiesText + "\n" + lengthText + "\n" + maxPlayersText);
if (result.isPresent() && result.get().equals(ButtonType.CANCEL)) {
return null;
}

importGameTypesFromFile(properties, languageList);
importDifficultiesFromFile(properties, languageList);
importLengthsFromFile(properties, languageList);
Expand All @@ -436,9 +458,10 @@ public ObservableList<ProfileDto> importProfilesFromFile(File file, String messa

if (savedProfileList.size() < selectedProfileList.size()) {
List<String> selectedProfileNameList = selectedProfileList.stream().map(dto -> dto.getProfileName()).collect(Collectors.toList());
List<String> savedProfileNameList = savedProfileList.stream().map(profile -> profile.getName()).collect(Collectors.toList());;
List<String> savedProfileNameList = savedProfileList.stream().map(profile -> profile.getName()).collect(Collectors.toList());
;

for (String selectedProfileName: selectedProfileNameList) {
for (String selectedProfileName : selectedProfileNameList) {
if (!savedProfileNameList.contains(selectedProfileName)) {
errorMessage.append(selectedProfileName + "\n");
}
Expand Down
12 changes: 5 additions & 7 deletions src/main/resources/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
}

.combo-box .cell:selected {
-fx-font-family: "Ubuntu Bold";
-fx-text-fill: white;
-fx-font-weight: bold;
}

.combo-box-popup .list-view {
Expand All @@ -72,11 +72,10 @@
}

.text-field, .text-area {
-fx-font-family: "Ubuntu";
-fx-font-family: "Ubuntu Bold";
-fx-text-box-border: transparent;
-fx-font-size: 14;
-fx-text-fill: white;
-fx-font-weight: bold;
}

#console {
Expand All @@ -85,10 +84,9 @@
}

.check-box {
-fx-font-family: "Ubuntu";
-fx-font-family: "Ubuntu Bold";
-fx-font-size: 14;
-fx-text-fill: white;
-fx-font-weight: bold;
-fx-cursor: hand;
}

Expand All @@ -111,7 +109,7 @@
}

.table-view .table-row-cell:selected .text {
-fx-font-weight: bold;
-fx-font-family: "Ubuntu Bold";
-fx-font-size: 20;
-fx-cursor: hand;
}
Expand All @@ -137,8 +135,8 @@
}

#titleConfigLabel {
-fx-font-family: "Ubuntu Bold";
-fx-text-fill: #fba140;
-fx-font-weight: bold;
-fx-font-size: 25;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/properties/config.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CONFIG PROPERTIES
prop.config.applicationTitle=Simple Killing Floor 2 Server Launcher
prop.config.applicationVersion=2.0 final 20190920
prop.config.applicationVersion=2.0.1 final 20190923
prop.config.applicationMaximized=false
prop.config.selectedLanguageCode=en
prop.config.urlSteamcmd=https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip
Expand Down
10 changes: 9 additions & 1 deletion src/main/resources/properties/languages/en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ prop.label.importMaps=Import
prop.label.slider=Columns
prop.label.customMaps=Custom Maps and Mods
prop.label.officiaslMaps=Official Maps
prop.label.backMapsPage=Back to map list
prop.label.backMapsPage=Back
prop.label.addNewMap=Add map/mod
prop.label.alreadyInLauncher=It is already in the launcher
prop.label.profileTitle=Profile name list
Expand Down Expand Up @@ -107,6 +107,12 @@ prop.length.1=7 waves
prop.length.2=10 waves

# MAX PLAYERS
prop.maxplayers.12=Twelve
prop.maxplayers.11=Eleven
prop.maxplayers.10=Ten
prop.maxplayers.9=Nine
prop.maxplayers.8=Eight
prop.maxplayers.7=Seven
prop.maxplayers.6=Six
prop.maxplayers.5=Five
prop.maxplayers.4=Four
Expand Down Expand Up @@ -214,6 +220,8 @@ prop.message.applicationMustBeRestarted=Restart the launcher for changes take ef
prop.message.browseFolder=Browse to KF2 server folder
prop.message.urlInfo=Url info
prop.message.photoLocation=Photo location
prop.message.proceed=Proceed with operation?
prop.message.importItems=Next items need to be imported before importing profiles

# TOOLTIPS
prop.tooltip.profile=This field indicates the selected profile to be applied. When a profile is selected, all others fields are filled with the profile's specific configuration. It is mandatory
Expand Down
10 changes: 9 additions & 1 deletion src/main/resources/properties/languages/es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ prop.label.importMaps=Importar
prop.label.slider=Columnas
prop.label.customMaps=Mapas Personalizados y Mods
prop.label.officiaslMaps=Mapas Oficiales
prop.label.backMapsPage=Volver a lista de mapas
prop.label.backMapsPage=Volver
prop.label.addNewMap=A\u00f1adir mapa/mod
prop.label.alreadyInLauncher=Ya est\u00e1 en el lanzador
prop.label.profileTitle=Lista de nombres de perfil
Expand Down Expand Up @@ -107,6 +107,12 @@ prop.length.1=7 oleadas
prop.length.2=10 oleadas

# MAX JUGADORES
prop.maxplayers.12=Doce
prop.maxplayers.11=Once
prop.maxplayers.10=Diez
prop.maxplayers.9=Nueve
prop.maxplayers.8=Ocho
prop.maxplayers.7=Siete
prop.maxplayers.6=Seis
prop.maxplayers.5=Cinco
prop.maxplayers.4=Cuatro
Expand Down Expand Up @@ -214,6 +220,8 @@ prop.message.applicationMustBeRestarted=Reinicia el lanzador para que los cambio
prop.message.browseFolder=Navegar a carpeta del servidor KF2
prop.message.urlInfo=Info Url
prop.message.photoLocation=Localizaci\u00f3n foto
prop.message.proceed=\u00bfProceder con la operaci\u00f3n?
prop.message.importItems=Los siguientes elementos deben ser importados antes de importar perfiles

# MENSAJES EMERGENTES
prop.tooltip.profile=Este campo indica el perfil seleccionado a ser aplicado. Cuando un perfil es seleccionado, los otros campos son rellenados con la configuraci\u00f3n espec\u00edfica del perfil. Es obligatorio
Expand Down
16 changes: 12 additions & 4 deletions src/main/resources/properties/languages/fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ prop.menu.installUpdateServer=Installation/Mise \u00e0 jour
prop.menu.webAdmin=WebAdmin
prop.menu.maps=Cartes/Mods
prop.menu.configuration=Configuration
prop.menu.configuration.profiles=Profiles
prop.menu.configuration.profiles=Profils
prop.menu.configuration.gameTypes=Types de jeux
prop.menu.configuration.difficulties=Difficult\u00e9s
prop.menu.configuration.length=Longueur de vagues
Expand All @@ -30,7 +30,7 @@ prop.label.serverName=NOM DE SERVER
prop.label.serverPassword=MOT DE PASSE SERVER
prop.label.webPage=PAGE WEB
prop.label.webPassword=MOT DE PASSE WEB
prop.label.ports=WEB/JEU/PORT DE DEMANDE
prop.label.ports=WEB/JEU/REQU\u00caTE PORT
prop.label.clan=TON CLAN
prop.label.webLink=TON LIEN WEB
prop.label.urlImage=URL DE L'IMAGE SERVER
Expand All @@ -47,7 +47,7 @@ prop.label.updateBeta=MISE \u00c0 JOUR VERS B\u00caTA?
prop.label.betaBrunch=BRANCHE B\u00caTA
prop.label.exploreFolder=EXPLORER
prop.label.installUpdate=INSTALLER / METTRE \u00c0 JOUR
prop.label.validateFilesCheck=ACTIVER POUR V\u00c9RIFIER L'INT\u00c9GRIT\u00c9 DES FICHIERS
prop.label.validateFilesCheck=Activer pour v\u00e9rifier l'int\u00e9grit\u00e9 des fichiers
prop.label.isBetaCheck=Activer pour passer vers la b\u00eata. D\u00e9sactiver pour la version officielle
prop.label.addMaps=Ajouter nouvelles
prop.label.searchInWorkShop=Chercher dans WorkShop
Expand All @@ -58,7 +58,7 @@ prop.label.importMaps=Importer
prop.label.slider=Colonnes
prop.label.customMaps=Cartes et Mods personnalis\u00e9s
prop.label.officiaslMaps=Cartes Officielles
prop.label.backMapsPage=Retourner \u00e0 la liste des cartes
prop.label.backMapsPage=Retourner
prop.label.addNewMap=Ajouter carte/mod
prop.label.alreadyInLauncher=D\u00e9j\u00e0 ajout\u00e9 dans le launcher
prop.label.profileTitle=Liste des noms de Profil
Expand Down Expand Up @@ -107,6 +107,12 @@ prop.length.1=7 vagues
prop.length.2=10 vagues

# MAX PLAYERS
prop.maxplayers.12=Douze
prop.maxplayers.11=Onze
prop.maxplayers.10=Dix
prop.maxplayers.9=Neuf
prop.maxplayers.8=Huit
prop.maxplayers.7=Sept
prop.maxplayers.6=Six
prop.maxplayers.5=Cinq
prop.maxplayers.4=Quatre
Expand Down Expand Up @@ -214,6 +220,8 @@ prop.message.applicationMustBeRestarted=La launcher doit red\u00e9marrer pour qu
prop.message.browseFolder=Parcourir le dossier de serveur KF2
prop.message.urlInfo=Info Url
prop.message.photoLocation=Emplacement photo
prop.message.proceed=Proc\u00e9der \u00e0 l'op\u00e9ration?
prop.message.importItems=Les \u00e9l\u00e9ments suivants doivent \u00eatre import\u00e9s avant d'importer des profils

# TOOLTIPS
prop.tooltip.profile=Ce champ indique le profil s\u00e9lectionn\u00e9 \u00e0 appliquer. Lorsqu'un profil est s\u00e9lectionn\u00e9, tous les autres champs sont remplis avec la configuration sp\u00e9cifique du profil. C'est indispensable
Expand Down

0 comments on commit e02433a

Please sign in to comment.