From 5ee3643e37ede610072055c19ba2ecd3559b092b Mon Sep 17 00:00:00 2001 From: Chen Asraf Date: Fri, 30 Jul 2021 23:41:00 +0300 Subject: [PATCH] before apply --- lib/alignment.dart | 4 +- lib/equipment.dart | 6 +- lib/gear_choice.dart | 8 +- lib/mappers.dart | 10 +- lib/monster.dart | 10 +- lib/move.dart | 8 +- lib/player_class.dart | 30 +++--- lib/spell.dart | 6 +- lib/src/_dungeon_world_data.dart | 18 ++-- lib/tag.dart | 6 +- pubspec.lock | 170 ++++++++++++++----------------- pubspec.yaml | 20 ++-- scripts/dump/dart_parsers.dart | 2 +- 13 files changed, 140 insertions(+), 158 deletions(-) diff --git a/lib/alignment.dart b/lib/alignment.dart index c0be16b..83c72f7 100644 --- a/lib/alignment.dart +++ b/lib/alignment.dart @@ -3,10 +3,10 @@ import 'dw_entity.dart'; class Alignment extends DWEntity { /// Alignment name - String name; + String/*!*/ name; /// Alignment description - String description; + String/*!*/ description; Alignment({ String key, diff --git a/lib/equipment.dart b/lib/equipment.dart index a8e2105..8d56554 100644 --- a/lib/equipment.dart +++ b/lib/equipment.dart @@ -5,16 +5,16 @@ import 'mappers.dart'; class Equipment extends DWEntity { /// Equipment name - String name; + String/*!*/ name; /// Equipment name, in plural String pluralName; /// Item description - String description; + String/*!*/ description; /// Equipment tags - List tags; + List tags; Equipment({ String key, diff --git a/lib/gear_choice.dart b/lib/gear_choice.dart index 49dbf5b..a4407ce 100644 --- a/lib/gear_choice.dart +++ b/lib/gear_choice.dart @@ -5,10 +5,10 @@ import 'mappers.dart'; class GearChoice extends DWEntity { /// Description of choices, possibly with other benefits to the stats. - String label; + String/*!*/ label; /// The list of options to choose from. `label` should specify how many to choose. - List gearOptions; + List gearOptions; GearChoice({ String key, @@ -36,8 +36,8 @@ class GearChoice extends DWEntity { class GearOption extends DWEntity { // String key; - String name; - List tags; + String/*!*/ name; + List/*!*/ tags; GearOption({ String key, diff --git a/lib/mappers.dart b/lib/mappers.dart index 1f05698..7089dde 100644 --- a/lib/mappers.dart +++ b/lib/mappers.dart @@ -7,16 +7,16 @@ import 'monster.dart'; import 'player_class.dart'; import 'tag.dart'; -List listMapper(List lst, R Function(A obj) mapper) => +List listMapper(List lst, R Function(A obj) mapper) => lst != null && lst.isNotEmpty ? List.from(lst).map((obj) => obj is A ? mapper(obj) : null).toList() : []; -Map mapMapper( - Map map, MapEntry Function(dynamic key, dynamic obj) mapper) => +Map mapMapper( + Map map, MapEntry Function(dynamic key, dynamic obj) mapper) => map != null ? Map.from(map).map(mapper) : {}; -List moveListMapper(List lst) => lst == null || lst.isEmpty +List moveListMapper(List lst) => lst == null || lst.isEmpty ? [] : listMapper( List.from(lst), (v) => Move.fromJSON(v)); @@ -29,7 +29,7 @@ Map classMapper(Map map) => mapMapper( (k, v) => MapEntry(k.toString(), PlayerClass.fromJSON(v))); -Map> nameMapper(Map map) => +Map/*!*/> nameMapper(Map map) => mapMapper>( map, (k, v) => MapEntry>(k.toString(), diff --git a/lib/monster.dart b/lib/monster.dart index c96977a..dc554bf 100644 --- a/lib/monster.dart +++ b/lib/monster.dart @@ -5,19 +5,19 @@ import 'mappers.dart'; class Monster extends DWEntity { /// Monster name - String name; + String /*!*/ name; /// Monster description - String description; + String /*!*/ description; /// Monster instinct - String instinct; + String /*!*/ instinct; /// Monster tags - List tags; + List tags; /// Monster moves - List moves; + List moves; Monster({ String key, diff --git a/lib/move.dart b/lib/move.dart index 0c5a1bd..7fc94ac 100644 --- a/lib/move.dart +++ b/lib/move.dart @@ -4,17 +4,17 @@ import 'mappers.dart'; class Move extends DWEntity { /// Move name - String name; + String/*!*/ name; /// Move description - String description; + String/*!*/ description; /// Move explanation - String explanation; + String/*!*/ explanation; /// Classes that can use this move. /// The keys correspond to the `PlayerClass` key. - List classes; + List classes; Move({ String key, diff --git a/lib/player_class.dart b/lib/player_class.dart index d4d6a8d..c5e0aef 100644 --- a/lib/player_class.dart +++ b/lib/player_class.dart @@ -9,49 +9,49 @@ import 'gear_choice.dart'; class PlayerClass extends DWEntity { /// Class name - String name; + String /*!*/ name; /// Class description - String description; + String /*!*/ description; /// Base max. weight load, without the +STR. - num load; + num /*!*/ load; /// Base HP - num baseHP; + num /*!*/ baseHP; /// Hit die - Dice damage; + Dice /*!*/ damage; /// Character name options, mapped by race - Map> names; + Map /*!*/ > names; /// Class Bonds - List bonds; + List bonds; /// Character look options - List> looks; + List /*!*/ > looks; /// Character alignment options. Map of `Alignment.key` => `Alignment` Map alignments; /// Race moves - List raceMoves; + List raceMoves; /// Starting moves - List startingMoves; + List startingMoves; /// Starting moves - List advancedMoves1; + List advancedMoves1; /// Starting moves - List advancedMoves2; + List advancedMoves2; /// Spells - List spells; + List spells; /// Gear choices - List gearChoices; + List gearChoices; PlayerClass({ String key, @@ -114,7 +114,7 @@ class PlayerClass extends DWEntity { 'names': names, 'bonds': bonds, 'looks': looks, - 'alignments': mapMapper( + 'alignments': mapMapper( alignments, (k, v) => MapEntry(k, v.toJSON())), 'race_moves': listMapper(raceMoves, (move) => move.toJSON()), diff --git a/lib/spell.dart b/lib/spell.dart index 05e4271..23ad5b8 100644 --- a/lib/spell.dart +++ b/lib/spell.dart @@ -5,16 +5,16 @@ import 'tag.dart'; class Spell extends DWEntity { /// Spell name - String name; + String/*!*/ name; /// Spell description - String description; + String/*!*/ description; /// Spell level String level; /// Spell tags - List tags; + List tags; Spell({ String key, diff --git a/lib/src/_dungeon_world_data.dart b/lib/src/_dungeon_world_data.dart index 2152495..1197646 100644 --- a/lib/src/_dungeon_world_data.dart +++ b/lib/src/_dungeon_world_data.dart @@ -20,7 +20,7 @@ part '_homebrew.dart'; const String VERSION = '2.0.0'; class DungeonWorldData { - Map _raw; + /*late*/ Map _raw; /// Raw data Map get raw { @@ -29,25 +29,25 @@ class DungeonWorldData { } /// Basic moves - List basicMoves; + /*late*/ List basicMoves; /// Special moves - List specialMoves; + /*late*/ List specialMoves; /// Classes - List classes; + /*late*/ List classes; /// Equipment - List equipment; + /*late*/ List equipment; /// Spells - List spells; + /*late*/ List spells; /// Monsters - List monsters; + /*late*/ List monsters; /// Tags - List tags; + /*late*/ List tags; /// Current version of data, corresponds to same version of https://www.npmjs.com/package/dungeonworld-data final String version = VERSION; @@ -92,5 +92,5 @@ class DungeonWorldData { list.map((v) => MapEntry(key(v), v)), ); - static String entryKey(DWEntity item) => item.key; + static String entryKey(DWEntity item) => item.key /*!*/; } diff --git a/lib/tag.dart b/lib/tag.dart index 228a277..2c3fb22 100644 --- a/lib/tag.dart +++ b/lib/tag.dart @@ -1,10 +1,10 @@ import 'dw_entity.dart'; class Tag extends DWEntity { - static Map tagInfoCache = {}; + static Map tagInfoCache = {}; /// Tag or feature name - String name; + String /*!*/ name; /// Value, if applicable T value; @@ -34,7 +34,7 @@ class Tag extends DWEntity { factory Tag.fromJSON(obj) { if (obj is String) { if (obj == '') { - return null; + throw TypeError(); } var amountThenName = RegExp('([0-9]+)\\s(.*)'); if (amountThenName.hasMatch(obj)) { diff --git a/pubspec.lock b/pubspec.lock index e0ee068..3b840d2 100755 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,377 +7,363 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "22.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.39.10" + version: "1.7.2" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.6.0" + version: "2.2.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.8.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.3.1" + cli_util: + dependency: transitive + description: + name: cli_util + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.3" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.12" + version: "1.15.0" convert: dependency: transitive description: name: convert url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "3.0.1" coverage: dependency: transitive description: name: coverage url: "https://pub.dartlang.org" source: hosted - version: "0.14.0" + version: "0.15.2" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" - csslib: - dependency: transitive - description: - name: csslib - url: "https://pub.dartlang.org" - source: hosted - version: "0.16.1" + version: "3.0.1" dart_style: dependency: "direct dev" description: name: dart_style url: "https://pub.dartlang.org" source: hosted - version: "1.3.6" + version: "2.0.3" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.2" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" glob: dependency: transitive description: name: glob url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - html: - dependency: transitive - description: - name: html - url: "https://pub.dartlang.org" - source: hosted - version: "0.14.0+3" - http: - dependency: transitive - description: - name: http - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.1" + version: "2.0.1" http_multi_server: dependency: transitive description: name: http_multi_server url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "3.0.1" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.4" + version: "4.0.0" io: dependency: transitive description: name: io url: "https://pub.dartlang.org" source: hosted - version: "0.3.4" + version: "1.0.3" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.2" + version: "0.6.3" + lints: + dependency: transitive + description: + name: lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" logging: dependency: transitive description: name: logging url: "https://pub.dartlang.org" source: hosted - version: "0.11.4" + version: "1.0.1" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.10" meta: dependency: "direct main" description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.7.0" mime: dependency: transitive description: name: mime url: "https://pub.dartlang.org" source: hosted - version: "0.9.6+3" - multi_server_socket: - dependency: transitive - description: - name: multi_server_socket - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2" - node_interop: - dependency: transitive - description: - name: node_interop - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.1" - node_io: - dependency: transitive - description: - name: node_io - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.1" + version: "1.0.0" node_preamble: dependency: transitive description: name: node_preamble url: "https://pub.dartlang.org" source: hosted - version: "1.4.10" + version: "1.4.13" package_config: dependency: transitive description: name: package_config url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "2.0.0" path: dependency: "direct dev" description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" pedantic: - dependency: "direct dev" + dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.9.0" + version: "1.11.1" pool: dependency: transitive description: name: pool url: "https://pub.dartlang.org" source: hosted - version: "1.4.0" + version: "1.5.0" pub_semver: dependency: transitive description: name: pub_semver url: "https://pub.dartlang.org" source: hosted - version: "1.4.4" + version: "2.0.0" quiver: dependency: "direct main" description: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "3.0.1" shelf: dependency: transitive description: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "0.7.5" + version: "1.2.0" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.1" shelf_static: dependency: transitive description: name: shelf_static url: "https://pub.dartlang.org" source: hosted - version: "0.2.8" + version: "0.2.9+2" shelf_web_socket: dependency: transitive description: name: shelf_web_socket url: "https://pub.dartlang.org" source: hosted - version: "0.2.3" + version: "0.2.4+1" source_map_stack_trace: dependency: transitive description: name: source_map_stack_trace url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" source_maps: dependency: transitive description: name: source_maps url: "https://pub.dartlang.org" source: hosted - version: "0.10.9" + version: "0.10.10" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test: dependency: "direct dev" description: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.14.7" + version: "1.16.5" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.16" + version: "0.2.19" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.3.7" + version: "0.3.15" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" uuid: dependency: "direct main" description: name: uuid url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "3.0.4" vm_service: dependency: transitive description: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "4.0.4" + version: "6.2.0" watcher: dependency: transitive description: name: watcher url: "https://pub.dartlang.org" source: hosted - version: "0.9.7+15" + version: "1.0.0" web_socket_channel: dependency: transitive description: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol url: "https://pub.dartlang.org" source: hosted - version: "0.7.3" + version: "1.0.0" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.1.0" sdks: - dart: ">=2.7.0 <3.0.0" + dart: ">=2.12.0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index f779270..2a316d2 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,23 +1,19 @@ name: dungeon_world_data homepage: https://github.com/DungeonPaper/dungeon_world_data -description: Data dump of Dungeon World classes, moves, equipment, and more. Also mirrored as NPM package. +description: Data dump of Dungeon World classes, moves, equipment, and more. + Also mirrored as NPM package. version: 2.0.5+10 environment: - sdk: ">=2.3.0 <3.0.0" + sdk: ">=2.11.0 <3.0.0" dependencies: - quiver: ^2.0.1 meta: ^1.1.0 - uuid: ^2.0.4 + quiver: ^3.0.1 + uuid: ^3.0.4 dev_dependencies: - pedantic: ^1.9.0 - test: ^1.6.4 - dart_style: ^1.3.3 + flutter_lints: ^1.0.4 + dart_style: ^2.0.3 path: ^1.6.4 - # js: ^0.6.1+1 - # build_runner: ^1.9.0 - # node_interop: ^1.0.3 - # build_node_compilers: ^0.2.4 - # build_web_compilers: ^2.9.0 + test: ^1.6.4 diff --git a/scripts/dump/dart_parsers.dart b/scripts/dump/dart_parsers.dart index 01e0684..81976c4 100644 --- a/scripts/dump/dart_parsers.dart +++ b/scripts/dump/dart_parsers.dart @@ -65,7 +65,7 @@ String Function(Tag) parseInfoTags = createClassParser( includeKey: false, ); -String Function(Alignment) parseAlignment = createClassParser( +String Function(Alignment/*!*/) parseAlignment = createClassParser( 'Alignment', (i) => ''' name: ${parseValue(i.name)},