ddb_ruby 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,33 +18,30 @@ module DdbRuby
18
18
  include Dry.Types(default: :nominal)
19
19
 
20
20
  Integer = Coercible::Integer
21
- Bool = Coercible::Bool
21
+ Bool = Types:Params::Bool
22
22
  Hash = Coercible::Hash
23
23
  String = Coercible::String
24
24
  Double = Coercible::Float | Coercible::Integer
25
25
  SaveSuccessDescription = Coercible::String.enum("", "half damage")
26
- Name = Coercible::String.enum("Ammunition", "Finesse", "Golgari Swarm", "Heavy", "Light", "Loading", "Range", "Reach", "Selesnya Conclave", "Thrown", "Two-Handed", "Versatile")
27
- Username = Coercible::String.enum("afstanton", "hXcMike", "trillianh85")
28
- DurationUnit = Coercible::String.enum("Day", "Hour", "Minute", "Round", "Special")
29
- DurationType = Coercible::String.enum("Concentration", "Instantaneous", "Time")
30
- BackgroundType = Coercible::String.enum("advantage", "bonus", "carrying-capacity", "damage", "disadvantage", "eldritch-blast", "expertise", "ignore", "immunity", "language", "natural-weapon", "proficiency", "protection", "resistance", "set", "set-base", "size", "stealth-disadvantage", "vulnerability")
31
- BackgroundFriendlyTypeName = Coercible::String.enum("Advantage", "Bonus", "Carrying Capacity", "Damage", "Disadvantage", "Eldritch Blast", "Expertise", "Ignore", "Immunity", "Language", "Natural Weapon", "Proficiency", "Protection", "Resistance", "Set", "Set Base", "Size", "Stealth Disadvantage", "Vulnerability")
32
- AoeType = Coercible::String.enum("Cone", "Cube", "Cylinder", "Line", "Sphere", "Square")
33
- Origin = Coercible::String.enum("Ranged", "Self", "Sight", "Touch")
26
+ Username = Coercible::String.enum("afstanton", "trillianh85")
27
+ DurationUnit = Coercible::String.enum("Day", "Hour", "Minute", "Round", "Special", "UntilDispelled")
28
+ DurationType = Coercible::String.enum("Concentration", "Instantaneous", "Special", "Time", "Until Dispelled", "Until Dispelled or Triggered")
29
+ BackgroundType = Coercible::String.enum("advantage", "bonus", "carrying-capacity", "damage", "disadvantage", "eldritch-blast", "expertise", "ignore", "immunity", "language", "natural-weapon", "proficiency", "protection", "resistance", "sense", "set", "set-base", "size", "stealth-disadvantage", "vulnerability", "weapon-property")
30
+ BackgroundFriendlyTypeName = Coercible::String.enum("Advantage", "Bonus", "Carrying Capacity", "Damage", "Disadvantage", "Eldritch Blast", "Expertise", "Ignore", "Immunity", "Language", "Natural Weapon", "Proficiency", "Protection", "Resistance", "Sense", "Set", "Set Base", "Size", "Stealth Disadvantage", "Vulnerability", "Weapon Property")
31
+ AoeType = Coercible::String.enum("Cone", "Cube", "Cylinder", "Line", "Sphere", "Square", "Square Feet")
32
+ Origin = Coercible::String.enum("Ranged", "Self", "Sight", "Touch", "Unlimited")
34
33
  ScaleType = Coercible::String.enum("characterlevel", "spelllevel", "spellscale")
35
34
  School = Coercible::String.enum("Abjuration", "Conjuration", "Divination", "Enchantment", "Evocation", "Illusion", "Necromancy", "Transmutation")
35
+ Tag = Coercible::String.enum("Banishment", "Buff", "Charmed", "Combat", "Communication", "Compulsion", "Control", "Creation", "Damage", "Debuff", "Deception", "Detection", "Environment", "Exploration", "Foreknowledge", "Healing", "Movement", "Negation", "Scrying", "Shapechanging", "Social", "Summoning", "Teleportation", "Utility", "Warding")
36
36
  EntityType = Coercible::String.enum("class-feature", "racial-trait")
37
37
  PrerequisiteMappingFriendlyTypeName = Coercible::String.enum("Ability Score", "Custom Value", "Proficiency", "Race", "Size")
38
38
  PrerequisiteMappingType = Coercible::String.enum("ability-score", "custom-value", "proficiency", "race", "size")
39
- AttunementDescription = Coercible::String.enum("druid or ranger", "", "Spellcaster", "Warlock", "wizard")
40
39
  DamageType = Coercible::String.enum("Bludgeoning", "Piercing", "Slashing")
41
- FilterType = Coercible::String.enum("Armor", "Other Gear", "Potion", "Ring", "Rod", "Wand", "Weapon", "Wondrous item")
42
- Rarity = Coercible::String.enum("Common", "Rare", "Uncommon", "Very Rare")
43
- SubType = Coercible::String.enum("Adventuring Gear", "Ammunition", "Arcane Focus", "Druidic Focus", "Holy Symbol", "Potion", "Tool")
44
- Tag = Coercible::String.enum("Buff", "Combat", "Communication", "Consumable", "Container", "Control", "Creation", "Damage", "Deception", "Detection", "Exploration", "Eyewear", "Focus", "Handwear", "Headwear", "Healing", "Instrument", "Jewelry", "Movement", "Outerwear", "Social", "Utility", "Warding")
40
+ FilterType = Coercible::String.enum("Armor", "Other Gear", "Potion", "Ring", "Rod", "Staff", "Wand", "Weapon", "Wondrous item")
41
+ Rarity = Coercible::String.enum("Artifact", "Common", "Legendary", "Rare", "Uncommon", "Very Rare")
42
+ SubType = Coercible::String.enum("Adventuring Gear", "Ammunition", "Arcane Focus", "Holy Symbol", "Potion", "Tool")
45
43
  ProvidedFrom = Coercible::String.enum("database", "storage")
46
- AdditionalDescription = Coercible::String.enum("does not require material components", "Doesn't require any components", "", "the hand is invisible")
47
- Restriction = Coercible::String.enum("Doesn't require concentration", "")
44
+ AdditionalDescription = Coercible::String.enum("Doesn't require any components", "")
48
45
  StatusSlug = Coercible::String.enum("active")
49
46
  end
50
47
 
@@ -76,7 +73,7 @@ module DdbRuby
76
73
  end
77
74
  end
78
75
 
79
- class Die < Dry::Struct
76
+ class HitPointDice < Dry::Struct
80
77
  attribute :dice_count, Types::Integer.optional
81
78
  attribute :dice_value, Types::Integer.optional
82
79
  attribute :dice_multiplier, Types::Integer.optional
@@ -170,7 +167,7 @@ module DdbRuby
170
167
 
171
168
  class Range1 < Dry::Struct
172
169
  attribute :range, Types::Integer.optional
173
- attribute :long_range, Types::Integer.optional
170
+ attribute :long_range, Types::Nil
174
171
  attribute :aoe_type, Types::Integer.optional
175
172
  attribute :aoe_size, Types::Integer.optional
176
173
  attribute :has_aoe_special_description, Types::Bool
@@ -231,12 +228,12 @@ module DdbRuby
231
228
  attribute :attack_type_range, Types::Integer.optional
232
229
  attribute :action_type, Types::Integer
233
230
  attribute :attack_subtype, Types::Integer.optional
234
- attribute :dice, Die.optional
231
+ attribute :dice, HitPointDice.optional
235
232
  attribute :value, Types::Integer.optional
236
233
  attribute :damage_type_id, Types::Integer.optional
237
234
  attribute :is_martial_arts, Types::Bool
238
235
  attribute :is_proficient, Types::Bool
239
- attribute :spell_range_type, Types::Integer.optional
236
+ attribute :spell_range_type, Types::Nil
240
237
  attribute :display_as_attack, Types::Bool.optional
241
238
  attribute :range, Range1
242
239
  attribute :activation, Activation
@@ -264,7 +261,7 @@ module DdbRuby
264
261
  attack_type_range: d.fetch("attackTypeRange"),
265
262
  action_type: d.fetch("actionType"),
266
263
  attack_subtype: d.fetch("attackSubtype"),
267
- dice: d.fetch("dice") ? Die.from_dynamic!(d.fetch("dice")) : nil,
264
+ dice: d.fetch("dice") ? HitPointDice.from_dynamic!(d.fetch("dice")) : nil,
268
265
  value: d.fetch("value"),
269
266
  damage_type_id: d.fetch("damageTypeId"),
270
267
  is_martial_arts: d.fetch("isMartialArts"),
@@ -359,6 +356,55 @@ module DdbRuby
359
356
  end
360
357
  end
361
358
 
