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
4b03770e
Commit
4b03770e
authored
Aug 10, 2022
by
AnimeGitB
Committed by
Luke H-W
Aug 21, 2022
Browse files
Hide resin from map when disabled
parent
a436ae9f
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/send/PacketOpenStateUpdateNotify.java
View file @
4b03770e
package
emu.grasscutter.server.packet.send
;
package
emu.grasscutter.server.packet.send
;
import
static
emu
.
grasscutter
.
config
.
Configuration
.
GAME_OPTIONS
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.excels.OpenStateData
;
import
emu.grasscutter.data.excels.OpenStateData
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.game.player.Player
;
...
@@ -19,16 +21,20 @@ public class PacketOpenStateUpdateNotify extends BasePacket {
...
@@ -19,16 +21,20 @@ public class PacketOpenStateUpdateNotify extends BasePacket {
OpenStateUpdateNotify
.
Builder
proto
=
OpenStateUpdateNotify
.
newBuilder
();
OpenStateUpdateNotify
.
Builder
proto
=
OpenStateUpdateNotify
.
newBuilder
();
for
(
OpenStateData
state
:
GameData
.
getOpenStateList
())
{
GameData
.
getOpenStateList
().
stream
().
map
(
OpenStateData:
:
getId
).
forEach
(
id
->
{
if
((
id
==
45
)
&&
!
GAME_OPTIONS
.
resinOptions
.
resinUsage
)
{
proto
.
putOpenStateMap
(
45
,
0
);
// Remove resin from map
return
;
}
// If the player has an open state stored in their map, then it would always override any default value
// If the player has an open state stored in their map, then it would always override any default value
if
(
player
.
getOpenStates
().
containsKey
(
state
.
getId
()
))
{
if
(
player
.
getOpenStates
().
containsKey
(
id
))
{
proto
.
putOpenStateMap
(
state
.
getId
()
,
player
.
getProgressManager
().
getOpenState
(
state
.
getId
()
));
proto
.
putOpenStateMap
(
id
,
player
.
getProgressManager
().
getOpenState
(
id
));
}
}
// Otherwise, add the state if it is contained in the set of default open states.
// Otherwise, add the state if it is contained in the set of default open states.
else
if
(
PlayerProgressManager
.
DEFAULT_OPEN_STATES
.
contains
(
state
.
getId
()))
{
else
if
(
PlayerProgressManager
.
DEFAULT_OPEN_STATES
.
contains
(
id
))
{
proto
.
putOpenStateMap
(
state
.
getId
(),
1
);
proto
.
putOpenStateMap
(
id
,
1
);
}
}
}
});
this
.
setData
(
proto
);
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