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
e6402c31
Commit
e6402c31
authored
Apr 22, 2022
by
memetrollsXD
Browse files
Merge branch 'stable' into development
parents
d5d90564
1dfe8733
Changes
107
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/send/PacketSceneTransToPointRsp.java
0 → 100644
View file @
e6402c31
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.data.GenshinData
;
import
emu.grasscutter.data.custom.ScenePointEntry
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SceneTransToPointRspOuterClass.SceneTransToPointRsp
;
import
emu.grasscutter.utils.Position
;
public
class
PacketSceneTransToPointRsp
extends
GenshinPacket
{
public
PacketSceneTransToPointRsp
(
GenshinPlayer
player
,
int
pointId
,
int
sceneId
)
{
super
(
PacketOpcodes
.
SceneTransToPointRsp
);
SceneTransToPointRsp
proto
=
SceneTransToPointRsp
.
newBuilder
()
.
setRetcode
(
0
)
.
setPointId
(
pointId
)
.
setSceneId
(
sceneId
)
.
build
();
this
.
setData
(
proto
);
}
public
PacketSceneTransToPointRsp
()
{
super
(
PacketOpcodes
.
SceneTransToPointRsp
);
SceneTransToPointRsp
proto
=
SceneTransToPointRsp
.
newBuilder
()
.
setRetcode
(
1
)
// Internal server error
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketSceneUnlockInfoNotify.java
View file @
e6402c31
...
@@ -12,8 +12,8 @@ public class PacketSceneUnlockInfoNotify extends GenshinPacket {
...
@@ -12,8 +12,8 @@ public class PacketSceneUnlockInfoNotify extends GenshinPacket {
SceneUnlockInfoNotify
proto
=
SceneUnlockInfoNotify
.
newBuilder
()
SceneUnlockInfoNotify
proto
=
SceneUnlockInfoNotify
.
newBuilder
()
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
1
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
1
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
3
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
3
)
.
addSceneTagIdList
(
102
).
addSceneTagIdList
(
113
).
addSceneTagIdList
(
117
)
)
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
4
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
4
)
.
addSceneTagIdList
(
106
).
addSceneTagIdList
(
109
)
)
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
5
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
5
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
6
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
6
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
7
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
7
))
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketStoreWeightLimitNotify.java
View file @
e6402c31
...
@@ -13,11 +13,11 @@ public class PacketStoreWeightLimitNotify extends GenshinPacket {
...
@@ -13,11 +13,11 @@ public class PacketStoreWeightLimitNotify extends GenshinPacket {
StoreWeightLimitNotify
p
=
StoreWeightLimitNotify
.
newBuilder
()
StoreWeightLimitNotify
p
=
StoreWeightLimitNotify
.
newBuilder
()
.
setStoreType
(
StoreType
.
StorePack
)
.
setStoreType
(
StoreType
.
StorePack
)
.
setWeightLimit
(
Grasscutter
.
getConfig
().
getServerOptions
().
InventoryLimitAll
)
.
setWeightLimit
(
Grasscutter
.
getConfig
().
get
Game
ServerOptions
().
InventoryLimitAll
)
.
setWeaponCountLimit
(
Grasscutter
.
getConfig
().
getServerOptions
().
InventoryLimitWeapon
)
.
setWeaponCountLimit
(
Grasscutter
.
getConfig
().
get
Game
ServerOptions
().
InventoryLimitWeapon
)
.
setReliquaryCountLimit
(
Grasscutter
.
getConfig
().
getServerOptions
().
InventoryLimitRelic
)
.
setReliquaryCountLimit
(
Grasscutter
.
getConfig
().
get
Game
ServerOptions
().
InventoryLimitRelic
)
.
setMaterialCountLimit
(
Grasscutter
.
getConfig
().
getServerOptions
().
InventoryLimitMaterial
)
.
setMaterialCountLimit
(
Grasscutter
.
getConfig
().
get
Game
ServerOptions
().
InventoryLimitMaterial
)
.
setFurnitureCountLimit
(
Grasscutter
.
getConfig
().
getServerOptions
().
InventoryLimitFurniture
)
.
setFurnitureCountLimit
(
Grasscutter
.
getConfig
().
get
Game
ServerOptions
().
InventoryLimitFurniture
)
.
build
();
.
build
();
this
.
setData
(
p
);
this
.
setData
(
p
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerLocationNotify.java
View file @
e6402c31
...
@@ -14,7 +14,7 @@ public class PacketWorldPlayerLocationNotify extends GenshinPacket {
...
@@ -14,7 +14,7 @@ public class PacketWorldPlayerLocationNotify extends GenshinPacket {
WorldPlayerLocationNotify
.
Builder
proto
=
WorldPlayerLocationNotify
.
newBuilder
();
WorldPlayerLocationNotify
.
Builder
proto
=
WorldPlayerLocationNotify
.
newBuilder
();
for
(
GenshinPlayer
p
:
world
.
getPlayers
())
{
for
(
GenshinPlayer
p
:
world
.
getPlayers
())
{
proto
.
addPlayerLocList
(
p
.
getPlayerLocationInfo
());
proto
.
addPlayerLocList
(
p
.
get
World
PlayerLocationInfo
());
}
}
this
.
setData
(
proto
);
this
.
setData
(
proto
);
...
...
src/main/java/emu/grasscutter/tools/Tools.java
View file @
e6402c31
...
@@ -21,6 +21,7 @@ import emu.grasscutter.data.def.AvatarData;
...
@@ -21,6 +21,7 @@ import emu.grasscutter.data.def.AvatarData;
import
emu.grasscutter.data.def.ItemData
;
import
emu.grasscutter.data.def.ItemData
;
import
emu.grasscutter.data.def.MonsterData
;
import
emu.grasscutter.data.def.MonsterData
;
import
emu.grasscutter.data.def.SceneData
;
import
emu.grasscutter.data.def.SceneData
;
import
emu.grasscutter.utils.Utils
;
public
final
class
Tools
{
public
final
class
Tools
{
...
@@ -29,7 +30,7 @@ public final class Tools {
...
@@ -29,7 +30,7 @@ public final class Tools {
ResourceLoader
.
loadResources
();
ResourceLoader
.
loadResources
();
Map
<
Long
,
String
>
map
;
Map
<
Long
,
String
>
map
;
try
(
FileReader
fileReader
=
new
FileReader
(
Grasscutter
.
getConfig
().
RESOURCE_FOLDER
+
"TextMapEN.json"
))
{
try
(
FileReader
fileReader
=
new
FileReader
(
Utils
.
toFilePath
(
Grasscutter
.
getConfig
().
RESOURCE_FOLDER
+
"
TextMap/
TextMapEN.json"
))
)
{
map
=
Grasscutter
.
getGsonFactory
().
fromJson
(
fileReader
,
new
TypeToken
<
Map
<
Long
,
String
>>()
{}.
getType
());
map
=
Grasscutter
.
getGsonFactory
().
fromJson
(
fileReader
,
new
TypeToken
<
Map
<
Long
,
String
>>()
{}.
getType
());
}
}
...
...
run
.cmd
→
start
.cmd
View file @
e6402c31
...
@@ -4,67 +4,97 @@
...
@@ -4,67 +4,97 @@
@if
"
%DEBUG%
"
==
""
echo
off
@if
"
%DEBUG%
"
==
""
echo
off
pushd
%~dp0
pushd
%~dp0
set
CUR_PATH
=
%~dp0
title
Grasscutter
title
Grasscutter
call
:LOG
[
INFO
]
Grasscutter
call
:LOG
[
INFO
]
Welcome
to
Grasscutter
call
:LOG
[
INFO
]
To
proper
exit
this
console
,
use
[
Ctrl
+
C
]
and
enter
N
not
Y
.
call
:LOG
[
INFO
]
call
:LOG
[
INFO
]
Initializing
...
call
:LOG
[
INFO
]
Initializing
...
@rem This will not work if your java or mitmproxy is in a different location, plugin as necessary
set
CONFIG
=
start_config
@rem this just saves you from changing your PATH
set
JAVA_PATH
=
C
:\Program
Files
\Java\jdk1.8.0_202\
set
MITMPROXY_PATH
=
%~dp0
set
PROXY_SCRIPT
=
proxy
@rem TODO: MongoDB integration
set
SERVER_PATH
=
%~dp0
@rem mitmproxy not found, server only
set
JAVA_PATH
=
DO_NOT_CHECK_PATH
if
not
exist
"
%MITMPROXY_PATH%
mitmdump.exe"
(
set
MITMDUMP_PATH
=
DO_NOT_CHECK_PATH
call
:LOG
[
WARN
]
mitmproxy
not
found
,
server
only
mode
.
set
MONGODB_PATH
=
DO_NOT_CHECK_PATH
goto
:SERVER
set
SERVER_JAR_PATH
=
%CUR_PATH%
set
DATABASE_STORAGE_PATH
=
%CUR_PATH%
resources
\Database
set
SERVER_JAR_NAME
=
grasscutter
.jar
set
PROXY_SCRIPT_NAME
=
proxy
if
exist
"
%CUR_PATH%%
CONFIG
%
.cmd"
(
call
"
%CUR_PATH%%
CONFIG
%
.cmd"
>
nul
2
>
nul
)
if
not
"
%JAVA_PATH%
"
==
"DO_NOT_CHECK_PATH"
(
if
not
exist
"
%JAVA_PATH%
java.exe"
(
call
:LOG
[
ERROR
]
Java
not
found
.
goto
:EXIT
)
)
else
set
JAVA_PATH
=
if
not
exist
"
%SERVER_PATH%
grasscutter.jar"
(
call
:LOG
[
ERROR
]
Server
jar
not
found
.
goto
:EXIT
)
)
@rem mitmproxy not found, server only
if
not
"
%MITMDUMP_PATH%
"
==
"DO_NOT_CHECK_PATH"
(
if
not
exist
"
%MITMDUMP_PATH%
mitmdump.exe"
(
call
:LOG
[
WARN
]
mitmdump
not
found
,
server
only
mode
.
goto
:SERVER
)
)
else
set
MITMDUMP_PATH
=
@rem proxy script not found, server only
@rem proxy script not found, server only
if
not
exist
"
%PROXY_SCRIPT%
.py"
(
if
not
exist
"
%PROXY_SCRIPT
_NAME
%
.py"
(
if
not
exist
"
%PROXY_SCRIPT%
.pyc"
(
if
not
exist
"
%PROXY_SCRIPT
_NAME
%
.pyc"
(
call
:LOG
[
WARN
]
Missing
proxy
script
or
compiled
proxy
script
,
server
only
mode
.
call
:LOG
[
WARN
]
Missing
proxy
script
or
compiled
proxy
script
,
server
only
mode
.
goto
:SERVER
goto
:SERVER
)
else
set
PROXY_SCRIPT
=
%PROXY_SCRIPT%
.pyc
)
else
set
PROXY_SCRIPT
_NAME
=
%PROXY_SCRIPT
_NAME
%
.pyc
)
else
set
PROXY_SCRIPT
=
%PROXY_SCRIPT%
.py
)
else
set
PROXY_SCRIPT
_NAME
=
%PROXY_SCRIPT
_NAME
%
.py
:PROXY
:PROXY
@rem UAC Administrator privileges
@rem UAC Administrator privileges
>
nul
2
>&
1
reg
query
"HKU\S-1-5-19"
||
(
>
nul
2
>&
1
reg
query
"HKU\S-1-5-19"
||
(
call
:LOG
[
WARN
]
Currently
running
with
non
Administrator
privileges
,
raising
...
call
:LOG
[
WARN
]
Currently
running
with
non
Administrator
privileges
,
raising
...
echo
set
UAC
=
CreateObject
^(
"Shell.Application"
^)
>
"
%temp%
\UAC.vbs"
echo
set
UAC
=
CreateObject
^(
"Shell.Application"
^)
>
"
%temp%
\UAC.vbs"
echo
UAC
.ShellExecute
"
%~f0
"
,
"
%
1"
,
""
,
"runas"
,
1
>>
"
%temp%
\UAC.vbs"
echo
UAC
.ShellExecute
"
%~f0
"
,
"
%
1"
,
""
,
"runas"
,
1
>>
"
%temp%
\UAC.vbs"
"
%temp%
\UAC.vbs"
"
%temp%
\UAC.vbs"
del
/f /q
"
%temp%
\UAC.vbs"
>
nul
2
>
nul
del
/f /q
"
%temp%
\UAC.vbs"
>
nul
2
>
nul
exit
/b
exit
/b
)
)
call
:LOG
[
INFO
]
Starting
proxy
daemon
...
set
PROXY
=
true
set
PROXY
=
true
@rem Store original proxy settings
@rem Store original proxy settings
for
/f
"tokens=2*"
%%a
in
(
'reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable 2
^>
nul'
)
do
set
"ORIG_PROXY_ENABLE=
%%b
"
for
/f
"tokens=2*"
%%a
in
(
'reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable 2
^>
nul'
)
do
set
"ORIG_PROXY_ENABLE=
%%b
"
for
/f
"tokens=2*"
%%a
in
(
'reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer 2
^>
nul'
)
do
set
"ORIG_PROXY_SERVER=
%%b
"
for
/f
"tokens=2*"
%%a
in
(
'reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer 2
^>
nul'
)
do
set
"ORIG_PROXY_SERVER=
%%b
"
call
:LOG
[
INFO
]
Starting
proxy
daemon
...
@rem TODO: External proxy when ORIG_PROXY_ENABLE == 0x1
@rem TODO: External proxy when ORIG_PROXY_ENABLE == 0x1
start
/min
""
"
%MITMPROXY_PATH%
mitmdump.exe"
-s
%PROXY_SCRIPT%
--ssl-insecure
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"
,
0
>>
"
%temp%
\proxy.vbs"
"
%temp%
\proxy.vbs"
del
/f /q
"
%temp%
\proxy.vbs"
>
nul
2
>
nul
@rem CA certificate for
possible
HTTPS scheme
@rem CA certificate for HTTPS scheme
call
:LOG
[
INFO
]
Waiting
for
CA
certificate
generation
...
call
:LOG
[
INFO
]
Waiting
for
CA
certificate
generation
...
set
CA_CERT_FILE
=
"
%USERPROFILE%
\.mitmproxy\mitmproxy-ca-cert.cer"
set
CA_CERT_FILE
=
"
%USERPROFILE%
\.mitmproxy\mitmproxy-ca-cert.cer"
set
/
A
TIMEOUT_COUNT
=
0
set
/
a
TIMEOUT_COUNT
=
0
:CERT
_CA_CHECK
:CERT
_CA_CHECK
if
not
exist
%CA_CERT_FILE%
(
if
not
exist
%CA_CERT_FILE%
(
timeout
/
T
1
>
nul
2
>
nul
timeout
/
t
1
>
nul
2
>
nul
set
/
A
TIMEOUT_COUNT
+=
1
set
/
a
TIMEOUT_COUNT
+=
1
goto
CERT_CA_CHECK
goto
CERT_CA_CHECK
)
)
:EXTRA
_TIMEOUT
:EXTRA
_TIMEOUT
if
%TIMEOUT_COUNT%
LEQ
2
(
if
%TIMEOUT_COUNT%
LEQ
2
(
timeout
/
T
1
>
nul
2
>
nul
timeout
/
t
1
>
nul
2
>
nul
set
/
A
TIMEOUT_COUNT
+=
1
set
/
a
TIMEOUT_COUNT
+=
1
goto
EXTRA_TIMEOUT
goto
EXTRA_TIMEOUT
)
)
call
:LOG
[
INFO
]
Adding
CA
certificate
to
store
...
call
:LOG
[
INFO
]
Adding
CA
certificate
to
store
...
...
@@ -75,21 +105,37 @@ reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v Pr
...
@@ -75,21 +105,37 @@ reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v Pr
reg
add
"HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
/v
ProxyServer
/d
"127.0.0.1:8080"
/f
>
nul
2
>
nul
reg
add
"HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
/v
ProxyServer
/d
"127.0.0.1:8080"
/f
>
nul
2
>
nul
:SERVER
:SERVER
if
not
exist
"
%JAVA_PATH%
bin\java.exe"
(
if
not
"
%MONGODB_PATH%
"
==
"DO_NOT_CHECK_PATH"
(
call
:LOG
[
ERROR
]
Java
not
found
.
if
not
exist
"
%MONGODB_PATH%
mongod.exe"
(
goto
:EXIT
call
:LOG
[
WARN
]
MongoDB
daemon
not
found
,
server
only
mode
.
)
goto
:GAME
if
not
exist
"
%SERVER_PATH%
grasscutter.jar"
(
)
call
:LOG
[
ERROR
]
Server
jar
not
found
.
)
else
set
MONGODB_PATH
=
goto
:EXIT
call
:LOG
[
INFO
]
Starting
MongoDB
daemon
...
)
set
DATABASE
=
true
mkdir
"
%DATABASE_STORAGE_PATH%
"
>
nul
2
>
nul
echo
set
ws
=
createobject
(
"wscript.shell"
)
>
"
%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"
"
%temp%
\db.vbs"
del
/f /q
"
%temp%
\db.vbs"
>
nul
2
>
nul
:GAME
call
:LOG
[
INFO
]
Starting
server
...
call
:LOG
[
INFO
]
Starting
server
...
"
%JAVA_PATH%
bin\
java.exe"
-jar
"
%SERVER_PATH%
grasscutter.jar"
"
%JAVA_PATH%
java.exe"
-jar
"
%SERVER_PATH%
grasscutter.jar"
call
:LOG
[
INFO
]
Server
stopped
call
:LOG
[
INFO
]
Server
stopped
:EXIT
:EXIT
if
"
%DATABASE%
"
==
""
(
call
:LOG
[
INFO
]
MongoDB
daemon
not
started
,
no
need
to
clean
up
.
)
else
(
call
:LOG
[
INFO
]
Shutting
down
MongoDB
daemon
...
taskkill
/t /f /im
mongod
.exe
>
nul
2
>
nul
)
if
"
%PROXY%
"
==
""
(
if
"
%PROXY%
"
==
""
(
call
:LOG
[
INFO
]
Proxy
not
started
,
no
need
to
clean
up
.
call
:LOG
[
INFO
]
Proxy
daemon
not
started
,
no
need
to
clean
up
.
)
else
(
)
else
(
call
:LOG
[
INFO
]
Restoring
network
settings
...
call
:LOG
[
INFO
]
Restoring
network
settings
...
...
@@ -100,7 +146,6 @@ if "%PROXY%" == "" (
...
@@ -100,7 +146,6 @@ if "%PROXY%" == "" (
taskkill
/t /f /im
mitmdump
.exe
>
nul
2
>
nul
taskkill
/t /f /im
mitmdump
.exe
>
nul
2
>
nul
call
:LOG
[
INFO
]
Removing
CA
certificate
...
call
:LOG
[
INFO
]
Removing
CA
certificate
...
for
/F
"tokens=2"
%%s
in
(
'certutil -dump
%CA_CERT_FILE%
^|
findstr
^"^s
ha1
^"
'
)
do
(
for
/F
"tokens=2"
%%s
in
(
'certutil -dump
%CA_CERT_FILE%
^|
findstr
^"^s
ha1
^"
'
)
do
(
set
SERIAL
=
%%s
set
SERIAL
=
%%s
)
)
...
...
start_config.cmd
0 → 100644
View file @
e6402c31
@rem
@rem Copyright (C) 2002-2022 MlgmXyysd All Rights Reserved.
@rem
@echo
off
pushd
%~dp0
set
CUR_PATH
=
%~dp0
@rem This will not work if your java or mitmproxy is in a different location, plugin as necessary
@rem this just saves you from changing your PATH
@rem Executable Path
@rem Note: Fill DO_NOT_CHECK_PATH if you need to run it from PATH
@rem without detecting whether the executable file exists
set
JAVA_PATH
=
C
:\Program
Files
\Java\jdk1.8.0_202\bin\
set
MITMDUMP_PATH
=
%CUR_PATH%
set
MONGODB_PATH
=
%CUR_PATH%
@rem Utility Path
set
SERVER_JAR_PATH
=
%CUR_PATH%
set
DATABASE_STORAGE_PATH
=
%CUR_PATH%
resources
\Database
@rem Utility Name
set
SERVER_JAR_NAME
=
grasscutter
.jar
set
PROXY_SCRIPT_NAME
=
proxy
\ No newline at end of file
Prev
1
2
3
4
5
6
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