359
+ class CustomBackground < Dry::Struct
360
+ attribute :id, Types::Integer
361
+ attribute :entity_type_id, Types::Integer
362
+ attribute :custom_background_name, Types::Nil
363
+ attribute :description, Types::Nil
364
+ attribute :features_background, Types::Nil
365
+ attribute :characteristics_background, Types::Nil
366
+ attribute :features_background_definition_id, Types::Nil
367
+ attribute :characteristics_background_definition_id, Types::Nil
368
+ attribute :background_type, Types::Nil
369
+
370
+ def self.from_dynamic!(d)
371
+ d = Types::Hash[d]
372
+ new(
373
+ id: d.fetch("id"),
374
+ entity_type_id: d.fetch("entityTypeId"),
375
+ custom_background_name: d.fetch("name"),
376
+ description: d.fetch("description"),
377
+ features_background: d.fetch("featuresBackground"),
378
+ characteristics_background: d.fetch("characteristicsBackground"),
379
+ features_background_definition_id: d.fetch("featuresBackgroundDefinitionId"),
380
+ characteristics_background_definition_id: d.fetch("characteristicsBackgroundDefinitionId"),
381
+ background_type: d.fetch("backgroundType"),
382
+ )
383
+ end
384
+
385
+ def self.from_json!(json)
386
+ from_dynamic!(JSON.parse(json))
387
+ end
388
+
389
+ def to_dynamic
390
+ {
391
+ "id" => id,
392
+ "entityTypeId" => entity_type_id,
393
+ "name" => custom_background_name,
394
+ "description" => description,
395
+ "featuresBackground" => features_background,
396
+ "characteristicsBackground" => characteristics_background,
397
+ "featuresBackgroundDefinitionId" => features_background_definition_id,
398
+ "characteristicsBackgroundDefinitionId" => characteristics_background_definition_id,
399
+ "backgroundType" => background_type,
400
+ }
401
+ end
402
+
403
+ def to_json(options = nil)
404
+ JSON.generate(to_dynamic, options)
405
+ end
406
+ end
407
+
362
408
  class Bond < Dry::Struct
363
409
  attribute :id, Types::Integer
364
410
  attribute :description, Types::String
@@ -421,24 +467,9 @@ module DdbRuby
421
467
  end
422
468
  end
423
469
 
424
- module Name
425
- Ammunition = "Ammunition"
426
- Finesse = "Finesse"
427
- GolgariSwarm = "Golgari Swarm"
428
- Heavy = "Heavy"
429
- Light = "Light"
430
- Loading = "Loading"
431
- Range = "Range"
432
- Reach = "Reach"
433
- SelesnyaConclave = "Selesnya Conclave"
434
- Thrown = "Thrown"
435
- TwoHanded = "Two-Handed"
436
- Versatile = "Versatile"
437
- end
438
-
439
470
  class Organization < Dry::Struct
440
471
  attribute :id, Types::Integer
441
- attribute :organization_name, Types::Name
472
+ attribute :organization_name, Types::String
442
473
  attribute :description, Types::String
443
474
  attribute :notes, Types::String.optional.optional
444
475
 
@@ -501,7 +532,7 @@ module DdbRuby
501
532
  end
502
533
  end
503
534
 
504
- class CharacteristicsBackgroundClass < Dry::Struct
535
+ class BackgroundDefinition < Dry::Struct
505
536
  attribute :id, Types::Integer
506
537
  attribute :entity_type_id, Types::Integer
507
538
  attribute :definition_key, Types::String
@@ -613,58 +644,9 @@ module DdbRuby
613
644
  end
614
645
  end
615
646
 
616
- class CustomBackground < Dry::Struct
617
- attribute :id, Types::Integer
618
- attribute :entity_type_id, Types::Integer
619
- attribute :custom_background_name, Types::String.optional
620
- attribute :description, Types::Nil
621
- attribute :features_background, CharacteristicsBackgroundClass.optional
622
- attribute :characteristics_background, CharacteristicsBackgroundClass.optional
623
- attribute :features_background_definition_id, Types::Nil
624
- attribute :characteristics_background_definition_id, Types::Nil
625
- attribute :background_type, Types::Integer.optional
626
-
627
- def self.from_dynamic!(d)
628
- d = Types::Hash[d]
629
- new(
630
- id: d.fetch("id"),
631
- entity_type_id: d.fetch("entityTypeId"),
632
- custom_background_name: d.fetch("name"),
633
- description: d.fetch("description"),
634
- features_background: d.fetch("featuresBackground") ? CharacteristicsBackgroundClass.from_dynamic!(d.fetch("featuresBackground")) : nil,
635
- characteristics_background: d.fetch("characteristicsBackground") ? CharacteristicsBackgroundClass.from_dynamic!(d.fetch("characteristicsBackground")) : nil,
636
- features_background_definition_id: d.fetch("featuresBackgroundDefinitionId"),
637
- characteristics_background_definition_id: d.fetch("characteristicsBackgroundDefinitionId"),
638
- background_type: d.fetch("backgroundType"),
639
- )
640
- end
641
-
642
- def self.from_json!(json)
643
- from_dynamic!(JSON.parse(json))
644
- end
645
-
646
- def to_dynamic
647
- {
648
- "id" => id,
649
- "entityTypeId" => entity_type_id,
650
- "name" => custom_background_name,
651
- "description" => description,
652
- "featuresBackground" => features_background&.to_dynamic,
653
- "characteristicsBackground" => characteristics_background&.to_dynamic,
654
- "featuresBackgroundDefinitionId" => features_background_definition_id,
655
- "characteristicsBackgroundDefinitionId" => characteristics_background_definition_id,
656
- "backgroundType" => background_type,
657
- }
658
- end
659
-
660
- def to_json(options = nil)
661
- JSON.generate(to_dynamic, options)
662
- end
663
- end
664
-
665
647
  class CharacterBackground < Dry::Struct
666
648
  attribute :has_custom_background, Types::Bool
667
- attribute :definition, CharacteristicsBackgroundClass.optional
649
+ attribute :definition, BackgroundDefinition.optional
668
650
  attribute :definition_id, Types::Nil
669
651
  attribute :custom_background, CustomBackground
670
652
 
@@ -672,7 +654,7 @@ module DdbRuby
672
654
  d = Types::Hash[d]
673
655
  new(
674
656
  has_custom_background: d.fetch("hasCustomBackground"),
675
- definition: d.fetch("definition") ? CharacteristicsBackgroundClass.from_dynamic!(d.fetch("definition")) : nil,
657
+ definition: d.fetch("definition") ? BackgroundDefinition.from_dynamic!(d.fetch("definition")) : nil,
676
658
  definition_id: d.fetch("definitionId"),
677
659
  custom_background: CustomBackground.from_dynamic!(d.fetch("customBackground")),
678
660
  )
@@ -696,7 +678,7 @@ module DdbRuby
696
678
  end
697
679
  end
698
680
 
699
- class Stat < Dry::Struct
681
+ class BonusStatElement < Dry::Struct
700
682
  attribute :id, Types::Integer
701
683
  attribute :stat_name, Types::Nil
702
684
  attribute :value, Types::Integer.optional
@@ -778,7 +760,6 @@ module DdbRuby
778
760
 
779
761
  module Username
780
762
  Afstanton = "afstanton"
781
- HXcMike = "hXcMike"
782
763
  Trillianh85 = "trillianh85"
783
764
  end
784
765
 
@@ -1185,7 +1166,7 @@ module DdbRuby
1185
1166
  class HigherLevelDefinition < Dry::Struct
1186
1167
  attribute :level, Types::Integer.optional
1187
1168
  attribute :type_id, Types::Integer
1188
- attribute :dice, Die.optional
1169
+ attribute :dice, HitPointDice.optional
1189
1170
  attribute :value, Types::Integer.optional
1190
1171
  attribute :details, Types::String
1191
1172
 
@@ -1194,7 +1175,7 @@ module DdbRuby
1194
1175
  new(
1195
1176
  level: d.fetch("level"),
1196
1177
  type_id: d.fetch("typeId"),
1197
- dice: d.fetch("dice") ? Die.from_dynamic!(d.fetch("dice")) : nil,
1178
+ dice: d.fetch("dice") ? HitPointDice.from_dynamic!(d.fetch("dice")) : nil,
1198
1179
  value: d.fetch("value"),
1199
1180
  details: d.fetch("details"),
1200
1181
  )
@@ -1269,14 +1250,15 @@ module DdbRuby
1269
1250
  end
1270
1251
 
1271
1252
  module DurationUnit
1272
- Day = "Day"
1273
- Hour = "Hour"
1274
- Minute = "Minute"
1275
- Round = "Round"
1276
- Special = "Special"
1253
+ Day = "Day"
1254
+ Hour = "Hour"
1255
+ Minute = "Minute"
1256
+ Round = "Round"
1257
+ Special = "Special"
1258
+ UntilDispelled = "UntilDispelled"
1277
1259
  end
1278
1260
 
1279
- class DefinitionCondition < Dry::Struct
1261
+ class Condition < Dry::Struct
1280
1262
  attribute :condition_type, Types::Integer
1281
1263
  attribute :condition_id, Types::Integer
1282
1264
  attribute :condition_duration, Types::Integer
@@ -1314,9 +1296,12 @@ module DdbRuby
1314
1296
  end
1315
1297
 
1316
1298
  module DurationType
1317
- Concentration = "Concentration"
1318
- Instantaneous = "Instantaneous"
1319
- Time = "Time"
1299
+ Concentration = "Concentration"
1300
+ Instantaneous = "Instantaneous"
1301
+ Special = "Special"
1302
+ Time = "Time"
1303
+ UntilDispelled = "Until Dispelled"
1304
+ UntilDispelledOrTriggered = "Until Dispelled or Triggered"
1320
1305
  end
1321
1306
 
1322
1307
  class DefinitionDuration < Dry::Struct
@@ -1365,11 +1350,13 @@ module DdbRuby
1365
1350
  Proficiency = "proficiency"
1366
1351
  Protection = "protection"
1367
1352
  Resistance = "resistance"
1353
+ Sense = "sense"
1368
1354
  Set = "set"
1369
1355
  SetBase = "set-base"
1370
1356
  Size = "size"
1371
1357
  StealthDisadvantage = "stealth-disadvantage"
1372
1358
  Vulnerability = "vulnerability"
1359
+ WeaponProperty = "weapon-property"
1373
1360
  end
1374
1361
 
1375
1362
  class BackgroundDuration < Dry::Struct
@@ -1415,11 +1402,13 @@ module DdbRuby
1415
1402
  Proficiency = "Proficiency"
1416
1403
  Protection = "Protection"
1417
1404
  Resistance = "Resistance"
1405
+ Sense = "Sense"
1418
1406
  Set = "Set"
1419
1407
  SetBase = "Set Base"
1420
1408
  Size = "Size"
1421
1409
  StealthDisadvantage = "Stealth Disadvantage"
1422
1410
  Vulnerability = "Vulnerability"
1411
+ WeaponProperty = "Weapon Property"
1423
1412
  end
1424
1413
 
1425
1414
  class ItemElement < Dry::Struct
@@ -1429,7 +1418,7 @@ module DdbRuby
1429
1418
  attribute :entity_type_id, Types::Integer.optional
1430
1419
  attribute :background_type, Types::BackgroundType
1431
1420
  attribute :sub_type, Types::String
1432
- attribute :dice, Die.optional
1421
+ attribute :dice, HitPointDice.optional
1433
1422
  attribute :restriction, Types::String.optional
1434
1423
  attribute :stat_id, Types::Integer.optional
1435
1424
  attribute :requires_attunement, Types::Bool
@@ -1444,7 +1433,7 @@ module DdbRuby
1444
1433
  attribute :modifier_sub_type_id, Types::Integer
1445
1434
  attribute :component_id, Types::Integer
1446
1435
  attribute :component_type_id, Types::Integer
1447
- attribute :die, Die.optional
1436
+ attribute :die, HitPointDice.optional
1448
1437
  attribute :count, Types::Integer.optional
1449
1438
  attribute :duration_unit, Types::Nil.optional
1450
1439
  attribute :use_primary_stat, Types::Bool.optional
@@ -1459,7 +1448,7 @@ module DdbRuby
1459
1448
  entity_type_id: d.fetch("entityTypeId"),
1460
1449
  background_type: d.fetch("type"),
1461
1450
  sub_type: d.fetch("subType"),
1462
- dice: d.fetch("dice") ? Die.from_dynamic!(d.fetch("dice")) : nil,
1451
+ dice: d.fetch("dice") ? HitPointDice.from_dynamic!(d.fetch("dice")) : nil,
1463
1452
  restriction: d.fetch("restriction"),
1464
1453
  stat_id: d.fetch("statId"),
1465
1454
  requires_attunement: d.fetch("requiresAttunement"),
@@ -1474,7 +1463,7 @@ module DdbRuby
1474
1463
  modifier_sub_type_id: d.fetch("modifierSubTypeId"),
1475
1464
  component_id: d.fetch("componentId"),
1476
1465
  component_type_id: d.fetch("componentTypeId"),
1477
- die: d["die"] ? Die.from_dynamic!(d["die"]) : nil,
1466
+ die: d["die"] ? HitPointDice.from_dynamic!(d["die"]) : nil,
1478
1467
  count: d["count"],
1479
1468
  duration_unit: d["durationUnit"],
1480
1469
  use_primary_stat: d["usePrimaryStat"],
@@ -1523,19 +1512,21 @@ module DdbRuby
1523
1512
  end
1524
1513
 
1525
1514
  module AoeType
1526
- Cone = "Cone"
1527
- Cube = "Cube"
1528
- Cylinder = "Cylinder"
1529
- Line = "Line"
1530
- Sphere = "Sphere"
1531
- Square = "Square"
1515
+ Cone = "Cone"
1516
+ Cube = "Cube"
1517
+ Cylinder = "Cylinder"
1518
+ Line = "Line"
1519
+ Sphere = "Sphere"
1520
+ Square = "Square"
1521
+ SquareFeet = "Square Feet"
1532
1522
  end
1533
1523
 
1534
1524
  module Origin
1535
- Ranged = "Ranged"
1536
- Self = "Self"
1537
- Sight = "Sight"
1538
- Touch = "Touch"
1525
+ Ranged = "Ranged"
1526
+ Self = "Self"
1527
+ Sight = "Sight"
1528
+ Touch = "Touch"
1529
+ Unlimited = "Unlimited"
1539
1530
  end
1540
1531
 
1541
1532
  class DefinitionRange < Dry::Struct
@@ -1589,6 +1580,34 @@ module DdbRuby
1589
1580
  Transmutation = "Transmutation"
1590
1581
  end
1591
1582
 
1583
+ module Tag
1584
+ Banishment = "Banishment"
1585
+ Buff = "Buff"
1586
+ Charmed = "Charmed"
1587
+ Combat = "Combat"
1588
+ Communication = "Communication"
1589
+ Compulsion = "Compulsion"
1590
+ Control = "Control"
1591
+ Creation = "Creation"
1592
+ Damage = "Damage"
1593
+ Debuff = "Debuff"
1594
+ Deception = "Deception"
1595
+ Detection = "Detection"
1596
+ Environment = "Environment"
1597
+ Exploration = "Exploration"
1598
+ Foreknowledge = "Foreknowledge"
1599
+ Healing = "Healing"
1600
+ Movement = "Movement"
1601
+ Negation = "Negation"
1602
+ Scrying = "Scrying"
1603
+ Shapechanging = "Shapechanging"
1604
+ Social = "Social"
1605
+ Summoning = "Summoning"
1606
+ Teleportation = "Teleportation"
1607
+ Utility = "Utility"
1608
+ Warding = "Warding"
1609
+ end
1610
+
1592
1611
  class SpellDefinition < Dry::Struct
1593
1612
  attribute :id, Types::Integer
1594
1613
  attribute :definition_key, Types::String
@@ -1600,7 +1619,7 @@ module DdbRuby
1600
1619
  attribute :range, DefinitionRange
1601
1620
  attribute :as_part_of_weapon_attack, Types::Bool
1602
1621
  attribute :description, Types::String
1603
- attribute :snippet, Types::String
1622
+ attribute :snippet, Types::String.optional
1604
1623
  attribute :concentration, Types::Bool
1605
1624
  attribute :ritual, Types::Bool
1606
1625
  attribute :range_area, Types::Nil
@@ -1621,8 +1640,8 @@ module DdbRuby
1621
1640
  attribute :requires_attack_roll, Types::Bool
1622
1641
  attribute :at_higher_levels, AtHigherLevels
1623
1642
  attribute :modifiers, Types.Array(ItemElement)
1624
- attribute :conditions, Types.Array(DefinitionCondition)
1625
- attribute :tags, Types.Array(Types::String)
1643
+ attribute :conditions, Types.Array(Condition)
1644
+ attribute :tags, Types.Array(Types::Tag)
1626
1645
  attribute :casting_time_description, Types::String
1627
1646
  attribute :scale_type, Types::ScaleType.optional
1628
1647
  attribute :sources, Types.Array(Source)
@@ -1662,7 +1681,7 @@ module DdbRuby
1662
1681
  requires_attack_roll: d.fetch("requiresAttackRoll"),
1663
1682
  at_higher_levels: AtHigherLevels.from_dynamic!(d.fetch("atHigherLevels")),
1664
1683
  modifiers: d.fetch("modifiers").map { |x| ItemElement.from_dynamic!(x) },
1665
- conditions: d.fetch("conditions").map { |x| DefinitionCondition.from_dynamic!(x) },
1684
+ conditions: d.fetch("conditions").map { |x| Condition.from_dynamic!(x) },
1666
1685
  tags: d.fetch("tags"),
1667
1686
  casting_time_description: d.fetch("castingTimeDescription"),
1668
1687
  scale_type: d.fetch("scaleType"),
@@ -1964,7 +1983,7 @@ module DdbRuby
1964
1983
  attribute :id, Types::Integer
1965
1984
  attribute :level, Types::Integer
1966
1985
  attribute :description, Types::String
1967
- attribute :dice, Die.optional
1986
+ attribute :dice, HitPointDice.optional
1968
1987
  attribute :fixed_value, Types::Integer.optional
1969
1988
 
1970
1989
  def self.from_dynamic!(d)
@@ -1973,7 +1992,7 @@ module DdbRuby
1973
1992
  id: d.fetch("id"),
1974
1993
  level: d.fetch("level"),
1975
1994
  description: d.fetch("description"),
