Skip to content

Commit

Permalink
Updated: Mod Code to Meet More Modern Standards
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Oct 11, 2022
1 parent 69c6d3c commit 07494d2
Show file tree
Hide file tree
Showing 26 changed files with 1,409 additions and 1,071 deletions.
147 changes: 147 additions & 0 deletions .github/workflows/reloaded.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Script to build and publish a Reloaded Mod.
# by Sewer56

# Produces:
# - Build to Upload to GameBanana
# - Build to Upload to GitHub
# - Build to Upload to NuGet
# - Changelog

# When pushing a tag
# - Upload to GitHub Releases
# - Upload to Reloaded NuGet Repository (if GitHub Secret RELOADED_NUGET_KEY is specified)

name: Build and Publish Reloaded Mod

on:
push:
branches: [ master ]
tags:
- '*'
pull_request:
branches: [ master ]
workflow_dispatch:

env:
PUBLISH_COMMON_PATH: ./Publish/ToUpload/

PUBLISH_GAMEBANANA_PATH: ./Publish/ToUpload/GameBanana
PUBLISH_GITHUB_PATH: ./Publish/ToUpload/Generic
PUBLISH_NUGET_PATH: ./Publish/ToUpload/NuGet

PUBLISH_CHANGELOG_PATH: ./Publish/Changelog.md
PUBLISH_PATH: ./Publish

# Default value is official Reloaded package server.
NUGET_URL: http://packages.sewer56.moe:5000/v3/index.json

IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/') }}
RELEASE_TAG: ${{ github.ref_name }}

jobs:
build:
runs-on: windows-latest
defaults:
run:
shell: pwsh

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'

- name: Setup .NET Core SDK (5.0)
uses: actions/setup-dotnet@v1.8.2
with:
dotnet-version: 5.0.x

- name: Setup .NET Core SDK (6.0)
uses: actions/setup-dotnet@v1.8.2
with:
dotnet-version: 6.0.x

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Setup AutoChangelog
run: npm install -g auto-changelog

- name: Create Changelog
run: |
[System.IO.Directory]::CreateDirectory("$env:PUBLISH_PATH")
if ($env:IS_RELEASE -eq 'true') {
auto-changelog --sort-commits date --hide-credit --template keepachangelog --commit-limit false --starting-version "$env:RELEASE_TAG" --output "$env:PUBLISH_CHANGELOG_PATH"
}
else {
auto-changelog --sort-commits date --hide-credit --template keepachangelog --commit-limit false --unreleased --output "$env:PUBLISH_CHANGELOG_PATH"
}
- name: Build
run: ./Publish.ps1 -ChangelogPath "$env:PUBLISH_CHANGELOG_PATH"

