Implements dataloading

This commit is contained in:
Deukhoofd 2024-08-18 14:22:50 +02:00
parent 488c717c5a
commit d48889e21a
36 changed files with 105526 additions and 15 deletions

616
.editorconfig Normal file
View File

@ -0,0 +1,616 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 120
tab_width = 4
trim_trailing_whitespace = false
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = true
ij_smart_tabs = false
ij_visual_guides =
ij_wrap_on_typing = false
[*.css]
ij_css_align_closing_brace_with_properties = false
ij_css_blank_lines_around_nested_selector = 1
ij_css_blank_lines_between_blocks = 1
ij_css_block_comment_add_space = false
ij_css_brace_placement = end_of_line
ij_css_enforce_quotes_on_format = false
ij_css_hex_color_long_format = false
ij_css_hex_color_lower_case = false
ij_css_hex_color_short_format = false
ij_css_hex_color_upper_case = false
ij_css_keep_blank_lines_in_code = 2
ij_css_keep_indents_on_empty_lines = false
ij_css_keep_single_line_blocks = false
ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_css_space_after_colon = true
ij_css_space_before_opening_brace = true
ij_css_use_double_quotes = true
ij_css_value_alignment = do_not_align
[*.less]
indent_size = 2
ij_less_align_closing_brace_with_properties = false
ij_less_blank_lines_around_nested_selector = 1
ij_less_blank_lines_between_blocks = 1
ij_less_block_comment_add_space = false
ij_less_brace_placement = 0
ij_less_enforce_quotes_on_format = false
ij_less_hex_color_long_format = false
ij_less_hex_color_lower_case = false
ij_less_hex_color_short_format = false
ij_less_hex_color_upper_case = false
ij_less_keep_blank_lines_in_code = 2
ij_less_keep_indents_on_empty_lines = false
ij_less_keep_single_line_blocks = false
ij_less_line_comment_add_space = false
ij_less_line_comment_at_first_column = false
ij_less_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_less_space_after_colon = true
ij_less_space_before_opening_brace = true
ij_less_use_double_quotes = true
ij_less_value_alignment = 0
[*.properties]
ij_properties_align_group_field_declarations = false
ij_properties_keep_blank_lines = false
ij_properties_key_value_delimiter = equals
ij_properties_spaces_around_key_value_delimiter = false
[*.proto]
indent_size = 2
tab_width = 2
ij_continuation_indent_size = 4
ij_protobuf_keep_blank_lines_in_code = 2
ij_protobuf_keep_indents_on_empty_lines = false
ij_protobuf_keep_line_breaks = true
ij_protobuf_space_after_comma = true
ij_protobuf_space_before_comma = false
ij_protobuf_spaces_around_assignment_operators = true
ij_protobuf_spaces_within_braces = false
ij_protobuf_spaces_within_brackets = false
[*.sass]
indent_size = 2
ij_sass_align_closing_brace_with_properties = false
ij_sass_blank_lines_around_nested_selector = 1
ij_sass_blank_lines_between_blocks = 1
ij_sass_brace_placement = 0
ij_sass_enforce_quotes_on_format = false
ij_sass_hex_color_long_format = false
ij_sass_hex_color_lower_case = false
ij_sass_hex_color_short_format = false
ij_sass_hex_color_upper_case = false
ij_sass_keep_blank_lines_in_code = 2
ij_sass_keep_indents_on_empty_lines = false
ij_sass_keep_single_line_blocks = false
ij_sass_line_comment_add_space = false
ij_sass_line_comment_at_first_column = false
ij_sass_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_sass_space_after_colon = true
ij_sass_space_before_opening_brace = true
ij_sass_use_double_quotes = true
ij_sass_value_alignment = 0
[*.scss]
indent_size = 2
ij_scss_align_closing_brace_with_properties = false
ij_scss_blank_lines_around_nested_selector = 1
ij_scss_blank_lines_between_blocks = 1
ij_scss_block_comment_add_space = false
ij_scss_brace_placement = 0
ij_scss_enforce_quotes_on_format = false
ij_scss_hex_color_long_format = false
ij_scss_hex_color_lower_case = false
ij_scss_hex_color_short_format = false
ij_scss_hex_color_upper_case = false
ij_scss_keep_blank_lines_in_code = 2
ij_scss_keep_indents_on_empty_lines = false
ij_scss_keep_single_line_blocks = false
ij_scss_line_comment_add_space = false
ij_scss_line_comment_at_first_column = false
ij_scss_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_scss_space_after_colon = true
ij_scss_space_before_opening_brace = true
ij_scss_use_double_quotes = true
ij_scss_value_alignment = 0
[*.vue]
indent_size = 2
tab_width = 2
ij_continuation_indent_size = 4
ij_vue_indent_children_of_top_level = template
ij_vue_interpolation_new_line_after_start_delimiter = true
ij_vue_interpolation_new_line_before_end_delimiter = true
ij_vue_interpolation_wrap = off
ij_vue_keep_indents_on_empty_lines = false
ij_vue_spaces_within_interpolation_expressions = true
[.editorconfig]
ij_editorconfig_align_group_field_declarations = false
ij_editorconfig_space_after_colon = false
ij_editorconfig_space_after_comma = true
ij_editorconfig_space_before_colon = false
ij_editorconfig_space_before_comma = false
ij_editorconfig_spaces_around_assignment_operators = true
[{*.ant,*.appxmanifest,*.axml,*.cscfg,*.csdef,*.disco,*.dotsettings,*.filelayout,*.fxml,*.jhm,*.jnlp,*.jrxml,*.manifest,*.myapp,*.nuspec,*.rng,*.stylecop,*.svcmap,*.tld,*.wadcfgx,*.webref,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul,StyleCop.Cache}]
ij_xml_align_attributes = true
ij_xml_align_text = false
ij_xml_attribute_wrap = normal
ij_xml_block_comment_add_space = false
ij_xml_block_comment_at_first_column = true
ij_xml_keep_blank_lines = 2
ij_xml_keep_indents_on_empty_lines = false
ij_xml_keep_line_breaks = true
ij_xml_keep_line_breaks_in_text = true
ij_xml_keep_whitespaces = false
ij_xml_keep_whitespaces_around_cdata = preserve
ij_xml_keep_whitespaces_inside_cdata = false
ij_xml_line_comment_at_first_column = true
ij_xml_space_after_tag_name = false
ij_xml_space_around_equals_in_attribute = false
ij_xml_space_inside_empty_tag = false
ij_xml_text_wrap = normal
[{*.ats,*.cts,*.mts,*.ts}]
ij_continuation_indent_size = 4
ij_typescript_align_imports = false
ij_typescript_align_multiline_array_initializer_expression = false
ij_typescript_align_multiline_binary_operation = false
ij_typescript_align_multiline_chained_methods = false
ij_typescript_align_multiline_extends_list = false
ij_typescript_align_multiline_for = true
ij_typescript_align_multiline_parameters = true
ij_typescript_align_multiline_parameters_in_calls = false
ij_typescript_align_multiline_ternary_operation = false
ij_typescript_align_object_properties = 0
ij_typescript_align_union_types = false
ij_typescript_align_var_statements = 0
ij_typescript_array_initializer_new_line_after_left_brace = false
ij_typescript_array_initializer_right_brace_on_new_line = false
ij_typescript_array_initializer_wrap = off
ij_typescript_assignment_wrap = off
ij_typescript_binary_operation_sign_on_next_line = false
ij_typescript_binary_operation_wrap = off
ij_typescript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/**
ij_typescript_blank_lines_after_imports = 1
ij_typescript_blank_lines_around_class = 1
ij_typescript_blank_lines_around_field = 0
ij_typescript_blank_lines_around_field_in_interface = 0
ij_typescript_blank_lines_around_function = 1
ij_typescript_blank_lines_around_method = 1
ij_typescript_blank_lines_around_method_in_interface = 1
ij_typescript_block_brace_style = end_of_line
ij_typescript_block_comment_add_space = false
ij_typescript_block_comment_at_first_column = true
ij_typescript_call_parameters_new_line_after_left_paren = false
ij_typescript_call_parameters_right_paren_on_new_line = false
ij_typescript_call_parameters_wrap = off
ij_typescript_catch_on_new_line = false
ij_typescript_chained_call_dot_on_new_line = true
ij_typescript_class_brace_style = end_of_line
ij_typescript_comma_on_new_line = false
ij_typescript_do_while_brace_force = never
ij_typescript_else_on_new_line = false
ij_typescript_enforce_trailing_comma = keep
ij_typescript_enum_constants_wrap = on_every_item
ij_typescript_extends_keyword_wrap = off
ij_typescript_extends_list_wrap = off
ij_typescript_field_prefix = _
ij_typescript_file_name_style = relaxed
ij_typescript_finally_on_new_line = false
ij_typescript_for_brace_force = never
ij_typescript_for_statement_new_line_after_left_paren = false
ij_typescript_for_statement_right_paren_on_new_line = false
ij_typescript_for_statement_wrap = off
ij_typescript_force_quote_style = false
ij_typescript_force_semicolon_style = false
ij_typescript_function_expression_brace_style = end_of_line
ij_typescript_if_brace_force = never
ij_typescript_import_merge_members = global
ij_typescript_import_prefer_absolute_path = global
ij_typescript_import_sort_members = true
ij_typescript_import_sort_module_name = false
ij_typescript_import_use_node_resolution = true
ij_typescript_imports_wrap = on_every_item
ij_typescript_indent_case_from_switch = true
ij_typescript_indent_chained_calls = true
ij_typescript_indent_package_children = 0
ij_typescript_jsdoc_include_types = false
ij_typescript_jsx_attribute_value = braces
ij_typescript_keep_blank_lines_in_code = 2
ij_typescript_keep_first_column_comment = true
ij_typescript_keep_indents_on_empty_lines = false
ij_typescript_keep_line_breaks = true
ij_typescript_keep_simple_blocks_in_one_line = false
ij_typescript_keep_simple_methods_in_one_line = false
ij_typescript_line_comment_add_space = true
ij_typescript_line_comment_at_first_column = false
ij_typescript_method_brace_style = end_of_line
ij_typescript_method_call_chain_wrap = off
ij_typescript_method_parameters_new_line_after_left_paren = false
ij_typescript_method_parameters_right_paren_on_new_line = false
ij_typescript_method_parameters_wrap = off
ij_typescript_object_literal_wrap = on_every_item
ij_typescript_object_types_wrap = on_every_item
ij_typescript_parentheses_expression_new_line_after_left_paren = false
ij_typescript_parentheses_expression_right_paren_on_new_line = false
ij_typescript_place_assignment_sign_on_next_line = false
ij_typescript_prefer_as_type_cast = false
ij_typescript_prefer_explicit_types_function_expression_returns = false
ij_typescript_prefer_explicit_types_function_returns = false
ij_typescript_prefer_explicit_types_vars_fields = false
ij_typescript_prefer_parameters_wrap = false
ij_typescript_property_prefix =
ij_typescript_reformat_c_style_comments = false
ij_typescript_space_after_colon = true
ij_typescript_space_after_comma = true
ij_typescript_space_after_dots_in_rest_parameter = false
ij_typescript_space_after_generator_mult = true
ij_typescript_space_after_property_colon = true
ij_typescript_space_after_quest = true
ij_typescript_space_after_type_colon = true
ij_typescript_space_after_unary_not = false
ij_typescript_space_before_async_arrow_lparen = true
ij_typescript_space_before_catch_keyword = true
ij_typescript_space_before_catch_left_brace = true
ij_typescript_space_before_catch_parentheses = true
ij_typescript_space_before_class_lbrace = true
ij_typescript_space_before_class_left_brace = true
ij_typescript_space_before_colon = true
ij_typescript_space_before_comma = false
ij_typescript_space_before_do_left_brace = true
ij_typescript_space_before_else_keyword = true
ij_typescript_space_before_else_left_brace = true
ij_typescript_space_before_finally_keyword = true
ij_typescript_space_before_finally_left_brace = true
ij_typescript_space_before_for_left_brace = true
ij_typescript_space_before_for_parentheses = true
ij_typescript_space_before_for_semicolon = false
ij_typescript_space_before_function_left_parenth = true
ij_typescript_space_before_generator_mult = false
ij_typescript_space_before_if_left_brace = true
ij_typescript_space_before_if_parentheses = true
ij_typescript_space_before_method_call_parentheses = false
ij_typescript_space_before_method_left_brace = true
ij_typescript_space_before_method_parentheses = false
ij_typescript_space_before_property_colon = false
ij_typescript_space_before_quest = true
ij_typescript_space_before_switch_left_brace = true
ij_typescript_space_before_switch_parentheses = true
ij_typescript_space_before_try_left_brace = true
ij_typescript_space_before_type_colon = false
ij_typescript_space_before_unary_not = false
ij_typescript_space_before_while_keyword = true
ij_typescript_space_before_while_left_brace = true
ij_typescript_space_before_while_parentheses = true
ij_typescript_spaces_around_additive_operators = true
ij_typescript_spaces_around_arrow_function_operator = true
ij_typescript_spaces_around_assignment_operators = true
ij_typescript_spaces_around_bitwise_operators = true
ij_typescript_spaces_around_equality_operators = true
ij_typescript_spaces_around_logical_operators = true
ij_typescript_spaces_around_multiplicative_operators = true
ij_typescript_spaces_around_relational_operators = true
ij_typescript_spaces_around_shift_operators = true
ij_typescript_spaces_around_unary_operator = false
ij_typescript_spaces_within_array_initializer_brackets = false
ij_typescript_spaces_within_brackets = false
ij_typescript_spaces_within_catch_parentheses = false
ij_typescript_spaces_within_for_parentheses = false
ij_typescript_spaces_within_if_parentheses = false
ij_typescript_spaces_within_imports = false
ij_typescript_spaces_within_interpolation_expressions = false
ij_typescript_spaces_within_method_call_parentheses = false
ij_typescript_spaces_within_method_parentheses = false
ij_typescript_spaces_within_object_literal_braces = false
ij_typescript_spaces_within_object_type_braces = true
ij_typescript_spaces_within_parentheses = false
ij_typescript_spaces_within_switch_parentheses = false
ij_typescript_spaces_within_type_assertion = false
ij_typescript_spaces_within_union_types = true
ij_typescript_spaces_within_while_parentheses = false
ij_typescript_special_else_if_treatment = true
ij_typescript_ternary_operation_signs_on_next_line = false
ij_typescript_ternary_operation_wrap = off
ij_typescript_union_types_wrap = on_every_item
ij_typescript_use_chained_calls_group_indents = false
ij_typescript_use_double_quotes = true
ij_typescript_use_explicit_js_extension = auto
ij_typescript_use_import_type = auto
ij_typescript_use_path_mapping = always
ij_typescript_use_public_modifier = false
ij_typescript_use_semicolon_after_statement = true
ij_typescript_var_declaration_wrap = normal
ij_typescript_while_brace_force = never
ij_typescript_while_on_new_line = false
ij_typescript_wrap_comments = false
[{*.bash,*.sh,*.zsh}]
indent_size = 2
tab_width = 2
ij_shell_binary_ops_start_line = false
ij_shell_keep_column_alignment_padding = false
ij_shell_minify_program = false
ij_shell_redirect_followed_by_space = false
ij_shell_switch_cases_indented = false
ij_shell_use_unix_line_separator = true
[{*.cjs,*.js}]
ij_continuation_indent_size = 4
ij_javascript_align_imports = false
ij_javascript_align_multiline_array_initializer_expression = false
ij_javascript_align_multiline_binary_operation = false
ij_javascript_align_multiline_chained_methods = false
ij_javascript_align_multiline_extends_list = false
ij_javascript_align_multiline_for = true
ij_javascript_align_multiline_parameters = true
ij_javascript_align_multiline_parameters_in_calls = false
ij_javascript_align_multiline_ternary_operation = false
ij_javascript_align_object_properties = 0
ij_javascript_align_union_types = false
ij_javascript_align_var_statements = 0
ij_javascript_array_initializer_new_line_after_left_brace = false
ij_javascript_array_initializer_right_brace_on_new_line = false
ij_javascript_array_initializer_wrap = off
ij_javascript_assignment_wrap = off
ij_javascript_binary_operation_sign_on_next_line = false
ij_javascript_binary_operation_wrap = off
ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/**
ij_javascript_blank_lines_after_imports = 1
ij_javascript_blank_lines_around_class = 1
ij_javascript_blank_lines_around_field = 0
ij_javascript_blank_lines_around_function = 1
ij_javascript_blank_lines_around_method = 1
ij_javascript_block_brace_style = end_of_line
ij_javascript_block_comment_add_space = false
ij_javascript_block_comment_at_first_column = true
ij_javascript_call_parameters_new_line_after_left_paren = false
ij_javascript_call_parameters_right_paren_on_new_line = false
ij_javascript_call_parameters_wrap = off
ij_javascript_catch_on_new_line = false
ij_javascript_chained_call_dot_on_new_line = true
ij_javascript_class_brace_style = end_of_line
ij_javascript_comma_on_new_line = false
ij_javascript_do_while_brace_force = never
ij_javascript_else_on_new_line = false
ij_javascript_enforce_trailing_comma = keep
ij_javascript_extends_keyword_wrap = off
ij_javascript_extends_list_wrap = off
ij_javascript_field_prefix = _
ij_javascript_file_name_style = relaxed
ij_javascript_finally_on_new_line = false
ij_javascript_for_brace_force = never
ij_javascript_for_statement_new_line_after_left_paren = false
ij_javascript_for_statement_right_paren_on_new_line = false
ij_javascript_for_statement_wrap = off
ij_javascript_force_quote_style = false
ij_javascript_force_semicolon_style = false
ij_javascript_function_expression_brace_style = end_of_line
ij_javascript_if_brace_force = never
ij_javascript_import_merge_members = global
ij_javascript_import_prefer_absolute_path = global
ij_javascript_import_sort_members = true
ij_javascript_import_sort_module_name = false
ij_javascript_import_use_node_resolution = true
ij_javascript_imports_wrap = on_every_item
ij_javascript_indent_case_from_switch = true
ij_javascript_indent_chained_calls = true
ij_javascript_indent_package_children = 0
ij_javascript_jsx_attribute_value = braces
ij_javascript_keep_blank_lines_in_code = 2
ij_javascript_keep_first_column_comment = true
ij_javascript_keep_indents_on_empty_lines = false
ij_javascript_keep_line_breaks = true
ij_javascript_keep_simple_blocks_in_one_line = false
ij_javascript_keep_simple_methods_in_one_line = false
ij_javascript_line_comment_add_space = true
ij_javascript_line_comment_at_first_column = false
ij_javascript_method_brace_style = end_of_line
ij_javascript_method_call_chain_wrap = off
ij_javascript_method_parameters_new_line_after_left_paren = false
ij_javascript_method_parameters_right_paren_on_new_line = false
ij_javascript_method_parameters_wrap = off
ij_javascript_object_literal_wrap = on_every_item
ij_javascript_object_types_wrap = on_every_item
ij_javascript_parentheses_expression_new_line_after_left_paren = false
ij_javascript_parentheses_expression_right_paren_on_new_line = false
ij_javascript_place_assignment_sign_on_next_line = false
ij_javascript_prefer_as_type_cast = false
ij_javascript_prefer_explicit_types_function_expression_returns = false
ij_javascript_prefer_explicit_types_function_returns = false
ij_javascript_prefer_explicit_types_vars_fields = false
ij_javascript_prefer_parameters_wrap = false
ij_javascript_property_prefix =
ij_javascript_reformat_c_style_comments = false
ij_javascript_space_after_colon = true
ij_javascript_space_after_comma = true
ij_javascript_space_after_dots_in_rest_parameter = false
ij_javascript_space_after_generator_mult = true
ij_javascript_space_after_property_colon = true
ij_javascript_space_after_quest = true
ij_javascript_space_after_type_colon = true
ij_javascript_space_after_unary_not = false
ij_javascript_space_before_async_arrow_lparen = true
ij_javascript_space_before_catch_keyword = true
ij_javascript_space_before_catch_left_brace = true
ij_javascript_space_before_catch_parentheses = true
ij_javascript_space_before_class_lbrace = true
ij_javascript_space_before_class_left_brace = true
ij_javascript_space_before_colon = true
ij_javascript_space_before_comma = false
ij_javascript_space_before_do_left_brace = true
ij_javascript_space_before_else_keyword = true
ij_javascript_space_before_else_left_brace = true
ij_javascript_space_before_finally_keyword = true
ij_javascript_space_before_finally_left_brace = true
ij_javascript_space_before_for_left_brace = true
ij_javascript_space_before_for_parentheses = true
ij_javascript_space_before_for_semicolon = false
ij_javascript_space_before_function_left_parenth = true
ij_javascript_space_before_generator_mult = false
ij_javascript_space_before_if_left_brace = true
ij_javascript_space_before_if_parentheses = true
ij_javascript_space_before_method_call_parentheses = false
ij_javascript_space_before_method_left_brace = true
ij_javascript_space_before_method_parentheses = false
ij_javascript_space_before_property_colon = false
ij_javascript_space_before_quest = true
ij_javascript_space_before_switch_left_brace = true
ij_javascript_space_before_switch_parentheses = true
ij_javascript_space_before_try_left_brace = true
ij_javascript_space_before_type_colon = false
ij_javascript_space_before_unary_not = false
ij_javascript_space_before_while_keyword = true
ij_javascript_space_before_while_left_brace = true
ij_javascript_space_before_while_parentheses = true
ij_javascript_spaces_around_additive_operators = true
ij_javascript_spaces_around_arrow_function_operator = true
ij_javascript_spaces_around_assignment_operators = true
ij_javascript_spaces_around_bitwise_operators = true
ij_javascript_spaces_around_equality_operators = true
ij_javascript_spaces_around_logical_operators = true
ij_javascript_spaces_around_multiplicative_operators = true
ij_javascript_spaces_around_relational_operators = true
ij_javascript_spaces_around_shift_operators = true
ij_javascript_spaces_around_unary_operator = false
ij_javascript_spaces_within_array_initializer_brackets = false
ij_javascript_spaces_within_brackets = false
ij_javascript_spaces_within_catch_parentheses = false
ij_javascript_spaces_within_for_parentheses = false
ij_javascript_spaces_within_if_parentheses = false
ij_javascript_spaces_within_imports = false
ij_javascript_spaces_within_interpolation_expressions = false
ij_javascript_spaces_within_method_call_parentheses = false
ij_javascript_spaces_within_method_parentheses = false
ij_javascript_spaces_within_object_literal_braces = false
ij_javascript_spaces_within_object_type_braces = true
ij_javascript_spaces_within_parentheses = false
ij_javascript_spaces_within_switch_parentheses = false
ij_javascript_spaces_within_type_assertion = false
ij_javascript_spaces_within_union_types = true
ij_javascript_spaces_within_while_parentheses = false
ij_javascript_special_else_if_treatment = true
ij_javascript_ternary_operation_signs_on_next_line = false
ij_javascript_ternary_operation_wrap = off
ij_javascript_union_types_wrap = on_every_item
ij_javascript_use_chained_calls_group_indents = false
ij_javascript_use_double_quotes = true
ij_javascript_use_explicit_js_extension = auto
ij_javascript_use_import_type = auto
ij_javascript_use_path_mapping = always
ij_javascript_use_public_modifier = false
ij_javascript_use_semicolon_after_statement = true
ij_javascript_var_declaration_wrap = normal
ij_javascript_while_brace_force = never
ij_javascript_while_on_new_line = false
ij_javascript_wrap_comments = false
[{*.har,*.jsb2,*.jsb3,*.json,*.jsonc,*.postman_collection,*.postman_collection.json,*.postman_environment,*.postman_environment.json,.babelrc,.eslintrc,.prettierrc,.stylelintrc,.ws-context,jest.config}]
indent_size = 2
ij_json_array_wrapping = split_into_lines
ij_json_keep_blank_lines_in_code = 0
ij_json_keep_indents_on_empty_lines = false
ij_json_keep_line_breaks = true
ij_json_keep_trailing_comma = false
ij_json_object_wrapping = split_into_lines
ij_json_property_alignment = do_not_align
ij_json_space_after_colon = true
ij_json_space_after_comma = true
ij_json_space_before_colon = false
ij_json_space_before_comma = false
ij_json_spaces_within_braces = false
ij_json_spaces_within_brackets = false
ij_json_wrap_long_lines = false
[{*.htm,*.html,*.sht,*.shtm,*.shtml}]
ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3
ij_html_align_attributes = true
ij_html_align_text = false
ij_html_attribute_wrap = normal
ij_html_block_comment_add_space = false
ij_html_block_comment_at_first_column = true
ij_html_do_not_align_children_of_min_lines = 0
ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p
ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot
ij_html_enforce_quotes = false
ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var
ij_html_keep_blank_lines = 2
ij_html_keep_indents_on_empty_lines = false
ij_html_keep_line_breaks = true
ij_html_keep_line_breaks_in_text = true
ij_html_keep_whitespaces = false
ij_html_keep_whitespaces_inside = span,pre,textarea
ij_html_line_comment_at_first_column = true
ij_html_new_line_after_last_attribute = never
ij_html_new_line_before_first_attribute = never
ij_html_quote_style = double
ij_html_remove_new_line_before_tags = br
ij_html_space_after_tag_name = false
ij_html_space_around_equality_in_attribute = false
ij_html_space_inside_empty_tag = false
ij_html_text_wrap = normal
[{*.http,*.rest}]
indent_size = 0
ij_continuation_indent_size = 4
ij_http-request_call_parameters_wrap = normal
ij_http-request_method_parameters_wrap = split_into_lines
ij_http-request_space_before_comma = true
ij_http-request_spaces_around_assignment_operators = true
[{*.markdown,*.md}]
ij_markdown_force_one_space_after_blockquote_symbol = true
ij_markdown_force_one_space_after_header_symbol = true
ij_markdown_force_one_space_after_list_bullet = true
ij_markdown_force_one_space_between_words = true
ij_markdown_format_tables = true
ij_markdown_insert_quote_arrows_on_wrap = true
ij_markdown_keep_indents_on_empty_lines = false
ij_markdown_keep_line_breaks_inside_text_blocks = true
ij_markdown_max_lines_around_block_elements = 1
ij_markdown_max_lines_around_header = 1
ij_markdown_max_lines_between_paragraphs = 1
ij_markdown_min_lines_around_block_elements = 1
ij_markdown_min_lines_around_header = 1
ij_markdown_min_lines_between_paragraphs = 1
ij_markdown_wrap_text_if_long = true
ij_markdown_wrap_text_inside_blockquotes = true
[{*.pb,*.textproto,*.txtpb}]
indent_size = 2
tab_width = 2
ij_continuation_indent_size = 4
ij_prototext_keep_blank_lines_in_code = 2
ij_prototext_keep_indents_on_empty_lines = false
ij_prototext_keep_line_breaks = true
ij_prototext_space_after_colon = true
ij_prototext_space_after_comma = true
ij_prototext_space_before_colon = false
ij_prototext_space_before_comma = false
ij_prototext_spaces_within_braces = true
ij_prototext_spaces_within_brackets = false
[{*.yaml,*.yml}]
indent_size = 2
ij_yaml_align_values_properties = do_not_align
ij_yaml_autoinsert_sequence_marker = true
ij_yaml_block_mapping_on_new_line = false
ij_yaml_indent_sequence_value = true
ij_yaml_keep_indents_on_empty_lines = false
ij_yaml_keep_line_breaks = true
ij_yaml_line_comment_add_space = false
ij_yaml_line_comment_add_space_on_reformat = false
ij_yaml_line_comment_at_first_column = true
ij_yaml_sequence_on_new_line = false
ij_yaml_space_before_colon = false
ij_yaml_spaces_within_braces = true
ij_yaml_spaces_within_brackets = true

View File

@ -0,0 +1,52 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Nodes;
using PkmnLib.Dataloader.Models;
using PkmnLib.Static.Libraries;
using PkmnLib.Static.Species;
using PkmnLib.Static.Utils;
namespace PkmnLib.Dataloader;
public static class AbilityDataLoader
{
public static AbilityLibrary LoadAbilities(Stream stream)
{
var library = new AbilityLibrary();
var obj = JsonSerializer.Deserialize<JsonObject>(stream);
if (obj == null)
throw new InvalidDataException("Ability data is empty.");
obj.Remove("$schema");
var cleanedString = obj.ToJsonString();
var objects = JsonSerializer.Deserialize<Dictionary<string, SerializedAbility>>(cleanedString,
new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = true,
});
if (objects == null)
throw new InvalidDataException("Ability data is empty.");
var abilities = objects.Select(x => DeserializeAbility(x.Key, x.Value));
foreach (var a in abilities)
library.Add(a);
return library;
}
private static AbilityImpl DeserializeAbility(string name, SerializedAbility serialized)
{
var effect = serialized.Effect;
var parameters = serialized.Parameters.ToDictionary(x => (StringKey)x.Key, x => x.Value.ToParameter());
StringKey? effectName;
if (effect == null)
effectName = null;
else
effectName = new StringKey(effect);
var ability = new AbilityImpl(name, effectName, parameters);
return ability;
}
}

View File

@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
using PkmnLib.Static;
using PkmnLib.Static.Libraries;
namespace PkmnLib.Dataloader;
public static class GrowthRateDataLoader
{
public static GrowthRateLibrary LoadGrowthRates(Stream stream)
{
var objects = JsonSerializer.Deserialize<Dictionary<string, uint[]>>(stream)!;
var library = new GrowthRateLibrary();
foreach (var (key, value) in objects)
{
var growthRate = new LookupGrowthRate(key, value);
library.Add(growthRate);
}
return library;
}
}

View File

@ -0,0 +1,40 @@
using System;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Text.Json;
using PkmnLib.Dataloader.Models;
using PkmnLib.Static;
using PkmnLib.Static.Libraries;
using PkmnLib.Static.Utils;
namespace PkmnLib.Dataloader;
public static class ItemDataLoader
{
public static ItemLibrary LoadItems(Stream stream)
{
var library = new ItemLibrary();
var obj = JsonSerializer.Deserialize<SerializedItem[]>(stream, new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = true,
});
if (obj == null)
throw new InvalidDataException("Item data is empty.");
var items = obj.Select(DeserializeItem);
foreach (var i in items)
library.Add(i);
return library;
}
private static IItem DeserializeItem(SerializedItem serialized)
{
if (!Enum.TryParse<ItemCategory>(serialized.ItemType, true, out var itemType))
throw new InvalidDataException($"Item type {serialized.ItemType} is not valid for item {serialized.Name}.");
BattleItemCategory battleType;
Enum.TryParse(serialized.BattleType, true, out battleType);
return new ItemImpl(serialized.Name, itemType, battleType, serialized.Price,
serialized.Flags.Select(x => (StringKey)x).ToImmutableHashSet());
}
}

View File

@ -0,0 +1,40 @@
using System;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Nodes;
using PkmnLib.Static.Utils;
namespace PkmnLib.Dataloader;
internal static class JsonParameterLoader
{
internal static object? ToParameter(this JsonNode node)
{
switch (node.GetValueKind())
{
case JsonValueKind.Undefined:
throw new InvalidOperationException("Undefined value.");
case JsonValueKind.Object:
return node.AsObject().ToDictionary(x => (StringKey)x.Key, x => x.Value?.ToParameter());
case JsonValueKind.Array:
return node.AsArray().Select(x => x?.ToParameter()).ToList();
case JsonValueKind.String:
return node.GetValue<string>();
case JsonValueKind.Number:
var element = node.GetValue<JsonElement>();
if (element.TryGetInt32(out var v))
return v;
if (element.TryGetSingle(out var f))
return f;
throw new InvalidOperationException("Number is not an integer or a float.");
case JsonValueKind.True:
return true;
case JsonValueKind.False:
return false;
case JsonValueKind.Null:
return null;
default:
throw new ArgumentOutOfRangeException();
}
}
}

View File

@ -0,0 +1,11 @@
using System.Collections.Generic;
using System.Text.Json.Nodes;
using PkmnLib.Static.Utils;
namespace PkmnLib.Dataloader.Models;
public class SerializedAbility
{
public string? Effect { get; set; }
public Dictionary<string, JsonNode> Parameters { get; set; } = new();
}

View File

@ -0,0 +1,11 @@
namespace PkmnLib.Dataloader.Models;
public class SerializedItem
{
public string Name { get; set; }
public string ItemType { get; set; }
public string BattleType { get; set; }
public string[] Flags { get; set; }
public int Price { get; set; }
public byte FlingPower { get; set; }
}

View File

@ -0,0 +1,30 @@
using System.Collections.Generic;
using System.Text.Json.Nodes;
namespace PkmnLib.Dataloader.Models;
public class SerializedMoveDataWrapper
{
public SerializedMove[] Data { get; set; }
}
public class SerializedMove
{
public string Name { get; set; }
public string Type { get; set; }
public byte Power { get; set; }
public byte PP { get; set; }
public byte Accuracy { get; set; }
public sbyte Priority { get; set; }
public string Target { get; set; }
public string Category { get; set; }
public string[] Flags { get; set; }
public SerializedMoveEffect? Effect { get; set; }
}
public class SerializedMoveEffect
{
public string Name { get; set; }
public float Chance { get; set; }
public Dictionary<string, JsonNode>? Parameters { get; set; }
}

View File

@ -0,0 +1,68 @@
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Nodes;
namespace PkmnLib.Dataloader.Models;
public class SerializedSpecies
{
public string Species { get; set; }
public ushort Id { get; set; }
public float GenderRatio { get; set; }
public string GrowthRate { get; set; }
public byte BaseHappiness { get; set; }
public byte CatchRate { get; set; }
public string Color { get; set; }
public bool GenderDifference { get; set; }
public string[] EggGroups { get; set; }
public int EggCycles { get; set; }
public string[] Flags { get; set; } = [];
public Dictionary<string, SerializedForm> Formes { get; set; }
public SerializedEvolution[] Evolutions { get; set; } = [];
}
public class SerializedForm
{
public string[] Abilities { get; set; }
public string[] HiddenAbilities { get; set; } = [];
public SerializedStats BaseStats { get; set; }
public SerializedStats EVReward { get; set; }
public string[] Types { get; set; }
public float Height { get; set; }
public float Weight { get; set; }
public uint BaseExp { get; set; }
public bool IsMega { get; set; }
public SerializedMoves Moves { get; set; }
public string[] Flags { get; set; } = [];
}
public class SerializedEvolution
{
public string Species { get; set; }
public string Method { get; set; }
public JsonNode Data { get; set; }
}
public class SerializedStats
{
public ushort Hp { get; set; }
public ushort Attack { get; set; }
public ushort Defense { get; set; }
public ushort SpecialAttack { get; set; }
public ushort SpecialDefense { get; set; }
public ushort Speed { get; set; }
}
public class SerializedLevelMove
{
public string Name { get; set; }
public uint Level { get; set; }
}
public class SerializedMoves
{
public SerializedLevelMove[] LevelMoves { get; set; }
public string[] EggMoves { get; set; }
public string[] TutorMoves { get; set; }
public string[] Machine { get; set; }
}

View File

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Text.Json;
using PkmnLib.Dataloader.Models;
using PkmnLib.Static.Libraries;
using PkmnLib.Static.Moves;
using PkmnLib.Static.Utils;
namespace PkmnLib.Dataloader;
public static class MoveDataLoader
{
public static MoveLibrary LoadMoves(Stream stream, TypeLibrary typeLibrary)
{
var library = new MoveLibrary();
var objects = JsonSerializer.Deserialize<SerializedMoveDataWrapper>(stream,
new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = true,
});
if (objects == null)
throw new InvalidDataException("Move data is empty.");
var moves = objects.Data.Select(x => DeserializeMove(x, typeLibrary));
foreach (var m in moves)
library.Add(m);
return library;
}
private static MoveDataImpl DeserializeMove(SerializedMove serialized, TypeLibrary typeLibrary)
{
var type = serialized.Type;
var power = serialized.Power;
var pp = serialized.PP;
var accuracy = serialized.Accuracy;
var priority = serialized.Priority;
var target = serialized.Target;
var category = serialized.Category;
var flags = serialized.Flags;
var effect = serialized.Effect;
if (target.Equals("self", StringComparison.InvariantCultureIgnoreCase))
target = "selfUse";
if (!typeLibrary.TryGetTypeIdentifier(type, out var typeIdentifier))
throw new InvalidDataException($"Type {type} is not a valid type.");
if (!Enum.TryParse<MoveCategory>(category, true, out var categoryEnum))
throw new InvalidDataException($"Category {category} is not a valid category.");
if (!Enum.TryParse<MoveTarget>(target, true, out var targetEnum))
throw new InvalidDataException($"Target {target} is not a valid target.");
var secondaryEffect = ParseEffect(effect);
var move = new MoveDataImpl(serialized.Name, typeIdentifier, categoryEnum, power, accuracy, pp, targetEnum,
priority, secondaryEffect, flags.Select(x => (StringKey)x).ToImmutableHashSet());
return move;
}
private static ISecondaryEffect? ParseEffect(SerializedMoveEffect? effect)
{
if (effect == null)
return null;
var name = effect.Name;
var chance = effect.Chance;
var parameters = effect.Parameters?.ToDictionary(x => (StringKey)x.Key, x => x.Value.ToParameter()) ??
new Dictionary<StringKey, object?>();
return new SecondaryEffectImpl(chance, name, parameters);
}
}

View File

@ -0,0 +1,60 @@
using System;
using System.IO;
using System.Linq;
using PkmnLib.Static;
using PkmnLib.Static.Libraries;
namespace PkmnLib.Dataloader;
public static class NatureDataLoader
{
private static readonly char[] CommonCsvDelimiters = ['|', ','];
public static NatureLibrary LoadNatureLibrary(Stream stream)
{
var library = new NatureLibrary();
using var reader = new StreamReader(stream);
var header = reader.ReadLine();
if (header == null)
throw new InvalidDataException("Type data is empty.");
var delimiter = CommonCsvDelimiters.FirstOrDefault(header.Contains);
if (delimiter == default)
throw new InvalidDataException("No valid delimiter found in type data.");
while (!reader.EndOfStream)
{
var line = reader.ReadLine();
if (line == null)
break;
var values = line.Split(delimiter)!;
var nature = values[0];
var increasedStat = values[1];
var decreasedStat = values[2];
var increasedModifier = 1.1f;
var decreasedModifier = 0.9f;
if (increasedStat == string.Empty)
{
increasedStat = "Hp";
increasedModifier = 1.0f;
}
if (decreasedStat == string.Empty)
{
decreasedStat = "Hp";
decreasedModifier = 1.0f;
}
if (!Enum.TryParse<Statistic>(increasedStat, out var increasedStatEnum))
throw new InvalidDataException($"Increased stat {increasedStat} is not a valid stat.");
if (!Enum.TryParse<Statistic>(decreasedStat, out var decreasedStatEnum))
throw new InvalidDataException($"Decreased stat {decreasedStat} is not a valid stat.");
library.Add(new Nature(nature, increasedStatEnum, decreasedStatEnum, increasedModifier, decreasedModifier));
}
return library;
}
}

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>12</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PkmnLib.Static\PkmnLib.Static.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,206 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Nodes;
using PkmnLib.Dataloader.Models;
using PkmnLib.Static;
using PkmnLib.Static.Libraries;
using PkmnLib.Static.Species;
using PkmnLib.Static.Utils;
namespace PkmnLib.Dataloader;
public static class SpeciesDataLoader
{
public static SpeciesLibrary LoadSpecies(Stream stream, IReadOnlyTypeLibrary typeLibrary)
{
var library = new SpeciesLibrary();
var obj = JsonSerializer.Deserialize<JsonObject>(stream);
if (obj == null)
throw new InvalidDataException("Species data is empty.");
obj.Remove("$schema");
var cleanedString = obj.ToJsonString();
var objects = JsonSerializer.Deserialize<Dictionary<string, SerializedSpecies>>(cleanedString,
new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = true,
});
if (objects == null)
throw new InvalidDataException("Species data is empty.");
var species = objects.Select(x => DeserializeSpecies(x.Value, typeLibrary));
foreach (var s in species)
library.Add(s);
return library;
}
private static SpeciesImpl DeserializeSpecies(SerializedSpecies serialized, IReadOnlyTypeLibrary typeLibrary)
{
var id = serialized.Id;
var genderRate = serialized.GenderRatio;
if (genderRate < -1.0 || genderRate > 100.0)
throw new InvalidDataException(
$"Gender rate for species {id} is invalid: {genderRate}. Must be between -1.0 and 100.0.");
if (serialized.EggCycles < 0)
throw new InvalidDataException(
$"Egg cycles for species {id} is invalid: {serialized.EggCycles}. Must be greater than or equal to 0.");
var forms = serialized.Formes.ToDictionary(x => (StringKey)x.Key,
x => DeserializeForm(x.Key, x.Value, typeLibrary));
var evolutions = serialized.Evolutions.Select(DeserializeEvolution).ToList();
var species = new SpeciesImpl(serialized.Id, serialized.Species, genderRate, serialized.GrowthRate,
serialized.CatchRate, serialized.BaseHappiness, forms,
serialized.Flags.Select(x => new StringKey(x)).ToImmutableHashSet(), evolutions);
return species;
}
private static IForm DeserializeForm(string name, SerializedForm form, IReadOnlyTypeLibrary typeLibrary)
{
if (form == null)
throw new ArgumentException("Form data is null.", nameof(form));
if (form.Height < 0.0)
throw new InvalidDataException(
$"Height for form {name} is invalid: {form.Height}. Must be greater than or equal to 0.0.");
if (form.Weight < 0.0)
throw new InvalidDataException(
$"Weight for form {name} is invalid: {form.Weight}. Must be greater than or equal to 0.0.");
var types = form.Types.Select(x =>
typeLibrary.TryGetTypeIdentifier(new StringKey(x), out var t)
? t
: throw new InvalidDataException($"Type {x} for form {name} is invalid.")).ToList();
return new FormImpl(name, form.Height, form.Weight, form.BaseExp, types, DeserializeStats(form.BaseStats),
form.Abilities.Select(x => new StringKey(x)).ToList(),
form.HiddenAbilities.Select(x => new StringKey(x)).ToList(), DeserializeMoves(form.Moves),
form.Flags.Select(x => new StringKey(x)).ToImmutableHashSet());
}
private static ILearnableMoves DeserializeMoves(SerializedMoves moves)
{
var learnableMoves = new LearnableMovesImpl();
foreach (var levelMove in moves.LevelMoves)
{
learnableMoves.AddLevelMove((byte)levelMove.Level, new StringKey(levelMove.Name));
}
return learnableMoves;
}
private static ImmutableStatisticSet<ushort> DeserializeStats(SerializedStats stats)
{
return new ImmutableStatisticSet<ushort>(stats.Hp, stats.Attack, stats.Defense, stats.SpecialAttack,
stats.SpecialDefense, stats.Speed);
}
private static IEvolution DeserializeEvolution(SerializedEvolution evolution)
{
return evolution.Method.ToLowerInvariant() switch
{
"level" => new LevelEvolution
{
Level = evolution.Data.GetValue<byte>(),
ToSpecies = evolution.Species,
},
"levelfemale" => new LevelGenderEvolution
{
Level = evolution.Data.GetValue<byte>(),
Gender = Gender.Female,
ToSpecies = evolution.Species,
},
"levelmale" => new LevelGenderEvolution
{
Level = evolution.Data.GetValue<byte>(),
Gender = Gender.Male,
ToSpecies = evolution.Species,
},
"happiness" => new HappinessEvolution
{
Happiness = evolution.Data.GetValue<byte>(),
ToSpecies = evolution.Species,
},
"happinessday" => new HappinessDayEvolution()
{
Happiness = evolution.Data.GetValue<byte>(),
ToSpecies = evolution.Species,
},
"happinessnight" => new HappinessNightEvolution()
{
Happiness = evolution.Data.GetValue<byte>(),
ToSpecies = evolution.Species,
},
"item" => new ItemUseEvolution()
{
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
ToSpecies = evolution.Species,
},
"itemmale" => new ItemGenderEvolution
{
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
ToSpecies = evolution.Species,
},
"itemfemale" => new ItemGenderEvolution
{
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
ToSpecies = evolution.Species,
},
"holditem" => new HoldItemEvolution()
{
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
ToSpecies = evolution.Species,
},
"dayholditem" => new DayHoldItemEvolution()
{
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
ToSpecies = evolution.Species,
},
"nightholditem" => new NightHoldItemEvolution()
{
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
ToSpecies = evolution.Species,
},
"hasmove" => new HasMoveEvolution
{
MoveName = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Move is null."),
ToSpecies = evolution.Species,
},
"trade" => new TradeEvolution
{
ToSpecies = evolution.Species,
},
"tradespecies" => new TradeSpeciesEvolution
{
WithSpecies = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Species is null."),
ToSpecies = evolution.Species,
},
"tradeitem" => new TradeItemEvolution
{
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
ToSpecies = evolution.Species,
},
"location" => new CustomEvolution
{
Name = "location",
Parameters = new Dictionary<StringKey, object?>
{
["location"] = evolution.Data.ToString() ?? throw new InvalidDataException("Location is null.")
},
ToSpecies = evolution.Species,
},
"custom" => new CustomEvolution
{
Name = evolution.Data.AsObject()["type"]?.GetValue<string>() ??
throw new InvalidDataException("Type is null."),
Parameters = evolution.Data.AsObject()
.Where(x => x.Key != "type")
.ToDictionary(x => new StringKey(x.Key), x => x.Value!.ToParameter()),
ToSpecies = evolution.Species,
},
_ => throw new InvalidDataException($"Evolution type {evolution.Method} is invalid.")
};
}
}

View File

@ -0,0 +1,53 @@
using System;
using System.IO;
using System.Linq;
using PkmnLib.Static;
using PkmnLib.Static.Libraries;
namespace PkmnLib.Dataloader;
public static class TypeDataLoader
{
private static readonly char[] CommonCsvDelimiters = ['|', ','];
public static TypeLibrary LoadTypeLibrary(Stream stream)
{
var library = new TypeLibrary();
using var reader = new StreamReader(stream);
var header = reader.ReadLine();
if (header == null)
throw new InvalidDataException("Type data is empty.");
var delimiter = CommonCsvDelimiters.FirstOrDefault(header.Contains);
if (delimiter == default)
throw new InvalidDataException("No valid delimiter found in type data.");
var types = header.Split(delimiter, StringSplitOptions.RemoveEmptyEntries)!;
if (!types.Any())
throw new InvalidDataException("No types found in type data.");
foreach (var type in types)
library.RegisterType(type);
while (!reader.EndOfStream)
{
var line = reader.ReadLine();
if (line == null)
break;
var values = line.Split(delimiter, StringSplitOptions.RemoveEmptyEntries)!;
var type = values[0];
if (!library.TryGetTypeIdentifier(type, out var typeId))
throw new InvalidDataException($"Type {type} not found in type library.");
for (var i = 1; i < values.Length; i++)
{
var effectiveness = float.Parse(values[i]);
if (effectiveness < 0.0)
throw new InvalidDataException(
$"Effectiveness for {type} against {types[i]} is invalid: {effectiveness}. Must be greater than or equal to 0.0.");
library.SetEffectiveness(typeId, (TypeIdentifier)i, effectiveness);
}
}
return library;
}
}

View File

@ -12,6 +12,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{63C1
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PkmnLib.Plugin.Gen7.Tests", "Plugins\PkmnLib.Plugin.Gen7.Tests\PkmnLib.Plugin.Gen7.Tests.csproj", "{FBB53861-081F-4DAC-B006-79EE238D0DFC}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PkmnLib.Plugin.Gen7.Tests", "Plugins\PkmnLib.Plugin.Gen7.Tests\PkmnLib.Plugin.Gen7.Tests.csproj", "{FBB53861-081F-4DAC-B006-79EE238D0DFC}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PkmnLib.Dataloader", "PkmnLib.Dataloader\PkmnLib.Dataloader.csproj", "{E6A733FD-C2A3-4206-B9A9-40DBFBDBE1AC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFiles", "SolutionFiles", "{2B99ADF8-10E2-4A3D-906F-27DC8E312A79}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -38,6 +45,10 @@ Global
{FBB53861-081F-4DAC-B006-79EE238D0DFC}.Debug|Any CPU.Build.0 = Debug|Any CPU {FBB53861-081F-4DAC-B006-79EE238D0DFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FBB53861-081F-4DAC-B006-79EE238D0DFC}.Release|Any CPU.ActiveCfg = Release|Any CPU {FBB53861-081F-4DAC-B006-79EE238D0DFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FBB53861-081F-4DAC-B006-79EE238D0DFC}.Release|Any CPU.Build.0 = Release|Any CPU {FBB53861-081F-4DAC-B006-79EE238D0DFC}.Release|Any CPU.Build.0 = Release|Any CPU
{E6A733FD-C2A3-4206-B9A9-40DBFBDBE1AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6A733FD-C2A3-4206-B9A9-40DBFBDBE1AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6A733FD-C2A3-4206-B9A9-40DBFBDBE1AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6A733FD-C2A3-4206-B9A9-40DBFBDBE1AC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{FA5380F0-28CC-4AEC-8963-814B347A89BA} = {63C1B450-DC26-444A-AEBD-15979F3EEE53} {FA5380F0-28CC-4AEC-8963-814B347A89BA} = {63C1B450-DC26-444A-AEBD-15979F3EEE53}

View File

@ -77,7 +77,7 @@ public class TypeLibrary : IReadOnlyTypeLibrary
{ {
var id = new TypeIdentifier((byte)( _types.Count + 1)); var id = new TypeIdentifier((byte)( _types.Count + 1));
_types.Add(name, id); _types.Add(name, id);
_effectiveness.Add(new List<float>(_types.Count)); _effectiveness.Add(Enumerable.Repeat(1.0f, _effectiveness.Count).ToList());
foreach (var list in _effectiveness) foreach (var list in _effectiveness)
{ {
list.Add(1); list.Add(1);

View File

@ -20,14 +20,14 @@ public interface ISecondaryEffect
/// <summary> /// <summary>
/// Parameters for the effect. /// Parameters for the effect.
/// </summary> /// </summary>
public IReadOnlyDictionary<StringKey, object> Parameters { get; } public IReadOnlyDictionary<StringKey, object?> Parameters { get; }
} }
/// <inheritdoc /> /// <inheritdoc />
public class SecondaryEffectImpl : ISecondaryEffect public class SecondaryEffectImpl : ISecondaryEffect
{ {
/// <inheritdoc cref="SecondaryEffectImpl" /> /// <inheritdoc cref="SecondaryEffectImpl" />
public SecondaryEffectImpl(float chance, StringKey name, IReadOnlyDictionary<StringKey, object> parameters) public SecondaryEffectImpl(float chance, StringKey name, IReadOnlyDictionary<StringKey, object?> parameters)
{ {
Chance = chance; Chance = chance;
Name = name; Name = name;
@ -41,5 +41,5 @@ public class SecondaryEffectImpl : ISecondaryEffect
public StringKey Name { get; } public StringKey Name { get; }
/// <inheritdoc /> /// <inheritdoc />
public IReadOnlyDictionary<StringKey, object> Parameters { get; } public IReadOnlyDictionary<StringKey, object?> Parameters { get; }
} }

View File

@ -11,19 +11,19 @@ public interface IAbility : INamedValue
/// The name of the script effect of the ability. This should refer to the name of the script that will be executed /// The name of the script effect of the ability. This should refer to the name of the script that will be executed
/// when the ability is triggered. /// when the ability is triggered.
/// </summary> /// </summary>
StringKey Effect { get; } StringKey? Effect { get; }
/// <summary> /// <summary>
/// The parameters for the script effect of the ability. /// The parameters for the script effect of the ability.
/// </summary> /// </summary>
IReadOnlyDictionary<StringKey, object> Parameters { get; } IReadOnlyDictionary<StringKey, object?> Parameters { get; }
} }
/// <inheritdoc /> /// <inheritdoc />
public class AbilityImpl : IAbility public class AbilityImpl : IAbility
{ {
/// <inheritdoc cref="AbilityImpl" /> /// <inheritdoc cref="AbilityImpl" />
public AbilityImpl(StringKey name, StringKey effect, IReadOnlyDictionary<StringKey, object> parameters) public AbilityImpl(StringKey name, StringKey? effect, IReadOnlyDictionary<StringKey, object?> parameters)
{ {
Name = name; Name = name;
Effect = effect; Effect = effect;
@ -34,10 +34,10 @@ public class AbilityImpl : IAbility
public StringKey Name { get; } public StringKey Name { get; }
/// <inheritdoc /> /// <inheritdoc />
public StringKey Effect { get; } public StringKey? Effect { get; }
/// <inheritdoc /> /// <inheritdoc />
public IReadOnlyDictionary<StringKey, object> Parameters { get; } public IReadOnlyDictionary<StringKey, object?> Parameters { get; }
} }
/// <summary> /// <summary>

View File

@ -21,7 +21,7 @@ public record LevelEvolution : IEvolution
/// <summary> /// <summary>
/// The level at which the Pokémon evolves. /// The level at which the Pokémon evolves.
/// </summary> /// </summary>
public required uint Level { get; init; } public required LevelInt Level { get; init; }
/// <inheritdoc /> /// <inheritdoc />
public required StringKey ToSpecies { get; init; } public required StringKey ToSpecies { get; init; }
@ -35,7 +35,7 @@ public record LevelGenderEvolution : IEvolution
/// <summary> /// <summary>
/// The level at which the Pokémon evolves. /// The level at which the Pokémon evolves.
/// </summary> /// </summary>
public required uint Level { get; init; } public required LevelInt Level { get; init; }
/// <summary> /// <summary>
/// The gender the Pokémon needs to have to evolve /// The gender the Pokémon needs to have to evolve
@ -227,7 +227,7 @@ public record CustomEvolution : IEvolution
/// <summary> /// <summary>
/// The parameters of the custom evolution method. /// The parameters of the custom evolution method.
/// </summary> /// </summary>
public required IReadOnlyDictionary<StringKey, object> Parameters { get; init; } public required IReadOnlyDictionary<StringKey, object?> Parameters { get; init; }
/// <inheritdoc /> /// <inheritdoc />
public required StringKey ToSpecies { get; init; } public required StringKey ToSpecies { get; init; }

View File

@ -114,8 +114,6 @@ public class FormImpl : IForm
throw new ArgumentException("A form must have at least one type."); throw new ArgumentException("A form must have at least one type.");
if (Abilities.Count == 0) if (Abilities.Count == 0)
throw new ArgumentException("A form must have at least one ability."); throw new ArgumentException("A form must have at least one ability.");
if (HiddenAbilities.Count == 0)
throw new ArgumentException("A form must have at least one hidden ability.");
} }
/// <inheritdoc /> /// <inheritdoc />

292
PkmnLib.Tests/Data/Abilities.json Executable file
View File

@ -0,0 +1,292 @@
{
"adaptability": {
"effect": "IncreasedStab"
},
"aerilate": {
"effect": "ChangeMoveType",
"parameters": {
"from": "normal",
"to": "flying"
}
},
"aftermath": {
"effect": "Aftermath"
},
"air_lock": {
"effect": "SuppressWeather"
},
"analytic": {
"effect": "Analytic"
},
"anger_point": {
"effect": "AngerPoint"
},
"anticipation": {
"effect": "Anticipation"
},
"arena_trap": {
"effect": "ArenaTrap"
},
"aroma_veil": {
"effect": "AromaVeil"
},
"aura_break": {
"effect": "AuraBreal"
},
"bad_dreams": {
"effect": "BadDreams"
},
"battery": {
"effect": "Battery"
},
"battle_armor": {
"effect": "PreventCritical"
},
"battle_bond": {
"effect": "BattleBond"
},
"beast_boost": {
"effect": "BeastBoost"
},
"berserk": {
"effect": "Berserk"
},
"big_pecks": {
"effect": "PreventDefLowering"
},
"blaze": {
"effect": "PowerUpType",
"parameters": {
"type": "fire"
}
},
"bulletproof": {
"effect": "Bulletproof"
},
"cheek_pouch": {
"effect": "CheekPouch"
},
"chlorophyll": {
"effect": "DoubleSpeedInWeather",
"parameters": {
"weather": "HarshSunlight"
}
},
"clear_body": {
"effect": "PreventStatLowering"
},
"cloud_nine": {
"effect": "SuppressWeather"
},
"color_change": {
"effect": "ColorChange"
},
"comatose": {},
"competitive": {},
"compound_eyes": {},
"contrary": {},
"corrosion": {},
"cursed_body": {},
"cute_charm": {},
"damp": {},
"dancer": {},
"dark_aura": {},
"dazzling": {},
"defeatist": {},
"defiant": {},
"delta_stream": {},
"desolate_land": {},
"disguise": {},
"download": {},
"drizzle": {},
"drought": {},
"dry_skin": {},
"early_bird": {},
"effect_spore": {},
"electric_surge": {},
"emergency_exit": {},
"fairy_aura": {},
"filter": {},
"flame_body": {},
"flare_boost": {},
"flash_fire": {},
"flower_gift": {},
"flower_veil": {},
"fluffy": {},
"forecast": {},
"forewarn": {},
"friend_guard": {},
"frisk": {},
"full_metal_body": {},
"fur_coat": {},
"gale_wings": {},
"galvanize": {},
"gluttony": {},
"gooey": {},
"grass_pelt": {},
"grassy_surge": {},
"guts": {},
"harvest": {},
"healer": {},
"heatproof": {},
"heavy_metal": {},
"honey_gather": {},
"huge_power": {},
"hustle": {},
"hydration": {},
"hyper_cutter": {},
"ice_body": {},
"illuminate": {},
"illusion": {},
"immunity": {},
"imposter": {},
"infiltrator": {},
"innards_out": {},
"inner_focus": {},
"insomnia": {},
"intimidate": {},
"iron_barbs": {},
"iron_fist": {},
"justified": {},
"keen_eye": {},
"klutz": {},
"leaf_guard": {},
"levitate": {},
"light_metal": {},
"lightning_rod": {},
"limber": {},
"liquid_ooze": {},
"liquid_voice": {},
"long_reach": {},
"magic_bounce": {},
"magic_guard": {},
"magician": {},
"magma_armor": {},
"magnet_pull": {},
"marvel_scale": {},
"mega_launcher": {},
"merciless": {},
"minus": {},
"misty_surge": {},
"mold_breaker": {},
"moody": {},
"motor_drive": {},
"moxie": {},
"multiscale": {},
"multitype": {},
"mummy": {},
"natural_cure": {},
"no_guard": {},
"normalize": {},
"oblivious": {},
"overcoat": {},
"overgrow": {},
"own_tempo": {},
"parental_bond": {},
"pickpocket": {},
"pickup": {},
"pixilate": {},
"plus": {},
"poison_heal": {},
"poison_point": {},
"poison_touch": {},
"power_construct": {},
"power_of_alchemy": {},
"prankster": {},
"pressure": {},
"primordial_sea": {},
"prism_armor": {},
"protean": {},
"psychic_surge": {},
"pure_power": {},
"queenly_majesty": {},
"quick_feet": {},
"rain_dish": {},
"rattled": {},
"receiver": {},
"reckless": {},
"refrigerate": {},
"regenerator": {},
"rivalry": {},
"rks_system": {},
"rock_head": {},
"rough_skin": {},
"run_away": {},
"sand_force": {},
"sand_rush": {},
"sand_stream": {},
"sand_veil": {},
"sap_sipper": {},
"schooling": {},
"scrappy": {},
"serene_grace": {},
"shadow_shield": {},
"shadow_tag": {},
"shed_skin": {},
"sheer_force": {},
"shell_armor": {},
"shield_dust": {},
"shields_down": {},
"simple": {},
"skill_link": {},
"slow_start": {},
"slush_rush": {},
"sniper": {},
"snow_cloak": {},
"snow_warning": {},
"solar_power": {},
"solid_rock": {},
"soul_heart": {},
"soundproof": {},
"speed_boost": {},
"stakeout": {},
"stall": {},
"stamina": {},
"stance_change": {},
"static": {},
"steadfast": {},
"steelworker": {},
"stench": {},
"sticky_hold": {},
"storm_drain": {},
"strong_jaw": {},
"sturdy": {},
"suction_cups": {},
"super_luck": {},
"surge_surfer": {},
"swarm": {},
"sweet_veil": {},
"swift_swim": {},
"symbiosis": {},
"synchronize": {},
"tangled_feet": {},
"tangling_hair": {},
"technician": {},
"telepathy": {},
"teravolt": {},
"thick_fat": {},
"tinted_lens": {},
"torrent": {},
"tough_claws": {},
"toxic_boost": {},
"trace": {},
"triage": {},
"truant": {},
"turboblaze": {},
"unaware": {},
"unburden": {},
"unnerve": {},
"victory_star": {},
"vital_spirit": {},
"volt_absorb": {},
"water_absorb": {},
"water_bubble": {},
"water_compaction": {},
"water_veil": {},
"weak_armor": {},
"white_smoke": {},
"wimp_out": {},
"wonder_guard": {},
"wonder_skin": {},
"zen_mode": {}
}

View File

@ -0,0 +1,614 @@
{
"Erratic": [
0,
15,
52,
122,
237,
406,
637,
942,
1326,
1800,
2369,
3041,
3822,
4719,
5737,
6881,
8155,
9564,
11111,
12800,
14632,
16610,
18737,
21012,
23437,
26012,
28737,
31610,
34632,
37800,
41111,
44564,
48155,
51881,
55737,
59719,
63822,
68041,
72369,
76800,
81326,
85942,
90637,
95406,
100237,
105122,
110052,
115015,
120001,
125000,
131324,
137795,
144410,
151165,
158056,
165079,
172229,
179503,
186894,
194400,
202013,
209728,
217540,
225443,
233431,
241496,
249633,
257834,
267406,
276458,
286328,
296358,
305767,
316074,
326531,
336255,
346965,
357812,
367807,
378880,
390077,
400293,
411686,
423190,
433572,
445239,
457001,
467489,
479378,
491346,
501878,
513934,
526049,
536557,
548720,
560922,
571333,
583539,
591882,
600000
],
"Fast": [
0,
6,
21,
51,
100,
172,
274,
409,
583,
800,
1064,
1382,
1757,
2195,
2700,
3276,
3930,
4665,
5487,
6400,
7408,
8518,
9733,
11059,
12500,
14060,
15746,
17561,
19511,
21600,
23832,
26214,
28749,
31443,
34300,
37324,
40522,
43897,
47455,
51200,
55136,
59270,
63605,
68147,
72900,
77868,
83058,
88473,
94119,
100000,
106120,
112486,
119101,
125971,
133100,
140492,
148154,
156089,
164303,
172800,
181584,
190662,
200037,
209715,
219700,
229996,
240610,
251545,
262807,
274400,
286328,
298598,
311213,
324179,
337500,
351180,
365226,
379641,
394431,
409600,
425152,
441094,
457429,
474163,
491300,
508844,
526802,
545177,
563975,
583200,
602856,
622950,
643485,
664467,
685900,
707788,
730138,
752953,
776239,
800000
],
"MediumFast": [
0,
8,
27,
64,
125,
216,
343,
512,
729,
1000,
1331,
1728,
2197,
2744,
3375,
4096,
4913,
5832,
6859,
8000,
9261,
10648,
12167,
13824,
15625,
17576,
19683,
21952,
24389,
27000,
29791,
32768,
35937,
39304,
42875,
46656,
50653,
54872,
59319,
64000,
68921,
74088,
79507,
85184,
91125,
97336,
103823,
110592,
117649,
125000,
132651,
140608,
148877,
157464,
166375,
175616,
185193,
195112,
205379,
216000,
226981,
238328,
250047,
262144,
274625,
287496,
300763,
314432,
328509,
343000,
357911,
373248,
389017,
405224,
421875,
438976,
456533,
474552,
493039,
512000,
531441,
551368,
571787,
592704,
614125,
636056,
658503,
681472,
704969,
729000,
753571,
778688,
804357,
830584,
857375,
884736,
912673,
941192,
970299,
1000000
],
"MediumSlow": [
0,
9,
57,
96,
135,
179,
236,
314,
419,
560,
742,
973,
1261,
1612,
2035,
2535,
3120,
3798,
4575,
5460,
6458,
7577,
8825,
10208,
11735,
13411,
15244,
17242,
19411,
21760,
24294,
27021,
29949,
33084,
36435,
40007,
43808,
47846,
52127,
56660,
61450,
66505,
71833,
77440,
83335,
89523,
96012,
102810,
109923,
117360,
125126,
133229,
141677,
150476,
159635,
169159,
179056,
189334,
199999,
211060,
222522,
234393,
246681,
259392,
272535,
286115,
300140,
314618,
329555,
344960,
360838,
377197,
394045,
411388,
429235,
447591,
466464,
485862,
505791,
526260,
547274,
568841,
590969,
613664,
636935,
660787,
685228,
710266,
735907,
762160,
789030,
816525,
844653,
873420,
902835,
932903,
963632,
995030,
1027103,
1059860
],
"Slow": [
0,
10,
33,
80,
156,
270,
428,
640,
911,
1250,
1663,
2160,
2746,
3430,
4218,
5120,
6141,
7290,
8573,
10000,
11576,
13310,
15208,
17280,
19531,
21970,
24603,
27440,
30486,
33750,
37238,
40960,
44921,
49130,
53593,
58320,
63316,
68590,
74148,
80000,
86151,
92610,
99383,
106480,
113906,
121670,
129778,
138240,
147061,
156250,
165813,
175760,
186096,
196830,
207968,
219520,
231491,
243890,
256723,
270000,
283726,
297910,
312558,
327680,
343281,
359370,
375953,
393040,
410636,
428750,
447388,
466560,
486271,
506530,
527343,
548720,
570666,
593190,
616298,
640000,
664301,
689210,
714733,
740880,
767656,
795070,
823128,
851840,
881211,
911250,
941963,
973360,
1005446,
1038230,
1071718,
1105920,
1140841,
1176490,
1212873,
1250000
],
"Fluctuating": [
0,
4,
13,
32,
65,
112,
178,
276,
393,
540,
745,
967,
1230,
1591,
1957,
2457,
3046,
3732,
4526,
5440,
6482,
7666,
9003,
10506,
12187,
14060,
16140,
18439,
20974,
23760,
26811,
30146,
33780,
37731,
42017,
46656,
50653,
55969,
60505,
66560,
71677,
78533,
84277,
91998,
98415,
107069,
114205,
123863,
131766,
142500,
151222,
163105,
172697,
185807,
196322,
210739,
222231,
238036,
250562,
267840,
281456,
300293,
315059,
335544,
351520,
373744,
390991,
415050,
433631,
459620,
479600,
507617,
529063,
559209,
582187,
614566,
639146,
673863,
700115,
737280,
765275,
804997,
834809,
877201,
908905,
954084,
987754,
1035837,
1071552,
1122660,
1160499,
1214753,
1254796,
1312322,
1354652,
1415577,
1460276,
1524731,
1571884,
1640000
]
}

5917
PkmnLib.Tests/Data/Items.json Executable file

File diff suppressed because it is too large Load Diff

10404
PkmnLib.Tests/Data/Moves.json Executable file

File diff suppressed because it is too large Load Diff

26
PkmnLib.Tests/Data/Natures.csv Executable file
View File

@ -0,0 +1,26 @@
Name|Increased|Decreased
Hardy||
Lonely|Attack|Defense
Brave|Attack|Speed
Adamant|Attack|SpecialAttack
Naughty|Attack|SpecialDefense
Bold|Defense|Attack
Docile||
Relaxed|Defense|Speed
Impish|Defense|SpecialAttack
Lax|Defense|SpecialDefense
Timid|Speed|Attack
Hasty|Speed|Defense
Serious||
Jolly|Speed|SpecialAttack
Naive|Speed|SpecialDefense
Modest|SpecialAttack|Attack
Mild|SpecialAttack|Defense
Quiet|SpecialAttack|Speed
Bashful||
Rash|SpecialAttack|SpecialDefense
Calm|SpecialDefense|Attack
Gentle|SpecialDefense|Defense
Sassy|SpecialDefense|Speed
Careful|SpecialDefense|SpecialAttack
Quirky||
1 Name Increased Decreased
2 Hardy
3 Lonely Attack Defense
4 Brave Attack Speed
5 Adamant Attack SpecialAttack
6 Naughty Attack SpecialDefense
7 Bold Defense Attack
8 Docile
9 Relaxed Defense Speed
10 Impish Defense SpecialAttack
11 Lax Defense SpecialDefense
12 Timid Speed Attack
13 Hasty Speed Defense
14 Serious
15 Jolly Speed SpecialAttack
16 Naive Speed SpecialDefense
17 Modest SpecialAttack Attack
18 Mild SpecialAttack Defense
19 Quiet SpecialAttack Speed
20 Bashful
21 Rash SpecialAttack SpecialDefense
22 Calm SpecialDefense Attack
23 Gentle SpecialDefense Defense
24 Sassy SpecialDefense Speed
25 Careful SpecialDefense SpecialAttack
26 Quirky

86782
PkmnLib.Tests/Data/Pokemon.json Executable file

File diff suppressed because it is too large Load Diff

19
PkmnLib.Tests/Data/Types.csv Executable file
View File

@ -0,0 +1,19 @@
Types|Normal|Fighting|Flying|Poison|Ground|Rock|Bug|Ghost|Steel|Fire|Water|Grass|Electric|Psychic|Ice|Dragon|Dark|Fairy
Normal|1|1|1|1|1|0.5|1|0|0.5|1|1|1|1|1|1|1|1|1
Fighting|2|1|0.5|0.5|1|2|0.5|0|2|1|1|1|1|0.5|2|1|2|0.5
Flying|1|2|1|1|1|0.5|2|1|0.5|1|1|2|0.5|1|1|1|1|1
Poison|1|1|1|0.5|0.5|0.5|1|0.5|0|1|1|2|1|1|1|1|1|2
Ground|1|1|0|2|1|2|0.5|1|2|2|1|0.5|2|1|1|1|1|1
Rock|1|0.5|2|1|0.5|1|2|1|0.5|2|1|1|1|1|2|1|1|1
Bug|1|0.5|0.5|0.5|1|1|1|0.5|0.5|0.5|1|2|1|2|1|1|2|0.5
Ghost|0|1|1|1|1|1|1|2|1|1|1|1|1|2|1|1|0.5|1
Steel|1|1|1|1|1|2|1|1|0.5|0.5|0.5|1|0.5|1|2|1|1|2
Fire|1|1|1|1|1|0.5|2|1|2|0.5|0.5|2|1|1|2|0.5|1|1
Water|1|1|1|1|2|2|1|1|1|2|0.5|0.5|1|1|1|0.5|1|1
Grass|1|1|0.5|0.5|2|2|0.5|1|0.5|0.5|2|0.5|1|1|1|0.5|1|1
Electric|1|1|2|1|0|1|1|1|1|1|2|0.5|0.5|1|1|0.5|1|1
Psychic|1|2|1|2|1|1|1|1|0.5|1|1|1|1|0.5|1|1|0|1
Ice|1|1|2|1|2|1|1|1|0.5|0.5|0.5|2|1|1|0.5|2|1|1
Dragon|1|1|1|1|1|1|1|1|0.5|1|1|1|1|1|1|2|1|0
Dark|1|0.5|1|1|1|1|1|2|1|1|1|1|1|2|1|1|0.5|0.5
Fairy|1|2|1|0.5|1|1|1|1|0.5|0.5|1|1|1|1|1|2|2|1
1 Types Normal Fighting Flying Poison Ground Rock Bug Ghost Steel Fire Water Grass Electric Psychic Ice Dragon Dark Fairy
2 Normal 1 1 1 1 1 0.5 1 0 0.5 1 1 1 1 1 1 1 1 1
3 Fighting 2 1 0.5 0.5 1 2 0.5 0 2 1 1 1 1 0.5 2 1 2 0.5
4 Flying 1 2 1 1 1 0.5 2 1 0.5 1 1 2 0.5 1 1 1 1 1
5 Poison 1 1 1 0.5 0.5 0.5 1 0.5 0 1 1 2 1 1 1 1 1 2
6 Ground 1 1 0 2 1 2 0.5 1 2 2 1 0.5 2 1 1 1 1 1
7 Rock 1 0.5 2 1 0.5 1 2 1 0.5 2 1 1 1 1 2 1 1 1
8 Bug 1 0.5 0.5 0.5 1 1 1 0.5 0.5 0.5 1 2 1 2 1 1 2 0.5
9 Ghost 0 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 0.5 1
10 Steel 1 1 1 1 1 2 1 1 0.5 0.5 0.5 1 0.5 1 2 1 1 2
11 Fire 1 1 1 1 1 0.5 2 1 2 0.5 0.5 2 1 1 2 0.5 1 1
12 Water 1 1 1 1 2 2 1 1 1 2 0.5 0.5 1 1 1 0.5 1 1
13 Grass 1 1 0.5 0.5 2 2 0.5 1 0.5 0.5 2 0.5 1 1 1 0.5 1 1
14 Electric 1 1 2 1 0 1 1 1 1 1 2 0.5 0.5 1 1 0.5 1 1
15 Psychic 1 2 1 2 1 1 1 1 0.5 1 1 1 1 0.5 1 1 0 1
16 Ice 1 1 2 1 2 1 1 1 0.5 0.5 0.5 2 1 1 0.5 2 1 1
17 Dragon 1 1 1 1 1 1 1 1 0.5 1 1 1 1 1 1 2 1 0
18 Dark 1 0.5 1 1 1 1 1 2 1 1 1 1 1 2 1 1 0.5 0.5
19 Fairy 1 2 1 0.5 1 1 1 1 0.5 0.5 1 1 1 1 1 2 2 1

View File

@ -0,0 +1,14 @@
using PkmnLib.Dataloader;
namespace PkmnLib.Tests.Dataloader;
public class AbilityDataLoaderTests
{
[Test]
public void TestPrimaryAbilityFile()
{
using var stream = File.OpenRead("Data/Abilities.json");
var library = AbilityDataLoader.LoadAbilities(stream);
Assert.That(library, Is.Not.Null);
}
}

View File

@ -0,0 +1,14 @@
using PkmnLib.Dataloader;
namespace PkmnLib.Tests.Dataloader;
public class GrowthRateDataLoaderTests
{
[Test]
public void TestPrimaryGrowthRateFile()
{
using var file = File.Open("Data/GrowthRates.json", FileMode.Open);
var library = GrowthRateDataLoader.LoadGrowthRates(file);
Assert.That(library, Is.Not.Null);
}
}

View File

@ -0,0 +1,14 @@
using PkmnLib.Dataloader;
namespace PkmnLib.Tests.Dataloader;
public class ItemDataLoaderTests
{
[Test]
public void TestPrimaryItemFile()
{
using var stream = File.OpenRead("Data/Items.json");
var library = ItemDataLoader.LoadItems(stream);
Assert.That(library, Is.Not.Null);
}
}

View File

@ -0,0 +1,35 @@
using PkmnLib.Dataloader;
using PkmnLib.Static.Libraries;
namespace PkmnLib.Tests.Dataloader;
public class MoveDataLoaderTests
{
[Test]
public void TestPrimaryMoveFile()
{
using var stream = File.OpenRead("Data/Moves.json");
var typeLibrary = new TypeLibrary();
typeLibrary.RegisterType("Normal");
typeLibrary.RegisterType("Fire");
typeLibrary.RegisterType("Water");
typeLibrary.RegisterType("Electric");
typeLibrary.RegisterType("Grass");
typeLibrary.RegisterType("Ice");
typeLibrary.RegisterType("Fighting");
typeLibrary.RegisterType("Poison");
typeLibrary.RegisterType("Ground");
typeLibrary.RegisterType("Flying");
typeLibrary.RegisterType("Psychic");
typeLibrary.RegisterType("Bug");
typeLibrary.RegisterType("Rock");
typeLibrary.RegisterType("Ghost");
typeLibrary.RegisterType("Dragon");
typeLibrary.RegisterType("Dark");
typeLibrary.RegisterType("Steel");
typeLibrary.RegisterType("Fairy");
var library = MoveDataLoader.LoadMoves(stream, typeLibrary);
Assert.That(library, Is.Not.Null);
}
}

View File

@ -0,0 +1,14 @@
using PkmnLib.Dataloader;
namespace PkmnLib.Tests.Dataloader;
public class NatureDataloaderTests
{
[Test]
public void TestPrimaryNatureFile()
{
using var file = File.Open("Data/Natures.csv", FileMode.Open);
var library = NatureDataLoader.LoadNatureLibrary(file);
Assert.That(library, Is.Not.Null);
}
}

View File

@ -0,0 +1,35 @@
using PkmnLib.Dataloader;
using PkmnLib.Static.Libraries;
namespace PkmnLib.Tests.Dataloader;
public class SpeciesDataloaderTests
{
[Test]
public void TestPrimarySpeciesFile()
{
using var file = File.Open("Data/Pokemon.json", FileMode.Open);
var typeLibrary = new TypeLibrary();
typeLibrary.RegisterType("Normal");
typeLibrary.RegisterType("Fire");
typeLibrary.RegisterType("Water");
typeLibrary.RegisterType("Electric");
typeLibrary.RegisterType("Grass");
typeLibrary.RegisterType("Ice");
typeLibrary.RegisterType("Fighting");
typeLibrary.RegisterType("Poison");
typeLibrary.RegisterType("Ground");
typeLibrary.RegisterType("Flying");
typeLibrary.RegisterType("Psychic");
typeLibrary.RegisterType("Bug");
typeLibrary.RegisterType("Rock");
typeLibrary.RegisterType("Ghost");
typeLibrary.RegisterType("Dragon");
typeLibrary.RegisterType("Dark");
typeLibrary.RegisterType("Steel");
typeLibrary.RegisterType("Fairy");
var library = SpeciesDataLoader.LoadSpecies(file, typeLibrary);
Assert.NotNull(library);
}
}

View File

@ -0,0 +1,14 @@
using PkmnLib.Dataloader;
namespace PkmnLib.Tests.Dataloader;
public class TypeDataloaderTests
{
[Test]
public void TestPrimaryTypesFile()
{
using var file = File.Open("Data/Types.csv", FileMode.Open);
var library = TypeDataLoader.LoadTypeLibrary(file);
Assert.That(library, Is.Not.Null);
}
}

View File

@ -19,7 +19,19 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\PkmnLib.Dataloader\PkmnLib.Dataloader.csproj" />
<ProjectReference Include="..\PkmnLib.Dynamic\PkmnLib.Dynamic.csproj" />
<ProjectReference Include="..\PkmnLib.Static\PkmnLib.Static.csproj" /> <ProjectReference Include="..\PkmnLib.Static\PkmnLib.Static.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Data\" />
</ItemGroup>
<ItemGroup>
<None Update="Data\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project> </Project>

View File

@ -14,7 +14,7 @@ public class Gen7MiscLibrary : IMiscLibrary
private readonly IMoveData _struggleData = new MoveDataImpl("struggle", new TypeIdentifier(0), private readonly IMoveData _struggleData = new MoveDataImpl("struggle", new TypeIdentifier(0),
MoveCategory.Physical, 50, MoveCategory.Physical, 50,
255, 255, MoveTarget.Any, 0, 255, 255, MoveTarget.Any, 0,
new SecondaryEffectImpl(-1, "struggle", new Dictionary<StringKey, object>()), []); new SecondaryEffectImpl(-1, "struggle", new Dictionary<StringKey, object?>()), []);
/// <inheritdoc /> /// <inheritdoc />
public ITurnChoice ReplacementChoice(IPokemon user, byte targetSide, byte targetPosition) => public ITurnChoice ReplacementChoice(IPokemon user, byte targetSide, byte targetPosition) =>