mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-26 16:40:55 +00:00
Allow the player to finish dungeons
This commit is contained in:
parent
8ab2b446cd
commit
72e9a21ce3
@ -12,6 +12,7 @@ import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType;
|
|||||||
import emu.grasscutter.scripts.constants.EventType;
|
import emu.grasscutter.scripts.constants.EventType;
|
||||||
import emu.grasscutter.scripts.data.SceneGroup;
|
import emu.grasscutter.scripts.data.SceneGroup;
|
||||||
import emu.grasscutter.scripts.data.SceneMonster;
|
import emu.grasscutter.scripts.data.SceneMonster;
|
||||||
|
import emu.grasscutter.server.packet.send.PacketChallengeDataNotify;
|
||||||
import emu.grasscutter.server.packet.send.PacketDungeonChallengeBeginNotify;
|
import emu.grasscutter.server.packet.send.PacketDungeonChallengeBeginNotify;
|
||||||
import emu.grasscutter.server.packet.send.PacketDungeonChallengeFinishNotify;
|
import emu.grasscutter.server.packet.send.PacketDungeonChallengeFinishNotify;
|
||||||
import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify;
|
import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify;
|
||||||
@ -66,6 +67,10 @@ public class DungeonChallenge {
|
|||||||
this.isSuccess = isSuccess;
|
this.isSuccess = isSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getScore() {
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
getScene().broadcastPacket(new PacketDungeonChallengeBeginNotify(this));
|
getScene().broadcastPacket(new PacketDungeonChallengeBeginNotify(this));
|
||||||
}
|
}
|
||||||
@ -81,9 +86,11 @@ public class DungeonChallenge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onMonsterDie(EntityMonster entity) {
|
public void onMonsterDie(EntityMonster entity) {
|
||||||
score++;
|
score = getScore() + 1;
|
||||||
|
|
||||||
if (score >= objective) {
|
getScene().broadcastPacket(new PacketChallengeDataNotify(this, 1, getScore()));
|
||||||
|
|
||||||
|
if (getScore() >= objective) {
|
||||||
this.setSuccess(true);
|
this.setSuccess(true);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,8 @@ public class DungeonManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grasscutter.getLogger().info(player.getNickname() + " is trying to enter dungeon " + dungeonId);
|
||||||
|
|
||||||
int sceneId = data.getSceneId();
|
int sceneId = data.getSceneId();
|
||||||
player.getScene().setPrevScene(sceneId);
|
player.getScene().setPrevScene(sceneId);
|
||||||
|
|
||||||
|
@ -139,6 +139,10 @@ public class ScriptLib {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int AddExtraGroupSuite(int groupId, int param2) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
public int ActiveChallenge(int challengeId, int challengeIndex, int param3, int groupId, int param4, int param5) {
|
public int ActiveChallenge(int challengeId, int challengeIndex, int param3, int groupId, int param4, int param5) {
|
||||||
SceneGroup group = getSceneScriptManager().getGroupById(groupId);
|
SceneGroup group = getSceneScriptManager().getGroupById(groupId);
|
||||||
|
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
package emu.grasscutter.server.packet.send;
|
||||||
|
|
||||||
|
import emu.grasscutter.game.dungeons.DungeonChallenge;
|
||||||
|
import emu.grasscutter.net.packet.BasePacket;
|
||||||
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||||
|
import emu.grasscutter.net.proto.ChallengeDataNotifyOuterClass.ChallengeDataNotify;
|
||||||
|
|
||||||
|
public class PacketChallengeDataNotify extends BasePacket {
|
||||||
|
|
||||||
|
public PacketChallengeDataNotify(DungeonChallenge challenge, int index, int value) {
|
||||||
|
super(PacketOpcodes.ChallengeDataNotify);
|
||||||
|
|
||||||
|
ChallengeDataNotify proto = ChallengeDataNotify.newBuilder()
|
||||||
|
.setChallengeIndex(challenge.getChallengeIndex())
|
||||||
|
.setParamIndex(index)
|
||||||
|
.setValue(value)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.setData(proto);
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,7 @@ public class PacketDungeonChallengeBeginNotify extends BasePacket {
|
|||||||
DungeonChallengeBeginNotify proto = DungeonChallengeBeginNotify.newBuilder()
|
DungeonChallengeBeginNotify proto = DungeonChallengeBeginNotify.newBuilder()
|
||||||
.setChallengeId(challenge.getChallengeId())
|
.setChallengeId(challenge.getChallengeId())
|
||||||
.setChallengeIndex(challenge.getChallengeIndex())
|
.setChallengeIndex(challenge.getChallengeIndex())
|
||||||
|
.setGroupId(challenge.getGroup().id)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
this.setData(proto);
|
this.setData(proto);
|
||||||
|
@ -11,8 +11,10 @@ public class PacketDungeonChallengeFinishNotify extends BasePacket {
|
|||||||
super(PacketOpcodes.DungeonChallengeFinishNotify);
|
super(PacketOpcodes.DungeonChallengeFinishNotify);
|
||||||
|
|
||||||
DungeonChallengeFinishNotify proto = DungeonChallengeFinishNotify.newBuilder()
|
DungeonChallengeFinishNotify proto = DungeonChallengeFinishNotify.newBuilder()
|
||||||
.setChallengeIndex(challenge.getChallengeId())
|
.setChallengeIndex(challenge.getChallengeIndex())
|
||||||
.setIsSuccess(challenge.isSuccess())
|
.setIsSuccess(challenge.isSuccess())
|
||||||
|
.setUnk1(challenge.getChallengeId())
|
||||||
|
.setUnk2(30)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
this.setData(proto);
|
this.setData(proto);
|
||||||
|
Loading…
Reference in New Issue
Block a user