- name: Upload GitHub Release Artifact
uses: actions/upload-artifact@v2.2.4
with:
# Artifact name
name: GitHub Release
# A file, directory or wildcard pattern that describes what to upload
path: |
${{ env.PUBLISH_GITHUB_PATH }}/*
- name: Upload GameBanana Release Artifact
uses: actions/upload-artifact@v2.2.4
with:
# Artifact name
name: GameBanana Release
# A file, directory or wildcard pattern that describes what to upload
path: |
${{ env.PUBLISH_GAMEBANANA_PATH }}/*
- name: Upload NuGet Release Artifact
uses: actions/upload-artifact@v2.2.4
with:
# Artifact name
name: NuGet Release
# A file, directory or wildcard pattern that describes what to upload
path: |
${{ env.PUBLISH_NUGET_PATH }}/*
- name: Upload Changelog Artifact
uses: actions/upload-artifact@v2.2.4
with:
# Artifact name
name: Changelog
# A file, directory or wildcard pattern that describes what to upload
path: ${{ env.PUBLISH_CHANGELOG_PATH }}
retention-days: 0

- name: Upload to GitHub Releases (on Tag)
uses: softprops/action-gh-release@v0.1.14
if: env.IS_RELEASE == 'true'
with:
# Path to load note-worthy description of changes in release from
body_path: ${{ env.PUBLISH_CHANGELOG_PATH }}
# Newline-delimited list of path globs for asset files to upload
files: |
${{ env.PUBLISH_GITHUB_PATH }}/*
- name: Push to NuGet (on Tag)
env:
NUGET_KEY: ${{ secrets.RELOADED_NUGET_KEY }}
if: env.IS_RELEASE == 'true'
run: |
if ([string]::IsNullOrEmpty("$env:NUGET_KEY"))
{
Write-Host "NuGet Repository Key (GitHub Secrets -> RELOADED_NUGET_KEY) Not Specified. Skipping."
return
}
$items = Get-ChildItem -Path "$env:PUBLISH_NUGET_PATH/*.nupkg"
Foreach ($item in $items)
{
Write-Host "Pushing $item"
dotnet nuget push "$item" -k "$env:NUGET_KEY" -s "$env:NUGET_URL" --skip-duplicate
}
9 changes: 9 additions & 0 deletions Heroes.Fun.AuraColorizer/BuildLinked.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Set Working Directory
Split-Path $MyInvocation.MyCommand.Path | Push-Location
[Environment]::CurrentDirectory = $PWD

Remove-Item "$env:RELOADEDIIMODS/sonicheroes.fun.colourizer/*" -Force -Recurse
dotnet publish "./Heroes.Fun.AuraColorizer.csproj" -c Release -o "$env:RELOADEDIIMODS/sonicheroes.fun.colourizer" /p:OutputPath="./bin/Release" /p:ReloadedILLink="true"

# Restore Working Directory
Pop-Location
24 changes: 10 additions & 14 deletions Heroes.Fun.AuraColorizer/Collections/BarrierColours.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
using Heroes.Fun.AuraColorizer.Heroes;
using Heroes.Fun.AuraColorizer.Heroes;

namespace Heroes.Fun.AuraColorizer.Collections
namespace Heroes.Fun.AuraColorizer.Collections;

public static class BarrierColours
{
public static class BarrierColours
public static unsafe RgbaColorComponentPtrSet[] Colours =
{
public static unsafe RgbaColorComponentPtrSet[] Colours =
{
new RgbaColorComponentPtrSet((byte*) 0x47244D, (byte*) 0x472452, (byte*) 0x472457, (byte*) 0x472443), // Power barrier
new RgbaColorComponentPtrSet((byte*) 0x47245E, (byte*) 0x472463, (byte*) 0x472468, (byte*) 0x472443), // Flight Barrier
new RgbaColorComponentPtrSet((byte*) 0x47246F, (byte*) 0x472474, (byte*) 0x472479, (byte*) 0x472443) // Speed Barrier
};
}
}
new RgbaColorComponentPtrSet((byte*) 0x47244D, (byte*) 0x472452, (byte*) 0x472457, (byte*) 0x472443), // Power barrier
new RgbaColorComponentPtrSet((byte*) 0x47245E, (byte*) 0x472463, (byte*) 0x472468, (byte*) 0x472443), // Flight Barrier
new RgbaColorComponentPtrSet((byte*) 0x47246F, (byte*) 0x472474, (byte*) 0x472479, (byte*) 0x472443) // Speed Barrier
};
}
34 changes: 16 additions & 18 deletions Heroes.Fun.AuraColorizer/Config/Config.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
using System.ComponentModel;
using System.IO;
using Heroes.Fun.AuraColorizer.Configuration;

namespace Heroes.Fun.AuraColorizer.Config
namespace Heroes.Fun.AuraColorizer.Config;

public class Config : Configurable<Config>
{
public class Config : Configurable<Config>
{
[DisplayName("Jump Ball Hue Cycle")]
[Description("Control the hue cycle effects on the characters' jumping ball.")]
public HueCycleEffectSettings BallColourHueCycle { get; set; } = new HueCycleEffectSettings(true, 1337, 60);
[DisplayName("Jump Ball Hue Cycle")]
[Description("Control the hue cycle effects on the characters' jumping ball.")]
public HueCycleEffectSettings BallColourHueCycle { get; set; } = new HueCycleEffectSettings(true, 1337, 60);

[DisplayName("Tornado Colour Hue Cycle")]
[Description("Control the hue cycle effects on the speed characters' tornado ability.")]
public HueCycleEffectSettings TornadoColourHueCycle { get; set; } = new HueCycleEffectSettings(true, 1337, 60);
[DisplayName("Tornado Colour Hue Cycle")]
[Description("Control the hue cycle effects on the speed characters' tornado ability.")]
public HueCycleEffectSettings TornadoColourHueCycle { get; set; } = new HueCycleEffectSettings(true, 1337, 60);

[DisplayName("Jump Trail Hue Cycle")]
[Description("Control the hue cycle effects on the trails left by the characters when performing an air dash/homing attack.")]
public HueCycleEffectSettings TrailColourHueCycle { get; set; } = new HueCycleEffectSettings(true, 1337, 60);
[DisplayName("Jump Trail Hue Cycle")]
[Description("Control the hue cycle effects on the trails left by the characters when performing an air dash/homing attack.")]
public HueCycleEffectSettings TrailColourHueCycle { get; set; } = new HueCycleEffectSettings(true, 1337, 60);

[DisplayName("Formation Gate Hue Cycle")]
[Description("Control the hue cycle effects on the individual formation switch gates.")]
public HueCycleEffectSettings FormationGateColourHueCycle { get; set; } = new HueCycleEffectSettings(true, 1337, 60);
}
}
[DisplayName("Formation Gate Hue Cycle")]
[Description("Control the hue cycle effects on the individual formation switch gates.")]
public HueCycleEffectSettings FormationGateColourHueCycle { get; set; } = new HueCycleEffectSettings(true, 1337, 60);
}
41 changes: 20 additions & 21 deletions Heroes.Fun.AuraColorizer/Config/HueCycleEffectSettings.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
using System.ComponentModel;

namespace Heroes.Fun.AuraColorizer.Config
{
public class HueCycleEffectSettings
{
[DefaultValue(true)]
public bool Enable { get; set; }
namespace Heroes.Fun.AuraColorizer.Config;

[Description("The duration of an entire indvidual hue cycle.")]
[DefaultValue(1337)]
public int Duration { get; set; }
public class HueCycleEffectSettings
{
[DefaultValue(true)]
public bool Enable { get; set; }

[Description("How many times the hue is changed during the Duration of one cycle.")]
[DefaultValue(60.0f)]
public float Framerate { get; set; }
[Description("The duration of an entire indvidual hue cycle.")]
[DefaultValue(1337)]
public int Duration { get; set; }

public HueCycleEffectSettings() { }
public HueCycleEffectSettings(bool enable, int duration, float framerate)
{
Enable = enable;
Duration = duration;
Framerate = framerate;
}
[Description("How many times the hue is changed during the Duration of one cycle.")]
[DefaultValue(60.0f)]
public float Framerate { get; set; }

public override string ToString() => $"Enabled: {Enable}, Duration: {Duration}, Framerate: {Framerate}";
public HueCycleEffectSettings() { }
public HueCycleEffectSettings(bool enable, int duration, float framerate)
{
Enable = enable;
Duration = duration;
Framerate = framerate;
}
}

public override string ToString() => $"Enabled: {Enable}, Duration: {Duration}, Framerate: {Framerate}";
}
Loading

0 comments on commit 07494d2

Please sign in to comment.