Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into v7
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/locale.yml
#	contractdata/HAWKESBAY/ESCALATION/YULANIA/YULANIA2.json
#	contractdata/HAWKESBAY/ESCALATION/YULANIA/YULANIA3.json
#	contractdata/MIAMI/_H2_MIAMI_CHALLENGES.json
#	package.json
#	resources/dynamic_resources_h2.rpkg
#	resources/dynamic_resources_h3.rpkg
#	resources/locale.json
  • Loading branch information
AnthonyFuller committed Apr 29, 2024
2 parents 8c7cf4f + 251e7e4 commit 6fa3f3d
Show file tree
Hide file tree
Showing 68 changed files with 6,436 additions and 889 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ webui/dist
*.plugin.js
*Plugin.js
packaging/livesplit-node-client/build
tests/data/scripts
tests/testData/scripts
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Thanks for contributing to Peacock! Here's a bit of a template to help make sure everything relevant is covered. -->

## Scope

<!-- List any relevant changes you have made here. Be sure to link any issues fixed, or that are relevant to these changes. -->

## Test Plan

<!-- List how you have verified these changes work as intended. -->

## Checklist

<!--
Just a few reminders to make sure everything is perfect. You can place an "X" in the boxes to tick them off.
If you have not completed one of the steps below, you can create the pull request as a draft, and then check off the items as you go.
When you have completed the checklist, press the "Ready for review" button.
-->

- [ ] I have run Prettier to reformat any changed files
- [ ] I have verified my changes work
87 changes: 87 additions & 0 deletions .github/workflows/locale-mod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Update Localisation Mod

on:
push:
tags: ["v*"]
workflow_dispatch:

jobs:
update-mod:
name: Update Mod
runs-on: windows-latest

steps:
- name: Checkout Peacock
uses: actions/checkout@v4
with:
token: ${{ secrets.PEACOCKBOT_TOKEN }}
path: "./Peacock"

- name: Checkout Peacock Strings
uses: actions/checkout@v4
with:
token: ${{ secrets.PEACOCKBOT_TOKEN }}
repository: thepeacockproject/peacock-strings
path: "./PeacockStrings"

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: "./Peacock/.nvmrc"
cache: "yarn"
cache-dependency-path: "./Peacock/yarn.lock"

- name: Install Packages
run: |
cd Peacock
yarn install --immutable
#- name: Download ResourceLib
# uses: robinraju/release-downloader@v1.7
# with:
# repository: "OrfeasZ/ZHMTools"
# latest: true
# fileName: "ResourceLib-win-x64.zip"
# out-file-path: "Peacock/resources"

- name: Download RPKG-CLI
id: rpkgcli
uses: robinraju/release-downloader@v1.10
with:
repository: "glacier-modding/RPKG-Tool"
latest: true
fileName: "rpkg_*-cli.zip"
out-file-path: "Peacock/resources"

- name: Download HMLanguageTools
id: hmlt
uses: robinraju/release-downloader@v1.10
with:
repository: "AnthonyFuller/TonyTools"
latest: true
fileName: "TonyTools.zip"
out-file-path: "Peacock/resources"

- name: Unzip dependencies
run: |
cd Peacock/resources
7z x ${{ fromJson(steps.rpkgcli.outputs.downloaded_files)[0] }}
7z x ${{ fromJson(steps.hmlt.outputs.downloaded_files)[0] }}
- name: Rebuild Locale Packages
run: |
cd Peacock
yarn rebuild-locale
- name: Copy peacockstrings.locr.json
run: |
copy ./Peacock/resources/peacockstrings.locr.json ./PeacockStrings/content/chunk0/peacockstrings.locr.json
- name: Push updated Peacock LOCR
uses: EndBug/add-and-commit@v9
with:
cwd: "./PeacockStrings"
add: content/chunk0/peacockstrings.locr.json
author_name: PeacockBot
author_email: admin@thepeacockproject.org
message: "enhancement: update strings"
87 changes: 2 additions & 85 deletions .github/workflows/locale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ name: Localisation
on:
push:
branches: ["master"]
tags: ["v*"]
paths: ["resources/locale.json", ".github/workflows/locale.yml"]
workflow_dispatch:

