BL Coding Where is the array for weapon types in the crafting menu populated from?

正在查看此主题的用户

DatDaxx

Recruit
I want to know where the dropdown options from the smithing menu (see picture) are populated from.


I have created a crafting_templates file at 'TestMod/ModuleData/crafting_tempaltes.xml' with the following contents:

插入代码块:
<?xml version="1.0" encoding="utf-8"?>
<CraftingTemplates>
  <CraftingTemplate id="Wand" item_modifier_group="Wand" item_holsters="sword_left_hip_3:sword_left_hip:sword_left_hip_2" use_weapon_as_holster_mesh="true" default_item_holster_position_offset="0,0,-0.1">
    <PieceDatas>
      <PieceData piece_type="Handle" build_order="0"/>
      <PieceData piece_type="Guard" build_order="1"/>
      <PieceData piece_type="Blade" build_order="2"/>
      <PieceData piece_type="Pommel" build_order="-1"/>
    </PieceDatas>
    <WeaponUsageDatas>
      <WeaponUsageData id="OneHandedSword"/>
    </WeaponUsageDatas>
    <StatsData>
      <StatData stat_type="Weight" max_value="1.0"/>
      <StatData stat_type="WeaponReach" max_value="500"/>
      <StatData stat_type="ThrustSpeed" max_value="500"/>
      <StatData stat_type="SwingSpeed" max_value="500"/>
      <StatData stat_type="ThrustDamage" max_value="500"/>
      <StatData stat_type="SwingDamage" max_value="500"/>
      <StatData stat_type="Handling" max_value="500"/>
      <StatData stat_type="FollowUp" max_value="500"/>
    </StatsData>
    <UsablePieces>
      <UsablePiece piece_id="wood_blade_1"/>
      <UsablePiece piece_id="battania_noble_guard_2"/>
      <UsablePiece piece_id="wood_grip_1"/>
      <UsablePiece piece_id="empire_pommel_1"/>
    </UsablePieces>
  </CraftingTemplate>

I have set up my item modifiers file as well at 'TestMod/ModuleData/item_modifiers.xml'

插入代码块:
<?xml version="1.0" encoding="utf-8"?>
<ItemModifiers>
  <!-- Wands -->
  <ItemModifier id="masterwork_wand" name="{=dxxitemmod0001}Masterwork {ITEMNAME}" damage="5" speed="2" price_factor="17.5" />
  <ItemModifier id="hardened_wand" name="{=dxxitemmod0002}Hardened {ITEMNAME}" damage="3" speed="1" price_factor="9" oldness="0.2" />
  <ItemModifier id="balanced_wand" name="{=dxxitemmod0003}Balanced {ITEMNAME}" damage="0" speed="1" price_factor="4.5" oldness="0.4" />
  <ItemModifier id="crude_wand" name="{=dxxitemmod0004}Crude {ITEMNAME}" damage="1" speed="-2" weight_factor="1.20" price_factor="0.8" oldness="0.6" />
  <ItemModifier id="bent_wand" name="{=dxxitemmod0005}Bent {ITEMNAME}" damage="-10" speed="-2" price_factor="0.6" oldness="1.0" />
  <ItemModifier id="chipped_wand" name="{=dxxitemmod0006}Chipped {ITEMNAME}" damage="-20" speed="-5" price_factor="0.3" oldness="0.9" />
</ItemModifiers>

and my item modifier groups at 'TestMod/ModuleData/item_modifiers.xml'

插入代码块:
<?xml version="1.0" encoding="utf-8"?>
<ItemModifierGroups>
    <ItemModifierGroup id="wand">
        <ItemModifier id="masterwork_wand" probability="1"/>
        <ItemModifier id="hardened_wand" probability="10"/>
        <ItemModifier id="balanced_wand" probability="15"/>
        <ItemModifier id="heavy_wand" probability="25"/>
        <ItemModifier id="chipped_wand" probability="25"/>
        <ItemModifier id="bent_wand" probability="20"/>
        <ItemModifier id="no_modifier" probability="30"/>
    </ItemModifierGroup>
</ItemModifierGroups>

