Adds a refund button & action upgrades for stores (#24518)
* adds refunds to stores * Adds method to check for starting map * comments, datafields, some requested changes * turns event into ref event * Adds datafields * Switches to entity terminating event * Changes store entity to be nullable and checks if store is terminating to remove reference. * Tryadd instead of containskey * Adds a refund disable method, disables refund on bought ent container changes if not an action * Removes datafield specification * Readds missing using statement * Removes unused using statements * What the heck is listing data --------- Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Linq;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||
@@ -77,6 +78,20 @@ public partial class ListingData : IEquatable<ListingData>, ICloneable
|
||||
[DataField("productAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string? ProductAction;
|
||||
|
||||
/// <summary>
|
||||
/// The listing ID of the related upgrade listing. Can be used to link a <see cref="ProductAction"/> to an
|
||||
/// upgrade or to use standalone as an upgrade
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public ProtoId<ListingPrototype>? ProductUpgradeID;
|
||||
|
||||
/// <summary>
|
||||
/// Keeps track of the current action entity this is tied to, for action upgrades
|
||||
/// </summary>
|
||||
[DataField]
|
||||
[NonSerialized]
|
||||
public EntityUid? ProductActionEntity;
|
||||
|
||||
/// <summary>
|
||||
/// The event that is broadcast when the listing is purchased.
|
||||
/// </summary>
|
||||
@@ -105,6 +120,7 @@ public partial class ListingData : IEquatable<ListingData>, ICloneable
|
||||
Description != listing.Description ||
|
||||
ProductEntity != listing.ProductEntity ||
|
||||
ProductAction != listing.ProductAction ||
|
||||
ProductActionEntity != listing.ProductActionEntity ||
|
||||
ProductEvent != listing.ProductEvent ||
|
||||
RestockTime != listing.RestockTime)
|
||||
return false;
|
||||
@@ -146,6 +162,8 @@ public partial class ListingData : IEquatable<ListingData>, ICloneable
|
||||
Priority = Priority,
|
||||
ProductEntity = ProductEntity,
|
||||
ProductAction = ProductAction,
|
||||
ProductUpgradeID = ProductUpgradeID,
|
||||
ProductActionEntity = ProductActionEntity,
|
||||
ProductEvent = ProductEvent,
|
||||
PurchaseAmount = PurchaseAmount,
|
||||
RestockTime = RestockTime,
|
||||
|
||||
@@ -18,11 +18,14 @@ public sealed class StoreUpdateState : BoundUserInterfaceState
|
||||
|
||||
public readonly bool ShowFooter;
|
||||
|
||||
public StoreUpdateState(HashSet<ListingData> listings, Dictionary<string, FixedPoint2> balance, bool showFooter)
|
||||
public readonly bool AllowRefund;
|
||||
|
||||
public StoreUpdateState(HashSet<ListingData> listings, Dictionary<string, FixedPoint2> balance, bool showFooter, bool allowRefund)
|
||||
{
|
||||
Listings = listings;
|
||||
Balance = balance;
|
||||
ShowFooter = showFooter;
|
||||
AllowRefund = allowRefund;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,3 +75,12 @@ public sealed class StoreRequestWithdrawMessage : BoundUserInterfaceMessage
|
||||
Amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used when the refund button is pressed
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class StoreRequestRefundMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user