Skip to content

Sealed Delivery Agreement ‐ 1.0.2 and below

mortuusars edited this page Jul 23, 2023 · 1 revision

Sealed Agreement allows to randomize some of the elements of an agreement. When opened - it is finalized to the regular Delivery Agreement.

Structure

Agreement data is stored in NBT of a Sealed Delivery Agreement item. You can see example by using an in-game command /wares give sealedAgreementExample
Relevant class: wares.data.agreement.SealedAgreement

  • id - string - Transfered as is.
  • buyerName - either [Component] or [List of WeightedComponent].
  • buyerAddress - either [Component] or [List of WeightedComponent].
  • title - either [Component] or [List of WeightedComponent].
  • message - either [Component] or [List of WeightedComponent].
  • seal - string - Transfered as is.
  • sealTooltip - component - Text shown on seal mouse over. Not transfered.
  • backsideMessage - component - Text shown on the back of a letter (In the inspect screen). Not transfered.
  • requested - either [LootTable path] or [List of ItemStack] - Gets the list of items from a loot table or just transfers as is if list is provided.
  • payment - either [LootTable path] or [List of ItemStack] - Gets the list of items from a loot table or just transfers as is if list is provided.
  • ordered - [Integer] or [Stepped Int] - Finalized to a number.
  • experience - [Integer] or [Stepped Int] - Finalized to a number.
  • deliveryTime - [Integer] or [Stepped Int] - Finalized to a number.
  • expiresInSeconds - [Integer] or [Stepped Int] - Finalized to a number.

Note:

expiresInSeconds - Is relative to when the player opens the Sealed Agreement. When opened - this time is multiplied by 20 (ticks) and combined with current game time to create an expireTimestamp for the Agreement.

As with the regular Agreement - all elements are optional and will have their default values if omitted.

Stepped Int

Simple integer provider that allows snapping to nearest step value.

When sealed agreement is finalized into a regular agreement - value from a SteppedInt will be chosen at random (within min-max bounds) and rounded up to a step, but not larger than a max value.


Given the SteppedInt [min = 2, max = 14, step = 4]

  • if random value chosen to be 9 - it will be rounded to 12 as it is the next "step" from 8.
  • if random value chosen to be 13 - it will be rounded to 16 as it is the next "step" from 12. BUT it is then clamped to the max value and we get 14 as the result.

Possible values for the example above would be: [4, 8, 12, 14].

Example json

{
  "min": 2,
  "max": 14,
  "step": 4
}

step is optional. If omitted - it is defaulted to 1.