Изменение отображения скидок в аплинке (#266)
* Better sales * Sale item restrictions
This commit is contained in:
@@ -159,8 +159,12 @@ public sealed partial class StoreMenu : DefaultWindow
|
|||||||
canBuy = false;
|
canBuy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listing.SaleAmount > 0) // WD
|
// WD START
|
||||||
|
if (listing.SaleAmount > 0)
|
||||||
listingName += $" [СКИДКА] ({listing.SaleAmount}%!)";
|
listingName += $" [СКИДКА] ({listing.SaleAmount}%!)";
|
||||||
|
else if (listing.OldCost.Count > 0)
|
||||||
|
listingName += " [Скидка закончилась]";
|
||||||
|
// WD END
|
||||||
|
|
||||||
var newListing = new StoreListingControl(listingName, listingDesc, listingInStock, canBuy, texture);
|
var newListing = new StoreListingControl(listingName, listingDesc, listingInStock, canBuy, texture);
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,10 @@ public sealed partial class StoreSystem
|
|||||||
|
|
||||||
if (listing.Cost.Any(x => x.Value.Int() != newCost[x.Key].Int()))
|
if (listing.Cost.Any(x => x.Value.Int() != newCost[x.Key].Int()))
|
||||||
{
|
{
|
||||||
|
var key = listing.Cost.First(x => x.Value > 0).Key;
|
||||||
|
listingData.OldCost = listing.Cost;
|
||||||
|
listingData.SaleAmount = 100 - (newCost[key] / listing.Cost[key] * 100).Int();
|
||||||
listingData.Cost = newCost;
|
listingData.Cost = newCost;
|
||||||
listingData.SaleAmount = 100 - (int) MathF.Round(sale.Item1 * 100);
|
|
||||||
listingData.Categories = new() {sale.Item2};
|
listingData.Categories = new() {sale.Item2};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,6 +183,14 @@ public sealed partial class StoreSystem
|
|||||||
listing.PurchaseAmount++; //track how many times something has been purchased
|
listing.PurchaseAmount++; //track how many times something has been purchased
|
||||||
_audio.PlayEntity(component.BuySuccessSound, msg.Session, uid); //cha-ching!
|
_audio.PlayEntity(component.BuySuccessSound, msg.Session, uid); //cha-ching!
|
||||||
|
|
||||||
|
//WD START
|
||||||
|
if (listing.SaleLimit != 0 && listing.SaleAmount > 0 && listing.PurchaseAmount >= listing.SaleLimit)
|
||||||
|
{
|
||||||
|
listing.SaleAmount = 0;
|
||||||
|
listing.Cost = listing.OldCost;
|
||||||
|
}
|
||||||
|
//WD END
|
||||||
|
|
||||||
UpdateUserInterface(buyer, uid, component);
|
UpdateUserInterface(buyer, uid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,10 +95,15 @@ public partial class ListingData : IEquatable<ListingData>, ICloneable
|
|||||||
public int RestockTime;
|
public int RestockTime;
|
||||||
|
|
||||||
// WD START
|
// WD START
|
||||||
|
[DataField("saleLimit")]
|
||||||
|
public int SaleLimit;
|
||||||
|
|
||||||
[DataField("saleBlacklist")]
|
[DataField("saleBlacklist")]
|
||||||
public bool SaleBlacklist;
|
public bool SaleBlacklist;
|
||||||
|
|
||||||
public int SaleAmount;
|
public int SaleAmount;
|
||||||
|
|
||||||
|
public Dictionary<string, FixedPoint2> OldCost = new();
|
||||||
// WD END
|
// WD END
|
||||||
|
|
||||||
public bool Equals(ListingData? listing)
|
public bool Equals(ListingData? listing)
|
||||||
@@ -155,8 +160,10 @@ public partial class ListingData : IEquatable<ListingData>, ICloneable
|
|||||||
PurchaseAmount = PurchaseAmount,
|
PurchaseAmount = PurchaseAmount,
|
||||||
RestockTime = RestockTime,
|
RestockTime = RestockTime,
|
||||||
// WD START
|
// WD START
|
||||||
|
SaleLimit = SaleLimit,
|
||||||
SaleBlacklist = SaleBlacklist,
|
SaleBlacklist = SaleBlacklist,
|
||||||
SaleAmount = SaleAmount,
|
SaleAmount = SaleAmount,
|
||||||
|
OldCost = OldCost,
|
||||||
// WD END
|
// WD END
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
blacklist:
|
blacklist:
|
||||||
tags:
|
tags:
|
||||||
- NukeOpsUplink
|
- NukeOpsUplink
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkPistolViper
|
id: UplinkPistolViper
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
Telecrystal: 3
|
Telecrystal: 3
|
||||||
categories:
|
categories:
|
||||||
- UplinkWeapons
|
- UplinkWeapons
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkRevolverPython
|
id: UplinkRevolverPython
|
||||||
@@ -35,6 +37,7 @@
|
|||||||
Telecrystal: 8 # Originally was 13 TC but was not used due to high cost
|
Telecrystal: 8 # Originally was 13 TC but was not used due to high cost
|
||||||
categories:
|
categories:
|
||||||
- UplinkWeapons
|
- UplinkWeapons
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
# Inbuilt suppressor so it's sneaky + more expensive.
|
# Inbuilt suppressor so it's sneaky + more expensive.
|
||||||
- type: listing
|
- type: listing
|
||||||
@@ -46,6 +49,7 @@
|
|||||||
Telecrystal: 4
|
Telecrystal: 4
|
||||||
categories:
|
categories:
|
||||||
- UplinkWeapons
|
- UplinkWeapons
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
# Poor accuracy, slow to fire, cheap option
|
# Poor accuracy, slow to fire, cheap option
|
||||||
- type: listing
|
- type: listing
|
||||||
@@ -57,6 +61,7 @@
|
|||||||
Telecrystal: 1
|
Telecrystal: 1
|
||||||
categories:
|
categories:
|
||||||
- UplinkWeapons
|
- UplinkWeapons
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkEsword
|
id: UplinkEsword
|
||||||
@@ -68,6 +73,7 @@
|
|||||||
Telecrystal: 10
|
Telecrystal: 10
|
||||||
categories:
|
categories:
|
||||||
- UplinkWeapons
|
- UplinkWeapons
|
||||||
|
saleLimit: 2
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkEnergyDagger
|
id: UplinkEnergyDagger
|
||||||
@@ -79,6 +85,18 @@
|
|||||||
Telecrystal: 2
|
Telecrystal: 2
|
||||||
categories:
|
categories:
|
||||||
- UplinkWeapons
|
- UplinkWeapons
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
|
- type: listing
|
||||||
|
id: UplinkFireAxeFlaming
|
||||||
|
name: uplink-fire-axe-flaming-name
|
||||||
|
description: uplink-fire-axe-flaming-desc
|
||||||
|
productEntity: FireAxeFlaming
|
||||||
|
cost:
|
||||||
|
Telecrystal: 10
|
||||||
|
categories:
|
||||||
|
- UplinkWeapons
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkGlovesNorthStar
|
id: UplinkGlovesNorthStar
|
||||||
@@ -89,6 +107,7 @@
|
|||||||
Telecrystal: 8
|
Telecrystal: 8
|
||||||
categories:
|
categories:
|
||||||
- UplinkWeapons
|
- UplinkWeapons
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkDisposableTurret
|
id: UplinkDisposableTurret
|
||||||
@@ -116,6 +135,7 @@
|
|||||||
Telecrystal: 4
|
Telecrystal: 4
|
||||||
categories:
|
categories:
|
||||||
- UplinkExplosives
|
- UplinkExplosives
|
||||||
|
saleLimit: 3
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkExplosiveGrenadeFlash
|
id: UplinkExplosiveGrenadeFlash
|
||||||
@@ -126,6 +146,7 @@
|
|||||||
Telecrystal: 1
|
Telecrystal: 1
|
||||||
categories:
|
categories:
|
||||||
- UplinkExplosives
|
- UplinkExplosives
|
||||||
|
saleLimit: 3
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkSmokeGrenade
|
id: UplinkSmokeGrenade
|
||||||
@@ -146,6 +167,7 @@
|
|||||||
Telecrystal: 6
|
Telecrystal: 6
|
||||||
categories:
|
categories:
|
||||||
- UplinkExplosives
|
- UplinkExplosives
|
||||||
|
saleLimit: 3
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkSupermatterGrenade
|
id: UplinkSupermatterGrenade
|
||||||
@@ -181,6 +203,7 @@
|
|||||||
blacklist:
|
blacklist:
|
||||||
components:
|
components:
|
||||||
- SurplusBundle
|
- SurplusBundle
|
||||||
|
saleLimit: 3
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkC4
|
id: UplinkC4
|
||||||
@@ -191,6 +214,7 @@
|
|||||||
Telecrystal: 2
|
Telecrystal: 2
|
||||||
categories:
|
categories:
|
||||||
- UplinkExplosives
|
- UplinkExplosives
|
||||||
|
saleLimit: 3
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkGrenadierRig
|
id: UplinkGrenadierRig
|
||||||
@@ -206,6 +230,7 @@
|
|||||||
whitelist:
|
whitelist:
|
||||||
tags:
|
tags:
|
||||||
- NukeOpsUplink
|
- NukeOpsUplink
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkC4Bundle
|
id: UplinkC4Bundle
|
||||||
@@ -216,6 +241,7 @@
|
|||||||
Telecrystal: 12 #you're buying bulk so its a 25% discount
|
Telecrystal: 12 #you're buying bulk so its a 25% discount
|
||||||
categories:
|
categories:
|
||||||
- UplinkExplosives
|
- UplinkExplosives
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkEmpGrenade
|
id: UplinkEmpGrenade
|
||||||
@@ -226,6 +252,7 @@
|
|||||||
Telecrystal: 2
|
Telecrystal: 2
|
||||||
categories:
|
categories:
|
||||||
- UplinkExplosives
|
- UplinkExplosives
|
||||||
|
saleLimit: 3
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkExplodingPen
|
id: UplinkExplodingPen
|
||||||
@@ -237,6 +264,7 @@
|
|||||||
Telecrystal: 5
|
Telecrystal: 5
|
||||||
categories:
|
categories:
|
||||||
- UplinkExplosives
|
- UplinkExplosives
|
||||||
|
saleLimit: 3
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkSyndicateBomb
|
id: UplinkSyndicateBomb
|
||||||
@@ -731,6 +759,7 @@
|
|||||||
blacklist:
|
blacklist:
|
||||||
components:
|
components:
|
||||||
- SurplusBundle
|
- SurplusBundle
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkChemistryKitBundle
|
id: UplinkChemistryKitBundle
|
||||||
@@ -761,6 +790,7 @@
|
|||||||
blacklist:
|
blacklist:
|
||||||
components:
|
components:
|
||||||
- SurplusBundle
|
- SurplusBundle
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkSniperBundle
|
id: UplinkSniperBundle
|
||||||
@@ -772,6 +802,7 @@
|
|||||||
Telecrystal: 12
|
Telecrystal: 12
|
||||||
categories:
|
categories:
|
||||||
- UplinkBundles
|
- UplinkBundles
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkC20RBundle
|
id: UplinkC20RBundle
|
||||||
@@ -783,6 +814,7 @@
|
|||||||
Telecrystal: 17
|
Telecrystal: 17
|
||||||
categories:
|
categories:
|
||||||
- UplinkBundles
|
- UplinkBundles
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkBulldogBundle
|
id: UplinkBulldogBundle
|
||||||
@@ -794,6 +826,7 @@
|
|||||||
Telecrystal: 20
|
Telecrystal: 20
|
||||||
categories:
|
categories:
|
||||||
- UplinkBundles
|
- UplinkBundles
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkGrenadeLauncherBundle
|
id: UplinkGrenadeLauncherBundle
|
||||||
@@ -805,6 +838,7 @@
|
|||||||
Telecrystal: 25
|
Telecrystal: 25
|
||||||
categories:
|
categories:
|
||||||
- UplinkBundles
|
- UplinkBundles
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkL6SawBundle
|
id: UplinkL6SawBundle
|
||||||
@@ -816,6 +850,7 @@
|
|||||||
Telecrystal: 30
|
Telecrystal: 30
|
||||||
categories:
|
categories:
|
||||||
- UplinkBundles
|
- UplinkBundles
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkZombieBundle
|
id: UplinkZombieBundle
|
||||||
@@ -836,6 +871,7 @@
|
|||||||
blacklist:
|
blacklist:
|
||||||
components:
|
components:
|
||||||
- SurplusBundle
|
- SurplusBundle
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkSurplusBundle
|
id: UplinkSurplusBundle
|
||||||
@@ -1014,6 +1050,7 @@
|
|||||||
- !type:BuyerJobCondition
|
- !type:BuyerJobCondition
|
||||||
whitelist:
|
whitelist:
|
||||||
- Chaplain
|
- Chaplain
|
||||||
|
saleLimit: 3
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: uplinkRevolverCapGunFake
|
id: uplinkRevolverCapGunFake
|
||||||
@@ -1029,6 +1066,7 @@
|
|||||||
whitelist:
|
whitelist:
|
||||||
- Mime
|
- Mime
|
||||||
- Clown
|
- Clown
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: uplinkBananaPeelExplosive
|
id: uplinkBananaPeelExplosive
|
||||||
@@ -1044,6 +1082,7 @@
|
|||||||
- !type:BuyerJobCondition
|
- !type:BuyerJobCondition
|
||||||
whitelist:
|
whitelist:
|
||||||
- Clown
|
- Clown
|
||||||
|
saleLimit: 3
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkClusterBananaPeel
|
id: UplinkClusterBananaPeel
|
||||||
@@ -1090,6 +1129,7 @@
|
|||||||
- Botanist
|
- Botanist
|
||||||
- Clown
|
- Clown
|
||||||
- Mime
|
- Mime
|
||||||
|
saleLimit: 3
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkChimpUpgradeKit
|
id: UplinkChimpUpgradeKit
|
||||||
@@ -1122,6 +1162,7 @@
|
|||||||
blacklist:
|
blacklist:
|
||||||
components:
|
components:
|
||||||
- SurplusBundle
|
- SurplusBundle
|
||||||
|
saleLimit: 3
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkSyndicateSpongeBox
|
id: UplinkSyndicateSpongeBox
|
||||||
@@ -1289,6 +1330,7 @@
|
|||||||
Telecrystal: 6
|
Telecrystal: 6
|
||||||
categories:
|
categories:
|
||||||
- UplinkMisc
|
- UplinkMisc
|
||||||
|
saleLimit: 1
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
id: UplinkSoapSyndie
|
id: UplinkSoapSyndie
|
||||||
|
|||||||
Reference in New Issue
Block a user