jobs:
rebuild-locale:
name: Rebuild Localisation
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
runs-on: windows-latest

steps:
Expand Down Expand Up @@ -42,7 +40,7 @@ jobs:

- name: Download RPKG-CLI
id: rpkgcli
uses: robinraju/release-downloader@v1.9
uses: robinraju/release-downloader@v1.10
with:
repository: "glacier-modding/RPKG-Tool"
latest: true
Expand All @@ -51,7 +49,7 @@ jobs:

- name: Download HMLanguageTools
id: hmlt
uses: robinraju/release-downloader@v1.9
uses: robinraju/release-downloader@v1.10
with:
repository: "AnthonyFuller/TonyTools"
latest: true
Expand Down Expand Up @@ -79,84 +77,3 @@ jobs:
author_name: PeacockBot
author_email: admin@thepeacockproject.org
message: "[skip ci] Update locale packages"

update-mod:
name: Update Mod
if: startsWith(github.ref, 'refs/tags/')
runs-on: windows-latest

steps:
- name: Checkout Peacock
uses: actions/checkout@v4
with:
token: ${{ secrets.PEACOCKBOT_TOKEN }}
path: "./Peacock"

- name: Checkout Peacock Strings
uses: actions/checkout@v4
with:
token: ${{ secrets.PEACOCKBOT_TOKEN }}
repository: thepeacockproject/peacock-strings
path: "./PeacockStrings"

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: "./Peacock/.nvmrc"
cache: "yarn"
cache-dependency-path: "./Peacock/yarn.lock"

- name: Install Packages
run: |
cd Peacock
yarn install --immutable
#- name: Download ResourceLib
# uses: robinraju/release-downloader@v1.7
# with:
# repository: "OrfeasZ/ZHMTools"
# latest: true
# fileName: "ResourceLib-win-x64.zip"
# out-file-path: "Peacock/resources"

- name: Download RPKG-CLI
id: rpkgcli
uses: robinraju/release-downloader@v1.9
with:
repository: "glacier-modding/RPKG-Tool"
latest: true
fileName: "rpkg_*-cli.zip"
out-file-path: "Peacock/resources"

- name: Download HMLanguageTools
id: hmlt
uses: robinraju/release-downloader@v1.9
with:
repository: "AnthonyFuller/TonyTools"
latest: true
fileName: "TonyTools.zip"
out-file-path: "Peacock/resources"

- name: Unzip dependencies
run: |
cd Peacock/resources
7z x ${{ fromJson(steps.rpkgcli.outputs.downloaded_files)[0] }}
7z x ${{ fromJson(steps.hmlt.outputs.downloaded_files)[0] }}
- name: Rebuild Locale Packages
run: |
cd Peacock
yarn rebuild-locale
- name: Copy peacockstrings.locr.json
run: |
copy ./Peacock/resources/peacockstrings.locr.json ./PeacockStrings/content/chunk0/peacockstrings.locr.json
- name: Push updated Peacock LOCR
uses: EndBug/add-and-commit@v9
with:
cwd: "./PeacockStrings"
add: content/chunk0/peacockstrings.locr.json
author_name: PeacockBot
author_email: admin@thepeacockproject.org
message: "enhancement: update strings"
2 changes: 1 addition & 1 deletion .github/workflows/patcher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@v4

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.3
uses: microsoft/setup-msbuild@v2

- name: Build Patcher
run: msbuild.exe patcher\HitmanPatcher.sln -t:Build -p:Configuration=Release -p:Platform=x64 -m
Expand Down
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.12.1
v20.12.2
4 changes: 4 additions & 0 deletions components/candle/challengeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ export abstract class ChallengeRegistry {
return this.challenges[gameVersion].get(challengeId)
}

getChallengeIds(gameVersion: GameVersion): string[] {
return Array.from(this.challenges[gameVersion].keys())
}

