Skip to content

Commit

Permalink
feat: Mod done
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkborderman committed Aug 20, 2024
0 parents commit ea03693
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text eol=lf
* linguist-detectable
18 changes: 18 additions & 0 deletions .github/workflows/github-repo-info.yml
Original file line number Diff line number Diff line change
@@ -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 }}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Starsector-LowerLevelCurve

Set max player level to 40 and lower exp curve in Starsector
5 changes: 5 additions & 0 deletions data/config/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"playerMaxLevel":40,
"skillPointsPerLevel": 1,
"storyPointsPerLevel": 4
}
107 changes: 107 additions & 0 deletions data/scripts/plugins/LevelupPluginImpl.java
Original file line number Diff line number Diff line change
@@ -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)));
}
}
}
12 changes: 12 additions & 0 deletions metadata.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions mod_info.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit ea03693

Please sign in to comment.