I have these files included as xmlNodes in my Submodule.xml, but the list is not populating, and shows only the vanilla weapon types.

When looking around more, I found the following in 'Sandbox/GUI/Prefabs/CraftingCategory.xml'
插入代码块:
...
<Widget Id="CraftingCategoryParent" DoNotAcceptEvents="true" WidthSizePolicy="StretchToParent" HeightSizePolicy="StretchToParent">
      <Children>
        <!--Type & Tier Selection-->
        <ListPanel DataSource="{WeaponDesign}" WidthSizePolicy="StretchToParent" HeightSizePolicy="CoverChildren" HorizontalAlignment="Center" MarginLeft="20" LayoutImp.LayoutMethod="VerticalTopToBottom">
          <Children>
...

Specifically I see 'DataSource = {WeaponDesign}' which if you edit to make an invaid classname like say, '{WeaponDesign}A' results in the following:


The Tier buttons and dropdown from this xml node (referenced in the comment) are skipped over due to the invalid syntax, so I know im looking in the right spot.

I also found the following enum in the TaleWorlds.Core package regarding weapon classes, but i don't think its related:

插入代码块:
using System;

namespace TaleWorlds.Core
{
    // Token: 0x020000D3 RID: 211
    public enum WeaponClass
    {
        // Token: 0x040005BF RID: 1471
        Undefined,
        // Token: 0x040005C0 RID: 1472
        Dagger,
        // Token: 0x040005C1 RID: 1473
        OneHandedSword,
        // Token: 0x040005C2 RID: 1474
        TwoHandedSword,
        // Token: 0x040005C3 RID: 1475
        OneHandedAxe,
        // Token: 0x040005C4 RID: 1476
        TwoHandedAxe,
        // Token: 0x040005C5 RID: 1477
        Mace,
        // Token: 0x040005C6 RID: 1478
        Pick,
        // Token: 0x040005C7 RID: 1479
        TwoHandedMace,
        // Token: 0x040005C8 RID: 1480
        OneHandedPolearm,
        // Token: 0x040005C9 RID: 1481
        TwoHandedPolearm,
        // Token: 0x040005CA RID: 1482
        LowGripPolearm,
        // Token: 0x040005CB RID: 1483
        Arrow,
        // Token: 0x040005CC RID: 1484
        Bolt,
        // Token: 0x040005CD RID: 1485
        Cartridge,
        // Token: 0x040005CE RID: 1486
        Bow,
        // Token: 0x040005CF RID: 1487
        Crossbow,
        // Token: 0x040005D0 RID: 1488
        Stone,
        // Token: 0x040005D1 RID: 1489
        Boulder,
        // Token: 0x040005D2 RID: 1490
        ThrowingAxe,
        // Token: 0x040005D3 RID: 1491
        ThrowingKnife,
        // Token: 0x040005D4 RID: 1492
        Javelin,
        // Token: 0x040005D5 RID: 1493
        Pistol,
        // Token: 0x040005D6 RID: 1494
        Musket,
        // Token: 0x040005D7 RID: 1495
        SmallShield,
        // Token: 0x040005D8 RID: 1496
        LargeShield,
        // Token: 0x040005D9 RID: 1497
        Banner,
        // Token: 0x040005DA RID: 1498
        NumClasses
    }
}

Does anybody know where that dropdown list is populated (or how to add an extra index to it?) Any help would be greatly appreciated.
 
did you look in the TaleWorlds.MountAndBlade.GauntletUI.Widgets.Crafting namespace?

What you're describing is displayed by the Gauntlet UI engine.

Also in the SandBox.GauntletUI namespace is the public class CraftingGauntletScreen : ScreenBase, ICraftingStateHandler, IGameStateListener. That's looks like the dependency injection point for the data--and a kitchen sink class for a lot of things. I didnt read it carefully.

Finally, there is haphazard use of a Tag system throughout the source code. Tag's are defined by a condition test function. If the object full fills the condition, a tag is added in the dictionary. It may be those weapon types are defined as tags.
 
最后编辑:
点赞 0
后退
顶部 底部