removeChallenge(challengeId: string, gameVersion: GameVersion): boolean {
const challenge = this.challenges[gameVersion].get(challengeId)
if (!challenge) return false
Expand Down
20 changes: 6 additions & 14 deletions components/candle/progressionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,22 +240,14 @@ export class ProgressionService {
// Update the SubLocation data
const profileData = userProfile.Extensions.progression.PlayerProfileXP

let foundSubLocation = profileData.Sublocations.find(
(e) => e.Location === parentLocationId,
)

if (!foundSubLocation) {
foundSubLocation = {
Location: parentLocationId,
Xp: 0,
ActionXp: 0,
}

profileData.Sublocations.push(foundSubLocation)
profileData.Sublocations[contract.Metadata.Location] ??= {
Xp: 0,
ActionXp: 0,
}

foundSubLocation.Xp += masteryXp
foundSubLocation.ActionXp += actionXp
profileData.Sublocations[contract.Metadata.Location].Xp += masteryXp
profileData.Sublocations[contract.Metadata.Location].ActionXp +=
actionXp

return true
}
Expand Down
88 changes: 88 additions & 0 deletions components/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* The Peacock Project - a HITMAN server replacement.
* Copyright (C) 2021-2024 The Peacock Project Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

// load as soon as possible to prevent dependency issues
import "./generatedPeacockRequireTable"

// load flags as soon as possible
import { getFlag, loadFlags } from "./flags"

loadFlags()

import { program } from "commander"
import { toolsMenu } from "./tools"
import { readFileSync, writeFileSync } from "fs"
import { pack, unpack } from "msgpackr"
import { log, LogLevel } from "./loggingInterop"
import { startServer } from "./index"

program.description(
"The Peacock Project is a HITMAN™ World of Assassination Trilogy server replacement.",
)

program.option(
"--hmr",
"enable experimental hot reloading of contracts",
getFlag("experimentalHMR") as boolean,
)
program.option(
"--plugin-dev-host",
"activate plugin development features - requires plugin dev workspace setup",
getFlag("developmentPluginDevHost") as boolean,
)
program.action(startServer)

program.command("tools").description("open the tools UI").action(toolsMenu)

// noinspection RequiredAttributes
program
.command("pack")
.argument("<input>", "input file to pack")
.option("-o, --output <path>", "where to output the packed file to", "")
.description("packs an input file into a Challenge Resource Package")
.action((input, options: { output: string }) => {
const outputPath =
options.output || input.replace(/\.[^/\\.]+$/, ".crp")

writeFileSync(
outputPath,
pack(JSON.parse(readFileSync(input).toString())),
)

log(LogLevel.INFO, `Packed "${input}" to "${outputPath}" successfully.`)
})

// noinspection RequiredAttributes
program
.command("unpack")
.argument("<input>", "input file to unpack")
.option("-o, --output <path>", "where to output the unpacked file to", "")
.description("unpacks a Challenge Resource Package")
.action((input, options: { output: string }) => {
const outputPath =
options.output || input.replace(/\.[^/\\.]+$/, ".json")

writeFileSync(outputPath, JSON.stringify(unpack(readFileSync(input))))

log(
LogLevel.INFO,
`Unpacked "${input}" to "${outputPath}" successfully.`,
)
})

program.parse(process.argv)
4 changes: 2 additions & 2 deletions components/configSwizzleManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ import MultiplayerPresets from "../static/MultiplayerPresets.json"
import LobbySlimTemplate from "../static/LobbySlimTemplate.json"
import MasteryDataForLocationTemplate from "../static/MasteryDataForLocationTemplate.json"
import LegacyMasteryLocationTemplate from "../static/LegacyMasteryLocationTemplate.json"
import DefaultCpdConfig from "../static/DefaultCpdConfig.json"
import DefaultCpdConfigs from "../static/DefaultCpdConfigs.json"
import EvergreenGameChangerProperties from "../static/EvergreenGameChangerProperties.json"
import AreaMap from "../static/AreaMap.json"
import ArcadePageTemplate from "../static/ArcadePageTemplate.json"
Expand Down Expand Up @@ -217,7 +217,7 @@ const configs = {
LobbySlimTemplate,
MasteryDataForLocationTemplate,
LegacyMasteryLocationTemplate,
DefaultCpdConfig,
DefaultCpdConfigs,
EvergreenGameChangerProperties,
AreaMap,
ArcadePageTemplate,
Expand Down
Loading

0 comments on commit 6fa3f3d

Please sign in to comment.