1976
- dice: d.fetch("dice") ? Die.from_dynamic!(d.fetch("dice")) : nil,
1995
+ dice: d.fetch("dice") ? HitPointDice.from_dynamic!(d.fetch("dice")) : nil,
1977
1996
  fixed_value: d.fetch("fixedValue"),
1978
1997
  )
1979
1998
  end
@@ -2045,7 +2064,7 @@ module DdbRuby
2045
2064
  attribute :creature_rules, Types.Array(CreatureRule)
2046
2065
  attribute :level_scales, Types.Array(LevelScale).optional
2047
2066
  attribute :infusion_rules, Types.Array(InfusionRule).optional
2048
- attribute :spell_list_ids, Types.Array(Types::Integer)
2067
+ attribute :spell_list_ids, Types.Array(Types::Any)
2049
2068
  attribute :class_id, Types::Integer.optional
2050
2069
  attribute :feature_type, Types::Integer
2051
2070
  attribute :sources, Types.Array(Source)
@@ -2350,7 +2369,7 @@ module DdbRuby
2350
2369
  attribute :sources, Types.Array(Source)
2351
2370
  attribute :class_features, Types.Array(DefinitionClassFeature)
2352
2371
  attribute :hit_dice, Types::Integer
2353
- attribute :wealth_dice, Die.optional
2372
+ attribute :wealth_dice, HitPointDice.optional
2354
2373
  attribute :can_cast_spells, Types::Bool
2355
2374
  attribute :knows_all_spells, Types::Bool.optional
2356
2375
  attribute :spell_prepare_type, Types::Integer.optional
@@ -2379,7 +2398,7 @@ module DdbRuby
2379
2398
  sources: d.fetch("sources").map { |x| Source.from_dynamic!(x) },
2380
2399
  class_features: d.fetch("classFeatures").map { |x| DefinitionClassFeature.from_dynamic!(x) },
2381
2400
  hit_dice: d.fetch("hitDice"),
2382
- wealth_dice: d.fetch("wealthDice") ? Die.from_dynamic!(d.fetch("wealthDice")) : nil,
2401
+ wealth_dice: d.fetch("wealthDice") ? HitPointDice.from_dynamic!(d.fetch("wealthDice")) : nil,
2383
2402
  can_cast_spells: d.fetch("canCastSpells"),
2384
2403
  knows_all_spells: d.fetch("knowsAllSpells"),
2385
2404
  spell_prepare_type: d.fetch("spellPrepareType"),
@@ -2484,15 +2503,17 @@ module DdbRuby
2484
2503
  end
2485
2504
  end
2486
2505
 
2487
- class CharacterCondition < Dry::Struct
2488
- attribute :id, Types::Integer
2489
- attribute :level, Types::Integer
2506
+ class Configuration < Dry::Struct
2507
+ attribute :starting_equipment_type, Types::Integer.optional
2508
+ attribute :ability_score_type, Types::Integer.optional
2509
+ attribute :show_help_text, Types::Bool
2490
2510
 
2491
2511
  def self.from_dynamic!(d)
2492
2512
  d = Types::Hash[d]
2493
2513
  new(
2494
- id: d.fetch("id"),
2495
- level: d.fetch("level"),
2514
+ starting_equipment_type: d.fetch("startingEquipmentType"),
2515
+ ability_score_type: d.fetch("abilityScoreType"),
2516
+ show_help_text: d.fetch("showHelpText"),
2496
2517
  )
2497
2518
  end
2498
2519
 
@@ -2502,8 +2523,9 @@ module DdbRuby
2502
2523
 
2503
2524
  def to_dynamic
2504
2525
  {
2505
- "id" => id,
2506
- "level" => level,
2526
+ "startingEquipmentType" => starting_equipment_type,
2527
+ "abilityScoreType" => ability_score_type,
2528
+ "showHelpText" => show_help_text,
2507
2529
  }
2508
2530
  end
2509
2531
 
@@ -2512,17 +2534,15 @@ module DdbRuby
2512
2534
  end
2513
2535
  end
2514
2536
 
2515
- class Configuration < Dry::Struct
2516
- attribute :starting_equipment_type, Types::Integer.optional
2517
- attribute :ability_score_type, Types::Integer.optional
2518
- attribute :show_help_text, Types::Bool
2537
+ class Language < Dry::Struct
2538
+ attribute :language_id, Types::Integer
2539
+ attribute :notes, Types::String
2519
2540
 
2520
2541
  def self.from_dynamic!(d)
2521
2542
  d = Types::Hash[d]
2522
2543
  new(
2523
- starting_equipment_type: d.fetch("startingEquipmentType"),
2524
- ability_score_type: d.fetch("abilityScoreType"),
2525
- show_help_text: d.fetch("showHelpText"),
2544
+ language_id: d.fetch("languageId"),
2545
+ notes: d.fetch("notes"),
2526
2546
  )
2527
2547
  end
2528
2548
 
@@ -2532,9 +2552,369 @@ module DdbRuby
2532
2552
 
2533
2553
  def to_dynamic
