Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Grasscutter
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
ziqian zhang
Grasscutter
Commits
b266854c
Commit
b266854c
authored
2 years ago
by
GanyusLeftHorn
Committed by
Melledy
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Handle existing players who might already have passed a level.
parent
af7bbdaa
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/emu/grasscutter/game/player/Player.java
+5
-1
5 additions, 1 deletion
src/main/java/emu/grasscutter/game/player/Player.java
src/main/java/emu/grasscutter/game/player/PlayerOpenStateManager.java
+3
-5
3 additions, 5 deletions
...a/emu/grasscutter/game/player/PlayerOpenStateManager.java
with
8 additions
and
6 deletions
src/main/java/emu/grasscutter/game/player/Player.java
+
5
−
1
View file @
b266854c
...
...
@@ -463,7 +463,7 @@ public class Player {
this
.
updateProfile
();
// Handle OpenState unlocks from level-up.
this
.
getOpenStateManager
().
onPlayerLevelUp
();
this
.
getOpenStateManager
().
unlockLevelDependentStates
();
return
true
;
}
...
...
@@ -1535,7 +1535,11 @@ public class Player {
this
.
forgingManager
.
sendForgeDataNotify
();
this
.
resinManager
.
onPlayerLogin
();
this
.
cookingManager
.
sendCookDataNofity
();
// Unlock in case this is an existing user that reached a level before we implemented unlocking.
this
.
openStateManager
.
unlockLevelDependentStates
();
this
.
openStateManager
.
onPlayerLogin
();
getTodayMoonCard
();
// The timer works at 0:0, some users log in after that, use this method to check if they have received a reward today or not. If not, send the reward.
// Battle Pass trigger
...
...
This diff is collapsed.
Click to expand it.
src/main/java/emu/grasscutter/game/player/PlayerOpenStateManager.java
+
3
−
5
View file @
b266854c
...
...
@@ -55,11 +55,9 @@ public class PlayerOpenStateManager {
public
void
setOpenState
(
OpenState
openState
,
Integer
value
)
{
Integer
previousValue
=
this
.
map
.
getOrDefault
(
openState
.
getValue
(),
0
);
if
(
!(
value
=
=
previousValue
)
)
{
if
(
value
!
=
previousValue
)
{
this
.
map
.
put
(
openState
.
getValue
(),
value
);
player
.
getSession
().
send
(
new
PacketOpenStateChangeNotify
(
openState
.
getValue
(),
value
));
}
else
{
Grasscutter
.
getLogger
().
debug
(
"Warning: OpenState {} is already set to {}!"
,
openState
,
value
);
}
}
...
...
@@ -73,9 +71,9 @@ public class PlayerOpenStateManager {
player
.
getSession
().
send
(
new
PacketOpenStateUpdateNotify
(
this
));
}
public
void
onPlayerLevelUp
()
{
public
void
unlockLevelDependentStates
()
{
Stream
.
of
(
OpenState
.
values
())
.
filter
(
s
->
s
.
getUnlockLevel
()
=
=
this
.
player
.
getLevel
())
.
filter
(
s
->
s
.
getUnlockLevel
()
>
1
&&
s
.
getUnlockLevel
()
<
=
this
.
player
.
getLevel
())
.
forEach
(
s
->
this
.
setOpenState
(
s
,
1
));
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment