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
7ccecda0
Commit
7ccecda0
authored
Apr 23, 2022
by
Yazawazi
Committed by
GitHub
Apr 23, 2022
Browse files
AvatarFetterLevelReward
parent
48db6446
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/data/GenshinData.java
View file @
7ccecda0
...
@@ -58,6 +58,7 @@ public class GenshinData {
...
@@ -58,6 +58,7 @@ public class GenshinData {
private
static
final
Int2ObjectMap
<
SceneData
>
sceneDataMap
=
new
Int2ObjectLinkedOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
SceneData
>
sceneDataMap
=
new
Int2ObjectLinkedOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
FetterData
>
fetterDataMap
=
new
Int2ObjectOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
FetterData
>
fetterDataMap
=
new
Int2ObjectOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
FetterCharacterCardData
>
fetterCharacterCardDataMap
=
new
Int2ObjectOpenHashMap
<>();
// Cache
// Cache
private
static
Map
<
Integer
,
List
<
Integer
>>
fetters
=
new
HashMap
<>();
private
static
Map
<
Integer
,
List
<
Integer
>>
fetters
=
new
HashMap
<>();
...
@@ -119,6 +120,10 @@ public class GenshinData {
...
@@ -119,6 +120,10 @@ public class GenshinData {
return
avatarFetterLevelDataMap
;
return
avatarFetterLevelDataMap
;
}
}
public
static
Int2ObjectMap
<
FetterCharacterCardData
>
getFetterCharacterCardDataMap
()
{
return
fetterCharacterCardDataMap
;
}
public
static
Int2ObjectMap
<
AvatarLevelData
>
getAvatarLevelDataMap
()
{
public
static
Int2ObjectMap
<
AvatarLevelData
>
getAvatarLevelDataMap
()
{
return
avatarLevelDataMap
;
return
avatarLevelDataMap
;
}
}
...
...
src/main/java/emu/grasscutter/data/def/AvatarData.java
View file @
7ccecda0
...
@@ -57,6 +57,7 @@ public class AvatarData extends GenshinResource {
...
@@ -57,6 +57,7 @@ public class AvatarData extends GenshinResource {
private
IntList
abilities
;
private
IntList
abilities
;
private
List
<
Integer
>
fetters
;
private
List
<
Integer
>
fetters
;
private
int
nameCardRewardId
;
@Override
@Override
public
int
getId
(){
public
int
getId
(){
...
@@ -199,12 +200,20 @@ public class AvatarData extends GenshinResource {
...
@@ -199,12 +200,20 @@ public class AvatarData extends GenshinResource {
return
fetters
;
return
fetters
;
}
}
public
int
getNameCardRewardId
()
{
return
nameCardRewardId
;
}
@Override
@Override
public
void
onLoad
()
{
public
void
onLoad
()
{
this
.
skillDepot
=
GenshinData
.
getAvatarSkillDepotDataMap
().
get
(
this
.
SkillDepotId
);
this
.
skillDepot
=
GenshinData
.
getAvatarSkillDepotDataMap
().
get
(
this
.
SkillDepotId
);
// Get fetters from GenshinData
// Get fetters from GenshinData
this
.
fetters
=
GenshinData
.
getFetterDataEntries
().
get
(
this
.
Id
);
this
.
fetters
=
GenshinData
.
getFetterDataEntries
().
get
(
this
.
Id
);
if
(
GenshinData
.
getFetterCharacterCardDataMap
().
get
(
this
.
Id
)
!=
null
)
{
this
.
nameCardRewardId
=
GenshinData
.
getFetterCharacterCardDataMap
().
get
(
this
.
Id
).
getRewardId
();
}
int
size
=
GenshinData
.
getAvatarCurveDataMap
().
size
();
int
size
=
GenshinData
.
getAvatarCurveDataMap
().
size
();
this
.
hpGrowthCurve
=
new
float
[
size
];
this
.
hpGrowthCurve
=
new
float
[
size
];
...
...
src/main/java/emu/grasscutter/data/def/FetterCharacterCardData.java
0 → 100644
View file @
7ccecda0
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.GenshinResource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.ResourceType.LoadPriority
;
@ResourceType
(
name
=
"FetterCharacterCardExcelConfigData.json"
,
loadPriority
=
LoadPriority
.
HIGHEST
)
public
class
FetterCharacterCardData
extends
GenshinResource
{
private
int
AvatarId
;
private
int
RewardId
;
@Override
public
int
getId
()
{
return
AvatarId
;
}
public
int
getRewardId
()
{
return
RewardId
;
}
@Override
public
void
onLoad
()
{
}
}
src/main/java/emu/grasscutter/game/avatar/GenshinAvatar.java
View file @
7ccecda0
...
@@ -92,6 +92,8 @@ public class GenshinAvatar {
...
@@ -92,6 +92,8 @@ public class GenshinAvatar {
private
int
fetterLevel
=
1
;
private
int
fetterLevel
=
1
;
private
int
fetterExp
;
private
int
fetterExp
;
private
int
nameCardRewardId
;
public
GenshinAvatar
()
{
public
GenshinAvatar
()
{
// Morhpia only!
// Morhpia only!
...
@@ -110,6 +112,7 @@ public class GenshinAvatar {
...
@@ -110,6 +112,7 @@ public class GenshinAvatar {
public
GenshinAvatar
(
AvatarData
data
)
{
public
GenshinAvatar
(
AvatarData
data
)
{
this
();
this
();
this
.
avatarId
=
data
.
getId
();
this
.
avatarId
=
data
.
getId
();
this
.
nameCardRewardId
=
data
.
getNameCardRewardId
();
this
.
data
=
data
;
this
.
data
=
data
;
this
.
bornTime
=
(
int
)
(
System
.
currentTimeMillis
()
/
1000
);
this
.
bornTime
=
(
int
)
(
System
.
currentTimeMillis
()
/
1000
);
this
.
flyCloak
=
140001
;
this
.
flyCloak
=
140001
;
...
@@ -172,6 +175,14 @@ public class GenshinAvatar {
...
@@ -172,6 +175,14 @@ public class GenshinAvatar {
this
.
satiation
=
satiation
;
this
.
satiation
=
satiation
;
}
}
public
int
getNameCardRewardId
()
{
return
nameCardRewardId
;
}
public
void
setNameCardRewardId
(
int
nameCardRewardId
)
{
this
.
nameCardRewardId
=
nameCardRewardId
;
}
public
int
getSatiationPenalty
()
{
public
int
getSatiationPenalty
()
{
return
satiationPenalty
;
return
satiationPenalty
;
}
}
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarFetterLevelRewardReq.java
0 → 100644
View file @
7ccecda0
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.AvatarFetterLevelRewardReqOuterClass.AvatarFetterLevelRewardReq
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketAvatarFetterLevelRewardRsp
;
import
emu.grasscutter.net.packet.PacketHandler
;
@Opcodes
(
PacketOpcodes
.
AvatarFetterLevelRewardReq
)
public
class
HandlerAvatarFetterLevelRewardReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
AvatarFetterLevelRewardReq
req
=
AvatarFetterLevelRewardReq
.
parseFrom
(
payload
);
if
(
req
.
getFetterLevel
()
<
10
)
{
// You don't have a full level of fetter level, why do you want to get a divorce certificate?
session
.
send
(
new
PacketAvatarFetterLevelRewardRsp
(
req
.
getAvatarGuid
(),
req
.
getFetterLevel
()));
}
else
{
long
avatarGuid
=
req
.
getAvatarGuid
();
int
rewardId
=
session
.
getPlayer
()
.
getAvatars
()
.
getAvatarByGuid
(
avatarGuid
)
.
getNameCardRewardId
();
// Here need to send the packets, I am not at all clear ah!
session
.
send
(
new
PacketAvatarFetterLevelRewardRsp
(
avatarGuid
,
req
.
getFetterLevel
(),
rewardId
));
}
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFetterLevelRewardRsp.java
0 → 100644
View file @
7ccecda0
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.AvatarFetterLevelRewardRspOuterClass.AvatarFetterLevelRewardRsp
;
public
class
PacketAvatarFetterLevelRewardRsp
extends
GenshinPacket
{
public
PacketAvatarFetterLevelRewardRsp
(
long
guid
,
int
fetterLevel
,
int
rewardId
)
{
super
(
PacketOpcodes
.
AvatarFetterLevelRewardRsp
);
AvatarFetterLevelRewardRsp
proto
=
AvatarFetterLevelRewardRsp
.
newBuilder
()
.
setAvatarGuid
(
guid
)
.
setFetterLevel
(
fetterLevel
)
.
setRetcode
(
0
)
.
setRewardId
(
rewardId
)
.
build
();
this
.
setData
(
proto
);
}
public
PacketAvatarFetterLevelRewardRsp
(
long
guid
,
int
fetterLevel
)
{
super
(
PacketOpcodes
.
AvatarFetterLevelRewardRsp
);
AvatarFetterLevelRewardRsp
proto
=
AvatarFetterLevelRewardRsp
.
newBuilder
()
.
setAvatarGuid
(
guid
)
.
setFetterLevel
(
fetterLevel
)
.
setRetcode
(
1
)
.
setRewardId
(
0
)
.
build
();
this
.
setData
(
proto
);
}
}
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