Skip to content

Attributes ​

I. Prerequisite Configuration ​

Attributes are provided by an external attribute plugin. First select the attribute type in config.yml:

yaml
buffType: "attribute_plus"

Supported types:

  • attribute_plus
  • sx_attribute
  • AttributeSystem
  • MythicLib
  • MythicMobs (3.3.0+)

Attribute names may differ between attribute plugins; use the attribute names supported by the corresponding plugin.

II. Fixed Attributes ​

Configure attribute under the companion node in companions.yml:

yaml
companions:
  reaper:
    attribute:
      - "Physical Attack: ${level * 1}"
      - "Max Health: ${level * 2}"

Notes:

  • attribute is the fixed attribute list.
  • ${level} is the companion's current level.
  • ${discountRate} is the attribute discount variable.
  • One attribute per line, in the format attribute name: value.

Example:

yaml
attribute:
  - "Physical Attack: ${level * 2 * discountRate}"

The global discount is configured in the main config.yml:

yaml
discountRate: 1

When isAllBuff: false, only the currently used companion provides attributes; when set to true, the fixed attributes, random attributes and bound equipment attributes of all owned instances are aggregated, but a companion still needs to be selected first.

The currently used instance's discount is always 1, while other instances are calculated using their own discountRate, and the formula must use that variable. In 3.0.0, this defaults to 1 when not configured; to read the main config value, set discountRate: "" in that companion node.

III. Random Attributes ​

Configure randomAttribute under the companion node in companions.yml:

yaml
companions:
  reaper:
    randomAttribute:
      - "Physical Attack: ${10~50}"
      - "Magic Attack: ${5~30}"

Notes:

  • randomAttribute is the random attribute pool.
  • When a companion is obtained, the quality is rolled first, then the number of attributes is drawn according to the quality.
  • The rolled result is saved to the companion instance and is not re-rolled every time the GUI is opened.
  • Range values are rolled only once; level and discountRate in the formula are preserved and evaluated with the current level and discount when attributes are calculated.
  • If the attribute pool is too small, all attributes in the current pool are taken.

Random ranges support two formats:

yaml
randomAttribute:
  - "Physical Attack: 10~50"
  - "Magic Attack: ${5~30 * discountRate}"

IV. Random Attribute Quality ​

Qualities and the number of attributes drawn per quality are configured under quality in the main config.yml:

yaml
quality:
  normal:
    amount: 1
    weight: 45
  advanced:
    amount: 2
    weight: 18
  rare:
    amount: 3
    weight: 18
  rarer:
    amount: 4
    weight: 9
  epic:
    amount: 5
    weight: 9
  mythical:
    amount: 6
    weight: 1
  • amount: how many random attributes this quality draws.
  • weight: the weight for rolling this quality; the higher the value, the more likely it is.
  • Quality names can be added or modified freely, but existing quality identifiers and their language mappings should be kept when upgrading.
  • Quality refinement in the management screen re-rolls the quality and random attributes, requiring the companions.upgrade.refineQuality permission; the button and cost are configured under quality.enable and quality.price in gui/upgrade.yml.

Quality Range qualityList ​

Configure qualityList under the companion node to restrict the qualities this companion can draw when obtained or refined; only the listed qualities are rolled with their original weights. Quality keys must match quality in config.yml; undefined ones are logged to the console and ignored. When not configured, all qualities are used:

yaml
qualityList:
  - 'rare'
  - 'epic'

Quality Refinement Button Variables ​

The refinement button (quality) in gui/upgrade.yml supports these variables:

  • ${qualityMax}: highest quality tip, showing the highest quality this companion can be refined to (range decided by qualityList); shows qualityMaxReached (&a✔已达最高) when already at the maximum, otherwise qualityMaxTip (&7(最高: ${quality}))
  • ${attributePercent}: random attribute value completion percentage; its format and tier colors are configured in languages/zh_CN.yml, where 0/20/40/60/80/100 are percentage floors - reaching one uses its color, matching the highest tier. It only appears when the button lore contains the variable
  • ${randomAttribute}: current random attributes; shows the language none when there are none
yaml
attributePercentColor:
  0: "&f"
  20: "&9"
  40: "&5"
  60: "&d"
  80: "&6"
  100: "&e&l"
attributePercent: " &8(${color}${percent}%&8)"

Quality display names are configured under quality in languages/zh_CN.yml:

yaml
quality:
  normal: "&fNormal"
  advanced: "&9Advanced"
  rare: "&5Rare"
  rarer: "&dRarer"
  epic: "&6Epic"
  mythical: "&e&lMythical"

V. Attribute Name Display ​

The actual attribute name is recognized by the attribute plugin. To change only the display name in the GUI, configure attributeNames in languages/zh_CN.yml:

yaml
attributeNames:
  attack_damage: "Attack Damage"

This only changes the display text, not the actual attribute name in effect.

VI. Displaying Attributes in the GUI ​

Use variables in the companion's GUI.shop or GUI.open description:

yaml
GUI:
  shop:
    description:
      - "&6Fixed Attributes"
      - "&7${attribute}"
      - "&6Random Attribute Range"
      - "&7${randomAttribute}"
  open:
    description:
      - "&7Level: ${level}"
      - "&7Quality: ${quality}"
      - "&7Attributes: ${attribute}"
      - "&7Random Attributes: ${randomAttribute}"

Supported variables:

  • ${attribute}: fixed attributes.
  • ${randomAttribute}: random attributes; the shop shows the attribute range, while the warehouse shows the rolled result.
  • ${level}: companion level.
  • ${quality}: companion quality.

VII. MythicLib Format ​

When using MythicLib, fill in the attribute ID from MMOItems/Language/stats.yml:

yaml
attribute:
  - "MAX_HEALTH: 5"

Attribute names are case-insensitive; refer to the MythicLib configuration for the available names.