fish-station/Content.Server/Store/Conditions/BuyBeforeCondition.cs
Rinary a85433e877
Новый антагонист: Вампиры (#560)
* Initial Commit

* Unfinished

* Continuing, more abilities

* Remove necromicon healing

* oops

* Continuing

* Continuing

* Checkpoint incase i need to undo something

* Rewrite to use event per power, working passives

* refactor fixes

* so many fixes

* some fixes

* some fixes

* new textures, status icon

* vampire antag role, mind role

* проверку на дауна вызывали?(если Null, у сервера ступор головного фатала)

* fix 1

* fix 2

* fix fatal, fix build

* breafing audio

* fix icons style, store in action

* clear store things, add gamerule, mid round game rule

* some rework

* clear any store systems

* clear x2

* if you have 150 Blood Essence, you get mutation

* upd

* some changes

* simple mutation menu

* я вот сижу, в 12 ночи, пишу какую-то очередную хуйню, вместо приятного сна...

* upd

* normal mutations menu

* actions translate

* None type, base actions list

* passive abilities

* ability earning

* fix

* translate vampire preset

* translate vampire mutations menu

* mutations menu textures

* disable some

* ДРАНЫЙ БРИФ ФАТАЛКУ ПО ПРИКОЛУ БЕЕМ

* game preset

* mutation can infinity changed

* fix

* fully rework abilities update system

* gargantua info

* update ignore list

* fix gargantua passives

* vampire objectives

* new icons

* balance

* fix

* upd objectives

* fix metabolizer type, balance 2

* fix metabolizer type 2

* fix syntax

* clear translation

* xd

* update

* round end info

* fix

* drain objective fix

* fix

* fix syntax

* fix

* clear

---------

Co-authored-by: Rainfey <rainfey0+github@gmail.com>
2024-10-31 19:06:01 +03:00

57 lines
1.6 KiB
C#

using Content.Server.Store.Systems;
using Content.Shared.Store;
using Content.Shared.Store.Components;
using Robust.Shared.Prototypes;
namespace Content.Server.Store.Conditions;
public sealed partial class BuyBeforeCondition : ListingCondition
{
/// <summary>
/// Required listing(s) needed to purchase before this listing is available
/// </summary>
[DataField(required: true)]
public HashSet<ProtoId<ListingPrototype>> Whitelist;
/// <summary>
/// Listing(s) that if bought, block this purchase, if any.
/// </summary>
[DataField]
public HashSet<ProtoId<ListingPrototype>>? Blacklist;
public override bool Condition(ListingConditionArgs args)
{
if (!args.EntityManager.TryGetComponent<StoreComponent>(args.StoreEntity, out var storeComp))
return false;
var allListings = storeComp.FullListingsCatalog;
var purchasesFound = false;
if (Blacklist != null)
{
foreach (var blacklistListing in Blacklist)
{
foreach (var listing in allListings)
{
if (listing.ID == blacklistListing.Id && listing.PurchaseAmount > 0)
return false;
}
}
}
foreach (var requiredListing in Whitelist)
{
foreach (var listing in allListings)
{
if (listing.ID == requiredListing.Id)
{
purchasesFound = listing.PurchaseAmount > 0;
break;
}
}
}
return purchasesFound;
}
}