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
9fc8cc1c
Commit
9fc8cc1c
authored
Apr 27, 2022
by
Kengxxiao
Committed by
GitHub
Apr 27, 2022
Browse files
Merge pull request #1 from Grasscutters/development
merge
parents
627a2f1e
d1fc8c1f
Changes
297
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/data/def/ItemData.java
View file @
9fc8cc1c
package
emu.grasscutter.data.def
;
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.game.props.FightProperty
;
import
it.unimi.dsi.fastutil.ints.IntOpenHashSet
;
import
it.unimi.dsi.fastutil.ints.IntOpenHashSet
;
import
it.unimi.dsi.fastutil.ints.IntSet
;
import
it.unimi.dsi.fastutil.ints.IntSet
;
@ResourceType
(
name
=
{
"MaterialExcelConfigData.json"
,
"WeaponExcelConfigData.json"
,
"ReliquaryExcelConfigData.json"
})
@ResourceType
(
name
=
{
"MaterialExcelConfigData.json"
,
"WeaponExcelConfigData.json"
,
"ReliquaryExcelConfigData.json"
})
public
class
ItemData
extends
G
enshin
Resource
{
public
class
ItemData
extends
G
ame
Resource
{
private
int
Id
;
private
int
Id
;
private
int
StackLimit
=
1
;
private
int
StackLimit
=
1
;
...
...
src/main/java/emu/grasscutter/data/def/MonsterCurveData.java
View file @
9fc8cc1c
...
@@ -4,12 +4,12 @@ import java.util.HashMap;
...
@@ -4,12 +4,12 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.common.CurveInfo
;
import
emu.grasscutter.data.common.CurveInfo
;
@ResourceType
(
name
=
"MonsterCurveExcelConfigData.json"
)
@ResourceType
(
name
=
"MonsterCurveExcelConfigData.json"
)
public
class
MonsterCurveData
extends
G
enshin
Resource
{
public
class
MonsterCurveData
extends
G
ame
Resource
{
private
int
Level
;
private
int
Level
;
private
CurveInfo
[]
CurveInfos
;
private
CurveInfo
[]
CurveInfos
;
...
...
src/main/java/emu/grasscutter/data/def/MonsterData.java
View file @
9fc8cc1c
...
@@ -2,14 +2,14 @@ package emu.grasscutter.data.def;
...
@@ -2,14 +2,14 @@ package emu.grasscutter.data.def;
import
java.util.List
;
import
java.util.List
;
import
emu.grasscutter.data.G
enshin
Data
;
import
emu.grasscutter.data.G
ame
Data
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType.LoadPriority
;
import
emu.grasscutter.data.ResourceType.LoadPriority
;
import
emu.grasscutter.data.common.PropGrowCurve
;
import
emu.grasscutter.data.common.PropGrowCurve
;
@ResourceType
(
name
=
"MonsterExcelConfigData.json"
,
loadPriority
=
LoadPriority
.
LOW
)
@ResourceType
(
name
=
"MonsterExcelConfigData.json"
,
loadPriority
=
LoadPriority
.
LOW
)
public
class
MonsterData
extends
G
enshin
Resource
{
public
class
MonsterData
extends
G
ame
Resource
{
private
int
Id
;
private
int
Id
;
private
String
MonsterName
;
private
String
MonsterName
;
...
@@ -168,13 +168,13 @@ public class MonsterData extends GenshinResource {
...
@@ -168,13 +168,13 @@ public class MonsterData extends GenshinResource {
@Override
@Override
public
void
onLoad
()
{
public
void
onLoad
()
{
this
.
describeData
=
G
enshin
Data
.
getMonsterDescribeDataMap
().
get
(
this
.
getDescribeId
());
this
.
describeData
=
G
ame
Data
.
getMonsterDescribeDataMap
().
get
(
this
.
getDescribeId
());
for
(
int
id
:
this
.
Equips
)
{
for
(
int
id
:
this
.
Equips
)
{
if
(
id
==
0
)
{
if
(
id
==
0
)
{
continue
;
continue
;
}
}
GadgetData
gadget
=
G
enshin
Data
.
getGadgetDataMap
().
get
(
id
);
GadgetData
gadget
=
G
ame
Data
.
getGadgetDataMap
().
get
(
id
);
if
(
gadget
==
null
)
{
if
(
gadget
==
null
)
{
continue
;
continue
;
}
}
...
...
src/main/java/emu/grasscutter/data/def/MonsterDescribeData.java
View file @
9fc8cc1c
package
emu.grasscutter.data.def
;
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType.LoadPriority
;
import
emu.grasscutter.data.ResourceType.LoadPriority
;
@ResourceType
(
name
=
"MonsterDescribeExcelConfigData.json"
,
loadPriority
=
LoadPriority
.
HIGH
)
@ResourceType
(
name
=
"MonsterDescribeExcelConfigData.json"
,
loadPriority
=
LoadPriority
.
HIGH
)
public
class
MonsterDescribeData
extends
G
enshin
Resource
{
public
class
MonsterDescribeData
extends
G
ame
Resource
{
private
int
Id
;
private
int
Id
;
private
long
NameTextMapHash
;
private
long
NameTextMapHash
;
private
int
TitleID
;
private
int
TitleID
;
...
...
src/main/java/emu/grasscutter/data/def/NpcData.java
View file @
9fc8cc1c
package
emu.grasscutter.data.def
;
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
@ResourceType
(
name
=
"NpcExcelConfigData.json"
)
@ResourceType
(
name
=
"NpcExcelConfigData.json"
)
public
class
NpcData
extends
G
enshin
Resource
{
public
class
NpcData
extends
G
ame
Resource
{
private
int
Id
;
private
int
Id
;
private
String
JsonName
;
private
String
JsonName
;
...
...
src/main/java/emu/grasscutter/data/def/PlayerLevelData.java
View file @
9fc8cc1c
package
emu.grasscutter.data.def
;
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
@ResourceType
(
name
=
"PlayerLevelExcelConfigData.json"
)
@ResourceType
(
name
=
"PlayerLevelExcelConfigData.json"
)
public
class
PlayerLevelData
extends
G
enshin
Resource
{
public
class
PlayerLevelData
extends
G
ame
Resource
{
private
int
Level
;
private
int
Level
;
private
int
Exp
;
private
int
Exp
;
private
int
RewardId
;
private
int
RewardId
;
...
...
src/main/java/emu/grasscutter/data/def/ProudSkillData.java
View file @
9fc8cc1c
...
@@ -3,13 +3,13 @@ package emu.grasscutter.data.def;
...
@@ -3,13 +3,13 @@ package emu.grasscutter.data.def;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.common.FightPropData
;
import
emu.grasscutter.data.common.FightPropData
;
import
emu.grasscutter.data.common.ItemParamData
;
import
emu.grasscutter.data.common.ItemParamData
;
@ResourceType
(
name
=
"ProudSkillExcelConfigData.json"
)
@ResourceType
(
name
=
"ProudSkillExcelConfigData.json"
)
public
class
ProudSkillData
extends
G
enshin
Resource
{
public
class
ProudSkillData
extends
G
ame
Resource
{
private
int
ProudSkillId
;
private
int
ProudSkillId
;
private
int
ProudSkillGroupId
;
private
int
ProudSkillGroupId
;
...
...
src/main/java/emu/grasscutter/data/def/ReliquaryAffixData.java
View file @
9fc8cc1c
package
emu.grasscutter.data.def
;
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.game.props.FightProperty
;
@ResourceType
(
name
=
"ReliquaryAffixExcelConfigData.json"
)
@ResourceType
(
name
=
"ReliquaryAffixExcelConfigData.json"
)
public
class
ReliquaryAffixData
extends
G
enshin
Resource
{
public
class
ReliquaryAffixData
extends
G
ame
Resource
{
private
int
Id
;
private
int
Id
;
private
int
DepotId
;
private
int
DepotId
;
...
...
src/main/java/emu/grasscutter/data/def/ReliquaryLevelData.java
View file @
9fc8cc1c
...
@@ -2,14 +2,14 @@ package emu.grasscutter.data.def;
...
@@ -2,14 +2,14 @@ package emu.grasscutter.data.def;
import
java.util.List
;
import
java.util.List
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.game.props.FightProperty
;
import
it.unimi.dsi.fastutil.ints.Int2ObjectMap
;
import
it.unimi.dsi.fastutil.ints.Int2ObjectMap
;
import
it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
;
import
it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
;
@ResourceType
(
name
=
"ReliquaryLevelExcelConfigData.json"
)
@ResourceType
(
name
=
"ReliquaryLevelExcelConfigData.json"
)
public
class
ReliquaryLevelData
extends
G
enshin
Resource
{
public
class
ReliquaryLevelData
extends
G
ame
Resource
{
private
int
id
;
private
int
id
;
private
Int2ObjectMap
<
Float
>
propMap
;
private
Int2ObjectMap
<
Float
>
propMap
;
...
...
src/main/java/emu/grasscutter/data/def/ReliquaryMainPropData.java
View file @
9fc8cc1c
package
emu.grasscutter.data.def
;
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.game.props.FightProperty
;
@ResourceType
(
name
=
"ReliquaryMainPropExcelConfigData.json"
)
@ResourceType
(
name
=
"ReliquaryMainPropExcelConfigData.json"
)
public
class
ReliquaryMainPropData
extends
G
enshin
Resource
{
public
class
ReliquaryMainPropData
extends
G
ame
Resource
{
private
int
Id
;
private
int
Id
;
private
int
PropDepotId
;
private
int
PropDepotId
;
...
...
src/main/java/emu/grasscutter/data/def/ReliquarySetData.java
View file @
9fc8cc1c
package
emu.grasscutter.data.def
;
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
@ResourceType
(
name
=
"ReliquarySetExcelConfigData.json"
)
@ResourceType
(
name
=
"ReliquarySetExcelConfigData.json"
)
public
class
ReliquarySetData
extends
G
enshin
Resource
{
public
class
ReliquarySetData
extends
G
ame
Resource
{
private
int
SetId
;
private
int
SetId
;
private
int
[]
SetNeedNum
;
private
int
[]
SetNeedNum
;
private
int
EquipAffixId
;
private
int
EquipAffixId
;
...
...
src/main/java/emu/grasscutter/data/def/RewardData.java
View file @
9fc8cc1c
...
@@ -2,12 +2,12 @@ package emu.grasscutter.data.def;
...
@@ -2,12 +2,12 @@ package emu.grasscutter.data.def;
import
java.util.List
;
import
java.util.List
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.common.RewardItemData
;
import
emu.grasscutter.data.common.RewardItemData
;
@ResourceType
(
name
=
"RewardExcelConfigData.json"
)
@ResourceType
(
name
=
"RewardExcelConfigData.json"
)
public
class
RewardData
extends
G
enshin
Resource
{
public
class
RewardData
extends
G
ame
Resource
{
public
int
RewardId
;
public
int
RewardId
;
public
List
<
RewardItemData
>
RewardItemList
;
public
List
<
RewardItemData
>
RewardItemList
;
...
...
src/main/java/emu/grasscutter/data/def/SceneData.java
View file @
9fc8cc1c
package
emu.grasscutter.data.def
;
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.G
enshin
Data
;
import
emu.grasscutter.data.G
ame
Data
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.game.props.SceneType
;
import
emu.grasscutter.game.props.SceneType
;
@ResourceType
(
name
=
"SceneExcelConfigData.json"
)
@ResourceType
(
name
=
"SceneExcelConfigData.json"
)
public
class
SceneData
extends
G
enshin
Resource
{
public
class
SceneData
extends
G
ame
Resource
{
private
int
Id
;
private
int
Id
;
private
SceneType
SceneType
;
private
SceneType
SceneType
;
private
String
ScriptData
;
private
String
ScriptData
;
...
...
src/main/java/emu/grasscutter/data/def/WeaponCurveData.java
View file @
9fc8cc1c
...
@@ -4,12 +4,12 @@ import java.util.HashMap;
...
@@ -4,12 +4,12 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.common.CurveInfo
;
import
emu.grasscutter.data.common.CurveInfo
;
@ResourceType
(
name
=
"WeaponCurveExcelConfigData.json"
)
@ResourceType
(
name
=
"WeaponCurveExcelConfigData.json"
)
public
class
WeaponCurveData
extends
G
enshin
Resource
{
public
class
WeaponCurveData
extends
G
ame
Resource
{
private
int
Level
;
private
int
Level
;
private
CurveInfo
[]
CurveInfos
;
private
CurveInfo
[]
CurveInfos
;
...
...
src/main/java/emu/grasscutter/data/def/WeaponLevelData.java
View file @
9fc8cc1c
package
emu.grasscutter.data.def
;
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
@ResourceType
(
name
=
"WeaponLevelExcelConfigData.json"
)
@ResourceType
(
name
=
"WeaponLevelExcelConfigData.json"
)
public
class
WeaponLevelData
extends
G
enshin
Resource
{
public
class
WeaponLevelData
extends
G
ame
Resource
{
private
int
Level
;
private
int
Level
;
private
int
[]
RequiredExps
;
private
int
[]
RequiredExps
;
...
...
src/main/java/emu/grasscutter/data/def/WeaponPromoteData.java
View file @
9fc8cc1c
package
emu.grasscutter.data.def
;
package
emu.grasscutter.data.def
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.common.FightPropData
;
import
emu.grasscutter.data.common.FightPropData
;
import
emu.grasscutter.data.common.ItemParamData
;
import
emu.grasscutter.data.common.ItemParamData
;
@ResourceType
(
name
=
"WeaponPromoteExcelConfigData.json"
)
@ResourceType
(
name
=
"WeaponPromoteExcelConfigData.json"
)
public
class
WeaponPromoteData
extends
G
enshin
Resource
{
public
class
WeaponPromoteData
extends
G
ame
Resource
{
private
int
WeaponPromoteId
;
private
int
WeaponPromoteId
;
private
int
PromoteLevel
;
private
int
PromoteLevel
;
...
...
src/main/java/emu/grasscutter/data/def/WorldLevelData.java
View file @
9fc8cc1c
package
emu.grasscutter.data.def
;
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType
;
@ResourceType
(
name
=
"WorldLevelExcelConfigData.json"
)
@ResourceType
(
name
=
"WorldLevelExcelConfigData.json"
)
public
class
WorldLevelData
extends
G
enshin
Resource
{
public
class
WorldLevelData
extends
G
ame
Resource
{
private
int
Level
;
private
int
Level
;
private
int
MonsterLevel
;
private
int
MonsterLevel
;
...
...
src/main/java/emu/grasscutter/database/DatabaseHelper.java
View file @
9fc8cc1c
...
@@ -4,12 +4,12 @@ import java.util.List;
...
@@ -4,12 +4,12 @@ import java.util.List;
import
com.mongodb.client.result.DeleteResult
;
import
com.mongodb.client.result.DeleteResult
;
import
dev.morphia.query.experimental.filters.Filters
;
import
dev.morphia.query.experimental.filters.Filters
;
import
emu.grasscutter.G
enshin
Constants
;
import
emu.grasscutter.G
ame
Constants
;
import
emu.grasscutter.game.Account
;
import
emu.grasscutter.game.Account
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.avatar.Avatar
;
import
emu.grasscutter.game.avatar.GenshinAvatar
;
import
emu.grasscutter.game.friends.Friendship
;
import
emu.grasscutter.game.friends.Friendship
;
import
emu.grasscutter.game.inventory.GenshinItem
;
import
emu.grasscutter.game.inventory.GameItem
;
import
emu.grasscutter.game.player.Player
;
public
final
class
DatabaseHelper
{
public
final
class
DatabaseHelper
{
public
static
Account
createAccount
(
String
username
)
{
public
static
Account
createAccount
(
String
username
)
{
...
@@ -26,7 +26,7 @@ public final class DatabaseHelper {
...
@@ -26,7 +26,7 @@ public final class DatabaseHelper {
// Make sure there are no id collisions
// Make sure there are no id collisions
if
(
reservedId
>
0
)
{
if
(
reservedId
>
0
)
{
// Cannot make account with the same uid as the server console
// Cannot make account with the same uid as the server console
if
(
reservedId
==
G
enshin
Constants
.
SERVER_CONSOLE_UID
)
{
if
(
reservedId
==
G
ame
Constants
.
SERVER_CONSOLE_UID
)
{
return
null
;
return
null
;
}
}
exists
=
DatabaseHelper
.
getAccountByPlayerId
(
reservedId
);
exists
=
DatabaseHelper
.
getAccountByPlayerId
(
reservedId
);
...
@@ -90,15 +90,19 @@ public final class DatabaseHelper {
...
@@ -90,15 +90,19 @@ public final class DatabaseHelper {
return
DatabaseManager
.
getDatastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"username"
,
username
)).
delete
().
getDeletedCount
()
>
0
;
return
DatabaseManager
.
getDatastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"username"
,
username
)).
delete
().
getDeletedCount
()
>
0
;
}
}
public
static
GenshinPlayer
getPlayerById
(
int
id
)
{
public
static
List
<
Player
>
getAllPlayers
()
{
return
DatabaseManager
.
getDatastore
().
find
(
GenshinPlayer
.
class
).
filter
(
Filters
.
eq
(
"_id"
,
id
)).
first
();
return
DatabaseManager
.
getDatastore
().
find
(
Player
.
class
).
stream
().
toList
();
}
public
static
Player
getPlayerById
(
int
id
)
{
return
DatabaseManager
.
getDatastore
().
find
(
Player
.
class
).
filter
(
Filters
.
eq
(
"_id"
,
id
)).
first
();
}
}
public
static
boolean
checkPlayerExists
(
int
id
)
{
public
static
boolean
checkPlayerExists
(
int
id
)
{
return
DatabaseManager
.
getDatastore
().
find
(
Genshin
Player
.
class
).
filter
(
Filters
.
eq
(
"_id"
,
id
)).
first
()
!=
null
;
return
DatabaseManager
.
getDatastore
().
find
(
Player
.
class
).
filter
(
Filters
.
eq
(
"_id"
,
id
)).
first
()
!=
null
;
}
}
public
static
synchronized
Genshin
Player
createPlayer
(
Genshin
Player
character
,
int
reservedId
)
{
public
static
synchronized
Player
createPlayer
(
Player
character
,
int
reservedId
)
{
// Check if reserved id
// Check if reserved id
int
id
;
int
id
;
if
(
reservedId
>
0
&&
!
checkPlayerExists
(
reservedId
))
{
if
(
reservedId
>
0
&&
!
checkPlayerExists
(
reservedId
))
{
...
@@ -123,42 +127,42 @@ public final class DatabaseHelper {
...
@@ -123,42 +127,42 @@ public final class DatabaseHelper {
id
=
reservedId
;
id
=
reservedId
;
}
else
{
}
else
{
do
{
do
{
id
=
DatabaseManager
.
getNextId
(
Genshin
Player
.
class
);
id
=
DatabaseManager
.
getNextId
(
Player
.
class
);
}
}
while
(
checkPlayerExists
(
id
));
while
(
checkPlayerExists
(
id
));
}
}
return
id
;
return
id
;
}
}
public
static
void
savePlayer
(
Genshin
Player
character
)
{
public
static
void
savePlayer
(
Player
character
)
{
DatabaseManager
.
getDatastore
().
save
(
character
);
DatabaseManager
.
getDatastore
().
save
(
character
);
}
}
public
static
void
saveAvatar
(
Genshin
Avatar
avatar
)
{
public
static
void
saveAvatar
(
Avatar
avatar
)
{
DatabaseManager
.
getDatastore
().
save
(
avatar
);
DatabaseManager
.
getDatastore
().
save
(
avatar
);
}
}
public
static
List
<
Genshin
Avatar
>
getAvatars
(
Genshin
Player
player
)
{
public
static
List
<
Avatar
>
getAvatars
(
Player
player
)
{
return
DatabaseManager
.
getDatastore
().
find
(
Genshin
Avatar
.
class
).
filter
(
Filters
.
eq
(
"ownerId"
,
player
.
getUid
())).
stream
().
toList
();
return
DatabaseManager
.
getDatastore
().
find
(
Avatar
.
class
).
filter
(
Filters
.
eq
(
"ownerId"
,
player
.
getUid
())).
stream
().
toList
();
}
}
public
static
void
saveItem
(
G
enshin
Item
item
)
{
public
static
void
saveItem
(
G
ame
Item
item
)
{
DatabaseManager
.
getDatastore
().
save
(
item
);
DatabaseManager
.
getDatastore
().
save
(
item
);
}
}
public
static
boolean
deleteItem
(
G
enshin
Item
item
)
{
public
static
boolean
deleteItem
(
G
ame
Item
item
)
{
DeleteResult
result
=
DatabaseManager
.
getDatastore
().
delete
(
item
);
DeleteResult
result
=
DatabaseManager
.
getDatastore
().
delete
(
item
);
return
result
.
wasAcknowledged
();
return
result
.
wasAcknowledged
();
}
}
public
static
List
<
G
enshin
Item
>
getInventoryItems
(
Genshin
Player
player
)
{
public
static
List
<
G
ame
Item
>
getInventoryItems
(
Player
player
)
{
return
DatabaseManager
.
getDatastore
().
find
(
G
enshin
Item
.
class
).
filter
(
Filters
.
eq
(
"ownerId"
,
player
.
getUid
())).
stream
().
toList
();
return
DatabaseManager
.
getDatastore
().
find
(
G
ame
Item
.
class
).
filter
(
Filters
.
eq
(
"ownerId"
,
player
.
getUid
())).
stream
().
toList
();
}
}
public
static
List
<
Friendship
>
getFriends
(
Genshin
Player
player
)
{
public
static
List
<
Friendship
>
getFriends
(
Player
player
)
{
return
DatabaseManager
.
getDatastore
().
find
(
Friendship
.
class
).
filter
(
Filters
.
eq
(
"ownerId"
,
player
.
getUid
())).
stream
().
toList
();
return
DatabaseManager
.
getDatastore
().
find
(
Friendship
.
class
).
filter
(
Filters
.
eq
(
"ownerId"
,
player
.
getUid
())).
stream
().
toList
();
}
}
public
static
List
<
Friendship
>
getReverseFriends
(
Genshin
Player
player
)
{
public
static
List
<
Friendship
>
getReverseFriends
(
Player
player
)
{
return
DatabaseManager
.
getDatastore
().
find
(
Friendship
.
class
).
filter
(
Filters
.
eq
(
"friendId"
,
player
.
getUid
())).
stream
().
toList
();
return
DatabaseManager
.
getDatastore
().
find
(
Friendship
.
class
).
filter
(
Filters
.
eq
(
"friendId"
,
player
.
getUid
())).
stream
().
toList
();
}
}
...
...
src/main/java/emu/grasscutter/database/DatabaseManager.java
View file @
9fc8cc1c
...
@@ -13,10 +13,10 @@ import dev.morphia.mapping.MapperOptions;
...
@@ -13,10 +13,10 @@ import dev.morphia.mapping.MapperOptions;
import
dev.morphia.query.experimental.filters.Filters
;
import
dev.morphia.query.experimental.filters.Filters
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.Account
;
import
emu.grasscutter.game.Account
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.avatar.Avatar
;
import
emu.grasscutter.game.avatar.GenshinAvatar
;
import
emu.grasscutter.game.friends.Friendship
;
import
emu.grasscutter.game.friends.Friendship
;
import
emu.grasscutter.game.inventory.GenshinItem
;
import
emu.grasscutter.game.inventory.GameItem
;
import
emu.grasscutter.game.player.Player
;
public
final
class
DatabaseManager
{
public
final
class
DatabaseManager
{
...
@@ -27,7 +27,7 @@ public final class DatabaseManager {
...
@@ -27,7 +27,7 @@ public final class DatabaseManager {
private
static
Datastore
dispatchDatastore
;
private
static
Datastore
dispatchDatastore
;
private
static
final
Class
<?>[]
mappedClasses
=
new
Class
<?>[]
{
private
static
final
Class
<?>[]
mappedClasses
=
new
Class
<?>[]
{
DatabaseCounter
.
class
,
Account
.
class
,
Genshin
Player
.
class
,
Genshin
Avatar
.
class
,
G
enshin
Item
.
class
,
Friendship
.
class
DatabaseCounter
.
class
,
Account
.
class
,
Player
.
class
,
Avatar
.
class
,
G
ame
Item
.
class
,
Friendship
.
class
};
};
public
static
Datastore
getDatastore
()
{
public
static
Datastore
getDatastore
()
{
...
...
src/main/java/emu/grasscutter/game/CoopRequest.java
View file @
9fc8cc1c
package
emu.grasscutter.game
;
package
emu.grasscutter.game
;
import
emu.grasscutter.game.player.Player
;
public
class
CoopRequest
{
public
class
CoopRequest
{
private
final
Genshin
Player
requester
;
private
final
Player
requester
;
private
final
long
requestTime
;
private
final
long
requestTime
;
private
final
long
expireTime
;
private
final
long
expireTime
;
public
CoopRequest
(
Genshin
Player
requester
)
{
public
CoopRequest
(
Player
requester
)
{
this
.
requester
=
requester
;
this
.
requester
=
requester
;
this
.
requestTime
=
System
.
currentTimeMillis
();
this
.
requestTime
=
System
.
currentTimeMillis
();
this
.
expireTime
=
this
.
requestTime
+
10000
;
this
.
expireTime
=
this
.
requestTime
+
10000
;
}
}
public
Genshin
Player
getRequester
()
{
public
Player
getRequester
()
{
return
requester
;
return
requester
;
}
}
...
...
Prev
1
2
3
4
5
6
7
8
…
15
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