Skip to content

Commit

Permalink
Merge pull request #3 from RoGreat/develop
Browse files Browse the repository at this point in the history
Create LICENSE
Add error handling to reset adoption attempts
Revert pipeline changes
  • Loading branch information
RoGreat authored Jan 9, 2024
2 parents 85fb604 + 28826f7 commit da7b84e
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 102 deletions.
107 changes: 10 additions & 97 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
mod_description: ${{ steps.changelog.outputs.mod_description }}
steps:
- name: Setup
uses: butr/actions-common-setup@master
uses: butr/actions-common-setup@v2
with:
github-token: ${{secrets.GITHUB_TOKEN}}

Expand Down Expand Up @@ -84,101 +84,14 @@ jobs:
# STEAM_PASSWORD: ${{ secrets.STEAM_WORKSHOP_PASSWORD }}
# STEAM_AUTH_CODE: ${{ secrets.STEAM_WORKSHOP_AUTH_CODE }}

# ###########################
# # GITHUB #
# ###########################
# publish-on-github:
# needs: ["build-module"]
# uses: BUTR/workflows/.github/workflows/release-github.yml@master
# with:
# mod_id: Adoption
# mod_version: ${{ needs.build-module.outputs.mod_version }}
# mod_description: ${{ needs.build-module.outputs.mod_description }}
# artifact_name: bannerlord

# Temporary edits to module to get BUTR pipeline working
###########################
# GITHUB #
###########################
publish-on-github:
needs: ["build-module"]
name: Publish Module on GitHub
runs-on: ubuntu-latest
environment:
name: GitHub Release
url: ${{ steps.upload_release_asset.outputs.browser_download_url }}
steps:

- name: Setup
uses: butr/actions-common-setup@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Download Module artifact
uses: actions/download-artifact@v4
with:
name: bannerlord
pattern: bannerlord-*
merge-multiple: true
path: ./artifact

- name: 7z Module
run: 7z a -t7z Adoption.7z ./artifact/* -mx9
#shell: pwsh
# pwsh casues it to include the root folder

- name: Install Bannerlord.ChangelogParser
if: ${{ needs.build-module.outputs.mod_version == '' || needs.build-module.outputs.mod_description == '' }}
run: dotnet tool install -g Bannerlord.ChangelogParser;
shell: pwsh

- name: Set Version
id: set_version
run: |
if ${{ needs.build-module.outputs.mod_version == '' }}
then
vers="$(bannerlord_changelog_parser latestversion -f "$PWD/changelog.txt")"
echo "::set-output name=mod_version::$vers"
else
echo "::set-output name=mod_version::${{ needs.build-module.outputs.mod_version }}"
fi
- name: Set Description
id: set_description
run: |
if ${{ needs.build-module.outputs.mod_description == '' }}
then
desc="$(bannerlord_changelog_parser fulldescription -f "$PWD/changelog.txt")"
desc="${desc//'%'/'%25'}"
desc="${desc//$'"'/'%22'}"
desc="${desc//$'\n'/'%0A'}"
desc="${desc//$'\r'/'%0D'}"
echo "::set-output name=mod_description::$desc"
else
desc="${{ needs.build-module.outputs.mod_description }}"
desc="${desc//'%'/'%25'}"
desc="${desc//$'"'/'%22'}"
desc="${desc//$'\n'/'%0A'}"
desc="${desc//$'\r'/'%0D'}"
echo "::set-output name=mod_description::$desc"
fi
- name: Create Release
uses: actions/create-release@v1
id: create_release
with:
tag_name: v${{ steps.set_version.outputs.mod_version }}
release_name: Release ${{ steps.set_version.outputs.mod_version }}
body: ${{ steps.set_description.outputs.mod_description }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Release Asset
id: upload_release_asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Adoption.7z
asset_name: Adoption.7z
asset_content_type: application/x-7z-compressed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: BUTR/workflows/.github/workflows/release-github.yml@master
with:
mod_id: Adoption
mod_version: ${{ needs.build-module.outputs.mod_version }}
mod_description: ${{ needs.build-module.outputs.mod_description }}
artifact_name: bannerlord
2 changes: 1 addition & 1 deletion README.md → LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 RoGreat
Copyright (c) 2024 RoGreat

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
9 changes: 8 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
---------------------------------------------------------------------------------------------------
Version: 2.0.1
Game Versions: v1.2.8
* Error handling for reset adoption attempts
---------------------------------------------------------------------------------------------------
Version: 2.0.0
Game Versions: v1.2.8
* Added console cheat commands under 'adoption'
* Localization fixes and addition
* Hard dependency on BUTR stack
* Code refactor
---------------------------------------------------------------------------------------------------
Version: 1.0.1
Game Versions: v1.0.0
Expand All @@ -11,4 +18,4 @@ Game Versions: v1.0.0
Version: 1.0.0
Game Versions: v1.0.0
* Initial release
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
2 changes: 1 addition & 1 deletion src/Adoption/Adoption.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Bannerlord.BUTRModule.Sdk/1.1.0.104">

<PropertyGroup>
<Version>2.0.0</Version>
<Version>2.0.1</Version>
<TargetFrameworks>net472;net6</TargetFrameworks>
<Platforms>x64</Platforms>
<LangVersion>10.0</LangVersion>
Expand Down
4 changes: 4 additions & 0 deletions src/Adoption/Cheats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ public static class Cheats
[CommandLineFunctionality.CommandLineArgumentFunction("reset_adoption_attempts", "adoption")]
public static string ResetAdoptionAttempts(List<string> strings)
{
if (!CampaignCheats.CheckCheatUsage(ref CampaignCheats.ErrorType))
{
return CampaignCheats.ErrorType;
}
if (CampaignCheats.CheckParameters(strings, 0) && !CampaignCheats.CheckHelp(strings))
{
AdoptionCampaignBehavior campaignBehavior = Campaign.Current.GetCampaignBehavior<AdoptionCampaignBehavior>();
Expand Down
6 changes: 4 additions & 2 deletions src/Adoption/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public class Settings : AttributeGlobalSettings<Settings>
public float AdoptionChance { get; set; } = 0.5f;

[SettingPropertyButton("{=zSklyZ76}Reset Adoption Attempts", Content = "{=Z3WQjWfW}Reset", Order = 1, RequireRestart = false)]
public Action ResetAdoptionAttempts { get; set; } = () => Campaign.Current.GetCampaignBehavior<AdoptionCampaignBehavior>()?.ResetAdoptionAttempts();

public Action ResetAdoptionAttempts { get; set; } = () =>
{
Campaign.Current?.GetCampaignBehavior<AdoptionCampaignBehavior>()?.ResetAdoptionAttempts();
};
}
}

0 comments on commit da7b84e

Please sign in to comment.