From e8c0f62c6097e4844a84f507278859b09bad7267 Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Sun, 23 May 2021 18:33:41 +0300 Subject: [PATCH] Move loadout config handling to .ron files --- assets/common/loadouts/adlet_bow.ron | 8 + assets/common/loadouts/adlet_spear.ron | 8 + assets/common/loadouts/bandit.ron | 15 + assets/common/loadouts/beastmaster.ron | 17 + assets/common/loadouts/cultist_acolyte.ron | 17 + assets/common/loadouts/cultist_novice.ron | 17 + assets/common/loadouts/guard.ron | 13 + assets/common/loadouts/haniwa.ron | 7 + assets/common/loadouts/highwayman.ron | 15 + assets/common/loadouts/husk.ron | 7 + assets/common/loadouts/myrmidon.ron | 8 + assets/common/loadouts/outcast.ron | 13 + assets/common/loadouts/sahagin.ron | 8 + assets/common/loadouts/villager.ron | 22 ++ assets/common/loadouts/warlock.ron | 17 + assets/common/loadouts/warlord.ron | 17 + common/src/comp/inventory/loadout_builder.rs | 380 +------------------ 17 files changed, 226 insertions(+), 363 deletions(-) create mode 100644 assets/common/loadouts/adlet_bow.ron create mode 100644 assets/common/loadouts/adlet_spear.ron create mode 100644 assets/common/loadouts/bandit.ron create mode 100644 assets/common/loadouts/beastmaster.ron create mode 100644 assets/common/loadouts/cultist_acolyte.ron create mode 100644 assets/common/loadouts/cultist_novice.ron create mode 100644 assets/common/loadouts/guard.ron create mode 100644 assets/common/loadouts/haniwa.ron create mode 100644 assets/common/loadouts/highwayman.ron create mode 100644 assets/common/loadouts/husk.ron create mode 100644 assets/common/loadouts/myrmidon.ron create mode 100644 assets/common/loadouts/outcast.ron create mode 100644 assets/common/loadouts/sahagin.ron create mode 100644 assets/common/loadouts/villager.ron create mode 100644 assets/common/loadouts/warlock.ron create mode 100644 assets/common/loadouts/warlord.ron diff --git a/assets/common/loadouts/adlet_bow.ron b/assets/common/loadouts/adlet_bow.ron new file mode 100644 index 0000000000..a01505224c --- /dev/null +++ b/assets/common/loadouts/adlet_bow.ron @@ -0,0 +1,8 @@ +({ + "head": Item("common.items.npc_armor.biped_small.adlet.head.adlet_bow"), + "hands": Item("common.items.npc_armor.biped_small.adlet.hand.adlet_bow"), + "feet": Item("common.items.npc_armor.biped_small.adlet.foot.adlet"), + "chest": Item("common.items.npc_armor.biped_small.adlet.chest.adlet_bow"), + "pants": Item("common.items.npc_armor.biped_small.adlet.pants.adlet_bow"), + "belt": Item("common.items.npc_armor.biped_small.adlet.tail.adlet"), +}) diff --git a/assets/common/loadouts/adlet_spear.ron b/assets/common/loadouts/adlet_spear.ron new file mode 100644 index 0000000000..c02a246b04 --- /dev/null +++ b/assets/common/loadouts/adlet_spear.ron @@ -0,0 +1,8 @@ +({ + "head": Item("common.items.npc_armor.biped_small.adlet.head.adlet_spear"), + "hands": Item("common.items.npc_armor.biped_small.adlet.hand.adlet_spear"), + "feet": Item("common.items.npc_armor.biped_small.adlet.foot.adlet"), + "chest": Item("common.items.npc_armor.biped_small.adlet.chest.adlet_spear"), + "pants": Item("common.items.npc_armor.biped_small.adlet.pants.adlet_spear"), + "belt": Item("common.items.npc_armor.biped_small.adlet.tail.adlet"), +}) diff --git a/assets/common/loadouts/bandit.ron b/assets/common/loadouts/bandit.ron new file mode 100644 index 0000000000..eb18a0332c --- /dev/null +++ b/assets/common/loadouts/bandit.ron @@ -0,0 +1,15 @@ +({ + "shoulder": Item("common.items.armor.assassin.shoulder"), + "chest": Item("common.items.armor.assassin.chest"), + "belt": Item("common.items.armor.assassin.belt"), + "hands": Item("common.items.armor.assassin.hand"), + "pants": Item("common.items.armor.assassin.pants"), + "feet": Item("common.items.armor.assassin.foot"), + + "lantern": Choice([ + (1.0, Some(Item("common.items.lantern.black_0"))), + (2.0, None), + ]), + + "glider": Item("common.items.glider.glider_cloverleaf"), +}) diff --git a/assets/common/loadouts/beastmaster.ron b/assets/common/loadouts/beastmaster.ron new file mode 100644 index 0000000000..87dd7fbba1 --- /dev/null +++ b/assets/common/loadouts/beastmaster.ron @@ -0,0 +1,17 @@ +({ + "shoulder": Item("common.items.armor.ferocious.shoulder"), + "chest": Item("common.items.armor.ferocious.chest"), + "belt": Item("common.items.armor.ferocious.belt"), + "hands": Item("common.items.armor.ferocious.hand"), + "pants": Item("common.items.armor.ferocious.pants"), + "feet": Item("common.items.armor.ferocious.foot"), + + "back": Item("common.items.armor.ferocious.back"), + + "lantern": Choice([ + (1.0, Some(Item("common.items.lantern.black_0"))), + (2.0, None), + ]), + + "glider": Item("common.items.glider.glider_blue"), +}) diff --git a/assets/common/loadouts/cultist_acolyte.ron b/assets/common/loadouts/cultist_acolyte.ron new file mode 100644 index 0000000000..865f43898a --- /dev/null +++ b/assets/common/loadouts/cultist_acolyte.ron @@ -0,0 +1,17 @@ +({ + "shoulder": Item("common.items.armor.cultist.shoulder"), + "chest": Item("common.items.armor.cultist.chest"), + "belt": Item("common.items.armor.cultist.belt"), + "hands": Item("common.items.armor.cultist.hand"), + "pants": Item("common.items.armor.cultist.pants"), + "feet": Item("common.items.armor.cultist.foot"), + + "back": Item("common.items.armor.misc.back.dungeon_purple"), + + "lantern": Choice([ + (1.0, Some(Item("common.items.lantern.black_0"))), + (2.0, None), + ]), + + "glider": Item("common.items.glider.glider_blue"), +}) diff --git a/assets/common/loadouts/cultist_novice.ron b/assets/common/loadouts/cultist_novice.ron new file mode 100644 index 0000000000..c8324e703d --- /dev/null +++ b/assets/common/loadouts/cultist_novice.ron @@ -0,0 +1,17 @@ +({ + "shoulder": Item("common.items.armor.steel.shoulder"), + "chest": Item("common.items.armor.steel.chest"), + "belt": Item("common.items.armor.steel.belt"), + "hands": Item("common.items.armor.steel.hand"), + "pants": Item("common.items.armor.steel.pants"), + "feet": Item("common.items.armor.steel.foot"), + + "back": Item("common.items.armor.misc.back.dungeon_purple"), + + "lantern": Choice([ + (1.0, Some(Item("common.items.lantern.black_0"))), + (2.0, None), + ]), + + "glider": Item("common.items.glider.glider_blue"), +}) diff --git a/assets/common/loadouts/guard.ron b/assets/common/loadouts/guard.ron new file mode 100644 index 0000000000..afeb440bf9 --- /dev/null +++ b/assets/common/loadouts/guard.ron @@ -0,0 +1,13 @@ +({ + "shoulder": Item("common.items.armor.leather_plate.shoulder"), + "chest": Item("common.items.armor.leather_plate.chest"), + "belt": Item("common.items.armor.leather_plate.belt"), + "hands": Item("common.items.armor.leather_plate.hand"), + "pants": Item("common.items.armor.leather_plate.pants"), + "feet": Item("common.items.armor.leather_plate.foot"), + + "lantern": Choice([ + (1.0, Some(Item("common.items.lantern.black_0"))), + (2.0, None), + ]), +}) diff --git a/assets/common/loadouts/haniwa.ron b/assets/common/loadouts/haniwa.ron new file mode 100644 index 0000000000..b2b9aa90e1 --- /dev/null +++ b/assets/common/loadouts/haniwa.ron @@ -0,0 +1,7 @@ +({ + "head": Item("common.items.npc_armor.biped_small.haniwa.head.haniwa"), + "feet": Item("common.items.npc_armor.biped_small.haniwa.foot.haniwa"), + "hands": Item("common.items.npc_armor.biped_small.haniwa.hand.haniwa"), + "chest": Item("common.items.npc_armor.biped_small.haniwa.chest.haniwa"), + "pants": Item("common.items.npc_armor.biped_small.haniwa.pants.haniwa"), +}) diff --git a/assets/common/loadouts/highwayman.ron b/assets/common/loadouts/highwayman.ron new file mode 100644 index 0000000000..cb67904f20 --- /dev/null +++ b/assets/common/loadouts/highwayman.ron @@ -0,0 +1,15 @@ +({ + "shoulder": Item("common.items.armor.swift.shoulder"), + "chest": Item("common.items.armor.swift.chest"), + "belt": Item("common.items.armor.swift.belt"), + "hands": Item("common.items.armor.swift.hand"), + "pants": Item("common.items.armor.swift.pants"), + "feet": Item("common.items.armor.swift.foot"), + + "lantern": Choice([ + (1.0, Some(Item("common.items.lantern.black_0"))), + (2.0, None), + ]), + + "glider": Item("common.items.glider.glider_cloverleaf"), +}) diff --git a/assets/common/loadouts/husk.ron b/assets/common/loadouts/husk.ron new file mode 100644 index 0000000000..9d5a3f6d83 --- /dev/null +++ b/assets/common/loadouts/husk.ron @@ -0,0 +1,7 @@ +({ + "head": Item("common.items.npc_armor.biped_small.husk.head.husk"), + "feet": Item("common.items.npc_armor.biped_small.husk.foot.husk"), + "hands": Item("common.items.npc_armor.biped_small.husk.hand.husk"), + "chest": Item("common.items.npc_armor.biped_small.husk.chest.husk"), + "pants": Item("common.items.npc_armor.biped_small.husk.pants.husk"), +}) diff --git a/assets/common/loadouts/myrmidon.ron b/assets/common/loadouts/myrmidon.ron new file mode 100644 index 0000000000..565b91d416 --- /dev/null +++ b/assets/common/loadouts/myrmidon.ron @@ -0,0 +1,8 @@ +({ + "head": Item("common.items.npc_armor.biped_small.myrmidon.head.myrmidon"), + "feet": Item("common.items.npc_armor.biped_small.myrmidon.foot.myrmidon"), + "hands": Item("common.items.npc_armor.biped_small.myrmidon.hand.myrmidon"), + "chest": Item("common.items.npc_armor.biped_small.myrmidon.chest.myrmidon"), + "pants": Item("common.items.npc_armor.biped_small.myrmidon.pants.myrmidon"), + "belt": Item("common.items.npc_armor.biped_small.myrmidon.tail.myrmidon"), +}) diff --git a/assets/common/loadouts/outcast.ron b/assets/common/loadouts/outcast.ron new file mode 100644 index 0000000000..ad5fac7b14 --- /dev/null +++ b/assets/common/loadouts/outcast.ron @@ -0,0 +1,13 @@ +({ + "shoulder": Item("common.items.armor.cloth_purple.shoulder"), + "chest": Item("common.items.armor.cloth_purple.chest"), + "belt": Item("common.items.armor.cloth_purple.belt"), + "hands": Item("common.items.armor.cloth_purple.hand"), + "pants": Item("common.items.armor.cloth_purple.pants"), + "feet": Item("common.items.armor.cloth_purple.foot"), + + "lantern": Choice([ + (1.0, Some(Item("common.items.lantern.black_0"))), + (2.0, None), + ]), +}) diff --git a/assets/common/loadouts/sahagin.ron b/assets/common/loadouts/sahagin.ron new file mode 100644 index 0000000000..3a26362fc8 --- /dev/null +++ b/assets/common/loadouts/sahagin.ron @@ -0,0 +1,8 @@ +({ + "head": Item("common.items.npc_armor.biped_small.sahagin.head.sahagin"), + "feet": Item("common.items.npc_armor.biped_small.sahagin.foot.sahagin"), + "hands": Item("common.items.npc_armor.biped_small.sahagin.hand.sahagin"), + "chest": Item("common.items.npc_armor.biped_small.sahagin.chest.sahagin"), + "pants": Item("common.items.npc_armor.biped_small.sahagin.pants.sahagin"), + "belt": Item("common.items.npc_armor.biped_small.sahagin.tail.sahagin"), +}) diff --git a/assets/common/loadouts/villager.ron b/assets/common/loadouts/villager.ron new file mode 100644 index 0000000000..fb520a56e3 --- /dev/null +++ b/assets/common/loadouts/villager.ron @@ -0,0 +1,22 @@ +({ + "chest": Choice([ + (1.0, Some(Item("common.items.armor.misc.chest.worker_green_0"))), + (1.0, Some(Item("common.items.armor.misc.chest.worker_green_1"))), + (1.0, Some(Item("common.items.armor.misc.chest.worker_red_0"))), + (1.0, Some(Item("common.items.armor.misc.chest.worker_red_1"))), + (1.0, Some(Item("common.items.armor.misc.chest.worker_purple_0"))), + (1.0, Some(Item("common.items.armor.misc.chest.worker_purple_1"))), + (1.0, Some(Item("common.items.armor.misc.chest.worker_yellow_0"))), + (1.0, Some(Item("common.items.armor.misc.chest.worker_yellow_1"))), + (1.0, Some(Item("common.items.armor.misc.chest.worker_orange_0"))), + (1.0, Some(Item("common.items.armor.misc.chest.worker_orange_1"))), + ]), + + "belt": Item("common.items.armor.swift.belt"), + "pants": Item("common.items.armor.misc.pants.worker_blue"), + + "feet": Choice([ + (1.0, Some(Item("common.items.armor.swift.foot"))), + (1.0, Some(Item("common.items.armor.misc.foot.sandals"))), + ]), +}) diff --git a/assets/common/loadouts/warlock.ron b/assets/common/loadouts/warlock.ron new file mode 100644 index 0000000000..ea04930ce3 --- /dev/null +++ b/assets/common/loadouts/warlock.ron @@ -0,0 +1,17 @@ +({ + "shoulder": Item("common.items.armor.warlock.shoulder"), + "chest": Item("common.items.armor.warlock.chest"), + "belt": Item("common.items.armor.warlock.belt"), + "hands": Item("common.items.armor.warlock.hand"), + "pants": Item("common.items.armor.warlock.pants"), + "feet": Item("common.items.armor.warlock.foot"), + + "back": Item("common.items.armor.warlock.back"), + + "lantern": Choice([ + (1.0, Some(Item("common.items.lantern.black_0"))), + (2.0, None), + ]), + + "glider": Item("common.items.glider.glider_purp"), +}) diff --git a/assets/common/loadouts/warlord.ron b/assets/common/loadouts/warlord.ron new file mode 100644 index 0000000000..66b65cc8ae --- /dev/null +++ b/assets/common/loadouts/warlord.ron @@ -0,0 +1,17 @@ +({ + "shoulder": Item("common.items.armor.warlord.shoulder"), + "chest": Item("common.items.armor.warlord.chest"), + "belt": Item("common.items.armor.warlord.belt"), + "hands": Item("common.items.armor.warlord.hand"), + "pants": Item("common.items.armor.warlord.pants"), + "feet": Item("common.items.armor.warlord.foot"), + + "back": Item("common.items.armor.warlord.back"), + + "lantern": Choice([ + (1.0, Some(Item("common.items.lantern.black_0"))), + (2.0, None), + ]), + + "glider": Item("common.items.glider.glider_purp"), +}) diff --git a/common/src/comp/inventory/loadout_builder.rs b/common/src/comp/inventory/loadout_builder.rs index c5d6c33eb8..31e5338a46 100644 --- a/common/src/comp/inventory/loadout_builder.rs +++ b/common/src/comp/inventory/loadout_builder.rs @@ -323,45 +323,11 @@ impl LoadoutBuilder { Adlet => match active_tool_kind { Some(ToolKind::Bow) => LoadoutBuilder::new() .active_mainhand(active_item) - .head(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.adlet.head.adlet_bow", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.adlet.hand.adlet_bow", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.adlet.foot.adlet", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.adlet.chest.adlet_bow", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.adlet.pants.adlet_bow", - ))) - .belt(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.adlet.tail.adlet", - ))) + .complete_from_spec("common.loadouts.adlet_bow") .build(), Some(ToolKind::Spear) | Some(ToolKind::Staff) => LoadoutBuilder::new() .active_mainhand(active_item) - .head(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.adlet.head.adlet_spear", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.adlet.hand.adlet_spear", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.adlet.foot.adlet", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.adlet.chest.adlet_spear", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.adlet.pants.adlet_spear", - ))) - .belt(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.adlet.tail.adlet", - ))) + .complete_from_spec("common.loadouts.adlet_spear") .build(), _ => LoadoutBuilder::new().active_mainhand(active_item).build(), }, @@ -376,106 +342,23 @@ impl LoadoutBuilder { }, Sahagin => LoadoutBuilder::new() .active_mainhand(active_item) - .head(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.sahagin.head.sahagin", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.sahagin.foot.sahagin", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.sahagin.hand.sahagin", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.sahagin.chest.sahagin", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.sahagin.pants.sahagin", - ))) - .belt(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.sahagin.tail.sahagin", - ))) + .complete_from_spec("common.loadouts.sahagin") .build(), Haniwa => LoadoutBuilder::new() .active_mainhand(active_item) - .head(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.haniwa.head.haniwa", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.haniwa.foot.haniwa", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.haniwa.hand.haniwa", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.haniwa.chest.haniwa", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.haniwa.pants.haniwa", - ))) + .complete_from_spec("common.loadouts.haniwa") .build(), Myrmidon => LoadoutBuilder::new() .active_mainhand(active_item) - .head(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.myrmidon.head.myrmidon", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.myrmidon.foot.myrmidon", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.myrmidon.hand.myrmidon", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.myrmidon.chest.myrmidon", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.myrmidon.pants.myrmidon", - ))) - .belt(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.myrmidon.tail.myrmidon", - ))) + .complete_from_spec("common.loadouts.myrmidon") .build(), Husk => LoadoutBuilder::new() .active_mainhand(active_item) - .head(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.husk.head.husk", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.husk.foot.husk", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.husk.hand.husk", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.husk.chest.husk", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.npc_armor.biped_small.husk.pants.husk", - ))) + .complete_from_spec("common.loadouts.husk") .build(), Guard => LoadoutBuilder::new() .active_mainhand(active_item) - .shoulder(Some(Item::new_from_asset_expect( - "common.items.armor.leather_plate.shoulder", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.armor.leather_plate.chest", - ))) - .belt(Some(Item::new_from_asset_expect( - "common.items.armor.leather_plate.belt", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.armor.leather_plate.hand", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.armor.leather_plate.pants", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.armor.leather_plate.foot", - ))) - .lantern(match rand::thread_rng().gen_range(0..3) { - 0 => Some(Item::new_from_asset_expect("common.items.lantern.black_0")), - _ => None, - }) + .complete_from_spec("common.loadouts.guard") .bag(ArmorSlot::Bag1, Some(make_potion_bag(25))) .build(), Merchant => { @@ -606,268 +489,39 @@ impl LoadoutBuilder { }, Outcast => LoadoutBuilder::new() .active_mainhand(active_item) - .shoulder(Some(Item::new_from_asset_expect( - "common.items.armor.cloth_purple.shoulder", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.armor.cloth_purple.chest", - ))) - .belt(Some(Item::new_from_asset_expect( - "common.items.armor.cloth_purple.belt", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.armor.cloth_purple.hand", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.armor.cloth_purple.pants", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.armor.cloth_purple.foot", - ))) - .lantern(match rand::thread_rng().gen_range(0..3) { - 0 => Some(Item::new_from_asset_expect("common.items.lantern.black_0")), - _ => None, - }) + .complete_from_spec("common.loadouts.outcast") .build(), Highwayman => LoadoutBuilder::new() .active_mainhand(active_item) - .shoulder(Some(Item::new_from_asset_expect( - "common.items.armor.swift.shoulder", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.armor.swift.chest", - ))) - .belt(Some(Item::new_from_asset_expect( - "common.items.armor.swift.belt", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.armor.swift.hand", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.armor.swift.pants", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.armor.swift.foot", - ))) - .lantern(match rand::thread_rng().gen_range(0..3) { - 0 => Some(Item::new_from_asset_expect("common.items.lantern.black_0")), - _ => None, - }) - .glider(Some(Item::new_from_asset_expect( - "common.items.glider.glider_cloverleaf", - ))) + .complete_from_spec("common.loadouts.highwayman") .build(), Bandit => LoadoutBuilder::new() .active_mainhand(active_item) - .shoulder(Some(Item::new_from_asset_expect( - "common.items.armor.assassin.shoulder", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.armor.assassin.chest", - ))) - .belt(Some(Item::new_from_asset_expect( - "common.items.armor.assassin.belt", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.armor.assassin.hand", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.armor.assassin.pants", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.armor.assassin.foot", - ))) - .lantern(match rand::thread_rng().gen_range(0..3) { - 0 => Some(Item::new_from_asset_expect("common.items.lantern.black_0")), - _ => None, - }) - .glider(Some(Item::new_from_asset_expect( - "common.items.glider.glider_cloverleaf", - ))) + .complete_from_spec("common.loadouts.bandit") .build(), CultistNovice => LoadoutBuilder::new() .active_mainhand(active_item) - .shoulder(Some(Item::new_from_asset_expect( - "common.items.armor.steel.shoulder", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.armor.steel.chest", - ))) - .belt(Some(Item::new_from_asset_expect( - "common.items.armor.steel.belt", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.armor.steel.hand", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.armor.steel.pants", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.armor.steel.foot", - ))) - .back(Some(Item::new_from_asset_expect( - "common.items.armor.misc.back.dungeon_purple", - ))) - .lantern(match rand::thread_rng().gen_range(0..3) { - 0 => Some(Item::new_from_asset_expect("common.items.lantern.black_0")), - _ => None, - }) - .glider(Some(Item::new_from_asset_expect( - "common.items.glider.glider_blue", - ))) + .complete_from_spec("common.loadouts.cultist_novice") .build(), CultistAcolyte => LoadoutBuilder::new() .active_mainhand(active_item) - .shoulder(Some(Item::new_from_asset_expect( - "common.items.armor.cultist.shoulder", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.armor.cultist.chest", - ))) - .belt(Some(Item::new_from_asset_expect( - "common.items.armor.cultist.belt", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.armor.cultist.hand", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.armor.cultist.pants", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.armor.cultist.foot", - ))) - .back(Some(Item::new_from_asset_expect( - "common.items.armor.misc.back.dungeon_purple", - ))) - .lantern(match rand::thread_rng().gen_range(0..3) { - 0 => Some(Item::new_from_asset_expect("common.items.lantern.black_0")), - _ => None, - }) - .glider(Some(Item::new_from_asset_expect( - "common.items.glider.glider_blue", - ))) + .complete_from_spec("common.loadouts.cultist_acolyte") .build(), Beastmaster => LoadoutBuilder::new() .active_mainhand(active_item) - .shoulder(Some(Item::new_from_asset_expect( - "common.items.armor.ferocious.shoulder", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.armor.ferocious.chest", - ))) - .belt(Some(Item::new_from_asset_expect( - "common.items.armor.ferocious.belt", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.armor.ferocious.hand", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.armor.ferocious.pants", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.armor.ferocious.foot", - ))) - .back(Some(Item::new_from_asset_expect( - "common.items.armor.ferocious.back", - ))) - .lantern(match rand::thread_rng().gen_range(0..3) { - 0 => Some(Item::new_from_asset_expect("common.items.lantern.black_0")), - _ => None, - }) - .glider(Some(Item::new_from_asset_expect( - "common.items.glider.glider_blue", - ))) + .complete_from_spec("common.loadouts.beastmaster") .build(), Warlord => LoadoutBuilder::new() .active_mainhand(active_item) - .shoulder(Some(Item::new_from_asset_expect( - "common.items.armor.warlord.shoulder", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.armor.warlord.chest", - ))) - .belt(Some(Item::new_from_asset_expect( - "common.items.armor.warlord.belt", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.armor.warlord.hand", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.armor.warlord.pants", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.armor.warlord.foot", - ))) - .back(Some(Item::new_from_asset_expect( - "common.items.armor.warlord.back", - ))) - .lantern(match rand::thread_rng().gen_range(0..3) { - 0 => Some(Item::new_from_asset_expect("common.items.lantern.black_0")), - _ => None, - }) - .glider(Some(Item::new_from_asset_expect( - "common.items.glider.glider_purp", - ))) + .complete_from_spec("common.loadouts.warlord") .build(), Warlock => LoadoutBuilder::new() .active_mainhand(active_item) - .shoulder(Some(Item::new_from_asset_expect( - "common.items.armor.warlock.shoulder", - ))) - .chest(Some(Item::new_from_asset_expect( - "common.items.armor.warlock.chest", - ))) - .belt(Some(Item::new_from_asset_expect( - "common.items.armor.warlock.belt", - ))) - .hands(Some(Item::new_from_asset_expect( - "common.items.armor.warlock.hand", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.armor.warlock.pants", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.armor.warlock.foot", - ))) - .back(Some(Item::new_from_asset_expect( - "common.items.armor.warlock.back", - ))) - .lantern(match rand::thread_rng().gen_range(0..3) { - 0 => Some(Item::new_from_asset_expect("common.items.lantern.black_0")), - _ => None, - }) - .glider(Some(Item::new_from_asset_expect( - "common.items.glider.glider_purp", - ))) + .complete_from_spec("common.loadouts.warlock") .build(), Villager => LoadoutBuilder::new() .active_mainhand(active_item) - .chest(Some(Item::new_from_asset_expect( - match rand::thread_rng().gen_range(0..10) { - 0 => "common.items.armor.misc.chest.worker_green_0", - 1 => "common.items.armor.misc.chest.worker_green_1", - 2 => "common.items.armor.misc.chest.worker_red_0", - 3 => "common.items.armor.misc.chest.worker_red_1", - 4 => "common.items.armor.misc.chest.worker_purple_0", - 5 => "common.items.armor.misc.chest.worker_purple_1", - 6 => "common.items.armor.misc.chest.worker_yellow_0", - 7 => "common.items.armor.misc.chest.worker_yellow_1", - 8 => "common.items.armor.misc.chest.worker_orange_0", - _ => "common.items.armor.misc.chest.worker_orange_1", - }, - ))) - .belt(Some(Item::new_from_asset_expect( - "common.items.armor.swift.belt", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.armor.misc.pants.worker_blue", - ))) - .feet(Some(Item::new_from_asset_expect( - match rand::thread_rng().gen_range(0..2) { - 0 => "common.items.armor.swift.foot", - _ => "common.items.armor.misc.foot.sandals", - }, - ))) + .complete_from_spec("common.loadouts.villager") .bag(ArmorSlot::Bag1, Some(make_potion_bag(10))) .build(), } @@ -1041,7 +695,7 @@ impl LoadoutBuilder { let mut rng = rand::thread_rng(); match items .choose_weighted(&mut rng, |item| item.0) - .unwrap_or_else(|| { + .unwrap_or_else(|_| { panic!( "failed to choose item from loadout asset ({})", asset_specifier