Compare commits
7 Commits
2.1.1-alph
...
2.1.1-alph
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d213fa1b91 | ||
|
|
4b2804427e | ||
|
|
d707a59a71 | ||
|
|
923358b364 | ||
|
|
1d0c0ac19c | ||
|
|
7c97ecddac | ||
|
|
bcae51cc92 |
20
changelog.md
@@ -1,14 +1,22 @@
|
||||
# 2.1.1
|
||||
|
||||
## Features/Imrpovements :
|
||||
* **[Other]** Added an installer option
|
||||
## Features/Improvements :
|
||||
* **[Other]** Added an installer option (thanks to contributor parithon)
|
||||
* **[Cheat Menu]** Added possibility to replace destroyed SAM and base defenses units for the player (Click on a SAM site to fix it)
|
||||
* **[Cheat Menu]** Added recon images for buildings on strike targets, click on a Strike target to get detailled informations
|
||||
* **[Units/Factions]** Added F-16C to USA 1990
|
||||
* **[Units/Factions]** Added MQ-9 Reaper as CAS unit for USA 2005
|
||||
* **[Units/Factions]** Added Mig-21, Mig-23, SA-342L to Syria 2011
|
||||
* **[Cheat Menu]** Added buttons to remove money
|
||||
|
||||
## Fixed issues :
|
||||
* **[UI/UX]** Spelling issues
|
||||
* **[Campaign Generator]** Tarawa was placed on land in Syrian Civil War campaign
|
||||
* **[UI/UX]** Spelling issues (Thanks to Github contributor steveveepee)
|
||||
* **[Campaign Generator]** LHA was placed on land in Syrian Civil War campaign
|
||||
* **[Campaign Generator]** Fixed inverted configuration for Syria full map
|
||||
* **[Units/Factions]** Minor changes to USA 1990
|
||||
* **[Units/Factions]** AH-64A now has default payloads. AH-64D has payloads for more mission types.
|
||||
* **[Campaign Generator]** Syria "Inherent Resolve" campaign, added Incirlik Air Base
|
||||
* **[Mission Generator]** AH-1W was not used by AI to generate CAS mission by default
|
||||
* **[Mission Generator]** Fixed F-16C targeting pod not being added to payload
|
||||
* **[Mission Generator]** AH-64A and AH-64D payloads fix.
|
||||
|
||||
# 2.1.0
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ DEFAULT_AVAILABLE_BUILDINGS = ['fuel', 'ammo', 'comms', 'oil', 'ware', 'farp', '
|
||||
WW2_GERMANY_BUILDINGS = ['fuel', 'factory', 'ww2bunker', 'ww2bunker', 'ww2bunker', 'allycamp', 'allycamp', 'aa']
|
||||
WW2_ALLIES_BUILDINGS = ['fuel', 'factory', 'allycamp', 'allycamp', 'allycamp', 'allycamp', 'allycamp', 'aa']
|
||||
|
||||
FORTIFICATION_BUILDINGS = ['Siegfried Line', 'Concertina Wire', 'Czech hedgehogs 1', 'Czech hedgehogs 2',
|
||||
FORTIFICATION_BUILDINGS = ['Siegfried Line', 'Concertina wire', 'Concertina Wire', 'Czech hedgehogs 1', 'Czech hedgehogs 2',
|
||||
'Dragonteeth 1', 'Dragonteeth 2', 'Dragonteeth 3', 'Dragonteeth 4', 'Dragonteeth 5',
|
||||
'Haystack 1', 'Haystack 2', 'Haystack 3', 'Haystack 4', 'Hemmkurvenvenhindernis',
|
||||
'Log posts 1', 'Log posts 2', 'Log posts 3', 'Log ramps 1', 'Log ramps 2', 'Log ramps 3',
|
||||
|
||||
93
game/db.py
@@ -295,23 +295,6 @@ PRICES = {
|
||||
|
||||
Unarmed.Transport_M818: 3,
|
||||
|
||||
AirDefence.AAA_Vulcan_M163: 5,
|
||||
AirDefence.SAM_Linebacker_M6: 10,
|
||||
|
||||
AirDefence.AAA_ZU_23_Closed: 2,
|
||||
AirDefence.SPAAA_ZSU_23_4_Shilka: 4,
|
||||
AirDefence.SAM_SA_9_Strela_1_9P31: 8,
|
||||
AirDefence.SAM_SA_19_Tunguska_2S6: 15,
|
||||
AirDefence.SAM_SA_6_Kub_LN_2P25: 22,
|
||||
AirDefence.SAM_SA_8_Osa_9A33: 12,
|
||||
AirDefence.SAM_SA_3_S_125_LN_5P73: 20,
|
||||
AirDefence.SAM_SA_2_LN_SM_90: 15,
|
||||
AirDefence.SAM_SA_11_Buk_LN_9A310M1: 25,
|
||||
AirDefence.SAM_Hawk_PCP: 20,
|
||||
AirDefence.SAM_Patriot_LN_M901: 60,
|
||||
AirDefence.SAM_SA_10_S_300PS_LN_5P85C: 60,
|
||||
AirDefence.SAM_Chaparral_M48: 10,
|
||||
|
||||
# WW2
|
||||
Armor.MT_Pz_Kpfw_V_Panther_Ausf_G:24,
|
||||
Armor.MT_Pz_Kpfw_IV_Ausf_H:16,
|
||||
@@ -332,9 +315,6 @@ PRICES = {
|
||||
Armor.LAC_M8_Greyhound: 8,
|
||||
Armor.TD_M10_GMC: 14,
|
||||
Armor.StuG_III_Ausf__G: 12,
|
||||
AirDefence.AAA_Bofors_40mm: 8,
|
||||
AirDefence.AAA_8_8cm_Flak_36: 8,
|
||||
AirDefence.AAA_8_8cm_Flak_18: 12,
|
||||
Artillery.M12_GMC: 10,
|
||||
Artillery.Sturmpanzer_IV_Brummbär: 10,
|
||||
|
||||
@@ -348,6 +328,79 @@ PRICES = {
|
||||
Dry_cargo_ship_Ivanov: 10,
|
||||
Tanker_Elnya_160: 10,
|
||||
|
||||
# Air Defence units
|
||||
AirDefence.SAM_SA_19_Tunguska_2S6: 30,
|
||||
AirDefence.SAM_SA_6_Kub_LN_2P25: 20,
|
||||
AirDefence.SAM_SA_3_S_125_LN_5P73: 6,
|
||||
AirDefence.SAM_SA_10_S_300PS_LN_5P85C: 22,
|
||||
AirDefence.SAM_SA_10_S_300PS_LN_5P85D: 22,
|
||||
AirDefence.SAM_SA_11_Buk_LN_9A310M1: 30,
|
||||
AirDefence.SAM_SA_8_Osa_9A33: 28,
|
||||
AirDefence.SAM_SA_15_Tor_9A331: 40,
|
||||
AirDefence.SAM_SA_13_Strela_10M3_9A35M3: 24,
|
||||
AirDefence.SAM_SA_9_Strela_1_9P31: 16,
|
||||
AirDefence.SAM_SA_11_Buk_CC_9S470M1: 25,
|
||||
AirDefence.SAM_SA_8_Osa_LD_9T217: 22,
|
||||
AirDefence.SAM_Patriot_AMG_AN_MRC_137: 35,
|
||||
AirDefence.SAM_Patriot_ECS_AN_MSQ_104: 30,
|
||||
AirDefence.SPAAA_Gepard: 24,
|
||||
AirDefence.SAM_Hawk_PCP: 14,
|
||||
AirDefence.AAA_Vulcan_M163: 12,
|
||||
AirDefence.SAM_Hawk_LN_M192: 8,
|
||||
AirDefence.SAM_Chaparral_M48: 16,
|
||||
AirDefence.SAM_Linebacker_M6: 18,
|
||||
AirDefence.SAM_Patriot_LN_M901: 15,
|
||||
AirDefence.SAM_Avenger_M1097: 20,
|
||||
AirDefence.SAM_Patriot_EPP_III: 15,
|
||||
AirDefence.SAM_Patriot_ICC: 18,
|
||||
AirDefence.SAM_Roland_ADS: 12,
|
||||
AirDefence.SAM_SA_10_S_300PS_CP_54K6: 18,
|
||||
AirDefence.Stinger_MANPADS: 6,
|
||||
AirDefence.SAM_Stinger_comm_dsr: 4,
|
||||
AirDefence.SAM_Stinger_comm: 4,
|
||||
AirDefence.SPAAA_ZSU_23_4_Shilka: 12,
|
||||
AirDefence.AAA_ZU_23_Closed: 6,
|
||||
AirDefence.AAA_ZU_23_Emplacement: 6,
|
||||
AirDefence.AAA_ZU_23_on_Ural_375: 8,
|
||||
AirDefence.AAA_ZU_23_Insurgent_Closed: 6,
|
||||
AirDefence.AAA_ZU_23_Insurgent_on_Ural_375: 8,
|
||||
AirDefence.AAA_ZU_23_Insurgent: 6,
|
||||
AirDefence.SAM_SA_18_Igla_MANPADS: 10,
|
||||
AirDefence.SAM_SA_18_Igla_comm: 8,
|
||||
AirDefence.SAM_SA_18_Igla_S_MANPADS: 12,
|
||||
AirDefence.SAM_SA_18_Igla_S_comm: 8,
|
||||
AirDefence.EWR_1L13: 30,
|
||||
AirDefence.SAM_SA_6_Kub_STR_9S91: 22,
|
||||
AirDefence.SAM_SA_10_S_300PS_TR_30N6: 24,
|
||||
AirDefence.SAM_SA_10_S_300PS_SR_5N66M: 30,
|
||||
AirDefence.EWR_55G6: 30,
|
||||
AirDefence.SAM_SA_10_S_300PS_SR_64H6E: 30,
|
||||
AirDefence.SAM_SA_11_Buk_SR_9S18M1: 28,
|
||||
AirDefence.CP_9S80M1_Sborka: 10,
|
||||
AirDefence.SAM_Hawk_TR_AN_MPQ_46: 14,
|
||||
AirDefence.SAM_Hawk_SR_AN_MPQ_50: 18,
|
||||
AirDefence.SAM_Patriot_STR_AN_MPQ_53: 22,
|
||||
AirDefence.SAM_Hawk_CWAR_AN_MPQ_55: 20,
|
||||
AirDefence.SAM_SR_P_19: 14,
|
||||
AirDefence.SAM_Roland_EWR: 16,
|
||||
AirDefence.SAM_SA_3_S_125_TR_SNR: 14,
|
||||
AirDefence.SAM_SA_2_LN_SM_90: 8,
|
||||
AirDefence.SAM_SA_2_TR_SNR_75_Fan_Song: 12,
|
||||
AirDefence.Rapier_FSA_Launcher: 6,
|
||||
AirDefence.Rapier_FSA_Optical_Tracker: 12,
|
||||
AirDefence.Rapier_FSA_Blindfire_Tracker: 16,
|
||||
AirDefence.HQ_7_Self_Propelled_LN: 20,
|
||||
AirDefence.HQ_7_Self_Propelled_STR: 24,
|
||||
AirDefence.AAA_8_8cm_Flak_18: 6,
|
||||
AirDefence.AAA_Flak_38: 6,
|
||||
AirDefence.AAA_8_8cm_Flak_36: 8,
|
||||
AirDefence.AAA_8_8cm_Flak_37: 10,
|
||||
AirDefence.AAA_Flak_Vierling_38:6,
|
||||
AirDefence.AAA_Kdo_G_40: 8,
|
||||
AirDefence.Flak_Searchlight_37: 4,
|
||||
AirDefence.Maschinensatz_33: 10,
|
||||
AirDefence.AAA_8_8cm_Flak_41: 12,
|
||||
AirDefence.AAA_Bofors_40mm: 8,
|
||||
|
||||
# FRENCH PACK MOD
|
||||
frenchpack.AMX_10RCR: 10,
|
||||
|
||||
@@ -178,9 +178,12 @@ class Event:
|
||||
for i, ground_object in enumerate(cp.ground_objects):
|
||||
if ground_object.dcs_identifier in ["AA", "CARRIER", "LHA"]:
|
||||
for g in ground_object.groups:
|
||||
if not hasattr(g, "units_losts"):
|
||||
g.units_losts = []
|
||||
for u in g.units:
|
||||
if u.name == destroyed_ground_unit_name:
|
||||
g.units.remove(u)
|
||||
g.units_losts.append(u)
|
||||
destroyed_units = destroyed_units + 1
|
||||
info.text = u.type
|
||||
ucount = sum([len(g.units) for g in ground_object.groups])
|
||||
|
||||
@@ -516,6 +516,10 @@ class AircraftConflictGenerator:
|
||||
group.points[0].tasks.append(OptRestrictJettison(True))
|
||||
|
||||
for point in flight.points:
|
||||
group.add_waypoint(Point(point.x,point.y), point.alt)
|
||||
group.add_waypoint(Point(point.x, point.y), point.alt)
|
||||
|
||||
|
||||
def setup_radio_preset(self, flight, group):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
4
gen/flights/radio_generator.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from dcs.unitgroup import FlyingGroup
|
||||
|
||||
|
||||
|
||||
@@ -65,6 +65,40 @@ SAM_MAP = {
|
||||
AirDefence.HQ_7_Self_Propelled_LN: HQ7Generator
|
||||
}
|
||||
|
||||
SAM_PRICES = {
|
||||
AirDefence.SAM_Hawk_PCP: 35,
|
||||
AirDefence.AAA_ZU_23_Emplacement: 10,
|
||||
AirDefence.AAA_ZU_23_Closed: 10,
|
||||
AirDefence.AAA_ZU_23_on_Ural_375: 10,
|
||||
AirDefence.AAA_ZU_23_Insurgent_on_Ural_375: 10,
|
||||
AirDefence.AAA_ZU_23_Insurgent_Closed: 10,
|
||||
AirDefence.AAA_ZU_23_Insurgent: 10,
|
||||
AirDefence.SPAAA_ZSU_23_4_Shilka: 10,
|
||||
AirDefence.AAA_Vulcan_M163: 15,
|
||||
AirDefence.SAM_Linebacker_M6: 20,
|
||||
AirDefence.Rapier_FSA_Launcher: 20,
|
||||
AirDefence.SAM_Avenger_M1097: 22,
|
||||
AirDefence.SPAAA_Gepard: 24,
|
||||
AirDefence.SAM_Roland_ADS: 40,
|
||||
AirDefence.SAM_Patriot_LN_M901: 85,
|
||||
AirDefence.SAM_Patriot_EPP_III: 85,
|
||||
AirDefence.SAM_Chaparral_M48: 25,
|
||||
AirDefence.AAA_Bofors_40mm: 15,
|
||||
AirDefence.AAA_8_8cm_Flak_36: 15,
|
||||
AirDefence.SAM_SA_2_LN_SM_90: 30,
|
||||
AirDefence.SAM_SA_3_S_125_LN_5P73: 35,
|
||||
AirDefence.SAM_SA_6_Kub_LN_2P25: 45,
|
||||
AirDefence.SAM_SA_8_Osa_9A33: 30,
|
||||
AirDefence.SAM_SA_9_Strela_1_9P31: 25,
|
||||
AirDefence.SAM_SA_10_S_300PS_LN_5P85C: 80,
|
||||
AirDefence.SAM_SA_10_S_300PS_CP_54K6: 80,
|
||||
AirDefence.SAM_SA_11_Buk_LN_9A310M1: 60,
|
||||
AirDefence.SAM_SA_13_Strela_10M3_9A35M3: 30,
|
||||
AirDefence.SAM_SA_15_Tor_9A331: 40,
|
||||
AirDefence.SAM_SA_19_Tunguska_2S6: 35,
|
||||
AirDefence.HQ_7_Self_Propelled_LN: 35
|
||||
}
|
||||
|
||||
def generate_anti_air_group(game, parent_cp, ground_object, faction:str):
|
||||
"""
|
||||
This generate a SAM group
|
||||
|
||||
@@ -143,7 +143,7 @@ class QLiberationMap(QGraphicsView):
|
||||
go_pos = self._transform_point(ground_object.position)
|
||||
if not ground_object.airbase_group:
|
||||
buildings = self.game.theater.find_ground_objects_by_obj_name(ground_object.obj_name)
|
||||
scene.addItem(QMapGroundObject(self, go_pos[0], go_pos[1], 12, 12, cp, ground_object, buildings))
|
||||
scene.addItem(QMapGroundObject(self, go_pos[0], go_pos[1], 14, 12, cp, ground_object, self.game, buildings))
|
||||
|
||||
if ground_object.category == "aa" and self.get_display_rule("sam"):
|
||||
max_range = 0
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
from PySide2.QtCore import QPoint, QRect, QPointF, Qt
|
||||
from PySide2.QtGui import QPainter
|
||||
from PySide2.QtGui import QPainter, QBrush
|
||||
from PySide2.QtWidgets import QGraphicsRectItem, QGraphicsItem, QGraphicsSceneHoverEvent, QGraphicsSceneMouseEvent
|
||||
|
||||
import qt_ui.uiconstants as CONST
|
||||
from game import db
|
||||
from game import db, Game
|
||||
from game.data.building_data import FORTIFICATION_BUILDINGS
|
||||
from qt_ui.windows.groundobject.QGroundObjectMenu import QGroundObjectMenu
|
||||
from theater import TheaterGroundObject, ControlPoint
|
||||
|
||||
|
||||
class QMapGroundObject(QGraphicsRectItem):
|
||||
|
||||
def __init__(self, parent, x: float, y: float, w: float, h: float, cp: ControlPoint, model: TheaterGroundObject, buildings=[]):
|
||||
def __init__(self, parent, x: float, y: float, w: float, h: float, cp: ControlPoint, model: TheaterGroundObject, game:Game, buildings=[]):
|
||||
super(QMapGroundObject, self).__init__(x, y, w, h)
|
||||
self.model = model
|
||||
self.cp = cp
|
||||
self.parent = parent
|
||||
self.game = game
|
||||
self.setAcceptHoverEvents(True)
|
||||
self.setZValue(2)
|
||||
self.buildings = buildings
|
||||
@@ -39,6 +42,8 @@ class QMapGroundObject(QGraphicsRectItem):
|
||||
tooltip = tooltip + str(building.dcs_identifier) + "\n"
|
||||
self.setToolTip(tooltip[:-1])
|
||||
|
||||
def mousePressEvent(self, event:QGraphicsSceneMouseEvent):
|
||||
self.openEditionMenu()
|
||||
|
||||
def paint(self, painter, option, widget=None):
|
||||
#super(QMapControlPoint, self).paint(painter, option, widget)
|
||||
@@ -53,14 +58,49 @@ class QMapGroundObject(QGraphicsRectItem):
|
||||
if cat == "aa" and self.model.sea_object:
|
||||
cat = "ship"
|
||||
|
||||
if not self.model.is_dead and not self.cp.captured:
|
||||
painter.drawPixmap(option.rect, CONST.ICONS[cat + enemyIcons])
|
||||
elif not self.model.is_dead:
|
||||
painter.drawPixmap(option.rect, CONST.ICONS[cat + playerIcons])
|
||||
rect = QRect(option.rect.x()+2,option.rect.y(),option.rect.width()-2,option.rect.height())
|
||||
|
||||
is_dead = self.model.is_dead
|
||||
for building in self.buildings:
|
||||
if not building.is_dead:
|
||||
is_dead = False
|
||||
break
|
||||
|
||||
if not is_dead and not self.cp.captured:
|
||||
painter.drawPixmap(rect, CONST.ICONS[cat + enemyIcons])
|
||||
elif not is_dead:
|
||||
painter.drawPixmap(rect, CONST.ICONS[cat + playerIcons])
|
||||
else:
|
||||
painter.drawPixmap(option.rect, CONST.ICONS["destroyed"])
|
||||
painter.drawPixmap(rect, CONST.ICONS["destroyed"])
|
||||
|
||||
self.drawHealthGauge(painter, option)
|
||||
painter.restore()
|
||||
|
||||
def drawHealthGauge(self, painter, option):
|
||||
units_alive = 0
|
||||
units_dead = 0
|
||||
|
||||
if len(self.model.groups) == 0:
|
||||
for building in self.buildings:
|
||||
if building.dcs_identifier in FORTIFICATION_BUILDINGS:
|
||||
continue
|
||||
if building.is_dead:
|
||||
units_dead += 1
|
||||
else:
|
||||
units_alive += 1
|
||||
|
||||
for g in self.model.groups:
|
||||
units_alive += len(g.units)
|
||||
if hasattr(g, "units_losts"):
|
||||
units_dead += len(g.units_losts)
|
||||
|
||||
if units_dead + units_alive > 0:
|
||||
ratio = float(units_alive)/(float(units_dead) + float(units_alive))
|
||||
bar_height = ratio * option.rect.height()
|
||||
painter.fillRect(option.rect.x(), option.rect.y(), 2, option.rect.height(), QBrush(CONST.COLORS["dark_red"]))
|
||||
painter.fillRect(option.rect.x(), option.rect.y(), 2, bar_height, QBrush(CONST.COLORS["green"]))
|
||||
|
||||
|
||||
def hoverEnterEvent(self, event: QGraphicsSceneHoverEvent):
|
||||
self.update()
|
||||
self.setCursor(Qt.PointingHandCursor)
|
||||
@@ -72,3 +112,7 @@ class QMapGroundObject(QGraphicsRectItem):
|
||||
def hoverLeaveEvent(self, event: QGraphicsSceneHoverEvent):
|
||||
self.update()
|
||||
|
||||
def openEditionMenu(self):
|
||||
self.editionMenu = QGroundObjectMenu(self.window(), self.model, self.buildings, self.cp, self.game)
|
||||
self.editionMenu.show()
|
||||
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox, QPushButton
|
||||
|
||||
from qt_ui.uiconstants import VEHICLES_ICONS
|
||||
from qt_ui.windows.groundobject.QGroundObjectMenu import QGroundObjectMenu
|
||||
from theater import ControlPoint, TheaterGroundObject
|
||||
|
||||
|
||||
class QBaseDefenseGroupInfo(QGroupBox):
|
||||
|
||||
def __init__(self, cp:ControlPoint, ground_object: TheaterGroundObject):
|
||||
def __init__(self, cp:ControlPoint, ground_object: TheaterGroundObject, game):
|
||||
super(QBaseDefenseGroupInfo, self).__init__("Group : " + ground_object.obj_name)
|
||||
self.ground_object = ground_object
|
||||
self.cp = cp
|
||||
self.game = game
|
||||
self.buildings = game.theater.find_ground_objects_by_obj_name(self.ground_object.obj_name)
|
||||
self.init_ui()
|
||||
|
||||
|
||||
|
||||
def init_ui(self):
|
||||
unit_dict = {}
|
||||
layout = QGridLayout()
|
||||
@@ -29,8 +35,18 @@ class QBaseDefenseGroupInfo(QGroupBox):
|
||||
# icon.setText("<b>" + k[:6] + "</b>")
|
||||
#icon.setProperty("style", "icon-plane")
|
||||
#layout.addWidget(icon, i, 0)
|
||||
layout.addWidget(QLabel(str(v) + " x " + "<strong>" + k + "</strong>"), i, 1)
|
||||
layout.addWidget(QLabel(str(v) + " x " + "<strong>" + k + "</strong>"), i, 0)
|
||||
i = i + 1
|
||||
|
||||
manage_button = QPushButton("Manage")
|
||||
manage_button.setProperty("style", "btn-success")
|
||||
manage_button.setMaximumWidth(180)
|
||||
manage_button.clicked.connect(self.onManage)
|
||||
layout.addWidget(manage_button, i+1, 0)
|
||||
self.setLayout(layout)
|
||||
|
||||
def onManage(self):
|
||||
self.editionMenu = QGroundObjectMenu(self.window(), self.ground_object, self.buildings, self.cp, self.game)
|
||||
self.editionMenu.show()
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,6 @@ class QBaseDefensesHQ(QFrame):
|
||||
def init_ui(self):
|
||||
airport = self.game.theater.terrain.airport_by_id(self.cp.id)
|
||||
layout = QGridLayout()
|
||||
layout.addWidget(QBaseInformation(self.cp, airport))
|
||||
layout.addWidget(QBaseInformation(self.cp, airport, self.game))
|
||||
self.setLayout(layout)
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox, QVBoxLayout, QFrame
|
||||
from PySide2.QtGui import Qt
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox, QVBoxLayout, QFrame, QWidget, QScrollArea
|
||||
|
||||
from game import db
|
||||
from qt_ui.uiconstants import AIRCRAFT_ICONS, VEHICLES_ICONS
|
||||
@@ -8,17 +9,34 @@ from theater import ControlPoint, Airport
|
||||
|
||||
class QBaseInformation(QFrame):
|
||||
|
||||
def __init__(self, cp:ControlPoint, airport:Airport):
|
||||
def __init__(self, cp:ControlPoint, airport:Airport, game):
|
||||
super(QBaseInformation, self).__init__()
|
||||
self.cp = cp
|
||||
self.airport = airport
|
||||
self.game = game
|
||||
self.setMinimumWidth(500)
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
self.layout = QVBoxLayout()
|
||||
self.mainLayout = QVBoxLayout()
|
||||
|
||||
scroll_content = QWidget()
|
||||
task_box_layout = QGridLayout()
|
||||
scroll_content.setLayout(task_box_layout)
|
||||
row = 0
|
||||
|
||||
for g in self.cp.ground_objects:
|
||||
if g.airbase_group:
|
||||
group_info = QBaseDefenseGroupInfo(self.cp, g)
|
||||
self.layout.addWidget(group_info)
|
||||
self.setLayout(self.layout)
|
||||
group_info = QBaseDefenseGroupInfo(self.cp, g, self.game)
|
||||
task_box_layout.addWidget(group_info)
|
||||
|
||||
scroll_content.setLayout(task_box_layout)
|
||||
scroll = QScrollArea()
|
||||
scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
|
||||
scroll.setWidgetResizable(True)
|
||||
scroll.setWidget(scroll_content)
|
||||
|
||||
self.mainLayout.addWidget(scroll)
|
||||
|
||||
self.setLayout(self.mainLayout)
|
||||
33
qt_ui/windows/groundobject/QBuildingInfo.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import os
|
||||
|
||||
from PySide2.QtGui import QPixmap
|
||||
from PySide2.QtWidgets import QGroupBox, QHBoxLayout, QVBoxLayout, QLabel
|
||||
|
||||
|
||||
class QBuildingInfo(QGroupBox):
|
||||
|
||||
def __init__(self, building, ground_object):
|
||||
super(QBuildingInfo, self).__init__()
|
||||
self.building = building
|
||||
self.ground_object = ground_object
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
self.header = QLabel()
|
||||
path = os.path.join("./resources/ui/units/buildings/" + self.building.dcs_identifier + ".png")
|
||||
if self.building.is_dead:
|
||||
pixmap = QPixmap("./resources/ui/units/buildings/dead.png")
|
||||
elif os.path.isfile(path):
|
||||
pixmap = QPixmap(path)
|
||||
else:
|
||||
pixmap = QPixmap("./resources/ui/units/buildings/missing.png")
|
||||
self.header.setPixmap(pixmap)
|
||||
name = "<b>{}</b> {}".format(self.building.dcs_identifier[0:18], "[DEAD]" if self.building.is_dead else "")
|
||||
self.name = QLabel(name)
|
||||
self.name.setProperty("style", "small")
|
||||
layout = QVBoxLayout()
|
||||
layout.addWidget(self.header)
|
||||
layout.addWidget(self.name)
|
||||
footer = QHBoxLayout()
|
||||
self.setLayout(layout)
|
||||
|
||||
117
qt_ui/windows/groundobject/QGroundObjectMenu.py
Normal file
@@ -0,0 +1,117 @@
|
||||
import logging
|
||||
|
||||
from PySide2.QtGui import QCloseEvent
|
||||
from PySide2.QtWidgets import QHBoxLayout, QWidget, QDialog, QGridLayout, QLabel, QGroupBox, QVBoxLayout, QPushButton
|
||||
from dcs import Point
|
||||
|
||||
from game import Game
|
||||
from game.data.building_data import FORTIFICATION_BUILDINGS
|
||||
from game.db import PRICES, unit_type_of
|
||||
from qt_ui.uiconstants import EVENT_ICONS
|
||||
from qt_ui.widgets.QBudgetBox import QBudgetBox
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
from qt_ui.windows.groundobject.QBuildingInfo import QBuildingInfo
|
||||
from theater import ControlPoint, TheaterGroundObject
|
||||
|
||||
|
||||
class QGroundObjectMenu(QDialog):
|
||||
|
||||
def __init__(self, parent, ground_object: TheaterGroundObject, buildings:[], cp: ControlPoint, game: Game):
|
||||
super(QGroundObjectMenu, self).__init__(parent)
|
||||
self.setMinimumWidth(350)
|
||||
self.ground_object = ground_object
|
||||
self.buildings = buildings
|
||||
self.cp = cp
|
||||
self.game = game
|
||||
self.setWindowTitle("Location " + self.ground_object.obj_name)
|
||||
self.setWindowIcon(EVENT_ICONS["capture"])
|
||||
self.intelBox = QGroupBox("Units :")
|
||||
self.buildingBox = QGroupBox("Buildings :")
|
||||
self.intelLayout = QGridLayout()
|
||||
self.buildingsLayout = QGridLayout()
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
|
||||
self.mainLayout = QVBoxLayout()
|
||||
self.budget = QBudgetBox(self.game)
|
||||
self.budget.setGame(self.game)
|
||||
|
||||
self.doLayout()
|
||||
|
||||
if len(self.ground_object.groups) > 0:
|
||||
self.mainLayout.addWidget(self.intelBox)
|
||||
else:
|
||||
self.mainLayout.addWidget(self.buildingBox)
|
||||
self.setLayout(self.mainLayout)
|
||||
|
||||
def doLayout(self):
|
||||
self.intelBox = QGroupBox("Units :")
|
||||
self.intelLayout = QGridLayout()
|
||||
i = 0
|
||||
for g in self.ground_object.groups:
|
||||
if not hasattr(g, "units_losts"):
|
||||
g.units_losts = []
|
||||
for u in g.units:
|
||||
self.intelLayout.addWidget(QLabel("<b>Unit #" + str(u.id) + " - " + str(u.type) + "</b>"), i, 0)
|
||||
i = i + 1
|
||||
|
||||
for u in g.units_losts:
|
||||
|
||||
utype = unit_type_of(u)
|
||||
if utype in PRICES:
|
||||
price = PRICES[utype]
|
||||
else:
|
||||
price = 6
|
||||
|
||||
self.intelLayout.addWidget(QLabel("<b>Unit #" + str(u.id) + " - " + str(u.type) + "</b> [DEAD]"), i, 0)
|
||||
if self.cp.captured:
|
||||
repair = QPushButton("Repair [" + str(price) + "M]")
|
||||
repair.setProperty("style", "btn-success")
|
||||
repair.clicked.connect(lambda u=u, g=g, p=price: self.repair_unit(g, u, p))
|
||||
self.intelLayout.addWidget(repair, i, 1)
|
||||
i = i + 1
|
||||
|
||||
self.buildingBox = QGroupBox("Buildings :")
|
||||
self.buildingsLayout = QGridLayout()
|
||||
j = 0
|
||||
for i, building in enumerate(self.buildings):
|
||||
if building.dcs_identifier not in FORTIFICATION_BUILDINGS:
|
||||
self.buildingsLayout.addWidget(QBuildingInfo(building, self.ground_object), j/3, j%3)
|
||||
j = j + 1
|
||||
|
||||
self.buildingBox.setLayout(self.buildingsLayout)
|
||||
self.intelBox.setLayout(self.intelLayout)
|
||||
|
||||
def do_refresh_layout(self):
|
||||
try:
|
||||
for i in range(self.mainLayout.count()):
|
||||
self.mainLayout.removeItem(self.mainLayout.itemAt(i))
|
||||
self.doLayout()
|
||||
if len(self.ground_object.groups) > 0:
|
||||
self.mainLayout.addWidget(self.intelBox)
|
||||
else:
|
||||
self.mainLayout.addWidget(self.buildingBox)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
def repair_unit(self, group, unit, price):
|
||||
if self.game.budget > price:
|
||||
self.game.budget -= price
|
||||
group.units_losts = [u for u in group.units_losts if u.id != unit.id]
|
||||
group.units.append(unit)
|
||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||
|
||||
# Remove destroyed units in the vicinity
|
||||
destroyed_units = self.game.get_destroyed_units()
|
||||
for d in destroyed_units:
|
||||
p = Point(d["x"], d["z"])
|
||||
if p.distance_to_point(unit.position) < 15:
|
||||
destroyed_units.remove(d)
|
||||
logging.info("Removed destroyed units " + str(d))
|
||||
logging.info("Repaired unit : " + str(unit.id) + " " + str(unit.type))
|
||||
|
||||
self.do_refresh_layout()
|
||||
|
||||
def closeEvent(self, closeEvent: QCloseEvent):
|
||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||
@@ -1,3 +1,5 @@
|
||||
import logging
|
||||
|
||||
from PySide2.QtCore import QSize, Qt, QItemSelectionModel, QPoint
|
||||
from PySide2.QtGui import QStandardItemModel, QStandardItem
|
||||
from PySide2.QtWidgets import QLabel, QDialog, QGridLayout, QListView, QStackedLayout, QComboBox, QWidget, \
|
||||
@@ -269,32 +271,28 @@ class QSettingsWindow(QDialog):
|
||||
self.moneyCheatBoxLayout = QGridLayout()
|
||||
self.moneyCheatBox.setLayout(self.moneyCheatBoxLayout)
|
||||
|
||||
self.cheat25M = QPushButton("Cheat +25M")
|
||||
self.cheat50M = QPushButton("Cheat +50M")
|
||||
self.cheat100M = QPushButton("Cheat +100M")
|
||||
self.cheat200M = QPushButton("Cheat +200M")
|
||||
self.cheat500M = QPushButton("Cheat +500M")
|
||||
self.cheat1000M = QPushButton("Cheat +1000M")
|
||||
|
||||
self.cheat25M.clicked.connect(lambda: self.cheatMoney(25))
|
||||
self.cheat50M.clicked.connect(lambda: self.cheatMoney(50))
|
||||
self.cheat100M.clicked.connect(lambda: self.cheatMoney(100))
|
||||
self.cheat200M.clicked.connect(lambda: self.cheatMoney(200))
|
||||
self.cheat500M.clicked.connect(lambda: self.cheatMoney(500))
|
||||
self.cheat1000M.clicked.connect(lambda: self.cheatMoney(1000))
|
||||
|
||||
self.moneyCheatBoxLayout.addWidget(self.cheat25M, 0, 0)
|
||||
self.moneyCheatBoxLayout.addWidget(self.cheat50M, 0, 1)
|
||||
self.moneyCheatBoxLayout.addWidget(self.cheat100M, 1, 0)
|
||||
self.moneyCheatBoxLayout.addWidget(self.cheat200M, 1, 1)
|
||||
self.moneyCheatBoxLayout.addWidget(self.cheat500M, 2, 0)
|
||||
self.moneyCheatBoxLayout.addWidget(self.cheat1000M, 2, 1)
|
||||
|
||||
cheats_amounts = [25, 50, 100, 200, 500, 1000, -25, -50, -100, -200]
|
||||
for i, amount in enumerate(cheats_amounts):
|
||||
if amount > 0:
|
||||
btn = QPushButton("Cheat +" + str(amount) + "M")
|
||||
btn.setProperty("style", "btn-success")
|
||||
else:
|
||||
btn = QPushButton("Cheat " + str(amount) + "M")
|
||||
btn.setProperty("style", "btn-danger")
|
||||
btn.clicked.connect(self.cheatLambda(amount))
|
||||
self.moneyCheatBoxLayout.addWidget(btn, i/2, i%2)
|
||||
self.cheatLayout.addWidget(self.moneyCheatBox, 0, 0)
|
||||
|
||||
def cheatLambda(self, amount):
|
||||
return lambda: self.cheatMoney(amount)
|
||||
|
||||
def cheatMoney(self, amount):
|
||||
logging.info("CHEATING FOR AMOUNT : " + str(amount) + "M")
|
||||
self.game.budget += amount
|
||||
self.game.informations.append(Information("CHEATER", "You are a cheater and you should feel bad", self.game.turn))
|
||||
if amount > 0:
|
||||
self.game.informations.append(Information("CHEATER", "You are a cheater and you should feel bad", self.game.turn))
|
||||
else:
|
||||
self.game.informations.append(Information("CHEATER", "You are still a cheater !", self.game.turn))
|
||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||
|
||||
def applySettings(self):
|
||||
|
||||
@@ -486,3 +486,7 @@ QWidget[style="baseMenuHeader"]{
|
||||
font-weight: bold;
|
||||
color:white;
|
||||
}*/
|
||||
|
||||
QLabel[style="small"]{
|
||||
font-size: 8px;
|
||||
}
|
||||
@@ -178,4 +178,8 @@ QLabel[style="SEAD"]{
|
||||
QWidget[style="baseMenuHeader"]{
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
}*/
|
||||
}*/
|
||||
|
||||
QLabel[style="small"]{
|
||||
font-size: 8px;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ def _mk_archieve():
|
||||
shutil.rmtree("./dist")
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
os.system("pyinstaller.exe pyinstaller.spec")
|
||||
os.system("pyinstaller.exe --clean pyinstaller.spec")
|
||||
#archieve = ZipFile(path, "w")
|
||||
#archieve.writestr("dcs_liberation.bat", "cd dist\\dcs_liberation\r\nliberation_main \"%UserProfile%\\Saved Games\" \"{}\"".format(VERSION))
|
||||
#_zip_dir(archieve, "./dist/dcs_liberation")
|
||||
|
||||
BIN
resources/ui/units/buildings/.Ammunition depot.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
resources/ui/units/buildings/.Command Center.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
resources/ui/units/buildings/Barracks 2.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
resources/ui/units/buildings/Chemical Tank A.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
resources/ui/units/buildings/Comms tower M.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
resources/ui/units/buildings/Electric power box.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
resources/ui/units/buildings/FARP Ammo Dump Coating.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
resources/ui/units/buildings/FARP CP Blindage.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
resources/ui/units/buildings/FARP Fuel Depot.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
resources/ui/units/buildings/FARP Tent.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
resources/ui/units/buildings/Farm A.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
resources/ui/units/buildings/Farm B.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
resources/ui/units/buildings/Fire Control Bunker.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
resources/ui/units/buildings/Garage B.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
resources/ui/units/buildings/Garage small B.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
resources/ui/units/buildings/Hangar A.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
resources/ui/units/buildings/Hangar B.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
resources/ui/units/buildings/Oil derrick.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
resources/ui/units/buildings/Oil platform.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
resources/ui/units/buildings/Pump station.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
resources/ui/units/buildings/Repair Workshop.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
resources/ui/units/buildings/SK_C_28_naval_gun.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
resources/ui/units/buildings/Subsidiary structure 2.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
resources/ui/units/buildings/TV tower.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
resources/ui/units/buildings/Tank 2.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
resources/ui/units/buildings/Tank 3.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
resources/ui/units/buildings/Tank.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
resources/ui/units/buildings/Tech combine.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
resources/ui/units/buildings/Tech hangar A.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
resources/ui/units/buildings/Warehouse.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
resources/ui/units/buildings/Watch tower armed.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
resources/ui/units/buildings/Workshop A.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
resources/ui/units/buildings/dead.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
resources/ui/units/buildings/house2arm.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
resources/ui/units/buildings/missing.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |