Template:ArtifactDef: Difference between revisions

From Heroes of Might and Magic: Olden Era Official Wiki
obelisk-bot: uploading initial Cargo templates
Tag: Manual revert
obelisk-bot: Pushing translation table rework
 
(3 intermediate revisions by the same user not shown)
Line 6: Line 6:
The bot emits each artifact at <code>Data:Artifact/<id></code> carrying:
The bot emits each artifact at <code>Data:Artifact/<id></code> carrying:


# <code>{{ArtifactDef | id=… | name=… | description=… | slot=| rarity=… | …}}</code> — main row with English defaults inline plus the SIDs for all four localizable fields (name, description, upgrade_description, narrative_description).
# <code><nowiki>{{ArtifactDef | id=… | slot=… | rarity=… | …}}</nowiki></code> — main structural row.
# <code>{{TranslationDef | type=artifact | target_id=<id> | …}}</code> — name + description i18n (per D-026).
# N × <code><nowiki>{{TranslationDef | type=artifact | target_id=<id> | language=… | name=… | description=… }}</nowiki></code> — name + description, one row per language.
# N × <code>{{BonusDef | parent_type=artifact | parent_id=<id> | …}}</code> — the artifact's bonuses, in the unified Bonus table (per D-031).
# N × <code><nowiki>{{TranslationDef | type=artifact_upgrade | target_id=<id> | language=… | description=… }}</nowiki></code> — upgrade text (in the <code>description</code> column), one row per language, when an <code>upgrade_description_sid</code> exists.
# N × <code><nowiki>{{TranslationDef | type=artifact_narrative | target_id=<id> | language=… | description=… }}</nowiki></code> — narrative/lore text (in the <code>description</code> column), one row per language, when a <code>narrative_description_sid</code> exists.
# N × <code><nowiki>{{BonusDef | parent_type=artifact | parent_id=<id> | …}}</nowiki></code> — bonuses, in the unified Bonus table.
 
The artifact's three translatable text fields each get their own <code>type</code> discriminator rather than extra columns on the shared Translation table — the same approach Hero uses for its motto.


== Schema ==
== Schema ==
{{#cargo_declare:_table=Artifact
{{#cargo_declare:_table=Artifact
| id = String
| id = String
| name = String
| description = Wikitext
| name_sid = String
| name_sid = String
| description_sid = String
| description_sid = String
| upgrade_description_sid = String
| upgrade_description_sid = String
| upgrade_description = Wikitext
| narrative_description_sid = String
| narrative_description_sid = String
| narrative_description = Wikitext
| icon = String
| icon = String
| slot = String
| slot = String
Line 36: Line 36:
| source_path = String
| source_path = String
}}
}}
<pre><nowiki>
{{ArtifactDef
| id = String
| name = String
| description = Wikitext
| name_sid = String
| description_sid = String
| upgrade_description_sid = String      <!-- shown when the artifact levels up -->
| upgrade_description = Wikitext
| narrative_description_sid = String    <!-- flavor text -->
| narrative_description = Wikitext
| icon = String
| slot = String                  <!-- armor, head, ring, item_slot, ... -->
| rarity = String (allowed values=common,rare,epic,legendary)
| artifact_set_id = String      <!-- joins ItemSet.id -->
| goods_value = Integer          <!-- gold value when sold -->
| max_level = Integer            <!-- 1 = non-upgradable; higher = upgradable -->
<!-- Sparse: only present on artifacts that can level up -->
| cost_base = Integer            <!-- cost to upgrade from level 1 to 2 -->
| cost_per_level = Integer      <!-- additional cost per subsequent level -->
| reward_for_destroy = Integer  <!-- crystal/etc. reward when destroyed -->
| is_special_item = Boolean      <!-- magic scrolls and a few specials -->
| use_expand_tooltip = Boolean
| can_destroy = Boolean
| can_apply_bonus_always = Boolean
| source_path = String
}}
</nowiki></pre>
== Field notes ==
* '''<code>slot</code>''' is one of 10 distinct values. <code>item_slot</code> is the catch-all for non-equipment items (magic scrolls live here). <code>unic_slot</code> is for one-of-a-kind unique items. The values preserve the source's lowercase-snake spelling.
* '''<code>rarity</code>''' counts in the 2026-05-03 corpus: rare (114), common (101), epic (50), legendary (39).
* '''<code>artifact_set_id</code>''' is sparse — 83 of 304 artifacts belong to a set. Joins to a future <code>ArtifactSet</code> table (deferred per D-031). Renamed from source's <code>itemSet</code> for terminology consistency.
* '''<code>max_level</code>''' = 1 means the artifact doesn't upgrade. Artifacts with <code>max_level > 1</code> carry <code>cost_base</code> + <code>cost_per_level</code> populated.
* '''<code>is_special_item</code>''' is true for magic scrolls and a few special items — they typically use <code>bonuses[].type=heroMagicAddition</code> to add a spell to the hero's spellbook. The field name preserves the source's spelling rather than renaming to <code>is_special_artifact</code> (the source field is <code>isSpecialItem</code>).
* '''<code>use_expand_tooltip</code>''' in source ships as both bool and the string <code>"false"</code> on different artifacts; the bot normalizes to a proper bool.
* '''No sub-fields for the <code>bonuses[]</code>''' here — they emit as separate <code>Bonus</code> rows. Query artifacts with their bonuses via <code>tables=Artifact, Bonus | join on=Artifact.id=Bonus.parent_id | where=Bonus.parent_type='artifact'</code>.


== Related tables ==
== Related tables ==
* [[Template:ItemSetDef|ItemSet]] — joined on <code>Artifact.artifact_set_id = ItemSet.id</code> (N:1). The set's own member roster lives on <code>ItemSet.items_in_set</code>; per-tier bonuses on [[Template:ItemSetTierDef|ItemSetTier]].
* [[Template:ItemSetDef|ItemSet]] — joined on <code>Artifact.artifact_set_id = ItemSet.id</code>.
* [[Template:BonusDef|Bonus]] — joined on <code>Artifact.id = Bonus.parent_id</code> (1:N), filtered by <code>Bonus.parent_type='artifact'</code>.
* [[Template:BonusDef|Bonus]] — joined on <code>Artifact.id = Bonus.parent_id</code>, filtered by <code>Bonus.parent_type='artifact'</code>.
* [[Template:TranslationDef|Translation]] — one row per artifact with <code>type=artifact</code>, joined on <code>Artifact.id = Translation.target_id</code>.
* [[Template:TranslationDef|Translation]] — display text in every language (English included), joined on <code>Artifact.id = Translation.target_id</code> with <code>Translation.type IN ('artifact', 'artifact_upgrade', 'artifact_narrative')</code> and the desired <code>language</code> filter.


[[Category:Cargo Definitions]]
[[Category:Cargo Definitions]]
</noinclude><includeonly>{{#cargo_store:_table=Artifact
</noinclude><includeonly>{{#cargo_store:_table=Artifact
| id = {{{id|}}}
| id = {{{id|}}}
| name = {{{name|}}}
| description = {{{description|}}}
| name_sid = {{{name_sid|}}}
| name_sid = {{{name_sid|}}}
| description_sid = {{{description_sid|}}}
| description_sid = {{{description_sid|}}}
| upgrade_description_sid = {{{upgrade_description_sid|}}}
| upgrade_description_sid = {{{upgrade_description_sid|}}}
| upgrade_description = {{{upgrade_description|}}}
| narrative_description_sid = {{{narrative_description_sid|}}}
| narrative_description_sid = {{{narrative_description_sid|}}}
| narrative_description = {{{narrative_description|}}}
| icon = {{{icon|}}}
| icon = {{{icon|}}}
| slot = {{{slot|}}}
| slot = {{{slot|}}}
Line 111: Line 63:
| can_apply_bonus_always = {{{can_apply_bonus_always|}}}
| can_apply_bonus_always = {{{can_apply_bonus_always|}}}
| source_path = {{{source_path|}}}
| source_path = {{{source_path|}}}
}}</includeonly>
}}
Created <code>Artifact</code> entry: <code>{{{id|}}}</code></includeonly>

Latest revision as of 20:47, 14 May 2026

This template defines and stores rows for the Artifact Cargo table. One row per artifact / equipment item. 304 rows in the 2026-05-03 corpus, across 13 source slot files (armor, head, ring, boots, back, belt, right_hand, left_hand, item_slot, unic_slot, magic_scroll, enchante_magic_scroll, mythic_scroll_box).

The source folder is DB/items/items/ — using the JSON's "item" spelling. The wiki side uses artifact per the in-game player-facing label.

The bot emits each artifact at Data:Artifact/<id> carrying:

  1. {{ArtifactDef | id=… | slot=… | rarity=… | …}} — main structural row.
  2. N × {{TranslationDef | type=artifact | target_id=<id> | language=… | name=… | description=… }} — name + description, one row per language.
  3. N × {{TranslationDef | type=artifact_upgrade | target_id=<id> | language=… | description=… }} — upgrade text (in the description column), one row per language, when an upgrade_description_sid exists.
  4. N × {{TranslationDef | type=artifact_narrative | target_id=<id> | language=… | description=… }} — narrative/lore text (in the description column), one row per language, when a narrative_description_sid exists.
  5. N × {{BonusDef | parent_type=artifact | parent_id=<id> | …}} — bonuses, in the unified Bonus table.

The artifact's three translatable text fields each get their own type discriminator rather than extra columns on the shared Translation table — the same approach Hero uses for its motto.

Schema

This template defines the table "Artifact". View table.

Related tables

  • ItemSet — joined on Artifact.artifact_set_id = ItemSet.id.
  • Bonus — joined on Artifact.id = Bonus.parent_id, filtered by Bonus.parent_type='artifact'.
  • Translation — display text in every language (English included), joined on Artifact.id = Translation.target_id with Translation.type IN ('artifact', 'artifact_upgrade', 'artifact_narrative') and the desired language filter.