2534
2554
  {
2535
- "startingEquipmentType" => starting_equipment_type,
2536
- "abilityScoreType" => ability_score_type,
2537
- "showHelpText" => show_help_text,
2555
+ "languageId" => language_id,
2556
+ "notes" => notes,
2557
+ }
2558
+ end
2559
+
2560
+ def to_json(options = nil)
2561
+ JSON.generate(to_dynamic, options)
2562
+ end
2563
+ end
2564
+
2565
+ class Movement < Dry::Struct
2566
+ attribute :movement_id, Types::Integer
2567
+ attribute :speed, Types::Integer
2568
+ attribute :notes, Types::Nil
2569
+
2570
+ def self.from_dynamic!(d)
2571
+ d = Types::Hash[d]
2572
+ new(
2573
+ movement_id: d.fetch("movementId"),
2574
+ speed: d.fetch("speed"),
2575
+ notes: d.fetch("notes"),
2576
+ )
2577
+ end
2578
+
2579
+ def self.from_json!(json)
2580
+ from_dynamic!(JSON.parse(json))
2581
+ end
2582
+
2583
+ def to_dynamic
2584
+ {
2585
+ "movementId" => movement_id,
2586
+ "speed" => speed,
2587
+ "notes" => notes,
2588
+ }
2589
+ end
2590
+
2591
+ def to_json(options = nil)
2592
+ JSON.generate(to_dynamic, options)
2593
+ end
2594
+ end
2595
+
2596
+ class SavingThrow < Dry::Struct
2597
+ attribute :stat_id, Types::Integer
2598
+ attribute :bonus_modifier, Types::Nil
2599
+
2600
+ def self.from_dynamic!(d)
2601
+ d = Types::Hash[d]
2602
+ new(
2603
+ stat_id: d.fetch("statId"),
2604
+ bonus_modifier: d.fetch("bonusModifier"),
2605
+ )
2606
+ end
2607
+
2608
+ def self.from_json!(json)
2609
+ from_dynamic!(JSON.parse(json))
2610
+ end
2611
+
2612
+ def to_dynamic
2613
+ {
2614
+ "statId" => stat_id,
2615
+ "bonusModifier" => bonus_modifier,
2616
+ }
2617
+ end
2618
+
2619
+ def to_json(options = nil)
2620
+ JSON.generate(to_dynamic, options)
2621
+ end
2622
+ end
2623
+
2624
+ class Sense < Dry::Struct
2625
+ attribute :sense_id, Types::Integer
2626
+ attribute :notes, Types::String
2627
+
2628
+ def self.from_dynamic!(d)
2629
+ d = Types::Hash[d]
2630
+ new(
2631
+ sense_id: d.fetch("senseId"),
2632
+ notes: d.fetch("notes"),
2633
+ )
2634
+ end
2635
+
2636
+ def self.from_json!(json)
2637
+ from_dynamic!(JSON.parse(json))
2638
+ end
2639
+
2640
+ def to_dynamic
2641
+ {
2642
+ "senseId" => sense_id,
2643
+ "notes" => notes,
2644
+ }
2645
+ end
2646
+
2647
+ def to_json(options = nil)
2648
+ JSON.generate(to_dynamic, options)
2649
+ end
2650
+ end
2651
+
2652
+ class Skill < Dry::Struct
2653
+ attribute :skill_id, Types::Integer
2654
+ attribute :value, Types::Integer
2655
+ attribute :additional_bonus, Types::Nil
2656
+
2657
+ def self.from_dynamic!(d)
2658
+ d = Types::Hash[d]
2659
+ new(
2660
+ skill_id: d.fetch("skillId"),
2661
+ value: d.fetch("value"),
2662
+ additional_bonus: d.fetch("additionalBonus"),
2663
+ )
2664
+ end
2665
+
2666
+ def self.from_json!(json)
2667
+ from_dynamic!(JSON.parse(json))
2668
+ end
2669
+
2670
+ def to_dynamic
2671
+ {
2672
+ "skillId" => skill_id,
2673
+ "value" => value,
2674
+ "additionalBonus" => additional_bonus,
2675
+ }
2676
+ end
2677
+
2678
+ def to_json(options = nil)
2679
+ JSON.generate(to_dynamic, options)
2680
+ end
2681
+ end
2682
+
2683
+ class DefinitionStat < Dry::Struct
2684
+ attribute :stat_id, Types::Integer
2685
+ attribute :stat_name, Types::Nil
2686
+ attribute :value, Types::Integer
2687
+
2688
+ def self.from_dynamic!(d)
2689
+ d = Types::Hash[d]
2690
+ new(
2691
+ stat_id: d.fetch("statId"),
2692
+ stat_name: d.fetch("name"),
2693
+ value: d.fetch("value"),
2694
+ )
2695
+ end
2696
+
2697
+ def self.from_json!(json)
2698
+ from_dynamic!(JSON.parse(json))
2699
+ end
2700
+
2701
+ def to_dynamic
2702
+ {
2703
+ "statId" => stat_id,
2704
+ "name" => stat_name,
2705
+ "value" => value,
2706
+ }
2707
+ end
2708
+
2709
+ def to_json(options = nil)
2710
+ JSON.generate(to_dynamic, options)
2711
+ end
2712
+ end
2713
+
2714
+ class CreatureDefinition < Dry::Struct
2715
+ attribute :id, Types::Integer
2716
+ attribute :entity_type_id, Types::Integer
2717
+ attribute :definition_name, Types::String
2718
+ attribute :alignment_id, Types::Integer
2719
+ attribute :size_id, Types::Integer
2720
+ attribute :type_id, Types::Integer
2721
+ attribute :armor_class, Types::Integer
2722
+ attribute :armor_class_description, Types::String
2723
+ attribute :average_hit_points, Types::Integer
2724
+ attribute :hit_point_dice, HitPointDice
2725
+ attribute :movements, Types.Array(Movement)
2726
+ attribute :passive_perception, Types::Integer
2727
+ attribute :is_homebrew, Types::Bool
2728
+ attribute :challenge_rating_id, Types::Integer
2729
+ attribute :source_id, Types::Integer
2730
+ attribute :source_page_number, Types::Integer
2731
+ attribute :is_legendary, Types::Bool
2732
+ attribute :is_mythic, Types::Bool
2733
+ attribute :has_lair, Types::Bool
2734
+ attribute :avatar_url, Types::String
2735
+ attribute :large_avatar_url, Types::String
2736
+ attribute :basic_avatar_url, Types::String
2737
+ attribute :version, Types::Nil
2738
+ attribute :swarm, Types::Nil
2739
+ attribute :sub_types, Types.Array(Types::Integer)
2740
+ attribute :environments, Types.Array(Types::Any)
2741
+ attribute :tags, Types.Array(Types::Any)
2742
+ attribute :sources, Types.Array(Source)
2743
+ attribute :stats, Types.Array(DefinitionStat)
2744
+ attribute :senses, Types.Array(Sense)
2745
+ attribute :damage_adjustments, Types.Array(Types::Integer)
2746
+ attribute :condition_immunities, Types.Array(Types::Integer)
2747
+ attribute :saving_throws, Types.Array(SavingThrow)
2748
+ attribute :skills, Types.Array(Skill)
2749
+ attribute :languages, Types.Array(Language)
2750
+ attribute :special_traits_description, Types::String
2751
+ attribute :actions_description, Types::String
2752
+ attribute :reactions_description, Types::String
2753
+ attribute :legendary_actions_description, Types::String
2754
+ attribute :mythic_actions_description, Types::Nil
2755
+ attribute :bonus_actions_description, Types::Nil
2756
+ attribute :characteristics_description, Types::String
2757
+ attribute :lair_description, Types::String
2758
+ attribute :language_description, Types::Nil
2759
+ attribute :language_note, Types::String
2760
+ attribute :hide_cr, Types::Bool
2761
+ attribute :is_legacy, Types::Bool
2762
+
2763
+ def self.from_dynamic!(d)
2764
+ d = Types::Hash[d]
2765
+ new(
2766
+ id: d.fetch("id"),
2767
+ entity_type_id: d.fetch("entityTypeId"),
2768
+ definition_name: d.fetch("name"),
2769
+ alignment_id: d.fetch("alignmentId"),
2770
+ size_id: d.fetch("sizeId"),
2771
+ type_id: d.fetch("typeId"),
2772
+ armor_class: d.fetch("armorClass"),
2773
+ armor_class_description: d.fetch("armorClassDescription"),
2774
+ average_hit_points: d.fetch("averageHitPoints"),
2775
+ hit_point_dice: HitPointDice.from_dynamic!(d.fetch("hitPointDice")),
2776
+ movements: d.fetch("movements").map { |x| Movement.from_dynamic!(x) },
2777
+ passive_perception: d.fetch("passivePerception"),
2778
+ is_homebrew: d.fetch("isHomebrew"),
2779
+ challenge_rating_id: d.fetch("challengeRatingId"),
2780
+ source_id: d.fetch("sourceId"),
2781
+ source_page_number: d.fetch("sourcePageNumber"),
2782
+ is_legendary: d.fetch("isLegendary"),
2783
+ is_mythic: d.fetch("isMythic"),
2784
+ has_lair: d.fetch("hasLair"),
2785
+ avatar_url: d.fetch("avatarUrl"),
2786
+ large_avatar_url: d.fetch("largeAvatarUrl"),
2787
+ basic_avatar_url: d.fetch("basicAvatarUrl"),
2788
+ version: d.fetch("version"),
2789
+ swarm: d.fetch("swarm"),
2790
+ sub_types: d.fetch("subTypes"),
2791
+ environments: d.fetch("environments"),
2792
+ tags: d.fetch("tags"),
2793
+ sources: d.fetch("sources").map { |x| Source.from_dynamic!(x) },
2794
+ stats: d.fetch("stats").map { |x| DefinitionStat.from_dynamic!(x) },
2795
+ senses: d.fetch("senses").map { |x| Sense.from_dynamic!(x) },
2796
+ damage_adjustments: d.fetch("damageAdjustments"),
2797
+ condition_immunities: d.fetch("conditionImmunities"),
2798
+ saving_throws: d.fetch("savingThrows").map { |x| SavingThrow.from_dynamic!(x) },
2799
+ skills: d.fetch("skills").map { |x| Skill.from_dynamic!(x) },
2800
+ languages: d.fetch("languages").map { |x| Language.from_dynamic!(x) },
2801
+ special_traits_description: d.fetch("specialTraitsDescription"),
2802
+ actions_description: d.fetch("actionsDescription"),
2803
+ reactions_description: d.fetch("reactionsDescription"),
2804
+ legendary_actions_description: d.fetch("legendaryActionsDescription"),
2805
+ mythic_actions_description: d.fetch("mythicActionsDescription"),
2806
+ bonus_actions_description: d.fetch("bonusActionsDescription"),
2807
+ characteristics_description: d.fetch("characteristicsDescription"),
2808
+ lair_description: d.fetch("lairDescription"),
2809
+ language_description: d.fetch("languageDescription"),
2810
+ language_note: d.fetch("languageNote"),
2811
+ hide_cr: d.fetch("hideCr"),
2812
+ is_legacy: d.fetch("isLegacy"),
2813
+ )
2814
+ end
2815
+
2816
+ def self.from_json!(json)
2817
+ from_dynamic!(JSON.parse(json))
2818
+ end
2819
+
2820
+ def to_dynamic
2821
+ {
2822
+ "id" => id,
2823
+ "entityTypeId" => entity_type_id,
2824
+ "name" => definition_name,
2825
+ "alignmentId" => alignment_id,
2826
+ "sizeId" => size_id,
2827
+ "typeId" => type_id,
2828
+ "armorClass" => armor_class,
2829
+ "armorClassDescription" => armor_class_description,
2830
+ "averageHitPoints" => average_hit_points,
2831
+ "hitPointDice" => hit_point_dice.to_dynamic,
2832
+ "movements" => movements.map { |x| x.to_dynamic },
2833
+ "passivePerception" => passive_perception,
2834
+ "isHomebrew" => is_homebrew,
2835
+ "challengeRatingId" => challenge_rating_id,
2836
+ "sourceId" => source_id,
2837
+ "sourcePageNumber" => source_page_number,
2838
+ "isLegendary" => is_legendary,
2839
+ "isMythic" => is_mythic,
2840
+ "hasLair" => has_lair,
2841
+ "avatarUrl" => avatar_url,
2842
+ "largeAvatarUrl" => large_avatar_url,
2843
+ "basicAvatarUrl" => basic_avatar_url,
2844
+ "version" => version,
2845
+ "swarm" => swarm,
2846
+ "subTypes" => sub_types,
2847
+ "environments" => environments,
2848
+ "tags" => tags,
2849
+ "sources" => sources.map { |x| x.to_dynamic },
2850
+ "stats" => stats.map { |x| x.to_dynamic },
2851
+ "senses" => senses.map { |x| x.to_dynamic },
2852
+ "damageAdjustments" => damage_adjustments,
2853
+ "conditionImmunities" => condition_immunities,
2854
+ "savingThrows" => saving_throws.map { |x| x.to_dynamic },
2855
+ "skills" => skills.map { |x| x.to_dynamic },
2856
+ "languages" => languages.map { |x| x.to_dynamic },
2857
+ "specialTraitsDescription" => special_traits_description,
2858
+ "actionsDescription" => actions_description,
2859
+ "reactionsDescription" => reactions_description,
2860
+ "legendaryActionsDescription" => legendary_actions_description,
2861
+ "mythicActionsDescription" => mythic_actions_description,
2862
+ "bonusActionsDescription" => bonus_actions_description,
2863
+ "characteristicsDescription" => characteristics_description,
2864
+ "lairDescription" => lair_description,
2865
+ "languageDescription" => language_description,
2866
+ "languageNote" => language_note,
2867
+ "hideCr" => hide_cr,
2868
+ "isLegacy" => is_legacy,
2869
+ }
2870
+ end
2871
+
2872
+ def to_json(options = nil)
2873
+ JSON.generate(to_dynamic, options)
2874
+ end
2875
+ end
2876
+
2877
+ class Creature < Dry::Struct
2878
+ attribute :id, Types::Integer
2879
+ attribute :entity_type_id, Types::Integer
2880
+ attribute :creature_name, Types::Nil
2881
+ attribute :description, Types::Nil
2882
+ attribute :is_active, Types::Bool
2883
+ attribute :removed_hit_points, Types::Integer
2884
+ attribute :temporary_hit_points, Types::Nil
2885
+ attribute :group_id, Types::Integer
2886
+ attribute :definition, CreatureDefinition
2887
+
2888
+ def self.from_dynamic!(d)
2889
+ d = Types::Hash[d]
2890
+ new(
2891
+ id: d.fetch("id"),
2892
+ entity_type_id: d.fetch("entityTypeId"),
2893
+ creature_name: d.fetch("name"),
2894
+ description: d.fetch("description"),
2895
+ is_active: d.fetch("isActive"),
2896
+ removed_hit_points: d.fetch("removedHitPoints"),
2897
+ temporary_hit_points: d.fetch("temporaryHitPoints"),
2898
+ group_id: d.fetch("groupId"),
2899
+ definition: CreatureDefinition.from_dynamic!(d.fetch("definition")),
2900
+ )
2901
+ end
2902
+
2903
+ def self.from_json!(json)
2904
+ from_dynamic!(JSON.parse(json))
2905
+ end
2906
+
2907
+ def to_dynamic
2908
+ {
2909
+ "id" => id,
2910
+ "entityTypeId" => entity_type_id,
2911
+ "name" => creature_name,
2912
+ "description" => description,
2913
+ "isActive" => is_active,
2914
+ "removedHitPoints" => removed_hit_points,
2915
+ "temporaryHitPoints" => temporary_hit_points,
2916
+ "groupId" => group_id,
2917
+ "definition" => definition.to_dynamic,
2538
2918
  }
