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
1c36f078
Commit
1c36f078
authored
Apr 26, 2022
by
Melledy
Browse files
Renamed all references to a certain game
parent
6b8902be
Changes
270
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/data/def/ReliquaryMainPropData.java
View file @
1c36f078
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.game.props.FightProperty
;
@ResourceType
(
name
=
"ReliquaryMainPropExcelConfigData.json"
)
public
class
ReliquaryMainPropData
extends
G
enshin
Resource
{
public
class
ReliquaryMainPropData
extends
G
ame
Resource
{
private
int
Id
;
private
int
PropDepotId
;
...
...
src/main/java/emu/grasscutter/data/def/ReliquarySetData.java
View file @
1c36f078
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
@ResourceType
(
name
=
"ReliquarySetExcelConfigData.json"
)
public
class
ReliquarySetData
extends
G
enshin
Resource
{
public
class
ReliquarySetData
extends
G
ame
Resource
{
private
int
SetId
;
private
int
[]
SetNeedNum
;
private
int
EquipAffixId
;
...
...
src/main/java/emu/grasscutter/data/def/RewardData.java
View file @
1c36f078
...
...
@@ -2,12 +2,12 @@ package emu.grasscutter.data.def;
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.common.RewardItemData
;
@ResourceType
(
name
=
"RewardExcelConfigData.json"
)
public
class
RewardData
extends
G
enshin
Resource
{
public
class
RewardData
extends
G
ame
Resource
{
public
int
RewardId
;
public
List
<
RewardItemData
>
RewardItemList
;
...
...
src/main/java/emu/grasscutter/data/def/SceneData.java
View file @
1c36f078
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.G
enshin
Data
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Data
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.game.props.SceneType
;
@ResourceType
(
name
=
"SceneExcelConfigData.json"
)
public
class
SceneData
extends
G
enshin
Resource
{
public
class
SceneData
extends
G
ame
Resource
{
private
int
Id
;
private
SceneType
SceneType
;
private
String
ScriptData
;
...
...
src/main/java/emu/grasscutter/data/def/WeaponCurveData.java
View file @
1c36f078
...
...
@@ -4,12 +4,12 @@ import java.util.HashMap;
import
java.util.Map
;
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.common.CurveInfo
;
@ResourceType
(
name
=
"WeaponCurveExcelConfigData.json"
)
public
class
WeaponCurveData
extends
G
enshin
Resource
{
public
class
WeaponCurveData
extends
G
ame
Resource
{
private
int
Level
;
private
CurveInfo
[]
CurveInfos
;
...
...
src/main/java/emu/grasscutter/data/def/WeaponLevelData.java
View file @
1c36f078
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
@ResourceType
(
name
=
"WeaponLevelExcelConfigData.json"
)
public
class
WeaponLevelData
extends
G
enshin
Resource
{
public
class
WeaponLevelData
extends
G
ame
Resource
{
private
int
Level
;
private
int
[]
RequiredExps
;
...
...
src/main/java/emu/grasscutter/data/def/WeaponPromoteData.java
View file @
1c36f078
package
emu.grasscutter.data.def
;
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.common.FightPropData
;
import
emu.grasscutter.data.common.ItemParamData
;
@ResourceType
(
name
=
"WeaponPromoteExcelConfigData.json"
)
public
class
WeaponPromoteData
extends
G
enshin
Resource
{
public
class
WeaponPromoteData
extends
G
ame
Resource
{
private
int
WeaponPromoteId
;
private
int
PromoteLevel
;
...
...
src/main/java/emu/grasscutter/data/def/WorldLevelData.java
View file @
1c36f078
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.ResourceType
;
@ResourceType
(
name
=
"WorldLevelExcelConfigData.json"
)
public
class
WorldLevelData
extends
G
enshin
Resource
{
public
class
WorldLevelData
extends
G
ame
Resource
{
private
int
Level
;
private
int
MonsterLevel
;
...
...
src/main/java/emu/grasscutter/database/DatabaseHelper.java
View file @
1c36f078
...
...
@@ -4,12 +4,12 @@ import java.util.List;
import
com.mongodb.client.result.DeleteResult
;
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.
Genshin
Player
;
import
emu.grasscutter.game.avatar.
Genshin
Avatar
;
import
emu.grasscutter.game.Player
;
import
emu.grasscutter.game.avatar.Avatar
;
import
emu.grasscutter.game.friends.Friendship
;
import
emu.grasscutter.game.inventory.G
enshin
Item
;
import
emu.grasscutter.game.inventory.G
ame
Item
;
public
final
class
DatabaseHelper
{
public
static
Account
createAccount
(
String
username
)
{
...
...
@@ -26,7 +26,7 @@ public final class DatabaseHelper {
// Make sure there are no id collisions
if
(
reservedId
>
0
)
{
// 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
;
}
exists
=
DatabaseHelper
.
getAccountByPlayerId
(
reservedId
);
...
...
@@ -90,19 +90,19 @@ public final class DatabaseHelper {
return
DatabaseManager
.
getDatastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"username"
,
username
)).
delete
().
getDeletedCount
()
>
0
;
}
public
static
List
<
Genshin
Player
>
getAllPlayers
()
{
return
DatabaseManager
.
getDatastore
().
find
(
Genshin
Player
.
class
).
stream
().
toList
();
public
static
List
<
Player
>
getAllPlayers
()
{
return
DatabaseManager
.
getDatastore
().
find
(
Player
.
class
).
stream
().
toList
();
}
public
static
Genshin
Player
getPlayerById
(
int
id
)
{
return
DatabaseManager
.
getDatastore
().
find
(
Genshin
Player
.
class
).
filter
(
Filters
.
eq
(
"_id"
,
id
)).
first
();
public
static
Player
getPlayerById
(
int
id
)
{
return
DatabaseManager
.
getDatastore
().
find
(
Player
.
class
).
filter
(
Filters
.
eq
(
"_id"
,
id
)).
first
();
}
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
int
id
;
if
(
reservedId
>
0
&&
!
checkPlayerExists
(
reservedId
))
{
...
...
@@ -127,42 +127,42 @@ public final class DatabaseHelper {
id
=
reservedId
;
}
else
{
do
{
id
=
DatabaseManager
.
getNextId
(
Genshin
Player
.
class
);
id
=
DatabaseManager
.
getNextId
(
Player
.
class
);
}
while
(
checkPlayerExists
(
id
));
}
return
id
;
}
public
static
void
savePlayer
(
Genshin
Player
character
)
{
public
static
void
savePlayer
(
Player
character
)
{
DatabaseManager
.
getDatastore
().
save
(
character
);
}
public
static
void
saveAvatar
(
Genshin
Avatar
avatar
)
{
public
static
void
saveAvatar
(
Avatar
avatar
)
{
DatabaseManager
.
getDatastore
().
save
(
avatar
);
}
public
static
List
<
Genshin
Avatar
>
getAvatars
(
Genshin
Player
player
)
{
return
DatabaseManager
.
getDatastore
().
find
(
Genshin
Avatar
.
class
).
filter
(
Filters
.
eq
(
"ownerId"
,
player
.
getUid
())).
stream
().
toList
();
public
static
List
<
Avatar
>
getAvatars
(
Player
player
)
{
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
);
}
public
static
boolean
deleteItem
(
G
enshin
Item
item
)
{
public
static
boolean
deleteItem
(
G
ame
Item
item
)
{
DeleteResult
result
=
DatabaseManager
.
getDatastore
().
delete
(
item
);
return
result
.
wasAcknowledged
();
}
public
static
List
<
G
enshin
Item
>
getInventoryItems
(
Genshin
Player
player
)
{
return
DatabaseManager
.
getDatastore
().
find
(
G
enshin
Item
.
class
).
filter
(
Filters
.
eq
(
"ownerId"
,
player
.
getUid
())).
stream
().
toList
();
public
static
List
<
G
ame
Item
>
getInventoryItems
(
Player
player
)
{
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
();
}
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
();
}
...
...
src/main/java/emu/grasscutter/database/DatabaseManager.java
View file @
1c36f078
...
...
@@ -13,10 +13,10 @@ import dev.morphia.mapping.MapperOptions;
import
dev.morphia.query.experimental.filters.Filters
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.Account
;
import
emu.grasscutter.game.
Genshin
Player
;
import
emu.grasscutter.game.avatar.
Genshin
Avatar
;
import
emu.grasscutter.game.Player
;
import
emu.grasscutter.game.avatar.Avatar
;
import
emu.grasscutter.game.friends.Friendship
;
import
emu.grasscutter.game.inventory.G
enshin
Item
;
import
emu.grasscutter.game.inventory.G
ame
Item
;
public
final
class
DatabaseManager
{
...
...
@@ -27,7 +27,7 @@ public final class DatabaseManager {
private
static
Datastore
dispatchDatastore
;
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
()
{
...
...
src/main/java/emu/grasscutter/game/CoopRequest.java
View file @
1c36f078
package
emu.grasscutter.game
;
public
class
CoopRequest
{
private
final
Genshin
Player
requester
;
private
final
Player
requester
;
private
final
long
requestTime
;
private
final
long
expireTime
;
public
CoopRequest
(
Genshin
Player
requester
)
{
public
CoopRequest
(
Player
requester
)
{
this
.
requester
=
requester
;
this
.
requestTime
=
System
.
currentTimeMillis
();
this
.
expireTime
=
this
.
requestTime
+
10000
;
}
public
Genshin
Player
getRequester
()
{
public
Player
getRequester
()
{
return
requester
;
}
...
...
src/main/java/emu/grasscutter/game/InvokeHandler.java
View file @
1c36f078
...
...
@@ -2,16 +2,16 @@ package emu.grasscutter.game;
import
java.util.ArrayList
;
import
java.util.List
;
import
emu.grasscutter.net.packet.
Genshin
Packet
;
import
emu.grasscutter.net.packet.
Base
Packet
;
import
emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType
;
public
class
InvokeHandler
<
T
>
{
private
final
List
<
T
>
entryListForwardAll
;
private
final
List
<
T
>
entryListForwardAllExceptCur
;
private
final
List
<
T
>
entryListForwardHost
;
private
final
Class
<?
extends
Genshin
Packet
>
packetClass
;
private
final
Class
<?
extends
Base
Packet
>
packetClass
;
public
InvokeHandler
(
Class
<?
extends
Genshin
Packet
>
packetClass
)
{
public
InvokeHandler
(
Class
<?
extends
Base
Packet
>
packetClass
)
{
this
.
entryListForwardAll
=
new
ArrayList
<>();
this
.
entryListForwardAllExceptCur
=
new
ArrayList
<>();
this
.
entryListForwardHost
=
new
ArrayList
<>();
...
...
@@ -28,7 +28,7 @@ public class InvokeHandler<T> {
}
}
public
synchronized
void
update
(
Genshin
Player
player
)
{
public
synchronized
void
update
(
Player
player
)
{
if
(
player
.
getWorld
()
==
null
)
{
this
.
entryListForwardAll
.
clear
();
this
.
entryListForwardAllExceptCur
.
clear
();
...
...
@@ -38,17 +38,17 @@ public class InvokeHandler<T> {
try
{
if
(
entryListForwardAll
.
size
()
>
0
)
{
Genshin
Packet
packet
=
packetClass
.
getDeclaredConstructor
(
List
.
class
).
newInstance
(
this
.
entryListForwardAll
);
Base
Packet
packet
=
packetClass
.
getDeclaredConstructor
(
List
.
class
).
newInstance
(
this
.
entryListForwardAll
);
player
.
getScene
().
broadcastPacket
(
packet
);
this
.
entryListForwardAll
.
clear
();
}
if
(
entryListForwardAllExceptCur
.
size
()
>
0
)
{
Genshin
Packet
packet
=
packetClass
.
getDeclaredConstructor
(
List
.
class
).
newInstance
(
this
.
entryListForwardAllExceptCur
);
Base
Packet
packet
=
packetClass
.
getDeclaredConstructor
(
List
.
class
).
newInstance
(
this
.
entryListForwardAllExceptCur
);
player
.
getScene
().
broadcastPacketToOthers
(
player
,
packet
);
this
.
entryListForwardAllExceptCur
.
clear
();
}
if
(
entryListForwardHost
.
size
()
>
0
)
{
Genshin
Packet
packet
=
packetClass
.
getDeclaredConstructor
(
List
.
class
).
newInstance
(
this
.
entryListForwardHost
);
Base
Packet
packet
=
packetClass
.
getDeclaredConstructor
(
List
.
class
).
newInstance
(
this
.
entryListForwardHost
);
player
.
getWorld
().
getHost
().
sendPacket
(
packet
);
this
.
entryListForwardHost
.
clear
();
}
...
...
src/main/java/emu/grasscutter/game/Mail.java
View file @
1c36f078
...
...
@@ -57,7 +57,7 @@ public class Mail {
this
(
title
,
content
,
"Server"
);
}
public
MailContent
(
String
title
,
String
content
,
Genshin
Player
sender
)
{
public
MailContent
(
String
title
,
String
content
,
Player
sender
)
{
this
(
title
,
content
,
sender
.
getNickname
());
}
...
...
src/main/java/emu/grasscutter/game/
Genshin
Player.java
→
src/main/java/emu/grasscutter/game/Player.java
View file @
1c36f078
...
...
@@ -4,26 +4,26 @@ import java.time.Instant;
import
java.util.*
;
import
dev.morphia.annotations.*
;
import
emu.grasscutter.G
enshin
Constants
;
import
emu.grasscutter.G
ame
Constants
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.data.G
enshin
Data
;
import
emu.grasscutter.data.G
ame
Data
;
import
emu.grasscutter.data.def.PlayerLevelData
;
import
emu.grasscutter.database.DatabaseHelper
;
import
emu.grasscutter.game.avatar.AvatarProfileData
;
import
emu.grasscutter.game.avatar.AvatarStorage
;
import
emu.grasscutter.game.avatar.
Genshin
Avatar
;
import
emu.grasscutter.game.avatar.Avatar
;
import
emu.grasscutter.game.entity.EntityItem
;
import
emu.grasscutter.game.entity.G
enshin
Entity
;
import
emu.grasscutter.game.entity.G
ame
Entity
;
import
emu.grasscutter.game.friends.FriendsList
;
import
emu.grasscutter.game.friends.PlayerProfile
;
import
emu.grasscutter.game.gacha.PlayerGachaInfo
;
import
emu.grasscutter.game.inventory.G
enshin
Item
;
import
emu.grasscutter.game.inventory.G
ame
Item
;
import
emu.grasscutter.game.inventory.Inventory
;
import
emu.grasscutter.game.player.PlayerBirthday
;
import
emu.grasscutter.game.props.ActionReason
;
import
emu.grasscutter.game.props.PlayerProperty
;
import
emu.grasscutter.net.packet.
Genshin
Packet
;
import
emu.grasscutter.net.packet.
Base
Packet
;
import
emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry
;
import
emu.grasscutter.net.proto.CombatInvokeEntryOuterClass.CombatInvokeEntry
;
import
emu.grasscutter.net.proto.HeadImageOuterClass.HeadImage
;
...
...
@@ -46,7 +46,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import
java.util.*
;
@Entity
(
value
=
"players"
,
useDiscriminator
=
false
)
public
class
Genshin
Player
{
public
class
Player
{
@Id
private
int
id
;
@Indexed
(
options
=
@IndexOptions
(
unique
=
true
))
private
String
accountId
;
...
...
@@ -67,7 +67,7 @@ public class GenshinPlayer {
@Transient
private
long
nextGuid
=
0
;
@Transient
private
int
peerId
;
@Transient
private
World
world
;
@Transient
private
Genshin
Scene
scene
;
@Transient
private
Scene
scene
;
@Transient
private
GameSession
session
;
@Transient
private
AvatarStorage
avatars
;
@Transient
private
Inventory
inventory
;
...
...
@@ -104,7 +104,7 @@ public class GenshinPlayer {
@Deprecated
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
// Morphia only!
public
Genshin
Player
()
{
public
Player
()
{
this
.
inventory
=
new
Inventory
(
this
);
this
.
avatars
=
new
AvatarStorage
(
this
);
this
.
friendsList
=
new
FriendsList
(
this
);
...
...
@@ -140,7 +140,7 @@ public class GenshinPlayer {
}
// On player creation
public
Genshin
Player
(
GameSession
session
)
{
public
Player
(
GameSession
session
)
{
this
();
this
.
account
=
session
.
getAccount
();
this
.
accountId
=
this
.
getAccount
().
getId
();
...
...
@@ -159,7 +159,7 @@ public class GenshinPlayer {
this
.
setProperty
(
PlayerProperty
.
PROP_PLAYER_RESIN
,
160
);
this
.
getFlyCloakList
().
add
(
140001
);
this
.
getNameCardList
().
add
(
210001
);
this
.
getPos
().
set
(
G
enshin
Constants
.
START_POSITION
);
this
.
getPos
().
set
(
G
ame
Constants
.
START_POSITION
);
this
.
getRotation
().
set
(
0
,
307
,
0
);
}
...
...
@@ -171,7 +171,7 @@ public class GenshinPlayer {
this
.
id
=
id
;
}
public
long
getNextG
enshin
Guid
()
{
public
long
getNextG
ame
Guid
()
{
long
nextId
=
++
this
.
nextGuid
;
return
((
long
)
this
.
getUid
()
<<
32
)
+
nextId
;
}
...
...
@@ -209,11 +209,11 @@ public class GenshinPlayer {
this
.
world
=
world
;
}
public
synchronized
Genshin
Scene
getScene
()
{
public
synchronized
Scene
getScene
()
{
return
scene
;
}
public
synchronized
void
setScene
(
Genshin
Scene
scene
)
{
public
synchronized
void
setScene
(
Scene
scene
)
{
this
.
scene
=
scene
;
}
...
...
@@ -292,7 +292,7 @@ public class GenshinPlayer {
}
private
int
getExpRequired
(
int
level
)
{
PlayerLevelData
levelData
=
G
enshin
Data
.
getPlayerLevelDataMap
().
get
(
level
);
PlayerLevelData
levelData
=
G
ame
Data
.
getPlayerLevelDataMap
().
get
(
level
);
return
levelData
!=
null
?
levelData
.
getExp
()
:
0
;
}
...
...
@@ -546,9 +546,9 @@ public class GenshinPlayer {
}
public
void
rechargeMoonCard
()
{
LinkedList
<
G
enshin
Item
>
items
=
new
LinkedList
<
G
enshin
Item
>();
LinkedList
<
G
ame
Item
>
items
=
new
LinkedList
<
G
ame
Item
>();
for
(
int
i
=
0
;
i
<
300
;
i
++)
{
items
.
add
(
new
G
enshin
Item
(
203
));
items
.
add
(
new
G
ame
Item
(
203
));
}
inventory
.
addItems
(
items
);
if
(!
moonCard
)
{
...
...
@@ -583,8 +583,8 @@ public class GenshinPlayer {
}
moonCardGetTimes
.
add
(
now
);
addMoonCardDays
(
1
);
G
enshinItem
genshinI
tem
=
new
G
enshin
Item
(
201
,
90
);
getInventory
().
addItem
(
genshinI
tem
,
ActionReason
.
BlessingRedeemReward
);
G
ameItem
i
tem
=
new
G
ame
Item
(
201
,
90
);
getInventory
().
addItem
(
i
tem
,
ActionReason
.
BlessingRedeemReward
);
session
.
send
(
new
PacketCardProductRewardNotify
(
getMoonCardRemainDays
()));
}
...
...
@@ -604,29 +604,19 @@ public class GenshinPlayer {
this
.
hasSentAvatarDataNotify
=
hasSentAvatarDataNotify
;
}
public
void
addAvatar
(
Genshin
Avatar
avatar
)
{
public
void
addAvatar
(
Avatar
avatar
)
{
boolean
result
=
getAvatars
().
addAvatar
(
avatar
);
if
(
result
)
{
// Add starting weapon
getAvatars
().
addStartingWeapon
(
avatar
);
// Try adding to team if possible
//List<EntityAvatar> currentTeam = this.getTeamManager().getCurrentTeam();
boolean
addedToTeam
=
false
;
/*
if (currentTeam.size() <= GenshinConstants.MAX_AVATARS_IN_TEAM) {
addedToTeam = currentTeam
}
*/
// Done
if
(
hasSentAvatarDataNotify
())
{
// Recalc stats
avatar
.
recalcStats
();
// Packet
sendPacket
(
new
PacketAvatarAddNotify
(
avatar
,
addedToTeam
));
sendPacket
(
new
PacketAvatarAddNotify
(
avatar
,
false
));
}
}
else
{
// Failed adding avatar
...
...
@@ -659,7 +649,7 @@ public class GenshinPlayer {
}
public
void
dropMessage
(
Object
message
)
{
this
.
sendPacket
(
new
PacketPrivateChatNotify
(
G
enshin
Constants
.
SERVER_CONSOLE_UID
,
getUid
(),
message
.
toString
()));
this
.
sendPacket
(
new
PacketPrivateChatNotify
(
G
ame
Constants
.
SERVER_CONSOLE_UID
,
getUid
(),
message
.
toString
()));
}
/**
...
...
@@ -668,7 +658,7 @@ public class GenshinPlayer {
* @param sender The sender of the message.
* @param message The message to send.
*/
public
void
sendMessage
(
Genshin
Player
sender
,
Object
message
)
{
public
void
sendMessage
(
Player
sender
,
Object
message
)
{
this
.
sendPacket
(
new
PacketPrivateChatNotify
(
sender
.
getUid
(),
this
.
getUid
(),
message
.
toString
()));
}
...
...
@@ -714,7 +704,7 @@ public class GenshinPlayer {
}
public
void
interactWith
(
int
gadgetEntityId
)
{
G
enshin
Entity
entity
=
getScene
().
getEntityById
(
gadgetEntityId
);
G
ame
Entity
entity
=
getScene
().
getEntityById
(
gadgetEntityId
);
if
(
entity
==
null
)
{
return
;
...
...
@@ -727,7 +717,7 @@ public class GenshinPlayer {
if
(
entity
instanceof
EntityItem
)
{
// Pick item
EntityItem
drop
=
(
EntityItem
)
entity
;
G
enshin
Item
item
=
new
G
enshin
Item
(
drop
.
getItemData
(),
drop
.
getCount
());
G
ame
Item
item
=
new
G
ame
Item
(
drop
.
getItemData
(),
drop
.
getCount
());
// Add to inventory
boolean
success
=
getInventory
().
addItem
(
item
,
ActionReason
.
SubfieldDrop
);
if
(
success
)
{
...
...
@@ -746,7 +736,7 @@ public class GenshinPlayer {
}
public
void
sendPacket
(
Genshin
Packet
packet
)
{
public
void
sendPacket
(
Base
Packet
packet
)
{
if
(
this
.
hasSentAvatarDataNotify
)
{
this
.
getSession
().
send
(
packet
);
}
...
...
@@ -875,7 +865,7 @@ public class GenshinPlayer {
// Check if player object exists in server
// TODO - optimize
Genshin
Player
exists
=
this
.
getServer
().
getPlayerByUid
(
getUid
());
Player
exists
=
this
.
getServer
().
getPlayerByUid
(
getUid
());
if
(
exists
!=
null
)
{
exists
.
getSession
().
close
();
}
...
...
src/main/java/emu/grasscutter/game/
Genshin
Scene.java
→
src/main/java/emu/grasscutter/game/Scene.java
View file @
1c36f078
...
...
@@ -12,9 +12,9 @@ import java.util.Set;
import
org.danilopianini.util.SpatialIndex
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.data.G
enshin
Data
;
import
emu.grasscutter.data.G
enshin
Depot
;
import
emu.grasscutter.data.G
enshin
Resource
;
import
emu.grasscutter.data.G
ame
Data
;
import
emu.grasscutter.data.G
ame
Depot
;
import
emu.grasscutter.data.G
ame
Resource
;
import
emu.grasscutter.data.def.MonsterData
;
import
emu.grasscutter.data.def.SceneData
;
import
emu.grasscutter.data.def.WorldLevelData
;
...
...
@@ -22,14 +22,14 @@ import emu.grasscutter.game.entity.EntityAvatar;
import
emu.grasscutter.game.entity.EntityClientGadget
;
import
emu.grasscutter.game.entity.EntityGadget
;
import
emu.grasscutter.game.entity.EntityMonster
;
import
emu.grasscutter.game.entity.G
enshin
Entity
;
import
emu.grasscutter.game.entity.G
ame
Entity
;
import
emu.grasscutter.game.props.ClimateType
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.game.props.LifeState
;
import
emu.grasscutter.game.props.SceneType
;
import
emu.grasscutter.game.world.SpawnDataEntry
;
import
emu.grasscutter.game.world.SpawnDataEntry.SpawnGroupEntry
;
import
emu.grasscutter.net.packet.
Genshin
Packet
;
import
emu.grasscutter.net.packet.
Base
Packet
;
import
emu.grasscutter.net.proto.AttackResultOuterClass.AttackResult
;
import
emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType
;
import
emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify
;
...
...
@@ -41,11 +41,11 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import
it.unimi.dsi.fastutil.ints.Int2ObjectMaps
;
import
it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
;
public
class
Genshin
Scene
{
public
class
Scene
{
private
final
World
world
;
private
final
SceneData
sceneData
;
private
final
List
<
Genshin
Player
>
players
;
private
final
Int2ObjectMap
<
G
enshin
Entity
>
entities
;
private
final
List
<
Player
>
players
;
private
final
Int2ObjectMap
<
G
ame
Entity
>
entities
;
private
final
Set
<
SpawnDataEntry
>
spawnedEntities
;
private
final
Set
<
SpawnDataEntry
>
deadSpawnedEntities
;
...
...
@@ -55,7 +55,7 @@ public class GenshinScene {
private
ClimateType
climate
;
private
int
weather
;
public
Genshin
Scene
(
World
world
,
SceneData
sceneData
)
{
public
Scene
(
World
world
,
SceneData
sceneData
)
{
this
.
world
=
world
;
this
.
sceneData
=
sceneData
;
this
.
players
=
Collections
.
synchronizedList
(
new
ArrayList
<>());
...
...
@@ -84,7 +84,7 @@ public class GenshinScene {
return
getSceneData
().
getSceneType
();
}
public
List
<
Genshin
Player
>
getPlayers
()
{
public
List
<
Player
>
getPlayers
()
{
return
players
;
}
...
...
@@ -92,11 +92,11 @@ public class GenshinScene {
return
this
.
getPlayers
().
size
();
}
public
Int2ObjectMap
<
G
enshin
Entity
>
getEntities
()
{
public
Int2ObjectMap
<
G
ame
Entity
>
getEntities
()
{
return
entities
;
}
public
G
enshin
Entity
getEntityById
(
int
id
)
{
public
G
ame
Entity
getEntityById
(
int
id
)
{
return
this
.
entities
.
get
(
id
);
}
...
...
@@ -140,11 +140,11 @@ public class GenshinScene {
return
deadSpawnedEntities
;
}
public
boolean
isInScene
(
G
enshin
Entity
entity
)
{
public
boolean
isInScene
(
G
ame
Entity
entity
)
{
return
this
.
entities
.
containsKey
(
entity
.
getId
());
}
public
synchronized
void
addPlayer
(
Genshin
Player
player
)
{
public
synchronized
void
addPlayer
(
Player
player
)
{
// Check if player already in
if
(
getPlayers
().
contains
(
player
))
{
return
;
...
...
@@ -163,7 +163,7 @@ public class GenshinScene {
this
.
setupPlayerAvatars
(
player
);
}
public
synchronized
void
removePlayer
(
Genshin
Player
player
)
{
public
synchronized
void
removePlayer
(
Player
player
)
{
// Remove player from scene
getPlayers
().
remove
(
player
);
player
.
setScene
(
null
);
...
...
@@ -182,7 +182,7 @@ public class GenshinScene {
}
}
private
void
setupPlayerAvatars
(
Genshin
Player
player
)
{
private
void
setupPlayerAvatars
(
Player
player
)
{
// Clear entities from old team
player
.
getTeamManager
().
getActiveTeam
().
clear
();
...
...
@@ -199,7 +199,7 @@ public class GenshinScene {
}
}
private
void
removePlayerAvatars
(
Genshin
Player
player
)
{
private
void
removePlayerAvatars
(
Player
player
)
{
Iterator
<
EntityAvatar
>
it
=
player
.
getTeamManager
().
getActiveTeam
().
iterator
();
while
(
it
.
hasNext
())
{
this
.
removeEntity
(
it
.
next
(),
VisionType
.
VISION_REMOVE
);
...
...
@@ -207,7 +207,7 @@ public class GenshinScene {
}
}
public
void
spawnPlayer
(
Genshin
Player
player
)
{
public
void
spawnPlayer
(
Player
player
)
{
if
(
this
.
isInScene
(
player
.
getTeamManager
().
getCurrentAvatarEntity
()))
{
return
;
}
...
...
@@ -219,33 +219,33 @@ public class GenshinScene {
this
.
addEntity
(
player
.
getTeamManager
().
getCurrentAvatarEntity
());
}
private
void
addEntityDirectly
(
G
enshin
Entity
entity
)
{
private
void
addEntityDirectly
(
G
ame
Entity
entity
)
{
getEntities
().
put
(
entity
.
getId
(),
entity
);
}
public
synchronized
void
addEntity
(
G
enshin
Entity
entity
)
{
public
synchronized
void
addEntity
(
G
ame
Entity
entity
)
{
this
.
addEntityDirectly
(
entity
);
this
.
broadcastPacket
(
new
PacketSceneEntityAppearNotify
(
entity
));
}
public
synchronized
void
addEntities
(
Collection
<
G
enshin
Entity
>
entities
)
{
for
(
G
enshin
Entity
entity
:
entities
)
{
public
synchronized
void
addEntities
(
Collection
<
G
ame
Entity
>
entities
)
{
for
(
G
ame
Entity
entity
:
entities
)
{
this
.
addEntityDirectly
(
entity
);
}
this
.
broadcastPacket
(
new
PacketSceneEntityAppearNotify
(
entities
,
VisionType
.
VISION_BORN
));
}
private
G
enshin
Entity
removeEntityDirectly
(
G
enshin
Entity
entity
)
{
private
G
ame
Entity
removeEntityDirectly
(
G
ame
Entity
entity
)
{
return
getEntities
().
remove
(
entity
.
getId
());
}
public
void
removeEntity
(
G
enshin
Entity
entity
)
{
public
void
removeEntity
(
G
ame
Entity
entity
)
{
this
.
removeEntity
(
entity
,
VisionType
.
VISION_DIE
);
}
public
synchronized
void
removeEntity
(
G
enshin
Entity
entity
,
VisionType
visionType
)
{
G
enshin
Entity
removed
=
this
.
removeEntityDirectly
(
entity
);
public
synchronized
void
removeEntity
(
G
ame
Entity
entity
,
VisionType
visionType
)
{
G
ame
Entity
removed
=
this
.
removeEntityDirectly
(
entity
);
if
(
removed
!=
null
)
{
this
.
broadcastPacket
(
new
PacketSceneEntityDisappearNotify
(
removed
,
visionType
));
}
...
...
@@ -258,11 +258,11 @@ public class GenshinScene {
this
.
broadcastPacket
(
new
PacketSceneEntityAppearNotify
(
newEntity
,
VisionType
.
VISION_REPLACE
,
oldEntity
.
getId
()));
}
public
void
showOtherEntities
(
Genshin
Player
player
)
{
List
<
G
enshin
Entity
>
entities
=
new
LinkedList
<>();
G
enshin
Entity
currentEntity
=
player
.
getTeamManager
().
getCurrentAvatarEntity
();
public
void
showOtherEntities
(
Player
player
)
{
List
<
G
ame
Entity
>
entities
=
new
LinkedList
<>();
G
ame
Entity
currentEntity
=
player
.
getTeamManager
().
getCurrentAvatarEntity
();
for
(
G
enshin
Entity
entity
:
this
.
getEntities
().
values
())
{
for
(
G
ame
Entity
entity
:
this
.
getEntities
().
values
())
{
if
(
entity
==
currentEntity
)
{
continue
;
}
...
...
@@ -273,8 +273,8 @@ public class GenshinScene {
}
public
void
handleAttack
(
AttackResult
result
)
{
//G
enshin
Entity attacker = getEntityById(result.getAttackerId());
G
enshin
Entity
target
=
getEntityById
(
result
.
getDefenseId
());
//G
ame
Entity attacker = getEntityById(result.getAttackerId());
G
ame
Entity
target
=
getEntityById
(
result
.
getDefenseId
());
if
(
target
==
null
)
{
return
;
...
...
@@ -306,7 +306,7 @@ public class GenshinScene {
}
}
public
void
killEntity
(
G
enshin
Entity
target
,
int
attackerId
)
{
public
void
killEntity
(
G
ame
Entity
target
,
int
attackerId
)
{
// Packet
this
.
broadcastPacket
(
new
PacketLifeStateChangeNotify
(
attackerId
,
target
,
LifeState
.
LIFE_DEAD
));
this
.
removeEntity
(
target
);
...
...
@@ -321,10 +321,10 @@ public class GenshinScene {
// TODO - Test
public
void
checkSpawns
()
{
SpatialIndex
<
SpawnGroupEntry
>
list
=
G
enshin
Depot
.
getSpawnListById
(
this
.
getId
());
SpatialIndex
<
SpawnGroupEntry
>
list
=
G
ame
Depot
.
getSpawnListById
(
this
.
getId
());
Set
<
SpawnDataEntry
>
visible
=
new
HashSet
<>();
for
(
Genshin
Player
player
:
this
.
getPlayers
())
{
for
(
Player
player
:
this
.
getPlayers
())
{
int
RANGE
=
100
;
Collection
<
SpawnGroupEntry
>
entries
=
list
.
query
(
new
double
[]
{
player
.
getPos
().
getX
()
-
RANGE
,
player
.
getPos
().
getZ
()
-
RANGE
},
...
...
@@ -339,7 +339,7 @@ public class GenshinScene {
}
// World level
WorldLevelData
worldLevelData
=
G
enshin
Data
.
getWorldLevelDataMap
().
get
(
getWorld
().
getWorldLevel
());
WorldLevelData
worldLevelData
=
G
ame
Data
.
getWorldLevelDataMap
().
get
(
getWorld
().
getWorldLevel
());
int
worldLevelOverride
=
0
;
if
(
worldLevelData
!=
null
)
{
...
...
@@ -347,13 +347,13 @@ public class GenshinScene {
}
// Todo
List
<
G
enshin
Entity
>
toAdd
=
new
LinkedList
<>();
List
<
G
enshin
Entity
>
toRemove
=
new
LinkedList
<>();
List
<
G
ame
Entity
>
toAdd
=
new
LinkedList
<>();
List
<
G
ame
Entity
>
toRemove
=
new
LinkedList
<>();
for
(
SpawnDataEntry
entry
:
visible
)
{
if
(!
this
.
getSpawnedEntities
().
contains
(
entry
)
&&
!
this
.
getDeadSpawnedEntities
().
contains
(
entry
))
{
// Spawn entity
MonsterData
data
=
G
enshin
Data
.
getMonsterDataMap
().
get
(
entry
.
getMonsterId
());
MonsterData
data
=
G
ame
Data
.
getMonsterDataMap
().
get
(
entry
.
getMonsterId
());
if
(
data
==
null
)
{
continue
;
...
...
@@ -373,7 +373,7 @@ public class GenshinScene {
}
}
for
(
G
enshin
Entity
entity
:
this
.
getEntities
().
values
())
{
for
(
G
ame
Entity
entity
:
this
.
getEntities
().
values
())
{
if
(
entity
.
getSpawnEntry
()
!=
null
&&
!
visible
.
contains
(
entity
.
getSpawnEntry
()))
{
toRemove
.
add
(
entity
);
}
...
...
@@ -407,7 +407,7 @@ public class GenshinScene {
}
public
void
onPlayerDestroyGadget
(
int
entityId
)
{
G
enshin
Entity
entity
=
getEntities
().
get
(
entityId
);
G
ame
Entity
entity
=
getEntities
().
get
(
entityId
);
if
(
entity
==
null
||
!(
entity
instanceof
EntityClientGadget
))
{
return
;
...
...
@@ -430,20 +430,20 @@ public class GenshinScene {
// Broadcasting
public
void
broadcastPacket
(
Genshin
Packet
packet
)
{
public
void
broadcastPacket
(
Base
Packet
packet
)
{
// Send to all players - might have to check if player has been sent data packets
for
(
Genshin
Player
player
:
this
.
getPlayers
())
{
for
(
Player
player
:
this
.
getPlayers
())
{
player
.
getSession
().
send
(
packet
);
}
}
public
void
broadcastPacketToOthers
(
Genshin
Player
excludedPlayer
,
Genshin
Packet
packet
)
{
public
void
broadcastPacketToOthers
(
Player
excludedPlayer
,
Base
Packet
packet
)
{
// Optimization
if
(
this
.
getPlayerCount
()
==
1
&&
this
.
getPlayers
().
get
(
0
)
==
excludedPlayer
)
{
return
;
}
// Send to all players - might have to check if player has been sent data packets
for
(
Genshin
Player
player
:
this
.
getPlayers
())
{
for
(
Player
player
:
this
.
getPlayers
())
{
if
(
player
==
excludedPlayer
)
{
continue
;
}
...
...
src/main/java/emu/grasscutter/game/TeamInfo.java
View file @
1c36f078
...
...
@@ -4,9 +4,9 @@ import java.util.ArrayList;
import
java.util.List
;
import
dev.morphia.annotations.Entity
;
import
emu.grasscutter.G
enshin
Constants
;
import
emu.grasscutter.G
ame
Constants
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.avatar.
Genshin
Avatar
;
import
emu.grasscutter.game.avatar.Avatar
;
@Entity
public
class
TeamInfo
{
...
...
@@ -34,11 +34,11 @@ public class TeamInfo {
return
avatars
.
size
();
}
public
boolean
contains
(
Genshin
Avatar
avatar
)
{
public
boolean
contains
(
Avatar
avatar
)
{
return
getAvatars
().
contains
(
avatar
.
getAvatarId
());
}
public
boolean
addAvatar
(
Genshin
Avatar
avatar
)
{
public
boolean
addAvatar
(
Avatar
avatar
)
{
if
(
size
()
>=
Grasscutter
.
getConfig
().
getGameServerOptions
().
MaxAvatarsInTeam
||
contains
(
avatar
))
{
return
false
;
}
...
...
src/main/java/emu/grasscutter/game/TeamManager.java
View file @
1c36f078
...
...
@@ -10,16 +10,16 @@ import java.util.Set;
import
dev.morphia.annotations.Entity
;
import
dev.morphia.annotations.Transient
;
import
emu.grasscutter.G
enshin
Constants
;
import
emu.grasscutter.G
ame
Constants
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.data.def.AvatarSkillDepotData
;
import
emu.grasscutter.game.avatar.
Genshin
Avatar
;
import
emu.grasscutter.game.avatar.Avatar
;
import
emu.grasscutter.game.entity.EntityAvatar
;
import
emu.grasscutter.game.entity.EntityGadget
;
import
emu.grasscutter.game.props.ElementType
;
import
emu.grasscutter.game.props.EnterReason
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.net.packet.
Genshin
Packet
;
import
emu.grasscutter.net.packet.
Base
Packet
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType
;
import
emu.grasscutter.net.proto.MotionStateOuterClass.MotionState
;
...
...
@@ -44,7 +44,7 @@ import it.unimi.dsi.fastutil.ints.IntSet;
@Entity
public
class
TeamManager
{
@Transient
private
Genshin
Player
player
;
@Transient
private
Player
player
;
private
Map
<
Integer
,
TeamInfo
>
teams
;
private
int
currentTeamIndex
;
...
...
@@ -65,18 +65,18 @@ public class TeamManager {
this
.
teamResonancesConfig
=
new
IntOpenHashSet
();
}
public
TeamManager
(
Genshin
Player
player
)
{
public
TeamManager
(
Player
player
)
{
this
();
this
.
player
=
player
;
this
.
teams
=
new
HashMap
<>();
this
.
currentTeamIndex
=
1
;
for
(
int
i
=
1
;
i
<=
G
enshin
Constants
.
MAX_TEAMS
;
i
++)
{
for
(
int
i
=
1
;
i
<=
G
ame
Constants
.
MAX_TEAMS
;
i
++)
{
this
.
teams
.
put
(
i
,
new
TeamInfo
());
}
}
public
Genshin
Player
getPlayer
()
{
public
Player
getPlayer
()
{
return
player
;
}
...
...
@@ -84,7 +84,7 @@ public class TeamManager {
return
player
.
getWorld
();
}
public
void
setPlayer
(
Genshin
Player
player
)
{
public
void
setPlayer
(
Player
player
)
{
this
.
player
=
player
;
}
...
...
@@ -207,7 +207,7 @@ public class TeamManager {
}
}
public
void
updateTeamEntities
(
Genshin
Packet
responsePacket
)
{
public
void
updateTeamEntities
(
Base
Packet
responsePacket
)
{
// Sanity check - Should never happen
if
(
this
.
getCurrentTeamInfo
().
getAvatars
().
size
()
<=
0
)
{
return
;
...
...
@@ -287,9 +287,9 @@ public class TeamManager {
}
// Set team data
LinkedHashSet
<
Genshin
Avatar
>
newTeam
=
new
LinkedHashSet
<>();
LinkedHashSet
<
Avatar
>
newTeam
=
new
LinkedHashSet
<>();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
Genshin
Avatar
avatar
=
getPlayer
().
getAvatars
().
getAvatarByGuid
(
list
.
get
(
i
));
Avatar
avatar
=
getPlayer
().
getAvatars
().
getAvatarByGuid
(
list
.
get
(
i
));
if
(
avatar
==
null
||
newTeam
.
contains
(
avatar
))
{
// Should never happen
return
;
...
...
@@ -299,7 +299,7 @@ public class TeamManager {
// Clear current team info and add avatars from our new team
teamInfo
.
getAvatars
().
clear
();
for
(
Genshin
Avatar
avatar
:
newTeam
)
{
for
(
Avatar
avatar
:
newTeam
)
{
teamInfo
.
addAvatar
(
avatar
);
}
...
...
@@ -323,9 +323,9 @@ public class TeamManager {
TeamInfo
teamInfo
=
this
.
getMpTeam
();
// Set team data
LinkedHashSet
<
Genshin
Avatar
>
newTeam
=
new
LinkedHashSet
<>();
LinkedHashSet
<
Avatar
>
newTeam
=
new
LinkedHashSet
<>();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
Genshin
Avatar
avatar
=
getPlayer
().
getAvatars
().
getAvatarByGuid
(
list
.
get
(
i
));
Avatar
avatar
=
getPlayer
().
getAvatars
().
getAvatarByGuid
(
list
.
get
(
i
));
if
(
avatar
==
null
||
newTeam
.
contains
(
avatar
))
{
// Should never happen
return
;
...
...
@@ -335,7 +335,7 @@ public class TeamManager {
// Clear current team info and add avatars from our new team
teamInfo
.
getAvatars
().
clear
();
for
(
Genshin
Avatar
avatar
:
newTeam
)
{
for
(
Avatar
avatar
:
newTeam
)
{
teamInfo
.
addAvatar
(
avatar
);
}
...
...
@@ -437,7 +437,7 @@ public class TeamManager {
getPlayer
().
sendPacket
(
new
PacketAvatarDieAnimationEndRsp
(
deadAvatar
.
getId
(),
0
));
}
public
boolean
reviveAvatar
(
Genshin
Avatar
avatar
)
{
public
boolean
reviveAvatar
(
Avatar
avatar
)
{
for
(
EntityAvatar
entity
:
getActiveTeam
())
{
if
(
entity
.
getAvatar
()
==
avatar
)
{
if
(
entity
.
isAlive
())
{
...
...
@@ -476,14 +476,14 @@ public class TeamManager {
}
// Teleport player
getPlayer
().
sendPacket
(
new
PacketPlayerEnterSceneNotify
(
getPlayer
(),
EnterType
.
ENTER_SELF
,
EnterReason
.
Revival
,
3
,
G
enshin
Constants
.
START_POSITION
));
getPlayer
().
sendPacket
(
new
PacketPlayerEnterSceneNotify
(
getPlayer
(),
EnterType
.
ENTER_SELF
,
EnterReason
.
Revival
,
3
,
G
ame
Constants
.
START_POSITION
));
// Set player position
player
.
setSceneId
(
3
);
player
.
getPos
().
set
(
G
enshin
Constants
.
START_POSITION
);
player
.
getPos
().
set
(
G
ame
Constants
.
START_POSITION
);
// Packets
getPlayer
().
sendPacket
(
new
Genshin
Packet
(
PacketOpcodes
.
WorldPlayerReviveRsp
));
getPlayer
().
sendPacket
(
new
Base
Packet
(
PacketOpcodes
.
WorldPlayerReviveRsp
));
}
public
void
saveAvatars
()
{
...
...
src/main/java/emu/grasscutter/game/World.java
View file @
1c36f078
...
...
@@ -8,19 +8,19 @@ import java.util.LinkedList;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
emu.grasscutter.game.entity.G
enshin
Entity
;
import
emu.grasscutter.game.entity.G
ame
Entity
;
import
emu.grasscutter.game.props.ClimateType
;
import
emu.grasscutter.game.props.EnterReason
;
import
emu.grasscutter.game.props.EntityIdType
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.game.props.LifeState
;
import
emu.grasscutter.data.G
enshin
Data
;
import
emu.grasscutter.data.G
ame
Data
;
import
emu.grasscutter.data.def.SceneData
;
import
emu.grasscutter.game.
Genshin
Player.SceneLoadState
;
import
emu.grasscutter.game.Player.SceneLoadState
;
import
emu.grasscutter.game.entity.EntityAvatar
;
import
emu.grasscutter.game.entity.EntityClientGadget
;
import
emu.grasscutter.game.entity.EntityGadget
;
import
emu.grasscutter.net.packet.
Genshin
Packet
;
import
emu.grasscutter.net.packet.
Base
Packet
;
import
emu.grasscutter.net.proto.AttackResultOuterClass.AttackResult
;
import
emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType
;
import
emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType
;
...
...
@@ -40,10 +40,10 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import
it.unimi.dsi.fastutil.ints.Int2ObjectMaps
;
import
it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
;
public
class
World
implements
Iterable
<
Genshin
Player
>
{
private
final
Genshin
Player
owner
;
private
final
List
<
Genshin
Player
>
players
;
private
final
Int2ObjectMap
<
Genshin
Scene
>
scenes
;
public
class
World
implements
Iterable
<
Player
>
{
private
final
Player
owner
;
private
final
List
<
Player
>
players
;
private
final
Int2ObjectMap
<
Scene
>
scenes
;
private
int
levelEntityId
;
private
int
nextEntityId
=
0
;
...
...
@@ -52,11 +52,11 @@ public class World implements Iterable<GenshinPlayer> {
private
boolean
isMultiplayer
;
public
World
(
Genshin
Player
player
)
{
public
World
(
Player
player
)
{
this
(
player
,
false
);
}
public
World
(
Genshin
Player
player
,
boolean
isMultiplayer
)
{
public
World
(
Player
player
,
boolean
isMultiplayer
)
{
this
.
owner
=
player
;
this
.
players
=
Collections
.
synchronizedList
(
new
ArrayList
<>());
this
.
scenes
=
Int2ObjectMaps
.
synchronize
(
new
Int2ObjectOpenHashMap
<>());
...
...
@@ -68,7 +68,7 @@ public class World implements Iterable<GenshinPlayer> {
this
.
owner
.
getServer
().
registerWorld
(
this
);
}
public
Genshin
Player
getHost
()
{
public
Player
getHost
()
{
return
owner
;
}
...
...
@@ -95,25 +95,25 @@ public class World implements Iterable<GenshinPlayer> {
this
.
worldLevel
=
worldLevel
;
}
public
List
<
Genshin
Player
>
getPlayers
()
{
public
List
<
Player
>
getPlayers
()
{
return
players
;
}
public
Int2ObjectMap
<
Genshin
Scene
>
getScenes
()
{
public
Int2ObjectMap
<
Scene
>
getScenes
()
{
return
this
.
scenes
;
}
public
Genshin
Scene
getSceneById
(
int
sceneId
)
{
public
Scene
getSceneById
(
int
sceneId
)
{
// Get scene normally
Genshin
Scene
scene
=
getScenes
().
get
(
sceneId
);
Scene
scene
=
getScenes
().
get
(
sceneId
);
if
(
scene
!=
null
)
{
return
scene
;
}
// Create scene from scene data if it doesnt exist
SceneData
sceneData
=
G
enshin
Data
.
getSceneDataMap
().
get
(
sceneId
);
SceneData
sceneData
=
G
ame
Data
.
getSceneDataMap
().
get
(
sceneId
);
if
(
sceneData
!=
null
)
{
scene
=
new
Genshin
Scene
(
this
,
sceneData
);
scene
=
new
Scene
(
this
,
sceneData
);
this
.
registerScene
(
scene
);
return
scene
;
}
...
...
@@ -133,7 +133,7 @@ public class World implements Iterable<GenshinPlayer> {
return
(
idType
.
getId
()
<<
24
)
+
++
this
.
nextEntityId
;
}
public
synchronized
void
addPlayer
(
Genshin
Player
player
)
{
public
synchronized
void
addPlayer
(
Player
player
)
{
// Check if player already in
if
(
getPlayers
().
contains
(
player
))
{
return
;
...
...
@@ -159,7 +159,7 @@ public class World implements Iterable<GenshinPlayer> {
}
// Add to scene
Genshin
Scene
scene
=
this
.
getSceneById
(
player
.
getSceneId
());
Scene
scene
=
this
.
getSceneById
(
player
.
getSceneId
());
scene
.
addPlayer
(
player
);
// Info packet for other players
...
...
@@ -168,7 +168,7 @@ public class World implements Iterable<GenshinPlayer> {
}
}
public
synchronized
void
removePlayer
(
Genshin
Player
player
)
{
public
synchronized
void
removePlayer
(
Player
player
)
{
// Remove team entities
player
.
sendPacket
(
new
PacketDelTeamEntityNotify
(
...
...
@@ -182,7 +182,7 @@ public class World implements Iterable<GenshinPlayer> {
player
.
setWorld
(
null
);
// Remove from scene
Genshin
Scene
scene
=
this
.
getSceneById
(
player
.
getSceneId
());
Scene
scene
=
this
.
getSceneById
(
player
.
getSceneId
());
scene
.
removePlayer
(
player
);
// Info packet for other players
...
...
@@ -192,8 +192,8 @@ public class World implements Iterable<GenshinPlayer> {
// Disband world if host leaves
if
(
getHost
()
==
player
)
{
List
<
Genshin
Player
>
kicked
=
new
ArrayList
<>(
this
.
getPlayers
());
for
(
Genshin
Player
victim
:
kicked
)
{
List
<
Player
>
kicked
=
new
ArrayList
<>(
this
.
getPlayers
());
for
(
Player
victim
:
kicked
)
{
World
world
=
new
World
(
victim
);
world
.
addPlayer
(
victim
);
...
...
@@ -202,20 +202,20 @@ public class World implements Iterable<GenshinPlayer> {
}
}
public
void
registerScene
(
Genshin
Scene
scene
)
{
public
void
registerScene
(
Scene
scene
)
{
this
.
getScenes
().
put
(
scene
.
getId
(),
scene
);
}
public
void
deregisterScene
(
Genshin
Scene
scene
)
{
public
void
deregisterScene
(
Scene
scene
)
{
this
.
getScenes
().
remove
(
scene
.
getId
());
}
public
boolean
transferPlayerToScene
(
Genshin
Player
player
,
int
sceneId
,
Position
pos
)
{
if
(
G
enshin
Data
.
getSceneDataMap
().
get
(
sceneId
)
==
null
)
{
public
boolean
transferPlayerToScene
(
Player
player
,
int
sceneId
,
Position
pos
)
{
if
(
G
ame
Data
.
getSceneDataMap
().
get
(
sceneId
)
==
null
)
{
return
false
;
}
Genshin
Scene
oldScene
=
null
;
Scene
oldScene
=
null
;
if
(
player
.
getScene
()
!=
null
)
{
oldScene
=
player
.
getScene
();
...
...
@@ -228,7 +228,7 @@ public class World implements Iterable<GenshinPlayer> {
oldScene
.
removePlayer
(
player
);
}
Genshin
Scene
newScene
=
this
.
getSceneById
(
sceneId
);
Scene
newScene
=
this
.
getSceneById
(
sceneId
);
newScene
.
addPlayer
(
player
);
player
.
getPos
().
set
(
pos
);
...
...
@@ -245,8 +245,8 @@ public class World implements Iterable<GenshinPlayer> {
return
true
;
}
private
void
updatePlayerInfos
(
Genshin
Player
paramPlayer
)
{
for
(
Genshin
Player
player
:
getPlayers
())
{
private
void
updatePlayerInfos
(
Player
paramPlayer
)
{
for
(
Player
player
:
getPlayers
())
{
// Dont send packets if player is loading in and filter out joining player
if
(!
player
.
hasSentAvatarDataNotify
()
||
player
.
getSceneLoadState
().
getValue
()
<
SceneLoadState
.
INIT
.
getValue
()
||
player
==
paramPlayer
)
{
continue
;
...
...
@@ -269,15 +269,15 @@ public class World implements Iterable<GenshinPlayer> {
}
}
public
void
broadcastPacket
(
Genshin
Packet
packet
)
{
public
void
broadcastPacket
(
Base
Packet
packet
)
{
// Send to all players - might have to check if player has been sent data packets
for
(
Genshin
Player
player
:
this
.
getPlayers
())
{
for
(
Player
player
:
this
.
getPlayers
())
{
player
.
getSession
().
send
(
packet
);
}
}
public
void
onTick
()
{
for
(
Genshin
Scene
scene
:
this
.
getScenes
().
values
())
{
for
(
Scene
scene
:
this
.
getScenes
().
values
())
{
scene
.
onTick
();
}
}
...
...
@@ -287,7 +287,7 @@ public class World implements Iterable<GenshinPlayer> {
}
@Override
public
Iterator
<
Genshin
Player
>
iterator
()
{
public
Iterator
<
Player
>
iterator
()
{
return
getPlayers
().
iterator
();
}
}
src/main/java/emu/grasscutter/game/avatar/
Genshin
Avatar.java
→
src/main/java/emu/grasscutter/game/avatar/Avatar.java
View file @
1c36f078
...
...
@@ -16,7 +16,7 @@ import dev.morphia.annotations.PostLoad;
import
dev.morphia.annotations.PrePersist
;
import
dev.morphia.annotations.Transient
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.data.G
enshin
Data
;
import
emu.grasscutter.data.G
ame
Data
;
import
emu.grasscutter.data.common.FightPropData
;
import
emu.grasscutter.data.custom.OpenConfigEntry
;
import
emu.grasscutter.data.def.AvatarData
;
...
...
@@ -35,10 +35,10 @@ import emu.grasscutter.data.def.WeaponPromoteData;
import
emu.grasscutter.data.def.ItemData.WeaponProperty
;
import
emu.grasscutter.data.def.ProudSkillData
;
import
emu.grasscutter.database.DatabaseHelper
;
import
emu.grasscutter.game.
Genshin
Player
;
import
emu.grasscutter.game.Player
;
import
emu.grasscutter.game.entity.EntityAvatar
;
import
emu.grasscutter.game.inventory.EquipType
;
import
emu.grasscutter.game.inventory.G
enshin
Item
;
import
emu.grasscutter.game.inventory.G
ame
Item
;
import
emu.grasscutter.game.props.ElementType
;
import
emu.grasscutter.game.props.EntityIdType
;
import
emu.grasscutter.game.props.FetterState
;
...
...
@@ -57,11 +57,11 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import
it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
;
@Entity
(
value
=
"avatars"
,
useDiscriminator
=
false
)
public
class
Genshin
Avatar
{
public
class
Avatar
{
@Id
private
ObjectId
id
;
@Indexed
private
int
ownerId
;
// Id of player that this avatar belongs to
@Transient
private
Genshin
Player
owner
;
@Transient
private
Player
owner
;
@Transient
private
AvatarData
data
;
@Transient
private
long
guid
;
// Player unique id
private
int
avatarId
;
// Id of avatar
...
...
@@ -73,7 +73,7 @@ public class GenshinAvatar {
private
int
satiationPenalty
;
// ?
private
float
currentHp
;
@Transient
private
final
Int2ObjectMap
<
G
enshin
Item
>
equips
;
@Transient
private
final
Int2ObjectMap
<
G
ame
Item
>
equips
;
@Transient
private
final
Int2FloatOpenHashMap
fightProp
;
@Transient
private
Set
<
String
>
extraAbilityEmbryos
;
...
...
@@ -96,21 +96,21 @@ public class GenshinAvatar {
private
int
nameCardRewardId
;
private
int
nameCardId
;
public
Genshin
Avatar
()
{
public
Avatar
()
{
// Morhpia only!
this
.
equips
=
new
Int2ObjectOpenHashMap
<>();
this
.
fightProp
=
new
Int2FloatOpenHashMap
();
this
.
extraAbilityEmbryos
=
new
HashSet
<>();
this
.
proudSkillBonusMap
=
new
HashMap
<>();
this
.
fetters
=
new
ArrayList
<>();
// TODO Move to
genshin
avatar
this
.
fetters
=
new
ArrayList
<>();
// TODO Move to avatar
}
// On creation
public
Genshin
Avatar
(
int
avatarId
)
{
this
(
G
enshin
Data
.
getAvatarDataMap
().
get
(
avatarId
));
public
Avatar
(
int
avatarId
)
{
this
(
G
ame
Data
.
getAvatarDataMap
().
get
(
avatarId
));
}
public
Genshin
Avatar
(
AvatarData
data
)
{
public
Avatar
(
AvatarData
data
)
{
this
();
this
.
avatarId
=
data
.
getId
();
this
.
nameCardRewardId
=
data
.
getNameCardRewardId
();
...
...
@@ -143,7 +143,7 @@ public class GenshinAvatar {
this
.
onLoad
();
}
public
Genshin
Player
getPlayer
()
{
public
Player
getPlayer
()
{
return
this
.
owner
;
}
...
...
@@ -163,10 +163,10 @@ public class GenshinAvatar {
return
ownerId
;
}
public
void
setOwner
(
Genshin
Player
player
)
{
public
void
setOwner
(
Player
player
)
{
this
.
owner
=
player
;
this
.
ownerId
=
player
.
getUid
();
this
.
guid
=
player
.
getNextG
enshin
Guid
();
this
.
guid
=
player
.
getNextG
ame
Guid
();
}
public
int
getSatiation
()
{
...
...
@@ -229,19 +229,19 @@ public class GenshinAvatar {
this
.
promoteLevel
=
promoteLevel
;
}
public
Int2ObjectMap
<
G
enshin
Item
>
getEquips
()
{
public
Int2ObjectMap
<
G
ame
Item
>
getEquips
()
{
return
equips
;
}
public
G
enshin
Item
getEquipBySlot
(
EquipType
slot
)
{
public
G
ame
Item
getEquipBySlot
(
EquipType
slot
)
{
return
this
.
getEquips
().
get
(
slot
.
getValue
());
}
private
G
enshin
Item
getEquipBySlot
(
int
slotId
)
{
private
G
ame
Item
getEquipBySlot
(
int
slotId
)
{
return
this
.
getEquips
().
get
(
slotId
);
}
public
G
enshin
Item
getWeapon
()
{
public
G
ame
Item
getWeapon
()
{
return
this
.
getEquipBySlot
(
EquipType
.
EQUIP_WEAPON
);
}
...
...
@@ -270,7 +270,7 @@ public class GenshinAvatar {
}
if
(
openData
.
getNeedAvatarPromoteLevel
()
<=
this
.
getPromoteLevel
())
{
int
proudSkillId
=
(
openData
.
getProudSkillGroupId
()
*
100
)
+
1
;
if
(
G
enshin
Data
.
getProudSkillDataMap
().
containsKey
(
proudSkillId
))
{
if
(
G
ame
Data
.
getProudSkillDataMap
().
containsKey
(
proudSkillId
))
{
this
.
getProudSkillList
().
add
(
proudSkillId
);
}
}
...
...
@@ -385,7 +385,7 @@ public class GenshinAvatar {
return
bornTime
;
}
public
boolean
equipItem
(
G
enshin
Item
item
,
boolean
shouldRecalc
)
{
public
boolean
equipItem
(
G
ame
Item
item
,
boolean
shouldRecalc
)
{
EquipType
itemEquipType
=
item
.
getItemData
().
getEquipType
();
if
(
itemEquipType
==
EquipType
.
EQUIP_NONE
)
{
return
false
;
...
...
@@ -416,7 +416,7 @@ public class GenshinAvatar {
}
public
boolean
unequipItem
(
EquipType
slot
)
{
G
enshin
Item
item
=
getEquips
().
remove
(
slot
.
getValue
());
G
ame
Item
item
=
getEquips
().
remove
(
slot
.
getValue
());
if
(
item
!=
null
)
{
item
.
setEquipCharacter
(
0
);
...
...
@@ -434,7 +434,7 @@ public class GenshinAvatar {
public
void
recalcStats
(
boolean
forceSendAbilityChange
)
{
// Setup
AvatarData
data
=
this
.
getAvatarData
();
AvatarPromoteData
promoteData
=
G
enshin
Data
.
getAvatarPromoteData
(
data
.
getAvatarPromoteId
(),
this
.
getPromoteLevel
());
AvatarPromoteData
promoteData
=
G
ame
Data
.
getAvatarPromoteData
(
data
.
getAvatarPromoteId
(),
this
.
getPromoteLevel
());
Int2IntOpenHashMap
setMap
=
new
Int2IntOpenHashMap
();
// Extra ability embryos
...
...
@@ -476,21 +476,21 @@ public class GenshinAvatar {
// Artifacts
for
(
int
slotId
=
1
;
slotId
<=
5
;
slotId
++)
{
// Get artifact
G
enshin
Item
equip
=
this
.
getEquipBySlot
(
slotId
);
G
ame
Item
equip
=
this
.
getEquipBySlot
(
slotId
);
if
(
equip
==
null
)
{
continue
;
}
// Artifact main stat
ReliquaryMainPropData
mainPropData
=
G
enshin
Data
.
getReliquaryMainPropDataMap
().
get
(
equip
.
getMainPropId
());
ReliquaryMainPropData
mainPropData
=
G
ame
Data
.
getReliquaryMainPropDataMap
().
get
(
equip
.
getMainPropId
());
if
(
mainPropData
!=
null
)
{
ReliquaryLevelData
levelData
=
G
enshin
Data
.
getRelicLevelData
(
equip
.
getItemData
().
getRankLevel
(),
equip
.
getLevel
());
ReliquaryLevelData
levelData
=
G
ame
Data
.
getRelicLevelData
(
equip
.
getItemData
().
getRankLevel
(),
equip
.
getLevel
());
if
(
levelData
!=
null
)
{
this
.
addFightProperty
(
mainPropData
.
getFightProp
(),
levelData
.
getPropValue
(
mainPropData
.
getFightProp
()));
}
}
// Artifact sub stats
for
(
int
appendPropId
:
equip
.
getAppendPropIdList
())
{
ReliquaryAffixData
affixData
=
G
enshin
Data
.
getReliquaryAffixDataMap
().
get
(
appendPropId
);
ReliquaryAffixData
affixData
=
G
ame
Data
.
getReliquaryAffixDataMap
().
get
(
appendPropId
);
if
(
affixData
!=
null
)
{
this
.
addFightProperty
(
affixData
.
getFightProp
(),
affixData
.
getPropValue
());
}
...
...
@@ -503,7 +503,7 @@ public class GenshinAvatar {
// Set stuff
for
(
Int2IntOpenHashMap
.
Entry
e
:
setMap
.
int2IntEntrySet
())
{
ReliquarySetData
setData
=
G
enshin
Data
.
getReliquarySetDataMap
().
get
(
e
.
getIntKey
());
ReliquarySetData
setData
=
G
ame
Data
.
getReliquarySetDataMap
().
get
(
e
.
getIntKey
());
if
(
setData
==
null
)
{
continue
;
}
...
...
@@ -516,7 +516,7 @@ public class GenshinAvatar {
if
(
amount
>=
setData
.
getSetNeedNum
()[
setIndex
])
{
int
affixId
=
(
setData
.
getEquipAffixId
()
*
10
)
+
setIndex
;
EquipAffixData
affix
=
G
enshin
Data
.
getEquipAffixDataMap
().
get
(
affixId
);
EquipAffixData
affix
=
G
ame
Data
.
getEquipAffixDataMap
().
get
(
affixId
);
if
(
affix
==
null
)
{
continue
;
}
...
...
@@ -535,17 +535,17 @@ public class GenshinAvatar {
}
// Weapon
G
enshin
Item
weapon
=
this
.
getWeapon
();
G
ame
Item
weapon
=
this
.
getWeapon
();
if
(
weapon
!=
null
)
{
// Add stats
WeaponCurveData
curveData
=
G
enshin
Data
.
getWeaponCurveDataMap
().
get
(
weapon
.
getLevel
());
WeaponCurveData
curveData
=
G
ame
Data
.
getWeaponCurveDataMap
().
get
(
weapon
.
getLevel
());
if
(
curveData
!=
null
)
{
for
(
WeaponProperty
weaponProperty
:
weapon
.
getItemData
().
getWeaponProperties
())
{
this
.
addFightProperty
(
weaponProperty
.
getFightProp
(),
weaponProperty
.
getInitValue
()
*
curveData
.
getMultByProp
(
weaponProperty
.
getType
()));
}
}
// Weapon promotion stats
WeaponPromoteData
wepPromoteData
=
G
enshin
Data
.
getWeaponPromoteData
(
weapon
.
getItemData
().
getWeaponPromoteId
(),
weapon
.
getPromoteLevel
());
WeaponPromoteData
wepPromoteData
=
G
ame
Data
.
getWeaponPromoteData
(
weapon
.
getItemData
().
getWeaponPromoteId
(),
weapon
.
getPromoteLevel
());
if
(
wepPromoteData
!=
null
)
{
for
(
FightPropData
prop
:
wepPromoteData
.
getAddProps
())
{
if
(
prop
.
getValue
()
==
0
f
||
prop
.
getProp
()
==
null
)
{
...
...
@@ -563,7 +563,7 @@ public class GenshinAvatar {
}
// Calculate affix id
int
affixId
=
(
af
*
10
)
+
weapon
.
getRefinement
();
EquipAffixData
affix
=
G
enshin
Data
.
getEquipAffixDataMap
().
get
(
affixId
);
EquipAffixData
affix
=
G
ame
Data
.
getEquipAffixDataMap
().
get
(
affixId
);
if
(
affix
==
null
)
{
continue
;
}
...
...
@@ -580,7 +580,7 @@ public class GenshinAvatar {
}
// Add proud skills and unlock them if needed
AvatarSkillDepotData
skillDepot
=
G
enshin
Data
.
getAvatarSkillDepotDataMap
().
get
(
this
.
getSkillDepotId
());
AvatarSkillDepotData
skillDepot
=
G
ame
Data
.
getAvatarSkillDepotDataMap
().
get
(
this
.
getSkillDepotId
());
this
.
getProudSkillList
().
clear
();
for
(
InherentProudSkillOpens
openData
:
skillDepot
.
getInherentProudSkillOpens
())
{
if
(
openData
.
getProudSkillGroupId
()
==
0
)
{
...
...
@@ -588,7 +588,7 @@ public class GenshinAvatar {
}
if
(
openData
.
getNeedAvatarPromoteLevel
()
<=
this
.
getPromoteLevel
())
{
int
proudSkillId
=
(
openData
.
getProudSkillGroupId
()
*
100
)
+
1
;
if
(
G
enshin
Data
.
getProudSkillDataMap
().
containsKey
(
proudSkillId
))
{
if
(
G
ame
Data
.
getProudSkillDataMap
().
containsKey
(
proudSkillId
))
{
this
.
getProudSkillList
().
add
(
proudSkillId
);
}
}
...
...
@@ -596,7 +596,7 @@ public class GenshinAvatar {
// Proud skills
for
(
int
proudSkillId
:
this
.
getProudSkillList
())
{
ProudSkillData
proudSkillData
=
G
enshin
Data
.
getProudSkillDataMap
().
get
(
proudSkillId
);
ProudSkillData
proudSkillData
=
G
ame
Data
.
getProudSkillDataMap
().
get
(
proudSkillId
);
if
(
proudSkillData
==
null
)
{
continue
;
}
...
...
@@ -613,7 +613,7 @@ public class GenshinAvatar {
// Constellations
if
(
this
.
getTalentIdList
().
size
()
>
0
)
{
for
(
int
talentId
:
this
.
getTalentIdList
())
{
AvatarTalentData
avatarTalentData
=
G
enshin
Data
.
getAvatarTalentDataMap
().
get
(
talentId
);
AvatarTalentData
avatarTalentData
=
G
ame
Data
.
getAvatarTalentDataMap
().
get
(
talentId
);
if
(
avatarTalentData
==
null
)
{
return
;
}
...
...
@@ -657,7 +657,7 @@ public class GenshinAvatar {
return
;
}
OpenConfigEntry
entry
=
G
enshin
Data
.
getOpenConfigEntries
().
get
(
openConfig
);
OpenConfigEntry
entry
=
G
ame
Data
.
getOpenConfigEntries
().
get
(
openConfig
);
if
(
entry
==
null
)
{
if
(
forceAdd
)
{
// Add config string to ability skill list anyways
...
...
@@ -684,14 +684,14 @@ public class GenshinAvatar {
if
(
this
.
getTalentIdList
().
size
()
>
0
)
{
for
(
int
talentId
:
this
.
getTalentIdList
())
{
AvatarTalentData
avatarTalentData
=
G
enshin
Data
.
getAvatarTalentDataMap
().
get
(
talentId
);
AvatarTalentData
avatarTalentData
=
G
ame
Data
.
getAvatarTalentDataMap
().
get
(
talentId
);
if
(
avatarTalentData
==
null
||
avatarTalentData
.
getOpenConfig
()
==
null
||
avatarTalentData
.
getOpenConfig
().
length
()
==
0
)
{
continue
;
}
// Get open config to find which skill should be boosted
OpenConfigEntry
entry
=
G
enshin
Data
.
getOpenConfigEntries
().
get
(
avatarTalentData
.
getOpenConfig
());
OpenConfigEntry
entry
=
G
ame
Data
.
getOpenConfigEntries
().
get
(
avatarTalentData
.
getOpenConfig
());
if
(
entry
==
null
)
{
continue
;
}
...
...
@@ -712,7 +712,7 @@ public class GenshinAvatar {
}
// Get proud skill group id
AvatarSkillData
skillData
=
G
enshin
Data
.
getAvatarSkillDataMap
().
get
(
skillId
);
AvatarSkillData
skillData
=
G
ame
Data
.
getAvatarSkillDataMap
().
get
(
skillId
);
if
(
skillData
==
null
)
{
continue
;
...
...
@@ -785,7 +785,7 @@ public class GenshinAvatar {
.
setWearingFlycloakId
(
this
.
getFlyCloak
())
.
setCostumeId
(
this
.
getCostume
());
for
(
G
enshin
Item
item
:
this
.
getEquips
().
values
())
{
for
(
G
ame
Item
item
:
this
.
getEquips
().
values
())
{
avatarInfo
.
addEquipGuidList
(
item
.
getGuid
());
}
...
...
src/main/java/emu/grasscutter/game/avatar/AvatarProfileData.java
View file @
1c36f078
...
...
@@ -7,7 +7,7 @@ public class AvatarProfileData {
private
int
avatarId
;
private
int
level
;
public
AvatarProfileData
(
Genshin
Avatar
avatar
)
{
public
AvatarProfileData
(
Avatar
avatar
)
{
this
.
update
(
avatar
);
}
...
...
@@ -19,7 +19,7 @@ public class AvatarProfileData {
return
level
;
}
public
void
update
(
Genshin
Avatar
avatar
)
{
public
void
update
(
Avatar
avatar
)
{
this
.
avatarId
=
avatar
.
getAvatarId
();
this
.
level
=
avatar
.
getLevel
();
}
...
...
Prev
1
2
3
4
5
6
7
8
…
14
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