From 46c8c744fa16094d851d10c8e16a6f46bbb9abbe Mon Sep 17 00:00:00 2001 From: jiminycrick Date: Mon, 25 Jan 2021 20:39:13 -0800 Subject: [PATCH] Add migration for starter gear --- CHANGELOG.md | 1 + assets/common/items/testing/test_bag_18_slot.ron | 5 ++++- assets/common/items/testing/test_bag_9_slot.ron | 5 ++++- assets/common/items/testing/test_boots.ron | 4 +++- common/src/comp/inventory/item/armor.rs | 11 +++++++++-- common/src/comp/inventory/loadout.rs | 2 ++ common/src/comp/inventory/test_helpers.rs | 1 + .../2021-01-25-202618_starter_gear/down.sql | 10 ++++++++++ .../migrations/2021-01-25-202618_starter_gear/up.sql | 10 ++++++++++ 9 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 server/src/migrations/2021-01-25-202618_starter_gear/down.sql create mode 100644 server/src/migrations/2021-01-25-202618_starter_gear/up.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fba9249c8..d927b9986c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Skill trees - Lactose tolerant golems - 6 different gems. (Topaz, Amethyst, Sapphire, Emerald, Ruby and Diamond) +- Poise system (not currently accessible to players for balancing reasons) ### Changed diff --git a/assets/common/items/testing/test_bag_18_slot.ron b/assets/common/items/testing/test_bag_18_slot.ron index 4c708efeab..35ae75be5b 100644 --- a/assets/common/items/testing/test_bag_18_slot.ron +++ b/assets/common/items/testing/test_bag_18_slot.ron @@ -4,7 +4,10 @@ ItemDef( kind: Armor( ( kind: Bag("TestBag18Slot"), - stats: (protection: Normal(0.0)), + stats: ( + protection: Normal(0.0), + poise_protection: Normal(0.0), + ), ) ), quality: High, diff --git a/assets/common/items/testing/test_bag_9_slot.ron b/assets/common/items/testing/test_bag_9_slot.ron index 454d51d06e..d0b439b001 100644 --- a/assets/common/items/testing/test_bag_9_slot.ron +++ b/assets/common/items/testing/test_bag_9_slot.ron @@ -4,7 +4,10 @@ ItemDef( kind: Armor( ( kind: Bag("TestBag9Slot"), - stats: (protection: Normal(0.0)), + stats: ( + protection: Normal(0.0), + poise_protection: Normal(0.0), + ), ) ), quality: High, diff --git a/assets/common/items/testing/test_boots.ron b/assets/common/items/testing/test_boots.ron index f30749f977..81872e78af 100644 --- a/assets/common/items/testing/test_boots.ron +++ b/assets/common/items/testing/test_boots.ron @@ -5,7 +5,9 @@ ItemDef( ( kind: Foot("Dark"), stats: ( - protection: Normal(0.0)), + protection: Normal(0.0), + poise_protection: Normal(0.0), + ), ) ), quality: Low, diff --git a/common/src/comp/inventory/item/armor.rs b/common/src/comp/inventory/item/armor.rs index 8ca4e5a75c..e8882ef5a5 100644 --- a/common/src/comp/inventory/item/armor.rs +++ b/common/src/comp/inventory/item/armor.rs @@ -68,10 +68,17 @@ impl Armor { pub fn get_poise_protection(&self) -> Protection { self.stats.poise_protection } #[cfg(test)] - pub fn test_armor(kind: ArmorKind, protection: Protection) -> Armor { + pub fn test_armor( + kind: ArmorKind, + protection: Protection, + poise_protection: Protection, + ) -> Armor { Armor { kind, - stats: Stats { protection }, + stats: Stats { + protection, + poise_protection, + }, } } } diff --git a/common/src/comp/inventory/loadout.rs b/common/src/comp/inventory/loadout.rs index 4de423af8e..c79f8c4d21 100644 --- a/common/src/comp/inventory/loadout.rs +++ b/common/src/comp/inventory/loadout.rs @@ -336,6 +336,7 @@ mod tests { .get_slot_to_equip_into(&ItemKind::Armor(Armor::test_armor( ArmorKind::Bag("test".to_string()), Protection::Normal(0.0), + Protection::Normal(0.0), ))) .unwrap(); @@ -355,6 +356,7 @@ mod tests { .get_slot_to_equip_into(&ItemKind::Armor(Armor::test_armor( ArmorKind::Bag("test".to_string()), Protection::Normal(0.0), + Protection::Normal(0.0), ))) .unwrap(); diff --git a/common/src/comp/inventory/test_helpers.rs b/common/src/comp/inventory/test_helpers.rs index 651d763081..8c2be8b586 100644 --- a/common/src/comp/inventory/test_helpers.rs +++ b/common/src/comp/inventory/test_helpers.rs @@ -15,6 +15,7 @@ pub(super) fn get_test_bag(slots: u16) -> Item { ItemKind::Armor(armor::Armor::test_armor( ArmorKind::Bag("Test Bag".to_string()), Protection::Normal(0.0), + Protection::Normal(0.0), )), Quality::Common, slots, diff --git a/server/src/migrations/2021-01-25-202618_starter_gear/down.sql b/server/src/migrations/2021-01-25-202618_starter_gear/down.sql new file mode 100644 index 0000000000..ca16a2e052 --- /dev/null +++ b/server/src/migrations/2021-01-25-202618_starter_gear/down.sql @@ -0,0 +1,10 @@ +UPDATE item +SET item_definition_id = 'common.items.armor.starter.glider' WHERE item_definition_id = 'common.items.glider.glider_cloverleaf'; +UPDATE item +SET item_definition_id = 'common.items.armor.starter.lantern' WHERE item_definition_id = 'common.items.lantern.black_0'; +UPDATE item +SET item_definition_id = 'common.items.armor.starter.rugged_chest' WHERE item_definition_id = 'common.items.armor.chest.rugged_chest'; +UPDATE item +SET item_definition_id = 'common.items.armor.starter.rugged_pants' WHERE item_definition_id = 'common.items.armor.pants.rugged_pants'; +UPDATE item +SET item_definition_id = 'common.items.armor.starter.sandals_0' WHERE item_definition_id = 'common.items.armor.foot.sandals_0'; diff --git a/server/src/migrations/2021-01-25-202618_starter_gear/up.sql b/server/src/migrations/2021-01-25-202618_starter_gear/up.sql new file mode 100644 index 0000000000..05e0fae4c9 --- /dev/null +++ b/server/src/migrations/2021-01-25-202618_starter_gear/up.sql @@ -0,0 +1,10 @@ +UPDATE item +SET item_definition_id = 'common.items.glider.glider_cloverleaf' WHERE item_definition_id = 'common.items.armor.starter.glider'; +UPDATE item +SET item_definition_id = 'common.items.lantern.black_0' WHERE item_definition_id = 'common.items.armor.starter.lantern'; +UPDATE item +SET item_definition_id = 'common.items.armor.chest.rugged_chest' WHERE item_definition_id = 'common.items.armor.starter.rugged_chest'; +UPDATE item +SET item_definition_id = 'common.items.armor.pants.rugged_pants' WHERE item_definition_id = 'common.items.armor.starter.rugged_pants'; +UPDATE item +SET item_definition_id = 'common.items.armor.foot.sandals_0' WHERE item_definition_id = 'common.items.armor.starter.sandals_0';