diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..61cba3ab7 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,48 @@ +name: CI + +on: ["workflow_dispatch", "push", "pull_request"] + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: actions/cache@v4 + with: + path: | + ~/.nuget/packages + ~/.cache/bepinex + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + restore-keys: | + ${{ runner.os }}-nuget- + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + - name: Run the Cake script + uses: cake-build/cake-action@v3 + with: + verbosity: Diagnostic + + - uses: actions/upload-artifact@v4 + with: + name: TownOfUsReactivated.dll + path: source/bin/Release/net6.0/TownOfUsReactivated.dll + retention-days: 7 + + - uses: actions/upload-artifact@v4 + with: + name: TownOfUsReactivated.nupkg + path: source/bin/Release/net6.0/TownOfUsReactivated.*.nupkg + retention-days: 7 + + - uses: softprops/action-gh-release@v2 + if: github.ref_type == 'tag' + with: + draft: true + files: source/bin/Release/net6.0/TownOfUsReactivated.dll diff --git a/Images/TOU-logo.png b/Images/TOU-logo.png index 7284a4541..808affb5a 100644 Binary files a/Images/TOU-logo.png and b/Images/TOU-logo.png differ diff --git a/README.md b/README.md index e52e7aaad..b88c54d5c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -## I will be taking a break from modding, for at minimum another 3 months due to both burnout and university. Meanwhile please check out this alternative version of [Town of Us](https://github.com/AU-Avengers/TOU-Mira) (based off this mod) which should be maintained in my absence. +## TOU Reactivated was a mod that set out to continue SlushieGoose's Town of Us mod. This will continue to be supported, but little-to-no content updates will be made to keep the mod's simplicity. -## *Note: This repository is an unofficial continuation of Town of Us due to the original repository being discontinued.* +## If you wish to play a frequently updated version of TOU with more content updates, then it is recommended to use [Town of Us: Mira](https://github.com/AU-Avengers/TOU-Mira) instead. ![LOGO](./Images/TOU-logo.png) ![Roles](./Images/Roles.png) @@ -43,79 +43,88 @@ Join our [Discord](https://discord.gg/ugyc4EVUYZ) if you have any problems or wa | | [Warden](#warden) | | | ----------------------- # Releases -| Among Us - Version| Mod Version | Link | -|----------|-------------|-----------------| -| 16.0.2s & 16.0.2e | v5.3.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.3.1/ToU.v5.3.1.zip) | -| 16.0.2s & 16.0.2e | v5.3.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.3.0/ToU.v5.3.0.zip) | -| 2024.10.29s & 2024.10.29e | v5.2.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.2.1/ToU.v5.2.1.zip) | -| 2024.10.29s & 2024.10.29e | v5.2.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.2.0/ToU.v5.2.0.zip) | -| 2024.10.29s & 2024.10.29e | v5.1.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.1.2/ToU.v5.1.2.zip) | -| 2024.9.4s & 2024.9.4e | v5.1.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.1.1/ToU.v5.1.1.zip) | -| 2024.9.4s & 2024.9.4e | v5.1.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.1.0/ToU.v5.1.0.zip) | -| 2024.3.5s & 2024.3.5e | v5.0.4 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.0.4/ToU.v5.0.4.zip) | -| 2023.11.28s & 2023.11.28e | v5.0.3 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.0.3/ToU.v5.0.3.zip) | -| 2023.7.12s & 2023.7.12e | v5.0.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.0.2/ToU.v5.0.2.zip) | -| 2023.6.13s & 2023.6.13e | v5.0.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.0.1/ToU.v5.0.1.zip) | -| 2023.6.13s & 2023.6.13e | v5.0.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.0.0/ToU.v5.0.0.zip) | -| 2023.3.28s & 2023.3.28e | v4.0.6 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.6/ToU.v4.0.6.zip) | -| 2023.3.28s & 2023.3.28e | v4.0.5 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.5/ToU.v4.0.5.zip) | -| 2023.3.28s & 2023.3.28e | v4.0.4 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.4/ToU.v4.0.4.zip) | -| 2023.2.28s & 2023.2.28e | v4.0.3 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.3/ToU.v4.0.3.zip) | -| 2022.12.14s & 2022.12.14e | v4.0.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.2/ToU.v4.0.2.zip) | -| 2022.12.14s & 2022.12.14e | v4.0.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.1/ToU.v4.0.1.zip) | -| 2022.12.14s & 2022.12.14e | v4.0.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.0/ToU.v4.0.0.zip) | -| 2022.10.25s & 2022.10.25e | v3.4.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.4.0/ToU.v3.4.0.zip) | -| 2022.8.24s & 2022.8.24e & 2022.9.20s & 2022.9.20e | v3.3.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.3.2/ToU.v3.3.2.zip) | -| 2022.8.24s & 2022.8.24e & 2022.9.20s & 2022.9.20e | v3.3.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.3.1/ToU.v3.3.1.zip) | -| 2022.8.24s & 2022.8.24e & 2022.9.20s & 2022.9.20e | v3.3.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.3.0/ToU.v3.3.0.zip) | -| 2022.6.21s & 2022.6.21e & 2022.7.12s & 2022.7.12e | v3.2.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.2.0/ToU.v3.2.0.zip) | -| 2022.3.29s & 2022.3.29e & 2022.4.19e | v3.1.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.1.0/ToU.v3.1.0.zip) | -| 2022.3.29s & 2022.3.29e & 2022.4.19e | v3.0.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.0.1/ToU.v3.0.1.zip) | -| 2022.3.29s & 2022.3.29e & 2022.4.19e | v3.0.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.0.0/ToU.v3.0.0.zip) | -| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.6.5 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.5/ToU.v2.6.5.zip) | -| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.6.4 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.4/ToU.v2.6.4.zip) | -| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.6.4 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.4/ToU.v2.6.4-2021.6.30.zip) | -| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.6.3 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.3/ToU.v2.6.3.zip) | -| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.6.3 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.3/ToU.v2.6.3-2021.6.30.zip) | -| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.6.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.2/ToU.v2.6.2.zip) | -| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.6.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.2/ToU.v2.6.2-2021.6.30.zip) | -| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.6.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.1/ToU.v2.6.1.zip) | -| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.6.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.1/ToU.v2.6.1.Old.zip) | -| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.6.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.0/ToU.v2.6.0.zip) | -| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.6.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.0/ToU.v2.6.0.Old.zip) | -| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.5.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.5.1/ToU.v2.5.1.zip) | -| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.5.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.5.0/ToU.v2.5.0.zip) | -| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.5.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.5.0/ToU.v2.5.0.Old.zip) | -| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.4.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.4.2/ToU.v2.4.2.zip) | -| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.4.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.4.1/ToU.v2.4.1.zip) | -| 2021.11.9.5s & 2021.11.9.5e | v2.4.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.4.0/ToU.v2.4.0.zip) | -| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.3.4 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.3.4/ToU.v2.3.4.zip) | -| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.3.3 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.3.3/ToU.v2.3.3.zip) | -| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.3.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.3.2/ToU.v2.3.2.zip) | -| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.3.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.3.1/ToU.v2.3.1.zip) | -| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.3.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.3.0/ToU.v2.3.0.zip) | -| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.2.1 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.2.1/TOU_221.zip) | -| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.2.0 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.2.0/TOU_220.zip) | -| 2021.6.15s & 2021.6.15e | v2.1.4 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.1.4/TOU_214.zip) | -| 2021.6.15s & 2021.6.15e | v2.1.3 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.1.3/TownOfUs213_1.zip) | -| 2021.6.15s & 2021.6.15e | v2.1.2 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.1.2/TownOfUs212_1.zip) | -| 2021.6.15s & 2021.6.15e | v2.1.1 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.1.1/TownOfUs211_1.zip) | -| 2021.5.10s | v2.0.4 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.0.4/TownOfUs-v2.0.4.zip) | -| 2021.5.10s | v2.0.3 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.0.3/TownOfUs-v2.0.3.zip) | -| 2021.4.12s & 2021.4.14s | v2.0.2 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.0.2/TownOfUs-v2.0.2.zip) | -| 2021.4.12s | v2.0.1 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.0.1/TownOfUs-v2.0.1.zip) | -| 2021.3.31.3s | v2.0.0 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.0.0/TownOfUs-v2.0.0.zip) | -| 2021.3.5s | v1.2.0 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v1.2.0/TownOfUs-v1.2.0.zip) | -| 2021.3.5s | v1.1.0 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v1.1.0/TownOfUs-v1.1.0-2021.3.5s.zip) | -| 2020.12.19s | v1.1.0 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v1.1.0/TownOfUs-v1.1.0-2020.12.9s.zip) | -| 2020.12.19s | v1.0.3 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v1.0.3/TownOfUs-v1.0.3.zip) | -| 2020.12.19s | v1.0.2 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v1.0.2/TownOfUs-v1.0.2.zip) | -| 2020.12.19s | v1.0.1 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v1.0.1/TownOfUs-v1.0.1.zip) | -| 2020.12.19s | v1.0.0 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v1.0.0/TownOfUs-v1.0.0.zip) | +| Among Us - Version | Mod Version | Link | +|---------------------------------------------------------|-------------|-----------------------------------------------------------------------------------------------------------| +| 17.4.x | v6.0.0 | [Download](https://github.com/AU-Avengers/Town-Of-Us-Reactivated/releases/tag/6.0.0) | +| 16.0.2s & 16.0.2e | v5.3.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.3.1/ToU.v5.3.1.zip) | +| 16.0.2s & 16.0.2e | v5.3.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.3.0/ToU.v5.3.0.zip) | +| 2024.10.29s & 2024.10.29e | v5.2.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.2.1/ToU.v5.2.1.zip) | +| 2024.10.29s & 2024.10.29e | v5.2.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.2.0/ToU.v5.2.0.zip) | +| 2024.10.29s & 2024.10.29e | v5.1.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.1.2/ToU.v5.1.2.zip) | +| 2024.9.4s & 2024.9.4e | v5.1.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.1.1/ToU.v5.1.1.zip) | +| 2024.9.4s & 2024.9.4e | v5.1.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.1.0/ToU.v5.1.0.zip) | +| 2024.3.5s & 2024.3.5e | v5.0.4 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.0.4/ToU.v5.0.4.zip) | +| 2023.11.28s & 2023.11.28e | v5.0.3 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.0.3/ToU.v5.0.3.zip) | +| 2023.7.12s & 2023.7.12e | v5.0.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.0.2/ToU.v5.0.2.zip) | +| 2023.6.13s & 2023.6.13e | v5.0.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.0.1/ToU.v5.0.1.zip) | +| 2023.6.13s & 2023.6.13e | v5.0.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v5.0.0/ToU.v5.0.0.zip) | +| 2023.3.28s & 2023.3.28e | v4.0.6 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.6/ToU.v4.0.6.zip) | +| 2023.3.28s & 2023.3.28e | v4.0.5 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.5/ToU.v4.0.5.zip) | +| 2023.3.28s & 2023.3.28e | v4.0.4 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.4/ToU.v4.0.4.zip) | +| 2023.2.28s & 2023.2.28e | v4.0.3 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.3/ToU.v4.0.3.zip) | +| 2022.12.14s & 2022.12.14e | v4.0.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.2/ToU.v4.0.2.zip) | +| 2022.12.14s & 2022.12.14e | v4.0.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.1/ToU.v4.0.1.zip) | +| 2022.12.14s & 2022.12.14e | v4.0.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v4.0.0/ToU.v4.0.0.zip) | +| 2022.10.25s & 2022.10.25e | v3.4.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.4.0/ToU.v3.4.0.zip) | +| 2022.8.24s & 2022.8.24e & 2022.9.20s & 2022.9.20e | v3.3.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.3.2/ToU.v3.3.2.zip) | +| 2022.8.24s & 2022.8.24e & 2022.9.20s & 2022.9.20e | v3.3.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.3.1/ToU.v3.3.1.zip) | +| 2022.8.24s & 2022.8.24e & 2022.9.20s & 2022.9.20e | v3.3.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.3.0/ToU.v3.3.0.zip) | +| 2022.6.21s & 2022.6.21e & 2022.7.12s & 2022.7.12e | v3.2.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.2.0/ToU.v3.2.0.zip) | +| 2022.3.29s & 2022.3.29e & 2022.4.19e | v3.1.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.1.0/ToU.v3.1.0.zip) | +| 2022.3.29s & 2022.3.29e & 2022.4.19e | v3.0.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.0.1/ToU.v3.0.1.zip) | +| 2022.3.29s & 2022.3.29e & 2022.4.19e | v3.0.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v3.0.0/ToU.v3.0.0.zip) | +| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.6.5 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.5/ToU.v2.6.5.zip) | +| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.6.4 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.4/ToU.v2.6.4.zip) | +| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.6.4 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.4/ToU.v2.6.4-2021.6.30.zip) | +| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.6.3 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.3/ToU.v2.6.3.zip) | +| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.6.3 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.3/ToU.v2.6.3-2021.6.30.zip) | +| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.6.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.2/ToU.v2.6.2.zip) | +| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.6.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.2/ToU.v2.6.2-2021.6.30.zip) | +| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.6.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.1/ToU.v2.6.1.zip) | +| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.6.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.1/ToU.v2.6.1.Old.zip) | +| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.6.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.0/ToU.v2.6.0.zip) | +| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.6.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.6.0/ToU.v2.6.0.Old.zip) | +| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.5.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.5.1/ToU.v2.5.1.zip) | +| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.5.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.5.0/ToU.v2.5.0.zip) | +| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.5.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.5.0/ToU.v2.5.0.Old.zip) | +| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.4.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.4.2/ToU.v2.4.2.zip) | +| 2021.12.15s & 2021.12.15e Until 2022.2.24s & 2022.2.24e | v2.4.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.4.1/ToU.v2.4.1.zip) | +| 2021.11.9.5s & 2021.11.9.5e | v2.4.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.4.0/ToU.v2.4.0.zip) | +| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.3.4 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.3.4/ToU.v2.3.4.zip) | +| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.3.3 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.3.3/ToU.v2.3.3.zip) | +| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.3.2 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.3.2/ToU.v2.3.2.zip) | +| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.3.1 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.3.1/ToU.v2.3.1.zip) | +| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.3.0 | [Download](https://github.com/eDonnes124/Town-Of-Us/releases/download/v2.3.0/ToU.v2.3.0.zip) | +| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.2.1 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.2.1/TOU_221.zip) | +| 2021.6.30s & 2021.6.30e & 2021.7.20e | v2.2.0 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.2.0/TOU_220.zip) | +| 2021.6.15s & 2021.6.15e | v2.1.4 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.1.4/TOU_214.zip) | +| 2021.6.15s & 2021.6.15e | v2.1.3 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.1.3/TownOfUs213_1.zip) | +| 2021.6.15s & 2021.6.15e | v2.1.2 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.1.2/TownOfUs212_1.zip) | +| 2021.6.15s & 2021.6.15e | v2.1.1 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.1.1/TownOfUs211_1.zip) | +| 2021.5.10s | v2.0.4 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.0.4/TownOfUs-v2.0.4.zip) | +| 2021.5.10s | v2.0.3 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.0.3/TownOfUs-v2.0.3.zip) | +| 2021.4.12s & 2021.4.14s | v2.0.2 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.0.2/TownOfUs-v2.0.2.zip) | +| 2021.4.12s | v2.0.1 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.0.1/TownOfUs-v2.0.1.zip) | +| 2021.3.31.3s | v2.0.0 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v2.0.0/TownOfUs-v2.0.0.zip) | +| 2021.3.5s | v1.2.0 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v1.2.0/TownOfUs-v1.2.0.zip) | +| 2021.3.5s | v1.1.0 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v1.1.0/TownOfUs-v1.1.0-2021.3.5s.zip) | +| 2020.12.19s | v1.1.0 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v1.1.0/TownOfUs-v1.1.0-2020.12.9s.zip) | +| 2020.12.19s | v1.0.3 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v1.0.3/TownOfUs-v1.0.3.zip) | +| 2020.12.19s | v1.0.2 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v1.0.2/TownOfUs-v1.0.2.zip) | +| 2020.12.19s | v1.0.1 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v1.0.1/TownOfUs-v1.0.1.zip) | +| 2020.12.19s | v1.0.0 | [Download](https://github.com/polusgg/Town-Of-Us/releases/download/v1.0.0/TownOfUs-v1.0.0.zip) |
Changelog
+ v6.0.0 + + + + + +
+
v5.3.1 diff --git a/TownOfUs.sln b/TownOfUs.sln index e92dfd245..21b2afe00 100644 --- a/TownOfUs.sln +++ b/TownOfUs.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.10.35122.118 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TownOfUs", "source\TownOfUs.csproj", "{7B91EF68-B9BB-4138-9DEF-79C91FA554D6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TownOfUsReactivated", "source\TownOfUsReactivated.csproj", "{7B91EF68-B9BB-4138-9DEF-79C91FA554D6}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/build.cake b/build.cake new file mode 100644 index 000000000..b3dc40b0b --- /dev/null +++ b/build.cake @@ -0,0 +1,28 @@ +var target = Argument("target", "Build"); + +var workflow = BuildSystem.GitHubActions.Environment.Workflow; +var buildId = workflow.RunNumber; +var tag = workflow.RefType == GitHubActionsRefType.Tag ? workflow.RefName : null; + +Task("Build") + .Does(() => +{ + var settings = new DotNetBuildSettings + { + Configuration = "Release", + MSBuildSettings = new DotNetMSBuildSettings() + }; + + if (tag != null) + { + settings.MSBuildSettings.Version = tag; + } + else if (buildId != 0) + { + settings.MSBuildSettings.VersionSuffix = "ci." + buildId; + } + + DotNetBuild(".", settings); +}); + +RunTarget(target); diff --git a/source/Extensions/AmongUsExtensions.cs b/source/Extensions/AmongUsExtensions.cs index eec39c4c6..d6eeae4ec 100644 --- a/source/Extensions/AmongUsExtensions.cs +++ b/source/Extensions/AmongUsExtensions.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; using System; using Il2CppInterop.Runtime.InteropTypes; @@ -104,7 +104,7 @@ public static bool IsNullOrDestroyed(this System.Object obj) } public static Texture2D CreateEmptyTexture(int width = 0, int height = 0) { - return new Texture2D(width, height, TextureFormat.RGBA32, Texture.GenerateAllMips, false, IntPtr.Zero); + return new Texture2D(width, height, TextureFormat.RGBA32, Texture.GenerateAllMips, false, false); } private static class CastExtension where T : Il2CppObjectBase diff --git a/source/GlobalUsings.cs b/source/GlobalUsings.cs new file mode 100644 index 000000000..5f1491b90 --- /dev/null +++ b/source/GlobalUsings.cs @@ -0,0 +1 @@ +global using TownOfUs.Interfaces; \ No newline at end of file diff --git a/source/Patches/Roles/IGuesser.cs b/source/Interfaces/IGuesser.cs similarity index 87% rename from source/Patches/Roles/IGuesser.cs rename to source/Interfaces/IGuesser.cs index 592937b38..7db7acfb0 100644 --- a/source/Patches/Roles/IGuesser.cs +++ b/source/Interfaces/IGuesser.cs @@ -2,7 +2,7 @@ using UnityEngine; using TMPro; -namespace TownOfUs.Roles +namespace TownOfUs.Interfaces { public interface IGuesser { diff --git a/source/Patches/Roles/IVisualAlteration.cs b/source/Interfaces/IVisualAlteration.cs similarity index 79% rename from source/Patches/Roles/IVisualAlteration.cs rename to source/Interfaces/IVisualAlteration.cs index a63ac5313..5f4ec7eb2 100644 --- a/source/Patches/Roles/IVisualAlteration.cs +++ b/source/Interfaces/IVisualAlteration.cs @@ -1,4 +1,4 @@ -namespace TownOfUs.Roles +namespace TownOfUs.Interfaces { public interface IVisualAlteration { diff --git a/source/Patches/Roles/Modifiers/Aftermath.cs b/source/Modifiers/Aftermath.cs similarity index 99% rename from source/Patches/Roles/Modifiers/Aftermath.cs rename to source/Modifiers/Aftermath.cs index 53ece9d1b..07c263132 100644 --- a/source/Patches/Roles/Modifiers/Aftermath.cs +++ b/source/Modifiers/Aftermath.cs @@ -9,8 +9,9 @@ using Hazel; using TownOfUs.Patches; using System.Linq; +using TownOfUs.Roles; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Aftermath : Modifier { diff --git a/source/Patches/Roles/Modifiers/Assassin.cs b/source/Modifiers/Assassin.cs similarity index 99% rename from source/Patches/Roles/Modifiers/Assassin.cs rename to source/Modifiers/Assassin.cs index 2f8548637..832a55c1e 100644 --- a/source/Patches/Roles/Modifiers/Assassin.cs +++ b/source/Modifiers/Assassin.cs @@ -6,7 +6,7 @@ using TownOfUs.NeutralRoles.ExecutionerMod; using TownOfUs.NeutralRoles.GuardianAngelMod; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Assassin : Ability, IGuesser { diff --git a/source/Patches/Roles/Modifiers/Bait.cs b/source/Modifiers/Bait.cs similarity index 89% rename from source/Patches/Roles/Modifiers/Bait.cs rename to source/Modifiers/Bait.cs index 77a3241e0..9e3c499d2 100644 --- a/source/Patches/Roles/Modifiers/Bait.cs +++ b/source/Modifiers/Bait.cs @@ -1,4 +1,4 @@ -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Bait : Modifier { diff --git a/source/Patches/Roles/Modifiers/ButtonBarry.cs b/source/Modifiers/ButtonBarry.cs similarity index 96% rename from source/Patches/Roles/Modifiers/ButtonBarry.cs rename to source/Modifiers/ButtonBarry.cs index f1b8dc89b..254167817 100644 --- a/source/Patches/Roles/Modifiers/ButtonBarry.cs +++ b/source/Modifiers/ButtonBarry.cs @@ -1,6 +1,6 @@ using System; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class ButtonBarry : Modifier { diff --git a/source/Patches/Roles/Modifiers/Celebrity.cs b/source/Modifiers/Celebrity.cs similarity index 96% rename from source/Patches/Roles/Modifiers/Celebrity.cs rename to source/Modifiers/Celebrity.cs index 18a914486..9b94befe9 100644 --- a/source/Patches/Roles/Modifiers/Celebrity.cs +++ b/source/Modifiers/Celebrity.cs @@ -1,8 +1,9 @@ using Hazel.Dtls; using System; using TownOfUs.Extensions; +using TownOfUs.Roles; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Celebrity : Modifier { diff --git a/source/Patches/Roles/Modifiers/Diseased.cs b/source/Modifiers/Diseased.cs similarity index 90% rename from source/Patches/Roles/Modifiers/Diseased.cs rename to source/Modifiers/Diseased.cs index 1183a7632..3a269ceaa 100644 --- a/source/Patches/Roles/Modifiers/Diseased.cs +++ b/source/Modifiers/Diseased.cs @@ -1,4 +1,4 @@ -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Diseased : Modifier { diff --git a/source/Patches/Roles/Modifiers/Disperser.cs b/source/Modifiers/Disperser.cs similarity index 99% rename from source/Patches/Roles/Modifiers/Disperser.cs rename to source/Modifiers/Disperser.cs index 16b8cc677..7bda9d117 100644 --- a/source/Patches/Roles/Modifiers/Disperser.cs +++ b/source/Modifiers/Disperser.cs @@ -11,7 +11,7 @@ using TownOfUs.Modifiers.ShyMod; using TownOfUs.Extensions; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Disperser : Modifier { diff --git a/source/Patches/Roles/Modifiers/DoubleShot.cs b/source/Modifiers/DoubleShot.cs similarity index 91% rename from source/Patches/Roles/Modifiers/DoubleShot.cs rename to source/Modifiers/DoubleShot.cs index 19f654fa9..9845b08f7 100644 --- a/source/Patches/Roles/Modifiers/DoubleShot.cs +++ b/source/Modifiers/DoubleShot.cs @@ -1,4 +1,4 @@ -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class DoubleShot : Modifier { diff --git a/source/Patches/Roles/Modifiers/Flash.cs b/source/Modifiers/Flash.cs similarity index 94% rename from source/Patches/Roles/Modifiers/Flash.cs rename to source/Modifiers/Flash.cs index 129bb5c91..0a1820917 100644 --- a/source/Patches/Roles/Modifiers/Flash.cs +++ b/source/Modifiers/Flash.cs @@ -1,6 +1,6 @@ using TownOfUs.Extensions; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Flash : Modifier, IVisualAlteration { diff --git a/source/Patches/Roles/Modifiers/Frosty.cs b/source/Modifiers/Frosty.cs similarity index 92% rename from source/Patches/Roles/Modifiers/Frosty.cs rename to source/Modifiers/Frosty.cs index b94228ee5..1e0ed81ba 100644 --- a/source/Patches/Roles/Modifiers/Frosty.cs +++ b/source/Modifiers/Frosty.cs @@ -1,6 +1,6 @@ using System; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Frosty : Modifier { diff --git a/source/Patches/Roles/Modifiers/Giant.cs b/source/Modifiers/Giant.cs similarity index 95% rename from source/Patches/Roles/Modifiers/Giant.cs rename to source/Modifiers/Giant.cs index 967dd23a5..d1ea53594 100644 --- a/source/Patches/Roles/Modifiers/Giant.cs +++ b/source/Modifiers/Giant.cs @@ -1,7 +1,7 @@ using TownOfUs.Extensions; using UnityEngine; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Giant : Modifier, IVisualAlteration { diff --git a/source/Patches/Roles/Modifiers/Immovable.cs b/source/Modifiers/Immovable.cs similarity index 91% rename from source/Patches/Roles/Modifiers/Immovable.cs rename to source/Modifiers/Immovable.cs index 7a6f976ee..cd7a09d3b 100644 --- a/source/Patches/Roles/Modifiers/Immovable.cs +++ b/source/Modifiers/Immovable.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Immovable : Modifier { diff --git a/source/Patches/Roles/Modifiers/Lover.cs b/source/Modifiers/Lover.cs similarity index 98% rename from source/Patches/Roles/Modifiers/Lover.cs rename to source/Modifiers/Lover.cs index e0be03dab..c04559939 100644 --- a/source/Patches/Roles/Modifiers/Lover.cs +++ b/source/Modifiers/Lover.cs @@ -3,8 +3,9 @@ using TownOfUs.Patches; using UnityEngine; using TownOfUs.Extensions; +using TownOfUs.Roles; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Lover : Modifier { diff --git a/source/Patches/Roles/Modifiers/Mini.cs b/source/Modifiers/Mini.cs similarity index 96% rename from source/Patches/Roles/Modifiers/Mini.cs rename to source/Modifiers/Mini.cs index 8172b2a6d..2a8317f0a 100644 --- a/source/Patches/Roles/Modifiers/Mini.cs +++ b/source/Modifiers/Mini.cs @@ -2,7 +2,7 @@ using TownOfUs.Extensions; using UnityEngine; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Mini : Modifier, IVisualAlteration { diff --git a/source/Patches/Roles/Modifiers/Modifier.cs b/source/Modifiers/Modifier.cs similarity index 99% rename from source/Patches/Roles/Modifiers/Modifier.cs rename to source/Modifiers/Modifier.cs index 243547313..79741b31a 100644 --- a/source/Patches/Roles/Modifiers/Modifier.cs +++ b/source/Modifiers/Modifier.cs @@ -5,7 +5,7 @@ using TownOfUs.Extensions; using UnityEngine; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public abstract class Modifier { diff --git a/source/Patches/Roles/Modifiers/Multitasker.cs b/source/Modifiers/Multitasker.cs similarity index 90% rename from source/Patches/Roles/Modifiers/Multitasker.cs rename to source/Modifiers/Multitasker.cs index 901747648..ba257750e 100644 --- a/source/Patches/Roles/Modifiers/Multitasker.cs +++ b/source/Modifiers/Multitasker.cs @@ -1,4 +1,4 @@ -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Multitasker : Modifier { diff --git a/source/Patches/Roles/Modifiers/Radar.cs b/source/Modifiers/Radar.cs similarity index 92% rename from source/Patches/Roles/Modifiers/Radar.cs rename to source/Modifiers/Radar.cs index 1e7f694d4..390cd4e94 100644 --- a/source/Patches/Roles/Modifiers/Radar.cs +++ b/source/Modifiers/Radar.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Radar : Modifier { diff --git a/source/Patches/Roles/Modifiers/Saboteur.cs b/source/Modifiers/Saboteur.cs similarity index 91% rename from source/Patches/Roles/Modifiers/Saboteur.cs rename to source/Modifiers/Saboteur.cs index a89b1c18b..d13fb38f0 100644 --- a/source/Patches/Roles/Modifiers/Saboteur.cs +++ b/source/Modifiers/Saboteur.cs @@ -1,4 +1,4 @@ -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Saboteur : Modifier { diff --git a/source/Patches/Roles/Modifiers/Satellite.cs b/source/Modifiers/Satellite.cs similarity index 98% rename from source/Patches/Roles/Modifiers/Satellite.cs rename to source/Modifiers/Satellite.cs index 1f62cde2e..0de987f1c 100644 --- a/source/Patches/Roles/Modifiers/Satellite.cs +++ b/source/Modifiers/Satellite.cs @@ -5,7 +5,7 @@ using UnityEngine; using Reactor.Utilities; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Satellite : Modifier { diff --git a/source/Patches/Roles/Modifiers/Shy.cs b/source/Modifiers/Shy.cs similarity index 92% rename from source/Patches/Roles/Modifiers/Shy.cs rename to source/Modifiers/Shy.cs index 5ddca72f4..56b7f8557 100644 --- a/source/Patches/Roles/Modifiers/Shy.cs +++ b/source/Modifiers/Shy.cs @@ -1,6 +1,6 @@ using System; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Shy : Modifier { diff --git a/source/Patches/Roles/Modifiers/SixthSense.cs b/source/Modifiers/SixthSense.cs similarity index 90% rename from source/Patches/Roles/Modifiers/SixthSense.cs rename to source/Modifiers/SixthSense.cs index da3fa8cf8..dcc0e92dc 100644 --- a/source/Patches/Roles/Modifiers/SixthSense.cs +++ b/source/Modifiers/SixthSense.cs @@ -1,4 +1,4 @@ -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class SixthSense : Modifier { diff --git a/source/Patches/Roles/Modifiers/Sleuth.cs b/source/Modifiers/Sleuth.cs similarity index 92% rename from source/Patches/Roles/Modifiers/Sleuth.cs rename to source/Modifiers/Sleuth.cs index 260c3b03d..fd12768ec 100644 --- a/source/Patches/Roles/Modifiers/Sleuth.cs +++ b/source/Modifiers/Sleuth.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Sleuth : Modifier { diff --git a/source/Patches/Roles/Modifiers/Taskmaster.cs b/source/Modifiers/Taskmaster.cs similarity index 90% rename from source/Patches/Roles/Modifiers/Taskmaster.cs rename to source/Modifiers/Taskmaster.cs index 03fb44568..d5f09cc14 100644 --- a/source/Patches/Roles/Modifiers/Taskmaster.cs +++ b/source/Modifiers/Taskmaster.cs @@ -1,4 +1,4 @@ -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Taskmaster : Modifier { diff --git a/source/Patches/Roles/Modifiers/Tiebreaker.cs b/source/Modifiers/Tiebreaker.cs similarity index 90% rename from source/Patches/Roles/Modifiers/Tiebreaker.cs rename to source/Modifiers/Tiebreaker.cs index 329b6b9f1..3db1fc7fc 100644 --- a/source/Patches/Roles/Modifiers/Tiebreaker.cs +++ b/source/Modifiers/Tiebreaker.cs @@ -1,4 +1,4 @@ -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Tiebreaker : Modifier { diff --git a/source/Patches/Roles/Modifiers/Torch.cs b/source/Modifiers/Torch.cs similarity index 89% rename from source/Patches/Roles/Modifiers/Torch.cs rename to source/Modifiers/Torch.cs index 274d79cde..46307b271 100644 --- a/source/Patches/Roles/Modifiers/Torch.cs +++ b/source/Modifiers/Torch.cs @@ -1,4 +1,4 @@ -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Torch : Modifier { diff --git a/source/Patches/Roles/Modifiers/Underdog.cs b/source/Modifiers/Underdog.cs similarity index 96% rename from source/Patches/Roles/Modifiers/Underdog.cs rename to source/Modifiers/Underdog.cs index ff3777018..b519fd0d6 100644 --- a/source/Patches/Roles/Modifiers/Underdog.cs +++ b/source/Modifiers/Underdog.cs @@ -1,6 +1,6 @@ using TownOfUs.Modifiers.UnderdogMod; -namespace TownOfUs.Roles.Modifiers +namespace TownOfUs.Modifiers { public class Underdog : Modifier { diff --git a/source/Patches/AmongUsClient_OnGameEnd.cs b/source/Patches/AmongUsClient_OnGameEnd.cs index c9a96f8d0..6663ca303 100644 --- a/source/Patches/AmongUsClient_OnGameEnd.cs +++ b/source/Patches/AmongUsClient_OnGameEnd.cs @@ -2,7 +2,7 @@ using Il2CppSystem.Collections.Generic; using System.Linq; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using TownOfUs.Extensions; namespace TownOfUs diff --git a/source/Patches/AssetLoader.cs b/source/Patches/AssetLoader.cs index 35f714001..5f054ff6c 100644 --- a/source/Patches/AssetLoader.cs +++ b/source/Patches/AssetLoader.cs @@ -11,18 +11,17 @@ namespace TownOfUs.Patches { public class AssetLoader { - public static string[] AssetBundles = { "trappershader", "soundvision" }; public AssetLoader() { Initialize(); } public void Initialize() { - Array.ForEach(AssetBundles, x => { - var b = loadBundle(x); - bundles.Add(b.name, b); - b.GetAllAssetNames().ToList().ForEach(y => { - objectname_to_bundle.Add(ConvertToBaseName(y), x); - }); + var arch = OperatingSystem.IsAndroid() ? "android" : "win"; + var bundle = $"tour-assets-{arch}.bundle"; + var b = loadBundle(bundle); + bundles.Add(b.name, b); + b.GetAllAssetNames().ToList().ForEach(y => { + objectname_to_bundle.Add(ConvertToBaseName(y), bundle); }); } @@ -39,7 +38,7 @@ private string ConvertToBaseName(string name) return name.Split('/').Last().Split('.').First(); } - private T? LoadAsset(AssetBundle assetBundle, string name) where T : UnityObject + private T LoadAsset(AssetBundle assetBundle, string name) where T : UnityObject { var asset = assetBundle.LoadAsset(name, Il2CppType.Of())?.Cast().DontUnload(); loadedObjects.Add(name, asset); diff --git a/source/Patches/CancelCountdownStart.cs b/source/Patches/CancelCountdownStart.cs index de4c47a52..67fa0a79e 100644 --- a/source/Patches/CancelCountdownStart.cs +++ b/source/Patches/CancelCountdownStart.cs @@ -40,6 +40,7 @@ public static void PrefixStart(GameStartManager __instance) if (__instance.countDownTimer < 4f) __instance.ResetStartState(); })); CancelStartButton.gameObject.SetActive(false); + __instance.MinPlayers = 2; } [HarmonyPatch(typeof(GameStartManager), nameof(GameStartManager.Update))] diff --git a/source/Patches/ChatCommands.cs b/source/Patches/ChatCommands.cs index 9e524062a..ae6702d72 100644 --- a/source/Patches/ChatCommands.cs +++ b/source/Patches/ChatCommands.cs @@ -1,6 +1,6 @@ using HarmonyLib; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.Patches { diff --git a/source/Patches/CrewmateRoles/AltruistMod/Coroutine.cs b/source/Patches/CrewmateRoles/AltruistMod/Coroutine.cs index b9417f8b9..bfaffd913 100644 --- a/source/Patches/CrewmateRoles/AltruistMod/Coroutine.cs +++ b/source/Patches/CrewmateRoles/AltruistMod/Coroutine.cs @@ -14,7 +14,7 @@ using Reactor.Networking.Extensions; using TownOfUs.CrewmateRoles.HaunterMod; using TownOfUs.NeutralRoles.PhantomMod; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.CrewmateRoles.AltruistMod { diff --git a/source/Patches/CrewmateRoles/DeputyMod/AddButton.cs b/source/Patches/CrewmateRoles/DeputyMod/AddButton.cs index e78a9d60b..04a007121 100644 --- a/source/Patches/CrewmateRoles/DeputyMod/AddButton.cs +++ b/source/Patches/CrewmateRoles/DeputyMod/AddButton.cs @@ -14,7 +14,7 @@ using TownOfUs.NeutralRoles.DoomsayerMod; using TownOfUs.Patches; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; using UnityEngine.UI; using Object = UnityEngine.Object; diff --git a/source/Patches/CrewmateRoles/HunterMod/HudManagerUpdate.cs b/source/Patches/CrewmateRoles/HunterMod/HudManagerUpdate.cs index bfdf093d4..3ce49890e 100644 --- a/source/Patches/CrewmateRoles/HunterMod/HudManagerUpdate.cs +++ b/source/Patches/CrewmateRoles/HunterMod/HudManagerUpdate.cs @@ -2,7 +2,7 @@ using System.Linq; using TownOfUs.Extensions; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; namespace TownOfUs.CrewmateRoles.HunterMod diff --git a/source/Patches/CrewmateRoles/HunterMod/Retribution.cs b/source/Patches/CrewmateRoles/HunterMod/Retribution.cs index 26a847fb9..2f6202a14 100644 --- a/source/Patches/CrewmateRoles/HunterMod/Retribution.cs +++ b/source/Patches/CrewmateRoles/HunterMod/Retribution.cs @@ -7,7 +7,7 @@ using TownOfUs.Extensions; using TownOfUs.Patches; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.CrewmateRoles.HunterMod { diff --git a/source/Patches/CrewmateRoles/JailorMod/AddButton.cs b/source/Patches/CrewmateRoles/JailorMod/AddButton.cs index 1c1eb2a3b..5c6d268f6 100644 --- a/source/Patches/CrewmateRoles/JailorMod/AddButton.cs +++ b/source/Patches/CrewmateRoles/JailorMod/AddButton.cs @@ -6,7 +6,7 @@ using TownOfUs.ImpostorRoles.BlackmailerMod; using TownOfUs.Patches; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; using UnityEngine.UI; using Object = UnityEngine.Object; diff --git a/source/Patches/CrewmateRoles/MayorMod/AddButton.cs b/source/Patches/CrewmateRoles/MayorMod/AddButton.cs index 5178007f9..7db4eacc6 100644 --- a/source/Patches/CrewmateRoles/MayorMod/AddButton.cs +++ b/source/Patches/CrewmateRoles/MayorMod/AddButton.cs @@ -4,7 +4,7 @@ using TownOfUs.Modifiers.AssassinMod; using TownOfUs.CrewmateRoles.VigilanteMod; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; using UnityEngine.UI; using Object = UnityEngine.Object; diff --git a/source/Patches/CrewmateRoles/MayorMod/RegisterExtraVotes.cs b/source/Patches/CrewmateRoles/MayorMod/RegisterExtraVotes.cs index 33f382023..6aa3ffabc 100644 --- a/source/Patches/CrewmateRoles/MayorMod/RegisterExtraVotes.cs +++ b/source/Patches/CrewmateRoles/MayorMod/RegisterExtraVotes.cs @@ -4,7 +4,7 @@ using Reactor.Utilities; using TownOfUs.Extensions; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using Il2CppInterop.Runtime.InteropTypes.Arrays; using UnityEngine; using Object = UnityEngine.Object; diff --git a/source/Patches/CrewmateRoles/PoliticianMod/HudManagerUpdate.cs b/source/Patches/CrewmateRoles/PoliticianMod/HudManagerUpdate.cs index 91328d90b..722ea7a15 100644 --- a/source/Patches/CrewmateRoles/PoliticianMod/HudManagerUpdate.cs +++ b/source/Patches/CrewmateRoles/PoliticianMod/HudManagerUpdate.cs @@ -2,7 +2,7 @@ using HarmonyLib; using TownOfUs.Extensions; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; namespace TownOfUs.CrewmateRoles.PoliticianMod diff --git a/source/Patches/CrewmateRoles/SeerMod/Update.cs b/source/Patches/CrewmateRoles/SeerMod/Update.cs index b15ff355c..eff6515d1 100644 --- a/source/Patches/CrewmateRoles/SeerMod/Update.cs +++ b/source/Patches/CrewmateRoles/SeerMod/Update.cs @@ -2,7 +2,7 @@ using TownOfUs.CrewmateRoles.ImitatorMod; using TownOfUs.Extensions; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; namespace TownOfUs.CrewmateRoles.SeerMod diff --git a/source/Patches/CrewmateRoles/SnitchMod/HighlightImpostors.cs b/source/Patches/CrewmateRoles/SnitchMod/HighlightImpostors.cs index e0158a14d..2a35c3dd6 100644 --- a/source/Patches/CrewmateRoles/SnitchMod/HighlightImpostors.cs +++ b/source/Patches/CrewmateRoles/SnitchMod/HighlightImpostors.cs @@ -2,7 +2,7 @@ using TownOfUs.CrewmateRoles.ImitatorMod; using TownOfUs.Extensions; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.CrewmateRoles.SnitchMod { diff --git a/source/Patches/CrewmateRoles/VigilanteMod/AddButton.cs b/source/Patches/CrewmateRoles/VigilanteMod/AddButton.cs index 88eaf94fb..2545d9386 100644 --- a/source/Patches/CrewmateRoles/VigilanteMod/AddButton.cs +++ b/source/Patches/CrewmateRoles/VigilanteMod/AddButton.cs @@ -4,7 +4,7 @@ using TMPro; using TownOfUs.Patches; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; using UnityEngine.UI; using Object = UnityEngine.Object; diff --git a/source/Patches/CrewmateRoles/VigilanteMod/VigilanteKill.cs b/source/Patches/CrewmateRoles/VigilanteMod/VigilanteKill.cs index 9c9a8038e..867751ac5 100644 --- a/source/Patches/CrewmateRoles/VigilanteMod/VigilanteKill.cs +++ b/source/Patches/CrewmateRoles/VigilanteMod/VigilanteKill.cs @@ -1,6 +1,6 @@ using System.Linq; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; using UnityEngine.UI; using Il2CppInterop.Runtime.InteropTypes.Arrays; diff --git a/source/Patches/CustomHats/CustomHatPatch.cs b/source/Patches/CustomHats/CustomHatPatch.cs index fbb65c7c3..1db420cf9 100644 --- a/source/Patches/CustomHats/CustomHatPatch.cs +++ b/source/Patches/CustomHats/CustomHatPatch.cs @@ -9,6 +9,8 @@ using Reactor.Utilities.Extensions; using TMPro; using UnityEngine; +using UnityEngine.Events; +using UnityEngine.UI; using Object = UnityEngine.Object; namespace TownOfUs.Patches.CustomHats @@ -22,7 +24,7 @@ public static class HatsTab_OnEnable public static string LastHeader = string.Empty; - private static IEnumerator? loadRoutine; + private static IEnumerator loadRoutine; private static int hatIndex; @@ -51,10 +53,57 @@ public static bool Prefix(HatsTab __instance) } GenHats(__instance, CurrentPage); + var leftButtonElement = Object.Instantiate(PlayerCustomizationMenu.Instance.BackButton.gameObject, __instance.scroller.Inner); + var leftSpriteRenderer = leftButtonElement.GetComponent(); + var leftButton = leftButtonElement.GetComponent(); + + leftButtonElement.transform.localPosition = new Vector3(-1f, -1f, -1); + leftSpriteRenderer.sprite = TownOfUs.NextSprite; + leftSpriteRenderer.maskInteraction = SpriteMaskInteraction.VisibleInsideMask; + leftSpriteRenderer.flipX = true; + + leftButton.OnMouseOver = new UnityEvent(); + leftButton.OnMouseOver.AddListener((Action)(() => leftSpriteRenderer.sprite = TownOfUs.NextActiveSprite)); + leftButton.OnMouseOut = new UnityEvent(); + leftButton.OnMouseOut.AddListener((Action)(() => leftSpriteRenderer.sprite = TownOfUs.NextSprite)); + + leftButton.OnClick = new Button.ButtonClickedEvent(); + leftButton.OnClick.AddListener((Action)(() => PreviousPage(__instance))); + + var rightButtonElement = Object.Instantiate(leftButtonElement, __instance.scroller.Inner); + var rightSpriteRenderer = rightButtonElement.GetComponent(); + var rightButton = rightButtonElement.GetComponent(); + + rightButtonElement.transform.localPosition = new Vector3(2.7f, -1f, -1); + rightSpriteRenderer.sprite = TownOfUs.NextSprite; + rightSpriteRenderer.maskInteraction = SpriteMaskInteraction.VisibleInsideMask; + rightSpriteRenderer.flipX = false; + + rightButton.OnMouseOver = new UnityEvent(); + rightButton.OnMouseOver.AddListener((Action)(() => rightSpriteRenderer.sprite = TownOfUs.NextActiveSprite)); + rightButton.OnMouseOut = new UnityEvent(); + rightButton.OnMouseOut.AddListener((Action)(() => rightSpriteRenderer.sprite = TownOfUs.NextSprite)); + + rightButton.OnClick = new Button.ButtonClickedEvent(); + rightButton.OnClick.AddListener((Action)(() => NextPage(__instance))); return false; } + private static void PreviousPage(HatsTab hatsTab) + { + CurrentPage--; + CurrentPage = CurrentPage < 0 ? HatCache.StoreNames.Count - 1 : CurrentPage; + GenHats(hatsTab, CurrentPage); + } + + private static void NextPage(HatsTab hatsTab) + { + CurrentPage++; + CurrentPage = CurrentPage > HatCache.StoreNames.Count - 1 ? 0 : CurrentPage; + GenHats(hatsTab, CurrentPage); + } + [HarmonyPatch(typeof(HatsTab), nameof(HatsTab.Update))] [HarmonyPrefix] @@ -64,15 +113,11 @@ public static void Update(HatsTab __instance) if (Input.GetKeyDown(KeyCode.LeftControl) || Input.GetKeyDown(KeyCode.RightControl) || Input.GetKeyDown(KeyCode.LeftArrow)) { - CurrentPage--; - CurrentPage = CurrentPage < 0 ? HatCache.StoreNames.Count - 1 : CurrentPage; - GenHats(__instance, CurrentPage); + PreviousPage(__instance); } else if (Input.GetKeyDown(KeyCode.Tab) || Input.GetKeyDown(KeyCode.RightArrow)) { - CurrentPage++; - CurrentPage = CurrentPage > HatCache.StoreNames.Count - 1 ? 0 : CurrentPage; - GenHats(__instance, CurrentPage); + NextPage(__instance); } } @@ -99,7 +144,7 @@ public static void GenHats(HatsTab __instance, int page) var text = Object.Instantiate(groupNameText, __instance.scroller.Inner); text.gameObject.transform.localScale = Vector3.one; text.GetComponent().Destroy(); - text.text = $"{groupName}\nPress Ctrl & Tab to cycle pages"; + text.text = $"{groupName} ({page + 1} / {HatCache.StoreNames.Count})\nPress Ctrl & Tab to cycle pages"; text.alignment = TextAlignmentOptions.Center; text.fontSize = 3f; text.fontSizeMax = 3f; diff --git a/source/Patches/CustomOption/LocalOnlySettings.cs b/source/Patches/CustomOption/LocalOnlySettings.cs index 216bd9d47..43bef8e9d 100644 --- a/source/Patches/CustomOption/LocalOnlySettings.cs +++ b/source/Patches/CustomOption/LocalOnlySettings.cs @@ -1,6 +1,7 @@ using HarmonyLib; using UnityEngine; using System; +using System.IO; using TMPro; using UnityEngine.Events; using static UnityEngine.UI.Button; @@ -37,6 +38,10 @@ public class ClientOptions [HarmonyPatch(typeof(MainMenuManager), nameof(MainMenuManager.Start))] public static void MainMenuManager_StartPostfix(MainMenuManager __instance) { + if (!Directory.Exists(TownOfUs.DataPath)) + { + Directory.CreateDirectory(TownOfUs.DataPath); + } // Prefab for the title var go = new GameObject("TitleText"); var tmp = go.AddComponent(); diff --git a/source/Patches/CustomOption/Patches.cs b/source/Patches/CustomOption/Patches.cs index 28c5f69f7..02b7a417b 100644 --- a/source/Patches/CustomOption/Patches.cs +++ b/source/Patches/CustomOption/Patches.cs @@ -57,7 +57,7 @@ public static void Postfix(GameSettingMenu __instance, int tabNum, bool previewO { var tab = SettingsUpdate.Tabs[tabNum].GetComponent(); tab.settingsContainer.DestroyChildren(); - var files = Directory.GetFiles(Application.persistentDataPath, "*.txt").Select(x => Path.GetFileNameWithoutExtension(x).Split('/')[^1].Split('\\')[^1]).ToList(); + var files = Directory.GetFiles(TownOfUs.DataPath, "*.txt").Select(x => Path.GetFileNameWithoutExtension(x).Split('/')[^1].Split('\\')[^1]).ToList(); float num = 1.5f; if (tabNum == 6) { @@ -354,7 +354,7 @@ public static void ImportSlot(GameSettingMenu __instance, string preset) try { - var path = Path.Combine(Application.persistentDataPath, $"{preset}.txt"); + var path = Path.Combine(TownOfUs.DataPath, $"{preset}.txt"); text = File.ReadAllText(path); } catch @@ -415,13 +415,13 @@ public static void ExportSlot(GameSettingMenu __instance) builder.AppendLine(option.Value.ToString()); } - var text = Path.Combine(Application.persistentDataPath, "Saved Settings 1.txt"); + var text = Path.Combine(TownOfUs.DataPath, "Saved Settings 1.txt"); var i = 1; while (File.Exists(text)) { i++; - text = Path.Combine(Application.persistentDataPath, $"Saved Settings {i}.txt"); + text = Path.Combine(TownOfUs.DataPath, $"Saved Settings {i}.txt"); } try @@ -449,7 +449,7 @@ public static void ExportSlot(GameSettingMenu __instance, string preset) try { - var path = Path.Combine(Application.persistentDataPath, $"{preset}.txt"); + var path = Path.Combine(TownOfUs.DataPath, $"{preset}.txt"); File.WriteAllText(path, builder.ToString()); Coroutines.Start(TabPatches.Flash(__instance, ExportText, Color.green)); } @@ -568,6 +568,11 @@ public static void CreateButton(LobbyViewSettingsPane __instance, int target, st public static void AddSettings(LobbyViewSettingsPane __instance, MultiMenu menu) { + foreach (var option in __instance.settingsInfo) + { + option.Destroy(); + } + __instance.settingsInfo.Clear(); var options = CustomOption.AllOptions.Where(x => x.Menu == menu).ToList(); float num = 1.5f; @@ -595,7 +600,6 @@ public static void AddSettings(LobbyViewSettingsPane __instance, MultiMenu menu) else { - var playerCount = GameOptionsManager.Instance.currentNormalGameOptions.MaxPlayers; if (option.Name.StartsWith("Slot ")) { continue; diff --git a/source/Patches/Disconnect.cs b/source/Patches/Disconnect.cs index b2cd8c950..808fb459b 100644 --- a/source/Patches/Disconnect.cs +++ b/source/Patches/Disconnect.cs @@ -7,7 +7,7 @@ using TownOfUs.CrewmateRoles.VigilanteMod; using TownOfUs.Modifiers.AssassinMod; using TownOfUs.NeutralRoles.DoomsayerMod; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine.UI; using TownOfUs.ImpostorRoles.BlackmailerMod; using Reactor.Utilities.Extensions; diff --git a/source/Patches/DiscordStatus.cs b/source/Patches/DiscordStatus.cs index fb5dca70c..7d960c809 100644 --- a/source/Patches/DiscordStatus.cs +++ b/source/Patches/DiscordStatus.cs @@ -9,7 +9,7 @@ internal class DiscordStatus [HarmonyPrefix] public static void Prefix([HarmonyArgument(0)] Activity activity) { - activity.Details += $" Town of Us v{TownOfUs.VersionString}"; + activity.Details += $" Town of Us: Reactivated v{TownOfUs.VersionString}"; } } } diff --git a/source/Patches/DisplayRoleList.cs b/source/Patches/DisplayRoleList.cs index fd4558399..e7d737dac 100644 --- a/source/Patches/DisplayRoleList.cs +++ b/source/Patches/DisplayRoleList.cs @@ -1,8 +1,12 @@ using System.Collections.Generic; +using System.Reflection; using AmongUs.GameOptions; using HarmonyLib; +using Il2CppInterop.Runtime.InteropTypes; +using Reactor.Utilities.Extensions; using TMPro; using TownOfUs.CustomOption; +using TownOfUs.Utilities; using UnityEngine; namespace TownOfUs.Patches @@ -10,7 +14,8 @@ namespace TownOfUs.Patches [HarmonyPatch(typeof(HudManager), nameof(HudManager.Update))] internal static class DisplayRoleList { - public static TextMeshPro RoleList; + public static GameObject RoleList; + public static TextMeshPro RoleListTextComp; private static readonly List roleListText = new List { @@ -50,21 +55,36 @@ private static string GetRoleForSlot(int slotValue) public static void Postfix(HudManager __instance) { - if (AmongUsClient.Instance?.GameState != InnerNet.InnerNetClient.GameStates.Joined) return; if (GameOptionsManager.Instance.CurrentGameOptions.GameMode == GameModes.HideNSeek) return; - var pingTracker = UnityEngine.Object.FindObjectOfType(true); - if (pingTracker == null) + if (!LobbyBehaviour.Instance) + { + if (RoleList) + { + RoleList.SetActive(false); + } + return; + } - if (RoleList != null) + if (!RoleList) { - UnityEngine.Object.Destroy(RoleList.gameObject); - RoleList = null; - } + var pingTracker = Object.FindObjectOfType(true); + RoleList = Object.Instantiate(pingTracker.gameObject, __instance.transform); + RoleList.name = "RoleListText"; + var pos = RoleList.gameObject.GetComponent(); + pos.Alignment = AspectPosition.EdgeAlignments.LeftTop; + pos.DistanceFromEdge = new Vector3(0.43f, 0.1f, 1f); + RoleList.GetComponent().Destroy(); - RoleList = UnityEngine.Object.Instantiate(pingTracker.GetComponent(), __instance.transform); - if (RoleList != null) + RoleListTextComp = RoleList.GetComponent(); + RoleListTextComp.alignment = TextAlignmentOptions.TopLeft; + RoleListTextComp.verticalAlignment = VerticalAlignmentOptions.Top; + RoleListTextComp.fontSize = RoleListTextComp.fontSizeMin = RoleListTextComp.fontSizeMax = 3f; + RoleList.SetActive(false); + } + + if (RoleList) { string rolelist = string.Empty; @@ -96,38 +116,8 @@ public static void Postfix(HudManager __instance) rolelist += $"{GetRoleForSlot(slotValue)}\n"; } - - RoleList.alignment = TextAlignmentOptions.TopLeft; - RoleList.verticalAlignment = VerticalAlignmentOptions.Top; - RoleList.transform.localPosition = new Vector3(-4.9f, 2.9f, 0); - RoleList.fontSize = RoleList.fontSizeMin = RoleList.fontSizeMax = 3f; - - RoleList.text = $"Role List:\n{rolelist}"; - RoleList.enabled = true; - } - } - } - - [HarmonyPatch(typeof(IntroCutscene), nameof(IntroCutscene.OnDestroy))] - internal static class HideRoleListInIntroCutscene - { - private static void Postfix() - { - if (DisplayRoleList.RoleList != null) - { - DisplayRoleList.RoleList.enabled = false; - } - } - } - - [HarmonyPatch(typeof(LobbyBehaviour), nameof(LobbyBehaviour.Start))] - internal static class RevealRoleListInLobby - { - private static void Postfix() - { - if (DisplayRoleList.RoleList != null) - { - DisplayRoleList.RoleList.enabled = true; + RoleListTextComp.text = $"Role List:\n{rolelist}"; + RoleList.SetActive(true); } } } diff --git a/source/Patches/HauntPatch.cs b/source/Patches/HauntPatch.cs index 2dc853854..76ae9e2c3 100644 --- a/source/Patches/HauntPatch.cs +++ b/source/Patches/HauntPatch.cs @@ -1,5 +1,5 @@ using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using HarmonyLib; using AmongUs.GameOptions; diff --git a/source/Patches/ImpostorRoles/BlackmailerMod/HudManagerUpdate.cs b/source/Patches/ImpostorRoles/BlackmailerMod/HudManagerUpdate.cs index 2b2557a07..b56808eb1 100644 --- a/source/Patches/ImpostorRoles/BlackmailerMod/HudManagerUpdate.cs +++ b/source/Patches/ImpostorRoles/BlackmailerMod/HudManagerUpdate.cs @@ -3,7 +3,7 @@ using UnityEngine; using System.Linq; using TownOfUs.Extensions; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.ImpostorRoles.BlackmailerMod { diff --git a/source/Patches/ImpostorRoles/HypnotistMod/HudManagerUpdate.cs b/source/Patches/ImpostorRoles/HypnotistMod/HudManagerUpdate.cs index 4d7221956..24501e209 100644 --- a/source/Patches/ImpostorRoles/HypnotistMod/HudManagerUpdate.cs +++ b/source/Patches/ImpostorRoles/HypnotistMod/HudManagerUpdate.cs @@ -3,7 +3,7 @@ using UnityEngine; using System.Linq; using TownOfUs.Extensions; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.ImpostorRoles.HypnotistMod { diff --git a/source/Patches/ImpostorRoles/ScavengerMod/HudManagerUpdate.cs b/source/Patches/ImpostorRoles/ScavengerMod/HudManagerUpdate.cs index e02e79489..80b7bc4c2 100644 --- a/source/Patches/ImpostorRoles/ScavengerMod/HudManagerUpdate.cs +++ b/source/Patches/ImpostorRoles/ScavengerMod/HudManagerUpdate.cs @@ -5,7 +5,7 @@ using TownOfUs.Modifiers.UnderdogMod; using TownOfUs.Patches; using TownOfUs.Extensions; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.ImpostorRoles.ScavengerMod { diff --git a/source/Patches/ImpostorRoles/TraitorMod/SetTraitor.cs b/source/Patches/ImpostorRoles/TraitorMod/SetTraitor.cs index b0d020ffa..c5d11060a 100644 --- a/source/Patches/ImpostorRoles/TraitorMod/SetTraitor.cs +++ b/source/Patches/ImpostorRoles/TraitorMod/SetTraitor.cs @@ -9,7 +9,7 @@ using TownOfUs.Patches; using AmongUs.GameOptions; using TownOfUs.CrewmateRoles.ImitatorMod; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using Il2CppSystem.Linq; using TownOfUs.CrewmateRoles.PlumberMod; diff --git a/source/Patches/ImpostorRoles/TraitorMod/TraitorMenu.cs b/source/Patches/ImpostorRoles/TraitorMod/TraitorMenu.cs index d4c913bec..df8621a2e 100644 --- a/source/Patches/ImpostorRoles/TraitorMod/TraitorMenu.cs +++ b/source/Patches/ImpostorRoles/TraitorMod/TraitorMenu.cs @@ -51,7 +51,7 @@ public IEnumerator Open(float delay) private static ShapeshifterMinigame GetShapeshifterMenu() { - var rolePrefab = RoleManager.Instance.AllRoles.First(r => r.Role == RoleTypes.Shapeshifter); + var rolePrefab = RoleManager.Instance.AllRoles.ToArray().First(r => r.Role == RoleTypes.Shapeshifter); return GameObject.Instantiate(rolePrefab?.Cast(), GameData.Instance.transform).ShapeshifterMenu; } diff --git a/source/Patches/Keybinds.cs b/source/Patches/Keybinds.cs index 16f16aefb..62a67110a 100644 --- a/source/Patches/Keybinds.cs +++ b/source/Patches/Keybinds.cs @@ -3,8 +3,8 @@ using Rewired.Data; using System.Linq; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; -using Ability = TownOfUs.Roles.Modifiers.Ability; +using TownOfUs.Modifiers; +using Ability = TownOfUs.Modifiers.Ability; namespace TownOfUs { diff --git a/source/Patches/KillButtonSprite.cs b/source/Patches/KillButtonSprite.cs index 1228483a0..35de92dfd 100644 --- a/source/Patches/KillButtonSprite.cs +++ b/source/Patches/KillButtonSprite.cs @@ -2,7 +2,7 @@ using HarmonyLib; using TownOfUs.Extensions; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; namespace TownOfUs diff --git a/source/Patches/LogoPatch.cs b/source/Patches/LogoPatch.cs index 6122119d8..1aa52b7bc 100644 --- a/source/Patches/LogoPatch.cs +++ b/source/Patches/LogoPatch.cs @@ -17,8 +17,8 @@ static void Postfix(PingTracker __instance) var position = touLogo.AddComponent(); - position.DistanceFromEdge = new Vector3(-0.2f, 1.5f, 8f); - position.Alignment = AspectPosition.EdgeAlignments.Top; + position.DistanceFromEdge = new Vector3(-0.2f, 0.75f, 8f); + position.Alignment = AspectPosition.EdgeAlignments.Center; position.StartCoroutine(Effects.Lerp(0.1f, new System.Action((p) => { diff --git a/source/Patches/LowLights.cs b/source/Patches/LowLights.cs index 607dcefc0..87401770b 100644 --- a/source/Patches/LowLights.cs +++ b/source/Patches/LowLights.cs @@ -2,7 +2,7 @@ using HarmonyLib; using TownOfUs.Extensions; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; namespace TownOfUs diff --git a/source/Patches/Modifiers/AssassinMod/AddButton.cs b/source/Patches/Modifiers/AssassinMod/AddButton.cs index 9ad0c0d27..ed37e51d6 100644 --- a/source/Patches/Modifiers/AssassinMod/AddButton.cs +++ b/source/Patches/Modifiers/AssassinMod/AddButton.cs @@ -5,7 +5,7 @@ using TownOfUs.Extensions; using TownOfUs.Patches; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; using UnityEngine.UI; using Object = UnityEngine.Object; diff --git a/source/Patches/Modifiers/AssassinMod/AssassinKill.cs b/source/Patches/Modifiers/AssassinMod/AssassinKill.cs index 11010e9de..a3d94d042 100644 --- a/source/Patches/Modifiers/AssassinMod/AssassinKill.cs +++ b/source/Patches/Modifiers/AssassinMod/AssassinKill.cs @@ -8,7 +8,7 @@ using TownOfUs.CrewmateRoles.VigilanteMod; using TownOfUs.NeutralRoles.DoomsayerMod; using TownOfUs.ImpostorRoles.BlackmailerMod; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using TownOfUs.Extensions; using TownOfUs.CrewmateRoles.ImitatorMod; using TownOfUs.Patches; diff --git a/source/Patches/Modifiers/AssassinMod/NotVote.cs b/source/Patches/Modifiers/AssassinMod/NotVote.cs index 9009c43f1..c297f37a1 100644 --- a/source/Patches/Modifiers/AssassinMod/NotVote.cs +++ b/source/Patches/Modifiers/AssassinMod/NotVote.cs @@ -1,5 +1,5 @@ using HarmonyLib; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.Modifiers.AssassinMod { diff --git a/source/Patches/Modifiers/AssassinMod/ShowHideButtons.cs b/source/Patches/Modifiers/AssassinMod/ShowHideButtons.cs index 930077886..e23d7d45d 100644 --- a/source/Patches/Modifiers/AssassinMod/ShowHideButtons.cs +++ b/source/Patches/Modifiers/AssassinMod/ShowHideButtons.cs @@ -1,6 +1,6 @@ using HarmonyLib; using System.Linq; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine.UI; using UnityEngine; diff --git a/source/Patches/Modifiers/ButtonBarryMod/PerformKill.cs b/source/Patches/Modifiers/ButtonBarryMod/PerformKill.cs index fb3688aeb..cfe64c28f 100644 --- a/source/Patches/Modifiers/ButtonBarryMod/PerformKill.cs +++ b/source/Patches/Modifiers/ButtonBarryMod/PerformKill.cs @@ -1,5 +1,5 @@ using HarmonyLib; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.Modifiers.ButtonBarryMod { diff --git a/source/Patches/Modifiers/ButtonBarryMod/Update.cs b/source/Patches/Modifiers/ButtonBarryMod/Update.cs index 75cb6ae0d..a7da1b5fe 100644 --- a/source/Patches/Modifiers/ButtonBarryMod/Update.cs +++ b/source/Patches/Modifiers/ButtonBarryMod/Update.cs @@ -1,5 +1,5 @@ using HarmonyLib; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; using TMPro; diff --git a/source/Patches/Modifiers/CelebrityMod/MeetingStart.cs b/source/Patches/Modifiers/CelebrityMod/MeetingStart.cs index aeeac4bb5..91670ddd2 100644 --- a/source/Patches/Modifiers/CelebrityMod/MeetingStart.cs +++ b/source/Patches/Modifiers/CelebrityMod/MeetingStart.cs @@ -1,5 +1,5 @@ using HarmonyLib; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.Modifiers.CelebrityMod { diff --git a/source/Patches/Modifiers/CelebrityMod/RoomTracker.cs b/source/Patches/Modifiers/CelebrityMod/RoomTracker.cs index eef2719fd..fd7b4e25b 100644 --- a/source/Patches/Modifiers/CelebrityMod/RoomTracker.cs +++ b/source/Patches/Modifiers/CelebrityMod/RoomTracker.cs @@ -1,5 +1,5 @@ using HarmonyLib; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs { diff --git a/source/Patches/Modifiers/DisperserMod/PerformKill.cs b/source/Patches/Modifiers/DisperserMod/PerformKill.cs index a5c815d88..1029e8b27 100644 --- a/source/Patches/Modifiers/DisperserMod/PerformKill.cs +++ b/source/Patches/Modifiers/DisperserMod/PerformKill.cs @@ -1,5 +1,5 @@ using HarmonyLib; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.Modifiers.DisperserMod { diff --git a/source/Patches/Modifiers/DisperserMod/Update.cs b/source/Patches/Modifiers/DisperserMod/Update.cs index 15a908fa2..56d52ce4b 100644 --- a/source/Patches/Modifiers/DisperserMod/Update.cs +++ b/source/Patches/Modifiers/DisperserMod/Update.cs @@ -1,5 +1,5 @@ using HarmonyLib; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; using TMPro; diff --git a/source/Patches/Modifiers/ImmovableMod/HudManagerUpdate.cs b/source/Patches/Modifiers/ImmovableMod/HudManagerUpdate.cs index ed89ef857..7cc5f454b 100644 --- a/source/Patches/Modifiers/ImmovableMod/HudManagerUpdate.cs +++ b/source/Patches/Modifiers/ImmovableMod/HudManagerUpdate.cs @@ -1,5 +1,5 @@ using HarmonyLib; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.Modifiers.ImmovableMod { diff --git a/source/Patches/Modifiers/LoversMod/Die.cs b/source/Patches/Modifiers/LoversMod/Die.cs index b7ec6b30d..5291cecbd 100644 --- a/source/Patches/Modifiers/LoversMod/Die.cs +++ b/source/Patches/Modifiers/LoversMod/Die.cs @@ -1,5 +1,5 @@ using HarmonyLib; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using TownOfUs.Roles; namespace TownOfUs.Modifiers.LoversMod diff --git a/source/Patches/Modifiers/LoversMod/Outro.cs b/source/Patches/Modifiers/LoversMod/Outro.cs index 06bede3d4..c082aa29d 100644 --- a/source/Patches/Modifiers/LoversMod/Outro.cs +++ b/source/Patches/Modifiers/LoversMod/Outro.cs @@ -3,7 +3,7 @@ using TMPro; using TownOfUs.Extensions; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; namespace TownOfUs.Modifiers.LoversMod diff --git a/source/Patches/Modifiers/MultitaskerMod/HudManagerUpdate.cs b/source/Patches/Modifiers/MultitaskerMod/HudManagerUpdate.cs index dac147db1..c1fe7d579 100644 --- a/source/Patches/Modifiers/MultitaskerMod/HudManagerUpdate.cs +++ b/source/Patches/Modifiers/MultitaskerMod/HudManagerUpdate.cs @@ -2,7 +2,7 @@ using HarmonyLib; using UnityEngine; -namespace TownOfUs.Modifiers +namespace TownOfUs.Modifiers.MultitaskerMod { [HarmonyPatch(typeof(HudManager), nameof(HudManager.Update))] public static class Multitasker diff --git a/source/Patches/Modifiers/RadarMod/UpdateArrow.cs b/source/Patches/Modifiers/RadarMod/UpdateArrow.cs index 51a42b7b1..91eea78d1 100644 --- a/source/Patches/Modifiers/RadarMod/UpdateArrow.cs +++ b/source/Patches/Modifiers/RadarMod/UpdateArrow.cs @@ -1,6 +1,6 @@ using System.Linq; using HarmonyLib; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using System.Collections.Generic; using UnityEngine; using TownOfUs.Patches; diff --git a/source/Patches/Modifiers/SaboteurMod/HudManagerUpdate.cs b/source/Patches/Modifiers/SaboteurMod/HudManagerUpdate.cs index 872d27e0d..188b7c3ac 100644 --- a/source/Patches/Modifiers/SaboteurMod/HudManagerUpdate.cs +++ b/source/Patches/Modifiers/SaboteurMod/HudManagerUpdate.cs @@ -1,5 +1,5 @@ using HarmonyLib; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.Modifiers.SaboteurMod { diff --git a/source/Patches/Modifiers/SatelliteMod/PerformKill.cs b/source/Patches/Modifiers/SatelliteMod/PerformKill.cs index 14fe13111..cf7cffb06 100644 --- a/source/Patches/Modifiers/SatelliteMod/PerformKill.cs +++ b/source/Patches/Modifiers/SatelliteMod/PerformKill.cs @@ -1,6 +1,6 @@ using HarmonyLib; using Reactor.Utilities; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.Modifiers.SatelliteMod { diff --git a/source/Patches/Modifiers/SatelliteMod/Update.cs b/source/Patches/Modifiers/SatelliteMod/Update.cs index 91621dd9d..44e818606 100644 --- a/source/Patches/Modifiers/SatelliteMod/Update.cs +++ b/source/Patches/Modifiers/SatelliteMod/Update.cs @@ -1,5 +1,5 @@ using HarmonyLib; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; using TMPro; diff --git a/source/Patches/Modifiers/ShyMod/HudManagerUpdate.cs b/source/Patches/Modifiers/ShyMod/HudManagerUpdate.cs index 9aeb33be3..e79bc414b 100644 --- a/source/Patches/Modifiers/ShyMod/HudManagerUpdate.cs +++ b/source/Patches/Modifiers/ShyMod/HudManagerUpdate.cs @@ -3,7 +3,7 @@ using AmongUs.Data; using HarmonyLib; using TownOfUs.Extensions; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.Modifiers.ShyMod { diff --git a/source/Patches/Modifiers/SleuthMod/BodyReport.cs b/source/Patches/Modifiers/SleuthMod/BodyReport.cs index eebf3613f..d1ed3d2ed 100644 --- a/source/Patches/Modifiers/SleuthMod/BodyReport.cs +++ b/source/Patches/Modifiers/SleuthMod/BodyReport.cs @@ -1,5 +1,5 @@ using HarmonyLib; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.Modifiers { diff --git a/source/Patches/Modifiers/UnderdogMod/PerformKill.cs b/source/Patches/Modifiers/UnderdogMod/PerformKill.cs index bffcca079..3fe6f8c2f 100644 --- a/source/Patches/Modifiers/UnderdogMod/PerformKill.cs +++ b/source/Patches/Modifiers/UnderdogMod/PerformKill.cs @@ -1,7 +1,7 @@ using System.Linq; using HarmonyLib; using TownOfUs.Extensions; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.Modifiers.UnderdogMod { diff --git a/source/Patches/Modifiers/UnderdogMod/PostMeeting.cs b/source/Patches/Modifiers/UnderdogMod/PostMeeting.cs index 580baf24e..00da24ddd 100644 --- a/source/Patches/Modifiers/UnderdogMod/PostMeeting.cs +++ b/source/Patches/Modifiers/UnderdogMod/PostMeeting.cs @@ -1,5 +1,5 @@ using HarmonyLib; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.Modifiers.UnderdogMod { diff --git a/source/Patches/NEWin.cs b/source/Patches/NEWin.cs index 31635e18e..c01881bdc 100644 --- a/source/Patches/NEWin.cs +++ b/source/Patches/NEWin.cs @@ -2,7 +2,7 @@ using HarmonyLib; using TownOfUs.NeutralRoles.ExecutionerMod; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.Patches { diff --git a/source/Patches/NeutralRoles/AmnesiacMod/PerformKillButton.cs b/source/Patches/NeutralRoles/AmnesiacMod/PerformKillButton.cs index acd444df8..f0846b29a 100644 --- a/source/Patches/NeutralRoles/AmnesiacMod/PerformKillButton.cs +++ b/source/Patches/NeutralRoles/AmnesiacMod/PerformKillButton.cs @@ -8,7 +8,7 @@ using TownOfUs.Extensions; using TownOfUs.CrewmateRoles.ImitatorMod; using AmongUs.GameOptions; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using TownOfUs.ImpostorRoles.BomberMod; using TownOfUs.Patches; diff --git a/source/Patches/NeutralRoles/ArsonistMod/HudManagerUpdate.cs b/source/Patches/NeutralRoles/ArsonistMod/HudManagerUpdate.cs index 52c148aa9..14dcec9ad 100644 --- a/source/Patches/NeutralRoles/ArsonistMod/HudManagerUpdate.cs +++ b/source/Patches/NeutralRoles/ArsonistMod/HudManagerUpdate.cs @@ -2,7 +2,7 @@ using HarmonyLib; using TownOfUs.Extensions; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; namespace TownOfUs.NeutralRoles.ArsonistMod diff --git a/source/Patches/NeutralRoles/DoomsayerMod/AddButton.cs b/source/Patches/NeutralRoles/DoomsayerMod/AddButton.cs index 0217d85ca..03f2202c5 100644 --- a/source/Patches/NeutralRoles/DoomsayerMod/AddButton.cs +++ b/source/Patches/NeutralRoles/DoomsayerMod/AddButton.cs @@ -4,7 +4,7 @@ using Reactor.Utilities.Extensions; using TMPro; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; using UnityEngine.UI; using Object = UnityEngine.Object; diff --git a/source/Patches/NeutralRoles/DoomsayerMod/DoomsayerKill.cs b/source/Patches/NeutralRoles/DoomsayerMod/DoomsayerKill.cs index c3bbf461b..978b0f9c7 100644 --- a/source/Patches/NeutralRoles/DoomsayerMod/DoomsayerKill.cs +++ b/source/Patches/NeutralRoles/DoomsayerMod/DoomsayerKill.cs @@ -1,6 +1,6 @@ using System.Linq; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; using UnityEngine.UI; using Il2CppInterop.Runtime.InteropTypes.Arrays; diff --git a/source/Patches/NeutralRoles/ExecutionerMod/TargetColor.cs b/source/Patches/NeutralRoles/ExecutionerMod/TargetColor.cs index 14062ff6f..a70044c6a 100644 --- a/source/Patches/NeutralRoles/ExecutionerMod/TargetColor.cs +++ b/source/Patches/NeutralRoles/ExecutionerMod/TargetColor.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TownOfUs.Extensions; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; namespace TownOfUs.NeutralRoles.ExecutionerMod diff --git a/source/Patches/NeutralRoles/GuardianAngelMod/TargetColor.cs b/source/Patches/NeutralRoles/GuardianAngelMod/TargetColor.cs index a6f6cb6af..b237819e6 100644 --- a/source/Patches/NeutralRoles/GuardianAngelMod/TargetColor.cs +++ b/source/Patches/NeutralRoles/GuardianAngelMod/TargetColor.cs @@ -2,7 +2,7 @@ using TownOfUs.Extensions; using TownOfUs.NeutralRoles.ExecutionerMod; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; namespace TownOfUs.NeutralRoles.GuardianAngelMod diff --git a/source/Patches/NeutralRoles/MercenaryMod/Update.cs b/source/Patches/NeutralRoles/MercenaryMod/Update.cs index e2cf514e8..8eb797094 100644 --- a/source/Patches/NeutralRoles/MercenaryMod/Update.cs +++ b/source/Patches/NeutralRoles/MercenaryMod/Update.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TownOfUs.Extensions; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; namespace TownOfUs.NeutralRoles.MercenaryMod diff --git a/source/Patches/NeutralRoles/PlaguebearerMod/HudManagerUpdate.cs b/source/Patches/NeutralRoles/PlaguebearerMod/HudManagerUpdate.cs index f5643325d..a90cfd118 100644 --- a/source/Patches/NeutralRoles/PlaguebearerMod/HudManagerUpdate.cs +++ b/source/Patches/NeutralRoles/PlaguebearerMod/HudManagerUpdate.cs @@ -3,7 +3,7 @@ using TownOfUs.Roles; using UnityEngine; using TownOfUs.Extensions; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs.NeutralRoles.PlaguebearerMod { diff --git a/source/Patches/NeutralRoles/PlayerMenu.cs b/source/Patches/NeutralRoles/PlayerMenu.cs index 9a10f4299..86571da1a 100644 --- a/source/Patches/NeutralRoles/PlayerMenu.cs +++ b/source/Patches/NeutralRoles/PlayerMenu.cs @@ -52,7 +52,7 @@ public IEnumerator Open(float delay, bool includeDead = false) private static ShapeshifterMinigame GetShapeshifterMenu() { - var rolePrefab = RoleManager.Instance.AllRoles.First(r => r.Role == RoleTypes.Shapeshifter); + var rolePrefab = RoleManager.Instance.AllRoles.ToArray().First(r => r.Role == RoleTypes.Shapeshifter); return GameObject.Instantiate(rolePrefab?.Cast(), GameData.Instance.transform).ShapeshifterMenu; } diff --git a/source/Patches/NeutralRoles/VampireMod/PerformKill.cs b/source/Patches/NeutralRoles/VampireMod/PerformKill.cs index a358b3dde..58eac9f67 100644 --- a/source/Patches/NeutralRoles/VampireMod/PerformKill.cs +++ b/source/Patches/NeutralRoles/VampireMod/PerformKill.cs @@ -7,7 +7,7 @@ using TownOfUs.CrewmateRoles.TrapperMod; using TownOfUs.CrewmateRoles.ImitatorMod; using System.Linq; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using TownOfUs.Patches.NeutralRoles; using TownOfUs.Patches; using TownOfUs.CrewmateRoles.PlumberMod; diff --git a/source/Patches/RpcHandling.cs b/source/Patches/RpcHandling.cs index d561d7b9e..823e5c221 100644 --- a/source/Patches/RpcHandling.cs +++ b/source/Patches/RpcHandling.cs @@ -22,7 +22,7 @@ using TownOfUs.ImpostorRoles.TraitorMod; using TownOfUs.CrewmateRoles.ImitatorMod; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; using Coroutine = TownOfUs.ImpostorRoles.JanitorMod.Coroutine; using Object = UnityEngine.Object; @@ -110,10 +110,13 @@ private static void GenEachRole(List infected) List crewNKBuckets = [RoleOptions.CrewInvest, RoleOptions.CrewKilling, RoleOptions.CrewPower, RoleOptions.CrewProtective, RoleOptions.CrewSupport, RoleOptions.CrewCommon, RoleOptions.CrewSpecial, RoleOptions.CrewRandom, RoleOptions.NeutKilling]; List impBuckets = [RoleOptions.ImpConceal, RoleOptions.ImpKilling, RoleOptions.ImpSupport, RoleOptions.ImpCommon, RoleOptions.ImpRandom]; - List buckets = [CustomGameOptions.Slot1, CustomGameOptions.Slot2, CustomGameOptions.Slot3, CustomGameOptions.Slot4]; + List buckets = [CustomGameOptions.Slot1]; var impCount = 0; var anySlots = 0; + if (players > 1) buckets.Add(CustomGameOptions.Slot2); + if (players > 2) buckets.Add(CustomGameOptions.Slot3); + if (players > 3) buckets.Add(CustomGameOptions.Slot4); if (players > 4) buckets.Add(CustomGameOptions.Slot5); if (players > 5) buckets.Add(CustomGameOptions.Slot6); if (players > 6) buckets.Add(CustomGameOptions.Slot7); diff --git a/source/Patches/SaveManagerPatch.cs b/source/Patches/SaveManagerPatch.cs index e4dcca833..e1f03b361 100644 --- a/source/Patches/SaveManagerPatch.cs +++ b/source/Patches/SaveManagerPatch.cs @@ -1,30 +1,17 @@ -using HarmonyLib; +using AmongUs.Data.Player; +using AmongUs.Data.Settings; +using HarmonyLib; -namespace TownOfUs.RainbowMod +namespace TownOfUs.Patches { - [HarmonyPatch(typeof(AmongUs.Data.Player.PlayerData), nameof(AmongUs.Data.Player.PlayerData.FileName), MethodType.Getter)] - public class SaveManagerPatch + public static class SaveManagerPatch { + [HarmonyPatch(typeof(PlayerData), nameof(PlayerData.FileName), MethodType.Getter)] + [HarmonyPatch(typeof(SettingsData), nameof(SettingsData.FileName), MethodType.Getter)] public static void Postfix(ref string __result) { - __result += "_TOU"; - } - } - [HarmonyPatch(typeof(AmongUs.Data.Legacy.LegacySaveManager), nameof(AmongUs.Data.Legacy.LegacySaveManager.GetPrefsName))] - public class LegacySaveManagerPatch - { - public static void Postfix(ref string __result) - { - __result += "_TOU"; - } - } - - [HarmonyPatch(typeof(AmongUs.Data.Settings.SettingsData), nameof(AmongUs.Data.Settings.SettingsData.FileName), MethodType.Getter)] - public class SettingsFilePatch - { - public static void Postfix(ref string __result) - { - __result += "_TOU"; + __result += "_TouReactivated"; } } } + diff --git a/source/Patches/SpeedPatch.cs b/source/Patches/SpeedPatch.cs index 8375d5c3a..947e5f90c 100644 --- a/source/Patches/SpeedPatch.cs +++ b/source/Patches/SpeedPatch.cs @@ -2,7 +2,7 @@ using System; using TownOfUs.Extensions; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; namespace TownOfUs.Patches diff --git a/source/Patches/Start.cs b/source/Patches/Start.cs index f639b724e..e4f4b5888 100644 --- a/source/Patches/Start.cs +++ b/source/Patches/Start.cs @@ -1,19 +1,26 @@ using System; +using System.Reflection; using HarmonyLib; using Hazel; +using Il2CppInterop.Runtime.InteropTypes; using TownOfUs.NeutralRoles.ExecutionerMod; using TownOfUs.NeutralRoles.GuardianAngelMod; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; +using TownOfUs.Utilities; using UnityEngine; using Object = UnityEngine.Object; namespace TownOfUs.Patches { - [HarmonyPatch(typeof(IntroCutscene._CoBegin_d__35), nameof(IntroCutscene._CoBegin_d__35.MoveNext))] + [HarmonyPatch] public static class Start { - public static void Postfix(IntroCutscene._CoBegin_d__35 __instance) + public static MethodBase TargetMethod() + { + return StateMachineWrapper.GetStateMachineMoveNext(nameof(IntroCutscene.CoBegin))!; + } + public static void Postfix(Il2CppObjectBase __instance) { HudUpdate.Zooming = false; HudUpdate.ZoomStart(); diff --git a/source/Patches/SubmergedCompatibility.cs b/source/Patches/SubmergedCompatibility.cs index 7d661e916..5b55dfc12 100644 --- a/source/Patches/SubmergedCompatibility.cs +++ b/source/Patches/SubmergedCompatibility.cs @@ -8,16 +8,22 @@ using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; +using Il2CppInterop.Runtime.InteropTypes; using UnityEngine; using Reactor.Utilities; using TownOfUs.Roles; +using TownOfUs.Utilities; namespace TownOfUs.Patches { - [HarmonyPatch(typeof(IntroCutscene._ShowRole_d__41), nameof(IntroCutscene._ShowRole_d__41.MoveNext))] + [HarmonyPatch] public static class SubmergedStartPatch { - public static void Postfix(IntroCutscene._ShowRole_d__41 __instance) + public static MethodBase TargetMethod() + { + return StateMachineWrapper.GetStateMachineMoveNext(nameof(IntroCutscene.ShowRole))!; + } + public static void Postfix(Il2CppObjectBase __instance) { if (SubmergedCompatibility.isSubmerged()) { diff --git a/source/Patches/TaskPatches.cs b/source/Patches/TaskPatches.cs index 31c506a9e..28b11588c 100644 --- a/source/Patches/TaskPatches.cs +++ b/source/Patches/TaskPatches.cs @@ -1,6 +1,6 @@ using HarmonyLib; using TownOfUs.Extensions; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; namespace TownOfUs { diff --git a/source/Patches/Updater.cs b/source/Patches/Updater.cs index 130f4a5d4..8e97cf3f6 100644 --- a/source/Patches/Updater.cs +++ b/source/Patches/Updater.cs @@ -19,38 +19,87 @@ public class ModUpdaterButton { private static Sprite TOUUpdateSprite => TownOfUs.UpdateTOUButton; private static Sprite SubmergedUpdateSprite => TownOfUs.UpdateSubmergedButton; + private static bool CheckedBadVersion; + private static void Prefix(MainMenuManager __instance) { //Check if there's a ToU update ModUpdater.LaunchUpdater(); - - var data = GetVersioning().FirstOrDefault(x => x.ModVersion.Equals(TownOfUs.VersionString)); - if (data != null) + if (!CheckedBadVersion) { - var RequiredVersions = data.InternalVersions; - var AUversion = Constants.GetBroadcastVersion(); - if (!RequiredVersions.ContainsKey(AUversion)) + CheckedBadVersion = true; + var auVersion = Version.Parse(Application.version); + + var data = GetVersioning().FirstOrDefault(x => x.ModVersion.Equals(TownOfUs.VersionString)); + if (data != null) + { + var RequiredVersions = new Dictionary(); + foreach (var pair in data.InternalVersions) + { + RequiredVersions.Add(Version.Parse(pair.Key), (AuSupport)pair.Value); + } + + if (!RequiredVersions.TryGetValue(auVersion, out var support) || support is AuSupport.Broken) + { + string action = auVersion > RequiredVersions.Keys.Max() ? "downgrade" : "update"; + var neededVersions = RequiredVersions.Where(x => x.Value is AuSupport.Preferred) + .Select(y => y.Key.ToString()).ToArray(); + var mainInfo = neededVersions.Count() > 1 + ? $"Town of Us {TownOfUs.VersionString} requires one of the following Among Us versions: {string.Join(",", neededVersions)}!" + : $"Town of Us {TownOfUs.VersionString} requires Among Us v{neededVersions.First()}!"; + string info = + $"ALERT\n{mainInfo}\nyou have {Application.version}\nPlease {action} Among Us!" + + "\nvisit Github or Discord for any help"; + TwitchManager man = TwitchManager.Instance; + ModUpdater.InfoPopup = UnityEngine.Object.Instantiate(man.TwitchPopup); + ModUpdater.InfoPopup.TextAreaTMP.fontSize *= 0.68f; + ModUpdater.InfoPopup.TextAreaTMP.enableAutoSizing = true; + ModUpdater.InfoPopup.Show(info); + ModUpdater.InfoPopup.StartCoroutine(Effects.Lerp(0.01f, + new Action((p) => { ModUpdater.setPopupText(info); }))); + ModUpdater.AuVersionSupported = AuSupport.Broken; + PluginSingleton.Instance.Log.LogMessage( + $"Current AU Version is {Application.version} | Tou Support: {AuSupport.Broken}"); + + return; + } + + if (support is AuSupport.Usable) + { + var neededVersions = RequiredVersions.Where(x => x.Value is AuSupport.Preferred) + .Select(y => y.Key.ToString()).ToArray(); + var mainInfo = neededVersions.Count() > 1 + ? $"Town of Us {TownOfUs.VersionString} works best with the following Among Us versions: {string.Join(",", neededVersions)}." + : $"Town of Us {TownOfUs.VersionString} works best with Among Us v{neededVersions.First()}."; + string info = + $"NOTICE\n{mainInfo}\nAmong us v{Application.version} should still work, but may have issues." + + "\nVisit Github or Discord for additional information"; + TwitchManager man = TwitchManager.Instance; + ModUpdater.InfoPopup = UnityEngine.Object.Instantiate(man.TwitchPopup); + ModUpdater.InfoPopup.TextAreaTMP.fontSize *= 0.68f; + ModUpdater.InfoPopup.TextAreaTMP.enableAutoSizing = true; + ModUpdater.InfoPopup.Show(info); + ModUpdater.InfoPopup.StartCoroutine(Effects.Lerp(0.01f, + new Action((p) => { ModUpdater.setPopupText(info); }))); + ModUpdater.AuVersionSupported = AuSupport.Usable; + } + + PluginSingleton.Instance.Log.LogMessage( + $"Current AU Version is {Application.version} | Tou Support: {support}"); + } + else { - string action = AUversion > RequiredVersions.Keys.Max() ? "downgrade" : "update"; - string info = - $"ALERT\nTown of Us {TownOfUs.VersionString} requires {RequiredVersions.Values.Last()}\nyou have {Application.version}\nPlease {action} your among us version" - + "\nvisit Github or Discord for any help"; - TwitchManager man = TwitchManager.Instance; - ModUpdater.InfoPopup = UnityEngine.Object.Instantiate(man.TwitchPopup); - ModUpdater.InfoPopup.TextAreaTMP.fontSize *= 0.68f; - ModUpdater.InfoPopup.TextAreaTMP.enableAutoSizing = true; - ModUpdater.InfoPopup.Show(info); - ModUpdater.InfoPopup.StartCoroutine(Effects.Lerp(0.01f, new Action((p) => { ModUpdater.setPopupText(info); }))); - ModUpdater.InvalidAUVersion = true; - - return; + PluginSingleton.Instance.Log.LogMessage( + $"Current AU Version is {Application.version} | Tou Support: ???"); } } + if (ModUpdater.HasTOUUpdate) { //If there's an update, create and show the update button UpdateButton(__instance, () => ModUpdater.ExecuteUpdate("TOU")); } + if (ModUpdater.HasSubmergedUpdate) { //If there's an update, create and show the update button @@ -65,7 +114,8 @@ private static void UpdateButton(MainMenuManager __instance, Action Onclick, int { var Button = UnityEngine.Object.Instantiate(template, null); - Button.transform.localPosition = new Vector3(Button.transform.localPosition.x, Button.transform.localPosition.y + 0.6f, Button.transform.localPosition.z); + Button.transform.localPosition = new Vector3(Button.transform.localPosition.x, + Button.transform.localPosition.y + 0.6f, Button.transform.localPosition.z); Button.transform.localScale = new Vector3(0.44f, 0.84f, 1f); @@ -74,12 +124,13 @@ private static void UpdateButton(MainMenuManager __instance, Action Onclick, int passiveButton.OnClick = new UnityEngine.UI.Button.ButtonClickedEvent(); ButtonSprite.sprite = _pos == 0 ? TOUUpdateSprite : SubmergedUpdateSprite; - Button.transform.GetChild(0).GetComponent().sprite = _pos == 0 ? TOUUpdateSprite : SubmergedUpdateSprite; + Button.transform.GetChild(0).GetComponent().sprite = + _pos == 0 ? TOUUpdateSprite : SubmergedUpdateSprite; Button.transform.SetParent(GameObject.Find("RightPanel").transform); var pos = Button.GetComponent(); pos.Alignment = AspectPosition.EdgeAlignments.LeftBottom; - pos.DistanceFromEdge = new Vector3(1.5f, 1f + 0.5f*_pos, 0f); + pos.DistanceFromEdge = new Vector3(1.5f, 1f + 0.5f * _pos, 0f); //Add onClick event to run the update on button click passiveButton.OnClick.AddListener((Action)(() => @@ -106,9 +157,11 @@ private static void UpdateButton(MainMenuManager __instance, Action Onclick, int private static List GetVersioning() { - var text = ModUpdater.Httpclient.GetAsync("https://github.com/eDonnes124/Town-Of-Us-R/raw/master/source/Versioning.json") - .GetAwaiter().GetResult().Content.ReadAsStringAsync().Result; - var data = JsonSerializer.Deserialize>(text, options: new() { ReadCommentHandling = JsonCommentHandling.Skip }); + var text = ModUpdater.Httpclient + .GetAsync("https://github.com/eDonnes124/Town-Of-Us-R/raw/master/source/VersioningV2.json") + .GetAwaiter().GetResult().Content.ReadAsStringAsync().Result; + var data = JsonSerializer.Deserialize>(text, + options: new() { ReadCommentHandling = JsonCommentHandling.Skip }); return data; } } @@ -118,7 +171,7 @@ public class ModUpdater public static bool Running = false; public static bool HasTOUUpdate = false; public static bool HasSubmergedUpdate = false; - public static bool InvalidAUVersion = false; + public static AuSupport AuVersionSupported = AuSupport.Preferred; public static string UpdateTOUURI = null; public static string UpdateSubmergedURI = null; private static Task UpdateTOUTask = null; @@ -371,7 +424,7 @@ class GitHubApiAsset public class UpdateData { - public Dictionary InternalVersions { get; set; } + public Dictionary InternalVersions { get; set; } public string ModVersion { get; set; } } @@ -385,10 +438,17 @@ public static void Postfix(GenericPopup __instance) { if (__instance != ModUpdater.InfoPopup) return; - if (ModUpdater.InvalidAUVersion) + if (ModUpdater.AuVersionSupported is AuSupport.Broken) { Application.Quit(); } } } + + public enum AuSupport + { + Preferred, + Usable, + Broken + } } \ No newline at end of file diff --git a/source/Patches/Utils.cs b/source/Patches/Utils.cs index cf775d89b..e6116d890 100644 --- a/source/Patches/Utils.cs +++ b/source/Patches/Utils.cs @@ -10,7 +10,7 @@ using TownOfUs.Extensions; using TownOfUs.Patches; using TownOfUs.Roles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using UnityEngine; diff --git a/source/Patches/VersionShowerUpdate.cs b/source/Patches/VersionShowerUpdate.cs index 3882e7410..5fb6840b1 100644 --- a/source/Patches/VersionShowerUpdate.cs +++ b/source/Patches/VersionShowerUpdate.cs @@ -10,7 +10,7 @@ public static class VersionShowerUpdate public static void Postfix(VersionShower __instance) { var text = __instance.text; - text.text += " - TownOfUs v" + TownOfUs.VersionString + "" + TownOfUs.VersionTag; + text.text += " - Town Of Us: Reactivated v" + TownOfUs.VersionString + "" + TownOfUs.VersionTag; text.transform.localPosition += new Vector3(-0.8f, -0.16f, 0f); if (GameObject.Find("RightPanel")) @@ -18,8 +18,8 @@ public static void Postfix(VersionShower __instance) text.transform.SetParent(GameObject.Find("RightPanel").transform); var aspect = text.gameObject.AddComponent(); - aspect.Alignment = AspectPosition.EdgeAlignments.Top; - aspect.DistanceFromEdge = new Vector3(-0.2f, 2.5f, 8f); + aspect.Alignment = AspectPosition.EdgeAlignments.Center; + aspect.DistanceFromEdge = new Vector3(-0.2f, -0.25f, 8f); aspect.StartCoroutine(Effects.Lerp(0.1f, new System.Action((p) => { diff --git a/source/Resources/Alert.png b/source/Resources/CrewButtons/Alert.png similarity index 100% rename from source/Resources/Alert.png rename to source/Resources/CrewButtons/Alert.png diff --git a/source/Resources/Barrier.png b/source/Resources/CrewButtons/Barrier.png similarity index 100% rename from source/Resources/Barrier.png rename to source/Resources/CrewButtons/Barrier.png diff --git a/source/Resources/Bless.png b/source/Resources/CrewButtons/Bless.png similarity index 100% rename from source/Resources/Bless.png rename to source/Resources/CrewButtons/Bless.png diff --git a/source/Resources/Block.png b/source/Resources/CrewButtons/Block.png similarity index 100% rename from source/Resources/Block.png rename to source/Resources/CrewButtons/Block.png diff --git a/source/Resources/Camp.png b/source/Resources/CrewButtons/Camp.png similarity index 100% rename from source/Resources/Camp.png rename to source/Resources/CrewButtons/Camp.png diff --git a/source/Resources/Campaign.png b/source/Resources/CrewButtons/Campaign.png similarity index 100% rename from source/Resources/Campaign.png rename to source/Resources/CrewButtons/Campaign.png diff --git a/source/Resources/Cleanse.png b/source/Resources/CrewButtons/Cleanse.png similarity index 100% rename from source/Resources/Cleanse.png rename to source/Resources/CrewButtons/Cleanse.png diff --git a/source/Resources/Confess.png b/source/Resources/CrewButtons/Confess.png similarity index 100% rename from source/Resources/Confess.png rename to source/Resources/CrewButtons/Confess.png diff --git a/source/Resources/Engineer.png b/source/Resources/CrewButtons/Engineer.png similarity index 100% rename from source/Resources/Engineer.png rename to source/Resources/CrewButtons/Engineer.png diff --git a/source/Resources/Examine.png b/source/Resources/CrewButtons/Examine.png similarity index 100% rename from source/Resources/Examine.png rename to source/Resources/CrewButtons/Examine.png diff --git a/source/Resources/Flush.png b/source/Resources/CrewButtons/Flush.png similarity index 100% rename from source/Resources/Flush.png rename to source/Resources/CrewButtons/Flush.png diff --git a/source/Resources/Fortify.png b/source/Resources/CrewButtons/Fortify.png similarity index 100% rename from source/Resources/Fortify.png rename to source/Resources/CrewButtons/Fortify.png diff --git a/source/Resources/Inspect.png b/source/Resources/CrewButtons/Inspect.png similarity index 100% rename from source/Resources/Inspect.png rename to source/Resources/CrewButtons/Inspect.png diff --git a/source/Resources/Jail.png b/source/Resources/CrewButtons/Jail.png similarity index 100% rename from source/Resources/Jail.png rename to source/Resources/CrewButtons/Jail.png diff --git a/source/Resources/Mediate.png b/source/Resources/CrewButtons/Mediate.png similarity index 100% rename from source/Resources/Mediate.png rename to source/Resources/CrewButtons/Mediate.png diff --git a/source/Resources/Medic.png b/source/Resources/CrewButtons/Medic.png similarity index 100% rename from source/Resources/Medic.png rename to source/Resources/CrewButtons/Medic.png diff --git a/source/Resources/Revive.png b/source/Resources/CrewButtons/Revive.png similarity index 100% rename from source/Resources/Revive.png rename to source/Resources/CrewButtons/Revive.png diff --git a/source/Resources/Seer.png b/source/Resources/CrewButtons/Seer.png similarity index 100% rename from source/Resources/Seer.png rename to source/Resources/CrewButtons/Seer.png diff --git a/source/Resources/Stalk.png b/source/Resources/CrewButtons/Stalk.png similarity index 100% rename from source/Resources/Stalk.png rename to source/Resources/CrewButtons/Stalk.png diff --git a/source/Resources/Track.png b/source/Resources/CrewButtons/Track.png similarity index 100% rename from source/Resources/Track.png rename to source/Resources/CrewButtons/Track.png diff --git a/source/Resources/Transport.png b/source/Resources/CrewButtons/Transport.png similarity index 100% rename from source/Resources/Transport.png rename to source/Resources/CrewButtons/Transport.png diff --git a/source/Resources/Trap.png b/source/Resources/CrewButtons/Trap.png similarity index 100% rename from source/Resources/Trap.png rename to source/Resources/CrewButtons/Trap.png diff --git a/source/Resources/Watch.png b/source/Resources/CrewButtons/Watch.png similarity index 100% rename from source/Resources/Watch.png rename to source/Resources/CrewButtons/Watch.png diff --git a/source/Resources/Blackmail.png b/source/Resources/ImpButtons/Blackmail.png similarity index 100% rename from source/Resources/Blackmail.png rename to source/Resources/ImpButtons/Blackmail.png diff --git a/source/Resources/Blind.png b/source/Resources/ImpButtons/Blind.png similarity index 100% rename from source/Resources/Blind.png rename to source/Resources/ImpButtons/Blind.png diff --git a/source/Resources/CamoSprint.png b/source/Resources/ImpButtons/CamoSprint.png similarity index 100% rename from source/Resources/CamoSprint.png rename to source/Resources/ImpButtons/CamoSprint.png diff --git a/source/Resources/CamoSprintFreeze.png b/source/Resources/ImpButtons/CamoSprintFreeze.png similarity index 100% rename from source/Resources/CamoSprintFreeze.png rename to source/Resources/ImpButtons/CamoSprintFreeze.png diff --git a/source/Resources/Camouflage.png b/source/Resources/ImpButtons/Camouflage.png similarity index 100% rename from source/Resources/Camouflage.png rename to source/Resources/ImpButtons/Camouflage.png diff --git a/source/Resources/Detonate.png b/source/Resources/ImpButtons/Detonate.png similarity index 100% rename from source/Resources/Detonate.png rename to source/Resources/ImpButtons/Detonate.png diff --git a/source/Resources/Drag.png b/source/Resources/ImpButtons/Drag.png similarity index 100% rename from source/Resources/Drag.png rename to source/Resources/ImpButtons/Drag.png diff --git a/source/Resources/Drop.png b/source/Resources/ImpButtons/Drop.png similarity index 100% rename from source/Resources/Drop.png rename to source/Resources/ImpButtons/Drop.png diff --git a/source/Resources/Flash.png b/source/Resources/ImpButtons/Flash.png similarity index 100% rename from source/Resources/Flash.png rename to source/Resources/ImpButtons/Flash.png diff --git a/source/Resources/Hypnotise.png b/source/Resources/ImpButtons/Hypnotise.png similarity index 100% rename from source/Resources/Hypnotise.png rename to source/Resources/ImpButtons/Hypnotise.png diff --git a/source/Resources/Janitor.png b/source/Resources/ImpButtons/Janitor.png similarity index 100% rename from source/Resources/Janitor.png rename to source/Resources/ImpButtons/Janitor.png diff --git a/source/Resources/Mark.png b/source/Resources/ImpButtons/Mark.png similarity index 100% rename from source/Resources/Mark.png rename to source/Resources/ImpButtons/Mark.png diff --git a/source/Resources/Mine.png b/source/Resources/ImpButtons/Mine.png similarity index 100% rename from source/Resources/Mine.png rename to source/Resources/ImpButtons/Mine.png diff --git a/source/Resources/Morph.png b/source/Resources/ImpButtons/Morph.png similarity index 100% rename from source/Resources/Morph.png rename to source/Resources/ImpButtons/Morph.png diff --git a/source/Resources/NoAbility.png b/source/Resources/ImpButtons/NoAbility.png similarity index 100% rename from source/Resources/NoAbility.png rename to source/Resources/ImpButtons/NoAbility.png diff --git a/source/Resources/Plant.png b/source/Resources/ImpButtons/Plant.png similarity index 100% rename from source/Resources/Plant.png rename to source/Resources/ImpButtons/Plant.png diff --git a/source/Resources/Recall.png b/source/Resources/ImpButtons/Recall.png similarity index 100% rename from source/Resources/Recall.png rename to source/Resources/ImpButtons/Recall.png diff --git a/source/Resources/Sample.png b/source/Resources/ImpButtons/Sample.png similarity index 100% rename from source/Resources/Sample.png rename to source/Resources/ImpButtons/Sample.png diff --git a/source/Resources/Swoop.png b/source/Resources/ImpButtons/Swoop.png similarity index 100% rename from source/Resources/Swoop.png rename to source/Resources/ImpButtons/Swoop.png diff --git a/source/Resources/Bite.png b/source/Resources/NeutButtons/Bite.png similarity index 100% rename from source/Resources/Bite.png rename to source/Resources/NeutButtons/Bite.png diff --git a/source/Resources/Bribe.png b/source/Resources/NeutButtons/Bribe.png similarity index 100% rename from source/Resources/Bribe.png rename to source/Resources/NeutButtons/Bribe.png diff --git a/source/Resources/Douse.png b/source/Resources/NeutButtons/Douse.png similarity index 100% rename from source/Resources/Douse.png rename to source/Resources/NeutButtons/Douse.png diff --git a/source/Resources/Guard.png b/source/Resources/NeutButtons/Guard.png similarity index 100% rename from source/Resources/Guard.png rename to source/Resources/NeutButtons/Guard.png diff --git a/source/Resources/Hack.png b/source/Resources/NeutButtons/Hack.png similarity index 100% rename from source/Resources/Hack.png rename to source/Resources/NeutButtons/Hack.png diff --git a/source/Resources/Ignite.png b/source/Resources/NeutButtons/Ignite.png similarity index 100% rename from source/Resources/Ignite.png rename to source/Resources/NeutButtons/Ignite.png diff --git a/source/Resources/Infect.png b/source/Resources/NeutButtons/Infect.png similarity index 100% rename from source/Resources/Infect.png rename to source/Resources/NeutButtons/Infect.png diff --git a/source/Resources/Mimic.png b/source/Resources/NeutButtons/Mimic.png similarity index 100% rename from source/Resources/Mimic.png rename to source/Resources/NeutButtons/Mimic.png diff --git a/source/Resources/Observe.png b/source/Resources/NeutButtons/Observe.png similarity index 100% rename from source/Resources/Observe.png rename to source/Resources/NeutButtons/Observe.png diff --git a/source/Resources/Protect.png b/source/Resources/NeutButtons/Protect.png similarity index 100% rename from source/Resources/Protect.png rename to source/Resources/NeutButtons/Protect.png diff --git a/source/Resources/Rampage.png b/source/Resources/NeutButtons/Rampage.png similarity index 100% rename from source/Resources/Rampage.png rename to source/Resources/NeutButtons/Rampage.png diff --git a/source/Resources/Reap.png b/source/Resources/NeutButtons/Reap.png similarity index 100% rename from source/Resources/Reap.png rename to source/Resources/NeutButtons/Reap.png diff --git a/source/Resources/Remember.png b/source/Resources/NeutButtons/Remember.png similarity index 100% rename from source/Resources/Remember.png rename to source/Resources/NeutButtons/Remember.png diff --git a/source/Resources/Vest.png b/source/Resources/NeutButtons/Vest.png similarity index 100% rename from source/Resources/Vest.png rename to source/Resources/NeutButtons/Vest.png diff --git a/source/Resources/NextButton.png b/source/Resources/NextButton.png new file mode 100644 index 000000000..0eea8eabf Binary files /dev/null and b/source/Resources/NextButton.png differ diff --git a/source/Resources/NextButtonActive.png b/source/Resources/NextButtonActive.png new file mode 100644 index 000000000..62ac434e6 Binary files /dev/null and b/source/Resources/NextButtonActive.png differ diff --git a/source/Resources/TouBanner.png b/source/Resources/TouBanner.png new file mode 100644 index 000000000..808affb5a Binary files /dev/null and b/source/Resources/TouBanner.png differ diff --git a/source/Resources/TownOfUsBanner.png b/source/Resources/TownOfUsBanner.png deleted file mode 100644 index c5a1455fb..000000000 Binary files a/source/Resources/TownOfUsBanner.png and /dev/null differ diff --git a/source/Resources/soundvision b/source/Resources/soundvision deleted file mode 100644 index 6ee95f709..000000000 Binary files a/source/Resources/soundvision and /dev/null differ diff --git a/source/Resources/tour-assets-android.bundle b/source/Resources/tour-assets-android.bundle new file mode 100644 index 000000000..a2e0d09e8 Binary files /dev/null and b/source/Resources/tour-assets-android.bundle differ diff --git a/source/Resources/tour-assets-win.bundle b/source/Resources/tour-assets-win.bundle new file mode 100644 index 000000000..6c8522db8 Binary files /dev/null and b/source/Resources/tour-assets-win.bundle differ diff --git a/source/Resources/trappershader b/source/Resources/trappershader deleted file mode 100644 index 11d11c72b..000000000 Binary files a/source/Resources/trappershader and /dev/null differ diff --git a/source/Patches/Roles/Altruist.cs b/source/Roles/Altruist.cs similarity index 100% rename from source/Patches/Roles/Altruist.cs rename to source/Roles/Altruist.cs diff --git a/source/Patches/Roles/Amnesiac.cs b/source/Roles/Amnesiac.cs similarity index 100% rename from source/Patches/Roles/Amnesiac.cs rename to source/Roles/Amnesiac.cs diff --git a/source/Patches/Roles/Arsonist.cs b/source/Roles/Arsonist.cs similarity index 99% rename from source/Patches/Roles/Arsonist.cs rename to source/Roles/Arsonist.cs index 9195ad56f..79b37b4cc 100644 --- a/source/Patches/Roles/Arsonist.cs +++ b/source/Roles/Arsonist.cs @@ -12,7 +12,7 @@ namespace TownOfUs.Roles { public class Arsonist : Role { - public static Material igniteMaterial = TownOfUs.bundledAssets.Get("ArsonistTrap"); + public static Material igniteMaterial = TownOfUs.bundledAssets.Get("ignite"); public IgniteMaterial igniteRadius = null; private KillButton _igniteButton; diff --git a/source/Patches/Roles/Aurial.cs b/source/Roles/Aurial.cs similarity index 100% rename from source/Patches/Roles/Aurial.cs rename to source/Roles/Aurial.cs diff --git a/source/Patches/Roles/Blackmailer.cs b/source/Roles/Blackmailer.cs similarity index 100% rename from source/Patches/Roles/Blackmailer.cs rename to source/Roles/Blackmailer.cs diff --git a/source/Patches/Roles/Bomber.cs b/source/Roles/Bomber.cs similarity index 100% rename from source/Patches/Roles/Bomber.cs rename to source/Roles/Bomber.cs diff --git a/source/Patches/Roles/Cleric.cs b/source/Roles/Cleric.cs similarity index 100% rename from source/Patches/Roles/Cleric.cs rename to source/Roles/Cleric.cs diff --git a/source/Patches/Roles/Deputy.cs b/source/Roles/Deputy.cs similarity index 100% rename from source/Patches/Roles/Deputy.cs rename to source/Roles/Deputy.cs diff --git a/source/Patches/Roles/Detective.cs b/source/Roles/Detective.cs similarity index 100% rename from source/Patches/Roles/Detective.cs rename to source/Roles/Detective.cs diff --git a/source/Patches/Roles/Doomsayer.cs b/source/Roles/Doomsayer.cs similarity index 100% rename from source/Patches/Roles/Doomsayer.cs rename to source/Roles/Doomsayer.cs diff --git a/source/Patches/Roles/Eclipsal.cs b/source/Roles/Eclipsal.cs similarity index 100% rename from source/Patches/Roles/Eclipsal.cs rename to source/Roles/Eclipsal.cs diff --git a/source/Patches/Roles/Engineer.cs b/source/Roles/Engineer.cs similarity index 100% rename from source/Patches/Roles/Engineer.cs rename to source/Roles/Engineer.cs diff --git a/source/Patches/Roles/Escapist.cs b/source/Roles/Escapist.cs similarity index 100% rename from source/Patches/Roles/Escapist.cs rename to source/Roles/Escapist.cs diff --git a/source/Patches/Roles/Executioner.cs b/source/Roles/Executioner.cs similarity index 100% rename from source/Patches/Roles/Executioner.cs rename to source/Roles/Executioner.cs diff --git a/source/Patches/Roles/GhostRole.cs b/source/Roles/GhostRole.cs similarity index 100% rename from source/Patches/Roles/GhostRole.cs rename to source/Roles/GhostRole.cs diff --git a/source/Patches/Roles/Glitch.cs b/source/Roles/Glitch.cs similarity index 99% rename from source/Patches/Roles/Glitch.cs rename to source/Roles/Glitch.cs index a7204287a..9d2d3de92 100644 --- a/source/Patches/Roles/Glitch.cs +++ b/source/Roles/Glitch.cs @@ -6,7 +6,7 @@ using Reactor.Utilities; using Reactor.Utilities.Extensions; using TownOfUs.Extensions; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; using Object = UnityEngine.Object; using TownOfUs.Patches; diff --git a/source/Patches/Roles/Grenadier.cs b/source/Roles/Grenadier.cs similarity index 100% rename from source/Patches/Roles/Grenadier.cs rename to source/Roles/Grenadier.cs diff --git a/source/Patches/Roles/GuardianAngel.cs b/source/Roles/GuardianAngel.cs similarity index 100% rename from source/Patches/Roles/GuardianAngel.cs rename to source/Roles/GuardianAngel.cs diff --git a/source/Patches/Roles/Haunter.cs b/source/Roles/Haunter.cs similarity index 100% rename from source/Patches/Roles/Haunter.cs rename to source/Roles/Haunter.cs diff --git a/source/Patches/Roles/Hunter.cs b/source/Roles/Hunter.cs similarity index 100% rename from source/Patches/Roles/Hunter.cs rename to source/Roles/Hunter.cs diff --git a/source/Patches/Roles/Hypnotist.cs b/source/Roles/Hypnotist.cs similarity index 100% rename from source/Patches/Roles/Hypnotist.cs rename to source/Roles/Hypnotist.cs diff --git a/source/Patches/Roles/Imitator.cs b/source/Roles/Imitator.cs similarity index 100% rename from source/Patches/Roles/Imitator.cs rename to source/Roles/Imitator.cs diff --git a/source/Patches/Roles/Investigator.cs b/source/Roles/Investigator.cs similarity index 100% rename from source/Patches/Roles/Investigator.cs rename to source/Roles/Investigator.cs diff --git a/source/Patches/Roles/Jailor.cs b/source/Roles/Jailor.cs similarity index 100% rename from source/Patches/Roles/Jailor.cs rename to source/Roles/Jailor.cs diff --git a/source/Patches/Roles/Janitor.cs b/source/Roles/Janitor.cs similarity index 100% rename from source/Patches/Roles/Janitor.cs rename to source/Roles/Janitor.cs diff --git a/source/Patches/Roles/Jester.cs b/source/Roles/Jester.cs similarity index 100% rename from source/Patches/Roles/Jester.cs rename to source/Roles/Jester.cs diff --git a/source/Patches/Roles/Juggernaut.cs b/source/Roles/Juggernaut.cs similarity index 100% rename from source/Patches/Roles/Juggernaut.cs rename to source/Roles/Juggernaut.cs diff --git a/source/Patches/Roles/Lookout.cs b/source/Roles/Lookout.cs similarity index 100% rename from source/Patches/Roles/Lookout.cs rename to source/Roles/Lookout.cs diff --git a/source/Patches/Roles/Mayor.cs b/source/Roles/Mayor.cs similarity index 100% rename from source/Patches/Roles/Mayor.cs rename to source/Roles/Mayor.cs diff --git a/source/Patches/Roles/Medic.cs b/source/Roles/Medic.cs similarity index 100% rename from source/Patches/Roles/Medic.cs rename to source/Roles/Medic.cs diff --git a/source/Patches/Roles/Medium.cs b/source/Roles/Medium.cs similarity index 100% rename from source/Patches/Roles/Medium.cs rename to source/Roles/Medium.cs diff --git a/source/Patches/Roles/Mercenary.cs b/source/Roles/Mercenary.cs similarity index 100% rename from source/Patches/Roles/Mercenary.cs rename to source/Roles/Mercenary.cs diff --git a/source/Patches/Roles/Miner.cs b/source/Roles/Miner.cs similarity index 100% rename from source/Patches/Roles/Miner.cs rename to source/Roles/Miner.cs diff --git a/source/Patches/Roles/Morphling.cs b/source/Roles/Morphling.cs similarity index 98% rename from source/Patches/Roles/Morphling.cs rename to source/Roles/Morphling.cs index fc962cb36..6ef85408c 100644 --- a/source/Patches/Roles/Morphling.cs +++ b/source/Roles/Morphling.cs @@ -1,7 +1,7 @@ using System; using System.Linq; using TownOfUs.Extensions; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using UnityEngine; namespace TownOfUs.Roles diff --git a/source/Patches/Roles/Mystic.cs b/source/Roles/Mystic.cs similarity index 100% rename from source/Patches/Roles/Mystic.cs rename to source/Roles/Mystic.cs diff --git a/source/Patches/Roles/Oracle.cs b/source/Roles/Oracle.cs similarity index 100% rename from source/Patches/Roles/Oracle.cs rename to source/Roles/Oracle.cs diff --git a/source/Patches/Roles/Pestilence.cs b/source/Roles/Pestilence.cs similarity index 100% rename from source/Patches/Roles/Pestilence.cs rename to source/Roles/Pestilence.cs diff --git a/source/Patches/Roles/Phantom.cs b/source/Roles/Phantom.cs similarity index 100% rename from source/Patches/Roles/Phantom.cs rename to source/Roles/Phantom.cs diff --git a/source/Patches/Roles/Plaguebearer.cs b/source/Roles/Plaguebearer.cs similarity index 100% rename from source/Patches/Roles/Plaguebearer.cs rename to source/Roles/Plaguebearer.cs diff --git a/source/Patches/Roles/Plumber.cs b/source/Roles/Plumber.cs similarity index 100% rename from source/Patches/Roles/Plumber.cs rename to source/Roles/Plumber.cs diff --git a/source/Patches/Roles/Politician.cs b/source/Roles/Politician.cs similarity index 100% rename from source/Patches/Roles/Politician.cs rename to source/Roles/Politician.cs diff --git a/source/Patches/Roles/Prosecutor.cs b/source/Roles/Prosecutor.cs similarity index 100% rename from source/Patches/Roles/Prosecutor.cs rename to source/Roles/Prosecutor.cs diff --git a/source/Patches/Roles/Role.cs b/source/Roles/Role.cs similarity index 88% rename from source/Patches/Roles/Role.cs rename to source/Roles/Role.cs index a5ee519a3..89ee739de 100644 --- a/source/Patches/Roles/Role.cs +++ b/source/Roles/Role.cs @@ -2,16 +2,19 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using Reactor.Utilities.Extensions; using TMPro; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using Il2CppInterop.Runtime.InteropTypes.Arrays; using UnityEngine; using Object = UnityEngine.Object; using Random = UnityEngine.Random; using TownOfUs.Extensions; using AmongUs.GameOptions; +using Il2CppInterop.Runtime.InteropTypes; using TownOfUs.ImpostorRoles.TraitorMod; +using TownOfUs.Utilities; namespace TownOfUs.Roles { @@ -479,34 +482,41 @@ public static void Postfix(IntroCutscene __instance) } } - [HarmonyPatch(typeof(IntroCutscene._ShowTeam_d__38), nameof(IntroCutscene._ShowTeam_d__38.MoveNext))] + [HarmonyPatch] public static class IntroCutscene_ShowTeam__d_MoveNext { - public static void Prefix(IntroCutscene._ShowTeam_d__38 __instance) + public static MethodBase TargetMethod() { - var role = GetRole(PlayerControl.LocalPlayer); - - if (role != null) role.IntroPrefix(__instance); + return StateMachineWrapper.GetStateMachineMoveNext(nameof(IntroCutscene.ShowTeam))!; } - - public static void Postfix(IntroCutscene._ShowRole_d__41 __instance) + public static void Postfix(Il2CppObjectBase __instance) { + var wrapper = new StateMachineWrapper(__instance); + + var cutscene = wrapper.Instance; var role = GetRole(PlayerControl.LocalPlayer); - // var alpha = __instance.__4__this.RoleText.color.a; if (role != null) { if (role.Faction == Faction.NeutralKilling || role.Faction == Faction.NeutralEvil || role.Faction == Faction.NeutralBenign) { - __instance.__4__this.TeamTitle.text = "Neutral"; - __instance.__4__this.TeamTitle.color = Color.white; - __instance.__4__this.BackgroundBar.material.color = Color.white; + cutscene.TeamTitle.text = "Neutral"; + cutscene.TeamTitle.color = Color.white; + cutscene.BackgroundBar.material.color = Color.white; PlayerControl.LocalPlayer.Data.Role.IntroSound = GetIntroSound(RoleTypes.Shapeshifter); } - __instance.__4__this.RoleText.text = role.Name; - __instance.__4__this.RoleText.color = role.Color; - __instance.__4__this.YouAreText.color = role.Color; - __instance.__4__this.RoleBlurbText.color = role.Color; - __instance.__4__this.RoleBlurbText.text = role.ImpostorText(); + else if (role.Faction == Faction.Impostors) + { + PlayerControl.LocalPlayer.Data.Role.IntroSound = GetIntroSound(RoleTypes.Impostor); + } + else + { + PlayerControl.LocalPlayer.Data.Role.IntroSound = GetIntroSound(RoleTypes.Crewmate); + } + cutscene.RoleText.text = role.Name; + cutscene.RoleText.color = role.Color; + cutscene.YouAreText.color = role.Color; + cutscene.RoleBlurbText.color = role.Color; + cutscene.RoleBlurbText.text = role.ImpostorText(); } if (ModifierText != null) @@ -530,33 +540,48 @@ public static void Postfix(IntroCutscene._ShowRole_d__41 __instance) ModifierText.color = Color.white; ModifierText.transform.position = - __instance.__4__this.transform.position - new Vector3(0f, 1.6f, 0f); + cutscene.transform.position - new Vector3(0f, 1.6f, 0f); ModifierText.gameObject.SetActive(true); } } } - [HarmonyPatch(typeof(IntroCutscene._ShowRole_d__41), nameof(IntroCutscene._ShowRole_d__41.MoveNext))] + [HarmonyPatch] public static class IntroCutscene_ShowRole_d__24 { - public static void Postfix(IntroCutscene._ShowRole_d__41 __instance) + public static MethodBase TargetMethod() + { + return StateMachineWrapper.GetStateMachineMoveNext(nameof(IntroCutscene.ShowRole))!; + } + public static void Postfix(Il2CppObjectBase __instance) { + var wrapper = new StateMachineWrapper(__instance); + + var cutscene = wrapper.Instance; var role = GetRole(PlayerControl.LocalPlayer); if (role != null) { if (role.Faction == Faction.NeutralKilling || role.Faction == Faction.NeutralEvil || role.Faction == Faction.NeutralBenign) { - __instance.__4__this.TeamTitle.text = "Neutral"; - __instance.__4__this.TeamTitle.color = Color.white; - __instance.__4__this.BackgroundBar.material.color = Color.white; + cutscene.TeamTitle.text = "Neutral"; + cutscene.TeamTitle.color = Color.white; + cutscene.BackgroundBar.material.color = Color.white; PlayerControl.LocalPlayer.Data.Role.IntroSound = GetIntroSound(RoleTypes.Shapeshifter); } - __instance.__4__this.RoleText.text = role.Name; - __instance.__4__this.RoleText.color = role.Color; - __instance.__4__this.YouAreText.color = role.Color; - __instance.__4__this.RoleBlurbText.color = role.Color; - __instance.__4__this.RoleBlurbText.text = role.ImpostorText(); - // __instance.__4__this.BackgroundBar.material.color = role.Color; + else if (role.Faction == Faction.Impostors) + { + PlayerControl.LocalPlayer.Data.Role.IntroSound = GetIntroSound(RoleTypes.Impostor); + } + else + { + PlayerControl.LocalPlayer.Data.Role.IntroSound = GetIntroSound(RoleTypes.Crewmate); + } + cutscene.RoleText.text = role.Name; + cutscene.RoleText.color = role.Color; + cutscene.YouAreText.color = role.Color; + cutscene.RoleBlurbText.color = role.Color; + cutscene.RoleBlurbText.text = role.ImpostorText(); + // cutscene.BackgroundBar.material.color = role.Color; } if (ModifierText != null) @@ -580,7 +605,7 @@ public static void Postfix(IntroCutscene._ShowRole_d__41 __instance) ModifierText.color = Color.white; ModifierText.transform.position = - __instance.__4__this.transform.position - new Vector3(0f, 1.6f, 0f); + cutscene.transform.position - new Vector3(0f, 1.6f, 0f); ModifierText.gameObject.SetActive(true); } @@ -608,32 +633,47 @@ public static void Postfix(IntroCutscene._ShowRole_d__41 __instance) } } - if (isAny) __instance.__4__this.ImpostorText.text = "There are an Unknown Number of Impostors among us"; + if (isAny) cutscene.ImpostorText.text = "There are an Unknown Number of Impostors among us"; } } } - [HarmonyPatch(typeof(IntroCutscene._CoBegin_d__35), nameof(IntroCutscene._CoBegin_d__35.MoveNext))] + [HarmonyPatch] public static class IntroCutscene_CoBegin_d__29 { - public static void Postfix(IntroCutscene._CoBegin_d__35 __instance) + public static MethodBase TargetMethod() + { + return StateMachineWrapper.GetStateMachineMoveNext(nameof(IntroCutscene.CoBegin))!; + } + public static void Postfix(Il2CppObjectBase __instance) { + var wrapper = new StateMachineWrapper(__instance); + + var cutscene = wrapper.Instance; var role = GetRole(PlayerControl.LocalPlayer); if (role != null) { if (role.Faction == Faction.NeutralKilling || role.Faction == Faction.NeutralEvil || role.Faction == Faction.NeutralBenign) { - __instance.__4__this.TeamTitle.text = "Neutral"; - __instance.__4__this.TeamTitle.color = Color.white; - __instance.__4__this.BackgroundBar.material.color = Color.white; + cutscene.TeamTitle.text = "Neutral"; + cutscene.TeamTitle.color = Color.white; + cutscene.BackgroundBar.material.color = Color.white; PlayerControl.LocalPlayer.Data.Role.IntroSound = GetIntroSound(RoleTypes.Shapeshifter); } - __instance.__4__this.RoleText.text = role.Name; - __instance.__4__this.RoleText.color = role.Color; - __instance.__4__this.YouAreText.color = role.Color; - __instance.__4__this.RoleBlurbText.color = role.Color; - __instance.__4__this.RoleBlurbText.text = role.ImpostorText(); - __instance.__4__this.BackgroundBar.material.color = role.Color; + else if (role.Faction == Faction.Impostors) + { + PlayerControl.LocalPlayer.Data.Role.IntroSound = GetIntroSound(RoleTypes.Impostor); + } + else + { + PlayerControl.LocalPlayer.Data.Role.IntroSound = GetIntroSound(RoleTypes.Crewmate); + } + cutscene.RoleText.text = role.Name; + cutscene.RoleText.color = role.Color; + cutscene.YouAreText.color = role.Color; + cutscene.RoleBlurbText.color = role.Color; + cutscene.RoleBlurbText.text = role.ImpostorText(); + cutscene.BackgroundBar.material.color = role.Color; } if (ModifierText != null) @@ -657,7 +697,7 @@ public static void Postfix(IntroCutscene._CoBegin_d__35 __instance) ModifierText.color = Color.white; ModifierText.transform.position = - __instance.__4__this.transform.position - new Vector3(0f, 1.6f, 0f); + cutscene.transform.position - new Vector3(0f, 1.6f, 0f); ModifierText.gameObject.SetActive(true); } @@ -685,19 +725,24 @@ public static void Postfix(IntroCutscene._CoBegin_d__35 __instance) } } - if (isAny) __instance.__4__this.ImpostorText.text = "There are an Unknown Number of Impostors among us"; + if (isAny) cutscene.ImpostorText.text = "There are an Unknown Number of Impostors among us"; } } } } - [HarmonyPatch(typeof(PlayerControl._CoSetTasks_d__141), nameof(PlayerControl._CoSetTasks_d__141.MoveNext))] + [HarmonyPatch] public static class PlayerControl_SetTasks { - public static void Postfix(PlayerControl._CoSetTasks_d__141 __instance) + public static MethodBase TargetMethod() { - if (__instance == null) return; - var player = __instance.__4__this; + return StateMachineWrapper.GetStateMachineMoveNext(nameof(PlayerControl.CoSetTasks))!; + } + public static void Postfix(Il2CppObjectBase __instance) + { + var wrapper = new StateMachineWrapper(__instance); + + var player = wrapper.Instance; var role = GetRole(player); var modifiers = Modifier.GetModifiers(player); foreach (var modifier in modifiers) @@ -1004,7 +1049,7 @@ private static void Postfix(HudManager __instance) } public static AudioClip GetIntroSound(RoleTypes roleType) { - return RoleManager.Instance.AllRoles.Where((role) => role.Role == roleType).FirstOrDefault().IntroSound; + return RoleManager.Instance.AllRoles.ToArray().First((role) => role.Role == roleType).IntroSound; } } } \ No newline at end of file diff --git a/source/Patches/Roles/RoleColorIndicators.cs b/source/Roles/RoleColorIndicators.cs similarity index 100% rename from source/Patches/Roles/RoleColorIndicators.cs rename to source/Roles/RoleColorIndicators.cs diff --git a/source/Patches/Roles/Scavenger.cs b/source/Roles/Scavenger.cs similarity index 100% rename from source/Patches/Roles/Scavenger.cs rename to source/Roles/Scavenger.cs diff --git a/source/Patches/Roles/Seer.cs b/source/Roles/Seer.cs similarity index 100% rename from source/Patches/Roles/Seer.cs rename to source/Roles/Seer.cs diff --git a/source/Patches/Roles/Sheriff.cs b/source/Roles/Sheriff.cs similarity index 100% rename from source/Patches/Roles/Sheriff.cs rename to source/Roles/Sheriff.cs diff --git a/source/Patches/Roles/Snitch.cs b/source/Roles/Snitch.cs similarity index 100% rename from source/Patches/Roles/Snitch.cs rename to source/Roles/Snitch.cs diff --git a/source/Patches/Roles/Soul Collector.cs b/source/Roles/Soul Collector.cs similarity index 100% rename from source/Patches/Roles/Soul Collector.cs rename to source/Roles/Soul Collector.cs diff --git a/source/Patches/Roles/Spy.cs b/source/Roles/Spy.cs similarity index 100% rename from source/Patches/Roles/Spy.cs rename to source/Roles/Spy.cs diff --git a/source/Patches/Roles/Survivor.cs b/source/Roles/Survivor.cs similarity index 100% rename from source/Patches/Roles/Survivor.cs rename to source/Roles/Survivor.cs diff --git a/source/Patches/Roles/Swapper.cs b/source/Roles/Swapper.cs similarity index 100% rename from source/Patches/Roles/Swapper.cs rename to source/Roles/Swapper.cs diff --git a/source/Patches/Roles/Swooper.cs b/source/Roles/Swooper.cs similarity index 100% rename from source/Patches/Roles/Swooper.cs rename to source/Roles/Swooper.cs diff --git a/source/Patches/Roles/Tracker.cs b/source/Roles/Tracker.cs similarity index 100% rename from source/Patches/Roles/Tracker.cs rename to source/Roles/Tracker.cs diff --git a/source/Patches/Roles/Traitor.cs b/source/Roles/Traitor.cs similarity index 100% rename from source/Patches/Roles/Traitor.cs rename to source/Roles/Traitor.cs diff --git a/source/Patches/Roles/Transporter.cs b/source/Roles/Transporter.cs similarity index 99% rename from source/Patches/Roles/Transporter.cs rename to source/Roles/Transporter.cs index 9e63ff6df..60192ab45 100644 --- a/source/Patches/Roles/Transporter.cs +++ b/source/Roles/Transporter.cs @@ -9,7 +9,7 @@ using System.Collections; using TownOfUs.CrewmateRoles.MedicMod; using TownOfUs.Patches.NeutralRoles; -using TownOfUs.Roles.Modifiers; +using TownOfUs.Modifiers; using TownOfUs.Modifiers.ShyMod; using TownOfUs.Extensions; using TownOfUs.CrewmateRoles.ClericMod; diff --git a/source/Patches/Roles/Trapper.cs b/source/Roles/Trapper.cs similarity index 100% rename from source/Patches/Roles/Trapper.cs rename to source/Roles/Trapper.cs diff --git a/source/Patches/Roles/Undertaker.cs b/source/Roles/Undertaker.cs similarity index 100% rename from source/Patches/Roles/Undertaker.cs rename to source/Roles/Undertaker.cs diff --git a/source/Patches/Roles/Vampire.cs b/source/Roles/Vampire.cs similarity index 100% rename from source/Patches/Roles/Vampire.cs rename to source/Roles/Vampire.cs diff --git a/source/Patches/Roles/Vanilla.cs b/source/Roles/Vanilla.cs similarity index 100% rename from source/Patches/Roles/Vanilla.cs rename to source/Roles/Vanilla.cs diff --git a/source/Patches/Roles/Venerer.cs b/source/Roles/Venerer.cs similarity index 100% rename from source/Patches/Roles/Venerer.cs rename to source/Roles/Venerer.cs diff --git a/source/Patches/Roles/Veteran.cs b/source/Roles/Veteran.cs similarity index 100% rename from source/Patches/Roles/Veteran.cs rename to source/Roles/Veteran.cs diff --git a/source/Patches/Roles/Vigilante.cs b/source/Roles/Vigilante.cs similarity index 100% rename from source/Patches/Roles/Vigilante.cs rename to source/Roles/Vigilante.cs diff --git a/source/Patches/Roles/Warden.cs b/source/Roles/Warden.cs similarity index 100% rename from source/Patches/Roles/Warden.cs rename to source/Roles/Warden.cs diff --git a/source/Patches/Roles/Warlock.cs b/source/Roles/Warlock.cs similarity index 100% rename from source/Patches/Roles/Warlock.cs rename to source/Roles/Warlock.cs diff --git a/source/Patches/Roles/Werewolf.cs b/source/Roles/Werewolf.cs similarity index 100% rename from source/Patches/Roles/Werewolf.cs rename to source/Roles/Werewolf.cs diff --git a/source/TownOfUs.cs b/source/TownOfUs.cs index a2f0088e8..0184fd805 100644 --- a/source/TownOfUs.cs +++ b/source/TownOfUs.cs @@ -22,18 +22,21 @@ namespace TownOfUs { - [BepInPlugin(Id, "Town Of Us", VersionString)] + [BepInPlugin(Id, "Town Of Us: Reactivated", VersionString)] [BepInDependency(ReactorPlugin.Id)] [BepInDependency(SubmergedCompatibility.SUBMERGED_GUID, BepInDependency.DependencyFlags.SoftDependency)] [ReactorModFlags(Reactor.Networking.ModFlags.RequireOnAllClients)] public class TownOfUs : BasePlugin { - public const string Id = "com.slushiegoose.townofus"; - public const string VersionString = "5.3.1"; + public static string DataPath => Path.GetFullPath("reactivated_presets", Application.persistentDataPath); + public const string Id = "com.reactivated.townofus"; + public const string VersionString = "6.0.0"; public static System.Version Version = System.Version.Parse(VersionString); public const string VersionTag = ""; public static AssetLoader bundledAssets; + public static Sprite NextSprite; + public static Sprite NextActiveSprite; public static Sprite JanitorClean; public static Sprite EngineerFix; @@ -129,8 +132,6 @@ public class TownOfUs : BasePlugin public static Vector3 ButtonPosition { get; private set; } = new Vector3(2.6f, 0.7f, -9f); - private static DLoadImage _iCallLoadImage; - private Harmony _harmony; public static ConfigEntry DeadSeeGhosts { get; set; } @@ -145,103 +146,115 @@ public override void Load() ReactorCredits.Register(ReactorCredits.AlwaysShow); System.Console.WriteLine("000.000.000.000/000000000000000000"); - _harmony = new Harmony("com.slushiegoose.townofus"); + _harmony = new Harmony("com.reactivated.townofus"); Generate.GenerateAll(); bundledAssets = new(); - JanitorClean = CreateSprite("TownOfUs.Resources.Janitor.png"); - EngineerFix = CreateSprite("TownOfUs.Resources.Engineer.png"); - SwapperSwitch = CreateSprite("TownOfUs.Resources.SwapperSwitch.png"); - SwapperSwitchDisabled = CreateSprite("TownOfUs.Resources.SwapperSwitchDisabled.png"); - Footprint = CreateSprite("TownOfUs.Resources.Footprint.png"); - MedicSprite = CreateSprite("TownOfUs.Resources.Medic.png"); - SeerSprite = CreateSprite("TownOfUs.Resources.Seer.png"); - SampleSprite = CreateSprite("TownOfUs.Resources.Sample.png"); - MorphSprite = CreateSprite("TownOfUs.Resources.Morph.png"); - Arrow = CreateSprite("TownOfUs.Resources.Arrow.png"); - MineSprite = CreateSprite("TownOfUs.Resources.Mine.png"); - SwoopSprite = CreateSprite("TownOfUs.Resources.Swoop.png"); - DouseSprite = CreateSprite("TownOfUs.Resources.Douse.png"); - IgniteSprite = CreateSprite("TownOfUs.Resources.Ignite.png"); - ReviveSprite = CreateSprite("TownOfUs.Resources.Revive.png"); - ButtonSprite = CreateSprite("TownOfUs.Resources.Button.png"); - DisperseSprite = CreateSprite("TownOfUs.Resources.Disperse.png"); - DragSprite = CreateSprite("TownOfUs.Resources.Drag.png"); - DropSprite = CreateSprite("TownOfUs.Resources.Drop.png"); - CycleBackSprite = CreateSprite("TownOfUs.Resources.CycleBack.png"); - CycleForwardSprite = CreateSprite("TownOfUs.Resources.CycleForward.png"); - GuessSprite = CreateSprite("TownOfUs.Resources.Guess.png"); - FlashSprite = CreateSprite("TownOfUs.Resources.Flash.png"); - AlertSprite = CreateSprite("TownOfUs.Resources.Alert.png"); - RememberSprite = CreateSprite("TownOfUs.Resources.Remember.png"); - TrackSprite = CreateSprite("TownOfUs.Resources.Track.png"); - PlantSprite = CreateSprite("TownOfUs.Resources.Plant.png"); - DetonateSprite = CreateSprite("TownOfUs.Resources.Detonate.png"); - TransportSprite = CreateSprite("TownOfUs.Resources.Transport.png"); - MediateSprite = CreateSprite("TownOfUs.Resources.Mediate.png"); - VestSprite = CreateSprite("TownOfUs.Resources.Vest.png"); - ProtectSprite = CreateSprite("TownOfUs.Resources.Protect.png"); - BlackmailSprite = CreateSprite("TownOfUs.Resources.Blackmail.png"); - BlackmailLetterSprite = CreateSprite("TownOfUs.Resources.BlackmailLetter.png"); - BlackmailOverlaySprite = CreateSprite("TownOfUs.Resources.BlackmailOverlay.png"); - LighterSprite = CreateSprite("TownOfUs.Resources.Lighter.png"); - DarkerSprite = CreateSprite("TownOfUs.Resources.Darker.png"); - InfectSprite = CreateSprite("TownOfUs.Resources.Infect.png"); - RampageSprite = CreateSprite("TownOfUs.Resources.Rampage.png"); - TrapSprite = CreateSprite("TownOfUs.Resources.Trap.png"); - InspectSprite = CreateSprite("TownOfUs.Resources.Inspect.png"); - ExamineSprite = CreateSprite("TownOfUs.Resources.Examine.png"); - EscapeSprite = CreateSprite("TownOfUs.Resources.Recall.png"); - MarkSprite = CreateSprite("TownOfUs.Resources.Mark.png"); - ImitateSelectSprite = CreateSprite("TownOfUs.Resources.ImitateSelect.png"); - ImitateDeselectSprite = CreateSprite("TownOfUs.Resources.ImitateDeselect.png"); - ObserveSprite = CreateSprite("TownOfUs.Resources.Observe.png"); - BiteSprite = CreateSprite("TownOfUs.Resources.Bite.png"); - RevealSprite = CreateSprite("TownOfUs.Resources.Reveal.png"); - ConfessSprite = CreateSprite("TownOfUs.Resources.Confess.png"); - BlessSprite = CreateSprite("TownOfUs.Resources.Bless.png"); - NoAbilitySprite = CreateSprite("TownOfUs.Resources.NoAbility.png"); - CamouflageSprite = CreateSprite("TownOfUs.Resources.Camouflage.png"); - CamoSprintSprite = CreateSprite("TownOfUs.Resources.CamoSprint.png"); - CamoSprintFreezeSprite = CreateSprite("TownOfUs.Resources.CamoSprintFreeze.png"); - HackSprite = CreateSprite("TownOfUs.Resources.Hack.png"); - MimicSprite = CreateSprite("TownOfUs.Resources.Mimic.png"); - LockSprite = CreateSprite("TownOfUs.Resources.Lock.png"); - StalkSprite = CreateSprite("TownOfUs.Resources.Stalk.png"); - CrimeSceneSprite = CreateSprite("TownOfUs.Resources.CrimeScene.png"); - CampaignSprite = CreateSprite("TownOfUs.Resources.Campaign.png"); - FortifySprite = CreateSprite("TownOfUs.Resources.Fortify.png"); - HypnotiseSprite = CreateSprite("TownOfUs.Resources.Hypnotise.png"); - HysteriaSprite = CreateSprite("TownOfUs.Resources.Hysteria.png"); - JailSprite = CreateSprite("TownOfUs.Resources.Jail.png"); - InJailSprite = CreateSprite("TownOfUs.Resources.InJail.png"); - JailCellSprite = CreateSprite("TownOfUs.Resources.JailCell.png"); - ExecuteSprite = CreateSprite("TownOfUs.Resources.Execute.png"); - ReapSprite = CreateSprite("TownOfUs.Resources.Reap.png"); - SoulSprite = CreateSprite("TownOfUs.Resources.Soul.png"); - WatchSprite = CreateSprite("TownOfUs.Resources.Watch.png"); - CampSprite = CreateSprite("TownOfUs.Resources.Camp.png"); - ShootSprite = CreateSprite("TownOfUs.Resources.Shoot.png"); - FlushSprite = CreateSprite("TownOfUs.Resources.Flush.png"); - BlockSprite = CreateSprite("TownOfUs.Resources.Block.png"); - BarricadeSprite = CreateSprite("TownOfUs.Resources.Barricade.png"); - BlindSprite = CreateSprite("TownOfUs.Resources.Blind.png"); - GuardSprite = CreateSprite("TownOfUs.Resources.Guard.png"); - BribeSprite = CreateSprite("TownOfUs.Resources.Bribe.png"); - BarrierSprite = CreateSprite("TownOfUs.Resources.Barrier.png"); - CleanseSprite = CreateSprite("TownOfUs.Resources.Cleanse.png"); - DetectSprite = CreateSprite("TownOfUs.Resources.Detect.png"); - - ToUBanner = CreateSprite("TownOfUs.Resources.TownOfUsBanner.png"); - UpdateTOUButton = CreateSprite("TownOfUs.Resources.UpdateToUButton.png"); - UpdateSubmergedButton = CreateSprite("TownOfUs.Resources.UpdateSubmergedButton.png"); - - ZoomPlusButton = CreateSprite("TownOfUs.Resources.Plus.png"); - ZoomMinusButton = CreateSprite("TownOfUs.Resources.Minus.png"); - ZoomPlusActiveButton = CreateSprite("TownOfUs.Resources.PlusActive.png"); - ZoomMinusActiveButton = CreateSprite("TownOfUs.Resources.MinusActive.png"); + var shortPath = "TownOfUs.Resources"; + + UpdateTOUButton = CreateSprite($"{shortPath}.UpdateToUButton.png"); + UpdateSubmergedButton = CreateSprite($"{shortPath}.UpdateSubmergedButton.png"); + NextSprite = CreateSprite($"{shortPath}.NextButton.png"); + NextActiveSprite = CreateSprite($"{shortPath}.NextButtonActive.png"); + SwapperSwitch = CreateSprite($"{shortPath}.SwapperSwitch.png"); + SwapperSwitchDisabled = CreateSprite($"{shortPath}.SwapperSwitchDisabled.png"); + Footprint = CreateSprite($"{shortPath}.Footprint.png"); + Arrow = CreateSprite($"{shortPath}.Arrow.png"); + ButtonSprite = CreateSprite($"{shortPath}.Button.png"); + DisperseSprite = CreateSprite($"{shortPath}.Disperse.png"); + CycleBackSprite = CreateSprite($"{shortPath}.CycleBack.png"); + CycleForwardSprite = CreateSprite($"{shortPath}.CycleForward.png"); + GuessSprite = CreateSprite($"{shortPath}.Guess.png"); + BlackmailLetterSprite = CreateSprite($"{shortPath}.BlackmailLetter.png"); + BlackmailOverlaySprite = CreateSprite($"{shortPath}.BlackmailOverlay.png"); + LighterSprite = CreateSprite($"{shortPath}.Lighter.png"); + DarkerSprite = CreateSprite($"{shortPath}.Darker.png"); + RevealSprite = CreateSprite($"{shortPath}.Reveal.png"); + ImitateSelectSprite = CreateSprite($"{shortPath}.ImitateSelect.png"); + ImitateDeselectSprite = CreateSprite($"{shortPath}.ImitateDeselect.png"); + LockSprite = CreateSprite($"{shortPath}.Lock.png"); + CrimeSceneSprite = CreateSprite($"{shortPath}.CrimeScene.png"); + HysteriaSprite = CreateSprite($"{shortPath}.Hysteria.png"); + InJailSprite = CreateSprite($"{shortPath}.InJail.png"); + JailCellSprite = CreateSprite($"{shortPath}.JailCell.png"); + ExecuteSprite = CreateSprite($"{shortPath}.Execute.png"); + SoulSprite = CreateSprite($"{shortPath}.Soul.png"); + ShootSprite = CreateSprite($"{shortPath}.Shoot.png"); + BarricadeSprite = CreateSprite($"{shortPath}.Barricade.png"); + DetectSprite = CreateSprite($"{shortPath}.Detect.png"); + + ToUBanner = CreateSprite($"{shortPath}.TouBanner.png", 125f); + + ZoomPlusButton = CreateSprite($"{shortPath}.Plus.png"); + ZoomMinusButton = CreateSprite($"{shortPath}.Minus.png"); + ZoomPlusActiveButton = CreateSprite($"{shortPath}.PlusActive.png"); + ZoomMinusActiveButton = CreateSprite($"{shortPath}.MinusActive.png"); + + var crewPath = "TownOfUs.Resources.CrewButtons"; + EngineerFix = CreateSprite($"{crewPath}.Engineer.png"); + MedicSprite = CreateSprite($"{crewPath}.Medic.png"); + SeerSprite = CreateSprite($"{crewPath}.Seer.png"); + ReviveSprite = CreateSprite($"{crewPath}.Revive.png"); + AlertSprite = CreateSprite($"{crewPath}.Alert.png"); + TrackSprite = CreateSprite($"{crewPath}.Track.png"); + TransportSprite = CreateSprite($"{crewPath}.Transport.png"); + MediateSprite = CreateSprite($"{crewPath}.Mediate.png"); + TrapSprite = CreateSprite($"{crewPath}.Trap.png"); + InspectSprite = CreateSprite($"{crewPath}.Inspect.png"); + ExamineSprite = CreateSprite($"{crewPath}.Examine.png"); + ConfessSprite = CreateSprite($"{crewPath}.Confess.png"); + BlessSprite = CreateSprite($"{crewPath}.Bless.png"); + StalkSprite = CreateSprite($"{crewPath}.Stalk.png"); + CampaignSprite = CreateSprite($"{crewPath}.Campaign.png"); + FortifySprite = CreateSprite($"{crewPath}.Fortify.png"); + JailSprite = CreateSprite($"{crewPath}.Jail.png"); + WatchSprite = CreateSprite($"{crewPath}.Watch.png"); + CampSprite = CreateSprite($"{crewPath}.Camp.png"); + FlushSprite = CreateSprite($"{crewPath}.Flush.png"); + BlockSprite = CreateSprite($"{crewPath}.Block.png"); + BarrierSprite = CreateSprite($"{crewPath}.Barrier.png"); + CleanseSprite = CreateSprite($"{crewPath}.Cleanse.png"); + + var impPath = "TownOfUs.Resources.ImpButtons"; + + JanitorClean = CreateSprite($"{impPath}.Janitor.png"); + SampleSprite = CreateSprite($"{impPath}.Sample.png"); + MorphSprite = CreateSprite($"{impPath}.Morph.png"); + MineSprite = CreateSprite($"{impPath}.Mine.png"); + SwoopSprite = CreateSprite($"{impPath}.Swoop.png"); + DragSprite = CreateSprite($"{impPath}.Drag.png"); + DropSprite = CreateSprite($"{impPath}.Drop.png"); + FlashSprite = CreateSprite($"{impPath}.Flash.png"); + PlantSprite = CreateSprite($"{impPath}.Plant.png"); + DetonateSprite = CreateSprite($"{impPath}.Detonate.png"); + BlackmailSprite = CreateSprite($"{impPath}.Blackmail.png"); + EscapeSprite = CreateSprite($"{impPath}.Recall.png"); + MarkSprite = CreateSprite($"{impPath}.Mark.png"); + NoAbilitySprite = CreateSprite($"{impPath}.NoAbility.png"); + CamouflageSprite = CreateSprite($"{impPath}.Camouflage.png"); + CamoSprintSprite = CreateSprite($"{impPath}.CamoSprint.png"); + CamoSprintFreezeSprite = CreateSprite($"{impPath}.CamoSprintFreeze.png"); + HypnotiseSprite = CreateSprite($"{impPath}.Hypnotise.png"); + BlindSprite = CreateSprite($"{impPath}.Blind.png"); + + var neutPath = "TownOfUs.Resources.NeutButtons"; + + DouseSprite = CreateSprite($"{neutPath}.Douse.png"); + IgniteSprite = CreateSprite($"{neutPath}.Ignite.png"); + RememberSprite = CreateSprite($"{neutPath}.Remember.png"); + VestSprite = CreateSprite($"{neutPath}.Vest.png"); + ProtectSprite = CreateSprite($"{neutPath}.Protect.png"); + InfectSprite = CreateSprite($"{neutPath}.Infect.png"); + RampageSprite = CreateSprite($"{neutPath}.Rampage.png"); + ObserveSprite = CreateSprite($"{neutPath}.Observe.png"); + BiteSprite = CreateSprite($"{neutPath}.Bite.png"); + HackSprite = CreateSprite($"{neutPath}.Hack.png"); + MimicSprite = CreateSprite($"{neutPath}.Mimic.png"); + ReapSprite = CreateSprite($"{neutPath}.Reap.png"); + GuardSprite = CreateSprite($"{neutPath}.Guard.png"); + BribeSprite = CreateSprite($"{neutPath}.Bribe.png"); PalettePatch.Load(); ClassInjector.RegisterTypeInIl2Cpp(); @@ -260,27 +273,36 @@ public override void Load() ServerManager.DefaultRegions = new Il2CppReferenceArray(new IRegionInfo[0]); } - public static Sprite CreateSprite(string name) + public static Sprite CreateSprite(string name, float pixelsPerUnit = 100f) { - var pixelsPerUnit = 100f; var pivot = new Vector2(0.5f, 0.5f); var assembly = Assembly.GetExecutingAssembly(); - var tex = AmongUsExtensions.CreateEmptyTexture(); - var imageStream = assembly.GetManifestResourceStream(name); - var img = imageStream.ReadFully(); - LoadImage(tex, img, true); - tex.DontDestroy(); - var sprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), pivot, pixelsPerUnit); + var tex = LoadTextureFromResourcePath(name, assembly); + var sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f), pixelsPerUnit); + sprite.name = name; sprite.DontDestroy(); return sprite; } - - public static void LoadImage(Texture2D tex, byte[] data, bool markNonReadable) + public static Texture2D LoadTextureFromResourcePath(string resourcePath, Assembly assembly) { - _iCallLoadImage ??= IL2CPP.ResolveICall("UnityEngine.ImageConversion::LoadImage"); - var il2CPPArray = (Il2CppStructArray) data; - _iCallLoadImage.Invoke(tex.Pointer, il2CPPArray.Pointer, markNonReadable); + var tex = new Texture2D(1, 1, TextureFormat.ARGB32, false) + { + wrapMode = TextureWrapMode.Clamp, + }; + var myStream = assembly.GetManifestResourceStream(resourcePath); + if (myStream != null) + { + var buttonTexture = myStream.ReadFully(); + tex.LoadImage(buttonTexture, false); + } + else + { + throw new ArgumentException($"Resource not found: {resourcePath}"); + } + + tex.name = resourcePath; + return tex; } private delegate bool DLoadImage(IntPtr tex, IntPtr data, bool markNonReadable); diff --git a/source/TownOfUs.csproj b/source/TownOfUsReactivated.csproj similarity index 55% rename from source/TownOfUs.csproj rename to source/TownOfUsReactivated.csproj index 9d7167c3e..c13ec40ef 100644 --- a/source/TownOfUs.csproj +++ b/source/TownOfUsReactivated.csproj @@ -1,26 +1,23 @@  net6.0 - 5.3.0 + 6.0.0 embedded + TownOfUs latest - Steam - 2025.3.25 - 2025.3.25 - true - - - - - - + + + + + + @@ -32,7 +29,6 @@ - - + \ No newline at end of file diff --git a/source/Utilities/CompilerGeneratedObjectWrapper.cs b/source/Utilities/CompilerGeneratedObjectWrapper.cs new file mode 100644 index 000000000..da5a28809 --- /dev/null +++ b/source/Utilities/CompilerGeneratedObjectWrapper.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using HarmonyLib; + +namespace TownOfUs.Utilities; + +/// +/// A safe wrapper around compiler generated classes like DisplayClass or IEnumerator state machines. +/// +public class CompilerGeneratedObjectWrapper +{ + /// + /// Gets a reference to the compiler generated object. + /// + public object GeneratedObject { get; } + + /// + /// Gets the type of the compiler generated object. + /// + protected Type GeneratedType { get; } + + /// + /// Gets the property info cache for faster lookups. + /// + protected Dictionary PropertyCache { get; } + + /// + /// Gets the getter cache for faster property access. + /// + protected Dictionary GetterCache { get; } + + /// + /// Gets the setter cache for faster property access. + /// + protected Dictionary SetterCache { get; } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of the compiler generated object. + public CompilerGeneratedObjectWrapper(object generatedObject) + { + GeneratedObject = generatedObject; + GeneratedType = generatedObject.GetType(); + + PropertyCache = []; + GetterCache = []; + SetterCache = []; + } + + public PropertyInfo CacheProperty(string fieldName) + { + var propertyInfo = AccessTools.Property(GeneratedType, fieldName) + ?? throw new MissingMemberException( + $"Could not find field '{fieldName}' in type '{GeneratedType}'."); + + if (propertyInfo.PropertyType != typeof(T)) + { + throw new InvalidCastException( + $"Field '{fieldName}' is of type '{propertyInfo.PropertyType}', not '{typeof(T)}'."); + } + + PropertyCache[fieldName] = propertyInfo; + + var funcType = typeof(Func); + GetterCache[fieldName] = propertyInfo.GetMethod!.CreateDelegate(funcType, GeneratedObject); + + var actionType = typeof(Action); + SetterCache[fieldName] = propertyInfo.SetMethod!.CreateDelegate(actionType, GeneratedObject); + + return propertyInfo; + } + + /// + /// Gets the value of a field in the compiler generated object. + /// + /// The name of the field to get. + /// The type of the field. + /// >The value of the field. + /// Thrown if the field does not exist. + public TField GetField(string fieldName) + { + if (!PropertyCache.TryGetValue(fieldName, out var propertyInfo)) + { + propertyInfo = CacheProperty(fieldName); + } + + if (GetterCache.TryGetValue(fieldName, out var getter)) + { + return ((Func) getter)(); + } + + return (TField) propertyInfo.GetValue(GeneratedObject)!; + } + + /// + /// Sets the value of a field in the compiler generated object. + /// + /// The name of the field to set. + /// The value to set. + /// The type of the field. + /// Thrown if the field does not exist. + public void SetField(string fieldName, TField value) + { + if (!PropertyCache.TryGetValue(fieldName, out var propertyInfo)) + { + propertyInfo = CacheProperty(fieldName); + } + + if (SetterCache.TryGetValue(fieldName, out var setter)) + { + ((Action) setter)(value); + return; + } + + propertyInfo.SetValue(GeneratedObject, value); + } +} + diff --git a/source/Utilities/StateMachineWrapper.cs b/source/Utilities/StateMachineWrapper.cs new file mode 100644 index 000000000..b30792daf --- /dev/null +++ b/source/Utilities/StateMachineWrapper.cs @@ -0,0 +1,107 @@ +using System; +using System.Linq; +using System.Reflection; +using BepInEx.Logging; +using HarmonyLib; +using Reactor.Utilities; + +namespace TownOfUs.Utilities; + +/// +/// A wrapper for state machine objects to access their parent instance and state. +/// +/// The type of the parent class that owns the state machine. +public class StateMachineWrapper : CompilerGeneratedObjectWrapper +{ + // normally it is fields, but IL2CPP turns them into properties + private readonly PropertyInfo _thisProperty; + private readonly PropertyInfo _stateProperty; + + private T _parentInstance; + + /// + /// Gets the instance of the parent class that owns the state machine. + /// + public T Instance => _parentInstance ??= (T) _thisProperty.GetValue(GeneratedObject)!; + + /// + /// Gets or sets the current state of the state machine. + /// + /// The current state as an integer. + public int State + { + get => (int) _stateProperty.GetValue(GeneratedObject)!; + set => _stateProperty.SetValue(GeneratedObject, value); + } + + /// + /// Initializes a new instance of the class. + /// + /// The state machine instance to wrap. + public StateMachineWrapper(object stateMachine) : base(stateMachine) + { + _thisProperty = AccessTools.Property(GeneratedType, "__4__this"); + _stateProperty = AccessTools.Property(GeneratedType, "__1__state"); + + if (_thisProperty == null || _stateProperty == null) + { + throw new MissingMemberException($"Could not find required properties in type '{GeneratedType}'."); + } + } + + /// + /// Gets a parameter from the state machine by its name. + /// + /// The name of the parameter to retrieve. + /// The type of the parameter to retrieve. + /// >The value of the specified parameter. + /// Thrown if the specified parameter does not exist. + public TField GetParameter(string parameterName) + { + return GetField(parameterName); + } + + /// + /// Sets a parameter in the state machine by its name. + /// + /// The name of the parameter to set. + /// The value to set for the parameter. + /// The type of the parameter to set. + /// Thrown if the specified parameter does not exist. + public void SetParameter(string parameterName, TField value) + { + SetField(parameterName, value); + } + + /// + /// Attempts to retrieve the MoveNext method of a state machine for the specified method name in type T. + /// + /// The name of the method whose state machine MoveNext method is to be retrieved. + /// The type containing the state machine. + /// The MoveNext if found; otherwise, null. + public static MethodBase GetStateMachineMoveNext(string methodName) + { + var typeName = typeof(T).FullName; + var showRoleStateMachine = + typeof(T) + .GetNestedTypes() + .FirstOrDefault(x => x.Name.Contains(methodName)); + + if (showRoleStateMachine == null) + { + Log.LogError($"Failed to find {methodName} state machine for {typeName}"); + return null; + } + + var moveNext = AccessTools.Method(showRoleStateMachine, "MoveNext"); + if (moveNext == null) + { + Log.LogError($"Failed to find MoveNext method for {typeName}.{methodName}"); + return null; + } + + Log.LogInfo($"Found {methodName}.MoveNext"); + return moveNext; + } + private static ManualLogSource Log => PluginSingleton.Instance.Log; +} diff --git a/source/Versioning.json b/source/Versioning.json index 5b9bdf77d..955a938ec 100644 --- a/source/Versioning.json +++ b/source/Versioning.json @@ -53,5 +53,17 @@ "50614950": "2025.3.25" }, "ModVersion": "5.3.1" + }, + { + "InternalVersions": { + "50614950": "2025.3.25" + }, + "ModVersion": "5.3.1" + }, + { + "InternalVersions": { + "50652400": "2026.3.31" + }, + "ModVersion": "6.0.0" } ] \ No newline at end of file diff --git a/source/VersioningV2.json b/source/VersioningV2.json new file mode 100644 index 000000000..512730a0f --- /dev/null +++ b/source/VersioningV2.json @@ -0,0 +1,18 @@ +[ // The versions are checked by using Semantic Versioning. The int determines if the version is recommended (0), if it's functional but not ideal (1) or completely incompatible (2). + { + "InternalVersions": { + "2026.3.31": 0, + "2026.4.7": 0, + "2026.6.5": 1 + }, + "ModVersion": "6.0.0" + }, + { + "InternalVersions": { + "2026.3.31": 0, + "2026.4.7": 0, + "2026.6.5": 1 + }, + "ModVersion": "6.0.1" + } +]