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
84bf7832
Commit
84bf7832
authored
Nov 05, 2022
by
github-actions
Browse files
Fix whitespace [skip actions]
parent
4d8caf5a
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/data/excels/BattlePassMissionData.java
View file @
84bf7832
...
@@ -21,46 +21,46 @@ public class BattlePassMissionData extends GameResource {
...
@@ -21,46 +21,46 @@ public class BattlePassMissionData extends GameResource {
private
int
progress
;
private
int
progress
;
private
TriggerConfig
triggerConfig
;
private
TriggerConfig
triggerConfig
;
private
BattlePassMissionRefreshType
refreshType
;
private
BattlePassMissionRefreshType
refreshType
;
private
transient
Set
<
Integer
>
mainParams
;
private
transient
Set
<
Integer
>
mainParams
;
public
WatcherTriggerType
getTriggerType
()
{
public
WatcherTriggerType
getTriggerType
()
{
return
this
.
getTriggerConfig
().
getTriggerType
();
return
this
.
getTriggerConfig
().
getTriggerType
();
}
}
public
boolean
isCycleRefresh
()
{
public
boolean
isCycleRefresh
()
{
return
getRefreshType
()
==
null
||
getRefreshType
()
==
BattlePassMissionRefreshType
.
BATTLE_PASS_MISSION_REFRESH_CYCLE_CROSS_SCHEDULE
;
return
getRefreshType
()
==
null
||
getRefreshType
()
==
BattlePassMissionRefreshType
.
BATTLE_PASS_MISSION_REFRESH_CYCLE_CROSS_SCHEDULE
;
}
}
public
boolean
isValidRefreshType
()
{
public
boolean
isValidRefreshType
()
{
return
getRefreshType
()
==
null
||
return
getRefreshType
()
==
null
||
getRefreshType
()
==
BattlePassMissionRefreshType
.
BATTLE_PASS_MISSION_REFRESH_CYCLE_CROSS_SCHEDULE
||
getRefreshType
()
==
BattlePassMissionRefreshType
.
BATTLE_PASS_MISSION_REFRESH_CYCLE_CROSS_SCHEDULE
||
getScheduleId
()
==
2701
;
getScheduleId
()
==
2701
;
}
}
@Override
@Override
public
void
onLoad
()
{
public
void
onLoad
()
{
if
(
this
.
getTriggerConfig
()
!=
null
&&
getTriggerConfig
().
getParamList
()[
0
].
length
()
>
0
)
{
if
(
this
.
getTriggerConfig
()
!=
null
&&
getTriggerConfig
().
getParamList
()[
0
].
length
()
>
0
)
{
this
.
mainParams
=
Arrays
.
stream
(
getTriggerConfig
().
getParamList
()[
0
].
split
(
"[:;,]"
)).
map
(
Integer:
:
parseInt
).
collect
(
Collectors
.
toSet
());
this
.
mainParams
=
Arrays
.
stream
(
getTriggerConfig
().
getParamList
()[
0
].
split
(
"[:;,]"
)).
map
(
Integer:
:
parseInt
).
collect
(
Collectors
.
toSet
());
}
}
}
}
@Getter
@Getter
public
static
class
TriggerConfig
{
public
static
class
TriggerConfig
{
private
WatcherTriggerType
triggerType
;
private
WatcherTriggerType
triggerType
;
private
String
[]
paramList
;
private
String
[]
paramList
;
}
}
public
emu
.
grasscutter
.
net
.
proto
.
BattlePassMissionOuterClass
.
BattlePassMission
toProto
()
{
public
emu
.
grasscutter
.
net
.
proto
.
BattlePassMissionOuterClass
.
BattlePassMission
toProto
()
{
var
protoBuilder
=
emu
.
grasscutter
.
net
.
proto
.
BattlePassMissionOuterClass
.
BattlePassMission
.
newBuilder
();
var
protoBuilder
=
emu
.
grasscutter
.
net
.
proto
.
BattlePassMissionOuterClass
.
BattlePassMission
.
newBuilder
();
protoBuilder
protoBuilder
.
setMissionId
(
getId
())
.
setMissionId
(
getId
())
.
setTotalProgress
(
this
.
getProgress
())
.
setTotalProgress
(
this
.
getProgress
())
.
setRewardBattlePassPoint
(
this
.
getAddPoint
())
.
setRewardBattlePassPoint
(
this
.
getAddPoint
())
.
setMissionStatus
(
MissionStatus
.
MISSION_STATUS_UNFINISHED
)
.
setMissionStatus
(
MissionStatus
.
MISSION_STATUS_UNFINISHED
)
.
setMissionType
(
this
.
getRefreshType
()
==
null
?
0
:
this
.
getRefreshType
().
getValue
());
.
setMissionType
(
this
.
getRefreshType
()
==
null
?
0
:
this
.
getRefreshType
().
getValue
());
return
protoBuilder
.
build
();
return
protoBuilder
.
build
();
}
}
}
}
src/main/java/emu/grasscutter/data/excels/DungeonData.java
View file @
84bf7832
...
@@ -8,23 +8,23 @@ import lombok.Getter;
...
@@ -8,23 +8,23 @@ import lombok.Getter;
@ResourceType
(
name
=
"DungeonExcelConfigData.json"
)
@ResourceType
(
name
=
"DungeonExcelConfigData.json"
)
public
class
DungeonData
extends
GameResource
{
public
class
DungeonData
extends
GameResource
{
@Getter
(
onMethod
=
@__
(
@Override
))
@Getter
(
onMethod
=
@__
(
@Override
))
private
int
id
;
private
int
id
;
@Getter
private
int
sceneId
;
@Getter
private
int
sceneId
;
@Getter
private
int
showLevel
;
@Getter
private
int
showLevel
;
private
int
passRewardPreviewID
;
private
int
passRewardPreviewID
;
private
String
involveType
;
// TODO enum
private
String
involveType
;
// TODO enum
private
RewardPreviewData
previewData
;
private
RewardPreviewData
previewData
;
@Getter
private
int
statueCostID
;
@Getter
private
int
statueCostID
;
@Getter
private
int
statueCostCount
;
@Getter
private
int
statueCostCount
;
public
RewardPreviewData
getRewardPreview
()
{
return
previewData
;}
public
RewardPreviewData
getRewardPreview
()
{
return
previewData
;}
@Override
@Override
public
void
onLoad
()
{
public
void
onLoad
()
{
if
(
this
.
passRewardPreviewID
>
0
)
{
if
(
this
.
passRewardPreviewID
>
0
)
{
this
.
previewData
=
GameData
.
getRewardPreviewDataMap
().
get
(
this
.
passRewardPreviewID
);
this
.
previewData
=
GameData
.
getRewardPreviewDataMap
().
get
(
this
.
passRewardPreviewID
);
}
}
}
}
}
}
src/main/java/emu/grasscutter/data/excels/MonsterData.java
View file @
84bf7832
...
@@ -56,7 +56,7 @@ public class MonsterData extends GameResource {
...
@@ -56,7 +56,7 @@ public class MonsterData extends GameResource {
private
List
<
PropGrowCurve
>
propGrowCurves
;
private
List
<
PropGrowCurve
>
propGrowCurves
;
private
long
nameTextMapHash
;
private
long
nameTextMapHash
;
private
int
campID
;
private
int
campID
;
// Transient
// Transient
private
int
weaponId
;
private
int
weaponId
;
private
MonsterDescribeData
describeData
;
private
MonsterDescribeData
describeData
;
...
@@ -78,23 +78,23 @@ public class MonsterData extends GameResource {
...
@@ -78,23 +78,23 @@ public class MonsterData extends GameResource {
};
};
}
}
@Override
@Override
public
void
onLoad
()
{
public
void
onLoad
()
{
this
.
describeData
=
GameData
.
getMonsterDescribeDataMap
().
get
(
this
.
getDescribeId
());
this
.
describeData
=
GameData
.
getMonsterDescribeDataMap
().
get
(
this
.
getDescribeId
());
for
(
int
id
:
this
.
equips
)
{
for
(
int
id
:
this
.
equips
)
{
if
(
id
==
0
)
{
if
(
id
==
0
)
{
continue
;
continue
;
}
}
GadgetData
gadget
=
GameData
.
getGadgetDataMap
().
get
(
id
);
GadgetData
gadget
=
GameData
.
getGadgetDataMap
().
get
(
id
);
if
(
gadget
==
null
)
{
if
(
gadget
==
null
)
{
continue
;
continue
;
}
}
if
(
gadget
.
getItemJsonName
().
equals
(
"Default_MonsterWeapon"
))
{
if
(
gadget
.
getItemJsonName
().
equals
(
"Default_MonsterWeapon"
))
{
this
.
weaponId
=
id
;
this
.
weaponId
=
id
;
}
}
}
}
}
}
@Getter
@Getter
public
class
HpDrops
{
public
class
HpDrops
{
...
...
src/main/java/emu/grasscutter/data/excels/RewardPreviewData.java
View file @
84bf7832
...
@@ -13,23 +13,23 @@ import emu.grasscutter.data.common.ItemParamStringData;
...
@@ -13,23 +13,23 @@ import emu.grasscutter.data.common.ItemParamStringData;
@ResourceType
(
name
=
"RewardPreviewExcelConfigData.json"
,
loadPriority
=
LoadPriority
.
HIGH
)
@ResourceType
(
name
=
"RewardPreviewExcelConfigData.json"
,
loadPriority
=
LoadPriority
.
HIGH
)
public
class
RewardPreviewData
extends
GameResource
{
public
class
RewardPreviewData
extends
GameResource
{
@Getter
(
onMethod
=
@__
(
@Override
))
@Getter
(
onMethod
=
@__
(
@Override
))
private
int
id
;
private
int
id
;
private
ItemParamStringData
[]
previewItems
;
private
ItemParamStringData
[]
previewItems
;
private
ItemParamData
[]
previewItemsArray
;
private
ItemParamData
[]
previewItemsArray
;
public
ItemParamData
[]
getPreviewItems
()
{
public
ItemParamData
[]
getPreviewItems
()
{
return
previewItemsArray
;
return
previewItemsArray
;
}
}
@Override
@Override
public
void
onLoad
()
{
public
void
onLoad
()
{
if
(
this
.
previewItems
!=
null
&&
this
.
previewItems
.
length
>
0
)
{
if
(
this
.
previewItems
!=
null
&&
this
.
previewItems
.
length
>
0
)
{
this
.
previewItemsArray
=
Arrays
.
stream
(
this
.
previewItems
)
this
.
previewItemsArray
=
Arrays
.
stream
(
this
.
previewItems
)
.
filter
(
d
->
d
.
getId
()
>
0
&&
d
.
getCount
()
!=
null
&&
!
d
.
getCount
().
isEmpty
())
.
filter
(
d
->
d
.
getId
()
>
0
&&
d
.
getCount
()
!=
null
&&
!
d
.
getCount
().
isEmpty
())
.
map
(
ItemParamStringData:
:
toItemParamData
)
.
map
(
ItemParamStringData:
:
toItemParamData
)
.
toArray
(
size
->
new
ItemParamData
[
size
]);
.
toArray
(
size
->
new
ItemParamData
[
size
]);
}
else
{
}
else
{
this
.
previewItemsArray
=
new
ItemParamData
[
0
];
this
.
previewItemsArray
=
new
ItemParamData
[
0
];
}
}
}
}
}
}
src/main/java/emu/grasscutter/game/props/FightProperty.java
View file @
84bf7832
...
@@ -16,131 +16,131 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
...
@@ -16,131 +16,131 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import
lombok.Getter
;
import
lombok.Getter
;
public
enum
FightProperty
{
public
enum
FightProperty
{
FIGHT_PROP_NONE
(
0
),
FIGHT_PROP_NONE
(
0
),
FIGHT_PROP_BASE_HP
(
1
),
FIGHT_PROP_BASE_HP
(
1
),
FIGHT_PROP_HP
(
2
),
FIGHT_PROP_HP
(
2
),
FIGHT_PROP_HP_PERCENT
(
3
),
FIGHT_PROP_HP_PERCENT
(
3
),
FIGHT_PROP_BASE_ATTACK
(
4
),
FIGHT_PROP_BASE_ATTACK
(
4
),
FIGHT_PROP_ATTACK
(
5
),
FIGHT_PROP_ATTACK
(
5
),
FIGHT_PROP_ATTACK_PERCENT
(
6
),
FIGHT_PROP_ATTACK_PERCENT
(
6
),
FIGHT_PROP_BASE_DEFENSE
(
7
),
FIGHT_PROP_BASE_DEFENSE
(
7
),
FIGHT_PROP_DEFENSE
(
8
),
FIGHT_PROP_DEFENSE
(
8
),
FIGHT_PROP_DEFENSE_PERCENT
(
9
),
FIGHT_PROP_DEFENSE_PERCENT
(
9
),
FIGHT_PROP_BASE_SPEED
(
10
),
FIGHT_PROP_BASE_SPEED
(
10
),
FIGHT_PROP_SPEED_PERCENT
(
11
),
FIGHT_PROP_SPEED_PERCENT
(
11
),
FIGHT_PROP_HP_MP_PERCENT
(
12
),
FIGHT_PROP_HP_MP_PERCENT
(
12
),
FIGHT_PROP_ATTACK_MP_PERCENT
(
13
),
FIGHT_PROP_ATTACK_MP_PERCENT
(
13
),
FIGHT_PROP_CRITICAL
(
20
),
FIGHT_PROP_CRITICAL
(
20
),
FIGHT_PROP_ANTI_CRITICAL
(
21
),
FIGHT_PROP_ANTI_CRITICAL
(
21
),
FIGHT_PROP_CRITICAL_HURT
(
22
),
FIGHT_PROP_CRITICAL_HURT
(
22
),
FIGHT_PROP_CHARGE_EFFICIENCY
(
23
),
FIGHT_PROP_CHARGE_EFFICIENCY
(
23
),
FIGHT_PROP_ADD_HURT
(
24
),
FIGHT_PROP_ADD_HURT
(
24
),
FIGHT_PROP_SUB_HURT
(
25
),
FIGHT_PROP_SUB_HURT
(
25
),
FIGHT_PROP_HEAL_ADD
(
26
),
FIGHT_PROP_HEAL_ADD
(
26
),
FIGHT_PROP_HEALED_ADD
(
27
),
FIGHT_PROP_HEALED_ADD
(
27
),
FIGHT_PROP_ELEMENT_MASTERY
(
28
),
FIGHT_PROP_ELEMENT_MASTERY
(
28
),
FIGHT_PROP_PHYSICAL_SUB_HURT
(
29
),
FIGHT_PROP_PHYSICAL_SUB_HURT
(
29
),
FIGHT_PROP_PHYSICAL_ADD_HURT
(
30
),
FIGHT_PROP_PHYSICAL_ADD_HURT
(
30
),
FIGHT_PROP_DEFENCE_IGNORE_RATIO
(
31
),
FIGHT_PROP_DEFENCE_IGNORE_RATIO
(
31
),
FIGHT_PROP_DEFENCE_IGNORE_DELTA
(
32
),
FIGHT_PROP_DEFENCE_IGNORE_DELTA
(
32
),
FIGHT_PROP_FIRE_ADD_HURT
(
40
),
FIGHT_PROP_FIRE_ADD_HURT
(
40
),
FIGHT_PROP_ELEC_ADD_HURT
(
41
),
FIGHT_PROP_ELEC_ADD_HURT
(
41
),
FIGHT_PROP_WATER_ADD_HURT
(
42
),
FIGHT_PROP_WATER_ADD_HURT
(
42
),
FIGHT_PROP_GRASS_ADD_HURT
(
43
),
FIGHT_PROP_GRASS_ADD_HURT
(
43
),
FIGHT_PROP_WIND_ADD_HURT
(
44
),
FIGHT_PROP_WIND_ADD_HURT
(
44
),
FIGHT_PROP_ROCK_ADD_HURT
(
45
),
FIGHT_PROP_ROCK_ADD_HURT
(
45
),
FIGHT_PROP_ICE_ADD_HURT
(
46
),
FIGHT_PROP_ICE_ADD_HURT
(
46
),
FIGHT_PROP_HIT_HEAD_ADD_HURT
(
47
),
FIGHT_PROP_HIT_HEAD_ADD_HURT
(
47
),
FIGHT_PROP_FIRE_SUB_HURT
(
50
),
FIGHT_PROP_FIRE_SUB_HURT
(
50
),
FIGHT_PROP_ELEC_SUB_HURT
(
51
),
FIGHT_PROP_ELEC_SUB_HURT
(
51
),
FIGHT_PROP_WATER_SUB_HURT
(
52
),
FIGHT_PROP_WATER_SUB_HURT
(
52
),
FIGHT_PROP_GRASS_SUB_HURT
(
53
),
FIGHT_PROP_GRASS_SUB_HURT
(
53
),
FIGHT_PROP_WIND_SUB_HURT
(
54
),
FIGHT_PROP_WIND_SUB_HURT
(
54
),
FIGHT_PROP_ROCK_SUB_HURT
(
55
),
FIGHT_PROP_ROCK_SUB_HURT
(
55
),
FIGHT_PROP_ICE_SUB_HURT
(
56
),
FIGHT_PROP_ICE_SUB_HURT
(
56
),
FIGHT_PROP_EFFECT_HIT
(
60
),
FIGHT_PROP_EFFECT_HIT
(
60
),
FIGHT_PROP_EFFECT_RESIST
(
61
),
FIGHT_PROP_EFFECT_RESIST
(
61
),
FIGHT_PROP_FREEZE_RESIST
(
62
),
FIGHT_PROP_FREEZE_RESIST
(
62
),
FIGHT_PROP_TORPOR_RESIST
(
63
),
FIGHT_PROP_TORPOR_RESIST
(
63
),
FIGHT_PROP_DIZZY_RESIST
(
64
),
FIGHT_PROP_DIZZY_RESIST
(
64
),
FIGHT_PROP_FREEZE_SHORTEN
(
65
),
FIGHT_PROP_FREEZE_SHORTEN
(
65
),
FIGHT_PROP_TORPOR_SHORTEN
(
66
),
FIGHT_PROP_TORPOR_SHORTEN
(
66
),
FIGHT_PROP_DIZZY_SHORTEN
(
67
),
FIGHT_PROP_DIZZY_SHORTEN
(
67
),
FIGHT_PROP_MAX_FIRE_ENERGY
(
70
),
FIGHT_PROP_MAX_FIRE_ENERGY
(
70
),
FIGHT_PROP_MAX_ELEC_ENERGY
(
71
),
FIGHT_PROP_MAX_ELEC_ENERGY
(
71
),
FIGHT_PROP_MAX_WATER_ENERGY
(
72
),
FIGHT_PROP_MAX_WATER_ENERGY
(
72
),
FIGHT_PROP_MAX_GRASS_ENERGY
(
73
),
FIGHT_PROP_MAX_GRASS_ENERGY
(
73
),
FIGHT_PROP_MAX_WIND_ENERGY
(
74
),
FIGHT_PROP_MAX_WIND_ENERGY
(
74
),
FIGHT_PROP_MAX_ICE_ENERGY
(
75
),
FIGHT_PROP_MAX_ICE_ENERGY
(
75
),
FIGHT_PROP_MAX_ROCK_ENERGY
(
76
),
FIGHT_PROP_MAX_ROCK_ENERGY
(
76
),
FIGHT_PROP_SKILL_CD_MINUS_RATIO
(
80
),
FIGHT_PROP_SKILL_CD_MINUS_RATIO
(
80
),
FIGHT_PROP_SHIELD_COST_MINUS_RATIO
(
81
),
FIGHT_PROP_SHIELD_COST_MINUS_RATIO
(
81
),
FIGHT_PROP_CUR_FIRE_ENERGY
(
1000
),
FIGHT_PROP_CUR_FIRE_ENERGY
(
1000
),
FIGHT_PROP_CUR_ELEC_ENERGY
(
1001
),
FIGHT_PROP_CUR_ELEC_ENERGY
(
1001
),
FIGHT_PROP_CUR_WATER_ENERGY
(
1002
),
FIGHT_PROP_CUR_WATER_ENERGY
(
1002
),
FIGHT_PROP_CUR_GRASS_ENERGY
(
1003
),
FIGHT_PROP_CUR_GRASS_ENERGY
(
1003
),
FIGHT_PROP_CUR_WIND_ENERGY
(
1004
),
FIGHT_PROP_CUR_WIND_ENERGY
(
1004
),
FIGHT_PROP_CUR_ICE_ENERGY
(
1005
),
FIGHT_PROP_CUR_ICE_ENERGY
(
1005
),
FIGHT_PROP_CUR_ROCK_ENERGY
(
1006
),
FIGHT_PROP_CUR_ROCK_ENERGY
(
1006
),
FIGHT_PROP_CUR_HP
(
1010
),
FIGHT_PROP_CUR_HP
(
1010
),
FIGHT_PROP_MAX_HP
(
2000
),
FIGHT_PROP_MAX_HP
(
2000
),
FIGHT_PROP_CUR_ATTACK
(
2001
),
FIGHT_PROP_CUR_ATTACK
(
2001
),
FIGHT_PROP_CUR_DEFENSE
(
2002
),
FIGHT_PROP_CUR_DEFENSE
(
2002
),
FIGHT_PROP_CUR_SPEED
(
2003
),
FIGHT_PROP_CUR_SPEED
(
2003
),
FIGHT_PROP_NONEXTRA_ATTACK
(
3000
),
FIGHT_PROP_NONEXTRA_ATTACK
(
3000
),
FIGHT_PROP_NONEXTRA_DEFENSE
(
3001
),
FIGHT_PROP_NONEXTRA_DEFENSE
(
3001
),
FIGHT_PROP_NONEXTRA_CRITICAL
(
3002
),
FIGHT_PROP_NONEXTRA_CRITICAL
(
3002
),
FIGHT_PROP_NONEXTRA_ANTI_CRITICAL
(
3003
),
FIGHT_PROP_NONEXTRA_ANTI_CRITICAL
(
3003
),
FIGHT_PROP_NONEXTRA_CRITICAL_HURT
(
3004
),
FIGHT_PROP_NONEXTRA_CRITICAL_HURT
(
3004
),
FIGHT_PROP_NONEXTRA_CHARGE_EFFICIENCY
(
3005
),
FIGHT_PROP_NONEXTRA_CHARGE_EFFICIENCY
(
3005
),
FIGHT_PROP_NONEXTRA_ELEMENT_MASTERY
(
3006
),
FIGHT_PROP_NONEXTRA_ELEMENT_MASTERY
(
3006
),
FIGHT_PROP_NONEXTRA_PHYSICAL_SUB_HURT
(
3007
),
FIGHT_PROP_NONEXTRA_PHYSICAL_SUB_HURT
(
3007
),
FIGHT_PROP_NONEXTRA_FIRE_ADD_HURT
(
3008
),
FIGHT_PROP_NONEXTRA_FIRE_ADD_HURT
(
3008
),
FIGHT_PROP_NONEXTRA_ELEC_ADD_HURT
(
3009
),
FIGHT_PROP_NONEXTRA_ELEC_ADD_HURT
(
3009
),
FIGHT_PROP_NONEXTRA_WATER_ADD_HURT
(
3010
),
FIGHT_PROP_NONEXTRA_WATER_ADD_HURT
(
3010
),
FIGHT_PROP_NONEXTRA_GRASS_ADD_HURT
(
3011
),
FIGHT_PROP_NONEXTRA_GRASS_ADD_HURT
(
3011
),
FIGHT_PROP_NONEXTRA_WIND_ADD_HURT
(
3012
),
FIGHT_PROP_NONEXTRA_WIND_ADD_HURT
(
3012
),
FIGHT_PROP_NONEXTRA_ROCK_ADD_HURT
(
3013
),
FIGHT_PROP_NONEXTRA_ROCK_ADD_HURT
(
3013
),
FIGHT_PROP_NONEXTRA_ICE_ADD_HURT
(
3014
),
FIGHT_PROP_NONEXTRA_ICE_ADD_HURT
(
3014
),
FIGHT_PROP_NONEXTRA_FIRE_SUB_HURT
(
3015
),
FIGHT_PROP_NONEXTRA_FIRE_SUB_HURT
(
3015
),
FIGHT_PROP_NONEXTRA_ELEC_SUB_HURT
(
3016
),
FIGHT_PROP_NONEXTRA_ELEC_SUB_HURT
(
3016
),
FIGHT_PROP_NONEXTRA_WATER_SUB_HURT
(
3017
),
FIGHT_PROP_NONEXTRA_WATER_SUB_HURT
(
3017
),
FIGHT_PROP_NONEXTRA_GRASS_SUB_HURT
(
3018
),
FIGHT_PROP_NONEXTRA_GRASS_SUB_HURT
(
3018
),
FIGHT_PROP_NONEXTRA_WIND_SUB_HURT
(
3019
),
FIGHT_PROP_NONEXTRA_WIND_SUB_HURT
(
3019
),
FIGHT_PROP_NONEXTRA_ROCK_SUB_HURT
(
3020
),
FIGHT_PROP_NONEXTRA_ROCK_SUB_HURT
(
3020
),
FIGHT_PROP_NONEXTRA_ICE_SUB_HURT
(
3021
),
FIGHT_PROP_NONEXTRA_ICE_SUB_HURT
(
3021
),
FIGHT_PROP_NONEXTRA_SKILL_CD_MINUS_RATIO
(
3022
),
FIGHT_PROP_NONEXTRA_SKILL_CD_MINUS_RATIO
(
3022
),
FIGHT_PROP_NONEXTRA_SHIELD_COST_MINUS_RATIO
(
3023
),
FIGHT_PROP_NONEXTRA_SHIELD_COST_MINUS_RATIO
(
3023
),
FIGHT_PROP_NONEXTRA_PHYSICAL_ADD_HURT
(
3024
);
FIGHT_PROP_NONEXTRA_PHYSICAL_ADD_HURT
(
3024
);
private
final
int
id
;
private
final
int
id
;
private
static
final
Int2ObjectMap
<
FightProperty
>
map
=
new
Int2ObjectOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
FightProperty
>
map
=
new
Int2ObjectOpenHashMap
<>();
private
static
final
Map
<
String
,
FightProperty
>
stringMap
=
new
HashMap
<>();
private
static
final
Map
<
String
,
FightProperty
>
stringMap
=
new
HashMap
<>();
public
static
final
int
[]
fightProps
=
new
int
[]
{
1
,
4
,
7
,
20
,
21
,
22
,
23
,
26
,
27
,
28
,
29
,
30
,
40
,
41
,
42
,
43
,
44
,
45
,
46
,
50
,
51
,
52
,
53
,
54
,
55
,
56
,
2000
,
2001
,
2002
,
2003
,
1010
};
public
static
final
int
[]
fightProps
=
new
int
[]
{
1
,
4
,
7
,
20
,
21
,
22
,
23
,
26
,
27
,
28
,
29
,
30
,
40
,
41
,
42
,
43
,
44
,
45
,
46
,
50
,
51
,
52
,
53
,
54
,
55
,
56
,
2000
,
2001
,
2002
,
2003
,
1010
};
static
{
static
{
Stream
.
of
(
values
()).
forEach
(
e
->
{
Stream
.
of
(
values
()).
forEach
(
e
->
{
map
.
put
(
e
.
getId
(),
e
);
map
.
put
(
e
.
getId
(),
e
);
stringMap
.
put
(
e
.
name
(),
e
);
stringMap
.
put
(
e
.
name
(),
e
);
});
});
}
}
private
FightProperty
(
int
id
)
{
private
FightProperty
(
int
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
public
int
getId
()
{
public
int
getId
()
{
return
id
;
return
id
;
}
}
public
static
FightProperty
getPropById
(
int
value
)
{
public
static
FightProperty
getPropById
(
int
value
)
{
return
map
.
getOrDefault
(
value
,
FIGHT_PROP_NONE
);
return
map
.
getOrDefault
(
value
,
FIGHT_PROP_NONE
);
}
}
public
static
FightProperty
getPropByName
(
String
name
)
{
public
static
FightProperty
getPropByName
(
String
name
)
{
return
stringMap
.
getOrDefault
(
name
,
FIGHT_PROP_NONE
);
return
stringMap
.
getOrDefault
(
name
,
FIGHT_PROP_NONE
);
}
}
public
static
FightProperty
getPropByShortName
(
String
name
)
{
public
static
FightProperty
getPropByShortName
(
String
name
)
{
return
shortNameMap
.
getOrDefault
(
name
,
FIGHT_PROP_NONE
);
return
shortNameMap
.
getOrDefault
(
name
,
FIGHT_PROP_NONE
);
...
@@ -153,28 +153,28 @@ public enum FightProperty {
...
@@ -153,28 +153,28 @@ public enum FightProperty {
// This was originally for relic properties so some names might not be applicable for e.g. setstats
// This was originally for relic properties so some names might not be applicable for e.g. setstats
private
static
final
Map
<
String
,
FightProperty
>
shortNameMap
=
Map
.
ofEntries
(
private
static
final
Map
<
String
,
FightProperty
>
shortNameMap
=
Map
.
ofEntries
(
// Normal relic stats
// Normal relic stats
entry
(
"hp"
,
FIGHT_PROP_HP
),
entry
(
"hp"
,
FIGHT_PROP_HP
),
entry
(
"atk"
,
FIGHT_PROP_ATTACK
),
entry
(
"atk"
,
FIGHT_PROP_ATTACK
),
entry
(
"def"
,
FIGHT_PROP_DEFENSE
),
entry
(
"def"
,
FIGHT_PROP_DEFENSE
),
entry
(
"hp%"
,
FIGHT_PROP_HP_PERCENT
),
entry
(
"hp%"
,
FIGHT_PROP_HP_PERCENT
),
entry
(
"atk%"
,
FIGHT_PROP_ATTACK_PERCENT
),
entry
(
"atk%"
,
FIGHT_PROP_ATTACK_PERCENT
),
entry
(
"def%"
,
FIGHT_PROP_DEFENSE_PERCENT
),
entry
(
"def%"
,
FIGHT_PROP_DEFENSE_PERCENT
),
entry
(
"em"
,
FIGHT_PROP_ELEMENT_MASTERY
),
entry
(
"em"
,
FIGHT_PROP_ELEMENT_MASTERY
),
entry
(
"er"
,
FIGHT_PROP_CHARGE_EFFICIENCY
),
entry
(
"er"
,
FIGHT_PROP_CHARGE_EFFICIENCY
),
entry
(
"hb"
,
FIGHT_PROP_HEAL_ADD
),
entry
(
"hb"
,
FIGHT_PROP_HEAL_ADD
),
entry
(
"heal"
,
FIGHT_PROP_HEAL_ADD
),
entry
(
"heal"
,
FIGHT_PROP_HEAL_ADD
),
entry
(
"cd"
,
FIGHT_PROP_CRITICAL_HURT
),
entry
(
"cd"
,
FIGHT_PROP_CRITICAL_HURT
),
entry
(
"cdmg"
,
FIGHT_PROP_CRITICAL_HURT
),
entry
(
"cdmg"
,
FIGHT_PROP_CRITICAL_HURT
),
entry
(
"cr"
,
FIGHT_PROP_CRITICAL
),
entry
(
"cr"
,
FIGHT_PROP_CRITICAL
),
entry
(
"crate"
,
FIGHT_PROP_CRITICAL
),
entry
(
"crate"
,
FIGHT_PROP_CRITICAL
),
entry
(
"phys%"
,
FIGHT_PROP_PHYSICAL_ADD_HURT
),
entry
(
"phys%"
,
FIGHT_PROP_PHYSICAL_ADD_HURT
),
entry
(
"dendro%"
,
FIGHT_PROP_GRASS_ADD_HURT
),
entry
(
"dendro%"
,
FIGHT_PROP_GRASS_ADD_HURT
),
entry
(
"geo%"
,
FIGHT_PROP_ROCK_ADD_HURT
),
entry
(
"geo%"
,
FIGHT_PROP_ROCK_ADD_HURT
),
entry
(
"anemo%"
,
FIGHT_PROP_WIND_ADD_HURT
),
entry
(
"anemo%"
,
FIGHT_PROP_WIND_ADD_HURT
),
entry
(
"hydro%"
,
FIGHT_PROP_WATER_ADD_HURT
),
entry
(
"hydro%"
,
FIGHT_PROP_WATER_ADD_HURT
),
entry
(
"cryo%"
,
FIGHT_PROP_ICE_ADD_HURT
),
entry
(
"cryo%"
,
FIGHT_PROP_ICE_ADD_HURT
),
entry
(
"electro%"
,
FIGHT_PROP_ELEC_ADD_HURT
),
entry
(
"electro%"
,
FIGHT_PROP_ELEC_ADD_HURT
),
entry
(
"pyro%"
,
FIGHT_PROP_FIRE_ADD_HURT
),
entry
(
"pyro%"
,
FIGHT_PROP_FIRE_ADD_HURT
),
// Other stats
// Other stats
entry
(
"maxhp"
,
FIGHT_PROP_MAX_HP
),
entry
(
"maxhp"
,
FIGHT_PROP_MAX_HP
),
entry
(
"dmg"
,
FIGHT_PROP_ADD_HURT
),
// This seems to get reset after attacks
entry
(
"dmg"
,
FIGHT_PROP_ADD_HURT
),
// This seems to get reset after attacks
...
@@ -191,7 +191,7 @@ public enum FightProperty {
...
@@ -191,7 +191,7 @@ public enum FightProperty {
entry
(
"reshydro"
,
FIGHT_PROP_WATER_SUB_HURT
),
entry
(
"reshydro"
,
FIGHT_PROP_WATER_SUB_HURT
),
entry
(
"respyro"
,
FIGHT_PROP_FIRE_SUB_HURT
),
entry
(
"respyro"
,
FIGHT_PROP_FIRE_SUB_HURT
),
entry
(
"resphys"
,
FIGHT_PROP_PHYSICAL_SUB_HURT
)
entry
(
"resphys"
,
FIGHT_PROP_PHYSICAL_SUB_HURT
)
);
);
private
static
final
List
<
FightProperty
>
flatProps
=
Arrays
.
asList
(
private
static
final
List
<
FightProperty
>
flatProps
=
Arrays
.
asList
(
FIGHT_PROP_BASE_HP
,
FIGHT_PROP_HP
,
FIGHT_PROP_BASE_ATTACK
,
FIGHT_PROP_ATTACK
,
FIGHT_PROP_BASE_DEFENSE
,
FIGHT_PROP_BASE_HP
,
FIGHT_PROP_HP
,
FIGHT_PROP_BASE_ATTACK
,
FIGHT_PROP_ATTACK
,
FIGHT_PROP_BASE_DEFENSE
,
...
...
src/main/java/emu/grasscutter/task/TaskMap.java
View file @
84bf7832
package
emu.grasscutter.task
;
package
emu.grasscutter.task
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
org.quartz.*
;
import
org.quartz.*
;
import
org.quartz.impl.StdSchedulerFactory
;
import
org.quartz.impl.StdSchedulerFactory
;
import
org.reflections.Reflections
;
import
org.reflections.Reflections
;
import
java.util.*
;
import
java.util.*
;
@SuppressWarnings
({
"UnusedReturnValue"
,
"unused"
})
@SuppressWarnings
({
"UnusedReturnValue"
,
"unused"
})
public
final
class
TaskMap
{
public
final
class
TaskMap
{
private
final
Map
<
String
,
TaskHandler
>
tasks
=
new
HashMap
<>();
private
final
Map
<
String
,
TaskHandler
>
tasks
=
new
HashMap
<>();
private
final
Map
<
String
,
Task
>
annotations
=
new
HashMap
<>();
private
final
Map
<
String
,
Task
>
annotations
=
new
HashMap
<>();
private
final
Map
<
String
,
TaskHandler
>
afterReset
=
new
HashMap
<>();
private
final
Map
<
String
,
TaskHandler
>
afterReset
=
new
HashMap
<>();
private
final
SchedulerFactory
schedulerFactory
=
new
StdSchedulerFactory
();
private
final
SchedulerFactory
schedulerFactory
=
new
StdSchedulerFactory
();
public
TaskMap
()
{
public
TaskMap
()
{
this
(
false
);
this
(
false
);
}
}
public
TaskMap
(
boolean
scan
)
{
public
TaskMap
(
boolean
scan
)
{
if
(
scan
)
this
.
scan
();
if
(
scan
)
this
.
scan
();
}
}
public
static
TaskMap
getInstance
()
{
public
static
TaskMap
getInstance
()
{
return
Grasscutter
.
getGameServer
().
getTaskMap
();
return
Grasscutter
.
getGameServer
().
getTaskMap
();
}
}
public
void
resetNow
()
{
public
void
resetNow
()
{
// Unregister all tasks
// Unregister all tasks
for
(
TaskHandler
task
:
this
.
tasks
.
values
())
{
for
(
TaskHandler
task
:
this
.
tasks
.
values
())
{
unregisterTask
(
task
);
unregisterTask
(
task
);
}
}
// Run all afterReset tasks
// Run all afterReset tasks
for
(
TaskHandler
task
:
this
.
afterReset
.
values
())
{
for
(
TaskHandler
task
:
this
.
afterReset
.
values
())
{
try
{
try
{
task
.
restartExecute
();
task
.
restartExecute
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
// Remove all afterReset tasks
// Remove all afterReset tasks
this
.
afterReset
.
clear
();
this
.
afterReset
.
clear
();
// Register all tasks
// Register all tasks
for
(
TaskHandler
task
:
this
.
tasks
.
values
())
{
for
(
TaskHandler
task
:
this
.
tasks
.
values
())
{
registerTask
(
task
.
getClass
().
getAnnotation
(
Task
.
class
).
taskName
(),
task
);
registerTask
(
task
.
getClass
().
getAnnotation
(
Task
.
class
).
taskName
(),
task
);
}
}
}
}
public
TaskMap
unregisterTask
(
TaskHandler
task
)
{
public
TaskMap
unregisterTask
(
TaskHandler
task
)
{
this
.
tasks
.
remove
(
task
.
getClass
().
getAnnotation
(
Task
.
class
).
taskName
());
this
.
tasks
.
remove
(
task
.
getClass
().
getAnnotation
(
Task
.
class
).
taskName
());
this
.
annotations
.
remove
(
task
.
getClass
().
getAnnotation
(
Task
.
class
).
taskName
());
this
.
annotations
.
remove
(
task
.
getClass
().
getAnnotation
(
Task
.
class
).
taskName
());
try
{
try
{
Scheduler
scheduler
=
schedulerFactory
.
getScheduler
();
Scheduler
scheduler
=
schedulerFactory
.
getScheduler
();
scheduler
.
deleteJob
(
new
JobKey
(
task
.
getClass
().
getAnnotation
(
Task
.
class
).
taskName
()));
scheduler
.
deleteJob
(
new
JobKey
(
task
.
getClass
().
getAnnotation
(
Task
.
class
).
taskName
()));
}
catch
(
SchedulerException
e
)
{
}
catch
(
SchedulerException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
task
.
onDisable
();
task
.
onDisable
();
return
this
;
return
this
;
}
}
public
boolean
pauseTask
(
String
taskName
)
{
public
boolean
pauseTask
(
String
taskName
)
{
try
{
try
{
Scheduler
scheduler
=
schedulerFactory
.
getScheduler
();
Scheduler
scheduler
=
schedulerFactory
.
getScheduler
();
scheduler
.
pauseJob
(
new
JobKey
(
taskName
));
scheduler
.
pauseJob
(
new
JobKey
(
taskName
));
}
catch
(
SchedulerException
e
)
{
}
catch
(
SchedulerException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
false
;
return
false
;
}
}
return
true
;
return
true
;
}
}
public
boolean
resumeTask
(
String
taskName
)
{
public
boolean
resumeTask
(
String
taskName
)
{
try
{
try
{
Scheduler
scheduler
=
schedulerFactory
.
getScheduler
();
Scheduler
scheduler
=
schedulerFactory
.
getScheduler
();
scheduler
.
resumeJob
(
new
JobKey
(
taskName
));
scheduler
.
resumeJob
(
new
JobKey
(
taskName
));
}
catch
(
SchedulerException
e
)
{
}
catch
(
SchedulerException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
false
;
return
false
;
}
}
return
true
;
return
true
;
}
}
public
boolean
cancelTask
(
String
taskName
)
{
public
boolean
cancelTask
(
String
taskName
)
{
Task
task
=
this
.
annotations
.
get
(
taskName
);
Task
task
=
this
.
annotations
.
get
(
taskName
);
if
(
task
==
null
)
return
false
;
if
(
task
==
null
)
return
false
;
try
{
try
{
this
.
unregisterTask
(
this
.
tasks
.
get
(
taskName
));
this
.
unregisterTask
(
this
.
tasks
.
get
(
taskName
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
false
;
return
false
;
}
}
return
true
;
return
true
;
}
}
public
TaskMap
registerTask
(
String
taskName
,
TaskHandler
task
)
{
public
TaskMap
registerTask
(
String
taskName
,
TaskHandler
task
)
{
Task
annotation
=
task
.
getClass
().
getAnnotation
(
Task
.
class
);
Task
annotation
=
task
.
getClass
().
getAnnotation
(
Task
.
class
);
this
.
annotations
.
put
(
taskName
,
annotation
);
this
.
annotations
.
put
(
taskName
,
annotation
);
this
.
tasks
.
put
(
taskName
,
task
);
this
.
tasks
.
put
(
taskName
,
task
);
// register task
// register task
try
{
try
{
Scheduler
scheduler
=
schedulerFactory
.
getScheduler
();
Scheduler
scheduler
=
schedulerFactory
.
getScheduler
();
JobDetail
job
=
JobBuilder
JobDetail
job
=
JobBuilder
.
newJob
(
task
.
getClass
())
.
newJob
(
task
.
getClass
())
.
withIdentity
(
taskName
)
.
withIdentity
(
taskName
)
.
build
();
.
build
();
Trigger
convTrigger
=
TriggerBuilder
.
newTrigger
()
Trigger
convTrigger
=
TriggerBuilder
.
newTrigger
()
.
withIdentity
(
annotation
.
triggerName
())
.
withIdentity
(
annotation
.
triggerName
())
.
withSchedule
(
CronScheduleBuilder
.
cronSchedule
(
annotation
.
taskCronExpression
()))
.
withSchedule
(
CronScheduleBuilder
.
cronSchedule
(
annotation
.
taskCronExpression
()))
.
build
();
.
build
();
scheduler
.
scheduleJob
(
job
,
convTrigger
);
scheduler
.
scheduleJob
(
job
,
convTrigger
);
if
(
annotation
.
executeImmediately
())
{
if
(
annotation
.
executeImmediately
())
{
task
.
execute
(
null
);
task
.
execute
(
null
);
}
}
task
.
onEnable
();
task
.
onEnable
();
}
catch
(
SchedulerException
e
)
{
}
catch
(
SchedulerException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
this
;
return
this
;
}
}
public
List
<
TaskHandler
>
getHandlersAsList
()
{
public
List
<
TaskHandler
>
getHandlersAsList
()
{
return
new
ArrayList
<>(
this
.
tasks
.
values
());
return
new
ArrayList
<>(
this
.
tasks
.
values
());
}
}
public
HashMap
<
String
,
TaskHandler
>
getHandlers
()
{
public
HashMap
<
String
,
TaskHandler
>
getHandlers
()
{
return
new
LinkedHashMap
<>(
this
.
tasks
);
return
new
LinkedHashMap
<>(
this
.
tasks
);
}
}
public
TaskHandler
getHandler
(
String
taskName
)
{
public
TaskHandler
getHandler
(
String
taskName
)
{
return
this
.
tasks
.
get
(
taskName
);
return
this
.
tasks
.
get
(
taskName
);
}
}
private
void
scan
()
{
private
void
scan
()
{
Reflections
reflector
=
Grasscutter
.
reflector
;
Reflections
reflector
=
Grasscutter
.
reflector
;
Set
<
Class
<?>>
classes
=
reflector
.
getTypesAnnotatedWith
(
Task
.
class
);
Set
<
Class
<?>>
classes
=
reflector
.
getTypesAnnotatedWith
(
Task
.
class
);
classes
.
forEach
(
annotated
->
{
classes
.
forEach
(
annotated
->
{
try
{
try
{
Task
taskData
=
annotated
.
getAnnotation
(
Task
.
class
);
Task
taskData
=
annotated
.
getAnnotation
(
Task
.
class
);
Object
object
=
annotated
.
getDeclaredConstructor
().
newInstance
();
Object
object
=
annotated
.
getDeclaredConstructor
().
newInstance
();
if
(
object
instanceof
TaskHandler
)
{
if
(
object
instanceof
TaskHandler
)
{
this
.
registerTask
(
taskData
.
taskName
(),
(
TaskHandler
)
object
);
this
.
registerTask
(
taskData
.
taskName
(),
(
TaskHandler
)
object
);
if
(
taskData
.
executeImmediatelyAfterReset
())
{
if
(
taskData
.
executeImmediatelyAfterReset
())
{
this
.
afterReset
.
put
(
taskData
.
taskName
(),
(
TaskHandler
)
object
);
this
.
afterReset
.
put
(
taskData
.
taskName
(),
(
TaskHandler
)
object
);
}
}
}
else
{
}
else
{
Grasscutter
.
getLogger
().
error
(
"Class "
+
annotated
.
getName
()
+
" is not a TaskHandler!"
);
Grasscutter
.
getLogger
().
error
(
"Class "
+
annotated
.
getName
()
+
" is not a TaskHandler!"
);
}
}
}
catch
(
Exception
exception
)
{
}
catch
(
Exception
exception
)
{
Grasscutter
.
getLogger
().
error
(
"Failed to register task handler for "
+
annotated
.
getSimpleName
(),
exception
);
Grasscutter
.
getLogger
().
error
(
"Failed to register task handler for "
+
annotated
.
getSimpleName
(),
exception
);
}
}
});
});
try
{
try
{
Scheduler
scheduler
=
schedulerFactory
.
getScheduler
();
Scheduler
scheduler
=
schedulerFactory
.
getScheduler
();
scheduler
.
start
();
scheduler
.
start
();
}
catch
(
SchedulerException
e
)
{
}
catch
(
SchedulerException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
}
}
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