diff options
| author | Michael <[email protected]> | 2017-01-14 10:28:57 -0500 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-01-14 10:29:03 -0500 |
| commit | ca7062c3e6527054d805dede838d951333f0cea7 (patch) | |
| tree | 6a4a5e72472109faaa8926d3f45f237fbb5b1eaa /ShiftOS.Objects/Shop.cs | |
| parent | 9aab77b2f1bd4231e0d4d97efc178a9ec702d96d (diff) | |
| download | shiftos_thereturn-ca7062c3e6527054d805dede838d951333f0cea7.tar.gz shiftos_thereturn-ca7062c3e6527054d805dede838d951333f0cea7.tar.bz2 shiftos_thereturn-ca7062c3e6527054d805dede838d951333f0cea7.zip | |
#5 - Users can be given CP over the MUD
Currently not usable in the UI, but will be used to power shops.
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; + } + } + } +} |
