From 8ec5ea1b19988e13c7378587eec35f5718f01287 Mon Sep 17 00:00:00 2001 From: deBurboun Date: Sat, 23 Mar 2024 14:32:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B4=D0=B5=D0=BB=D0=B0=D1=82?= =?UTF-8?q?=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WizardSurplusBundleSystem.cs | 93 +++++++++++++ .../WizardSurplusBundleComponent.cs | 25 ++++ .../Catalog/Fills/Backpacks/duffelbag.yml | 20 ++- .../Catalog/Fills/Crates/antagonist.yml | 6 + .../Backmen/Catalog/uplink_catalog.yml | 121 ++++++++++++++++ .../Backmen/Entities/Clothing/Head/magic.yml | 14 ++ .../Entities/Clothing/OuterClothing/magic.yml | 14 ++ .../Backmen/Entities/Magic/books.yml | 14 ++ .../Entities/Mobs/Player/humanoids.yml | 131 ++++++++++++++++++ .../Entities/Objects/Specific/antagonist.yml | 46 ++++++ .../Roles/Antags/wizard_startinggear.yml | 59 ++++++++ .../Prototypes/Backmen/Store/categories.yml | 32 +++++ Resources/Prototypes/Backmen/Store/preset.yml | 12 ++ .../Entities/Clothing/Belt/belts.yml | 1 + 14 files changed, 587 insertions(+), 1 deletion(-) create mode 100644 Content.Server/Backmen/Traitor/SurplusBundle/WizardSurplusBundleSystem.cs create mode 100644 Content.Server/Backmen/Traitor/Uplink/SurplusBundle/WizardSurplusBundleComponent.cs create mode 100644 Resources/Prototypes/Backmen/Catalog/Fills/Crates/antagonist.yml create mode 100644 Resources/Prototypes/Backmen/Entities/Clothing/Head/magic.yml create mode 100644 Resources/Prototypes/Backmen/Entities/Clothing/OuterClothing/magic.yml create mode 100644 Resources/Prototypes/Backmen/Entities/Magic/books.yml create mode 100644 Resources/Prototypes/Backmen/Entities/Objects/Specific/antagonist.yml create mode 100644 Resources/Prototypes/Backmen/Roles/Antags/wizard_startinggear.yml create mode 100644 Resources/Prototypes/Backmen/Store/preset.yml diff --git a/Content.Server/Backmen/Traitor/SurplusBundle/WizardSurplusBundleSystem.cs b/Content.Server/Backmen/Traitor/SurplusBundle/WizardSurplusBundleSystem.cs new file mode 100644 index 00000000000..d7cf37d8634 --- /dev/null +++ b/Content.Server/Backmen/Traitor/SurplusBundle/WizardSurplusBundleSystem.cs @@ -0,0 +1,93 @@ +using System.Linq; +using Content.Server.Store.Systems; +using Content.Server.Storage.EntitySystems; +using Content.Shared.Store; +using Content.Shared.FixedPoint; +using Robust.Shared.Prototypes; +using Robust.Shared.Random; + +namespace Content.Server.Traitor.Uplink.SurplusBundle; + +public sealed class WizardSurplusBundleSystem : EntitySystem +{ + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly EntityStorageSystem _entityStorage = default!; + [Dependency] private readonly StoreSystem _store = default!; + + private ListingData[] _listings = default!; + + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnMapInit); + + SubscribeLocalEvent(OnInit); + } + + private void OnInit(EntityUid uid, WizardSurplusBundleComponent component, ComponentInit args) + { + var storePreset = _prototypeManager.Index(component.StorePreset); + + _listings = _store.GetAvailableListings(uid, null, storePreset.Categories).ToArray(); + + Array.Sort(_listings, (a, b) => (int) (b.Cost.Values.Sum() - a.Cost.Values.Sum())); //this might get weird with multicurrency but don't think about it + } + + private void OnMapInit(EntityUid uid, WizardSurplusBundleComponent component, MapInitEvent args) + { + FillStorage(uid, component); + } + + private void FillStorage(EntityUid uid, WizardSurplusBundleComponent? component = null) + { + if (!Resolve(uid, ref component)) + return; + + var cords = Transform(uid).Coordinates; + + var content = GetRandomContent(component.TotalPrice); + foreach (var item in content) + { + var ent = EntityManager.SpawnEntity(item.ProductEntity, cords); + _entityStorage.Insert(ent, component.Owner); + } + } + + // wow, is this leetcode reference? + private List GetRandomContent(FixedPoint2 targetCost) + { + var ret = new List(); + if (_listings.Length == 0) + return ret; + + var totalCost = FixedPoint2.Zero; + var index = 0; + while (totalCost < targetCost) + { + // All data is sorted in price descending order + // Find new item with the lowest acceptable price + // All expansive items will be before index, all acceptable after + var remainingBudget = targetCost - totalCost; + while (_listings[index].Cost.Values.Sum() > remainingBudget) + { + index++; + if (index >= _listings.Length) + { + // Looks like no cheap items left + // It shouldn't be case for ss14 content + // Because there are 1 TC items + return ret; + } + } + + // Select random listing and add into crate + var randomIndex = _random.Next(index, _listings.Length); + var randomItem = _listings[randomIndex]; + ret.Add(randomItem); + totalCost += randomItem.Cost.Values.Sum(); + } + + return ret; + } +} diff --git a/Content.Server/Backmen/Traitor/Uplink/SurplusBundle/WizardSurplusBundleComponent.cs b/Content.Server/Backmen/Traitor/Uplink/SurplusBundle/WizardSurplusBundleComponent.cs new file mode 100644 index 00000000000..aea0a9ff9ff --- /dev/null +++ b/Content.Server/Backmen/Traitor/Uplink/SurplusBundle/WizardSurplusBundleComponent.cs @@ -0,0 +1,25 @@ +using Content.Shared.Store; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; + +namespace Content.Server.Traitor.Uplink.SurplusBundle; + +/// +/// Fill crate with a random wizard items. +/// +[RegisterComponent] +public sealed partial class WizardSurplusBundleComponent : Component +{ + /// + /// Total price of all content inside bundle. + /// + [ViewVariables(VVAccess.ReadOnly)] + [DataField("totalPrice")] + public int TotalPrice = 20; + + /// + /// The preset that will be used to get all the listings. + /// Currently just defaults to the basic uplink. + /// + [DataField("storePreset", customTypeSerializer: typeof(PrototypeIdSerializer))] + public string StorePreset = "WizardStorePresetUplink"; +} diff --git a/Resources/Prototypes/Backmen/Catalog/Fills/Backpacks/duffelbag.yml b/Resources/Prototypes/Backmen/Catalog/Fills/Backpacks/duffelbag.yml index 80689a89162..d334ae7d505 100644 --- a/Resources/Prototypes/Backmen/Catalog/Fills/Backpacks/duffelbag.yml +++ b/Resources/Prototypes/Backmen/Catalog/Fills/Backpacks/duffelbag.yml @@ -38,4 +38,22 @@ - type: StorageFill contents: - id: AntiPsiGrenade - amount: 20 \ No newline at end of file + amount: 20 + +- type: entity + parent: ClothingBackpackDuffelSyndicateBundle + id: ClothingBackpackDuffelWizard + name: wizard outfit bag + description: "Contains 3 wizard outfits." + components: + - type: StorageFill + contents: + - id: ClothingOuterWizardReal + - id: ClothingHeadHatWizardReal + - id: ClothingOuterWizardVioletReal + - id: ClothingHeadHatVioletwizardReal + - id: ClothingOuterWizardRedReal + - id: ClothingHeadHatRedwizardReal + - id: ClothingShoesWizard + - id: BedsheetWiz + amount: 3 \ No newline at end of file diff --git a/Resources/Prototypes/Backmen/Catalog/Fills/Crates/antagonist.yml b/Resources/Prototypes/Backmen/Catalog/Fills/Crates/antagonist.yml new file mode 100644 index 00000000000..14a7a42cacd --- /dev/null +++ b/Resources/Prototypes/Backmen/Catalog/Fills/Crates/antagonist.yml @@ -0,0 +1,6 @@ +- type: entity + id: CrateWizardSurplus + parent: CrateGenericSteel + components: + - type: WizardSurplusBundle + totalPrice: 50 \ No newline at end of file diff --git a/Resources/Prototypes/Backmen/Catalog/uplink_catalog.yml b/Resources/Prototypes/Backmen/Catalog/uplink_catalog.yml index 7bf58289901..b3ad5477788 100644 --- a/Resources/Prototypes/Backmen/Catalog/uplink_catalog.yml +++ b/Resources/Prototypes/Backmen/Catalog/uplink_catalog.yml @@ -137,3 +137,124 @@ Telecrystal: 2 categories: - UplinkAllies + + +# Books +- type: listing + id: WizardSpawnBook + name: uplink-book-spawnbook-name + description: uplink-book-spawnbook-desc + productEntity: SpawnSpellbook + cost: + MaterialBluespace: 8 + categories: + - WizardBooks + +- type: listing + id: WizardWallBook + name: uplink-book-forcewall-name + description: uplink-book-forcewall-desc + productEntity: ForceWallSpellbook + cost: + MaterialBluespace: 10 + categories: + - WizardBooks + +- type: listing + id: WizardBlinkBook + name: uplink-book-blink-name + description: uplink-book-blink-desc + productEntity: BlinkBook + cost: + MaterialBluespace: 16 + categories: + - WizardBooks + +- type: listing + id: WizardSmiteBook + name: uplink-book-smite-name + description: uplink-book-smite-desc + productEntity: SmiteBook + cost: + MaterialBluespace: 50 + categories: + - WizardBooks + +- type: listing + id: WizardKnockBook + name: uplink-book-knok-name + description: uplink-book-knok-desc + productEntity: KnockSpellbook + cost: + MaterialBluespace: 14 + categories: + - WizardBooks + +- type: listing + id: WizardFireballBook + name: uplink-book-fireball-name + description: uplink-book-fireball-desc + productEntity: FireballSpellbook + cost: + MaterialBluespace: 16 + categories: + - WizardBooks + +- type: listing + id: WizardHealingBook + name: uplink-book-heal-name + description: uplink-book-heal-desc + productEntity: HealingSpellbook + cost: + MaterialBluespace: 8 + categories: + - WizardBooks + +# Wands + + +# Armor +- type: listing + id: WizardHardsuit + name: uplink-armor-hardsuit-name + description: uplink-armor-hardsuit-desc + productEntity: ClothingOuterHardsuitWizard + cost: + MaterialBluespace: 6 + categories: + - WizardArmor + +# Utility +- type: listing + id: WizardSpellBelt + name: uplink-utility-spellbelt-name + description: uplink-utility-spellbelt-desc + productEntity: ClothingBeltWand + cost: + MaterialBluespace: 4 + categories: + - WizardUtility + +# Bundles +- type: listing + id: WizardSurplusCrate30BS + name: uplink-bundles-wizarsurpluscrate30bs-name + description: uplink-bundles-wizarsurpluscrate30bs-desc + productEntity: CrateWizardSurplus + cost: + MaterialBluespace: 30 + categories: + - WizardBundles + +# Miscellanious + +# Pointless +- type: listing + id: WizardBurger + name: uplink-pointless-spellburger-name + description: uplink-pointless-spellburger-desc + productEntity: FoodBurgerSpell + cost: + MaterialBluespace: 1 + categories: + - WizardPointless diff --git a/Resources/Prototypes/Backmen/Entities/Clothing/Head/magic.yml b/Resources/Prototypes/Backmen/Entities/Clothing/Head/magic.yml new file mode 100644 index 00000000000..e35083d88e1 --- /dev/null +++ b/Resources/Prototypes/Backmen/Entities/Clothing/Head/magic.yml @@ -0,0 +1,14 @@ +- type: entity + parent: ClothingHeadHatVioletwizard + id: ClothingHeadHatVioletwizardReal + + +- type: entity + parent: ClothingHeadHatWizard + id: ClothingHeadHatWizardReal + + +- type: entity + parent: ClothingHeadHatRedwizard + id: ClothingHeadHatRedwizardReal + suffix: magical diff --git a/Resources/Prototypes/Backmen/Entities/Clothing/OuterClothing/magic.yml b/Resources/Prototypes/Backmen/Entities/Clothing/OuterClothing/magic.yml new file mode 100644 index 00000000000..1bde3d4c0cb --- /dev/null +++ b/Resources/Prototypes/Backmen/Entities/Clothing/OuterClothing/magic.yml @@ -0,0 +1,14 @@ +- type: entity + parent: ClothingOuterWizardViolet + id: ClothingOuterWizardVioletReal + suffix: magical + +- type: entity + parent: ClothingOuterWizard + id: ClothingOuterWizardReal + suffix: magical + +- type: entity + parent: ClothingOuterWizardRed + id: ClothingOuterWizardRedReal + suffix: magical \ No newline at end of file diff --git a/Resources/Prototypes/Backmen/Entities/Magic/books.yml b/Resources/Prototypes/Backmen/Entities/Magic/books.yml new file mode 100644 index 00000000000..b13b9c89a07 --- /dev/null +++ b/Resources/Prototypes/Backmen/Entities/Magic/books.yml @@ -0,0 +1,14 @@ +- type: entity + id: HealingSpellbook + name: healing spellbook + parent: BaseSpellbook + components: + - type: Sprite + netsync: false + sprite: Objects/Magic/spellbooks.rsi + layers: + - state: spellbook + - type: Spellbook + entitySpells: + HealingSpell: -1 + learnTime: 0.75 \ No newline at end of file diff --git a/Resources/Prototypes/Backmen/Entities/Mobs/Player/humanoids.yml b/Resources/Prototypes/Backmen/Entities/Mobs/Player/humanoids.yml index 6c87bd07664..dcb6ecfb0a5 100644 --- a/Resources/Prototypes/Backmen/Entities/Mobs/Player/humanoids.yml +++ b/Resources/Prototypes/Backmen/Entities/Mobs/Player/humanoids.yml @@ -57,3 +57,134 @@ - type: Fugitive - type: FugitiveCountdown - type: RandomHumanoidAppearance + +# Wizard +- type: entity + name: Urist McWizard + id: UristMcWizardBase + suffix: base + abstract: true + parent: MobHuman + components: + - type: GhostTakeoverAvailable + name: Urist McWizard + description: | + You have been sent to the station via bluespace and wizard magic. Your goal is to kill as many people as possible and destroy the station. + You can gain more "BS" (Bluespace) for your uplink by completing Oracle quests. + You are considered KOS (Kill On Sight) so be careful wandering the station for the Oracle's items. + If you encounter an Urist McNars (SuperPsi), you may team up with them or kill them. The SuperPsi is able to steal and use your spellbooks, be very careful. + - type: RandomMetadata + nameSegments: + - names_wizard_first + - names_wizard_last + - type: SlowOnDamage + speedModifierThresholds: + 60: 0.8 + 120: 0.6 + 180: 0.4 + 240: 0.2 + - type: MobState + - type: MobThresholds + thresholds: + 0: Alive + 300: Dead + - type: StatusEffects + allowed: + - Stun + - KnockedDown + - SlowedDown + - Stutter + - Electrocution + - type: NpcFactionMember + factions: + - SimpleHostile + - type: BibleUser + # - type: RandomHumanoidAppearance # Removes random names :( + +- type: entity + name: Urist McWizard + id: UristMcWizardViolet2 + suffix: violet + parent: UristMcWizardBase + components: + - type: Loadout + prototype: WizardVioletGear2 + prototypes: [WizardVioletGear2] + +- type: entity + name: Urist McWizard + id: UristMcWizardRed2 + suffix: red + parent: UristMcWizardBase + components: + - type: Loadout + prototype: WizardRedGear2 + prototypes: [WizardRedGear2] + +- type: entity + name: Urist McWizard + id: UristMcWizardBlue2 + suffix: blue + parent: UristMcWizardBase + components: + - type: Loadout + prototype: WizardBlueGear2 + prototypes: [WizardBlueGear2] + +- type: entity + name: Urist McWizard + id: UristMcWizardHardsuit2 + suffix: hardsuit + parent: UristMcWizardBase + components: + - type: Loadout + prototype: WizardHardsuitGear2 + prototypes: [WizardHardsuitGear2] + +# SuperPsi - Urist McNars +- type: entity + name: Urist McNars + id: UristMcNars + parent: MobHuman + components: + - type: GhostTakeoverAvailable + name: Urist McNars + description: | + You have been sent to the station via the Noosphere. Your goal is to kill as many people as possible and destroy the station. + You have been given every Psionic power via the Noosphere, you should be theoretically unstoppable if you time everything right. + - type: RandomMetadata + nameSegments: + - names_wizard_first + - names_wizard_last + - type: SlowOnDamage + speedModifierThresholds: + 60: 0.8 + 120: 0.6 + 180: 0.4 + 240: 0.2 + - type: MobState + - type: MobThresholds + thresholds: + 0: Alive + 300: Dead + - type: StatusEffects + allowed: + - Stun + - KnockedDown + - SlowedDown + - Electrocution + - type: NpcFactionMember + factions: + - SimpleHostile + - type: BibleUser + # - type: RandomHumanoidAppearance # Removes random names :( + + - type: DispelPower + - type: MassSleepPower + - type: MetapsionicPower + - type: MindSwapPower + - type: NoosphericZapPower + - type: PsionicInvisibilityPower + - type: PsionicRegenerationPower + - type: PyrokinesisPower + - type: TelegnosisPower diff --git a/Resources/Prototypes/Backmen/Entities/Objects/Specific/antagonist.yml b/Resources/Prototypes/Backmen/Entities/Objects/Specific/antagonist.yml new file mode 100644 index 00000000000..921da692abe --- /dev/null +++ b/Resources/Prototypes/Backmen/Entities/Objects/Specific/antagonist.yml @@ -0,0 +1,46 @@ +# Uplinks +- type: entity + parent: BaseItem + id: BaseWizardUplinkRadio + name: wizard uplink + description: You're a wizard, harry! + suffix: Empty + components: + - type: Sprite + sprite: Objects/Devices/communication.rsi + layers: + - state: old-radio + netsync: false + - type: Item + sprite: Objects/Devices/communication.rsi + heldPrefix: old-radio + - type: UserInterface + interfaces: + - key: enum.StoreUiKey.Key + type: StoreBoundUserInterface + - type: ActivatableUI + key: enum.StoreUiKey.Key + - type: Store + preset: WizardStorePresetUplink + balance: + MaterialBluespace: 0 + +- type: entity + parent: BaseWizardUplinkRadio + id: BaseWizardUplinkRadio8BS + suffix: 8 Bluespace + components: + - type: Store + preset: WizardStorePresetUplink + balance: + MaterialBluespace: 8 + +- type: entity + parent: BaseWizardUplinkRadio + id: BaseWizardUplinkRadio30BS + suffix: 30 Bluespace + components: + - type: Store + preset: WizardStorePresetUplink + balance: + MaterialBluespace: 30 diff --git a/Resources/Prototypes/Backmen/Roles/Antags/wizard_startinggear.yml b/Resources/Prototypes/Backmen/Roles/Antags/wizard_startinggear.yml new file mode 100644 index 00000000000..3d4a9c3e862 --- /dev/null +++ b/Resources/Prototypes/Backmen/Roles/Antags/wizard_startinggear.yml @@ -0,0 +1,59 @@ +#Wizard outfit startingGear definitions. +- type: startingGear + id: WizardBlueGear2 + equipment: + jumpsuit: ClothingUniformJumpsuitColorDarkBlue + back: ClothingBackpackFilled + head: ClothingHeadHatWizardReal + outerClothing: ClothingOuterWizardReal + shoes: ClothingShoesWizard + id: PassengerPDA + ears: ClothingHeadsetService + pocket2: BaseWizardUplinkRadio8BS + innerclothingskirt: ClothingUniformJumpskirtColorDarkBlue + satchel: ClothingBackpackSatchelFilled + duffelbag: ClothingBackpackDuffelFilled + +- type: startingGear + id: WizardRedGear2 + equipment: + jumpsuit: ClothingUniformJumpsuitColorRed + back: ClothingBackpackFilled + head: ClothingHeadHatRedwizardReal + outerClothing: ClothingOuterWizardRedReal + shoes: ClothingShoesWizard + id: PassengerPDA + ears: ClothingHeadsetService + pocket2: BaseWizardUplinkRadio8BS + innerclothingskirt: ClothingUniformJumpskirtColorRed + satchel: ClothingBackpackSatchelFilled + duffelbag: ClothingBackpackDuffelFilled + +- type: startingGear + id: WizardVioletGear2 + equipment: + jumpsuit: ClothingUniformJumpsuitColorPurple + back: ClothingBackpackFilled + head: ClothingHeadHatVioletwizardReal + outerClothing: ClothingOuterWizardVioletReal + shoes: ClothingShoesWizard + id: PassengerPDA + ears: ClothingHeadsetService + pocket2: BaseWizardUplinkRadio8BS + innerclothingskirt: ClothingUniformJumpskirtColorPurple + satchel: ClothingBackpackSatchelFilled + duffelbag: ClothingBackpackDuffelFilled + +- type: startingGear + id: WizardHardsuitGear2 + equipment: + jumpsuit: ClothingUniformJumpsuitColorPurple + back: ClothingBackpackFilled + outerClothing: ClothingOuterHardsuitWizard + shoes: ClothingShoesWizard + id: PassengerPDA + ears: ClothingHeadsetService + pocket2: BaseWizardUplinkRadio30BS + innerclothingskirt: ClothingUniformJumpskirtColorPurple + satchel: ClothingBackpackSatchelFilled + duffelbag: ClothingBackpackDuffelFilled diff --git a/Resources/Prototypes/Backmen/Store/categories.yml b/Resources/Prototypes/Backmen/Store/categories.yml index e3ea54f1919..342c332fe00 100644 --- a/Resources/Prototypes/Backmen/Store/categories.yml +++ b/Resources/Prototypes/Backmen/Store/categories.yml @@ -101,3 +101,35 @@ - type: storeCategory id: HotDrinksMachineInventoryEmag name: store-category-emag + + #withard + +- type: storeCategory + id: WizardBooks + name: store-category-books + priority: 0 + +- type: storeCategory + id: WizardArmor + name: store-category-armor + priority: 2 + +- type: storeCategory + id: WizardUtility + name: store-category-utility + priority: 3 + +- type: storeCategory + id: WizardBundles + name: store-category-bundles + priority: 6 + +- type: storeCategory + id: WizardMisc + name: store-category-misc + priority: 7 + +- type: storeCategory + id: WizardPointless + name: store-category-pointless + priority: 8 \ No newline at end of file diff --git a/Resources/Prototypes/Backmen/Store/preset.yml b/Resources/Prototypes/Backmen/Store/preset.yml new file mode 100644 index 00000000000..4d792fbe174 --- /dev/null +++ b/Resources/Prototypes/Backmen/Store/preset.yml @@ -0,0 +1,12 @@ +- type: storePreset + id: WizardStorePresetUplink + storeName: Wizard + categories: + - WizardBooks + - WizardArmor + - WizardUtility + - WizardBundles + - WizardMisc + - WizardPointless + currencyWhitelist: + - Bluespace \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Clothing/Belt/belts.yml b/Resources/Prototypes/Entities/Clothing/Belt/belts.yml index d3ccd335c17..5cfc8f7fb30 100644 --- a/Resources/Prototypes/Entities/Clothing/Belt/belts.yml +++ b/Resources/Prototypes/Entities/Clothing/Belt/belts.yml @@ -688,3 +688,4 @@ whitelist: tags: - WizardWand + - WizardBook