mirror of
https://github.com/gwdevhub/Daybreak.git
synced 2026-09-16 13:29:30 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
733883a6c2 | ||
|
|
d1ed8aeaf6 | ||
|
|
66ad44b8ce | ||
|
|
18e51ae408 | ||
|
|
06940dbf38 | ||
|
|
875b29f8ba | ||
|
|
a953c3a0d3 | ||
|
|
ce198fcfc9 | ||
|
|
3d84648af2 | ||
|
|
38bb43bba3 | ||
|
|
cc00709016 | ||
|
|
ee02b3b49a | ||
|
|
d1d6b7d757 | ||
|
|
4e1c0c4f50 | ||
|
|
2a7e2c90fc | ||
|
|
0dc957a99d | ||
|
|
f3f0aeb97e | ||
|
|
d6dbe6f2cd | ||
|
|
79da1801bc | ||
|
|
2b692b2d88 | ||
|
|
a7a98f7288 | ||
|
|
5d27d9c380 | ||
|
|
fb4185b541 | ||
|
|
d2d6e87e12 | ||
|
|
354cdda109 | ||
|
|
83429e264a | ||
|
|
ffdf374cdd | ||
|
|
aed34608ee | ||
|
|
18981e131d | ||
|
|
fe0a77d89d | ||
|
|
dbfd555f0d | ||
|
|
85d4ac3a29 | ||
|
|
dcb983d3de | ||
|
|
ba1e4348ad | ||
|
|
04bc7cffc6 | ||
|
|
01b74a936b | ||
|
|
654b6bc10f | ||
|
|
c9e6b9f626 | ||
|
|
554f1aea9b | ||
|
|
6fb817855c | ||
|
|
b3f5fadfe3 | ||
|
|
9275b7a7f8 | ||
|
|
2d06ff85b8 | ||
|
|
07d06313d9 | ||
|
|
546409130c | ||
|
|
82436872f8 | ||
|
|
ad6f76af0c | ||
|
|
8f0ad91a22 | ||
|
|
6a70c5b7cc | ||
|
|
5f5d67fdf2 | ||
|
|
150b41647a | ||
|
|
66e52e7324 | ||
|
|
23328240a9 | ||
|
|
3f06e9486d | ||
|
|
52a8e912e9 | ||
|
|
641aa8250e | ||
|
|
faa47f32c7 | ||
|
|
e3dac780df | ||
|
|
dfc0f12150 | ||
|
|
638fb38fa0 | ||
|
|
4d6a06ccdf | ||
|
|
3228604876 | ||
|
|
44879924d6 | ||
|
|
6b7478f6ae | ||
|
|
f54d95c1e7 | ||
|
|
5315a45a98 | ||
|
|
8575d970a3 | ||
|
|
5c611eca4f | ||
|
|
71aa37b965 | ||
|
|
0f1b1cc83d | ||
|
|
198c1e6eb3 | ||
|
|
e7c9111a1f | ||
|
|
1191e996db | ||
|
|
19de3c99f9 | ||
|
|
d857b6dc26 | ||
|
|
68b5b79035 | ||
|
|
318032d998 | ||
|
|
483860532f | ||
|
|
694dbe82a9 | ||
|
|
a936f24e32 | ||
|
|
a2ec87ced2 | ||
|
|
48955a7dd7 | ||
|
|
9d7c6c29b0 | ||
|
|
902d210dfd | ||
|
|
57867851a9 | ||
|
|
ca82cc92bf | ||
|
|
569ce1e656 | ||
|
|
a96c6c3f66 | ||
|
|
28c3b2f8c1 | ||
|
|
deeccd81b4 | ||
|
|
6a27245ae8 | ||
|
|
6f4063abb7 | ||
|
|
f307bcd665 | ||
|
|
02ca41ba6d | ||
|
|
a0ebc87b7c | ||
|
|
d21c55deb0 | ||
|
|
50a8131ec2 | ||
|
|
e70cfa3d99 | ||
|
|
4c0c45f1c7 | ||
|
|
a9e819a83a | ||
|
|
65830f9125 | ||
|
|
3d9106addf | ||
|
|
2863032d9a | ||
|
|
aada189b1b | ||
|
|
22ea4de66e | ||
|
|
9859617a74 | ||
|
|
0629c1929d | ||
|
|
6ec45396c3 | ||
|
|
b76a9b80fb | ||
|
|
f4bc58bbf7 | ||
|
|
09fdbb6f95 | ||
|
|
8ee7ed23e4 | ||
|
|
8d8a78cf88 | ||
|
|
f0652231cb | ||
|
|
d9aa760256 | ||
|
|
a65f375255 | ||
|
|
3ee58e2711 | ||
|
|
9b3b083aec | ||
|
|
ecb9b8f172 | ||
|
|
5765c27240 | ||
|
|
c53456112a | ||
|
|
ccea21886e | ||
|
|
37be8de5ac | ||
|
|
107e43a15f | ||
|
|
17b3ed34db | ||
|
|
cce9cd34af | ||
|
|
6a80f8ee5d | ||
|
|
edb7f0d0bd | ||
|
|
8e69375338 | ||
|
|
d24ae98fb0 | ||
|
|
111b3ea632 | ||
|
|
cc1e759972 | ||
|
|
ad0527ed73 | ||
|
|
8ffbb918ea | ||
|
|
c27a0dba65 | ||
|
|
ad8305c66d | ||
|
|
29fe12f094 | ||
|
|
9dbe4c5eaf | ||
|
|
1e9aca3807 | ||
|
|
895da23f7d | ||
|
|
f788a10879 | ||
|
|
9fe4be0467 | ||
|
|
b1a7d3a111 | ||
|
|
8b9fdaaa30 | ||
|
|
60d5947535 | ||
|
|
0ba0e64a2a | ||
|
|
e1dfd1f0d0 | ||
|
|
cd2a529381 | ||
|
|
6ba8dcac49 | ||
|
|
f2e76b5459 | ||
|
|
cfbf6ed021 | ||
|
|
a372eb5125 | ||
|
|
76b89ca0e8 | ||
|
|
2c1721d52c | ||
|
|
324a77a625 | ||
|
|
88e59b8ec9 | ||
|
|
df71a17d9f | ||
|
|
8451f53e19 | ||
|
|
e795af5c11 | ||
|
|
efa3c5175c | ||
|
|
32efe42a61 | ||
|
|
97d2d09cdc | ||
|
|
ed90d567a4 | ||
|
|
51d6fb0f42 | ||
|
|
c10525708c | ||
|
|
0a69d795aa | ||
|
|
3b1d6831a5 | ||
|
|
b4c1dbcddb | ||
|
|
db5d62d7c0 | ||
|
|
ed5ccf38c6 | ||
|
|
7671e0c04c | ||
|
|
f3b8221b29 | ||
|
|
8fdc9a67c0 | ||
|
|
bb2e739876 | ||
|
|
852cbff5f3 | ||
|
|
6e1c111876 | ||
|
|
9f60839e40 | ||
|
|
dd37db18b5 | ||
|
|
793d60f7b5 | ||
|
|
08674cd7a6 | ||
|
|
dca3e39a6d | ||
|
|
8a1033d4b6 | ||
|
|
e4ebe558d7 | ||
|
|
70728cc5ed | ||
|
|
b49a0a5ff4 | ||
|
|
b48d959ffb | ||
|
|
b8e1ad89af | ||
|
|
b2bfbfcd86 | ||
|
|
062e28a6d2 | ||
|
|
dc0f833291 | ||
|
|
e598237916 | ||
|
|
6b96d3d9e9 | ||
|
|
1dbb610846 | ||
|
|
5c649b0c15 | ||
|
|
527ab041d9 | ||
|
|
ff94e90259 | ||
|
|
51efbcce1e | ||
|
|
87b2345105 | ||
|
|
5022d33ca9 | ||
|
|
141f949a63 | ||
|
|
3913c71fd8 | ||
|
|
5706652c40 | ||
|
|
768b6b20f5 | ||
|
|
7066b7dbb6 | ||
|
|
17e01fc7b9 | ||
|
|
ee9fcf38b7 | ||
|
|
5abb24bdd4 | ||
|
|
53f17d3f22 | ||
|
|
b728c38dc1 | ||
|
|
5e57b6ecd0 | ||
|
|
e9ffcdf7c3 | ||
|
|
118657de7c | ||
|
|
34c332504b | ||
|
|
d7a29d68a1 | ||
|
|
eefa02837d | ||
|
|
5b2812fa61 | ||
|
|
e3ddfb88c1 | ||
|
|
664d94aeaa | ||
|
|
e2baf63099 | ||
|
|
c1b7000139 | ||
|
|
6e8333d76f | ||
|
|
c67eddc9d4 | ||
|
|
292cf6fd94 | ||
|
|
69038bca43 | ||
|
|
f05d15ce36 | ||
|
|
98cb349d67 | ||
|
|
a4314ee4d5 | ||
|
|
96097bd25a | ||
|
|
14029e6af2 | ||
|
|
365777141d | ||
|
|
aaa5da8d9b | ||
|
|
b898ab5679 | ||
|
|
b896fa5cc7 | ||
|
|
bca9f6d66b | ||
|
|
d6f71cb2eb | ||
|
|
986d09867c | ||
|
|
97cb2151f9 | ||
|
|
338ac100a1 | ||
|
|
01badcee6a | ||
|
|
302cf1114c | ||
|
|
613e03dc75 | ||
|
|
4267359cb2 | ||
|
|
daac8ec787 | ||
|
|
857adec459 | ||
|
|
b46e10a1a6 | ||
|
|
10799b7e9c | ||
|
|
6bbeaa1738 | ||
|
|
1a0f1cbf9a | ||
|
|
68e708fe96 | ||
|
|
a2166f2327 | ||
|
|
6d55366bdc | ||
|
|
28fcaa81cf | ||
|
|
c5efc2990e | ||
|
|
597010b9a1 | ||
|
|
1f71816256 | ||
|
|
7c3618d2b5 | ||
|
|
df9038039c | ||
|
|
9a4b23976a | ||
|
|
8732e0fe5e | ||
|
|
c23b84c4d5 | ||
|
|
345b6a792a | ||
|
|
d9ae52165d | ||
|
|
4f40e8328b | ||
|
|
ebdd828b06 | ||
|
|
711acb55db | ||
|
|
7dfc21bfe0 | ||
|
|
78644a6eec | ||
|
|
30b1d77575 | ||
|
|
a9626d03a4 | ||
|
|
be731bbffb | ||
|
|
8cd40e2de3 | ||
|
|
7745594bb6 | ||
|
|
e43bedf1c2 | ||
|
|
d6623a8646 | ||
|
|
403ba51a7d | ||
|
|
b185a606e6 | ||
|
|
342a9a4826 | ||
|
|
2df2e8a65e | ||
|
|
2d5e9231a9 | ||
|
|
818e2bf1d0 | ||
|
|
f0a876f7cc | ||
|
|
3fae8f91cb | ||
|
|
8b08056ca7 | ||
|
|
39eaf53deb | ||
|
|
4674d1d7e5 | ||
|
|
b8b5cc8b1d | ||
|
|
dc987233a7 | ||
|
|
266b400c22 | ||
|
|
a4ac083fd0 | ||
|
|
320dd16838 | ||
|
|
5c05c636bc | ||
|
|
7103a8a83a | ||
|
|
ad749d801a | ||
|
|
747e9a0490 | ||
|
|
836402bd0f | ||
|
|
a3d5e1ce1f | ||
|
|
f2cc59a4ab | ||
|
|
6ea77f7e05 | ||
|
|
5ea8df7cb9 | ||
|
|
c70e8ec90d | ||
|
|
210e3a8cb1 | ||
|
|
a0c3bb094c | ||
|
|
b4d932692a | ||
|
|
667534a07a | ||
|
|
159928f24b | ||
|
|
8a91ded610 | ||
|
|
4226b7eb32 | ||
|
|
b61c99dd1c | ||
|
|
1ccb0d5334 | ||
|
|
7fa01353dd | ||
|
|
4f849d880b | ||
|
|
4b60c96aad | ||
|
|
a4dc0d65cf | ||
|
|
85e017423f | ||
|
|
b38488937b | ||
|
|
d291d5825a | ||
|
|
9d6162f65f | ||
|
|
f54ab42a92 | ||
|
|
78c8ae3e8f | ||
|
|
c64830c5b6 | ||
|
|
561c7cf7b1 | ||
|
|
2c6862de41 | ||
|
|
69842cbadf | ||
|
|
c7327e7bb2 | ||
|
|
de33ed7fc4 | ||
|
|
c99bb8d074 | ||
|
|
a98e54ebc6 | ||
|
|
a832aa1925 | ||
|
|
c7eb5debcb | ||
|
|
91f0cb4e31 | ||
|
|
5e8407a6ab | ||
|
|
243c2c1536 | ||
|
|
930aca4ffe | ||
|
|
1639cabe8e | ||
|
|
5961a57c5b | ||
|
|
75d9bc6dec | ||
|
|
4ccca32881 | ||
|
|
a7f5d9dd96 | ||
|
|
c8ba125abc | ||
|
|
7d290031f1 | ||
|
|
5220a8c7ac | ||
|
|
33e221f60f | ||
|
|
7f77547c50 | ||
|
|
c5964e33ac | ||
|
|
1c6f3ec797 | ||
|
|
8601f61739 | ||
|
|
91bac0d50b | ||
|
|
0bf03e0fb5 | ||
|
|
81401178a5 | ||
|
|
882357a8e5 | ||
|
|
abf629c5c6 | ||
|
|
758f9004cd | ||
|
|
f174f8cbb3 | ||
|
|
f2f6bde25d | ||
|
|
85f378b303 | ||
|
|
71ab3fdefb | ||
|
|
2f83d6c860 | ||
|
|
3db4975b48 | ||
|
|
6a6eea5d02 | ||
|
|
8fe9eeb32f | ||
|
|
4c1025243b | ||
|
|
f24eb02ca1 | ||
|
|
b01c09491f | ||
|
|
54ae742899 | ||
|
|
4c862463d7 | ||
|
|
b455c89ddc | ||
|
|
782b76cd8e | ||
|
|
230c2d9457 | ||
|
|
63531e3b8c | ||
|
|
ac430305f4 | ||
|
|
3d830cfc16 | ||
|
|
b529aa8861 | ||
|
|
3798daa54e | ||
|
|
624380ed86 | ||
|
|
2b025e225b | ||
|
|
15a67ea28c | ||
|
|
c6b62fd5fd | ||
|
|
3c0877c1a0 | ||
|
|
967b57b9a8 | ||
|
|
f47cc319b5 | ||
|
|
26da84c4e7 | ||
|
|
a39e8dc5c6 | ||
|
|
1bb4669135 | ||
|
|
0203eef006 | ||
|
|
4ab50ee191 | ||
|
|
06c1ec1ac2 | ||
|
|
ef4befdc38 | ||
|
|
33f49ddffa | ||
|
|
49aa249b5b | ||
|
|
c387d44890 | ||
|
|
d4d09e7267 | ||
|
|
dd7bf02a97 | ||
|
|
6d0eeb478f | ||
|
|
d4e9de48b1 | ||
|
|
6bd9877925 | ||
|
|
d38df6596f | ||
|
|
b4e31e859c | ||
|
|
1acd07c1be | ||
|
|
b9b25bb098 | ||
|
|
5ea2981dc7 | ||
|
|
4fb96ca3a4 | ||
|
|
6de52f5585 | ||
|
|
6622e41f64 | ||
|
|
8405e4d1e5 | ||
|
|
0edc3f1560 | ||
|
|
c109fe7561 | ||
|
|
b5413dca5c | ||
|
|
6c2d4a1e70 | ||
|
|
be03f1a32d | ||
|
|
3ed1cc453a | ||
|
|
16030063ed | ||
|
|
458696ad8f | ||
|
|
6201702563 | ||
|
|
c5bea23a8f | ||
|
|
e5f38f77ef | ||
|
|
1d774ab8de | ||
|
|
bc66ca9948 | ||
|
|
524cd21fd4 | ||
|
|
132cb0e1f4 | ||
|
|
09c99e7731 | ||
|
|
c9d0be1117 | ||
|
|
965055c8d7 | ||
|
|
f6bb21d0ef | ||
|
|
465e0a4ce0 | ||
|
|
55f304b885 | ||
|
|
0cb1d97332 | ||
|
|
e2091cd82f | ||
|
|
d2bada4159 | ||
|
|
b27998d7f2 | ||
|
|
98d3e21db9 |
+137
@@ -0,0 +1,137 @@
|
||||
[*.cs]
|
||||
|
||||
# CA2254: Template should be a static expression
|
||||
dotnet_diagnostic.CA2254.severity = none
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_using_directive_placement = outside_namespace:error
|
||||
csharp_prefer_simple_using_statement = true:error
|
||||
csharp_prefer_braces = true:silent
|
||||
csharp_style_namespace_declarations = file_scoped:error
|
||||
csharp_style_prefer_method_group_conversion = true:suggestion
|
||||
csharp_style_expression_bodied_methods = false:silent
|
||||
csharp_style_expression_bodied_constructors = false:silent
|
||||
csharp_style_expression_bodied_operators = false:silent
|
||||
csharp_style_expression_bodied_properties = true:silent
|
||||
csharp_style_expression_bodied_indexers = true:silent
|
||||
csharp_style_expression_bodied_accessors = true:silent
|
||||
csharp_style_expression_bodied_lambdas = true:silent
|
||||
csharp_style_expression_bodied_local_functions = false:silent
|
||||
csharp_indent_braces = false
|
||||
insert_final_newline = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_style_throw_expression = true:suggestion
|
||||
csharp_style_prefer_null_check_over_type_check = true:suggestion
|
||||
csharp_prefer_simple_default_expression = true:suggestion
|
||||
csharp_style_prefer_local_over_anonymous_function = true:error
|
||||
csharp_style_prefer_index_operator = true:suggestion
|
||||
csharp_style_prefer_range_operator = true:suggestion
|
||||
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
|
||||
csharp_style_prefer_tuple_swap = true:suggestion
|
||||
csharp_style_inlined_variable_declaration = true:suggestion
|
||||
csharp_style_deconstructed_variable_declaration = true:error
|
||||
csharp_style_unused_value_assignment_preference = discard_variable:error
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
|
||||
csharp_prefer_static_local_function = true:suggestion
|
||||
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
|
||||
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
|
||||
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:suggestion
|
||||
csharp_style_conditional_delegate_call = true:suggestion
|
||||
csharp_style_prefer_parameter_null_checking = true:suggestion
|
||||
csharp_style_prefer_switch_expression = true:suggestion
|
||||
csharp_style_prefer_pattern_matching = true:silent
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
|
||||
csharp_style_prefer_not_pattern = true:suggestion
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
||||
csharp_style_prefer_extended_property_pattern = true:suggestion
|
||||
csharp_style_var_for_built_in_types = false:silent
|
||||
csharp_style_var_when_type_is_apparent = false:silent
|
||||
csharp_style_var_elsewhere = false:silent
|
||||
csharp_style_prefer_top_level_statements = true:suggestion
|
||||
csharp_style_prefer_utf8_string_literals = true:suggestion
|
||||
csharp_style_prefer_readonly_struct = true:suggestion
|
||||
|
||||
[*.{cs,vb}]
|
||||
#### Naming styles ####
|
||||
|
||||
# Naming rules
|
||||
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.severity = error
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
||||
|
||||
dotnet_naming_rule.types_should_be_pascal_case.severity = error
|
||||
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
||||
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = error
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
|
||||
|
||||
# Symbol specifications
|
||||
|
||||
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.interface.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
|
||||
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.types.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||
|
||||
# Naming styles
|
||||
|
||||
dotnet_naming_style.begins_with_i.required_prefix = I
|
||||
dotnet_naming_style.begins_with_i.required_suffix =
|
||||
dotnet_naming_style.begins_with_i.word_separator =
|
||||
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.pascal_case.required_prefix =
|
||||
dotnet_naming_style.pascal_case.required_suffix =
|
||||
dotnet_naming_style.pascal_case.word_separator =
|
||||
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.pascal_case.required_prefix =
|
||||
dotnet_naming_style.pascal_case.required_suffix =
|
||||
dotnet_naming_style.pascal_case.word_separator =
|
||||
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||
tab_width = 4
|
||||
indent_size = 4
|
||||
end_of_line = crlf
|
||||
dotnet_style_coalesce_expression = true:suggestion
|
||||
dotnet_style_null_propagation = true:suggestion
|
||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:error
|
||||
dotnet_style_prefer_auto_properties = true:error
|
||||
dotnet_style_object_initializer = true:suggestion
|
||||
dotnet_style_collection_initializer = true:suggestion
|
||||
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
|
||||
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
|
||||
dotnet_style_prefer_conditional_expression_over_return = true:silent
|
||||
dotnet_style_explicit_tuple_names = true:suggestion
|
||||
dotnet_style_prefer_inferred_tuple_names = true:suggestion
|
||||
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
|
||||
dotnet_style_prefer_compound_assignment = true:suggestion
|
||||
dotnet_style_prefer_simplified_interpolation = true:suggestion
|
||||
dotnet_style_namespace_match_folder = true:suggestion
|
||||
dotnet_style_readonly_field = true:suggestion
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
|
||||
dotnet_style_predefined_type_for_member_access = true:silent
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
|
||||
dotnet_style_allow_multiple_blank_lines_experimental = true:silent
|
||||
dotnet_style_allow_statement_immediately_after_block_experimental = false:suggestion
|
||||
dotnet_code_quality_unused_parameters = all:error
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
|
||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
|
||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
|
||||
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
|
||||
dotnet_style_qualification_for_field = true:error
|
||||
dotnet_style_qualification_for_property = true:error
|
||||
dotnet_style_qualification_for_method = true:error
|
||||
dotnet_style_qualification_for_event = true:error
|
||||
dotnet_diagnostic.CA1000.severity = error
|
||||
|
||||
[*.vb]
|
||||
dotnet_diagnostic.CA1047.severity = error
|
||||
@@ -0,0 +1 @@
|
||||
* amacocian@yahoo.com
|
||||
@@ -0,0 +1,16 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
- package-ecosystem: "nuget"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
@@ -0,0 +1,134 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
# This continuous integration pipeline is triggered anytime a user pushes code to the repo.
|
||||
# This pipeline builds the Wpf project, runs unit tests, then saves the MSIX build artifact.
|
||||
name: Daybreak CD Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- "Daybreak/**"
|
||||
- "Daybreak.Installer/**"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
targetplatform: [x86]
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
env:
|
||||
Configuration: Release
|
||||
Solution_Path: Daybreak.sln
|
||||
Test_Project_Path: Daybreak.Tests\Daybreak.Tests.csproj
|
||||
Wpf_Project_Path: Daybreak\Daybreak.csproj
|
||||
Actions_Allow_Unsecure_Commands: true
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get Latest Tag
|
||||
id: getLatestTag
|
||||
uses: WyriHaximus/github-action-get-previous-tag@v1
|
||||
|
||||
- name: Generate changelog
|
||||
id: gen_changelog
|
||||
run: |
|
||||
$changeLog = git log --no-merges --pretty="%h - %s (%an)<br />" ${{ env.LatestReleaseTag }}..HEAD
|
||||
echo "::set-env name=Changelog::$changeLog"
|
||||
mkdir Publish
|
||||
echo $changeLog > .\Publish\changelog.txt
|
||||
env:
|
||||
LatestReleaseTag: ${{steps.getLatestTag.outputs.tag}}
|
||||
|
||||
- name: Install .NET Core
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '8.x'
|
||||
|
||||
- name: Setup MSBuild.exe
|
||||
uses: microsoft/setup-msbuild@v2.0.0
|
||||
|
||||
- name: Fetch submodules
|
||||
run: |
|
||||
git submodule update --init --recursive
|
||||
|
||||
- name: Build CMake Files
|
||||
run: cmake -S . -B build -A Win32
|
||||
|
||||
- name: Setup project secrets
|
||||
run: |
|
||||
dotnet user-secrets --project Daybreak\Daybreak.csproj set AadApplicationId "${{ secrets.AadApplicationId }}"
|
||||
dotnet user-secrets --project Daybreak\Daybreak.csproj set AadTenantId "${{ secrets.AadTenantId }}"
|
||||
|
||||
- name: Restore project
|
||||
run: msbuild $env:Solution_Path /t:Restore /p:Configuration=$env:Configuration /p:RuntimeIdentifier=$env:RuntimeIdentifier --property:SolutionDir=$GITHUB_WORKSPACE
|
||||
env:
|
||||
RuntimeIdentifier: win-${{ matrix.targetplatform }}
|
||||
|
||||
- name: Build Daybreak project
|
||||
run: dotnet build Daybreak -c $env:Configuration --property:SolutionDir=$env:GITHUB_WORKSPACE
|
||||
|
||||
- name: Set version variable
|
||||
run: |
|
||||
$version = .\Scripts\GetBuildVersion.ps1
|
||||
echo "::set-env name=Version::$version"
|
||||
|
||||
- name: Create publish launcher files
|
||||
run: dotnet publish .\Daybreak\Daybreak.csproj -c $env:Configuration -r $env:RuntimeIdentifier --property:SolutionDir=$env:GITHUB_WORKSPACE -p:PublishReadyToRun=true -p:PublishSingleFile=false --self-contained true -o .\Publish
|
||||
env:
|
||||
RuntimeIdentifier: win-${{ matrix.targetplatform }}
|
||||
|
||||
- name: Create publish installer files
|
||||
run: dotnet publish .\Daybreak.Installer\Daybreak.Installer.csproj -c $env:Configuration -r $env:RuntimeIdentifier --property:SolutionDir=$env:GITHUB_WORKSPACE -p:PublishReadyToRun=true -p:PublishSingleFile=true --self-contained true -o .\Publish
|
||||
env:
|
||||
RuntimeIdentifier: win-${{ matrix.targetplatform }}
|
||||
|
||||
- name: Create publish extractor files
|
||||
run: dotnet publish .\Daybreak.7ZipExtractor\Daybreak.7ZipExtractor.csproj -c $env:Configuration -r $env:RuntimeIdentifier --property:SolutionDir=$env:GITHUB_WORKSPACE -p:PublishReadyToRun=true -p:PublishSingleFile=false --self-contained true -o .\Publish
|
||||
env:
|
||||
RuntimeIdentifier: win-${{ matrix.targetplatform }}
|
||||
|
||||
- name: Pack publish files
|
||||
run: |
|
||||
Write-Host $env
|
||||
.\Scripts\BuildRelease.ps1 -version $env:Version
|
||||
shell: pwsh
|
||||
|
||||
- name: Publish blob files
|
||||
run: |
|
||||
Write-Host $env
|
||||
.\Scripts\PushFilesToBlobStorage.ps1 -version $env:Version -sourcePath .\Publish\ -connectionString "${{ secrets.BLOBSTORAGE_CONNECTIONSTRING }}"
|
||||
shell: pwsh
|
||||
|
||||
- name: Create release draft
|
||||
uses: Xotl/cool-github-releases@v1.1.10
|
||||
with:
|
||||
mode: update
|
||||
tag_name: v${{ env.Version }}
|
||||
release_name: Daybreak v${{ env.Version }}
|
||||
assets: .\Publish\daybreakv${{ env.Version }}.zip
|
||||
github_token: ${{ env.GITHUB_TOKEN }}
|
||||
replace_assets: true
|
||||
body_mrkdwn: ${{ env.Changelog }}
|
||||
isDraft: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Publish release
|
||||
run: |
|
||||
gh release edit v${{ env.Version }} --draft=false
|
||||
shell: powershell
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
# This continuous integration pipeline is triggered anytime a user pushes code to the repo.
|
||||
# This pipeline builds the Wpf project, runs unit tests, then saves the MSIX build artifact.
|
||||
name: Daybreak CI Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
targetplatform: [x86]
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
env:
|
||||
Solution_Path: Daybreak.sln
|
||||
Test_Project_Path: Daybreak.Tests\Daybreak.Tests.csproj
|
||||
Wpf_Project_Path: Daybreak\Daybreak.csproj
|
||||
Actions_Allow_Unsecure_Commands: true
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install .NET Core
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '8.x'
|
||||
|
||||
- name: Setup MSBuild.exe
|
||||
uses: microsoft/setup-msbuild@v2.0.0
|
||||
|
||||
- name: Fetch submodules
|
||||
run: |
|
||||
git submodule update --init --recursive
|
||||
|
||||
- name: Build CMake Files
|
||||
run: cmake -S . -B build -A Win32
|
||||
|
||||
- name: Execute Unit Tests
|
||||
run: dotnet test $env:Test_Project_Path --property:SolutionDir=$env:GITHUB_WORKSPACE -p:ParallelizeTestCollections=false
|
||||
|
||||
- name: Restore the Wpf application to populate the obj folder
|
||||
run: msbuild $env:Solution_Path /t:Restore /p:Configuration=$env:Configuration /p:RuntimeIdentifier=$env:RuntimeIdentifier --property:SolutionDir=$env:GITHUB_WORKSPACE
|
||||
env:
|
||||
Configuration: Debug
|
||||
RuntimeIdentifier: win-${{ matrix.targetplatform }}
|
||||
@@ -0,0 +1,94 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ "master" ]
|
||||
schedule:
|
||||
- cron: '41 12 * * 6'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: windows-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'csharp' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||
|
||||
env:
|
||||
Configuration: Release
|
||||
Solution_Path: Daybreak.sln
|
||||
Test_Project_Path: Daybreak.Tests\Daybreak.Tests.csproj
|
||||
Wpf_Project_Path: Daybreak\Daybreak.csproj
|
||||
Actions_Allow_Unsecure_Commands: true
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Fetch submodules
|
||||
run: |
|
||||
git submodule update --init --recursive
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
|
||||
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||
# queries: security-extended,security-and-quality
|
||||
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
|
||||
- name: Install .NET Core
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '8.x'
|
||||
|
||||
#- name: Autobuild
|
||||
# uses: github/codeql-action/autobuild@v2
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
|
||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
||||
|
||||
# - run: |
|
||||
# echo "Run, Build Application using script"
|
||||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Build Daybreak project
|
||||
run: dotnet build Daybreak -c $env:Configuration --property:SolutionDir=$env:GITHUB_WORKSPACE
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
@@ -0,0 +1,60 @@
|
||||
name: Daybreak Version Check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- "Daybreak/**"
|
||||
- "Daybreak.Installer/**"
|
||||
|
||||
jobs:
|
||||
|
||||
check_version:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
targetplatform: [x86]
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
env:
|
||||
Configuration: Release
|
||||
Solution_Path: Daybreak.sln
|
||||
Actions_Allow_Unsecure_Commands: true
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install .NET Core
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '8.x'
|
||||
|
||||
- name: Get Latest Tag
|
||||
id: getLatestTag
|
||||
uses: WyriHaximus/github-action-get-previous-tag@v1
|
||||
|
||||
- name: Fetch submodules
|
||||
run: |
|
||||
git submodule update --init --recursive
|
||||
|
||||
- name: Build CMake Files
|
||||
run: cmake -S . -B build -A Win32
|
||||
|
||||
- name: Build Daybreak project
|
||||
run: dotnet build Daybreak -c $env:Configuration --property:SolutionDir=$env:GITHUB_WORKSPACE
|
||||
|
||||
- name: Set version variable
|
||||
run: |
|
||||
$version = .\Scripts\GetBuildVersion.ps1
|
||||
echo "::set-env name=Version::$version"
|
||||
|
||||
- name: Check version difference
|
||||
run: |
|
||||
.\Scripts\CompareVersions -currentVersion ${{ env.Version }} -lastVersion ${{ env.LatestReleaseTag }}
|
||||
env:
|
||||
LatestReleaseTag: ${{ steps.getLatestTag.outputs.tag }}
|
||||
+5
-1
@@ -9,6 +9,7 @@
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
*.version
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
@@ -27,6 +28,7 @@ x86/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
build/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Oo]ut/
|
||||
@@ -360,4 +362,6 @@ MigrationBackup/
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
FodyWeavers.xsd
|
||||
|
||||
.idea
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[submodule "GWCA"]
|
||||
path = GWCA
|
||||
url = https://github.com/gwdevhub/GWCA
|
||||
@@ -0,0 +1,16 @@
|
||||
# CMakeList.txt : Top-level CMake project file, do global configuration
|
||||
# and include sub-projects here.
|
||||
#
|
||||
cmake_minimum_required (VERSION 3.8)
|
||||
|
||||
# Enable Hot Reload for MSVC compilers if supported.
|
||||
if (POLICY CMP0141)
|
||||
cmake_policy(SET CMP0141 NEW)
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
|
||||
endif()
|
||||
|
||||
project ("Daybreak")
|
||||
|
||||
# Include sub-projects.
|
||||
add_subdirectory ("Daybreak.GWCA")
|
||||
add_subdirectory ("GWCA")
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "windows-base",
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"installDir": "${sourceDir}/install/${presetName}",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "cl.exe",
|
||||
"CMAKE_CXX_COMPILER": "cl.exe",
|
||||
"CMAKE_CXX_FLAGS": "/EHa"
|
||||
},
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x86-debug",
|
||||
"displayName": "x86 Debug",
|
||||
"inherits": "windows-base",
|
||||
"architecture": {
|
||||
"value": "x86",
|
||||
"strategy": "external"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x86-release",
|
||||
"displayName": "x86 Release",
|
||||
"inherits": "x86-debug",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>Daybreak._7ZipExtractor</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SharpCompress" Version="0.37.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Extractor is in a different executable because of memory limitations. Daybreak needs to be compiled for x86 and as such has a memory limit of 2GB.
|
||||
* 7Zip algorithm may require more than 2GB memory to unpack large zip files.
|
||||
* As such, Daybreak.7ZipExtractor is x64.
|
||||
*/
|
||||
using SharpCompress.Archives;
|
||||
|
||||
if (args.Length != 2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
var archivePath = args[0];
|
||||
var destinationDirectory = args[1];
|
||||
|
||||
using var fileStream = new FileStream(archivePath, FileMode.Open);
|
||||
using var archive = ArchiveFactory.Open(fileStream);
|
||||
var progress = 0d;
|
||||
var count = archive.Entries.Count();
|
||||
var reader = archive.ExtractAllEntries();
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
var entry = reader.Entry;
|
||||
if (entry.IsDirectory)
|
||||
{
|
||||
var directoryName = Path.Combine(Path.GetFullPath(destinationDirectory), entry.Key);
|
||||
Directory.CreateDirectory(directoryName);
|
||||
continue;
|
||||
}
|
||||
|
||||
var fileName = Path.Combine(Path.GetFullPath(destinationDirectory), entry.Key);
|
||||
using var entryStream = new FileStream(fileName, FileMode.Create);
|
||||
using (var stream = reader.OpenEntryStream())
|
||||
{
|
||||
stream.CopyTo(entryStream);
|
||||
}
|
||||
|
||||
progress += 1d / count;
|
||||
Console.WriteLine($"{progress} {fileName}");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -0,0 +1,52 @@
|
||||
# CMakeList.txt : CMake project for Daybreak.GWCA, include source and define
|
||||
# project specific logic here.
|
||||
#
|
||||
|
||||
project(Daybreak.GWCA VERSION 1.0.0)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
message(FATAL_ERROR "You are configuring a 64bit build, this is not supported. Run cmake with `-A Win32`")
|
||||
endif()
|
||||
|
||||
set(VERSION_MAJOR 0)
|
||||
set(VERSION_MINOR 9)
|
||||
set(VERSION_PATCH 9)
|
||||
set(VERSION_TWEAK 44)
|
||||
|
||||
set(VERSION_RC "${CMAKE_CURRENT_BINARY_DIR}/version.rc")
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in" "${VERSION_RC}" @ONLY)
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/bin/install)
|
||||
add_compile_options(/MP /permissive-)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/")
|
||||
|
||||
add_library(Daybreak.GWCA SHARED)
|
||||
file(GLOB SOURCES
|
||||
"source/pch.h"
|
||||
"source/*.cpp"
|
||||
"source/*/*.cpp"
|
||||
"header/*.h*"
|
||||
"header/*/*.h")
|
||||
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${SOURCES})
|
||||
source_group("Generated Files" FILES ${VERSION_RC})
|
||||
target_sources(Daybreak.GWCA PRIVATE ${SOURCES} ${VERSION_RC})
|
||||
target_compile_features(Daybreak.GWCA PUBLIC cxx_std_17)
|
||||
target_compile_definitions(Daybreak.GWCA PRIVATE
|
||||
$<$<CONFIG:Debug>:BUILD_TYPE_DEBUG>
|
||||
$<$<CONFIG:Release>:BUILD_TYPE_RELEASE>
|
||||
NOMINMAX
|
||||
)
|
||||
|
||||
target_precompile_headers(Daybreak.GWCA PRIVATE "header/pch.h")
|
||||
target_include_directories(Daybreak.GWCA PUBLIC "header")
|
||||
|
||||
target_link_libraries(Daybreak.GWCA PUBLIC
|
||||
gwca
|
||||
directx
|
||||
minhook)
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
|
||||
namespace http {
|
||||
namespace modules {
|
||||
void HandleAlive(const httplib::Request&, httplib::Response& res);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
#pragma once
|
||||
|
||||
#include <httplib.h>
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <thread>
|
||||
#include <json.hpp>
|
||||
#include <semaphore>
|
||||
#include <future>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
using nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
template <typename TPayload, typename TContext>
|
||||
class DaybreakModule {
|
||||
protected:
|
||||
virtual std::chrono::milliseconds GetTimeout() {
|
||||
return std::chrono::milliseconds(200);
|
||||
}
|
||||
std::future<std::optional<TPayload>> EnqueueWithReturn(const TContext context) {
|
||||
std::shared_ptr<std::promise<std::optional<TPayload>>> promise = std::make_shared<std::promise<std::optional<TPayload>>>();
|
||||
std::future<std::optional<TPayload>> ret = promise->get_future();
|
||||
GW::GameThread::Enqueue([this, context, promise]() {
|
||||
try {
|
||||
const std::optional<TPayload> result = this->GetPayload(context);
|
||||
promise->set_value(result);
|
||||
}
|
||||
catch (...) {
|
||||
promise->set_exception(std::current_exception());
|
||||
}
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
virtual std::optional<TContext> GetContext(const httplib::Request& req, httplib::Response& res) = 0;
|
||||
virtual bool CanReturn(const httplib::Request& req, httplib::Response& res, const TPayload& payload) {
|
||||
return true;
|
||||
}
|
||||
virtual std::tuple<std::string, std::string> ReturnPayload(TPayload payload) {
|
||||
return std::make_tuple(static_cast<json>(payload).dump(), "application/json");
|
||||
}
|
||||
virtual void OnNoValue(httplib::Response& res) {
|
||||
res.status = 500;
|
||||
res.body = "No payload";
|
||||
}
|
||||
virtual std::optional<TPayload> GetPayload(const TContext context) = 0;
|
||||
public:
|
||||
virtual std::string ApiUri() = 0;
|
||||
void HandleApiCall(const httplib::Request& req, httplib::Response& res) {
|
||||
const auto startTime = std::chrono::steady_clock::now();
|
||||
const std::optional<TContext> context = this->GetContext(req, res);
|
||||
if (!context.has_value()) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::future<std::optional<TPayload>> future = this->EnqueueWithReturn(context.value());
|
||||
std::optional<TPayload> payload = future.get();
|
||||
if (!payload.has_value()) {
|
||||
this->OnNoValue(res);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait until timeout. Normally timeout should be handled differently, but since the modules
|
||||
* wait only for strings to populate, we can return the rest of the payload just fine and let
|
||||
* Daybreak handle the missing string
|
||||
*/
|
||||
while (!this->CanReturn(req, res, payload.value()) &&
|
||||
std::chrono::steady_clock::now() - startTime < this->GetTimeout()) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
std::tuple<std::string, std::string> contentResponse = this->ReturnPayload(payload.value());
|
||||
res.status = 200;
|
||||
res.set_content(std::get<0>(contentResponse), std::get<1>(contentResponse));
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <payloads/DebugPayload.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class DebugModule : public DaybreakModule<DebugPayload, uint32_t> {
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<uint32_t> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<DebugPayload> GetPayload(uint32_t context) override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <payloads/NamePayload.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class EntityNameModule : public DaybreakModule<NamePayload, uint32_t> {
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<uint32_t> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<NamePayload> GetPayload(uint32_t context) override;
|
||||
bool CanReturn(const httplib::Request& req, httplib::Response& res, const NamePayload& payload) override;
|
||||
std::tuple<std::string, std::string> ReturnPayload(NamePayload payload) override;
|
||||
private:
|
||||
std::wstring name;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <payloads/GamePayload.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class GameModule : public DaybreakModule<GamePayload, uint32_t> {
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<uint32_t> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<GamePayload> GetPayload(const uint32_t) override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <payloads/GameStatePayload.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class GameStateModule : public DaybreakModule<GameStatePayload, uint32_t> {
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<uint32_t> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<GameStatePayload> GetPayload(const uint32_t) override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
|
||||
namespace http {
|
||||
void ConsoleLogger(const httplib::Request req, httplib::Response res);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <payloads/InventoryPayload.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class InventoryModule : public DaybreakModule<InventoryPayload, uint32_t> {
|
||||
protected:
|
||||
std::optional<uint32_t> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<InventoryPayload> GetPayload(const uint32_t) override;
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <payloads/NamePayload.h>
|
||||
#include <GWCA/GameEntities/Item.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class ItemNameModule : public DaybreakModule<NamePayload, GW::Item*> {
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<GW::Item*> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<NamePayload> GetPayload(GW::Item* context) override;
|
||||
bool CanReturn(const httplib::Request& req, httplib::Response& res, const NamePayload& payload) override;
|
||||
std::tuple<std::string, std::string> ReturnPayload(NamePayload payload) override;
|
||||
private:
|
||||
std::wstring name;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <payloads/LoginPayload.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class LoginModule : public DaybreakModule<LoginPayload, uint32_t>{
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<uint32_t> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<LoginPayload> GetPayload(const uint32_t) override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <payloads/MainPlayer.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class MainPlayerModule : public DaybreakModule<MainPlayer, uint32_t> {
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<uint32_t> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<MainPlayer> GetPayload(const uint32_t) override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <payloads/MapPayload.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class MapModule : public DaybreakModule<MapPayload, uint32_t> {
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<uint32_t> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<MapPayload> GetPayload(const uint32_t) override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <payloads/PathingMetadataPayload.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class PathingMetadataModule : public DaybreakModule<PathingMetadataPayload, uint32_t> {
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<uint32_t> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<PathingMetadataPayload> GetPayload(const uint32_t) override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <payloads/PathingPayload.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class PathingModule : public DaybreakModule<PathingPayload, uint32_t> {
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<uint32_t> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<PathingPayload> GetPayload(const uint32_t) override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <payloads/PreGamePayload.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class PreGameModule : public DaybreakModule<PreGamePayload, uint32_t> {
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<uint32_t> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<PreGamePayload> GetPayload(const uint32_t) override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
|
||||
namespace http {
|
||||
namespace modules {
|
||||
void HandleProcessId(const httplib::Request&, httplib::Response& res);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include "pch.h"
|
||||
|
||||
namespace http {
|
||||
namespace server {
|
||||
bool StartServer();
|
||||
void StopServer();
|
||||
void SetLogger(httplib::Logger logger);
|
||||
void Get(const std::string& pattern, httplib::Server::Handler handler);
|
||||
void Post(const std::string& pattern, httplib::Server::Handler handler);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <payloads/SessionPayload.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class SessionModule : public DaybreakModule<SessionPayload, uint32_t> {
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<uint32_t> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<SessionPayload> GetPayload(const uint32_t) override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <TitleInfoModule.h>
|
||||
#include <payloads/TitleInfoPayload.h>
|
||||
#include <tuple>
|
||||
#include <string>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class TitleInfoModule : public DaybreakModule<TitleInfoPayload, uint32_t> {
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<TitleInfoPayload> GetPayload(const uint32_t context) override;
|
||||
std::tuple<std::string, std::string> ReturnPayload(TitleInfoPayload payload) override;
|
||||
bool CanReturn(const httplib::Request& req, httplib::Response& res, const TitleInfoPayload& payload) override;
|
||||
std::optional<uint32_t> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
private:
|
||||
std::wstring name;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <payloads/UserPayload.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class UserModule : public DaybreakModule<UserPayload, uint32_t> {
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<uint32_t> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<UserPayload> GetPayload(const uint32_t) override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
namespace Daybreak::Utils {
|
||||
std::string WStringToString(const std::wstring& wstr);
|
||||
std::wstring StringToWString(const std::string& str);
|
||||
bool StringToInt(const std::string& str, int& outValue);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include "httplib.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <string>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
class WhisperModule : public DaybreakModule<bool, std::wstring> {
|
||||
public:
|
||||
std::string ApiUri() override;
|
||||
protected:
|
||||
std::optional<std::wstring> GetContext(const httplib::Request& req, httplib::Response& res) override;
|
||||
std::optional<bool> GetPayload(const std::wstring message) override;
|
||||
std::tuple<std::string, std::string> ReturnPayload(bool) override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct Attribute {
|
||||
uint32_t Id;
|
||||
uint32_t BaseLevel;
|
||||
uint32_t ActualLevel;
|
||||
uint32_t DecrementPoints;
|
||||
uint32_t IncrementPoints;
|
||||
};
|
||||
|
||||
void to_json(json& j, const Attribute& p);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <payloads/BagContent.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct Bag {
|
||||
std::list<BagContent> Items;
|
||||
};
|
||||
|
||||
void to_json(json& j, const Bag& p);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct BagContent {
|
||||
uint32_t Id = 0;
|
||||
uint32_t Slot = 0;
|
||||
uint32_t Count = 0;
|
||||
std::list<uint32_t> Modifiers;
|
||||
};
|
||||
|
||||
void to_json(json& j, const BagContent& p);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
#include <payloads/Attribute.h>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct Build {
|
||||
uint32_t Primary = 0;
|
||||
uint32_t Secondary = 0;
|
||||
std::list<Attribute> Attributes;
|
||||
std::list<uint32_t> Skills;
|
||||
};
|
||||
|
||||
void to_json(json& j, const Build& p);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct Camera {
|
||||
float Yaw;
|
||||
float Pitch;
|
||||
};
|
||||
|
||||
void to_json(json& j, const Camera& p);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
#include <payloads/MainPlayer.h>
|
||||
#include <payloads/MapIcon.h>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct DebugPayload {
|
||||
std::string GameContextAddress;
|
||||
std::string WorldContextAddress;
|
||||
std::string AgentContextAddress;
|
||||
std::string MapContextAddress;
|
||||
std::string CharContextAddress;
|
||||
};
|
||||
|
||||
void to_json(json& j, const DebugPayload& p);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
#include <payloads/MainPlayer.h>
|
||||
#include <payloads/MapIcon.h>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct GamePayload {
|
||||
MainPlayer MainPlayer;
|
||||
std::list<Player> Party;
|
||||
std::list<WorldPlayer> WorldPlayers;
|
||||
std::list<LivingEntity> LivingEntities;
|
||||
std::list<MapIcon> MapIcons;
|
||||
uint32_t TargetId = 0;
|
||||
};
|
||||
|
||||
void to_json(json& j, const GamePayload& p);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <json.hpp>
|
||||
#include <payloads/StatePayload.h>
|
||||
#include <payloads/Camera.h>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct GameStatePayload {
|
||||
Camera Camera;
|
||||
std::list<StatePayload> States;
|
||||
};
|
||||
|
||||
void to_json(json& j, const GameStatePayload& p);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
#include <payloads/Bag.h>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct InventoryPayload {
|
||||
uint32_t GoldInStorage;
|
||||
uint32_t GoldOnCharacter;
|
||||
Bag Backpack;
|
||||
Bag BeltPouch;
|
||||
Bag EquipmentPack;
|
||||
Bag MaterialStorage;
|
||||
Bag UnclaimedItems;
|
||||
Bag EquippedItems;
|
||||
std::list<Bag> Bags;
|
||||
std::list<Bag> StoragePanes;
|
||||
};
|
||||
|
||||
void to_json(json& j, const InventoryPayload& p);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct LivingEntity {
|
||||
uint32_t Id = 0;
|
||||
uint32_t Timer = 0;
|
||||
float PosX = 0;
|
||||
float PosY = 0;
|
||||
uint32_t NpcDefinition = 0;
|
||||
uint32_t PrimaryProfessionId = 0;
|
||||
uint32_t SecondaryProfessionId = 0;
|
||||
uint32_t Level = 0;
|
||||
uint32_t EntityState = 0;
|
||||
uint32_t EntityAllegiance = 0;
|
||||
float Health;
|
||||
float Energy;
|
||||
float RotationAngle;
|
||||
};
|
||||
|
||||
void to_json(json& j, const LivingEntity& p);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct LoginPayload {
|
||||
std::string Email;
|
||||
std::string PlayerName;
|
||||
};
|
||||
|
||||
void to_json(json& j, const LoginPayload& p);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
#include <payloads/WorldPlayer.h>
|
||||
#include <payloads/QuestMetadata.h>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct MainPlayer : public WorldPlayer {
|
||||
uint32_t CurrentQuest = 0;
|
||||
std::list<QuestMetadata> QuestLog;
|
||||
bool HardModeUnlocked = false;
|
||||
uint32_t Experience = 0;
|
||||
uint32_t Morale = 0;
|
||||
float CurrentHp = 0;
|
||||
uint32_t MaxHp = 0;
|
||||
float CurrentEnergy = 0;
|
||||
uint32_t MaxEnergy = 0;
|
||||
};
|
||||
|
||||
void to_json(json& j, const MainPlayer& p);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct MapIcon {
|
||||
uint32_t Id;
|
||||
float PosX;
|
||||
float PosY;
|
||||
uint32_t Affiliation;
|
||||
};
|
||||
|
||||
void to_json(json& j, const MapIcon& p);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct MapPayload {
|
||||
bool IsLoaded;
|
||||
uint32_t Id;
|
||||
uint32_t InstanceType;
|
||||
uint32_t Timer;
|
||||
uint32_t Campaign;
|
||||
uint32_t Continent;
|
||||
uint32_t Region;
|
||||
uint32_t Type;
|
||||
};
|
||||
|
||||
void to_json(json& j, const MapPayload& p);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct NamePayload {
|
||||
uint32_t Id = 0;
|
||||
std::string Name = "";
|
||||
};
|
||||
|
||||
void to_json(json& j, const NamePayload& p);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct PathingMetadataPayload {
|
||||
uint32_t TrapezoidCount;
|
||||
};
|
||||
|
||||
void to_json(json& j, const PathingMetadataPayload& p);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <payloads/PathingTrapezoid.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct PathingPayload {
|
||||
std::list<PathingTrapezoid> Trapezoids;
|
||||
std::list<std::list<int>> AdjacencyList;
|
||||
};
|
||||
|
||||
void to_json(json& j, const PathingPayload& p);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct PathingTrapezoid {
|
||||
uint32_t Id;
|
||||
uint32_t PathingMapId;
|
||||
float XTL;
|
||||
float XTR;
|
||||
float XBL;
|
||||
float XBR;
|
||||
float YT;
|
||||
float YB;
|
||||
};
|
||||
|
||||
void to_json(json& j, const PathingTrapezoid& p);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
#include <payloads/LivingEntity.h>
|
||||
#include <payloads/Build.h>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct Player : public LivingEntity {
|
||||
std::list<uint32_t> UnlockedProfession;
|
||||
uint32_t NpcDefinition = 0;
|
||||
Build Build;
|
||||
};
|
||||
|
||||
void to_json(json& j, const Player& p);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct PreGamePayload {
|
||||
int ChosenCharacterIndex = -1;
|
||||
std::list<std::string> Characters;
|
||||
};
|
||||
|
||||
void to_json(json& j, const PreGamePayload& p);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct QuestMetadata {
|
||||
uint32_t Id;
|
||||
float PosX;
|
||||
float PosY;
|
||||
uint32_t FromId;
|
||||
uint32_t ToId;
|
||||
};
|
||||
|
||||
void to_json(json& j, const QuestMetadata& p);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct SessionPayload {
|
||||
uint32_t FoesKilled = 0;
|
||||
uint32_t FoesToKill = 0;
|
||||
uint32_t MapId = 0;
|
||||
uint32_t InstanceTimer = 0;
|
||||
uint32_t InstanceType = 0;
|
||||
};
|
||||
|
||||
void to_json(json& j, const SessionPayload& p);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct StatePayload {
|
||||
uint32_t Id = 0;
|
||||
float PosX = 0;
|
||||
float PosY = 0;
|
||||
uint32_t State = 0;
|
||||
float Health = 0;
|
||||
float Energy = 0;
|
||||
float RotationAngle = 0;
|
||||
};
|
||||
|
||||
void to_json(json& j, const StatePayload& p);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct Title {
|
||||
uint32_t Id = 0;
|
||||
uint32_t CurrentPoints = 0;
|
||||
uint32_t PointsForCurrentRank = 0;
|
||||
uint32_t PointsForNextRank = 0;
|
||||
uint32_t TierNumber = 0;
|
||||
uint32_t MaxTierNumber = 0;
|
||||
bool IsPercentage = false;
|
||||
};
|
||||
|
||||
void to_json(json& j, const Title& p);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct TitleInfoPayload {
|
||||
uint32_t TitleId = 0;
|
||||
uint32_t TitleTierId = 0;
|
||||
uint32_t CurrentTier = 0;
|
||||
uint32_t CurrentPoints = 0;
|
||||
uint32_t PointsNeededNextRank = 0;
|
||||
bool IsPercentageBased = false;
|
||||
std::string TitleName = "";
|
||||
};
|
||||
|
||||
void to_json(json& j, const TitleInfoPayload& p);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct UserPayload {
|
||||
std::string Email;
|
||||
uint32_t CurrentKurzickPoints;
|
||||
uint32_t TotalKurzickPoints;
|
||||
uint32_t CurrentLuxonPoints;
|
||||
uint32_t TotalLuxonPoints;
|
||||
uint32_t CurrentImperialPoints;
|
||||
uint32_t TotalImperialPoints;
|
||||
uint32_t CurrentBalthazarPoints;
|
||||
uint32_t TotalBalthazarPoints;
|
||||
uint32_t CurrentSkillPoints;
|
||||
uint32_t TotalSkillPoints;
|
||||
uint32_t MaxKurzickPoints;
|
||||
uint32_t MaxLuxonPoints;
|
||||
uint32_t MaxImperialPoints;
|
||||
uint32_t MaxBalthazarPoints;
|
||||
};
|
||||
|
||||
void to_json(json& j, const UserPayload& p);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
#include <payloads/Player.h>
|
||||
#include <payloads/Title.h>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
struct WorldPlayer : public Player {
|
||||
std::string Name = "";
|
||||
Title Title;
|
||||
};
|
||||
|
||||
void to_json(json& j, const WorldPlayer& p);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// pch.h: This is a precompiled header file.
|
||||
// Files listed below are compiled only once, improving build performance for future builds.
|
||||
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
|
||||
// add headers that you want to pre-compile here
|
||||
#include "framework.h"
|
||||
|
||||
#endif //PCH_H
|
||||
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
namespace PipeServer {
|
||||
void StartServer();
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
#pragma once
|
||||
|
||||
#pragma warning(disable: 4619) // there is no warning number 'number'
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4061) // enumerator 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label
|
||||
#pragma warning(disable: 4365) // 'action' : conversion from 'type_1' to 'type_2', signed/unsigned mismatch
|
||||
#pragma warning(disable: 4514) // 'function' : unreferenced inline function has been removed
|
||||
#pragma warning(disable: 4530) // C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
|
||||
#pragma warning(disable: 4577) // 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc
|
||||
#pragma warning(disable: 4623) // 'derived class' : default constructor was implicitly defined as deleted because a base class default constructor is inaccessible or deleted
|
||||
#pragma warning(disable: 4625) // 'derived class' : copy constructor was implicitly defined as deleted because a base class copy constructor is inaccessible or deleted
|
||||
#pragma warning(disable: 4626) // 'derived class' : assignment operator was implicitly defined as deleted because a base class assignment operator is inaccessible or deleted
|
||||
#pragma warning(disable: 4668) // 'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives'
|
||||
#pragma warning(disable: 4710) // 'function' : function not inlined
|
||||
#pragma warning(disable: 4711) // function 'function' selected for inline expansion
|
||||
#pragma warning(disable: 4820) // 'bytes' bytes padding added after construct 'member_name'
|
||||
#pragma warning(disable: 4917) // 'declarator' : a GUID can only be associated with a class, interface or namespace
|
||||
#pragma warning(disable: 5026) // 'type': move constructor was implicitly defined as deleted
|
||||
#pragma warning(disable: 5027) // 'type': move assignment operator was implicitly defined as deleted
|
||||
#pragma warning(disable: 5039) // 'function': pointer or reference to potentially throwing function passed to extern C function under -EHc. Undefined behavior may occur if this function throws an exception.
|
||||
#pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
|
||||
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
# define _CRT_SECURE_NO_WARNINGS 1
|
||||
#endif
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
#include <map>
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#ifndef NOMINMAX
|
||||
# define NOMINMAX
|
||||
#endif
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#include <Windows.h>
|
||||
#include <ShellApi.h>
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
|
||||
#pragma warning(disable: 4061) // enumerator 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label
|
||||
#pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
|
||||
#pragma warning(disable: 4514) // 'function' : unreferenced inline function has been removed
|
||||
#pragma warning(disable: 4505) // 'function' : unreferenced local function has been removed
|
||||
#pragma warning(disable: 4530) // C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
|
||||
#pragma warning(disable: 4577) // 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc
|
||||
#pragma warning(disable: 4623) // 'derived class' : default constructor was implicitly defined as deleted because a base class default constructor is inaccessible or deleted
|
||||
#pragma warning(disable: 4625) // 'derived class' : copy constructor was implicitly defined as deleted because a base class copy constructor is inaccessible or deleted
|
||||
#pragma warning(disable: 4626) // 'derived class' : assignment operator was implicitly defined as deleted because a base class assignment operator is inaccessible or deleted
|
||||
#pragma warning(disable: 4710) // 'function' : function not inlined
|
||||
#pragma warning(disable: 4711) // function 'function' selected for inline expansion
|
||||
#pragma warning(disable: 4774) // 'swprintf' : format string expected in argument 3 is not a string literal
|
||||
#pragma warning(disable: 4820) // 'bytes' bytes padding added after construct 'member_name'
|
||||
#pragma warning(disable: 5026) // 'type': move constructor was implicitly defined as deleted
|
||||
#pragma warning(disable: 5027) // 'type': move assignment operator was implicitly defined as deleted
|
||||
#pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
|
||||
#pragma warning(disable: 28159) // Consider using 'GetTickCount64' instead of 'GetTickCount'.
|
||||
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
#include <payloads/LivingEntity.h>
|
||||
#include <payloads/Build.h>
|
||||
#include <GWCA/GameContainers/Array.h>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak::Temp {
|
||||
struct GWPlayer { // total: 0x4C/76
|
||||
/* +h0000 */ uint32_t agent_id;
|
||||
/* +h0004 */ uint32_t h0004[3];
|
||||
/* +h0010 */ uint32_t appearance_bitmap;
|
||||
/* +h0014 */ uint32_t flags; // Bitwise field
|
||||
/* +h0018 */ uint32_t primary;
|
||||
/* +h001C */ uint32_t secondary;
|
||||
/* +h0020 */ uint32_t h0020;
|
||||
/* +h0024 */ wchar_t* name_enc;
|
||||
/* +h0028 */ wchar_t* name;
|
||||
/* +h002C */ uint32_t party_leader_player_number;
|
||||
/* +h0030 */ uint32_t active_title_tier;
|
||||
/* +h0034 */ uint32_t player_number;
|
||||
/* +h0038 */ uint32_t party_size;
|
||||
/* +h003C */ uint32_t m_buffer; // +h0000
|
||||
/* +h0040 */ uint32_t m_capacity; // +h0004
|
||||
/* +h0044 */ uint32_t m_size; // +h0008
|
||||
/* +h0048 */ uint32_t m_param;
|
||||
|
||||
inline bool IsPvP() {
|
||||
return (flags & 0x800) != 0;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#include "pch.h"
|
||||
#include "AliveModule.h"
|
||||
|
||||
namespace http {
|
||||
namespace modules {
|
||||
void HandleAlive(const httplib::Request&, httplib::Response& res) {
|
||||
res.set_content("Yes!", "text/plain");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#include "pch.h"
|
||||
#include "DebugModule.h"
|
||||
#include "payloads/DebugPayload.h"
|
||||
#include <GWCA/GWCA.h>
|
||||
#include <GWCA/Context/GameContext.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
std::string DebugModule::ApiUri()
|
||||
{
|
||||
return "/debug";
|
||||
}
|
||||
|
||||
std::optional<uint32_t> DebugModule::GetContext(const httplib::Request& req, httplib::Response& res)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::optional<DebugPayload> DebugModule::GetPayload(const uint32_t)
|
||||
{
|
||||
char buffer[20];
|
||||
DebugPayload debugPayload;
|
||||
const auto gameContext = GW::GetGameContext();
|
||||
std::snprintf(buffer, 20, "%p", static_cast<void*>(gameContext));
|
||||
debugPayload.GameContextAddress = std::string(buffer);
|
||||
std::snprintf(buffer, 20, "%p", static_cast<void*>(gameContext->agent));
|
||||
debugPayload.AgentContextAddress = std::string(buffer);
|
||||
std::snprintf(buffer, 20, "%p", static_cast<void*>(gameContext->character));
|
||||
debugPayload.CharContextAddress = std::string(buffer);
|
||||
std::snprintf(buffer, 20, "%p", static_cast<void*>(gameContext->world));
|
||||
debugPayload.WorldContextAddress = std::string(buffer);
|
||||
std::snprintf(buffer, 20, "%p", static_cast<void*>(gameContext->map));
|
||||
debugPayload.MapContextAddress = std::string(buffer);
|
||||
|
||||
return debugPayload;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
#include "pch.h"
|
||||
#include "EntityNameModule.h"
|
||||
#include "payloads/NamePayload.h"
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/MapMgr.h>
|
||||
#include <GWCA/GameEntities/Agent.h>
|
||||
#include <future>
|
||||
#include <json.hpp>
|
||||
#include <tuple>
|
||||
#include <queue>
|
||||
#include <GWCA/GWCA.h>
|
||||
#include <GWCA/Context/PreGameContext.h>
|
||||
#include <GWCA/Managers/AgentMgr.h>
|
||||
#include <Windows.h>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include "Utils.h"
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
std::string EntityNameModule::ApiUri()
|
||||
{
|
||||
return "/entities/name";
|
||||
}
|
||||
|
||||
std::optional<uint32_t> EntityNameModule::GetContext(const httplib::Request& req, httplib::Response& res)
|
||||
{
|
||||
uint32_t id = 0;
|
||||
auto it = req.params.find("id");
|
||||
if (it == req.params.end()) {
|
||||
res.status = 400;
|
||||
res.set_content("Missing id parameter", "text/plain");
|
||||
return std::optional<uint32_t>();
|
||||
}
|
||||
else {
|
||||
auto idStr = it->second;
|
||||
size_t pos = 0;
|
||||
auto result = std::stoul(idStr, &pos);
|
||||
if (pos != idStr.size()) {
|
||||
res.status = 400;
|
||||
res.set_content("Invalid id parameter", "text/plain");
|
||||
return std::optional<uint32_t>();
|
||||
}
|
||||
|
||||
id = static_cast<uint32_t>(result);
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
std::optional<NamePayload> EntityNameModule::GetPayload(const uint32_t context)
|
||||
{
|
||||
NamePayload namePayload;
|
||||
auto agent = GW::Agents::GetAgentByID(context);
|
||||
if (!agent) {
|
||||
return std::optional<NamePayload>();
|
||||
}
|
||||
|
||||
auto agentLiving = agent->GetAsAgentLiving();
|
||||
if (!agentLiving) {
|
||||
return std::optional<NamePayload>();
|
||||
}
|
||||
|
||||
if (!GW::Agents::AsyncGetAgentName(agentLiving, this->name)) {
|
||||
return std::optional<NamePayload>();
|
||||
}
|
||||
|
||||
namePayload.Id = context;
|
||||
return namePayload;
|
||||
}
|
||||
|
||||
bool EntityNameModule::CanReturn(const httplib::Request& req, httplib::Response& res, const NamePayload& payload) {
|
||||
return !name.empty();
|
||||
}
|
||||
|
||||
std::tuple<std::string, std::string> EntityNameModule::ReturnPayload(NamePayload payload) {
|
||||
payload.Name = Daybreak::Utils::WStringToString(this->name);
|
||||
return std::make_tuple(static_cast<json>(payload).dump(), "application/json");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,580 @@
|
||||
#include "pch.h"
|
||||
#include "GameModule.h"
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/MapMgr.h>
|
||||
#include <GWCA/Managers/AgentMgr.h>
|
||||
#include <GWCA/Managers/PartyMgr.h>
|
||||
#include <GWCA/Managers/PlayerMgr.h>
|
||||
#include <GWCA/Managers/SkillbarMgr.h>
|
||||
#include <GWCA/Managers/QuestMgr.h>
|
||||
#include <GWCA/Context/WorldContext.h>
|
||||
#include <GWCA/GameContainers/Array.h>
|
||||
#include <GWCA/GameEntities/Skill.h>
|
||||
#include <GWCA/GameEntities/Quest.h>
|
||||
#include <GWCA/GameEntities/Agent.h>
|
||||
#include <GWCA/GameEntities/Title.h>
|
||||
#include <GWCA/GameEntities/Party.h>
|
||||
#include <GWCA/GameEntities/Attribute.h>
|
||||
#include <GWCA/GameEntities/Player.h>
|
||||
#include <GWCA/GameEntities/NPC.h>
|
||||
#include <GWCA/Constants/Constants.h>
|
||||
#include <temp/GWPlayer.h>
|
||||
#include <future>
|
||||
#include <payloads/GamePayload.h>
|
||||
#include <json.hpp>
|
||||
#include <queue>
|
||||
#include <algorithm>
|
||||
#include "Utils.h"
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
namespace GameModuleInternal {
|
||||
std::list<QuestMetadata> GetQuestLog() {
|
||||
std::list<QuestMetadata> questMetadatas;
|
||||
const auto questLog = GW::QuestMgr::GetQuestLog();
|
||||
if (!questLog) {
|
||||
return questMetadatas;
|
||||
}
|
||||
|
||||
for (const auto& quest : *questLog) {
|
||||
QuestMetadata metadata;
|
||||
metadata.FromId = (uint32_t)quest.map_from;
|
||||
metadata.ToId = (uint32_t)quest.map_to;
|
||||
metadata.Id = (uint32_t)quest.quest_id;
|
||||
metadata.PosX = quest.marker.x;
|
||||
metadata.PosY = quest.marker.y;
|
||||
questMetadatas.push_back(metadata);
|
||||
}
|
||||
|
||||
return questMetadatas;
|
||||
}
|
||||
|
||||
std::vector<GW::MapAgent> GetMapEntities() {
|
||||
std::vector<GW::MapAgent> entities;
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
for (const auto& agent : worldContext->map_agents) {
|
||||
entities.push_back(agent);
|
||||
}
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
std::list<GW::PartyAttribute> GetPartyAttributes() {
|
||||
std::list<GW::PartyAttribute> attributes;
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
for (const auto& attribute : worldContext->attributes) {
|
||||
attributes.push_back(attribute);
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
std::list<GW::ProfessionState> GetProfessions() {
|
||||
std::list<GW::ProfessionState> professions;
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
for (const auto& profession : worldContext->party_profession_states) {
|
||||
professions.push_back(profession);
|
||||
}
|
||||
|
||||
return professions;
|
||||
}
|
||||
|
||||
std::list<GW::AgentLiving> GetLivingAgents() {
|
||||
std::list<GW::AgentLiving> agentList;
|
||||
const GW::AgentArray* agents_ptr = GW::Agents::GetAgentArray();
|
||||
GW::AgentArray* agents = GW::Agents::GetAgentArray();
|
||||
if (!agents) {
|
||||
return agentList;
|
||||
}
|
||||
|
||||
for (const auto* a : *agents) {
|
||||
const GW::AgentLiving* agent = a ? a->GetAsAgentLiving() : nullptr;
|
||||
if (agent) {
|
||||
agentList.push_back(*agent);
|
||||
}
|
||||
}
|
||||
|
||||
return agentList;
|
||||
}
|
||||
|
||||
std::vector<GW::TitleTier> GetTitleTiers() {
|
||||
std::vector<GW::TitleTier> titles;
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
for (const auto& title : worldContext->title_tiers) {
|
||||
titles.push_back(title);
|
||||
}
|
||||
|
||||
return titles;
|
||||
}
|
||||
|
||||
std::list<GW::Title> GetTitles() {
|
||||
std::list<GW::Title> titles;
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
for (const auto& title : worldContext->titles) {
|
||||
titles.push_back(title);
|
||||
}
|
||||
|
||||
return titles;
|
||||
}
|
||||
|
||||
std::list<Temp::GWPlayer> GetPlayers() {
|
||||
std::list<Temp::GWPlayer> players;
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
Temp::GWPlayer* tempPlayerArray = (Temp::GWPlayer*)worldContext->players.m_buffer;
|
||||
if (!tempPlayerArray) {
|
||||
return players;
|
||||
}
|
||||
|
||||
for (auto i = 0U; i < worldContext->players.m_size; i++) {
|
||||
if (tempPlayerArray->agent_id != 0) {
|
||||
players.push_back(*tempPlayerArray);
|
||||
}
|
||||
tempPlayerArray++;
|
||||
}
|
||||
|
||||
return players;
|
||||
}
|
||||
|
||||
std::map<uint32_t, std::list<uint32_t>> GetSkillbars() {
|
||||
std::map<uint32_t, std::list<uint32_t>> skillbarMap;
|
||||
const auto skillbars = GW::SkillbarMgr::GetSkillbarArray();
|
||||
if (!skillbars) {
|
||||
return skillbarMap;
|
||||
}
|
||||
|
||||
for (const auto& skillbar : *skillbars) {
|
||||
std::list<uint32_t> skillList;
|
||||
skillList.push_back((uint32_t)skillbar.skills[0].skill_id);
|
||||
skillList.push_back((uint32_t)skillbar.skills[1].skill_id);
|
||||
skillList.push_back((uint32_t)skillbar.skills[2].skill_id);
|
||||
skillList.push_back((uint32_t)skillbar.skills[3].skill_id);
|
||||
skillList.push_back((uint32_t)skillbar.skills[4].skill_id);
|
||||
skillList.push_back((uint32_t)skillbar.skills[5].skill_id);
|
||||
skillList.push_back((uint32_t)skillbar.skills[6].skill_id);
|
||||
skillList.push_back((uint32_t)skillbar.skills[7].skill_id);
|
||||
skillbarMap[skillbar.agent_id] = skillList;
|
||||
}
|
||||
|
||||
return skillbarMap;
|
||||
}
|
||||
|
||||
std::list<LivingEntity> GetLivingEntities(
|
||||
std::list<GW::AgentLiving> agents) {
|
||||
std::list<LivingEntity> entities;
|
||||
for (const auto& agent : agents) {
|
||||
LivingEntity entity;
|
||||
entity.PrimaryProfessionId = agent.primary;
|
||||
entity.SecondaryProfessionId = agent.secondary;
|
||||
entity.EntityState = agent.type_map;
|
||||
entity.EntityAllegiance = (uint32_t)agent.allegiance;
|
||||
entity.NpcDefinition = agent.player_number;
|
||||
entity.Id = agent.agent_id;
|
||||
entity.Timer = agent.timer;
|
||||
entity.Level = agent.level;
|
||||
entity.PosX = agent.pos.x;
|
||||
entity.PosY = agent.pos.y;
|
||||
entity.Health = agent.hp;
|
||||
entity.Energy = agent.energy;
|
||||
entity.RotationAngle = agent.rotation_angle;
|
||||
if (agent.primary == 0) {
|
||||
const auto npc = GW::Agents::GetNPCByID(agent.player_number);
|
||||
if (npc) {
|
||||
entity.PrimaryProfessionId = npc->primary;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
entities.push_back(entity);
|
||||
}
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
void PopulatePlayer(
|
||||
Player& player,
|
||||
int playerId,
|
||||
GW::ProfessionState* professionState,
|
||||
std::list<uint32_t> skillbar,
|
||||
GW::PartyAttribute* partyAttribute,
|
||||
GW::AgentLiving* agent) {
|
||||
|
||||
std::list<uint32_t> unlockedProfessions;
|
||||
if (professionState) {
|
||||
for (auto i = 0; i < 11; i++) {
|
||||
const auto prof = (GW::Constants::Profession)i;
|
||||
if (professionState->IsProfessionUnlocked(prof)) {
|
||||
unlockedProfessions.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
unlockedProfessions.push_back((uint32_t)professionState->primary);
|
||||
}
|
||||
|
||||
Build build;
|
||||
std::list<Attribute> attributes;
|
||||
if (partyAttribute) {
|
||||
for (const auto& partyAttr : partyAttribute->attribute) {
|
||||
if (((uint32_t)partyAttr.id < 0) ||
|
||||
((uint32_t)partyAttr.id > 44) ||
|
||||
partyAttr.level <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Attribute attribute;
|
||||
attribute.Id = (uint32_t)partyAttr.id;
|
||||
attribute.BaseLevel = partyAttr.level_base;
|
||||
attribute.ActualLevel = partyAttr.level;
|
||||
attribute.DecrementPoints = partyAttr.decrement_points;
|
||||
attribute.IncrementPoints = partyAttr.increment_points;
|
||||
attributes.push_back(attribute);
|
||||
}
|
||||
|
||||
build.Attributes = attributes;
|
||||
if (agent) {
|
||||
build.Primary = (uint32_t)agent->primary;
|
||||
build.Secondary = (uint32_t)agent->secondary;
|
||||
}
|
||||
else if (professionState) {
|
||||
build.Primary = (uint32_t)professionState->primary;
|
||||
build.Secondary = (uint32_t)professionState->secondary;
|
||||
}
|
||||
|
||||
build.Skills = skillbar;
|
||||
player.Build = build;
|
||||
}
|
||||
|
||||
player.UnlockedProfession = unlockedProfessions;
|
||||
player.Id = playerId;
|
||||
if (agent) {
|
||||
player.PosX = agent->pos.x;
|
||||
player.PosY = agent->pos.y;
|
||||
player.Timer = agent->timer;
|
||||
player.Level = agent->level;
|
||||
player.NpcDefinition = agent->player_number;
|
||||
player.PrimaryProfessionId = (uint32_t)agent->primary;
|
||||
player.SecondaryProfessionId = (uint32_t)agent->secondary;
|
||||
player.Health = agent->hp * (agent->max_hp > 0 ? agent->max_hp : 1);
|
||||
player.Energy = agent->energy * (agent->max_energy > 0 ? agent->max_energy : 1);
|
||||
player.RotationAngle = agent->rotation_angle;
|
||||
}
|
||||
else if (professionState) {
|
||||
player.PrimaryProfessionId = (uint32_t)professionState->primary;
|
||||
player.SecondaryProfessionId = (uint32_t)professionState->secondary;
|
||||
}
|
||||
}
|
||||
|
||||
void PopulateWorldPlayer(
|
||||
std::list<GW::Title> titles,
|
||||
std::vector<GW::TitleTier> titleTiers,
|
||||
WorldPlayer& player,
|
||||
int playerId,
|
||||
Temp::GWPlayer* gwPlayer,
|
||||
GW::ProfessionState* professionState,
|
||||
std::list<uint32_t> skillbar,
|
||||
GW::PartyAttribute* partyAttribute,
|
||||
GW::AgentLiving* agent) {
|
||||
|
||||
PopulatePlayer(player, playerId, professionState, skillbar, partyAttribute, agent);
|
||||
if (!gwPlayer) {
|
||||
return;
|
||||
}
|
||||
|
||||
GW::Title gwTitle;
|
||||
Title title;
|
||||
int titleId = 0;
|
||||
std::wstring nameString(gwPlayer->name);
|
||||
const auto name = Daybreak::Utils::WStringToString(nameString);
|
||||
player.Name = name;
|
||||
|
||||
if (titles.empty() ||
|
||||
titleTiers.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto& t : titles) {
|
||||
if (t.current_title_tier_index == gwPlayer->active_title_tier) {
|
||||
gwTitle = t;
|
||||
break;
|
||||
}
|
||||
|
||||
titleId++;
|
||||
}
|
||||
|
||||
if (gwTitle.current_title_tier_index >= titleTiers.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto titleTier = titleTiers[gwTitle.current_title_tier_index];
|
||||
title.CurrentPoints = gwTitle.current_points;
|
||||
title.IsPercentage = gwTitle.is_percentage_based();
|
||||
title.PointsForCurrentRank = gwTitle.points_needed_current_rank;
|
||||
title.PointsForNextRank = titleTier.tier_number == gwTitle.max_title_rank ? gwTitle.current_points : gwTitle.points_needed_next_rank;
|
||||
title.TierNumber = titleTier.tier_number;
|
||||
title.MaxTierNumber = gwTitle.max_title_rank;
|
||||
title.Id = titleId;
|
||||
|
||||
player.Title = title;
|
||||
}
|
||||
|
||||
void PopulateMainPlayer(
|
||||
MainPlayer& player,
|
||||
int activeQuestId,
|
||||
std::list<QuestMetadata> questLog,
|
||||
std::list<GW::Title> titles,
|
||||
std::vector<GW::TitleTier> titleTiers,
|
||||
int playerId,
|
||||
Temp::GWPlayer* gwPlayer,
|
||||
GW::ProfessionState* professionState,
|
||||
std::list<uint32_t> skillbar,
|
||||
GW::PartyAttribute* partyAttribute,
|
||||
GW::AgentLiving* agent) {
|
||||
PopulateWorldPlayer(titles, titleTiers, player, playerId, gwPlayer, professionState, skillbar, partyAttribute, agent);
|
||||
player.CurrentQuest = activeQuestId;
|
||||
player.QuestLog = questLog;
|
||||
player.HardModeUnlocked = GW::GetWorldContext()->is_hard_mode_unlocked == 1;
|
||||
player.Experience = GW::GetWorldContext()->experience;
|
||||
player.Morale = GW::GetWorldContext()->morale;
|
||||
if (agent) {
|
||||
player.CurrentEnergy = agent->max_energy * agent->energy;
|
||||
player.CurrentHp = agent->max_hp * agent->hp;
|
||||
player.MaxEnergy = agent->max_energy;
|
||||
player.MaxHp = agent->max_hp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string GameModule::ApiUri()
|
||||
{
|
||||
return "/game";
|
||||
}
|
||||
|
||||
std::optional<uint32_t> GameModule::GetContext(const httplib::Request& req, httplib::Response& res)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::optional<GamePayload> GameModule::GetPayload(uint32_t)
|
||||
{
|
||||
GamePayload gamePayload;
|
||||
gamePayload.TargetId = 0;
|
||||
if (!GW::Map::GetIsMapLoaded()) {
|
||||
return gamePayload;
|
||||
}
|
||||
|
||||
gamePayload.TargetId = GW::Agents::GetTargetId();
|
||||
auto worldContext = GW::GetWorldContext();
|
||||
auto activeQuestId = GW::QuestMgr::GetActiveQuestId();
|
||||
auto questLog = GameModuleInternal::GetQuestLog();
|
||||
auto skillbars = GameModuleInternal::GetSkillbars();
|
||||
if (skillbars.empty()) {
|
||||
return gamePayload;
|
||||
}
|
||||
|
||||
auto agents = GameModuleInternal::GetLivingAgents();
|
||||
if (agents.empty()) {
|
||||
return gamePayload;
|
||||
}
|
||||
|
||||
auto titles = GameModuleInternal::GetTitles();
|
||||
|
||||
auto titleTiers = GameModuleInternal::GetTitleTiers();
|
||||
|
||||
auto players = GameModuleInternal::GetPlayers();
|
||||
if (players.empty()) {
|
||||
return gamePayload;
|
||||
}
|
||||
|
||||
auto attributes = GameModuleInternal::GetPartyAttributes();
|
||||
if (attributes.empty()) {
|
||||
return gamePayload;
|
||||
}
|
||||
|
||||
auto professions = GameModuleInternal::GetProfessions();
|
||||
if (professions.empty()) {
|
||||
return gamePayload;
|
||||
}
|
||||
|
||||
auto mapAgents = GameModuleInternal::GetMapEntities();
|
||||
if (mapAgents.empty()) {
|
||||
return gamePayload;
|
||||
}
|
||||
|
||||
auto playerAgentId = GW::Agents::GetControlledCharacterId();
|
||||
|
||||
std::list<MapIcon> mapIcons;
|
||||
for (const auto& icon : worldContext->mission_map_icons) {
|
||||
MapIcon mapIcon;
|
||||
mapIcon.Id = icon.model_id;
|
||||
mapIcon.Affiliation = icon.option;
|
||||
mapIcon.PosX = icon.X;
|
||||
mapIcon.PosY = icon.Y;
|
||||
mapIcons.push_back(mapIcon);
|
||||
}
|
||||
|
||||
gamePayload.MapIcons = mapIcons;
|
||||
|
||||
std::list<Player> partyMembers;
|
||||
for (auto& prof : professions) {
|
||||
if (prof.agent_id == playerAgentId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Player player;
|
||||
auto foundAttr = std::find_if(attributes.begin(), attributes.end(), [&](GW::PartyAttribute attribute) {
|
||||
return prof.agent_id == attribute.agent_id;
|
||||
});
|
||||
|
||||
auto foundAgent = std::find_if(agents.begin(), agents.end(), [&](GW::AgentLiving agentLiving) {
|
||||
return prof.agent_id == agentLiving.agent_id;
|
||||
});
|
||||
|
||||
GW::AgentLiving* agentPtr;
|
||||
if (foundAgent == agents.end()) {
|
||||
agentPtr = nullptr;
|
||||
}
|
||||
else {
|
||||
agentPtr = &*foundAgent;
|
||||
}
|
||||
|
||||
GW::PartyAttribute* attrPtr;
|
||||
if (foundAttr == attributes.end()) {
|
||||
attrPtr = nullptr;
|
||||
}
|
||||
else {
|
||||
attrPtr = &*foundAttr;
|
||||
}
|
||||
|
||||
GameModuleInternal::PopulatePlayer(player, prof.agent_id, &prof, skillbars[prof.agent_id], attrPtr, agentPtr);
|
||||
partyMembers.push_back(player);
|
||||
}
|
||||
gamePayload.Party = partyMembers;
|
||||
|
||||
MainPlayer mainPlayer;
|
||||
auto foundMainAttr = std::find_if(attributes.begin(), attributes.end(), [&](GW::PartyAttribute attribute) {
|
||||
return playerAgentId == attribute.agent_id;
|
||||
});
|
||||
auto foundMainAgent = std::find_if(agents.begin(), agents.end(), [&](GW::AgentLiving agentLiving) {
|
||||
return playerAgentId == agentLiving.agent_id;
|
||||
});
|
||||
auto foundMainProfessionsState = std::find_if(professions.begin(), professions.end(), [&](GW::ProfessionState professionState) {
|
||||
return playerAgentId == professionState.agent_id;
|
||||
});
|
||||
auto foundMainGwPlayer = std::find_if(players.begin(), players.end(), [&](Temp::GWPlayer gwPlayer) {
|
||||
return playerAgentId == gwPlayer.agent_id;
|
||||
});
|
||||
GW::AgentLiving* mainAgentPtr;
|
||||
if (foundMainAgent == agents.end()) {
|
||||
mainAgentPtr = nullptr;
|
||||
}
|
||||
else {
|
||||
mainAgentPtr = &*foundMainAgent;
|
||||
}
|
||||
|
||||
GW::PartyAttribute* mainAttrPtr;
|
||||
if (foundMainAttr == attributes.end()) {
|
||||
mainAttrPtr = nullptr;
|
||||
}
|
||||
else {
|
||||
mainAttrPtr = &*foundMainAttr;
|
||||
}
|
||||
|
||||
GW::ProfessionState* mainProfPtr;
|
||||
if (foundMainProfessionsState == professions.end()) {
|
||||
mainProfPtr = nullptr;
|
||||
}
|
||||
else {
|
||||
mainProfPtr = &*foundMainProfessionsState;
|
||||
}
|
||||
|
||||
Temp::GWPlayer* mainGwPlayer;
|
||||
if (foundMainGwPlayer == players.end()) {
|
||||
mainGwPlayer = nullptr;
|
||||
}
|
||||
else {
|
||||
mainGwPlayer = &*foundMainGwPlayer;
|
||||
}
|
||||
|
||||
GameModuleInternal::PopulateMainPlayer(mainPlayer, (uint32_t)activeQuestId, questLog, titles, titleTiers, playerAgentId, mainGwPlayer, mainProfPtr, skillbars[playerAgentId], mainAttrPtr, mainAgentPtr);
|
||||
gamePayload.MainPlayer = mainPlayer;
|
||||
|
||||
std::list<WorldPlayer> worldPlayers;
|
||||
for (auto& gwPlayer : players) {
|
||||
if (gwPlayer.agent_id == 0 ||
|
||||
gwPlayer.agent_id == playerAgentId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
WorldPlayer worldPlayer;
|
||||
auto foundWorldProfessionsState = std::find_if(professions.begin(), professions.end(), [&](GW::ProfessionState professionState) {
|
||||
return gwPlayer.agent_id == professionState.agent_id;
|
||||
});
|
||||
auto foundWorldAttr = std::find_if(attributes.begin(), attributes.end(), [&](GW::PartyAttribute attribute) {
|
||||
return gwPlayer.agent_id == attribute.agent_id;
|
||||
});
|
||||
auto foundWorldAgent = std::find_if(agents.begin(), agents.end(), [&](GW::AgentLiving agentLiving) {
|
||||
return gwPlayer.agent_id == agentLiving.agent_id;
|
||||
});
|
||||
|
||||
std::list<uint32_t> skills;
|
||||
auto foundSkillbar = skillbars.find(gwPlayer.agent_id);
|
||||
if (foundSkillbar != skillbars.end()) {
|
||||
skills = foundSkillbar->second;
|
||||
}
|
||||
|
||||
GW::AgentLiving* worldAgentPtr;
|
||||
if (foundWorldAgent == agents.end()) {
|
||||
worldAgentPtr = nullptr;
|
||||
}
|
||||
else {
|
||||
worldAgentPtr = &*foundWorldAgent;
|
||||
}
|
||||
|
||||
GW::PartyAttribute* worldAttrPtr;
|
||||
if (foundWorldAttr == attributes.end()) {
|
||||
worldAttrPtr = nullptr;
|
||||
}
|
||||
else {
|
||||
worldAttrPtr = &*foundWorldAttr;
|
||||
}
|
||||
|
||||
GW::ProfessionState* worldProfPtr;
|
||||
if (foundWorldProfessionsState == professions.end()) {
|
||||
worldProfPtr = nullptr;
|
||||
}
|
||||
else {
|
||||
worldProfPtr = &*foundWorldProfessionsState;
|
||||
}
|
||||
|
||||
auto* tempGwPlayer = &gwPlayer;
|
||||
GameModuleInternal::PopulateWorldPlayer(titles, titleTiers, worldPlayer, gwPlayer.agent_id, tempGwPlayer, worldProfPtr, skills, worldAttrPtr, worldAgentPtr);
|
||||
worldPlayers.push_back(worldPlayer);
|
||||
}
|
||||
|
||||
gamePayload.WorldPlayers = worldPlayers;
|
||||
std::list<GW::AgentLiving> livingEntities;
|
||||
for (const auto& agentLiving : agents) {
|
||||
/*
|
||||
* Get all living entities that are not the main player, a world player or a party member.
|
||||
*/
|
||||
if (!agentLiving.GetIsLivingType() ||
|
||||
agentLiving.agent_id == playerAgentId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto foundPartyMember = std::find_if(partyMembers.begin(), partyMembers.end(), [&](Daybreak::Player player) { return player.Id == agentLiving.agent_id; });
|
||||
if (foundPartyMember != partyMembers.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto foundWorldPlayer = std::find_if(worldPlayers.begin(), worldPlayers.end(), [&](Daybreak::WorldPlayer player) { return player.Id == agentLiving.agent_id; });
|
||||
if (foundWorldPlayer != worldPlayers.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
livingEntities.push_back(agentLiving);
|
||||
}
|
||||
|
||||
auto livingEntityList = GameModuleInternal::GetLivingEntities(livingEntities);
|
||||
gamePayload.LivingEntities = livingEntityList;
|
||||
return gamePayload;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
#include "pch.h"
|
||||
#include "GameStateModule.h"
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/AgentMgr.h>
|
||||
#include <GWCA/Managers/CameraMgr.h>
|
||||
#include <GWCA/GameEntities/Agent.h>
|
||||
#include <GWCA/GameEntities/Camera.h>
|
||||
#include <GWCA/Managers/MapMgr.h>
|
||||
#include <future>
|
||||
#include <payloads/GameStatePayload.h>
|
||||
#include <json.hpp>
|
||||
#include <queue>
|
||||
#include <algorithm>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
namespace GameStateModuleInternal {
|
||||
std::list<GW::AgentLiving> GetLivingAgents() {
|
||||
std::list<GW::AgentLiving> agentList;
|
||||
const GW::AgentArray* agents_ptr = GW::Agents::GetAgentArray();
|
||||
GW::AgentArray* agents = GW::Agents::GetAgentArray();
|
||||
if (!agents) {
|
||||
return agentList;
|
||||
}
|
||||
|
||||
for (const auto* a : *agents) {
|
||||
const GW::AgentLiving* agent = a ? a->GetAsAgentLiving() : nullptr;
|
||||
if (agent) {
|
||||
agentList.push_back(*agent);
|
||||
}
|
||||
}
|
||||
|
||||
return agentList;
|
||||
}
|
||||
|
||||
std::list<StatePayload> GetStates(
|
||||
std::list<GW::AgentLiving> agents) {
|
||||
std::list<StatePayload> states;
|
||||
for (auto& agent : agents) {
|
||||
StatePayload state;
|
||||
state.Id = agent.agent_id;
|
||||
state.PosX = agent.pos.x;
|
||||
state.PosY = agent.pos.y;
|
||||
state.State = agent.type_map;
|
||||
state.Health = agent.hp * (agent.max_hp > 0 ? agent.max_hp : 1);
|
||||
state.Energy = agent.energy * (agent.max_energy > 0 ? agent.max_energy : 1);
|
||||
state.RotationAngle = agent.rotation_angle;
|
||||
states.push_back(state);
|
||||
}
|
||||
|
||||
return states;
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<GameStatePayload> GameStateModule::GetPayload(uint32_t) {
|
||||
GameStatePayload gamePayload;
|
||||
if (!GW::Map::GetIsMapLoaded()) {
|
||||
return gamePayload;
|
||||
}
|
||||
|
||||
auto agents = GameStateModuleInternal::GetLivingAgents();
|
||||
if (agents.empty()) {
|
||||
return gamePayload;
|
||||
}
|
||||
|
||||
auto states = GameStateModuleInternal::GetStates(agents);
|
||||
gamePayload.States = states;
|
||||
|
||||
auto camera = GW::CameraMgr::GetCamera();
|
||||
Daybreak::Camera cameraPayload{};
|
||||
cameraPayload.Pitch = camera->pitch;
|
||||
cameraPayload.Yaw = camera->yaw;
|
||||
gamePayload.Camera = cameraPayload;
|
||||
return gamePayload;
|
||||
}
|
||||
|
||||
std::string GameStateModule::ApiUri() {
|
||||
return "/game/state";
|
||||
}
|
||||
|
||||
std::optional<uint32_t> GameStateModule::GetContext(const httplib::Request& req, httplib::Response& res) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "HttpLogger.h"
|
||||
|
||||
namespace http {
|
||||
void ConsoleLogger(const httplib::Request req, httplib::Response res) {
|
||||
std::cout << req.method << " " << req.path << std::endl << res.status << std::endl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
#include "pch.h"
|
||||
#include "InventoryModule.h"
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/MapMgr.h>
|
||||
#include <GWCA/Context/ItemContext.h>
|
||||
#include <GWCA/Managers/ItemMgr.h>
|
||||
#include <GWCA/GameEntities/Item.h>
|
||||
#include <future>
|
||||
#include <payloads/inventoryPayload.h>
|
||||
#include <json.hpp>
|
||||
#include <queue>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
namespace InventoryModuleInternal {
|
||||
Daybreak::Bag GetBag(GW::Bag* bag) {
|
||||
Bag retBag;
|
||||
if (!bag) {
|
||||
return retBag;
|
||||
}
|
||||
|
||||
for (const auto& item : bag->items) {
|
||||
BagContent bagContent;
|
||||
if (!item) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bagContent.Id = item->model_id;
|
||||
bagContent.Slot = item->slot;
|
||||
bagContent.Count = item->quantity;
|
||||
auto modifier = item->mod_struct;
|
||||
for (auto i = 0U; i < item->mod_struct_size; i++) {
|
||||
bagContent.Modifiers.push_back((uint32_t)(modifier->mod));
|
||||
modifier++;
|
||||
}
|
||||
|
||||
retBag.Items.push_back(bagContent);
|
||||
}
|
||||
|
||||
return retBag;
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<InventoryPayload> InventoryModule::GetPayload(const uint32_t) {
|
||||
InventoryPayload inventoryPayload;
|
||||
if (!GW::Map::GetIsMapLoaded()) {
|
||||
return inventoryPayload;
|
||||
}
|
||||
|
||||
auto inventory = GW::GetItemContext()->inventory;
|
||||
if (!inventory) {
|
||||
return inventoryPayload;
|
||||
}
|
||||
|
||||
inventoryPayload.GoldInStorage = GW::Items::GetGoldAmountInStorage();
|
||||
inventoryPayload.GoldOnCharacter = GW::Items::GetGoldAmountOnCharacter();
|
||||
inventoryPayload.Backpack = InventoryModuleInternal::GetBag(inventory->backpack);
|
||||
inventoryPayload.BeltPouch = (InventoryModuleInternal::GetBag(inventory->belt_pouch));
|
||||
inventoryPayload.Bags.push_back(InventoryModuleInternal::GetBag(inventory->bag1));
|
||||
inventoryPayload.Bags.push_back(InventoryModuleInternal::GetBag(inventory->bag2));
|
||||
inventoryPayload.EquipmentPack = (InventoryModuleInternal::GetBag(inventory->equipment_pack));
|
||||
inventoryPayload.MaterialStorage = (InventoryModuleInternal::GetBag(inventory->material_storage));
|
||||
inventoryPayload.UnclaimedItems = (InventoryModuleInternal::GetBag(inventory->unclaimed_items));
|
||||
inventoryPayload.EquippedItems = (InventoryModuleInternal::GetBag(inventory->equipped_items));
|
||||
inventoryPayload.StoragePanes.push_back(InventoryModuleInternal::GetBag(inventory->storage1));
|
||||
inventoryPayload.StoragePanes.push_back(InventoryModuleInternal::GetBag(inventory->storage2));
|
||||
inventoryPayload.StoragePanes.push_back(InventoryModuleInternal::GetBag(inventory->storage3));
|
||||
inventoryPayload.StoragePanes.push_back(InventoryModuleInternal::GetBag(inventory->storage4));
|
||||
inventoryPayload.StoragePanes.push_back(InventoryModuleInternal::GetBag(inventory->storage5));
|
||||
inventoryPayload.StoragePanes.push_back(InventoryModuleInternal::GetBag(inventory->storage6));
|
||||
inventoryPayload.StoragePanes.push_back(InventoryModuleInternal::GetBag(inventory->storage7));
|
||||
inventoryPayload.StoragePanes.push_back(InventoryModuleInternal::GetBag(inventory->storage8));
|
||||
inventoryPayload.StoragePanes.push_back(InventoryModuleInternal::GetBag(inventory->storage9));
|
||||
inventoryPayload.StoragePanes.push_back(InventoryModuleInternal::GetBag(inventory->storage10));
|
||||
inventoryPayload.StoragePanes.push_back(InventoryModuleInternal::GetBag(inventory->storage11));
|
||||
inventoryPayload.StoragePanes.push_back(InventoryModuleInternal::GetBag(inventory->storage12));
|
||||
inventoryPayload.StoragePanes.push_back(InventoryModuleInternal::GetBag(inventory->storage13));
|
||||
inventoryPayload.StoragePanes.push_back(InventoryModuleInternal::GetBag(inventory->storage14));
|
||||
return inventoryPayload;
|
||||
}
|
||||
|
||||
std::optional<uint32_t> InventoryModule::GetContext(const httplib::Request& req, httplib::Response& res)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string InventoryModule::ApiUri()
|
||||
{
|
||||
return "/inventory";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
#include "pch.h"
|
||||
#include "ItemNameModule.h"
|
||||
#include "payloads/NamePayload.h"
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/ItemMgr.h>
|
||||
#include <GWCA/GameEntities/Item.h>
|
||||
#include <future>
|
||||
#include <json.hpp>
|
||||
#include <tuple>
|
||||
#include <queue>
|
||||
#include <GWCA/GWCA.h>
|
||||
#include <Windows.h>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <Utils.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
namespace ItemNameModuleInternal {
|
||||
std::vector<std::string> SplitAndRemoveSpaces(const std::string& s) {
|
||||
std::vector<std::string> result;
|
||||
std::stringstream ss(s);
|
||||
std::string item;
|
||||
|
||||
while (getline(ss, item, ',')) {
|
||||
item.erase(std::remove(item.begin(), item.end(), ' '), item.end());
|
||||
result.push_back(item);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
std::string ItemNameModule::ApiUri() {
|
||||
return "/items/name";
|
||||
}
|
||||
|
||||
std::optional<GW::Item*> ItemNameModule::GetContext(const httplib::Request& req, httplib::Response& res) {
|
||||
uint32_t id = 0;
|
||||
std::vector<uint32_t> modifiers;
|
||||
|
||||
auto id_it = req.params.find("id");
|
||||
if (id_it == req.params.end()) {
|
||||
res.status = 400;
|
||||
res.set_content("Missing id parameter", "text/plain");
|
||||
return std::optional<GW::Item*>();
|
||||
}
|
||||
else {
|
||||
auto& idStr = id_it->second;
|
||||
int parsedId;
|
||||
if (!Daybreak::Utils::StringToInt(idStr, parsedId)) {
|
||||
res.status = 400;
|
||||
res.set_content("Invalid id parameter", "text/plain");
|
||||
return std::optional<GW::Item*>();
|
||||
}
|
||||
|
||||
id = static_cast<uint32_t>(parsedId);
|
||||
}
|
||||
|
||||
auto mod_it = req.params.find("modifiers");
|
||||
if (mod_it == req.params.end()) {
|
||||
res.status = 400;
|
||||
res.set_content("Missing modifiers parameter", "text/plain");
|
||||
return std::optional<GW::Item*>();
|
||||
}
|
||||
else {
|
||||
auto& modifiersStr = mod_it->second;
|
||||
const auto tokens = ItemNameModuleInternal::SplitAndRemoveSpaces(modifiersStr);
|
||||
for (const auto& token : tokens) {
|
||||
int parsedModifier;
|
||||
if (!Daybreak::Utils::StringToInt(token, parsedModifier)) {
|
||||
res.status = 400;
|
||||
res.set_content("Invalid modifier parameter", "text/plain");
|
||||
return std::optional<GW::Item*>();
|
||||
}
|
||||
|
||||
modifiers.push_back(static_cast<uint32_t>(parsedModifier));
|
||||
}
|
||||
}
|
||||
|
||||
GW::ItemModifier parsedModifiers[64];
|
||||
for (auto i = 0U; i < modifiers.size(); i++) {
|
||||
GW::ItemModifier parsedModifier;
|
||||
const auto mod = modifiers.at(i);
|
||||
parsedModifier.mod = mod;
|
||||
parsedModifiers[i] = parsedModifier;
|
||||
}
|
||||
|
||||
auto item = GW::Items::GetItemByModelIdAndModifiers(id, parsedModifiers, modifiers.size(), 1, 23);
|
||||
if (!item) {
|
||||
return std::optional<GW::Item*>();
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
std::optional<NamePayload> ItemNameModule::GetPayload(GW::Item* context) {
|
||||
NamePayload payload;
|
||||
if (!context) {
|
||||
return std::optional<NamePayload>();
|
||||
}
|
||||
|
||||
payload.Id = context->item_id;
|
||||
GW::Items::AsyncGetItemName(context, this->name);
|
||||
return payload;
|
||||
}
|
||||
|
||||
bool ItemNameModule::CanReturn(const httplib::Request& req, httplib::Response& res, const NamePayload& payload) {
|
||||
return !name.empty();
|
||||
}
|
||||
|
||||
std::tuple<std::string, std::string> ItemNameModule::ReturnPayload(NamePayload payload) {
|
||||
payload.Name = Daybreak::Utils::WStringToString(this->name);
|
||||
return std::make_tuple(static_cast<json>(payload).dump(), "application/json");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#include "pch.h"
|
||||
#include "LoginModule.h"
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/MapMgr.h>
|
||||
#include <GWCA/Context/CharContext.h>
|
||||
#include <future>
|
||||
#include <payloads/LoginPayload.h>
|
||||
#include <json.hpp>
|
||||
#include <queue>
|
||||
#include "Utils.h"
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
std::optional<LoginPayload> LoginModule::GetPayload(const uint32_t) {
|
||||
const auto context = GW::GetCharContext();
|
||||
LoginPayload loginPayload;
|
||||
if (!context) {
|
||||
return loginPayload;
|
||||
}
|
||||
|
||||
std::wstring playerEmail(context->player_email);
|
||||
std::wstring playerName(context->player_name);
|
||||
loginPayload.Email = Daybreak::Utils::WStringToString(playerEmail);
|
||||
loginPayload.PlayerName = Daybreak::Utils::WStringToString(playerName);
|
||||
|
||||
return loginPayload;
|
||||
}
|
||||
|
||||
std::optional<uint32_t> LoginModule::GetContext(const httplib::Request& req, httplib::Response& res) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string LoginModule::ApiUri()
|
||||
{
|
||||
return "/login";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,481 @@
|
||||
#include "pch.h"
|
||||
#include "MainPlayerModule.h"
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/MapMgr.h>
|
||||
#include <GWCA/Managers/AgentMgr.h>
|
||||
#include <GWCA/Managers/PartyMgr.h>
|
||||
#include <GWCA/Managers/PlayerMgr.h>
|
||||
#include <GWCA/Managers/SkillbarMgr.h>
|
||||
#include <GWCA/Managers/QuestMgr.h>
|
||||
#include <GWCA/Context/WorldContext.h>
|
||||
#include <GWCA/GameContainers/Array.h>
|
||||
#include <GWCA/GameEntities/Skill.h>
|
||||
#include <GWCA/GameEntities/Quest.h>
|
||||
#include <GWCA/GameEntities/Agent.h>
|
||||
#include <GWCA/GameEntities/Title.h>
|
||||
#include <GWCA/GameEntities/Party.h>
|
||||
#include <GWCA/GameEntities/Attribute.h>
|
||||
#include <GWCA/GameEntities/Player.h>
|
||||
#include <GWCA/GameEntities/NPC.h>
|
||||
#include <GWCA/Constants/Constants.h>
|
||||
#include <temp/GWPlayer.h>
|
||||
#include <future>
|
||||
#include <payloads/MainPlayer.h>
|
||||
#include <json.hpp>
|
||||
#include <queue>
|
||||
#include <algorithm>
|
||||
#include "Utils.h"
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
namespace MainPlayerModuleInternal {
|
||||
std::list<QuestMetadata> GetQuestLog() {
|
||||
std::list<QuestMetadata> questMetadatas;
|
||||
const auto questLog = GW::QuestMgr::GetQuestLog();
|
||||
if (!questLog) {
|
||||
return questMetadatas;
|
||||
}
|
||||
|
||||
for (auto& quest : *questLog) {
|
||||
QuestMetadata metadata;
|
||||
metadata.FromId = (uint32_t)quest.map_from;
|
||||
metadata.ToId = (uint32_t)quest.map_to;
|
||||
metadata.Id = (uint32_t)quest.quest_id;
|
||||
metadata.PosX = quest.marker.x;
|
||||
metadata.PosY = quest.marker.y;
|
||||
questMetadatas.push_back(metadata);
|
||||
}
|
||||
|
||||
return questMetadatas;
|
||||
}
|
||||
|
||||
std::vector<GW::MapAgent> GetMapEntities() {
|
||||
std::vector<GW::MapAgent> entities;
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
if (!worldContext) {
|
||||
return entities;
|
||||
}
|
||||
|
||||
for (auto& agent : worldContext->map_agents) {
|
||||
entities.push_back(agent);
|
||||
}
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
std::list<GW::PartyAttribute> GetPartyAttributes() {
|
||||
std::list<GW::PartyAttribute> attributes;
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
if (!worldContext) {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
for (auto& attribute : worldContext->attributes) {
|
||||
attributes.push_back(attribute);
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
std::list<GW::ProfessionState> GetProfessions() {
|
||||
std::list<GW::ProfessionState> professions;
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
if (!worldContext) {
|
||||
return professions;
|
||||
}
|
||||
|
||||
for (auto& profession : worldContext->party_profession_states) {
|
||||
professions.push_back(profession);
|
||||
}
|
||||
|
||||
return professions;
|
||||
}
|
||||
|
||||
std::list<GW::AgentLiving> GetLivingAgents() {
|
||||
std::list<GW::AgentLiving> agentList;
|
||||
const GW::AgentArray* agents = GW::Agents::GetAgentArray();
|
||||
if (!agents) {
|
||||
return agentList;
|
||||
}
|
||||
|
||||
for (auto* a : *agents) {
|
||||
const GW::AgentLiving* agent = a ? a->GetAsAgentLiving() : nullptr;
|
||||
if (agent) {
|
||||
agentList.push_back(*agent);
|
||||
}
|
||||
}
|
||||
|
||||
return agentList;
|
||||
}
|
||||
|
||||
std::list<GW::NPC> GetNpcs() {
|
||||
std::list<GW::NPC> npcs;
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
if (!worldContext) {
|
||||
return npcs;
|
||||
}
|
||||
|
||||
for (auto& npc : worldContext->npcs) {
|
||||
npcs.push_back(npc);
|
||||
}
|
||||
|
||||
return npcs;
|
||||
}
|
||||
|
||||
std::vector<GW::TitleTier> GetTitleTiers() {
|
||||
std::vector<GW::TitleTier> titles;
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
if (!worldContext) {
|
||||
return titles;
|
||||
}
|
||||
|
||||
for (auto& title : worldContext->title_tiers) {
|
||||
titles.push_back(title);
|
||||
}
|
||||
|
||||
return titles;
|
||||
}
|
||||
|
||||
std::list<GW::Title> GetTitles() {
|
||||
std::list<GW::Title> titles;
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
if (!worldContext) {
|
||||
return titles;
|
||||
}
|
||||
|
||||
for (auto& title : worldContext->titles) {
|
||||
titles.push_back(title);
|
||||
}
|
||||
|
||||
return titles;
|
||||
}
|
||||
|
||||
std::list<Temp::GWPlayer> GetPlayers() {
|
||||
std::list<Temp::GWPlayer> players;
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
if (!worldContext) {
|
||||
return players;
|
||||
}
|
||||
|
||||
Temp::GWPlayer* tempPlayerArray = (Temp::GWPlayer*)worldContext->players.m_buffer;
|
||||
if (!tempPlayerArray) {
|
||||
return players;
|
||||
}
|
||||
|
||||
for (auto i = 0U; i < worldContext->players.m_size; i++) {
|
||||
if (tempPlayerArray->agent_id != 0) {
|
||||
players.push_back(*tempPlayerArray);
|
||||
}
|
||||
tempPlayerArray++;
|
||||
}
|
||||
|
||||
return players;
|
||||
}
|
||||
|
||||
std::map<uint32_t, std::list<uint32_t>> GetSkillbars() {
|
||||
std::map<uint32_t, std::list<uint32_t>> skillbarMap;
|
||||
auto skillbars = GW::SkillbarMgr::GetSkillbarArray();
|
||||
if (!skillbars) {
|
||||
return skillbarMap;
|
||||
}
|
||||
|
||||
for (auto& skillbar : *skillbars) {
|
||||
std::list<uint32_t> skillList;
|
||||
skillList.push_back((uint32_t)skillbar.skills[0].skill_id);
|
||||
skillList.push_back((uint32_t)skillbar.skills[1].skill_id);
|
||||
skillList.push_back((uint32_t)skillbar.skills[2].skill_id);
|
||||
skillList.push_back((uint32_t)skillbar.skills[3].skill_id);
|
||||
skillList.push_back((uint32_t)skillbar.skills[4].skill_id);
|
||||
skillList.push_back((uint32_t)skillbar.skills[5].skill_id);
|
||||
skillList.push_back((uint32_t)skillbar.skills[6].skill_id);
|
||||
skillList.push_back((uint32_t)skillbar.skills[7].skill_id);
|
||||
skillbarMap[skillbar.agent_id] = skillList;
|
||||
}
|
||||
|
||||
return skillbarMap;
|
||||
}
|
||||
|
||||
std::list<LivingEntity> GetLivingEntities(
|
||||
std::list<GW::AgentLiving> agents) {
|
||||
std::list<LivingEntity> entities;
|
||||
for (auto& agent : agents) {
|
||||
LivingEntity entity;
|
||||
entity.PrimaryProfessionId = agent.primary;
|
||||
entity.SecondaryProfessionId = agent.secondary;
|
||||
entity.EntityState = agent.type_map;
|
||||
entity.EntityAllegiance = (uint32_t)agent.allegiance;
|
||||
entity.NpcDefinition = agent.player_number;
|
||||
entity.Id = agent.agent_id;
|
||||
entity.Timer = agent.timer;
|
||||
entity.Level = agent.level;
|
||||
entity.PosX = agent.pos.x;
|
||||
entity.PosY = agent.pos.y;
|
||||
entities.push_back(entity);
|
||||
}
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
void PopulatePlayer(
|
||||
Player& player,
|
||||
int playerId,
|
||||
GW::ProfessionState* professionState,
|
||||
std::list<uint32_t> skillbar,
|
||||
GW::PartyAttribute* partyAttribute,
|
||||
GW::AgentLiving* agent) {
|
||||
|
||||
std::list<uint32_t> unlockedProfessions;
|
||||
if (professionState) {
|
||||
for (auto i = 0; i < 11; i++) {
|
||||
auto prof = (GW::Constants::Profession)i;
|
||||
if (professionState->IsProfessionUnlocked(prof)) {
|
||||
unlockedProfessions.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
unlockedProfessions.push_back((uint32_t)professionState->primary);
|
||||
}
|
||||
|
||||
Build build;
|
||||
std::list<Attribute> attributes;
|
||||
if (partyAttribute) {
|
||||
for (const auto& partyAttr : partyAttribute->attribute) {
|
||||
if (((uint32_t)partyAttr.id < 0) ||
|
||||
((uint32_t)partyAttr.id > 44) ||
|
||||
partyAttr.level <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Attribute attribute;
|
||||
attribute.Id = (uint32_t)partyAttr.id;
|
||||
attribute.BaseLevel = partyAttr.level_base;
|
||||
attribute.ActualLevel = partyAttr.level;
|
||||
attribute.DecrementPoints = partyAttr.decrement_points;
|
||||
attribute.IncrementPoints = partyAttr.increment_points;
|
||||
attributes.push_back(attribute);
|
||||
}
|
||||
|
||||
build.Attributes = attributes;
|
||||
if (agent) {
|
||||
build.Primary = (uint32_t)agent->primary;
|
||||
build.Secondary = (uint32_t)agent->secondary;
|
||||
}
|
||||
else if (professionState) {
|
||||
build.Primary = (uint32_t)professionState->primary;
|
||||
build.Secondary = (uint32_t)professionState->secondary;
|
||||
}
|
||||
|
||||
build.Skills = skillbar;
|
||||
player.Build = build;
|
||||
}
|
||||
|
||||
player.UnlockedProfession = unlockedProfessions;
|
||||
player.Id = playerId;
|
||||
if (agent) {
|
||||
player.PosX = agent->pos.x;
|
||||
player.PosY = agent->pos.y;
|
||||
player.Timer = agent->timer;
|
||||
player.Level = agent->level;
|
||||
player.NpcDefinition = agent->player_number;
|
||||
player.PrimaryProfessionId = (uint32_t)agent->primary;
|
||||
player.SecondaryProfessionId = (uint32_t)agent->secondary;
|
||||
player.Health = agent->hp * (agent->max_hp > 0 ? agent->max_hp : 1);
|
||||
player.Energy = agent->energy * (agent->max_energy > 0 ? agent->max_energy : 1);
|
||||
player.RotationAngle = agent->rotation_angle;
|
||||
}
|
||||
else if (professionState) {
|
||||
player.PrimaryProfessionId = (uint32_t)professionState->primary;
|
||||
player.SecondaryProfessionId = (uint32_t)professionState->secondary;
|
||||
}
|
||||
}
|
||||
|
||||
void PopulateWorldPlayer(
|
||||
std::list<GW::Title> titles,
|
||||
std::vector<GW::TitleTier> titleTiers,
|
||||
WorldPlayer& player,
|
||||
int playerId,
|
||||
Temp::GWPlayer* gwPlayer,
|
||||
GW::ProfessionState* professionState,
|
||||
std::list<uint32_t> skillbar,
|
||||
GW::PartyAttribute* partyAttribute,
|
||||
GW::AgentLiving* agent) {
|
||||
|
||||
PopulatePlayer(player, playerId, professionState, skillbar, partyAttribute, agent);
|
||||
if (!gwPlayer) {
|
||||
return;
|
||||
}
|
||||
|
||||
GW::Title gwTitle;
|
||||
Title title;
|
||||
int titleId = 0;
|
||||
std::wstring gwPlayerName(gwPlayer->name);
|
||||
auto name = Daybreak::Utils::WStringToString(gwPlayerName);
|
||||
player.Name = name;
|
||||
|
||||
if (titles.empty() ||
|
||||
titleTiers.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto& t : titles) {
|
||||
if (t.current_title_tier_index == gwPlayer->active_title_tier) {
|
||||
gwTitle = t;
|
||||
break;
|
||||
}
|
||||
|
||||
titleId++;
|
||||
}
|
||||
|
||||
if (gwTitle.current_title_tier_index >= titleTiers.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto titleTier = titleTiers[gwTitle.current_title_tier_index];
|
||||
title.CurrentPoints = gwTitle.current_points;
|
||||
title.IsPercentage = gwTitle.is_percentage_based();
|
||||
title.PointsForCurrentRank = gwTitle.points_needed_current_rank;
|
||||
title.PointsForNextRank = titleTier.tier_number == gwTitle.max_title_rank ? gwTitle.current_points : gwTitle.points_needed_next_rank;
|
||||
title.TierNumber = titleTier.tier_number;
|
||||
title.MaxTierNumber = gwTitle.max_title_rank;
|
||||
title.Id = titleId;
|
||||
|
||||
player.Title = title;
|
||||
}
|
||||
|
||||
void PopulateMainPlayer(
|
||||
MainPlayer& player,
|
||||
int activeQuestId,
|
||||
std::list<QuestMetadata> questLog,
|
||||
std::list<GW::Title> titles,
|
||||
std::vector<GW::TitleTier> titleTiers,
|
||||
int playerId,
|
||||
Temp::GWPlayer* gwPlayer,
|
||||
GW::ProfessionState* professionState,
|
||||
std::list<uint32_t> skillbar,
|
||||
GW::PartyAttribute* partyAttribute,
|
||||
GW::AgentLiving* agent) {
|
||||
PopulateWorldPlayer(titles, titleTiers, player, playerId, gwPlayer, professionState, skillbar, partyAttribute, agent);
|
||||
player.CurrentQuest = activeQuestId;
|
||||
player.QuestLog = questLog;
|
||||
player.HardModeUnlocked = GW::GetWorldContext()->is_hard_mode_unlocked == 1;
|
||||
player.Experience = GW::GetWorldContext()->experience;
|
||||
player.Morale = GW::GetWorldContext()->morale;
|
||||
if (agent) {
|
||||
player.CurrentEnergy = agent->max_energy * agent->energy;
|
||||
player.CurrentHp = agent->max_hp * agent->hp;
|
||||
player.MaxEnergy = agent->max_energy;
|
||||
player.MaxHp = agent->max_hp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<MainPlayer> MainPlayerModule::GetPayload(const uint32_t) {
|
||||
MainPlayer mainPlayer;
|
||||
if (!GW::Map::GetIsMapLoaded()) {
|
||||
return mainPlayer;
|
||||
}
|
||||
|
||||
auto worldContext = GW::GetWorldContext();
|
||||
if (!worldContext) {
|
||||
return mainPlayer;
|
||||
}
|
||||
|
||||
auto activeQuestId = GW::QuestMgr::GetActiveQuestId();
|
||||
auto questLog = MainPlayerModuleInternal::GetQuestLog();
|
||||
auto skillbars = MainPlayerModuleInternal::GetSkillbars();
|
||||
if (skillbars.empty()) {
|
||||
return mainPlayer;
|
||||
}
|
||||
|
||||
auto agents = MainPlayerModuleInternal::GetLivingAgents();
|
||||
if (agents.empty()) {
|
||||
return mainPlayer;
|
||||
}
|
||||
|
||||
auto titles = MainPlayerModuleInternal::GetTitles();
|
||||
|
||||
auto titleTiers = MainPlayerModuleInternal::GetTitleTiers();
|
||||
|
||||
auto players = MainPlayerModuleInternal::GetPlayers();
|
||||
if (players.empty()) {
|
||||
return mainPlayer;
|
||||
}
|
||||
|
||||
auto npcs = MainPlayerModuleInternal::GetNpcs();
|
||||
if (npcs.empty()) {
|
||||
return mainPlayer;
|
||||
}
|
||||
|
||||
auto attributes = MainPlayerModuleInternal::GetPartyAttributes();
|
||||
if (attributes.empty()) {
|
||||
return mainPlayer;
|
||||
}
|
||||
|
||||
auto professions = MainPlayerModuleInternal::GetProfessions();
|
||||
if (professions.empty()) {
|
||||
return mainPlayer;
|
||||
}
|
||||
|
||||
auto mapAgents = MainPlayerModuleInternal::GetMapEntities();
|
||||
if (mapAgents.empty()) {
|
||||
return mainPlayer;
|
||||
}
|
||||
auto playerAgentId = GW::Agents::GetControlledCharacterId();
|
||||
|
||||
auto foundMainAttr = std::find_if(attributes.begin(), attributes.end(), [&](GW::PartyAttribute attribute) {
|
||||
return playerAgentId == attribute.agent_id;
|
||||
});
|
||||
auto foundMainAgent = std::find_if(agents.begin(), agents.end(), [&](GW::AgentLiving agentLiving) {
|
||||
return playerAgentId == agentLiving.agent_id;
|
||||
});
|
||||
auto foundMainProfessionsState = std::find_if(professions.begin(), professions.end(), [&](GW::ProfessionState professionState) {
|
||||
return playerAgentId == professionState.agent_id;
|
||||
});
|
||||
auto foundMainGwPlayer = std::find_if(players.begin(), players.end(), [&](Temp::GWPlayer gwPlayer) {
|
||||
return playerAgentId == gwPlayer.agent_id;
|
||||
});
|
||||
GW::AgentLiving* mainAgentPtr;
|
||||
if (foundMainAgent == agents.end()) {
|
||||
mainAgentPtr = nullptr;
|
||||
}
|
||||
else {
|
||||
mainAgentPtr = &*foundMainAgent;
|
||||
}
|
||||
|
||||
GW::PartyAttribute* mainAttrPtr;
|
||||
if (foundMainAttr == attributes.end()) {
|
||||
mainAttrPtr = nullptr;
|
||||
}
|
||||
else {
|
||||
mainAttrPtr = &*foundMainAttr;
|
||||
}
|
||||
|
||||
GW::ProfessionState* mainProfPtr;
|
||||
if (foundMainProfessionsState == professions.end()) {
|
||||
mainProfPtr = nullptr;
|
||||
}
|
||||
else {
|
||||
mainProfPtr = &*foundMainProfessionsState;
|
||||
}
|
||||
|
||||
Temp::GWPlayer* mainGwPlayer;
|
||||
if (foundMainGwPlayer == players.end()) {
|
||||
mainGwPlayer = nullptr;
|
||||
}
|
||||
else {
|
||||
mainGwPlayer = &*foundMainGwPlayer;
|
||||
}
|
||||
|
||||
MainPlayerModuleInternal::PopulateMainPlayer(mainPlayer, (uint32_t)activeQuestId, questLog, titles, titleTiers, playerAgentId, mainGwPlayer, mainProfPtr, skillbars[playerAgentId], mainAttrPtr, mainAgentPtr);
|
||||
return mainPlayer;
|
||||
}
|
||||
|
||||
std::optional<uint32_t> MainPlayerModule::GetContext(const httplib::Request& req, httplib::Response& res)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::string MainPlayerModule::ApiUri()
|
||||
{
|
||||
return "/game/mainplayer";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#include "pch.h"
|
||||
#include "MapModule.h"
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/MapMgr.h>
|
||||
#include <future>
|
||||
#include <payloads/MapPayload.h>
|
||||
#include <json.hpp>
|
||||
#include <queue>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
std::optional<MapPayload> MapModule::GetPayload(const uint32_t) {
|
||||
MapPayload mapPayload;
|
||||
auto isLoaded = GW::Map::GetIsMapLoaded();
|
||||
if (!isLoaded) {
|
||||
return mapPayload;
|
||||
}
|
||||
|
||||
auto instanceType = GW::Map::GetInstanceType();
|
||||
auto instanceTime = GW::Map::GetInstanceTime();
|
||||
auto mapInfo = GW::Map::GetCurrentMapInfo();
|
||||
auto isInCinematic = GW::Map::GetIsInCinematic();
|
||||
auto region = GW::Map::GetRegion();
|
||||
auto mapId = GW::Map::GetMapID();
|
||||
if (!mapInfo) {
|
||||
return mapPayload;
|
||||
}
|
||||
|
||||
mapPayload.Campaign = static_cast<uint32_t>(mapInfo->campaign);
|
||||
mapPayload.Continent = static_cast<uint32_t>(mapInfo->continent);
|
||||
mapPayload.Region = mapInfo->region;
|
||||
mapPayload.InstanceType = (uint32_t)instanceType;
|
||||
mapPayload.IsLoaded = isLoaded;
|
||||
mapPayload.Timer = instanceTime;
|
||||
mapPayload.Id = (uint32_t)mapId;
|
||||
|
||||
return mapPayload;
|
||||
}
|
||||
|
||||
std::string MapModule::ApiUri()
|
||||
{
|
||||
return "/map";
|
||||
}
|
||||
|
||||
std::optional<uint32_t> MapModule::GetContext(const httplib::Request& req, httplib::Response& res)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#include "pch.h"
|
||||
#include "PathingMetadataModule.h"
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/MapMgr.h>
|
||||
#include <GWCA/GameEntities/Pathing.h>
|
||||
#include <future>
|
||||
#include <payloads/PathingMetadataPayload.h>
|
||||
#include <json.hpp>
|
||||
#include <queue>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
std::optional<PathingMetadataPayload> PathingMetadataModule::GetPayload(const uint32_t) {
|
||||
PathingMetadataPayload pathingPayload;
|
||||
pathingPayload.TrapezoidCount = 0;
|
||||
if (!GW::Map::GetIsMapLoaded()) {
|
||||
return pathingPayload;
|
||||
}
|
||||
|
||||
auto pathingMap = GW::Map::GetPathingMap();
|
||||
if (!pathingMap) {
|
||||
return pathingPayload;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (auto i = 0U; i < pathingMap->size(); i++) {
|
||||
auto gwPathingMap = pathingMap->at(i);
|
||||
count += gwPathingMap.trapezoid_count;
|
||||
}
|
||||
|
||||
pathingPayload.TrapezoidCount = count;
|
||||
return pathingPayload;
|
||||
}
|
||||
|
||||
std::string PathingMetadataModule::ApiUri()
|
||||
{
|
||||
return "/pathing/metadata";
|
||||
}
|
||||
|
||||
std::optional<uint32_t> PathingMetadataModule::GetContext(const httplib::Request& req, httplib::Response& res)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
#include "pch.h"
|
||||
#include "PathingModule.h"
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/MapMgr.h>
|
||||
#include <future>
|
||||
#include <payloads/PathingPayload.h>
|
||||
#include <json.hpp>
|
||||
#include <queue>
|
||||
#include <GWCA/GameEntities/Pathing.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
std::optional<PathingPayload> PathingModule::GetPayload(const uint32_t) {
|
||||
PathingPayload pathingPayload;
|
||||
pathingPayload.Trapezoids.clear();
|
||||
pathingPayload.AdjacencyList.clear();
|
||||
if (!GW::Map::GetIsMapLoaded()) {
|
||||
return pathingPayload;
|
||||
}
|
||||
|
||||
auto pathingMap = GW::Map::GetPathingMap();
|
||||
if (!pathingMap) {
|
||||
return pathingPayload;
|
||||
}
|
||||
|
||||
std::list<PathingTrapezoid> trapezoids;
|
||||
std::map<int, std::list<int>> adjacencyMap;
|
||||
for (auto i = 0U; i < pathingMap->size(); i++) {
|
||||
auto gwPathingMap = pathingMap->at(i);
|
||||
for (auto j = 0U; j < gwPathingMap.trapezoid_count; j++) {
|
||||
auto gwTrapezoid = gwPathingMap.trapezoids[j];
|
||||
PathingTrapezoid trapezoid;
|
||||
trapezoid.Id = gwTrapezoid.id;
|
||||
trapezoid.PathingMapId = i;
|
||||
trapezoid.XTL = gwTrapezoid.XTL;
|
||||
trapezoid.XBL = gwTrapezoid.XBL;
|
||||
trapezoid.XTR = gwTrapezoid.XTR;
|
||||
trapezoid.XBR = gwTrapezoid.XBR;
|
||||
trapezoid.YT = gwTrapezoid.YT;
|
||||
trapezoid.YB = gwTrapezoid.YB;
|
||||
|
||||
trapezoids.push_back(trapezoid);
|
||||
for (int k = 0; k < 4; k++) {
|
||||
auto adjacentTrapezoid = gwTrapezoid.adjacent[k];
|
||||
if (adjacentTrapezoid) {
|
||||
adjacencyMap[trapezoid.Id].push_back(adjacentTrapezoid->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::list<std::list<int>> adjacencyList;
|
||||
for (const auto& pair : adjacencyMap) {
|
||||
adjacencyList.push_back(pair.second);
|
||||
}
|
||||
|
||||
pathingPayload.Trapezoids = trapezoids;
|
||||
pathingPayload.AdjacencyList = adjacencyList;
|
||||
return pathingPayload;
|
||||
}
|
||||
|
||||
std::string PathingModule::ApiUri()
|
||||
{
|
||||
return "/pathing";
|
||||
}
|
||||
|
||||
std::optional<uint32_t> PathingModule::GetContext(const httplib::Request& req, httplib::Response& res)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
#include "pch.h"
|
||||
#include <PreGameModule.h>
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/MapMgr.h>
|
||||
#include <GWCA/Context/PreGameContext.h>
|
||||
#include <payloads/PreGamePayload.h>
|
||||
#include <json.hpp>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
std::optional<PreGamePayload> PreGameModule::GetPayload(const uint32_t) {
|
||||
PreGamePayload preGamePayload;
|
||||
if (GW::Map::GetIsMapLoaded())
|
||||
{
|
||||
preGamePayload.Characters.clear();
|
||||
preGamePayload.ChosenCharacterIndex = 0;
|
||||
return preGamePayload;
|
||||
}
|
||||
|
||||
const auto context = GW::GetPreGameContext();
|
||||
if (!context)
|
||||
{
|
||||
return preGamePayload;
|
||||
}
|
||||
|
||||
for (const auto& loginChar : context->chars)
|
||||
{
|
||||
char charName[20];
|
||||
int result = WideCharToMultiByte(CP_UTF8, 0, loginChar.character_name, -1, charName, sizeof(charName), NULL, NULL);
|
||||
if (result == 0)
|
||||
{
|
||||
// handle error, use GetLastError() to get more info
|
||||
}
|
||||
|
||||
preGamePayload.Characters.emplace_back(charName);
|
||||
}
|
||||
|
||||
preGamePayload.ChosenCharacterIndex = context->index_1;
|
||||
return preGamePayload;
|
||||
}
|
||||
|
||||
std::string PreGameModule::ApiUri()
|
||||
{
|
||||
return "/pregame";
|
||||
}
|
||||
|
||||
std::optional<uint32_t> PreGameModule::GetContext(const httplib::Request& req, httplib::Response& res)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "pch.h"
|
||||
#include "ProcessIdModule.h"
|
||||
|
||||
namespace http {
|
||||
namespace modules {
|
||||
static DWORD processId = 0;
|
||||
|
||||
int GetProcessId() {
|
||||
if (processId > 0) {
|
||||
return processId;
|
||||
}
|
||||
|
||||
processId = GetCurrentProcessId();
|
||||
return processId;
|
||||
}
|
||||
|
||||
void HandleProcessId(const httplib::Request&, httplib::Response& res) {
|
||||
res.set_content(std::to_string(GetProcessId()), "text/plain");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
#include "pch.h"
|
||||
#include "Server.h"
|
||||
|
||||
namespace http {
|
||||
namespace server {
|
||||
static httplib::Server server;
|
||||
|
||||
static int FindPort() {
|
||||
// Initialize Winsock
|
||||
WSADATA wsaData;
|
||||
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
|
||||
std::cout << "Failed to initialize Winsock." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Create a socket
|
||||
SOCKET serverSocket = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (serverSocket == INVALID_SOCKET) {
|
||||
std::cout << "Failed to create socket." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
sockaddr_in serverAddr;
|
||||
serverAddr.sin_family = AF_INET;
|
||||
serverAddr.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
// Start from a specific port number and find an available port
|
||||
int port = 48557;
|
||||
while (true) {
|
||||
serverAddr.sin_port = htons(port);
|
||||
|
||||
if (bind(serverSocket, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) == 0) {
|
||||
std::cout << "Successfully bound to port " << port << std::endl;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
port++; // Try the next port
|
||||
}
|
||||
|
||||
if (port > 65534) {
|
||||
std::cout << "Failed to find a port. Cannot initialize server" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up
|
||||
closesocket(serverSocket);
|
||||
WSACleanup();
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
void Get(const std::string& pattern, httplib::Server::Handler handler) {
|
||||
server.Get(pattern, handler);
|
||||
}
|
||||
|
||||
void Post(const std::string& pattern, httplib::Server::Handler handler) {
|
||||
server.Post(pattern, handler);
|
||||
}
|
||||
|
||||
void SetLogger(httplib::Logger logger) {
|
||||
server.set_logger(logger);
|
||||
}
|
||||
|
||||
bool StartServer() {
|
||||
int port = FindPort();
|
||||
if (port > 0) {
|
||||
std::cout << "Initializing server on port " << port << std::endl;
|
||||
server.set_read_timeout(1, 0);
|
||||
server.set_write_timeout(1, 0);
|
||||
server.set_idle_interval(0, 100000);
|
||||
server.listen("0.0.0.0", port);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void StopServer() {
|
||||
server.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#include "pch.h"
|
||||
#include "SessionModule.h"
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/MapMgr.h>
|
||||
#include <future>
|
||||
#include <payloads/SessionPayload.h>
|
||||
#include <json.hpp>
|
||||
#include <queue>
|
||||
#include <GWCA/Context/AgentContext.h>
|
||||
#include <GWCA/Context/WorldContext.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
std::optional<SessionPayload> SessionModule::GetPayload(const uint32_t) {
|
||||
SessionPayload sessionPayload;
|
||||
sessionPayload.MapId = (uint32_t)GW::Map::GetMapID();
|
||||
sessionPayload.InstanceType = (uint32_t)GW::Map::GetInstanceType();
|
||||
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
if (!worldContext) {
|
||||
return sessionPayload;
|
||||
}
|
||||
|
||||
sessionPayload.FoesKilled = worldContext->foes_killed;
|
||||
sessionPayload.FoesToKill = worldContext->foes_to_kill;
|
||||
|
||||
const auto agentContext = GW::GetAgentContext();
|
||||
if (!agentContext) {
|
||||
return sessionPayload;
|
||||
}
|
||||
|
||||
sessionPayload.InstanceTimer = agentContext->instance_timer;
|
||||
return sessionPayload;
|
||||
}
|
||||
|
||||
std::string SessionModule::ApiUri()
|
||||
{
|
||||
return "/session";
|
||||
}
|
||||
|
||||
std::optional<uint32_t> SessionModule::GetContext(const httplib::Request& req, httplib::Response& res)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
#include "pch.h"
|
||||
#include "TitleInfoModule.h"
|
||||
#include "payloads/TitleInfoPayload.h"
|
||||
#include <DaybreakModule.h>
|
||||
#include <Utils.h>
|
||||
#include <GWCA/GameContainers/Array.h>
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/MapMgr.h>
|
||||
#include <GWCA/Managers/PlayerMgr.h>
|
||||
#include <GWCA/Constants/AgentIDs.h>
|
||||
#include <GWCA/GameEntities/Title.h>
|
||||
#include <GWCA/Context/WorldContext.h>
|
||||
#include <GWCA/Constants/Constants.h>
|
||||
#include <GWCA/Managers/UIMgr.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
std::string TitleInfoModule::ApiUri()
|
||||
{
|
||||
return "/titles/info";
|
||||
}
|
||||
|
||||
std::optional<TitleInfoPayload> TitleInfoModule::GetPayload(const uint32_t context) {
|
||||
TitleInfoPayload payload;
|
||||
if (!GW::Map::GetIsMapLoaded()) {
|
||||
return std::optional<TitleInfoPayload>();
|
||||
}
|
||||
|
||||
const auto title = GW::PlayerMgr::GetTitleTrack((GW::Constants::TitleID)context);
|
||||
if (!title) {
|
||||
return std::optional<TitleInfoPayload>();
|
||||
}
|
||||
|
||||
if (title->current_points == 0 &&
|
||||
title->current_title_tier_index == 0 &&
|
||||
title->next_title_tier_index == 0 &&
|
||||
title->max_title_rank == 0) {
|
||||
return std::optional<TitleInfoPayload>();
|
||||
}
|
||||
|
||||
const auto tierIndex = title->current_title_tier_index;
|
||||
const auto worldContext = GW::GetWorldContext();
|
||||
const auto tiers = &worldContext->title_tiers;
|
||||
const auto tier = &tiers->at(tierIndex);
|
||||
|
||||
payload.TitleId = context;
|
||||
payload.TitleTierId = tierIndex;
|
||||
payload.CurrentPoints = title->current_points;
|
||||
payload.PointsNeededNextRank = title->points_needed_next_rank;
|
||||
payload.IsPercentageBased = title->is_percentage_based();
|
||||
payload.CurrentTier = tier->tier_number;
|
||||
GW::UI::AsyncDecodeStr(tier->tier_name_enc, &this->name);
|
||||
return payload;
|
||||
}
|
||||
|
||||
bool TitleInfoModule::CanReturn(const httplib::Request& req, httplib::Response& res, const TitleInfoPayload& payload) {
|
||||
return !name.empty();
|
||||
}
|
||||
|
||||
std::tuple<std::string, std::string> TitleInfoModule::ReturnPayload(TitleInfoPayload payload) {
|
||||
payload.TitleName = Daybreak::Utils::WStringToString(name);
|
||||
return std::make_tuple(static_cast<json>(payload).dump(), "application/json");
|
||||
}
|
||||
|
||||
std::optional<uint32_t> TitleInfoModule::GetContext(const httplib::Request& req, httplib::Response& res) {
|
||||
uint32_t id = 0;
|
||||
auto it = req.params.find("id");
|
||||
if (it == req.params.end()) {
|
||||
res.status = 400;
|
||||
res.set_content("Missing id parameter", "text/plain");
|
||||
return std::optional<uint32_t>();
|
||||
}
|
||||
else {
|
||||
auto idStr = it->second;
|
||||
size_t pos = 0;
|
||||
auto result = std::stoul(idStr, &pos);
|
||||
if (pos != idStr.size()) {
|
||||
res.status = 400;
|
||||
res.set_content("Invalid id parameter", "text/plain");
|
||||
return std::optional<uint32_t>();
|
||||
}
|
||||
|
||||
id = static_cast<uint32_t>(result);
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
#include "pch.h"
|
||||
#include "UserModule.h"
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/MapMgr.h>
|
||||
#include <future>
|
||||
#include <payloads/UserPayload.h>
|
||||
#include <json.hpp>
|
||||
#include <queue>
|
||||
#include <GWCA/Context/CharContext.h>
|
||||
#include <GWCA/Context/WorldContext.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
std::optional<UserPayload> UserModule::GetPayload(const uint32_t) {
|
||||
UserPayload userPayload;
|
||||
auto charContext = GW::GetCharContext();
|
||||
auto worldContext = GW::GetWorldContext();
|
||||
if (!charContext) {
|
||||
return userPayload;
|
||||
}
|
||||
|
||||
if (!worldContext) {
|
||||
return userPayload;
|
||||
}
|
||||
|
||||
char emailStr[64];
|
||||
int result = WideCharToMultiByte(CP_UTF8, 0, charContext->player_email, -1, emailStr, sizeof(emailStr), NULL, NULL);
|
||||
if (result == 0) {
|
||||
// handle error, use GetLastError() to get more info
|
||||
}
|
||||
|
||||
userPayload.Email = emailStr;
|
||||
userPayload.CurrentKurzickPoints = worldContext->current_kurzick;
|
||||
userPayload.CurrentLuxonPoints = worldContext->current_luxon;
|
||||
userPayload.CurrentImperialPoints = worldContext->current_imperial;
|
||||
userPayload.CurrentBalthazarPoints = worldContext->current_balth;
|
||||
userPayload.CurrentSkillPoints = worldContext->current_skill_points;
|
||||
userPayload.TotalKurzickPoints = worldContext->total_earned_kurzick;
|
||||
userPayload.TotalLuxonPoints = worldContext->total_earned_luxon;
|
||||
userPayload.TotalImperialPoints = worldContext->total_earned_imperial;
|
||||
userPayload.TotalBalthazarPoints = worldContext->total_earned_balth;
|
||||
userPayload.TotalSkillPoints = worldContext->total_earned_skill_points;
|
||||
userPayload.MaxKurzickPoints = worldContext->max_kurzick;
|
||||
userPayload.MaxLuxonPoints = worldContext->max_luxon;
|
||||
userPayload.MaxImperialPoints = worldContext->max_imperial;
|
||||
userPayload.MaxBalthazarPoints = worldContext->max_balth;
|
||||
|
||||
return userPayload;
|
||||
}
|
||||
|
||||
std::string UserModule::ApiUri()
|
||||
{
|
||||
return "/user";
|
||||
}
|
||||
|
||||
std::optional<uint32_t> UserModule::GetContext(const httplib::Request& req, httplib::Response& res)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#include "pch.h"
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <windows.h>
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
|
||||
namespace Daybreak::Utils {
|
||||
std::wstring StringToWString(const std::string& str) {
|
||||
if (str.empty()) return std::wstring();
|
||||
|
||||
int size_needed = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0);
|
||||
std::wstring wstrTo(size_needed, 0);
|
||||
MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &wstrTo[0], size_needed);
|
||||
|
||||
return wstrTo;
|
||||
}
|
||||
|
||||
std::string WStringToString(const std::wstring& wstr)
|
||||
{
|
||||
if (wstr.empty()) return std::string();
|
||||
|
||||
int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
|
||||
std::string strTo(size_needed, 0);
|
||||
WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL);
|
||||
|
||||
return strTo;
|
||||
}
|
||||
|
||||
bool StringToInt(const std::string& str, int& outValue) {
|
||||
size_t pos = 0;
|
||||
unsigned long result = std::stoul(str, &pos);
|
||||
|
||||
// Ensure the entire string was processed
|
||||
if (pos != str.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
outValue = static_cast<int>(result);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#include "pch.h"
|
||||
#include "WhisperModule.h"
|
||||
#include <GWCA/Managers/GameThreadMgr.h>
|
||||
#include <GWCA/Managers/MapMgr.h>
|
||||
#include <GWCA/Managers/ChatMgr.h>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <Utils.h>
|
||||
|
||||
namespace Daybreak::Modules {
|
||||
std::optional<bool> WhisperModule::GetPayload(std::wstring message) {
|
||||
if (!GW::Map::GetIsMapLoaded()) {
|
||||
return std::optional<bool>();
|
||||
}
|
||||
|
||||
GW::Chat::WriteChat(GW::Chat::CHANNEL_WHISPER, message.c_str(), L"Daybreak", false);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string WhisperModule::ApiUri()
|
||||
{
|
||||
return "/whisper";
|
||||
}
|
||||
|
||||
std::optional<std::wstring> WhisperModule::GetContext(const httplib::Request& req, httplib::Response& res)
|
||||
{
|
||||
auto wMessage = Utils::StringToWString(req.body);
|
||||
return wMessage;
|
||||
}
|
||||
|
||||
std::tuple<std::string, std::string> WhisperModule::ReturnPayload(bool) {
|
||||
return std::make_tuple("", "text/plain");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
// dllmain.cpp : Defines the entry point for the DLL application.
|
||||
#include "pch.h"
|
||||
#include "httplib.h"
|
||||
#include <GWCA/GWCA.h>
|
||||
#include <GWCA/Utilities/Scanner.h>
|
||||
#include <GWCA/Utilities/Hook.h>
|
||||
#include <GWCA/Utilities/Hooker.h>
|
||||
#include <GWCA/Managers/RenderMgr.h>
|
||||
#include <GWCA/Managers/MemoryMgr.h>
|
||||
#include "AliveModule.h"
|
||||
#include "ProcessIdModule.h"
|
||||
#include "HttpLogger.h"
|
||||
#include "Server.h"
|
||||
#include "MapModule.h"
|
||||
#include "LoginModule.h"
|
||||
#include "PathingMetadataModule.h"
|
||||
#include "PathingModule.h"
|
||||
#include "PreGameModule.h"
|
||||
#include "InventoryModule.h"
|
||||
#include "UserModule.h"
|
||||
#include "GameModule.h"
|
||||
#include "MainPlayerModule.h"
|
||||
#include "SessionModule.h"
|
||||
#include "EntityNameModule.h"
|
||||
#include "GameStateModule.h"
|
||||
#include "ItemNameModule.h"
|
||||
#include "TitleInfoModule.h"
|
||||
#include "WhisperModule.h"
|
||||
#include "DebugModule.h"
|
||||
#include <mutex>
|
||||
|
||||
volatile bool initialized;
|
||||
volatile WNDPROC oldWndProc;
|
||||
std::mutex startupMutex;
|
||||
HMODULE dllmodule;
|
||||
HANDLE serverThread;
|
||||
static FILE* stdout_proxy;
|
||||
static FILE* stderr_proxy;
|
||||
|
||||
void Terminate()
|
||||
{
|
||||
http::server::StopServer();
|
||||
if (serverThread) {
|
||||
CloseHandle(serverThread);
|
||||
}
|
||||
|
||||
#ifdef BUILD_TYPE_DEBUG
|
||||
if (stdout_proxy)
|
||||
fclose(stdout_proxy);
|
||||
if (stderr_proxy)
|
||||
fclose(stderr_proxy);
|
||||
FreeConsole();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static DWORD WINAPI StartHttpServer(LPVOID)
|
||||
{
|
||||
// This is a new thread so you should only initialize GWCA and setup the hook on the game thread.
|
||||
// When the game thread hook is setup (i.e. SetRenderCallback), you should do the next operations
|
||||
// on the game from within the game thread.
|
||||
const auto titleInfoModule = new Daybreak::Modules::TitleInfoModule();
|
||||
const auto entityNameModule = new Daybreak::Modules::EntityNameModule();
|
||||
const auto gameModule = new Daybreak::Modules::GameModule();
|
||||
const auto gameStateModule = new Daybreak::Modules::GameStateModule();
|
||||
const auto inventoryModule = new Daybreak::Modules::InventoryModule();
|
||||
const auto itemNameModule = new Daybreak::Modules::ItemNameModule();
|
||||
const auto loginModule = new Daybreak::Modules::LoginModule();
|
||||
const auto mainPlayerModule = new Daybreak::Modules::MainPlayerModule();
|
||||
const auto mapModule = new Daybreak::Modules::MapModule();
|
||||
const auto pathingMetadataModule = new Daybreak::Modules::PathingMetadataModule();
|
||||
const auto pathingModule = new Daybreak::Modules::PathingModule();
|
||||
const auto preGameModule = new Daybreak::Modules::PreGameModule();
|
||||
const auto sessionModule = new Daybreak::Modules::SessionModule();
|
||||
const auto userModule = new Daybreak::Modules::UserModule();
|
||||
const auto whisperModule = new Daybreak::Modules::WhisperModule();
|
||||
const auto debugModule = new Daybreak::Modules::DebugModule();
|
||||
|
||||
http::server::SetLogger(http::ConsoleLogger);
|
||||
http::server::Get("/alive", http::modules::HandleAlive);
|
||||
http::server::Get("/id", http::modules::HandleProcessId);
|
||||
http::server::Get(mapModule->ApiUri(), [&mapModule](const httplib::Request& req, httplib::Response& res) { mapModule->HandleApiCall(req, res); });
|
||||
http::server::Get(loginModule->ApiUri(), [&loginModule](const httplib::Request& req, httplib::Response& res) { loginModule->HandleApiCall(req, res); });
|
||||
http::server::Get(pathingMetadataModule->ApiUri(), [&pathingMetadataModule](const httplib::Request& req, httplib::Response& res) { pathingMetadataModule->HandleApiCall(req, res); });
|
||||
http::server::Get(pathingModule->ApiUri(), [&pathingModule](const httplib::Request& req, httplib::Response& res) { pathingModule->HandleApiCall(req, res); });
|
||||
http::server::Get(preGameModule->ApiUri(), [&preGameModule](const httplib::Request& req, httplib::Response& res) { preGameModule->HandleApiCall(req, res); });
|
||||
http::server::Get(userModule->ApiUri(), [&userModule](const httplib::Request& req, httplib::Response& res) { userModule->HandleApiCall(req, res); });
|
||||
http::server::Get(gameModule->ApiUri(), [&gameModule](const httplib::Request& req, httplib::Response& res) { gameModule->HandleApiCall(req, res); });
|
||||
http::server::Get(inventoryModule->ApiUri(), [&inventoryModule](const httplib::Request& req, httplib::Response& res) { inventoryModule->HandleApiCall(req, res); });
|
||||
http::server::Get(mainPlayerModule->ApiUri(), [&mainPlayerModule](const httplib::Request& req, httplib::Response& res) { mainPlayerModule->HandleApiCall(req, res); });
|
||||
http::server::Get(gameStateModule->ApiUri(), [&gameStateModule](const httplib::Request& req, httplib::Response& res) { gameStateModule->HandleApiCall(req, res); });
|
||||
http::server::Get(sessionModule->ApiUri(), [&sessionModule](const httplib::Request& req, httplib::Response& res) { sessionModule->HandleApiCall(req, res); });
|
||||
http::server::Get(entityNameModule->ApiUri(), [&entityNameModule](const httplib::Request& req, httplib::Response& res) { entityNameModule->HandleApiCall(req, res); });
|
||||
http::server::Get(itemNameModule->ApiUri(), [&itemNameModule](const httplib::Request& req, httplib::Response& res) { itemNameModule->HandleApiCall(req, res); });
|
||||
http::server::Get(titleInfoModule->ApiUri(), [&titleInfoModule](const httplib::Request& req, httplib::Response& res) { titleInfoModule->HandleApiCall(req, res); });
|
||||
http::server::Post(whisperModule->ApiUri(), [&whisperModule](const httplib::Request& req, httplib::Response& res) { whisperModule->HandleApiCall(req, res); });
|
||||
http::server::Get(debugModule->ApiUri(), [&debugModule](const httplib::Request& req, httplib::Response& res) { debugModule->HandleApiCall(req, res); });
|
||||
http::server::StartServer();
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WndProc(const HWND hWnd, const UINT Message, const WPARAM wParam, const LPARAM lParam) {
|
||||
if (Message == WM_CLOSE || (Message == WM_SYSCOMMAND && wParam == SC_CLOSE)) {
|
||||
Terminate();
|
||||
}
|
||||
|
||||
return CallWindowProc(oldWndProc, hWnd, Message, wParam, lParam);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK SafeWndProc(const HWND hWnd, const UINT Message, const WPARAM wParam, const LPARAM lParam) noexcept
|
||||
{
|
||||
__try {
|
||||
return WndProc(hWnd, Message, wParam, lParam);
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER) {
|
||||
return CallWindowProc(oldWndProc, hWnd, Message, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
||||
void OnWindowCreated(IDirect3DDevice9*) {
|
||||
startupMutex.lock();
|
||||
if (initialized) {
|
||||
startupMutex.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef BUILD_TYPE_DEBUG
|
||||
AllocConsole();
|
||||
SetConsoleTitleA("Daybreak.GWCA Console");
|
||||
freopen_s(&stdout_proxy, "CONOUT$", "w", stdout);
|
||||
freopen_s(&stderr_proxy, "CONOUT$", "w", stderr);
|
||||
#endif
|
||||
auto handle = GW::MemoryMgr::GetGWWindowHandle();
|
||||
oldWndProc = reinterpret_cast<WNDPROC>(SetWindowLongPtrW(handle, GWL_WNDPROC, reinterpret_cast<LONG>(SafeWndProc)));
|
||||
serverThread = CreateThread(
|
||||
NULL,
|
||||
0,
|
||||
StartHttpServer,
|
||||
NULL,
|
||||
0,
|
||||
NULL);
|
||||
startupMutex.unlock();
|
||||
initialized = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static DWORD WINAPI Init(LPVOID)
|
||||
{
|
||||
printf("Init: Setting up scanner\n");
|
||||
GW::Scanner::Initialize();
|
||||
printf("Init: Setting up hook base\n");
|
||||
GW::HookBase::Initialize();
|
||||
printf("Init: Setting up GWCA\n");
|
||||
if (!GW::Initialize()) {
|
||||
printf("Init: Failed to set up GWCA\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("Init: Enabling hooks\n");
|
||||
GW::HookBase::EnableHooks();
|
||||
printf("Init: Set up render callback\n");
|
||||
GW::Render::SetRenderCallback(OnWindowCreated);
|
||||
printf("Init: Returning success\n");
|
||||
FreeLibraryAndExitThread(dllmodule, EXIT_SUCCESS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// DLL entry point, dont do things in this thread unless you know what you are doing.
|
||||
BOOL APIENTRY DllMain(HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
DisableThreadLibraryCalls(hModule);
|
||||
|
||||
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
|
||||
HANDLE handle = CreateThread(0, 0, Init, hModule, 0, 0);
|
||||
CloseHandle(handle);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#include <cstdint>
|
||||
#include <payloads/Attribute.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
void to_json(json& j, const Attribute& p) {
|
||||
j = json
|
||||
{
|
||||
{"Id", p.Id},
|
||||
{"BaseLevel", p.BaseLevel},
|
||||
{"ActualLevel", p.ActualLevel},
|
||||
{"DecrementPoints", p.DecrementPoints},
|
||||
{"IncrementPoints", p.IncrementPoints},
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <payloads/BagContent.h>
|
||||
#include <payloads/Bag.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
void to_json(json& j, const Bag& p) {
|
||||
j = json
|
||||
{
|
||||
{"Items", p.Items},
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <payloads/BagContent.h>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
void to_json(json& j, const BagContent& p) {
|
||||
j = json
|
||||
{
|
||||
{"Id", p.Id},
|
||||
{"Slot", p.Slot},
|
||||
{"Count", p.Count},
|
||||
{"Modifiers", p.Modifiers},
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
#include <payloads/Build.h>
|
||||
#include <payloads/Attribute.h>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
void to_json(json& j, const Build& p) {
|
||||
j = json
|
||||
{
|
||||
{"Primary", p.Primary},
|
||||
{"Secondary", p.Secondary},
|
||||
{"Attributes", p.Attributes},
|
||||
{"Skills", p.Skills}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include <payloads/Camera.h>
|
||||
#include <cstdint>
|
||||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
void to_json(json& j, const Camera& p) {
|
||||
j = json
|
||||
{
|
||||
{"Yaw", p.Yaw},
|
||||
{"Pitch", p.Pitch}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#include <cstdint>
|
||||
#include <json.hpp>
|
||||
#include <payloads/DebugPayload.h>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
void to_json(json& j, const DebugPayload& p) {
|
||||
j = json
|
||||
{
|
||||
{"GameContextAddress", p.GameContextAddress},
|
||||
{"WorldContextAddress", p.WorldContextAddress},
|
||||
{"MapContextAddress", p.MapContextAddress},
|
||||
{"AgentContextAddress", p.AgentContextAddress},
|
||||
{"CharContextAddress", p.CharContextAddress},
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#include <cstdint>
|
||||
#include <GWCA/GameEntities/Map.h>
|
||||
#include <json.hpp>
|
||||
#include <payloads/MainPlayer.h>
|
||||
#include <payloads/MapIcon.h>
|
||||
#include <payloads/GamePayload.h>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
void to_json(json& j, const GamePayload& p) {
|
||||
j = json
|
||||
{
|
||||
{"MainPlayer", p.MainPlayer},
|
||||
{"Party", p.Party},
|
||||
{"WorldPlayers", p.WorldPlayers},
|
||||
{"LivingEntities", p.LivingEntities},
|
||||
{"MapIcons", p.MapIcons},
|
||||
{"TargetId", p.TargetId},
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#include <cstdint>
|
||||
#include <json.hpp>
|
||||
#include <payloads/GameStatePayload.h>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Daybreak {
|
||||
void to_json(json& j, const GameStatePayload& p) {
|
||||
j = json
|
||||
{
|
||||
{"Camera", p.Camera},
|
||||
{"States", p.States},
|
||||
};
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user