Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Grasscutter
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
ziqian zhang
Grasscutter
Commits
c3450e89
Commit
c3450e89
authored
2 years ago
by
AnimeGitB
Browse files
Options
Downloads
Patches
Plain Diff
Handbooks: use some sorted maps
parent
b3c80db4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/emu/grasscutter/tools/Tools.java
+12
-12
12 additions, 12 deletions
src/main/java/emu/grasscutter/tools/Tools.java
with
12 additions
and
12 deletions
src/main/java/emu/grasscutter/tools/Tools.java
+
12
−
12
View file @
c3450e89
...
...
@@ -21,8 +21,8 @@ import emu.grasscutter.data.excels.ItemData;
import
emu.grasscutter.data.excels.QuestData
;
import
emu.grasscutter.utils.Language
;
import
emu.grasscutter.utils.Language.TextStrings
;
import
it.unimi.dsi.fastutil.ints.Int2IntMap
;
import
it.unimi.dsi.fastutil.ints.Int2Int
OpenHash
Map
;
import
it.unimi.dsi.fastutil.ints.Int2Int
Sorted
Map
;
import
it.unimi.dsi.fastutil.ints.Int2Int
RBTree
Map
;
import
it.unimi.dsi.fastutil.ints.Int2ObjectMap
;
import
static
emu
.
grasscutter
.
config
.
Configuration
.*;
...
...
@@ -33,11 +33,11 @@ public final class Tools {
final
Int2ObjectMap
<
TextStrings
>
textMaps
=
Language
.
getTextMapStrings
();
ResourceLoader
.
loadAll
();
final
Int2IntMap
avatarNames
=
new
Int2Int
OpenHash
Map
(
GameData
.
getAvatarDataMap
().
int2ObjectEntrySet
().
stream
().
collect
(
Collectors
.
toMap
(
e
->
(
int
)
e
.
getIntKey
(),
e
->
(
int
)
e
.
getValue
().
getNameTextMapHash
())));
final
Int2IntMap
itemNames
=
new
Int2Int
OpenHash
Map
(
GameData
.
getItemDataMap
().
int2ObjectEntrySet
().
stream
().
collect
(
Collectors
.
toMap
(
e
->
(
int
)
e
.
getIntKey
(),
e
->
(
int
)
e
.
getValue
().
getNameTextMapHash
())));
final
Int2IntMap
monsterNames
=
new
Int2Int
OpenHash
Map
(
GameData
.
getMonsterDataMap
().
int2ObjectEntrySet
().
stream
().
collect
(
Collectors
.
toMap
(
e
->
(
int
)
e
.
getIntKey
(),
e
->
(
int
)
e
.
getValue
().
getNameTextMapHash
())));
final
Int2IntMap
mainQuestTitles
=
new
Int2Int
OpenHash
Map
(
GameData
.
getMainQuestDataMap
().
int2ObjectEntrySet
().
stream
().
collect
(
Collectors
.
toMap
(
e
->
(
int
)
e
.
getIntKey
(),
e
->
(
int
)
e
.
getValue
().
getTitleTextMapHash
())));
// Int2IntMap questDescs = new Int2Int
OpenHash
Map(GameData.getQuestDataMap().int2ObjectEntrySet().stream().collect(Collectors.toMap(e -> (int) e.getIntKey(), e -> (int) e.getValue().getDescTextMapHash())));
final
Int2Int
Sorted
Map
avatarNames
=
new
Int2Int
RBTree
Map
(
GameData
.
getAvatarDataMap
().
int2ObjectEntrySet
().
stream
().
collect
(
Collectors
.
toMap
(
e
->
(
int
)
e
.
getIntKey
(),
e
->
(
int
)
e
.
getValue
().
getNameTextMapHash
())));
final
Int2Int
Sorted
Map
itemNames
=
new
Int2Int
RBTree
Map
(
GameData
.
getItemDataMap
().
int2ObjectEntrySet
().
stream
().
collect
(
Collectors
.
toMap
(
e
->
(
int
)
e
.
getIntKey
(),
e
->
(
int
)
e
.
getValue
().
getNameTextMapHash
())));
final
Int2Int
Sorted
Map
monsterNames
=
new
Int2Int
RBTree
Map
(
GameData
.
getMonsterDataMap
().
int2ObjectEntrySet
().
stream
().
collect
(
Collectors
.
toMap
(
e
->
(
int
)
e
.
getIntKey
(),
e
->
(
int
)
e
.
getValue
().
getNameTextMapHash
())));
final
Int2Int
Sorted
Map
mainQuestTitles
=
new
Int2Int
RBTree
Map
(
GameData
.
getMainQuestDataMap
().
int2ObjectEntrySet
().
stream
().
collect
(
Collectors
.
toMap
(
e
->
(
int
)
e
.
getIntKey
(),
e
->
(
int
)
e
.
getValue
().
getTitleTextMapHash
())));
// Int2Int
Sorted
Map questDescs = new Int2Int
RBTree
Map(GameData.getQuestDataMap().int2ObjectEntrySet().stream().collect(Collectors.toMap(e -> (int) e.getIntKey(), e -> (int) e.getValue().getDescTextMapHash())));
// Preamble
final
List
<
StringBuilder
>
handbookBuilders
=
new
ArrayList
<>(
TextStrings
.
NUM_LANGUAGES
);
...
...
@@ -60,15 +60,15 @@ public final class Tools {
}
// Avatars, Items, Monsters
final
String
[]
handbookSections
=
{
"Avatars"
,
"Items"
,
"Monsters"
};
final
Int2IntMap
[]
handbookNames
=
{
avatarNames
,
itemNames
,
monsterNames
};
final
Int2Int
Sorted
Map
[]
handbookNames
=
{
avatarNames
,
itemNames
,
monsterNames
};
for
(
int
section
=
0
;
section
<
handbookSections
.
length
;
section
++)
{
final
Int2IntMap
h
=
handbookNames
[
section
];
final
var
h
=
handbookNames
[
section
];
final
String
s
=
"\n\n// "
+
handbookSections
[
section
]
+
"\n"
;
handbookBuilders
.
forEach
(
b
->
b
.
append
(
s
));
final
String
padId
=
"%"
+
Integer
.
toString
(
h
.
keySet
().
intStream
().
max
().
getAs
Int
()).
length
()
+
"s : "
;
h
.
keySet
().
intStream
().
sorted
().
forEach
(
id
->
{
final
String
padId
=
"%"
+
Integer
.
toString
(
h
.
keySet
().
last
Int
()).
length
()
+
"s : "
;
h
.
forEach
(
(
id
,
hash
)
->
{
final
String
sId
=
padId
.
formatted
(
id
);
final
TextStrings
t
=
textMaps
.
get
(
h
.
get
(
id
)
);
final
TextStrings
t
=
textMaps
.
get
(
(
int
)
hash
);
for
(
int
i
=
0
;
i
<
TextStrings
.
NUM_LANGUAGES
;
i
++)
handbookBuilders
.
get
(
i
).
append
(
sId
+
t
.
strings
[
i
]
+
"\n"
);
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment