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
6554c37d
Commit
6554c37d
authored
Apr 23, 2022
by
WangYneos
Committed by
GitHub
Apr 23, 2022
Browse files
Merge branch 'development' into stable
parents
39e590df
df1dca8d
Changes
39
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/friends/PlayerProfile.java
View file @
6554c37d
...
@@ -4,6 +4,7 @@ import dev.morphia.annotations.*;
...
@@ -4,6 +4,7 @@ import dev.morphia.annotations.*;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.utils.Utils
;
import
emu.grasscutter.utils.Utils
;
@Entity
public
class
PlayerProfile
{
public
class
PlayerProfile
{
@Transient
private
GenshinPlayer
player
;
@Transient
private
GenshinPlayer
player
;
...
...
src/main/java/emu/grasscutter/game/gacha/PlayerGachaBannerInfo.java
View file @
6554c37d
package
emu.grasscutter.game.gacha
;
package
emu.grasscutter.game.gacha
;
import
dev.morphia.annotations.Entity
;
@Entity
public
class
PlayerGachaBannerInfo
{
public
class
PlayerGachaBannerInfo
{
private
int
pity5
=
0
;
private
int
pity5
=
0
;
private
int
pity4
=
0
;
private
int
pity4
=
0
;
...
...
src/main/java/emu/grasscutter/game/gacha/PlayerGachaInfo.java
View file @
6554c37d
package
emu.grasscutter.game.gacha
;
package
emu.grasscutter.game.gacha
;
import
dev.morphia.annotations.Entity
;
@Entity
public
class
PlayerGachaInfo
{
public
class
PlayerGachaInfo
{
private
PlayerGachaBannerInfo
standardBanner
;
private
PlayerGachaBannerInfo
standardBanner
;
private
PlayerGachaBannerInfo
eventCharacterBanner
;
private
PlayerGachaBannerInfo
eventCharacterBanner
;
...
...
src/main/java/emu/grasscutter/game/inventory/GenshinItem.java
View file @
6554c37d
...
@@ -34,7 +34,7 @@ import emu.grasscutter.net.proto.SceneWeaponInfoOuterClass.SceneWeaponInfo;
...
@@ -34,7 +34,7 @@ import emu.grasscutter.net.proto.SceneWeaponInfoOuterClass.SceneWeaponInfo;
import
emu.grasscutter.net.proto.WeaponOuterClass.Weapon
;
import
emu.grasscutter.net.proto.WeaponOuterClass.Weapon
;
import
emu.grasscutter.utils.WeightedList
;
import
emu.grasscutter.utils.WeightedList
;
@Entity
(
value
=
"items"
,
noClassnameS
tor
ed
=
tru
e
)
@Entity
(
value
=
"items"
,
useDiscrimina
tor
=
fals
e
)
public
class
GenshinItem
{
public
class
GenshinItem
{
@Id
private
ObjectId
id
;
@Id
private
ObjectId
id
;
@Indexed
private
int
ownerId
;
@Indexed
private
int
ownerId
;
...
...
src/main/java/emu/grasscutter/game/player/PlayerBirthday.java
0 → 100644
View file @
6554c37d
package
emu.grasscutter.game.player
;
import
dev.morphia.annotations.Entity
;
import
emu.grasscutter.net.proto.BirthdayOuterClass.Birthday
;
@Entity
public
class
PlayerBirthday
{
private
int
day
;
private
int
month
;
public
PlayerBirthday
(){
this
.
day
=
0
;
this
.
month
=
0
;
}
public
PlayerBirthday
(
int
day
,
int
month
){
this
.
day
=
day
;
this
.
month
=
month
;
}
public
PlayerBirthday
set
(
PlayerBirthday
birth
){
this
.
day
=
birth
.
day
;
this
.
month
=
birth
.
month
;
return
this
;
}
public
PlayerBirthday
set
(
int
d
,
int
m
){
this
.
day
=
d
;
this
.
month
=
m
;
return
this
;
}
public
PlayerBirthday
setDay
(
int
value
){
this
.
day
=
value
;
return
this
;
}
public
PlayerBirthday
setMonth
(
int
value
){
this
.
month
=
value
;
return
this
;
}
public
int
getDay
(){
return
this
.
day
;
}
public
int
getMonth
(){
return
this
.
month
;
}
public
Birthday
toProto
(){
return
Birthday
.
newBuilder
()
.
setDay
(
this
.
getDay
())
.
setMonth
(
this
.
getMonth
())
.
build
();
}
public
Birthday
.
Builder
getFilledProtoWhenNotEmpty
(){
if
(
this
.
getDay
()
>
0
)
{
return
Birthday
.
newBuilder
()
.
setDay
(
this
.
getDay
())
.
setMonth
(
this
.
getMonth
());
}
return
Birthday
.
newBuilder
();
}
}
\ No newline at end of file
src/main/java/emu/grasscutter/net/packet/PacketOpcodes.java
View file @
6554c37d
...
@@ -1034,6 +1034,8 @@ public class PacketOpcodes {
...
@@ -1034,6 +1034,8 @@ public class PacketOpcodes {
public
static
final
int
ShowTemplateReminderNotify
=
3164
;
public
static
final
int
ShowTemplateReminderNotify
=
3164
;
public
static
final
int
SignInInfoReq
=
2510
;
public
static
final
int
SignInInfoReq
=
2510
;
public
static
final
int
SignInInfoRsp
=
2515
;
public
static
final
int
SignInInfoRsp
=
2515
;
public
static
final
int
SitReq
=
354
;
public
static
final
int
SitRsp
=
335
;
public
static
final
int
SocialDataNotify
=
4063
;
public
static
final
int
SocialDataNotify
=
4063
;
public
static
final
int
SpringUseReq
=
1720
;
public
static
final
int
SpringUseReq
=
1720
;
public
static
final
int
SpringUseRsp
=
1727
;
public
static
final
int
SpringUseRsp
=
1727
;
...
@@ -1208,5 +1210,4 @@ public class PacketOpcodes {
...
@@ -1208,5 +1210,4 @@ public class PacketOpcodes {
public
static
final
int
WorldRoutineChangeNotify
=
3548
;
public
static
final
int
WorldRoutineChangeNotify
=
3548
;
public
static
final
int
WorldRoutineTypeCloseNotify
=
3513
;
public
static
final
int
WorldRoutineTypeCloseNotify
=
3513
;
public
static
final
int
WorldRoutineTypeRefreshNotify
=
3545
;
public
static
final
int
WorldRoutineTypeRefreshNotify
=
3545
;
}
}
\ No newline at end of file
src/main/java/emu/grasscutter/netty/MihoyoKcpServer.java
View file @
6554c37d
...
@@ -64,9 +64,8 @@ public class MihoyoKcpServer extends Thread {
...
@@ -64,9 +64,8 @@ public class MihoyoKcpServer extends Thread {
// Wait until the server socket is closed.
// Wait until the server socket is closed.
f
.
channel
().
closeFuture
().
sync
();
f
.
channel
().
closeFuture
().
sync
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
exception
)
{
// TODO Auto-generated catch block
Grasscutter
.
getLogger
().
error
(
"Unable to start game server."
,
exception
);
e
.
printStackTrace
();
}
finally
{
}
finally
{
// Close
// Close
finish
();
finish
();
...
...
src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
View file @
6554c37d
...
@@ -24,6 +24,7 @@ import emu.grasscutter.utils.Utils;
...
@@ -24,6 +24,7 @@ import emu.grasscutter.utils.Utils;
import
javax.net.ssl.KeyManagerFactory
;
import
javax.net.ssl.KeyManagerFactory
;
import
javax.net.ssl.SSLContext
;
import
javax.net.ssl.SSLContext
;
import
java.io.*
;
import
java.io.*
;
import
java.net.BindException
;
import
java.net.InetSocketAddress
;
import
java.net.InetSocketAddress
;
import
java.net.URI
;
import
java.net.URI
;
import
java.net.URLDecoder
;
import
java.net.URLDecoder
;
...
@@ -101,14 +102,14 @@ public final class DispatchServer {
...
@@ -101,14 +102,14 @@ public final class DispatchServer {
.
setName
(
"os_usa"
)
.
setName
(
"os_usa"
)
.
setTitle
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
Name
)
.
setTitle
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
Name
)
.
setType
(
"DEV_PUBLIC"
)
.
setType
(
"DEV_PUBLIC"
)
.
setDispatchUrl
(
"http
s
://"
+
(
Grasscutter
.
getConfig
().
getDispatchOptions
().
PublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
getDispatchOptions
().
Ip
:
Grasscutter
.
getConfig
().
getDispatchOptions
().
PublicIp
)
+
":"
+
getAddress
().
getPort
(
)
+
"/query_cur_region_"
+
defaultServerName
)
.
setDispatchUrl
(
"http
"
+
(
Grasscutter
.
getConfig
().
getDispatchOptions
().
FrontHTTPS
?
"s"
:
""
)
+
"
://"
+
(
Grasscutter
.
getConfig
().
getDispatchOptions
().
PublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
getDispatchOptions
().
Ip
:
Grasscutter
.
getConfig
().
getDispatchOptions
().
PublicIp
)
+
":"
+
(
Grasscutter
.
getConfig
().
getDispatchOptions
().
PublicPort
!=
0
?
Grasscutter
.
getConfig
().
getDispatchOptions
().
PublicPort
:
Grasscutter
.
getConfig
().
getDispatchOptions
().
Port
)
+
"/query_cur_region_"
+
defaultServerName
)
.
build
();
.
build
();
usedNames
.
add
(
defaultServerName
);
usedNames
.
add
(
defaultServerName
);
servers
.
add
(
server
);
servers
.
add
(
server
);
RegionInfo
serverRegion
=
regionQuery
.
getRegionInfo
().
toBuilder
()
RegionInfo
serverRegion
=
regionQuery
.
getRegionInfo
().
toBuilder
()
.
setIp
((
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
getGameServerOptions
().
Ip
:
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
))
.
setIp
((
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
getGameServerOptions
().
Ip
:
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
))
.
setPort
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
Port
)
.
setPort
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicPort
!=
0
?
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicPort
:
Grasscutter
.
getConfig
().
getGameServerOptions
().
Port
)
.
setSecretKey
(
ByteString
.
copyFrom
(
FileUtils
.
read
(
Grasscutter
.
getConfig
().
KEY_FOLDER
+
"dispatchSeed.bin"
)))
.
setSecretKey
(
ByteString
.
copyFrom
(
FileUtils
.
read
(
Grasscutter
.
getConfig
().
KEY_FOLDER
+
"dispatchSeed.bin"
)))
.
build
();
.
build
();
...
@@ -131,7 +132,7 @@ public final class DispatchServer {
...
@@ -131,7 +132,7 @@ public final class DispatchServer {
.
setName
(
regionInfo
.
Name
)
.
setName
(
regionInfo
.
Name
)
.
setTitle
(
regionInfo
.
Title
)
.
setTitle
(
regionInfo
.
Title
)
.
setType
(
"DEV_PUBLIC"
)
.
setType
(
"DEV_PUBLIC"
)
.
setDispatchUrl
(
"http
s
://"
+
(
Grasscutter
.
getConfig
().
getDispatchOptions
().
PublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
getDispatchOptions
().
Ip
:
Grasscutter
.
getConfig
().
getDispatchOptions
().
PublicIp
)
+
":"
+
getAddress
().
getPort
()
+
"/query_cur_region_"
+
regionInfo
.
Name
)
.
setDispatchUrl
(
"http
"
+
(
Grasscutter
.
getConfig
().
getDispatchOptions
().
FrontHTTPS
?
"s"
:
""
)
+
"
://"
+
(
Grasscutter
.
getConfig
().
getDispatchOptions
().
PublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
getDispatchOptions
().
Ip
:
Grasscutter
.
getConfig
().
getDispatchOptions
().
PublicIp
)
+
":"
+
getAddress
().
getPort
()
+
"/query_cur_region_"
+
regionInfo
.
Name
)
.
build
();
.
build
();
usedNames
.
add
(
regionInfo
.
Name
);
usedNames
.
add
(
regionInfo
.
Name
);
servers
.
add
(
server
);
servers
.
add
(
server
);
...
@@ -158,12 +159,21 @@ public final class DispatchServer {
...
@@ -158,12 +159,21 @@ public final class DispatchServer {
Grasscutter
.
getLogger
().
error
(
"[Dispatch] Error while initializing region info!"
,
e
);
Grasscutter
.
getLogger
().
error
(
"[Dispatch] Error while initializing region info!"
,
e
);
}
}
}
}
private
HttpServer
safelyCreateServer
(
InetSocketAddress
address
)
{
try
{
return
HttpServer
.
create
(
address
,
0
);
}
catch
(
BindException
ignored
)
{
Grasscutter
.
getLogger
().
error
(
"Unable to bind to port: "
+
getAddress
().
getPort
()
+
" (HTTP)"
);
}
catch
(
Exception
exception
)
{
Grasscutter
.
getLogger
().
error
(
"Unable to start HTTP server."
,
exception
);
}
return
null
;
}
public
void
start
()
throws
Exception
{
public
void
start
()
throws
Exception
{
HttpServer
server
;
HttpServer
server
;
if
(
Grasscutter
.
getConfig
().
getDispatchOptions
().
UseSSL
)
{
if
(
Grasscutter
.
getConfig
().
getDispatchOptions
().
UseSSL
)
{
HttpsServer
httpsServer
;
HttpsServer
httpsServer
=
HttpsServer
.
create
(
getAddress
(),
0
);
httpsServer
=
HttpsServer
.
create
(
getAddress
(),
0
);
SSLContext
sslContext
=
SSLContext
.
getInstance
(
"TLS"
);
SSLContext
sslContext
=
SSLContext
.
getInstance
(
"TLS"
);
try
(
FileInputStream
fis
=
new
FileInputStream
(
Grasscutter
.
getConfig
().
getDispatchOptions
().
KeystorePath
))
{
try
(
FileInputStream
fis
=
new
FileInputStream
(
Grasscutter
.
getConfig
().
getDispatchOptions
().
KeystorePath
))
{
char
[]
keystorePassword
=
Grasscutter
.
getConfig
().
getDispatchOptions
().
KeystorePassword
.
toCharArray
();
char
[]
keystorePassword
=
Grasscutter
.
getConfig
().
getDispatchOptions
().
KeystorePassword
.
toCharArray
();
...
@@ -176,14 +186,20 @@ public final class DispatchServer {
...
@@ -176,14 +186,20 @@ public final class DispatchServer {
httpsServer
.
setHttpsConfigurator
(
new
HttpsConfigurator
(
sslContext
));
httpsServer
.
setHttpsConfigurator
(
new
HttpsConfigurator
(
sslContext
));
server
=
httpsServer
;
server
=
httpsServer
;
}
catch
(
BindException
ignored
)
{
Grasscutter
.
getLogger
().
error
(
"Unable to bind to port: "
+
getAddress
().
getPort
()
+
" (HTTPS)"
);
server
=
this
.
safelyCreateServer
(
this
.
getAddress
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
Grasscutter
.
getLogger
().
warn
(
"[Dispatch] No SSL cert found! Falling back to HTTP server."
);
Grasscutter
.
getLogger
().
warn
(
"[Dispatch] No SSL cert found! Falling back to HTTP server."
);
Grasscutter
.
getConfig
().
getDispatchOptions
().
UseSSL
=
false
;
Grasscutter
.
getConfig
().
getDispatchOptions
().
UseSSL
=
false
;
server
=
HttpServer
.
create
(
getAddress
()
,
0
);
server
=
this
.
safelyCreateServer
(
this
.
getAddress
());
}
}
}
else
{
}
else
{
server
=
HttpServer
.
create
(
getAddress
()
,
0
);
server
=
this
.
safelyCreateServer
(
this
.
getAddress
());
}
}
if
(
server
==
null
)
throw
new
NullPointerException
(
"An HTTP server was not created."
);
server
.
createContext
(
"/"
,
t
->
responseHTML
(
t
,
"Hello"
));
server
.
createContext
(
"/"
,
t
->
responseHTML
(
t
,
"Hello"
));
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandleEvtAvatarSitDownNotify.java
0 → 100644
View file @
6554c37d
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.EvtAvatarSitDownNotifyOuterClass.EvtAvatarSitDownNotify
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketEvtAvatarSitDownNotify
;
@Opcodes
(
PacketOpcodes
.
EvtAvatarSitDownNotify
)
public
class
HandleEvtAvatarSitDownNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
EvtAvatarSitDownNotify
notify
=
EvtAvatarSitDownNotify
.
parseFrom
(
payload
);
session
.
send
(
new
PacketEvtAvatarSitDownNotify
(
notify
));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandleSitReq.java
0 → 100644
View file @
6554c37d
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SitReqOuterClass
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketSitRsp
;
import
emu.grasscutter.utils.Position
;
@Opcodes
(
PacketOpcodes
.
SitReq
)
public
class
HandleSitReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
SitReqOuterClass
.
SitReq
req
=
SitReqOuterClass
.
SitReq
.
parseFrom
(
payload
);
float
x
=
req
.
getPosition
().
getX
();
float
y
=
req
.
getPosition
().
getY
();
float
z
=
req
.
getPosition
().
getZ
();
session
.
send
(
new
PacketSitRsp
(
req
.
getChairId
(),
new
Position
(
x
,
y
,
z
),
session
.
getPlayer
().
getTeamManager
().
getCurrentAvatarEntity
().
getId
()));
}
}
\ No newline at end of file
src/main/java/emu/grasscutter/server/packet/recv/HandlerSetPlayerBirthdayReq.java
0 → 100644
View file @
6554c37d
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketGetPlayerSocialDetailRsp
;
import
emu.grasscutter.server.packet.send.PacketSetPlayerBirthdayRsp
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail
;
import
emu.grasscutter.net.proto.SetPlayerBirthdayReqOuterClass.SetPlayerBirthdayReq
;
import
com.google.gson.Gson
;
@Opcodes
(
PacketOpcodes
.
SetPlayerBirthdayReq
)
public
class
HandlerSetPlayerBirthdayReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
SetPlayerBirthdayReq
req
=
SetPlayerBirthdayReq
.
parseFrom
(
payload
);
if
(
req
.
getBirth
()
!=
null
&&
req
.
getBirth
().
getDay
()
>
0
&&
req
.
getBirth
().
getMonth
()
>
0
)
{
int
day
=
req
.
getBirth
().
getDay
();
int
month
=
req
.
getBirth
().
getMonth
();
// Update birthday value
session
.
getPlayer
().
setBirthday
(
day
,
month
);
// Save birthday month and day
session
.
getPlayer
().
save
();
SocialDetail
.
Builder
detail
=
session
.
getPlayer
().
getSocialDetail
();
session
.
send
(
new
PacketSetPlayerBirthdayRsp
(
session
.
getPlayer
()));
session
.
send
(
new
PacketGetPlayerSocialDetailRsp
(
detail
));
}
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketEvtAvatarSitDownNotify.java
0 → 100644
View file @
6554c37d
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.EvtAvatarSitDownNotifyOuterClass.EvtAvatarSitDownNotify
;
public
class
PacketEvtAvatarSitDownNotify
extends
GenshinPacket
{
public
PacketEvtAvatarSitDownNotify
(
EvtAvatarSitDownNotify
notify
)
{
super
(
PacketOpcodes
.
EvtAvatarSitDownNotify
);
EvtAvatarSitDownNotify
proto
=
EvtAvatarSitDownNotify
.
newBuilder
()
.
setEntityId
(
notify
.
getEntityId
())
.
setPosition
(
notify
.
getPosition
())
.
setChairId
(
notify
.
getChairId
())
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLoginRsp.java
View file @
6554c37d
...
@@ -41,7 +41,7 @@ public class PacketPlayerLoginRsp extends GenshinPacket {
...
@@ -41,7 +41,7 @@ public class PacketPlayerLoginRsp extends GenshinPacket {
RegionInfo
serverRegion
=
regionQuery
.
getRegionInfo
().
toBuilder
()
RegionInfo
serverRegion
=
regionQuery
.
getRegionInfo
().
toBuilder
()
.
setIp
((
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
getGameServerOptions
().
Ip
:
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
))
.
setIp
((
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
getGameServerOptions
().
Ip
:
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
))
.
setPort
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
Port
)
.
setPort
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicPort
!=
0
?
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicPort
:
Grasscutter
.
getConfig
().
getGameServerOptions
().
Port
)
.
setSecretKey
(
ByteString
.
copyFrom
(
FileUtils
.
read
(
Grasscutter
.
getConfig
().
KEY_FOLDER
+
"dispatchSeed.bin"
)))
.
setSecretKey
(
ByteString
.
copyFrom
(
FileUtils
.
read
(
Grasscutter
.
getConfig
().
KEY_FOLDER
+
"dispatchSeed.bin"
)))
.
build
();
.
build
();
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerBirthdayRsp.java
0 → 100644
View file @
6554c37d
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SetPlayerBirthdayRspOuterClass.SetPlayerBirthdayRsp
;
import
emu.grasscutter.net.proto.BirthdayOuterClass.Birthday
;
public
class
PacketSetPlayerBirthdayRsp
extends
GenshinPacket
{
public
PacketSetPlayerBirthdayRsp
(
GenshinPlayer
player
)
{
super
(
PacketOpcodes
.
SetPlayerBirthdayRsp
);
SetPlayerBirthdayRsp
proto
=
SetPlayerBirthdayRsp
.
newBuilder
()
.
setBirth
(
player
.
getBirthday
().
toProto
())
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketSitRsp.java
0 → 100644
View file @
6554c37d
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SitRspOuterClass.SitRsp
;
import
emu.grasscutter.utils.Position
;
public
class
PacketSitRsp
extends
GenshinPacket
{
public
PacketSitRsp
(
long
chairId
,
Position
pos
,
int
EntityId
)
{
super
(
PacketOpcodes
.
SitRsp
);
SitRsp
proto
=
SitRsp
.
newBuilder
()
.
setEntityId
(
EntityId
)
.
setPosition
(
pos
.
toProto
())
.
setChairId
(
chairId
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/utils/Position.java
View file @
6554c37d
...
@@ -2,8 +2,10 @@ package emu.grasscutter.utils;
...
@@ -2,8 +2,10 @@ package emu.grasscutter.utils;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
dev.morphia.annotations.Entity
;
import
emu.grasscutter.net.proto.VectorOuterClass.Vector
;
import
emu.grasscutter.net.proto.VectorOuterClass.Vector
;
@Entity
public
class
Position
implements
Serializable
{
public
class
Position
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2001232313615923575L
;
private
static
final
long
serialVersionUID
=
-
2001232313615923575L
;
...
...
src/main/java/emu/grasscutter/utils/Utils.java
View file @
6554c37d
...
@@ -158,7 +158,7 @@ public final class Utils {
...
@@ -158,7 +158,7 @@ public final class Utils {
// Check for GenshinData.
// Check for GenshinData.
if
(!
fileExists
(
resourcesFolder
+
"BinOutput"
)
||
if
(!
fileExists
(
resourcesFolder
+
"BinOutput"
)
||
!
fileExists
(
resourcesFolder
+
"ExcelBinOutput"
))
{
!
fileExists
(
resourcesFolder
+
"ExcelBinOutput"
))
{
logger
.
info
(
"Place a copy of '
GenshinData
' in the resources folder."
);
logger
.
info
(
"Place a copy of '
BinOutput' and 'ExcelBinOutput
' in the resources folder."
);
exit
=
true
;
exit
=
true
;
}
}
...
...
src/main/resources/logback.xml
View file @
6554c37d
...
@@ -4,8 +4,19 @@
...
@@ -4,8 +4,19 @@
<pattern>
[%d{HH:mm:ss}] [%highlight(%level)] %msg%n
</pattern>
<pattern>
[%d{HH:mm:ss}] [%highlight(%level)] %msg%n
</pattern>
</encoder>
</encoder>
</appender>
</appender>
<appender
name=
"FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<file>
logs/latest.log
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
logs/log.%d{yyyy-MM-dd}_%d{HH}.log.tar.gz
</fileNamePattern>
<maxHistory>
24
</maxHistory>
</rollingPolicy>
<encoder>
<pattern>
%d{yyyy-MM-dd'T'HH:mm:ss'Z'} - %m%n
</pattern>
</encoder>
</appender>
<logger
name=
"org.reflections"
level=
"OFF"
/>
<logger
name=
"org.reflections"
level=
"OFF"
/>
<root
level=
"INFO"
>
<root
level=
"INFO"
>
<appender-ref
ref=
"STDOUT"
/>
<appender-ref
ref=
"STDOUT"
/>
<appender-ref
ref=
"FILE"
/>
</root>
</root>
</Configuration>
</Configuration>
\ No newline at end of file
start.cmd
View file @
6554c37d
...
@@ -74,8 +74,11 @@ for /f "tokens=2*" %%a in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVe
...
@@ -74,8 +74,11 @@ for /f "tokens=2*" %%a in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVe
@rem TODO: External proxy when ORIG_PROXY_ENABLE == 0x1
@rem TODO: External proxy when ORIG_PROXY_ENABLE == 0x1
echo
set
ws
=
createobject
(
"wscript.shell"
)
>
"
%temp%
\proxy.vbs"
echo
set
ws
=
createobject
(
"wscript.shell"
)
>
"
%temp%
\proxy.vbs"
echo
ws
.currentdirectory
=
"
%MITMDUMP_PATH%
"
>>
"
%temp%
\proxy.vbs"
echo
ws
.run
"cmd /c mitmdump.exe -s "
^&
chr
(
34
)
^&
"
%PROXY_SCRIPT_NAME%
"
^&
chr
(
34
)
^&
" -k --allow-hosts "
^&
chr
(
34
)
^&
".*\.yuanshen\.com|.*\.mihoyo\.com|.*\.hoyoverse\.com"
^&
chr
(
34
),
0
>>
"
%temp%
\proxy.vbs"
if
not
"
%MITMDUMP_PATH%
"
==
""
(
echo
ws
.currentdirectory
=
"
%MITMDUMP_PATH%
"
>>
"
%temp%
\proxy.vbs"
)
echo
ws
.run
"cmd /c mitmdump.exe -s "
^&
chr
(
34
)
^&
"
%CUR_PATH%%
PROXY_SCRIPT_NAME
%
"
^&
chr
(
34
)
^&
" -k --allow-hosts "
^&
chr
(
34
)
^&
".*\.yuanshen\.com|.*\.mihoyo\.com|.*\.hoyoverse\.com"
^&
chr
(
34
),
0
>>
"
%temp%
\proxy.vbs"
"
%temp%
\proxy.vbs"
"
%temp%
\proxy.vbs"
del
/f /q
"
%temp%
\proxy.vbs"
>
nul
2
>
nul
del
/f /q
"
%temp%
\proxy.vbs"
>
nul
2
>
nul
...
@@ -117,7 +120,9 @@ set DATABASE=true
...
@@ -117,7 +120,9 @@ set DATABASE=true
mkdir
"
%DATABASE_STORAGE_PATH%
"
>
nul
2
>
nul
mkdir
"
%DATABASE_STORAGE_PATH%
"
>
nul
2
>
nul
echo
set
ws
=
createobject
(
"wscript.shell"
)
>
"
%temp%
\db.vbs"
echo
set
ws
=
createobject
(
"wscript.shell"
)
>
"
%temp%
\db.vbs"
if
not
"
%MONGODB_PATH%
"
==
""
(
echo
ws
.currentdirectory
=
"
%MONGODB_PATH%
"
>>
"
%temp%
\db.vbs"
echo
ws
.currentdirectory
=
"
%MONGODB_PATH%
"
>>
"
%temp%
\db.vbs"
)
echo
ws
.run
"cmd /c mongod.exe --dbpath "
^&
chr
(
34
)
^&
"
%DATABASE_STORAGE_PATH%
"
^&
chr
(
34
)
^&
""
,
0
>>
"
%temp%
\db.vbs"
echo
ws
.run
"cmd /c mongod.exe --dbpath "
^&
chr
(
34
)
^&
"
%DATABASE_STORAGE_PATH%
"
^&
chr
(
34
)
^&
""
,
0
>>
"
%temp%
\db.vbs"
"
%temp%
\db.vbs"
"
%temp%
\db.vbs"
del
/f /q
"
%temp%
\db.vbs"
>
nul
2
>
nul
del
/f /q
"
%temp%
\db.vbs"
>
nul
2
>
nul
...
...
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