2539
2919
  end
2540
2920
 
@@ -2583,7 +2963,7 @@ module DdbRuby
2583
2963
  class CustomItem < Dry::Struct
2584
2964
  attribute :id, Types::Integer
2585
2965
  attribute :custom_item_name, Types::String
2586
- attribute :description, Types::String.optional
2966
+ attribute :description, Types::String
2587
2967
  attribute :weight, Types::Integer.optional
2588
2968
  attribute :cost, Types::Nil
2589
2969
  attribute :quantity, Types::Integer
@@ -2883,7 +3263,7 @@ module DdbRuby
2883
3263
  end
2884
3264
  end
2885
3265
 
2886
- class Feat < Dry::Struct
3266
+ class CharacterFeat < Dry::Struct
2887
3267
  attribute :component_type_id, Types::Integer
2888
3268
  attribute :component_id, Types::Integer
2889
3269
  attribute :definition, Definition1
@@ -2917,14 +3297,6 @@ module DdbRuby
2917
3297
  end
2918
3298
  end
2919
3299
 
2920
- module AttunementDescription
2921
- DruidOrRanger = "druid or ranger"
2922
- Empty = ""
2923
- Spellcaster = "Spellcaster"
2924
- Warlock = "Warlock"
2925
- Wizard = "wizard"
2926
- end
2927
-
2928
3300
  module DamageType
2929
3301
  Bludgeoning = "Bludgeoning"
2930
3302
  Piercing = "Piercing"
@@ -2937,54 +3309,30 @@ module DdbRuby
2937
3309
  Potion = "Potion"
2938
3310
  Ring = "Ring"
2939
3311
  Rod = "Rod"
3312
+ Staff = "Staff"
2940
3313
  Wand = "Wand"
2941
3314
  Weapon = "Weapon"
2942
3315
  WondrousItem = "Wondrous item"
2943
3316
  end
2944
3317
 
2945
3318
  module Rarity
2946
- Common = "Common"
2947
- Rare = "Rare"
2948
- Uncommon = "Uncommon"
2949
- VeryRare = "Very Rare"
3319
+ Artifact = "Artifact"
3320
+ Common = "Common"
3321
+ Legendary = "Legendary"
3322
+ Rare = "Rare"
3323
+ Uncommon = "Uncommon"
3324
+ VeryRare = "Very Rare"
2950
3325
  end
2951
3326
 
2952
3327
  module SubType
2953
3328
  AdventuringGear = "Adventuring Gear"
2954
3329
  Ammunition = "Ammunition"
2955
3330
  ArcaneFocus = "Arcane Focus"
2956
- DruidicFocus = "Druidic Focus"
2957
3331
  HolySymbol = "Holy Symbol"
2958
3332
  Potion = "Potion"
2959
3333
  Tool = "Tool"
2960
3334
  end
2961
3335
 
2962
- module Tag
2963
- Buff = "Buff"
2964
- Combat = "Combat"
2965
- Communication = "Communication"
2966
- Consumable = "Consumable"
2967
- Container = "Container"
2968
- Control = "Control"
2969
- Creation = "Creation"
2970
- Damage = "Damage"
2971
- Deception = "Deception"
2972
- Detection = "Detection"
2973
- Exploration = "Exploration"
2974
- Eyewear = "Eyewear"
2975
- Focus = "Focus"
2976
- Handwear = "Handwear"
2977
- Headwear = "Headwear"
2978
- Healing = "Healing"
2979
- Instrument = "Instrument"
2980
- Jewelry = "Jewelry"
2981
- Movement = "Movement"
2982
- Outerwear = "Outerwear"
2983
- Social = "Social"
2984
- Utility = "Utility"
2985
- Warding = "Warding"
2986
- end
2987
-
2988
3336
  class WeaponBehavior < Dry::Struct
2989
3337
  attribute :base_item_id, Types::Integer
2990
3338
  attribute :base_type_id, Types::Integer
@@ -2992,7 +3340,7 @@ module DdbRuby
2992
3340
  attribute :attack_type, Types::Integer
2993
3341
  attribute :category_id, Types::Integer
2994
3342
  attribute :properties, Types.Array(Organization)
2995
- attribute :damage, Die
3343
+ attribute :damage, HitPointDice
2996
3344
  attribute :damage_type, Types::DamageType
2997
3345
  attribute :range, Types::Integer
2998
3346
  attribute :long_range, Types::Integer
@@ -3007,7 +3355,7 @@ module DdbRuby
3007
3355
  attack_type: d.fetch("attackType"),
3008
3356
  category_id: d.fetch("categoryId"),
3009
3357
  properties: d.fetch("properties").map { |x| Organization.from_dynamic!(x) },
3010
- damage: Die.from_dynamic!(d.fetch("damage")),
3358
+ damage: HitPointDice.from_dynamic!(d.fetch("damage")),
3011
3359
  damage_type: d.fetch("damageType"),
3012
3360
  range: d.fetch("range"),
3013
3361
  long_range: d.fetch("longRange"),
@@ -3054,9 +3402,9 @@ module DdbRuby
3054
3402
  attribute :capacity, Types::String.optional
3055
3403
  attribute :capacity_weight, Types::Integer
3056
3404
  attribute :definition_type, Types::String.optional
3057
- attribute :description, Types::String.optional
3405
+ attribute :description, Types::String
3058
3406
  attribute :can_attune, Types::Bool
3059
- attribute :attunement_description, Types::AttunementDescription.optional
3407
+ attribute :attunement_description, Types::String.optional
3060
3408
  attribute :rarity, Types::Rarity.optional
3061
3409
  attribute :is_homebrew, Types::Bool
3062
3410
  attribute :version, Types::Nil
@@ -3069,7 +3417,7 @@ module DdbRuby
3069
3417
  attribute :filter_type, Types::FilterType.optional
3070
3418
  attribute :cost, Types::Double.optional
3071
3419
  attribute :is_pack, Types::Bool
3072
- attribute :tags, Types.Array(Types::Tag)
3420
+ attribute :tags, Types.Array(Types::String)
3073
3421
  attribute :granted_modifiers, Types.Array(ItemElement)
3074
3422
  attribute :sub_type, Types::SubType.optional
3075
3423
  attribute :is_consumable, Types::Bool
@@ -3079,7 +3427,7 @@ module DdbRuby
3079
3427
  attribute :strength_requirement, Types::Integer.optional
3080
3428
  attribute :armor_class, Types::Integer.optional
3081
3429
  attribute :stealth_check, Types::Integer.optional
3082
- attribute :damage, Die.optional
3430
+ attribute :damage, HitPointDice.optional
3083
3431
  attribute :damage_type, Types::DamageType.optional
