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
1ecc3f43
Commit
1ecc3f43
authored
Oct 17, 2022
by
AnimeGitB
Browse files
Remove constellation charge and talent level bonuses from db
parent
cbd66a74
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/data/GameData.java
View file @
1ecc3f43
...
@@ -12,6 +12,8 @@ import emu.grasscutter.data.binout.*;
...
@@ -12,6 +12,8 @@ import emu.grasscutter.data.binout.*;
import
emu.grasscutter.game.quest.QuestEncryptionKey
;
import
emu.grasscutter.game.quest.QuestEncryptionKey
;
import
emu.grasscutter.utils.Utils
;
import
emu.grasscutter.utils.Utils
;
import
emu.grasscutter.data.excels.*
;
import
emu.grasscutter.data.excels.*
;
import
it.unimi.dsi.fastutil.ints.Int2IntMap
;
import
it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap
;
import
it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap
;
import
it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap
;
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
;
...
@@ -124,6 +126,7 @@ public class GameData {
...
@@ -124,6 +126,7 @@ public class GameData {
private
static
Map
<
Integer
,
List
<
Integer
>>
fetters
=
new
HashMap
<>();
private
static
Map
<
Integer
,
List
<
Integer
>>
fetters
=
new
HashMap
<>();
private
static
Map
<
Integer
,
List
<
ShopGoodsData
>>
shopGoods
=
new
HashMap
<>();
private
static
Map
<
Integer
,
List
<
ShopGoodsData
>>
shopGoods
=
new
HashMap
<>();
protected
static
Int2ObjectMap
<
IntSet
>
proudSkillGroupLevels
=
new
Int2ObjectOpenHashMap
<>();
protected
static
Int2ObjectMap
<
IntSet
>
proudSkillGroupLevels
=
new
Int2ObjectOpenHashMap
<>();
protected
static
Int2IntMap
proudSkillGroupMaxLevels
=
new
Int2IntOpenHashMap
();
protected
static
Int2ObjectMap
<
IntSet
>
avatarSkillLevels
=
new
Int2ObjectOpenHashMap
<>();
protected
static
Int2ObjectMap
<
IntSet
>
avatarSkillLevels
=
new
Int2ObjectOpenHashMap
<>();
// Getters with wrong names, remove later
// Getters with wrong names, remove later
...
@@ -141,6 +144,7 @@ public class GameData {
...
@@ -141,6 +144,7 @@ public class GameData {
public
static
AbilityData
getAbilityData
(
String
abilityName
)
{
return
abilityDataMap
.
get
(
abilityName
);}
public
static
AbilityData
getAbilityData
(
String
abilityName
)
{
return
abilityDataMap
.
get
(
abilityName
);}
public
static
IntSet
getAvatarSkillLevels
(
int
avatarSkillId
)
{
return
avatarSkillLevels
.
get
(
avatarSkillId
);}
public
static
IntSet
getAvatarSkillLevels
(
int
avatarSkillId
)
{
return
avatarSkillLevels
.
get
(
avatarSkillId
);}
public
static
IntSet
getProudSkillGroupLevels
(
int
proudSkillGroupId
)
{
return
proudSkillGroupLevels
.
get
(
proudSkillGroupId
);}
public
static
IntSet
getProudSkillGroupLevels
(
int
proudSkillGroupId
)
{
return
proudSkillGroupLevels
.
get
(
proudSkillGroupId
);}
public
static
int
getProudSkillGroupMaxLevel
(
int
proudSkillGroupId
)
{
return
proudSkillGroupMaxLevels
.
getOrDefault
(
proudSkillGroupId
,
0
);}
// Multi-keyed getters
// Multi-keyed getters
public
static
AvatarPromoteData
getAvatarPromoteData
(
int
promoteId
,
int
promoteLevel
)
{
public
static
AvatarPromoteData
getAvatarPromoteData
(
int
promoteId
,
int
promoteLevel
)
{
...
...
src/main/java/emu/grasscutter/data/ResourceLoader.java
View file @
1ecc3f43
...
@@ -172,12 +172,17 @@ public class ResourceLoader {
...
@@ -172,12 +172,17 @@ public class ResourceLoader {
}
}
private
static
void
cacheTalentLevelSets
()
{
private
static
void
cacheTalentLevelSets
()
{
// All known levels, keyed by proudSkillGroupId
GameData
.
getProudSkillDataMap
().
forEach
((
id
,
data
)
->
GameData
.
getProudSkillDataMap
().
forEach
((
id
,
data
)
->
GameData
.
proudSkillGroupLevels
GameData
.
proudSkillGroupLevels
.
computeIfAbsent
(
data
.
getProudSkillGroupId
(),
i
->
new
IntArraySet
())
.
computeIfAbsent
(
data
.
getProudSkillGroupId
(),
i
->
new
IntArraySet
())
.
add
(
data
.
getLevel
()));
.
add
(
data
.
getLevel
()));
// All known levels, keyed by avatarSkillId
GameData
.
getAvatarSkillDataMap
().
forEach
((
id
,
data
)
->
GameData
.
getAvatarSkillDataMap
().
forEach
((
id
,
data
)
->
GameData
.
avatarSkillLevels
.
put
((
int
)
id
,
GameData
.
proudSkillGroupLevels
.
get
(
data
.
getProudSkillGroupId
())));
GameData
.
avatarSkillLevels
.
put
((
int
)
id
,
GameData
.
proudSkillGroupLevels
.
get
(
data
.
getProudSkillGroupId
())));
// Maximum known levels, keyed by proudSkillGroupId
GameData
.
proudSkillGroupLevels
.
forEach
((
id
,
set
)
->
GameData
.
proudSkillGroupMaxLevels
.
put
((
int
)
id
,
set
.
intStream
().
max
().
getAsInt
()));
}
}
private
static
void
loadAbilityEmbryos
()
{
private
static
void
loadAbilityEmbryos
()
{
...
...
src/main/java/emu/grasscutter/game/avatar/Avatar.java
View file @
1ecc3f43
...
@@ -3,7 +3,6 @@ package emu.grasscutter.game.avatar;
...
@@ -3,7 +3,6 @@ package emu.grasscutter.game.avatar;
import
static
emu
.
grasscutter
.
config
.
Configuration
.
GAME_OPTIONS
;
import
static
emu
.
grasscutter
.
config
.
Configuration
.
GAME_OPTIONS
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -60,6 +59,7 @@ import emu.grasscutter.net.proto.ShowEquipOuterClass.ShowEquip;
...
@@ -60,6 +59,7 @@ import emu.grasscutter.net.proto.ShowEquipOuterClass.ShowEquip;
import
emu.grasscutter.server.packet.send.*
;
import
emu.grasscutter.server.packet.send.*
;
import
emu.grasscutter.utils.ProtoHelper
;
import
emu.grasscutter.utils.ProtoHelper
;
import
it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap
;
import
it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap
;
import
it.unimi.dsi.fastutil.ints.Int2IntArrayMap
;
import
it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap
;
import
it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap
;
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
;
...
@@ -95,9 +95,9 @@ public class Avatar {
...
@@ -95,9 +95,9 @@ public class Avatar {
private
List
<
Integer
>
fetters
;
private
List
<
Integer
>
fetters
;
private
Map
<
Integer
,
Integer
>
skillLevelMap
;
// Talent levels
private
Map
<
Integer
,
Integer
>
skillLevelMap
=
new
Int2IntArrayMap
(
7
)
;
// Talent levels
private
Map
<
Integer
,
Integer
>
skillExtraChargeMap
;
// Charges
@Transient
@Getter
private
Map
<
Integer
,
Integer
>
skillExtraChargeMap
=
new
Int2IntArrayMap
(
2
)
;
// Charges
private
Map
<
Integer
,
Integer
>
proudSkillBonusMap
;
// Talent bonus levels (from const)
@Transient
private
Map
<
Integer
,
Integer
>
proudSkillBonusMap
=
new
Int2IntArrayMap
(
2
)
;
// Talent bonus levels (from const)
@Getter
private
int
skillDepotId
;
@Getter
private
int
skillDepotId
;
private
Set
<
Integer
>
talentIdList
;
// Constellation id list
private
Set
<
Integer
>
talentIdList
;
// Constellation id list
@Getter
private
Set
<
Integer
>
proudSkillList
;
// Character passives
@Getter
private
Set
<
Integer
>
proudSkillList
;
// Character passives
...
@@ -118,7 +118,6 @@ public class Avatar {
...
@@ -118,7 +118,6 @@ public class Avatar {
this
.
fightProp
=
new
Int2FloatOpenHashMap
();
this
.
fightProp
=
new
Int2FloatOpenHashMap
();
this
.
fightPropOverrides
=
new
Int2FloatOpenHashMap
();
this
.
fightPropOverrides
=
new
Int2FloatOpenHashMap
();
this
.
extraAbilityEmbryos
=
new
HashSet
<>();
this
.
extraAbilityEmbryos
=
new
HashSet
<>();
this
.
proudSkillBonusMap
=
new
HashMap
<>();
this
.
fetters
=
new
ArrayList
<>();
// TODO Move to avatar
this
.
fetters
=
new
ArrayList
<>();
// TODO Move to avatar
}
}
...
@@ -136,8 +135,6 @@ public class Avatar {
...
@@ -136,8 +135,6 @@ public class Avatar {
this
.
bornTime
=
(
int
)
(
System
.
currentTimeMillis
()
/
1000
);
this
.
bornTime
=
(
int
)
(
System
.
currentTimeMillis
()
/
1000
);
this
.
flyCloak
=
140001
;
this
.
flyCloak
=
140001
;
this
.
skillLevelMap
=
new
HashMap
<>();
this
.
skillExtraChargeMap
=
new
HashMap
<>();
this
.
talentIdList
=
new
HashSet
<>();
this
.
talentIdList
=
new
HashSet
<>();
this
.
proudSkillList
=
new
HashSet
<>();
this
.
proudSkillList
=
new
HashSet
<>();
...
@@ -247,13 +244,6 @@ public class Avatar {
...
@@ -247,13 +244,6 @@ public class Avatar {
this
.
recalcStats
();
this
.
recalcStats
();
}
}
private
Map
<
Integer
,
Integer
>
getSkillExtraChargeMap
()
{
if
(
skillExtraChargeMap
==
null
)
{
skillExtraChargeMap
=
new
HashMap
<>();
}
return
skillExtraChargeMap
;
}
public
void
setFetterList
(
List
<
Integer
>
fetterList
)
{
public
void
setFetterList
(
List
<
Integer
>
fetterList
)
{
this
.
fetters
=
fetterList
;
this
.
fetters
=
fetterList
;
}
}
...
@@ -315,18 +305,16 @@ public class Avatar {
...
@@ -315,18 +305,16 @@ public class Avatar {
// Returns a copy of the skill bonus levels for the current skillDepot, capped to avoid invalid levels.
// Returns a copy of the skill bonus levels for the current skillDepot, capped to avoid invalid levels.
public
Map
<
Integer
,
Integer
>
getProudSkillBonusMap
()
{
public
Map
<
Integer
,
Integer
>
getProudSkillBonusMap
()
{
var
map
=
new
Int2Int
OpenHash
Map
();
var
map
=
new
Int2Int
Array
Map
();
this
.
skillDepot
.
getSkillsAndEnergySkill
().
forEach
(
skillId
->
{
this
.
skillDepot
.
getSkillsAndEnergySkill
().
forEach
(
skillId
->
{
val
skillData
=
GameData
.
getAvatarSkillDataMap
().
get
(
skillId
);
val
skillData
=
GameData
.
getAvatarSkillDataMap
().
get
(
skillId
);
if
(
skillData
==
null
)
return
;
if
(
skillData
==
null
)
return
;
int
proudSkillGroupId
=
skillData
.
getProudSkillGroupId
();
int
proudSkillGroupId
=
skillData
.
getProudSkillGroupId
();
int
bonus
=
this
.
proudSkillBonusMap
.
getOrDefault
(
proudSkillGroupId
,
0
);
int
bonus
=
this
.
proudSkillBonusMap
.
getOrDefault
(
proudSkillGroupId
,
0
);
val
validLevels
=
GameData
.
getProudSkillGroupLevels
(
proudSkillGroupId
);
int
maxLevel
=
GameData
.
getProudSkillGroupMaxLevel
(
proudSkillGroupId
);
if
(
validLevels
!=
null
&&
validLevels
.
size
()
>
0
)
{
int
curLevel
=
this
.
skillLevelMap
.
getOrDefault
(
skillId
,
0
);
int
maxLevel
=
validLevels
.
intStream
().
max
().
getAsInt
();
if
(
maxLevel
>
0
)
{
int
maxBonus
=
maxLevel
-
this
.
skillLevelMap
.
getOrDefault
(
skillId
,
0
);
bonus
=
Math
.
min
(
bonus
,
maxLevel
-
curLevel
);
if
(
maxBonus
<
bonus
)
bonus
=
maxBonus
;
}
}
map
.
put
(
proudSkillGroupId
,
bonus
);
map
.
put
(
proudSkillGroupId
,
bonus
);
});
});
...
@@ -678,8 +666,8 @@ public class Avatar {
...
@@ -678,8 +666,8 @@ public class Avatar {
public
void
recalcConstellations
()
{
public
void
recalcConstellations
()
{
// Clear first
// Clear first
this
.
getP
roudSkillBonusMap
()
.
clear
();
this
.
p
roudSkillBonusMap
.
clear
();
this
.
getS
killExtraChargeMap
()
.
clear
();
this
.
s
killExtraChargeMap
.
clear
();
// Sanity checks
// Sanity checks
if
(
this
.
data
==
null
||
this
.
skillDepot
==
null
)
{
if
(
this
.
data
==
null
||
this
.
skillDepot
==
null
)
{
...
@@ -732,7 +720,7 @@ public class Avatar {
...
@@ -732,7 +720,7 @@ public class Avatar {
}
}
// Add to bonus list
// Add to bonus list
this
.
addProudSkillLevelBonus
(
skill
Id
,
3
);
this
.
addProudSkillLevelBonus
(
skill
Data
.
getProudSkillGroupId
()
,
3
);
return
true
;
return
true
;
}
}
...
@@ -834,9 +822,9 @@ public class Avatar {
...
@@ -834,9 +822,9 @@ public class Avatar {
}
}
public
boolean
sendSkillExtraChargeMap
()
{
public
boolean
sendSkillExtraChargeMap
()
{
va
r
map
=
this
.
getSkillExtraChargeMap
();
va
l
map
=
this
.
getSkillExtraChargeMap
();
if
(
map
.
isEmpty
())
return
false
;
if
(
map
.
isEmpty
())
return
false
;
this
.
getPlayer
().
sendPacket
(
new
PacketAvatarSkillInfoNotify
(
this
.
guid
,
new
Int2Int
OpenHash
Map
(
map
)));
this
.
getPlayer
().
sendPacket
(
new
PacketAvatarSkillInfoNotify
(
this
.
guid
,
new
Int2Int
Array
Map
(
map
)));
// TODO: Remove this allocation when updating interfaces to FastUtils later
return
true
;
return
true
;
}
}
...
@@ -891,7 +879,7 @@ public class Avatar {
...
@@ -891,7 +879,7 @@ public class Avatar {
.
setCoreProudSkillLevel
(
this
.
getCoreProudSkillLevel
())
.
setCoreProudSkillLevel
(
this
.
getCoreProudSkillLevel
())
.
putAllSkillLevelMap
(
this
.
getSkillLevelMap
())
.
putAllSkillLevelMap
(
this
.
getSkillLevelMap
())
.
addAllInherentProudSkillList
(
this
.
getProudSkillList
())
.
addAllInherentProudSkillList
(
this
.
getProudSkillList
())
.
putAllProudSkillExtraLevelMap
(
getProudSkillBonusMap
())
.
putAllProudSkillExtraLevelMap
(
this
.
getProudSkillBonusMap
())
.
setAvatarType
(
1
)
.
setAvatarType
(
1
)
.
setBornTime
(
this
.
getBornTime
())
.
setBornTime
(
this
.
getBornTime
())
.
setFetterInfo
(
avatarFetter
)
.
setFetterInfo
(
avatarFetter
)
...
...
src/main/java/emu/grasscutter/game/entity/EntityAvatar.java
View file @
1ecc3f43
...
@@ -39,6 +39,7 @@ import emu.grasscutter.utils.ProtoHelper;
...
@@ -39,6 +39,7 @@ import emu.grasscutter.utils.ProtoHelper;
import
emu.grasscutter.utils.Utils
;
import
emu.grasscutter.utils.Utils
;
import
it.unimi.dsi.fastutil.ints.Int2FloatMap
;
import
it.unimi.dsi.fastutil.ints.Int2FloatMap
;
import
it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap
;
import
it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap
;
import
lombok.val
;
public
class
EntityAvatar
extends
GameEntity
{
public
class
EntityAvatar
extends
GameEntity
{
private
final
Avatar
avatar
;
private
final
Avatar
avatar
;
...
@@ -193,21 +194,23 @@ public class EntityAvatar extends GameEntity {
...
@@ -193,21 +194,23 @@ public class EntityAvatar extends GameEntity {
}
}
public
SceneAvatarInfo
getSceneAvatarInfo
()
{
public
SceneAvatarInfo
getSceneAvatarInfo
()
{
val
avatar
=
this
.
getAvatar
();
val
player
=
this
.
getPlayer
();
SceneAvatarInfo
.
Builder
avatarInfo
=
SceneAvatarInfo
.
newBuilder
()
SceneAvatarInfo
.
Builder
avatarInfo
=
SceneAvatarInfo
.
newBuilder
()
.
setUid
(
this
.
getP
layer
()
.
getUid
())
.
setUid
(
p
layer
.
getUid
())
.
setAvatarId
(
this
.
getA
vatar
()
.
getAvatarId
())
.
setAvatarId
(
a
vatar
.
getAvatarId
())
.
setGuid
(
this
.
getA
vatar
()
.
getGuid
())
.
setGuid
(
a
vatar
.
getGuid
())
.
setPeerId
(
this
.
getP
layer
()
.
getPeerId
())
.
setPeerId
(
p
layer
.
getPeerId
())
.
addAllTalentIdList
(
this
.
getA
vatar
()
.
getTalentIdList
())
.
addAllTalentIdList
(
a
vatar
.
getTalentIdList
())
.
setCoreProudSkillLevel
(
this
.
getA
vatar
()
.
getCoreProudSkillLevel
())
.
setCoreProudSkillLevel
(
a
vatar
.
getCoreProudSkillLevel
())
.
putAllSkillLevelMap
(
this
.
getA
vatar
()
.
getSkillLevelMap
())
.
putAllSkillLevelMap
(
a
vatar
.
getSkillLevelMap
())
.
setSkillDepotId
(
this
.
getA
vatar
()
.
getSkillDepotId
())
.
setSkillDepotId
(
a
vatar
.
getSkillDepotId
())
.
addAllInherentProudSkillList
(
this
.
getA
vatar
()
.
getProudSkillList
())
.
addAllInherentProudSkillList
(
a
vatar
.
getProudSkillList
())
.
putAllProudSkillExtraLevelMap
(
this
.
getA
vatar
()
.
getProudSkillBonusMap
())
.
putAllProudSkillExtraLevelMap
(
a
vatar
.
getProudSkillBonusMap
())
.
addAllTeamResonanceList
(
this
.
getAvatar
().
getP
layer
()
.
getTeamManager
().
getTeamResonances
())
.
addAllTeamResonanceList
(
p
layer
.
getTeamManager
().
getTeamResonances
())
.
setWearingFlycloakId
(
this
.
getA
vatar
()
.
getFlyCloak
())
.
setWearingFlycloakId
(
a
vatar
.
getFlyCloak
())
.
setCostumeId
(
this
.
getA
vatar
()
.
getCostume
())
.
setCostumeId
(
a
vatar
.
getCostume
())
.
setBornTime
(
this
.
getA
vatar
()
.
getBornTime
());
.
setBornTime
(
a
vatar
.
getBornTime
());
for
(
GameItem
item
:
avatar
.
getEquips
().
values
())
{
for
(
GameItem
item
:
avatar
.
getEquips
().
values
())
{
if
(
item
.
getItemData
().
getEquipType
()
==
EquipType
.
EQUIP_WEAPON
)
{
if
(
item
.
getItemData
().
getEquipType
()
==
EquipType
.
EQUIP_WEAPON
)
{
...
...
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