bugfix in tag parsing

This commit is contained in:
Chen Asraf
2020-04-26 19:40:49 +03:00
parent e8a3e473e9
commit c100b59e3c
3 changed files with 4 additions and 3 deletions

View File

@@ -39,6 +39,7 @@ void main() {
// Parse tags from objects or strings
print(Tag.fromJSON({'weight': 1}));
print(Tag.fromJSON('{coins: 3}'));
print(Tag.fromJSON('close'));
// All info tags

View File

@@ -11,7 +11,7 @@ class Tag<T> extends DWEntity {
String description;
Tag(this.name, [this.value, this.description]) {
Tag(this.name, [this.value, this.description]) : super(key: name) {
if (description != null &&
description.isNotEmpty &&
!tagInfoCache.containsKey(key)) {
@@ -43,7 +43,7 @@ class Tag<T> extends DWEntity {
var value = int.tryParse(match.group(1));
return Tag(name, value as dynamic);
}
var mapLike = RegExp('\\{(.*):\\s?([0-9]+)\\}');
var mapLike = RegExp('\\{(.*):\\s?([+-]?[0-9]+)\\}');
if (mapLike.hasMatch(obj)) {
var match = mapLike.allMatches(obj).toList().first;

View File

@@ -1,7 +1,7 @@
name: dungeon_world_data
homepage: https://github.com/chenasraf/dungeon_world_data
description: Data dump of Dungeon World classes, moves, equipment, and more. Also mirrored as NPM package.
version: 2.0.2
version: 2.0.3
environment:
sdk: ">=2.3.0 <3.0.0"