mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-07-26 00:23:48 +00:00
Compare commits
11 Commits
v1.7.4
...
bc1fa400d1
Author | SHA1 | Date | |
---|---|---|---|
bc1fa400d1 | |||
04401e4317 | |||
9328ce09e5 | |||
c37c4e2a81 | |||
2794331032 | |||
d3dc04dcc8 | |||
4d9f3921ea | |||
6e1913aacb | |||
9e17e4aacb | |||
770a793c69 | |||
c4402cc287 |
51
.github/workflows/build-container.yml
vendored
Normal file
51
.github/workflows/build-container.yml
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
---
|
||||
name: Build Docker Container
|
||||
on:
|
||||
push:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Generate Docker Meta
|
||||
uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: ghcr.io/kashalls/grasscutter
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3.1.0
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3.0.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and Push Docker image
|
||||
uses: docker/build-push-action@v5.2.0
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -64,6 +64,7 @@ tmp/
|
||||
|
||||
/*.jar
|
||||
/*.sh
|
||||
!entrypoint.sh
|
||||
|
||||
GM Handbook*.txt
|
||||
handbook.html
|
||||
|
38
Dockerfile
Normal file
38
Dockerfile
Normal file
@ -0,0 +1,38 @@
|
||||
# Builder
|
||||
FROM gradle:jdk17-alpine as builder
|
||||
|
||||
RUN apk add --update nodejs npm
|
||||
|
||||
WORKDIR /app
|
||||
COPY ./ /app/
|
||||
|
||||
RUN gradle jar --no-daemon
|
||||
|
||||
# Fetch Data
|
||||
FROM bitnami/git:2.43.0-debian-11-r1 as data
|
||||
|
||||
ARG DATA_REPOSITORY=https://gitlab.com/YuukiPS/GC-Resources.git
|
||||
ARG DATA_BRANCH=4.0
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN git clone --branch ${DATA_BRANCH} --depth 1 ${DATA_REPOSITORY}
|
||||
|
||||
# Result Container
|
||||
FROM amazoncorretto:17-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy built assets
|
||||
COPY --from=builder /app/grasscutter-1.7.4.jar /app/grasscutter.jar
|
||||
COPY --from=builder /app/keystore.p12 /app/keystore.p12
|
||||
|
||||
# Copy the resources
|
||||
COPY --from=data /app/GC-Resources/Resources /app/resources/
|
||||
|
||||
# Copy startup files
|
||||
COPY ./entrypoint.sh /app/
|
||||
|
||||
CMD [ "sh", "/app/entrypoint.sh" ]
|
||||
|
||||
EXPOSE 80 443 8888 22102
|
@ -26,7 +26,7 @@
|
||||
|
||||
- Get Java 17: https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html
|
||||
- Get [MongoDB Community Server](https://www.mongodb.com/try/download/community)
|
||||
- Get game version REL4.0.x (4.0.x client can be found here if you don't have it): https://github.com/MAnggiarMustofa/GI-Download-Library/blob/main/GenshinImpact/Client/4.0.0.md
|
||||
- Get game version REL4.0.x (4.0.x client can be found here if you don't have it): https://github.com/JRSKelvin/GenshinRepository/blob/main/Version%204.0.0.md
|
||||
|
||||
- Download the [latest Cultivation version](https://github.com/Grasscutters/Cultivation/releases/latest). Use the `.msi` installer.
|
||||
- After opening Cultivation (as admin), press the download button in the upper right corner.
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
- Click the small button next to launch.
|
||||
- Click the launch button.
|
||||
- Log in with whatever username you want. Password doesn't matter.
|
||||
- Log in with whatever username you want. Password can be anything.
|
||||
|
||||
### Building
|
||||
|
||||
|
3
entrypoint.sh
Normal file
3
entrypoint.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#/bin/sh
|
||||
|
||||
java -jar /app/grasscutter.jar
|
@ -29,7 +29,7 @@ public class WorldChallenge {
|
||||
private final AtomicInteger score;
|
||||
private boolean progress;
|
||||
private boolean success;
|
||||
private long startedAt;
|
||||
private int startedAt;
|
||||
private int finishedTime;
|
||||
|
||||
/**
|
||||
|
@ -36,6 +36,6 @@ public class KillMonsterCountInTimeIncChallengeFactoryHandler implements Challen
|
||||
List.of(
|
||||
new KillMonsterCountTrigger(),
|
||||
new InTimeTrigger(),
|
||||
new KillMonsterTimeIncTrigger(timeInc)));
|
||||
new KillMonsterTimeIncTrigger(timeLimit, timeInc)));
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
package emu.grasscutter.game.dungeons.challenge.factory;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.game.dungeons.challenge.WorldChallenge;
|
||||
import emu.grasscutter.game.dungeons.challenge.enums.ChallengeType;
|
||||
import emu.grasscutter.game.dungeons.challenge.trigger.*;
|
||||
import emu.grasscutter.game.world.Scene;
|
||||
import emu.grasscutter.scripts.data.SceneGroup;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import lombok.val;
|
||||
|
||||
public class KillMonsterTimeChallengeFactoryHandler implements ChallengeFactoryHandler {
|
||||
@ -28,6 +29,16 @@ public class KillMonsterTimeChallengeFactoryHandler implements ChallengeFactoryH
|
||||
Scene scene,
|
||||
SceneGroup group) {
|
||||
val realGroup = scene.getScriptManager().getGroupById(groupId);
|
||||
val challengeTriggers = new ArrayList<ChallengeTrigger>();
|
||||
challengeTriggers.addAll(List.of(new KillMonsterCountTrigger(), new InTimeTrigger()));
|
||||
|
||||
val challengeData = GameData.getDungeonChallengeConfigDataMap().get(challengeId);
|
||||
val challengeType = challengeData.getChallengeType();
|
||||
if (challengeType == ChallengeType.CHALLENGE_KILL_COUNT_FAST) {
|
||||
challengeTriggers.add(
|
||||
new KillMonsterTimeIncTrigger(timeLimit, 0 /* refresh to original limit on kill */));
|
||||
}
|
||||
|
||||
return new WorldChallenge(
|
||||
scene,
|
||||
realGroup,
|
||||
@ -36,6 +47,6 @@ public class KillMonsterTimeChallengeFactoryHandler implements ChallengeFactoryH
|
||||
List.of(targetCount, timeLimit),
|
||||
timeLimit, // Limit
|
||||
targetCount, // Goal
|
||||
List.of(new KillMonsterCountTrigger(), new InTimeTrigger()));
|
||||
challengeTriggers);
|
||||
}
|
||||
}
|
||||
|
@ -6,22 +6,33 @@ import emu.grasscutter.server.packet.send.PacketChallengeDataNotify;
|
||||
|
||||
public class KillMonsterTimeIncTrigger extends ChallengeTrigger {
|
||||
|
||||
private int increment;
|
||||
private final int maxTime;
|
||||
private final int increment;
|
||||
|
||||
public KillMonsterTimeIncTrigger(int increment) {
|
||||
public KillMonsterTimeIncTrigger(int maxTime, int increment) {
|
||||
this.maxTime = maxTime;
|
||||
this.increment = increment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBegin(WorldChallenge challenge) {
|
||||
// challenge.getScene().broadcastPacket(new PacketChallengeDataNotify(challenge, 0,
|
||||
// challenge.getScore().get()));
|
||||
}
|
||||
public void onBegin(WorldChallenge challenge) {}
|
||||
|
||||
@Override
|
||||
public void onMonsterDeath(WorldChallenge challenge, EntityMonster monster) {
|
||||
challenge.getScene().broadcastPacket(new PacketChallengeDataNotify(challenge, 0, increment));
|
||||
|
||||
var scene = challenge.getScene();
|
||||
var elapsed = scene.getSceneTimeSeconds() - challenge.getStartedAt();
|
||||
var timeLeft = challenge.getTimeLimit() - elapsed;
|
||||
var increment = this.increment;
|
||||
if (increment == 0) {
|
||||
// Refresh time limit back to max
|
||||
increment = maxTime - timeLeft;
|
||||
} else if (maxTime < timeLeft + increment) {
|
||||
// Don't add back more time than original limit
|
||||
increment -= timeLeft + increment - maxTime;
|
||||
}
|
||||
challenge.setTimeLimit(challenge.getTimeLimit() + increment);
|
||||
scene.broadcastPacket(
|
||||
new PacketChallengeDataNotify(
|
||||
challenge, 2, timeLeft + increment + scene.getSceneTimeSeconds()));
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +222,9 @@ public class EntityMonster extends GameEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
public void onTick(int sceneTime) {
|
||||
super.onTick(sceneTime);
|
||||
|
||||
// Lua event
|
||||
getScene()
|
||||
.getScriptManager()
|
||||
|
@ -218,6 +218,8 @@ public final class HttpServer {
|
||||
|
||||
<body>
|
||||
<img src="https://http.cat/404" />
|
||||
<h1>Grasscutter cannot find the route you're trying to access.</h1>
|
||||
<p>Your proxy is active, so if you're trying to download something close the game/stop the proxy.</p>
|
||||
</body>
|
||||
</html>
|
||||
""");
|
||||
|
Reference in New Issue
Block a user