Allow skill level selection

This commit is contained in:
Mr.Alien
2024-05-17 18:29:36 +02:00
committed by Spencer Shepard
parent 2b108d7746
commit b898b4dbdd
7 changed files with 101 additions and 28 deletions

View File

@@ -1,6 +1,7 @@
import json
import dcs.installation
import dcs.unit
import yaml
import sys
import os
@@ -14,7 +15,6 @@ import logging
import requests
from packaging import version as ver
from PyQt5.QtWidgets import (
QApplication, QDialog, QMainWindow, QMessageBox, QCheckBox, QSpinBox, QSplashScreen, QFileDialog, QRadioButton,
QInputDialog, QDialogButtonBox, QVBoxLayout, QLabel, QComboBox
@@ -104,6 +104,10 @@ defenders_text = "Defending Forces:"
attackers_text = "Attacking Forces:"
ratings_json = None
skillNameList = ["From Template", "Average", "Good", "High", "Excellent", "Random"]
skillValueList = [None, dcs.unit.Skill.Average, dcs.unit.Skill.Good, dcs.unit.Skill.High, dcs.unit.Skill.Excellent, dcs.unit.Skill.Random]
logger.info("RotorOps v" + version.version_string)
logger.info("pydcs DCS installation directory: " + dcs.installation.get_dcs_install_directory())
logger.info("pydcs DCS saved games directory: " + dcs.installation.get_dcs_saved_games_directory())
@@ -323,6 +327,9 @@ class Window(QMainWindow, Ui_MainWindow):
for forces in self.forces_list:
self.redforces_comboBox.addItem(forces.name)
self.blueforces_comboBox.addItem(forces.name)
for skill in skillNameList:
self.redforces_skill_comboBox.addItem(skill)
self.blueforces_skill_comboBox.addItem(skill)
def getImports(self):
self.imports_list = []
@@ -617,6 +624,8 @@ class Window(QMainWindow, Ui_MainWindow):
red_forces = self.forces_list[self.redforces_comboBox.currentIndex()]
blue_forces = self.forces_list[self.blueforces_comboBox.currentIndex()]
red_forces_skill = skillValueList[self.redforces_skill_comboBox.currentIndex()]
blue_forces_skill = skillValueList[self.blueforces_skill_comboBox.currentIndex()]
scenario_name = self.scenario.name
scenario_path = self.scenario.path
@@ -637,6 +646,8 @@ class Window(QMainWindow, Ui_MainWindow):
"scenario_name": scenario_name,
"red_forces_path": red_forces.path,
"blue_forces_path": blue_forces.path,
"red_forces_skill": red_forces_skill,
"blue_forces_skill": blue_forces_skill,
"red_quantity": self.redqty_spinBox.value(),
"blue_quantity": self.blueqty_spinBox.value(),
"inf_spawn_qty": self.inf_spawn_spinBox.value(),