Skip to content

Commit

Permalink
Added: New Mod Template
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Jun 11, 2022
1 parent a2b43d5 commit 5a2f97b
Show file tree
Hide file tree
Showing 14 changed files with 1,191 additions and 2 deletions.
30 changes: 28 additions & 2 deletions source/Reloaded-II.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.31911.260
Expand Down Expand Up @@ -66,7 +65,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reloaded.Mod.Loader.Update.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reloaded.Mod.Loader.Community", "Reloaded.Mod.Loader.Community\Reloaded.Mod.Loader.Community.csproj", "{C529F382-25A3-4C1F-A877-0ED4E53EFF20}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reloaded.Community.Tool", "Tools\Reloaded.Community.Tool\Reloaded.Community.Tool.csproj", "{16976E7C-4826-40E5-9E17-2C4266394FD5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reloaded.Community.Tool", "Tools\Reloaded.Community.Tool\Reloaded.Community.Tool.csproj", "{16976E7C-4826-40E5-9E17-2C4266394FD5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reloaded.Mod.Template.Nupkg", "Reloaded.Mod.Template\Reloaded.Mod.Template.Nupkg.csproj", "{4914B6D0-C38B-4633-BA1F-4CF8143FE7F7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Templates", "Templates", "{5E60B8D6-820D-4CD6-A0FE-DC2DA574499F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "configurable", "configurable", "{D61BEC35-E70A-4C4D-B398-7D3E1A29D03B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reloaded.Mod.Template", "Reloaded.Mod.Template\templates\configurable\Reloaded.Mod.Template.csproj", "{229E092C-5309-4077-9A09-70A5ADA3816D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -276,6 +283,22 @@ Global
{16976E7C-4826-40E5-9E17-2C4266394FD5}.Release|Any CPU.Build.0 = Release|Any CPU
{16976E7C-4826-40E5-9E17-2C4266394FD5}.Release|X64+X86.ActiveCfg = Release|Any CPU
{16976E7C-4826-40E5-9E17-2C4266394FD5}.Release|X64+X86.Build.0 = Release|Any CPU
{4914B6D0-C38B-4633-BA1F-4CF8143FE7F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4914B6D0-C38B-4633-BA1F-4CF8143FE7F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4914B6D0-C38B-4633-BA1F-4CF8143FE7F7}.Debug|X64+X86.ActiveCfg = Debug|Any CPU
{4914B6D0-C38B-4633-BA1F-4CF8143FE7F7}.Debug|X64+X86.Build.0 = Debug|Any CPU
{4914B6D0-C38B-4633-BA1F-4CF8143FE7F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4914B6D0-C38B-4633-BA1F-4CF8143FE7F7}.Release|Any CPU.Build.0 = Release|Any CPU
{4914B6D0-C38B-4633-BA1F-4CF8143FE7F7}.Release|X64+X86.ActiveCfg = Release|Any CPU
{4914B6D0-C38B-4633-BA1F-4CF8143FE7F7}.Release|X64+X86.Build.0 = Release|Any CPU
{229E092C-5309-4077-9A09-70A5ADA3816D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{229E092C-5309-4077-9A09-70A5ADA3816D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{229E092C-5309-4077-9A09-70A5ADA3816D}.Debug|X64+X86.ActiveCfg = Debug|Any CPU
{229E092C-5309-4077-9A09-70A5ADA3816D}.Debug|X64+X86.Build.0 = Debug|Any CPU
{229E092C-5309-4077-9A09-70A5ADA3816D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{229E092C-5309-4077-9A09-70A5ADA3816D}.Release|Any CPU.Build.0 = Release|Any CPU
{229E092C-5309-4077-9A09-70A5ADA3816D}.Release|X64+X86.ActiveCfg = Release|Any CPU
{229E092C-5309-4077-9A09-70A5ADA3816D}.Release|X64+X86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -293,6 +316,9 @@ Global
{4805E5D7-A321-41F3-9547-CAF69D688CFB} = {E74AA64B-677C-4C35-8599-03B59982FDFC}
{4C458EA1-044F-43B5-8DC2-EF5AE2D7F45F} = {E74AA64B-677C-4C35-8599-03B59982FDFC}
{16976E7C-4826-40E5-9E17-2C4266394FD5} = {E74AA64B-677C-4C35-8599-03B59982FDFC}
{4914B6D0-C38B-4633-BA1F-4CF8143FE7F7} = {5E60B8D6-820D-4CD6-A0FE-DC2DA574499F}
{D61BEC35-E70A-4C4D-B398-7D3E1A29D03B} = {5E60B8D6-820D-4CD6-A0FE-DC2DA574499F}
{229E092C-5309-4077-9A09-70A5ADA3816D} = {D61BEC35-E70A-4C4D-B398-7D3E1A29D03B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {29C01A02-5EA4-442B-92BD-67EC119B4356}
Expand Down
24 changes: 24 additions & 0 deletions source/Reloaded.Mod.Template/Reloaded.Mod.Template.Nupkg.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PackageType>Template</PackageType>
<PackageVersion>1.0</PackageVersion>
<PackageId>Reloaded.Mod.Templates</PackageId>
<Title>Reloaded-II Mod Templates</Title>
<Authors>Sewer56</Authors>
<Description>Templates to use when creating a Reloaded Mod.</Description>
<PackageTags>dotnet-new;templates;reloaded</PackageTags>
<TargetFramework>netstandard2.0</TargetFramework>

<IncludeContentInPack>true</IncludeContentInPack>
<IncludeBuildOutput>false</IncludeBuildOutput>
<ContentTargetFolders>content</ContentTargetFolders>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
<Content Include="templates\**\*" Exclude="templates\**\bin\**;templates\**\obj\**" />
<Compile Remove="**\*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# 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: [ main ]
tags:
- '*'
pull_request:
branches: [ main ]
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

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 "http://packages.sewer56.moe:5000/v3/index.json" --skip-duplicate
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "Sewer56",
"classifications": [
"Common",
"Library",
"Games"
],
"name": "Reloaded II Mod Template",
"description": "Template for a Reloaded-II modification.",
"sourceName": "Reloaded.Mod.Template",
"defaultName": "My Reloaded-II Mod",
"identity": "Reloaded.Mod.Template",
"shortName": "reloaded",
"tags": {
"language": "C#",
"type": "project"
},
"preferNameDirectory": true,
"symbols": {
"ModName": {
"type": "parameter",
"displayName": "Mod Name",
"description": "Name of the mod as seen in the launcher.",
"datatype": "text",
"replaces": "ModNameValue",
"defaultValue": "My Cool Reloaded Mod"
},
"ModDescription": {
"type": "parameter",
"displayName": "Mod Description",
"description": "Description of the mod as seen in the launcher.",
"datatype": "text",
"replaces": "ModDescriptionValue",
"defaultValue": "Description"
},
"ModAuthor": {
"type": "parameter",
"displayName": "Mod Author",
"description": "Author of the mod as seen in the launcher.",
"datatype": "text",
"replaces": "ModAuthorValue",
"defaultValue": "Me"
},
"AddGitHubActions": {
"type": "parameter",
"displayName": "Add GitHub Actions",
"dataType": "bool",
"defaultValue": "true"
}
},
"sources": [
{
"modifiers": [
{
"condition": "(!AddGitHubActions)",
"exclude": [
".github/workflows/reloaded.yml"
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Reloaded.Mod.Template.Configuration.Implementation;
using System.ComponentModel;

namespace Reloaded.Mod.Template.Configuration
{
public class Config : Configurable<Config>
{
/*
User Properties:
- Please put all of your configurable properties here.
- Tip: Consider using the various available attributes https://stackoverflow.com/a/15051390/11106111
By default, configuration saves as "Config.json" in mod folder.
Need more config files/classes? See Configuration.cs
*/


[DisplayName("String")]
[Description("This is a string.")]
public string String { get; set; } = "Default Name";

[DisplayName("Int")]
[Description("This is an int.")]
public int Integer { get; set; } = 42;

[DisplayName("Bool")]
[Description("This is a bool.")]
public bool Boolean { get; set; } = true;

[DisplayName("Float")]
[Description("This is a floating point number.")]
public float Float { get; set; } = 6.987654F;

[DisplayName("Enum")]
[Description("This is an enumerable.")]
public SampleEnum Reloaded { get; set; } = SampleEnum.ILoveIt;

public enum SampleEnum
{
NoOpinion,
Sucks,
IsMediocre,
IsOk,
IsCool,
ILoveIt
}
}
}

0 comments on commit 5a2f97b

Please sign in to comment.