3084
3432
  attribute :fixed_damage, Types::Nil
3085
3433
  attribute :properties, Types.Array(Organization).optional
@@ -3138,7 +3486,7 @@ module DdbRuby
3138
3486
  strength_requirement: d.fetch("strengthRequirement"),
3139
3487
  armor_class: d.fetch("armorClass"),
3140
3488
  stealth_check: d.fetch("stealthCheck"),
3141
- damage: d.fetch("damage") ? Die.from_dynamic!(d.fetch("damage")) : nil,
3489
+ damage: d.fetch("damage") ? HitPointDice.from_dynamic!(d.fetch("damage")) : nil,
3142
3490
  damage_type: d.fetch("damageType"),
3143
3491
  fixed_damage: d.fetch("fixedDamage"),
3144
3492
  properties: d.fetch("properties")&.map { |x| Organization.from_dynamic!(x) },
@@ -3375,13 +3723,13 @@ module DdbRuby
3375
3723
  end
3376
3724
 
3377
3725
  class Notes < Dry::Struct
3378
- attribute :allies, Types::Nil
3726
+ attribute :allies, Types::String.optional
3379
3727
  attribute :personal_possessions, Types::String.optional
3380
3728
  attribute :other_holdings, Types::Nil
3381
- attribute :organizations, Types::Nil
3382
- attribute :enemies, Types::Nil
3729
+ attribute :organizations, Types::String.optional
3730
+ attribute :enemies, Types::String.optional
3383
3731
  attribute :backstory, Types::String.optional
3384
- attribute :other_notes, Types::Nil
3732
+ attribute :other_notes, Types::String.optional
3385
3733
 
3386
3734
  def self.from_dynamic!(d)
3387
3735
  d = Types::Hash[d]
@@ -3729,18 +4077,11 @@ module DdbRuby
3729
4077
  end
3730
4078
 
3731
4079
  module AdditionalDescription
3732
- DoesNotRequireMaterialComponents = "does not require material components"
3733
- DoesnTRequireAnyComponents = "Doesn't require any components"
3734
- Empty = ""
3735
- TheHandIsInvisible = "the hand is invisible"
3736
- end
3737
-
3738
- module Restriction
3739
- DoesnTRequireConcentration = "Doesn't require concentration"
4080
+ DoesnTRequireAnyComponents = "Doesn't require any components"
3740
4081
  Empty = ""
3741
4082
  end
3742
4083
 
3743
- class SpellsClass < Dry::Struct
4084
+ class RaceElement < Dry::Struct
3744
4085
  attribute :override_save_dc, Types::Nil
3745
4086
  attribute :limited_use, ClassLimitedUse.optional
3746
4087
  attribute :id, Types::Integer
@@ -3752,12 +4093,12 @@ module DdbRuby
3752
4093
  attribute :uses_spell_slot, Types::Bool
3753
4094
  attribute :cast_at_level, Types::Integer.optional
3754
4095
  attribute :always_prepared, Types::Bool
3755
- attribute :restriction, Types::Restriction
3756
- attribute :spell_casting_ability_id, Types::Integer.optional
4096
+ attribute :restriction, Types::String
4097
+ attribute :spell_casting_ability_id, Types::Integer
3757
4098
  attribute :display_as_attack, Types::Nil
3758
4099
  attribute :additional_description, Types::AdditionalDescription.optional
3759
4100
  attribute :cast_only_as_ritual, Types::Bool
3760
- attribute :ritual_casting_type, Types::Integer.optional
4101
+ attribute :ritual_casting_type, Types::Nil
3761
4102
  attribute :range, DefinitionRange
3762
4103
  attribute :activation, Activation
3763
4104
  attribute :base_level_at_will, Types::Bool
@@ -3847,7 +4188,7 @@ module DdbRuby
3847
4188
  attribute :prepared, Types::Bool
3848
4189
  attribute :counts_as_known_spell, Types::Nil
3849
4190
  attribute :uses_spell_slot, Types::Bool
3850
- attribute :cast_at_level, Types::Nil
4191
+ attribute :cast_at_level, Types::Integer.optional
3851
4192
  attribute :always_prepared, Types::Bool
3852
4193
  attribute :restriction, Types::Nil
3853
4194
  attribute :spell_casting_ability_id, Types::Nil
@@ -3934,21 +4275,118 @@ module DdbRuby
3934
4275
  end
3935
4276
  end
3936
4277
 
4278
+ class SpellsClass < Dry::Struct
4279
+ attribute :override_save_dc, Types::Nil
4280
+ attribute :limited_use, ClassLimitedUse.optional
4281
+ attribute :id, Types::Integer.optional
4282
+ attribute :entity_type_id, Types::Integer.optional
4283
+ attribute :definition, SpellDefinition.optional
4284
+ attribute :definition_id, Types::Integer
4285
+ attribute :prepared, Types::Bool
4286
+ attribute :counts_as_known_spell, Types::Bool.optional
4287
+ attribute :uses_spell_slot, Types::Bool
4288
+ attribute :cast_at_level, Types::Nil
4289
+ attribute :always_prepared, Types::Bool
4290
+ attribute :restriction, Types::String.optional
4291
+ attribute :spell_casting_ability_id, Types::Nil
4292
+ attribute :display_as_attack, Types::Nil
4293
+ attribute :additional_description, Types::String.optional
4294
+ attribute :cast_only_as_ritual, Types::Bool
4295
+ attribute :ritual_casting_type, Types::Integer.optional
4296
+ attribute :range, DefinitionRange.optional
4297
+ attribute :activation, Activation.optional
4298
+ attribute :base_level_at_will, Types::Bool
4299
+ attribute :at_will_limited_use_level, Types::Nil
4300
+ attribute :is_signature_spell, Types::Nil
4301
+ attribute :component_id, Types::Integer
4302
+ attribute :component_type_id, Types::Integer
4303
+ attribute :spell_list_id, Types::Nil
4304
+
4305
+ def self.from_dynamic!(d)
4306
+ d = Types::Hash[d]
4307
+ new(
4308
+ override_save_dc: d.fetch("overrideSaveDc"),
4309
+ limited_use: d.fetch("limitedUse") ? ClassLimitedUse.from_dynamic!(d.fetch("limitedUse")) : nil,
4310
+ id: d.fetch("id"),
4311
+ entity_type_id: d.fetch("entityTypeId"),
4312
+ definition: d.fetch("definition") ? SpellDefinition.from_dynamic!(d.fetch("definition")) : nil,
4313
+ definition_id: d.fetch("definitionId"),
4314
+ prepared: d.fetch("prepared"),
4315
+ counts_as_known_spell: d.fetch("countsAsKnownSpell"),
4316
+ uses_spell_slot: d.fetch("usesSpellSlot"),
4317
+ cast_at_level: d.fetch("castAtLevel"),
4318
+ always_prepared: d.fetch("alwaysPrepared"),
4319
+ restriction: d.fetch("restriction"),
4320
+ spell_casting_ability_id: d.fetch("spellCastingAbilityId"),
4321
+ display_as_attack: d.fetch("displayAsAttack"),
4322
+ additional_description: d.fetch("additionalDescription"),
4323
+ cast_only_as_ritual: d.fetch("castOnlyAsRitual"),
4324
+ ritual_casting_type: d.fetch("ritualCastingType"),
4325
+ range: d.fetch("range") ? DefinitionRange.from_dynamic!(d.fetch("range")) : nil,
4326
+ activation: d.fetch("activation") ? Activation.from_dynamic!(d.fetch("activation")) : nil,
4327
+ base_level_at_will: d.fetch("baseLevelAtWill"),
4328
+ at_will_limited_use_level: d.fetch("atWillLimitedUseLevel"),
4329
+ is_signature_spell: d.fetch("isSignatureSpell"),
4330
+ component_id: d.fetch("componentId"),
4331
+ component_type_id: d.fetch("componentTypeId"),
4332
+ spell_list_id: d.fetch("spellListId"),
4333
+ )
4334
+ end
4335
+
4336
+ def self.from_json!(json)
4337
+ from_dynamic!(JSON.parse(json))
4338
+ end
4339
+
4340
+ def to_dynamic
4341
+ {
4342
+ "overrideSaveDc" => override_save_dc,
4343
+ "limitedUse" => limited_use&.to_dynamic,
4344
+ "id" => id,
4345
+ "entityTypeId" => entity_type_id,
4346
+ "definition" => definition&.to_dynamic,
4347
+ "definitionId" => definition_id,
4348
+ "prepared" => prepared,
4349
+ "countsAsKnownSpell" => counts_as_known_spell,
4350
+ "usesSpellSlot" => uses_spell_slot,
4351
+ "castAtLevel" => cast_at_level,
4352
+ "alwaysPrepared" => always_prepared,
4353
+ "restriction" => restriction,
4354
+ "spellCastingAbilityId" => spell_casting_ability_id,
4355
+ "displayAsAttack" => display_as_attack,
4356
+ "additionalDescription" => additional_description,
4357
+ "castOnlyAsRitual" => cast_only_as_ritual,
4358
+ "ritualCastingType" => ritual_casting_type,
4359
+ "range" => range&.to_dynamic,
4360
+ "activation" => activation&.to_dynamic,
4361
+ "baseLevelAtWill" => base_level_at_will,
4362
+ "atWillLimitedUseLevel" => at_will_limited_use_level,
4363
+ "isSignatureSpell" => is_signature_spell,
4364
+ "componentId" => component_id,
4365
+ "componentTypeId" => component_type_id,
4366
+ "spellListId" => spell_list_id,
4367
+ }
4368
+ end
4369
+
4370
+ def to_json(options = nil)
4371
+ JSON.generate(to_dynamic, options)
4372
+ end
4373
+ end
4374
+
3937
4375
  class Spells < Dry::Struct
