Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
72e9a21c
Commit
72e9a21c
authored
Apr 29, 2022
by
Melledy
Browse files
Allow the player to finish dungeons
parent
8ab2b446
Changes
6
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/dungeons/DungeonChallenge.java
View file @
72e9a21c
...
...
@@ -12,6 +12,7 @@ import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType;
import
emu.grasscutter.scripts.constants.EventType
;
import
emu.grasscutter.scripts.data.SceneGroup
;
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.PacketDungeonChallengeFinishNotify
;
import
emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify
;
...
...
@@ -66,6 +67,10 @@ public class DungeonChallenge {
this
.
isSuccess
=
isSuccess
;
}
public
int
getScore
()
{
return
score
;
}
public
void
start
()
{
getScene
().
broadcastPacket
(
new
PacketDungeonChallengeBeginNotify
(
this
));
}
...
...
@@ -81,9 +86,11 @@ public class DungeonChallenge {
}
public
void
onMonsterDie
(
EntityMonster
entity
)
{
score
++;
score
=
getScore
()
+
1
;
getScene
().
broadcastPacket
(
new
PacketChallengeDataNotify
(
this
,
1
,
getScore
()));
if
(
s
core
>=
objective
)
{
if
(
getS
core
()
>=
objective
)
{
this
.
setSuccess
(
true
);
finish
();
}
...
...
src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java
View file @
72e9a21c
...
...
@@ -44,6 +44,8 @@ public class DungeonManager {
return
;
}
Grasscutter
.
getLogger
().
info
(
player
.
getNickname
()
+
" is trying to enter dungeon "
+
dungeonId
);
int
sceneId
=
data
.
getSceneId
();
player
.
getScene
().
setPrevScene
(
sceneId
);
...
...
src/main/java/emu/grasscutter/scripts/ScriptLib.java
View file @
72e9a21c
...
...
@@ -139,6 +139,10 @@ public class ScriptLib {
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
)
{
SceneGroup
group
=
getSceneScriptManager
().
getGroupById
(
groupId
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketChallengeDataNotify.java
0 → 100644
View file @
72e9a21c
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
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketDungeonChallengeBeginNotify.java
View file @
72e9a21c
...
...
@@ -13,6 +13,7 @@ public class PacketDungeonChallengeBeginNotify extends BasePacket {
DungeonChallengeBeginNotify
proto
=
DungeonChallengeBeginNotify
.
newBuilder
()
.
setChallengeId
(
challenge
.
getChallengeId
())
.
setChallengeIndex
(
challenge
.
getChallengeIndex
())
.
setGroupId
(
challenge
.
getGroup
().
id
)
.
build
();
this
.
setData
(
proto
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketDungeonChallengeFinishNotify.java
View file @
72e9a21c
...
...
@@ -11,8 +11,10 @@ public class PacketDungeonChallengeFinishNotify extends BasePacket {
super
(
PacketOpcodes
.
DungeonChallengeFinishNotify
);
DungeonChallengeFinishNotify
proto
=
DungeonChallengeFinishNotify
.
newBuilder
()
.
setChallengeIndex
(
challenge
.
getChallengeI
d
())
.
setChallengeIndex
(
challenge
.
getChallengeI
ndex
())
.
setIsSuccess
(
challenge
.
isSuccess
())
.
setUnk1
(
challenge
.
getChallengeId
())
.
setUnk2
(
30
)
.
build
();
this
.
setData
(
proto
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment