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
f04035da
Commit
f04035da
authored
Jun 24, 2022
by
Luke H-W
Committed by
GitHub
Jun 24, 2022
Browse files
Merge branch 'development' into Weather
parents
b2e62055
1c9a9599
Changes
23
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/event/EventHandler.java
View file @
f04035da
package
emu.grasscutter.server.event
;
package
emu.grasscutter.server.event
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.plugin.Plugin
;
import
emu.grasscutter.utils.EventConsumer
;
import
emu.grasscutter.utils.EventConsumer
;
public
final
class
EventHandler
<
T
extends
Event
>
{
public
final
class
EventHandler
<
T
extends
Event
>
{
...
@@ -75,7 +76,7 @@ public final class EventHandler<T extends Event> {
...
@@ -75,7 +76,7 @@ public final class EventHandler<T extends Event> {
/**
/**
* Registers the handler into the PluginManager.
* Registers the handler into the PluginManager.
*/
*/
public
void
register
()
{
public
void
register
(
Plugin
plugin
)
{
Grasscutter
.
getPluginManager
().
registerListener
(
this
);
Grasscutter
.
getPluginManager
().
registerListener
(
plugin
,
this
);
}
}
}
}
\ No newline at end of file
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerTokenReq.java
View file @
f04035da
...
@@ -11,7 +11,6 @@ import emu.grasscutter.net.packet.PacketOpcodes;
...
@@ -11,7 +11,6 @@ import emu.grasscutter.net.packet.PacketOpcodes;
import
emu.grasscutter.net.proto.GetPlayerTokenReqOuterClass.GetPlayerTokenReq
;
import
emu.grasscutter.net.proto.GetPlayerTokenReqOuterClass.GetPlayerTokenReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.event.game.PlayerCreationEvent
;
import
emu.grasscutter.server.event.game.PlayerCreationEvent
;
import
emu.grasscutter.server.game.GameServer
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.game.GameSession.SessionState
;
import
emu.grasscutter.server.game.GameSession.SessionState
;
import
emu.grasscutter.server.packet.send.PacketGetPlayerTokenRsp
;
import
emu.grasscutter.server.packet.send.PacketGetPlayerTokenRsp
;
...
@@ -58,15 +57,15 @@ public class HandlerGetPlayerTokenReq extends PacketHandler {
...
@@ -58,15 +57,15 @@ public class HandlerGetPlayerTokenReq extends PacketHandler {
}
}
}
}
// Get player
// Call creation event.
Player
player
=
DatabaseHelper
.
getPlayerByAccount
(
account
);
PlayerCreationEvent
event
=
new
PlayerCreationEvent
(
session
,
Player
.
class
);
event
.
call
();
// Get player.
Player
player
=
DatabaseHelper
.
getPlayerByAccount
(
account
,
event
.
getPlayerClass
());
if
(
player
==
null
)
{
if
(
player
==
null
)
{
int
nextPlayerUid
=
DatabaseHelper
.
getNextPlayerId
(
session
.
getAccount
().
getReservedPlayerUid
());
int
nextPlayerUid
=
DatabaseHelper
.
getNextPlayerId
(
session
.
getAccount
().
getReservedPlayerUid
());
// Call creation event.
PlayerCreationEvent
event
=
new
PlayerCreationEvent
(
session
,
Player
.
class
);
event
.
call
();
// Create player instance from event.
// Create player instance from event.
player
=
event
.
getPlayerClass
().
getDeclaredConstructor
(
GameSession
.
class
).
newInstance
(
session
);
player
=
event
.
getPlayerClass
().
getDeclaredConstructor
(
GameSession
.
class
).
newInstance
(
session
);
...
...
src/main/resources/defaults/data/ChestReward.json
View file @
f04035da
...
@@ -131,5 +131,293 @@
...
@@ -131,5 +131,293 @@
"count"
:
1
"count"
:
1
}
}
]
]
},
{
"objNames"
:
[
"SceneObj_Chest_Default_Lv3"
,
"SceneObj_Chest_Locked_Lv3"
,
"SceneObj_Chest_Bramble_Lv3"
,
"SceneObj_Chest_Frozen_Lv3"
],
"advExp"
:
200
,
"resin"
:
20
,
"mora"
:
8888
,
"sigil"
:
20
,
"content"
:
[
{
"itemId"
:
104012
,
"count"
:
3
},
{
"itemId"
:
223
,
"count"
:
10
},
{
"itemId"
:
104002
,
"count"
:
1
}
],
"randomCount"
:
4
,
"randomContent"
:
[
{
"itemId"
:
11509
,
"count"
:
1
},
{
"itemId"
:
13501
,
"count"
:
1
},
{
"itemId"
:
12201
,
"count"
:
1
},
{
"itemId"
:
12301
,
"count"
:
1
},
{
"itemId"
:
13201
,
"count"
:
1
},
{
"itemId"
:
13301
,
"count"
:
1
},
{
"itemId"
:
14201
,
"count"
:
1
},
{
"itemId"
:
14301
,
"count"
:
1
},
{
"itemId"
:
15201
,
"count"
:
1
},
{
"itemId"
:
15301
,
"count"
:
1
}
]
},
{
"objNames"
:
[
"SceneObj_Chest_Default_Lv4"
,
"SceneObj_Chest_Locked_Lv4"
,
"SceneObj_Chest_Bramble_Lv4"
,
"SceneObj_Chest_Frozen_Lv4"
],
"advExp"
:
20000
,
"resin"
:
2
,
"mora"
:
88888
,
"sigil"
:
2
,
"content"
:
[
{
"itemId"
:
104012
,
"count"
:
3
},
{
"itemId"
:
223
,
"count"
:
50
},
{
"itemId"
:
104002
,
"count"
:
1
}
],
"randomCount"
:
4
,
"randomContent"
:
[
{
"itemId"
:
13501
,
"count"
:
1
},
{
"itemId"
:
11301
,
"count"
:
1
},
{
"itemId"
:
12201
,
"count"
:
1
},
{
"itemId"
:
12301
,
"count"
:
1
},
{
"itemId"
:
13201
,
"count"
:
1
},
{
"itemId"
:
13301
,
"count"
:
1
},
{
"itemId"
:
14201
,
"count"
:
1
},
{
"itemId"
:
14301
,
"count"
:
1
},
{
"itemId"
:
15201
,
"count"
:
1
},
{
"itemId"
:
15301
,
"count"
:
1
}
]
},
{
"objNames"
:
[
"SceneObj_Chest_Default_Lv5"
,
"SceneObj_Chest_Locked_Lv5"
,
"SceneObj_Chest_Bramble_Lv5"
,
"SceneObj_Chest_Frozen_Lv5"
],
"advExp"
:
20000
,
"resin"
:
2
,
"mora"
:
88888
,
"sigil"
:
2
,
"content"
:
[
{
"itemId"
:
104012
,
"count"
:
3
},
{
"itemId"
:
223
,
"count"
:
100
},
{
"itemId"
:
104002
,
"count"
:
1
}
],
"randomCount"
:
5
,
"randomContent"
:
[
{
"itemId"
:
13501
,
"count"
:
1
},
{
"itemId"
:
11301
,
"count"
:
1
},
{
"itemId"
:
13509
,
"count"
:
1
},
{
"itemId"
:
12301
,
"count"
:
1
},
{
"itemId"
:
14509
,
"count"
:
1
},
{
"itemId"
:
15507
,
"count"
:
1
},
{
"itemId"
:
15509
,
"count"
:
1
},
{
"itemId"
:
11509
,
"count"
:
1
},
{
"itemId"
:
11503
,
"count"
:
1
},
{
"itemId"
:
15301
,
"count"
:
1
}
]
},
{
"objNames"
:
[
"SceneObj_Area_Common_Property_Ani_Prop_MoonlitBox_01"
],
"advExp"
:
20000
,
"resin"
:
2
,
"mora"
:
88888
,
"sigil"
:
2
,
"content"
:
[
{
"itemId"
:
104012
,
"count"
:
3
},
{
"itemId"
:
223
,
"count"
:
100
},
{
"itemId"
:
104002
,
"count"
:
1
}
],
"randomCount"
:
5
,
"randomContent"
:
[
{
"itemId"
:
13501
,
"count"
:
1
},
{
"itemId"
:
11301
,
"count"
:
1
},
{
"itemId"
:
13509
,
"count"
:
1
},
{
"itemId"
:
12301
,
"count"
:
1
},
{
"itemId"
:
14509
,
"count"
:
1
},
{
"itemId"
:
15507
,
"count"
:
1
},
{
"itemId"
:
15509
,
"count"
:
1
},
{
"itemId"
:
11509
,
"count"
:
1
},
{
"itemId"
:
11503
,
"count"
:
1
},
{
"itemId"
:
15301
,
"count"
:
1
}
]
},
{
"objNames"
:
[
"SceneObj_Area_Dq_Property_Ani_Prop_JunkChest_01"
,
"SceneObj_Area_Common_Property_Ani_Prop_JunkChest_02"
,
"SearchPoint"
,
"SearchPoint_OnWater"
],
"mora"
:
1
,
"content"
:
[
{
"itemId"
:
201
,
"count"
:
114
}
]
}
}
]
]
Prev
1
2
Next
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