3938
- attribute :race, Types.Array(SpellsClass)
4376
+ attribute :race, Types.Array(RaceElement)
3939
4377
  attribute :spells_class, Types.Array(SpellsClass)
3940
4378
  attribute :background, Types::Nil
3941
4379
  attribute :item, Types.Array(Item)
3942
- attribute :feat, Types.Array(SpellsClass)
4380
+ attribute :feat, Types.Array(RaceElement)
3943
4381
 
3944
4382
  def self.from_dynamic!(d)
3945
4383
  d = Types::Hash[d]
3946
4384
  new(
3947
- race: d.fetch("race").map { |x| SpellsClass.from_dynamic!(x) },
4385
+ race: d.fetch("race").map { |x| RaceElement.from_dynamic!(x) },
3948
4386
  spells_class: d.fetch("class").map { |x| SpellsClass.from_dynamic!(x) },
3949
4387
  background: d.fetch("background"),
3950
4388
  item: d.fetch("item").map { |x| Item.from_dynamic!(x) },
3951
- feat: d.fetch("feat").map { |x| SpellsClass.from_dynamic!(x) },
4389
+ feat: d.fetch("feat").map { |x| RaceElement.from_dynamic!(x) },
3952
4390
  )
3953
4391
  end
3954
4392
 
@@ -4038,9 +4476,9 @@ module DdbRuby
4038
4476
  attribute :current_xp, Types::Integer
4039
4477
  attribute :alignment_id, Types::Integer.optional
4040
4478
  attribute :lifestyle_id, Types::Integer.optional
4041
- attribute :stats, Types.Array(Stat)
4042
- attribute :bonus_stats, Types.Array(Stat)
4043
- attribute :override_stats, Types.Array(Stat)
4479
+ attribute :stats, Types.Array(BonusStatElement)
4480
+ attribute :bonus_stats, Types.Array(BonusStatElement)
4481
+ attribute :override_stats, Types.Array(BonusStatElement)
4044
4482
  attribute :background, CharacterBackground
4045
4483
  attribute :race, Race.optional
4046
4484
  attribute :race_definition_id, Types::Nil
@@ -4053,7 +4491,7 @@ module DdbRuby
4053
4491
  attribute :inventory, Types.Array(Inventory)
4054
4492
  attribute :currencies, Currencies
4055
4493
  attribute :classes, Types.Array(CharacterClass)
4056
- attribute :feats, Types.Array(Feat)
4494
+ attribute :feats, Types.Array(CharacterFeat)
4057
4495
  attribute :features, Types.Array(Types::Any)
4058
4496
  attribute :custom_defense_adjustments, Types.Array(Types::Any)
4059
4497
  attribute :custom_senses, Types.Array(Types::Any)
@@ -4061,7 +4499,7 @@ module DdbRuby
4061
4499
  attribute :custom_proficiencies, Types.Array(Types::Any)
4062
4500
  attribute :custom_actions, Types.Array(Types::Any)
4063
4501
  attribute :character_values, Types.Array(CharacterValue)
4064
- attribute :conditions, Types.Array(CharacterCondition)
4502
+ attribute :conditions, Types.Array(Types::Any)
4065
4503
  attribute :death_saves, DeathSaves
4066
4504
  attribute :adjustment_xp, Types::Integer.optional
4067
4505
  attribute :spell_slots, Types.Array(PactMagic)
@@ -4075,7 +4513,7 @@ module DdbRuby
4075
4513
  attribute :class_spells, Types.Array(ClassSpell)
4076
4514
  attribute :custom_items, Types.Array(CustomItem)
4077
4515
  attribute :campaign, Campaign.optional
4078
- attribute :creatures, Types.Array(Types::Any)
4516
+ attribute :creatures, Types.Array(Creature)
4079
4517
  attribute :optional_origins, Types.Array(Types::Any)
4080
4518
  attribute :optional_class_features, Types.Array(Types::Any)
4081
4519
  attribute :date_modified, Types::String
@@ -4113,9 +4551,9 @@ module DdbRuby
4113
4551
  current_xp: d.fetch("currentXp"),
4114
4552
  alignment_id: d.fetch("alignmentId"),
4115
4553
  lifestyle_id: d.fetch("lifestyleId"),
4116
- stats: d.fetch("stats").map { |x| Stat.from_dynamic!(x) },
4117
- bonus_stats: d.fetch("bonusStats").map { |x| Stat.from_dynamic!(x) },
4118
- override_stats: d.fetch("overrideStats").map { |x| Stat.from_dynamic!(x) },
4554
+ stats: d.fetch("stats").map { |x| BonusStatElement.from_dynamic!(x) },
4555
+ bonus_stats: d.fetch("bonusStats").map { |x| BonusStatElement.from_dynamic!(x) },
4556
+ override_stats: d.fetch("overrideStats").map { |x| BonusStatElement.from_dynamic!(x) },
4119
4557
  background: CharacterBackground.from_dynamic!(d.fetch("background")),
4120
4558
  race: d.fetch("race") ? Race.from_dynamic!(d.fetch("race")) : nil,
4121
4559
  race_definition_id: d.fetch("raceDefinitionId"),
@@ -4128,7 +4566,7 @@ module DdbRuby
4128
4566
  inventory: d.fetch("inventory").map { |x| Inventory.from_dynamic!(x) },
4129
4567
  currencies: Currencies.from_dynamic!(d.fetch("currencies")),
4130
4568
  classes: d.fetch("classes").map { |x| CharacterClass.from_dynamic!(x) },
4131
- feats: d.fetch("feats").map { |x| Feat.from_dynamic!(x) },
4569
+ feats: d.fetch("feats").map { |x| CharacterFeat.from_dynamic!(x) },
4132
4570
  features: d.fetch("features"),
4133
4571
  custom_defense_adjustments: d.fetch("customDefenseAdjustments"),
4134
4572
  custom_senses: d.fetch("customSenses"),
@@ -4136,7 +4574,7 @@ module DdbRuby
4136
4574
  custom_proficiencies: d.fetch("customProficiencies"),
4137
4575
  custom_actions: d.fetch("customActions"),
4138
4576
  character_values: d.fetch("characterValues").map { |x| CharacterValue.from_dynamic!(x) },
4139
- conditions: d.fetch("conditions").map { |x| CharacterCondition.from_dynamic!(x) },
4577
+ conditions: d.fetch("conditions"),
4140
4578
  death_saves: DeathSaves.from_dynamic!(d.fetch("deathSaves")),
4141
4579
  adjustment_xp: d.fetch("adjustmentXp"),
4142
4580
  spell_slots: d.fetch("spellSlots").map { |x| PactMagic.from_dynamic!(x) },
@@ -4150,7 +4588,7 @@ module DdbRuby
4150
4588
  class_spells: d.fetch("classSpells").map { |x| ClassSpell.from_dynamic!(x) },
4151
4589
  custom_items: d.fetch("customItems").map { |x| CustomItem.from_dynamic!(x) },
4152
4590
  campaign: d.fetch("campaign") ? Campaign.from_dynamic!(d.fetch("campaign")) : nil,
4153
- creatures: d.fetch("creatures"),
4591
+ creatures: d.fetch("creatures").map { |x| Creature.from_dynamic!(x) },
4154
4592
  optional_origins: d.fetch("optionalOrigins"),
4155
4593
  optional_class_features: d.fetch("optionalClassFeatures"),
4156
4594
  date_modified: d.fetch("dateModified"),
@@ -4216,7 +4654,7 @@ module DdbRuby
4216
4654
  "customProficiencies" => custom_proficiencies,
4217
4655
  "customActions" => custom_actions,
4218
4656
  "characterValues" => character_values.map { |x| x.to_dynamic },
4219
- "conditions" => conditions.map { |x| x.to_dynamic },
4657
+ "conditions" => conditions,
4220
4658
  "deathSaves" => death_saves.to_dynamic,
4221
4659
  "adjustmentXp" => adjustment_xp,
4222
4660
  "spellSlots" => spell_slots.map { |x| x.to_dynamic },
@@ -4230,7 +4668,7 @@ module DdbRuby
4230
4668
  "classSpells" => class_spells.map { |x| x.to_dynamic },
4231
4669
  "customItems" => custom_items.map { |x| x.to_dynamic },
4232
4670
  "campaign" => campaign&.to_dynamic,
4233
- "creatures" => creatures,
4671
+ "creatures" => creatures.map { |x| x.to_dynamic },
4234
4672
  "optionalOrigins" => optional_origins,
4235
4673
  "optionalClassFeatures" => optional_class_features,
4236
4674
  "dateModified" => date_modified,