From ea03693ff2eae9c1a1dff01eefe313cc91101679 Mon Sep 17 00:00:00 2001 From: Darkborderman Date: Sun, 12 Mar 2023 22:31:39 +0800 Subject: [PATCH] feat: Mod done --- .gitattributes | 2 + .github/workflows/github-repo-info.yml | 18 ++++ LICENSE | 21 ++++ README.md | 3 + data/config/settings.json | 5 + data/scripts/plugins/LevelupPluginImpl.java | 107 ++++++++++++++++++++ metadata.yml | 12 +++ mod_info.json | 8 ++ 8 files changed, 176 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/workflows/github-repo-info.yml create mode 100644 LICENSE create mode 100644 README.md create mode 100644 data/config/settings.json create mode 100644 data/scripts/plugins/LevelupPluginImpl.java create mode 100644 metadata.yml create mode 100644 mod_info.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3f10803 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* text eol=lf +* linguist-detectable diff --git a/.github/workflows/github-repo-info.yml b/.github/workflows/github-repo-info.yml new file mode 100644 index 0000000..585ab15 --- /dev/null +++ b/.github/workflows/github-repo-info.yml @@ -0,0 +1,18 @@ +name: Update Github repository information + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Update Github repo info + uses: Darkborderman/github-actions/github-repo-info@master + env: + YML_PATH: metadata.yml + GH_TOKEN: ${{ secrets.PAT_TOKEN }} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8e45bda --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Darkborderman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a209c24 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Starsector-LowerLevelCurve + +Set max player level to 40 and lower exp curve in Starsector diff --git a/data/config/settings.json b/data/config/settings.json new file mode 100644 index 0000000..2344908 --- /dev/null +++ b/data/config/settings.json @@ -0,0 +1,5 @@ +{ + "playerMaxLevel":40, + "skillPointsPerLevel": 1, + "storyPointsPerLevel": 4 +} diff --git a/data/scripts/plugins/LevelupPluginImpl.java b/data/scripts/plugins/LevelupPluginImpl.java new file mode 100644 index 0000000..7205dd5 --- /dev/null +++ b/data/scripts/plugins/LevelupPluginImpl.java @@ -0,0 +1,107 @@ +package data.scripts.plugins; + +import com.fs.starfarer.api.Global; +import com.fs.starfarer.api.plugins.LevelupPlugin; + +public class LevelupPluginImpl implements LevelupPlugin { + + public static int XP_AFTER_MAX_LEVEL = 450000; + + public static long [] XP_PER_LEVEL = new long [] { + 0, + 2500, + 5000, + 7500, + 10000, // level 5, 2500 each + 15000, + 20000, + 25000, + 30000, + 35000, // level 10, 5000 each + 42500, + 50000, + 57500, + 65000, + 72500, // level 15, 7500 each + 82500, + 92500, + 102500, + 112500, + 122500, // level 20, 10000 each + 135000, + 147500, + 160000, + 172500, + 185000, // level 25, 12500 each + 200000, + 215000, + 230000, + 245000, + 260000, // level 30, 15000 each + 277500, + 295000, + 312500, + 330000, + 347500, // level 35, 17500 each + 367500, + 387500, + 407500, + 427500, + 447500, // level 40, 20000 each + }; + + public static long [] TOTAL_XP_PER_LEVEL = new long [XP_PER_LEVEL.length]; + + static { + long total = 0; + for (int i = 0; i < XP_PER_LEVEL.length; i++) { + total += XP_PER_LEVEL[i]; + TOTAL_XP_PER_LEVEL[i] = total; + } + } + + public int getPointsAtLevel(int level) { + return (int) Global.getSettings().getFloat("skillPointsPerLevel"); + } + + public int getMaxLevel() { + return (int) Global.getSettings().getFloat("playerMaxLevel"); + } + + public int getStoryPointsPerLevel() { + return (int) Global.getSettings().getFloat("storyPointsPerLevel"); + } + + public int getBonusXPUseMultAtMaxLevel() { + return (int) Global.getSettings().getFloat("bonusXPUseMultAtMaxLevel"); + } + + public long getXPForNextLevel(int level) { + if (level < XP_PER_LEVEL.length) { + return XP_PER_LEVEL[level]; + } + + return (long) (XP_PER_LEVEL[XP_PER_LEVEL.length - 1]); + } + + public long getXPForLevel(int level) { + if (level <= 1) return 0; + + if (level - 1 < TOTAL_XP_PER_LEVEL.length) { + return TOTAL_XP_PER_LEVEL[level - 1]; + } + + return TOTAL_XP_PER_LEVEL[TOTAL_XP_PER_LEVEL.length - 1] + + XP_AFTER_MAX_LEVEL * (level - TOTAL_XP_PER_LEVEL.length); + } + + public static void main(String[] args) { + LevelupPluginImpl plugin = new LevelupPluginImpl(); + // System.out.println(plugin.getXPForLevel(16) - plugin.getXPForLevel(15)); + + for (int i = 1; i < 41; i++) { + //System.out.println(i + ": " + (plugin.getXPForLevel(i) - plugin.getXPForLevel(i - 1))); + System.out.println(i + ": " + (plugin.getXPForLevel(i))); + } + } +} diff --git a/metadata.yml b/metadata.yml new file mode 100644 index 0000000..5e38005 --- /dev/null +++ b/metadata.yml @@ -0,0 +1,12 @@ +github: + description: Set max player level to 40 and lower exp curve in Starsector. + enable_discussions: false + enable_issues: false + enable_projects: false + enable_wiki: false + homepage: https://github.com/DarkbordermanModding/Starsector-LowerLevelCurve + template: false + topics: + - mod + - starsector + - starsector-mod diff --git a/mod_info.json b/mod_info.json new file mode 100644 index 0000000..79c6659 --- /dev/null +++ b/mod_info.json @@ -0,0 +1,8 @@ +{ + "id": "darkborderman.lowerlevelcurve", + "name": "Lower Level Curve", + "author": "Darkborderman", + "version": "0.0.0", + "description": "Set max player level to 40 and lower exp curve in Starsector", + "gameVersion": "0.97a-RC11" +}