Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# The version string
- name: Set Version Environment Variable
Expand All @@ -40,7 +40,7 @@ jobs:
- name: Download Assemblies
uses: carlosperate/download-file-action@v2
with:
file-url: https://gridentertainment.blob.core.windows.net/general-storage/csm/Assemblies.zip
file-url: https://storage.citiesskylinesmultiplayer.com/Assemblies.zip
# New filename to rename the downloaded file
file-name: Assemblies.zip

Expand All @@ -52,20 +52,17 @@ jobs:
- name: Build Mod
run: powershell.exe -NoP -NonI -Command "../scripts/build.ps1 -Build"
working-directory: src

# Copy output to common folder
- name: Copy DLLs
run: powershell.exe -NoP -NonI -Command "New-Item -ItemType directory -Path 'output'; Copy-Item './src/csm/bin/Release/*.dll','scripts/install.ps1' 'output'"

# Publish artifacts
- name: Upload mod DLLs
uses: actions/upload-artifact@v3
with:
name: CSM ${{ steps.csm_version.outputs.version }}
path: src/csm/bin/Release/*.dll

# Publish install script
- name: Upload install script
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: CSM ${{ steps.csm_version.outputs.version }}
path: scripts/install.ps1
path: 'output/*'

# Pack API package (Nuget)
- name: Build nuget API package
Expand All @@ -84,7 +81,7 @@ jobs:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Build Docker Image
working-directory: src/gs
Expand All @@ -102,7 +99,7 @@ jobs:
if: github.ref == 'refs/heads/master'

- name: Upload Docker Image
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: API Server Docker Image
path: apiserver.tar
6 changes: 6 additions & 0 deletions src/basegame/CSM.BaseGame.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@
<Compile Include="Commands\Data\Buildings\BuildingRemoveCommand.cs" />
<Compile Include="Commands\Data\Buildings\BuildingSetEmptyingFillingCommand.cs" />
<Compile Include="Commands\Data\Buildings\BuildingSetHistoricalCommand.cs" />
<Compile Include="Commands\Data\Buildings\BuildingSetIndustrialVariationCommand.cs" />
<Compile Include="Commands\Data\Buildings\BuildingSetTollPriceCommand.cs" />
<Compile Include="Commands\Data\Buildings\BuildingSetTransferReasonCommand.cs" />
<Compile Include="Commands\Data\Buildings\BuildingSetVariationCommand.cs" />
<Compile Include="Commands\Data\Buildings\BuildingToolCreateCommand.cs" />
<Compile Include="Commands\Data\Buildings\BuildingUpdateIndustryLastIndexCommand.cs" />
<Compile Include="Commands\Data\Buildings\BuildingUpgradeCommand.cs" />
<Compile Include="Commands\Data\Buildings\ServiceBuildingChangeVehicleCommand.cs" />
<Compile Include="Commands\Data\Campus\BuyResearchGrantCommand.cs" />
Expand Down Expand Up @@ -105,6 +107,7 @@
<Compile Include="Commands\Data\Economy\EconomyTakeLoanCommand.cs" />
<Compile Include="Commands\Data\Events\EventActivateCommand.cs" />
<Compile Include="Commands\Data\Events\EventColorChangedCommand.cs" />
<Compile Include="Commands\Data\Events\EventSetConcertTicketPriceCommand.cs" />
<Compile Include="Commands\Data\Events\EventSetResultCommand.cs" />
<Compile Include="Commands\Data\Events\EventSetSecurityBudgetCommand.cs" />
<Compile Include="Commands\Data\Events\EventSetTicketPriceCommand.cs" />
Expand Down Expand Up @@ -156,10 +159,12 @@
<Compile Include="Commands\Handler\Buildings\BuildingRemoveHandler.cs" />
<Compile Include="Commands\Handler\Buildings\BuildingSetEmptyingFillingHandler.cs" />
<Compile Include="Commands\Handler\Buildings\BuildingSetHistoricalHandler.cs" />
<Compile Include="Commands\Handler\Buildings\BuildingSetIndustrialVariationHandler.cs" />
<Compile Include="Commands\Handler\Buildings\BuildingSetTollPriceHandler.cs" />
<Compile Include="Commands\Handler\Buildings\BuildingSetTransferReasonHandler.cs" />
<Compile Include="Commands\Handler\Buildings\BuildingSetVariationHandler.cs" />
<Compile Include="Commands\Handler\Buildings\BuildingToolCreateHandler.cs" />
<Compile Include="Commands\Handler\Buildings\BuildingUpdateIndustryLastIndexHandler.cs" />
<Compile Include="Commands\Handler\Buildings\BuildingUpgradeHandler.cs" />
<Compile Include="Commands\Handler\Buildings\TransportLineChangeVehicleHandler.cs" />
<Compile Include="Commands\Handler\Campus\BuyResearchGrantHandler.cs" />
Expand Down Expand Up @@ -187,6 +192,7 @@
<Compile Include="Commands\Handler\Economy\EconomyTakeLoanHandler.cs" />
<Compile Include="Commands\Handler\Events\EventActivateHandler.cs" />
<Compile Include="Commands\Handler\Events\EventColorChangedHandler.cs" />
<Compile Include="Commands\Handler\Events\EventSetConcertTicketPriceHandler.cs" />
<Compile Include="Commands\Handler\Events\EventSetResultHandler.cs" />
<Compile Include="Commands\Handler\Events\EventSetSecurityBudgetHandler.cs" />
<Compile Include="Commands\Handler\Events\EventSetTicketPriceHandler.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using CSM.API.Commands;
using ProtoBuf;

namespace CSM.BaseGame.Commands.Data.Buildings
{
/// <summary>
/// Called when the industry building variation was changed.
/// </summary>
/// Sent by:
/// - BuildingHandler
[ProtoContract]
public class BuildingSetIndustrialVariationCommand : CommandBase
{
/// <summary>
/// The id of the modified building.
/// </summary>
[ProtoMember(1)]
public ushort Building { get; set; }

/// <summary>
/// The new building info.
/// </summary>
[ProtoMember(2)]
public ushort VariationInfoIndex { get; set; }

/// <summary>
/// The selected variation index.
/// </summary>
[ProtoMember(3)]
public int VariationIndex { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using CSM.API.Commands;
using ProtoBuf;

namespace CSM.BaseGame.Commands.Data.Buildings
{
/// <summary>
/// Called when the last index cache for randomizing the industry variant is updated.
/// </summary>
/// Sent by:
/// - BuildingHandler
[ProtoContract]
public class BuildingUpdateIndustryLastIndexCommand : CommandBase
{
/// <summary>
/// The key of the changed index.
/// </summary>
[ProtoMember(1)]
public uint Key { get; set; }

/// <summary>
/// The new index value.
/// </summary>
[ProtoMember(2)]
public int Value { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using CSM.API.Commands;
using ProtoBuf;

namespace CSM.BaseGame.Commands.Data.Events
{
/// <summary>
/// Called when the ticket price of a concert was changed.
/// </summary>
/// Sent by:
/// - EventHandler
[ProtoContract]
public class EventSetConcertTicketPriceCommand : CommandBase
{
/// <summary>
/// The building id of the related panel.
/// </summary>
[ProtoMember(1)]
public ushort Building { get; set; }
/// <summary>
/// The event info id of the concert that was modified.
/// </summary>
[ProtoMember(2)]
public uint Event { get; set; }

/// <summary>
/// The new ticket price.
/// </summary>
[ProtoMember(3)]
public int Price { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using ColossalFramework;
using CSM.API.Commands;
using CSM.API.Helpers;
using CSM.BaseGame.Commands.Data.Buildings;
using CSM.BaseGame.Helpers;

namespace CSM.BaseGame.Commands.Handler.Buildings
{
public class BuildingSetIndustrialVariationHandler : CommandHandler<BuildingSetIndustrialVariationCommand>
{
protected override void Handle(BuildingSetIndustrialVariationCommand command)
{
IgnoreHelper.Instance.StartIgnore();

BuildingInfo newPrefab = PrefabCollection<BuildingInfo>.GetPrefab(command.VariationInfoIndex);
Singleton<BuildingManager>.instance.UpdateBuildingInfo(command.Building, newPrefab);

((IndustryBuildingAI) Singleton<BuildingManager>.instance.m_buildings.m_buffer[command.Building].Info.m_buildingAI).SetLastVariationIndex(command.VariationIndex);

// Refresh panel
if (InfoPanelHelper.IsBuilding(typeof(CityServiceWorldInfoPanel), command.Building,
out WorldInfoPanel panel))
{
SimulationManager.instance.m_ThreadingWrapper.QueueMainThread(() =>
{
ReflectionHelper.Call((CityServiceWorldInfoPanel)panel, "OnSetTarget");
});
}

IgnoreHelper.Instance.EndIgnore();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Collections.Generic;
using CSM.API.Commands;
using CSM.API.Helpers;
using CSM.BaseGame.Commands.Data.Buildings;

namespace CSM.BaseGame.Commands.Handler.Buildings
{
public class BuildingUpdateIndustryLastIndexHandler : CommandHandler<BuildingUpdateIndustryLastIndexCommand>
{
protected override void Handle(BuildingUpdateIndustryLastIndexCommand command)
{
Dictionary<uint,int> lastTableIndex = ReflectionHelper.GetAttr<Dictionary<uint, int>>(typeof(IndustryBuildingAI), "m_lastTableIndex");
lastTableIndex[command.Key] = command.Value;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ColossalFramework;
using System;
using ColossalFramework;
using ColossalFramework.UI;
using CSM.API.Commands;
using CSM.API.Helpers;
Expand All @@ -13,11 +14,14 @@ protected override void Handle(DistrictChangeStyleCommand command)
{
Singleton<DistrictManager>.instance.m_districts.m_buffer[command.DistrictId].m_Style = command.Style;

if (InfoPanelHelper.IsDistrict(typeof(DistrictWorldInfoPanel), command.DistrictId, out WorldInfoPanel panel))
if (InfoPanelHelper.IsDistrict(typeof(DistrictWorldInfoPanel), command.DistrictId, out WorldInfoPanel pan))
{
SimulationManager.instance.m_ThreadingWrapper.QueueMainThread(() =>
{
ReflectionHelper.GetAttr<UIDropDown>((DistrictWorldInfoPanel)panel, "m_Style").selectedIndex = command.Style;
DistrictWorldInfoPanel panel = (DistrictWorldInfoPanel) pan;
int[] styleMap = ReflectionHelper.GetAttr<int[]>(panel, "m_StyleMap");
int num = Array.IndexOf(styleMap, command.Style);
ReflectionHelper.GetAttr<UIDropDown>(panel, "m_Style").selectedIndex = num;
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected override void Handle(EventColorChangedCommand command)
});
}
}
else if (aiType == typeof(SportMatchAI))
else if (aiType == typeof(SportMatchAI) || aiType == typeof(VarsitySportsMatchAI))
{
if (InfoPanelHelper.IsEventBuilding(typeof(FootballPanel), command.Event, out WorldInfoPanel panel))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using CSM.API;
using CSM.API.Commands;
using CSM.API.Helpers;
using CSM.BaseGame.Commands.Data.Events;
using CSM.BaseGame.Helpers;

namespace CSM.BaseGame.Commands.Handler.Events
{
public class EventSetConcertTicketPriceHandler : CommandHandler<EventSetConcertTicketPriceCommand>
{
protected override void Handle(EventSetConcertTicketPriceCommand command)
{
IgnoreHelper.Instance.StartIgnore();

ConcertAI concertAI = PrefabCollection<EventInfo>.GetLoaded(command.Event).GetAI() as ConcertAI;
EventData data = new EventData();
if (concertAI != null) concertAI.SetTicketPrice(0, ref data, command.Price);

IgnoreHelper.Instance.EndIgnore();

if (InfoPanelHelper.IsBuilding(typeof(FestivalPanel), command.Building, out WorldInfoPanel panel))
{
SimulationManager.instance.m_ThreadingWrapper.QueueMainThread(() =>
{
ReflectionHelper.Call((FestivalPanel)panel, "RefreshTicketPrices");
});
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ protected override void Handle(EventSetSecurityBudgetCommand command)

if (InfoPanelHelper.IsEventBuilding(typeof(FestivalPanel), command.Event, out WorldInfoPanel panel))
{
UISlider slider = ReflectionHelper.GetAttr<UISlider>(panel, "m_securityBudgetSlider");
SimulationManager.instance.m_ThreadingWrapper.QueueMainThread(() =>
{
slider.value = command.Budget;
ReflectionHelper.Call(panel, "OnSetTarget");
});
}

Expand Down
Loading