diff options
Diffstat (limited to 'ShiftOS.Objects/Shop.cs')
| -rw-r--r-- | ShiftOS.Objects/Shop.cs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/ShiftOS.Objects/Shop.cs b/ShiftOS.Objects/Shop.cs new file mode 100644 index 0000000..d20fecb --- /dev/null +++ b/ShiftOS.Objects/Shop.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShiftOS.Objects +{ + public class Shop + { + public string Name { get; set; } + public string Description { get; set; } + public List<ShopItem> Items { get; set; } + } + + public abstract class ShopItem + { + public string Name { get; set; } + public string Description { get; set; } + public int Cost { get; set; } + public string ShopOwner { get; set; } + + + protected abstract void OnBuy(); + + protected abstract void GiveCPToShopOwner(int cp); + + public bool Buy(ref Save buyer) + { + if(buyer.Codepoints >= Cost) + { + buyer.Codepoints -= Cost; + OnBuy(); + GiveCPToShopOwner(Cost); + return true; + } + else + { + return false; + } + } + } +} |
