diff --git a/ShiftOS.Objects/ShiftOS.Objects.csproj b/ShiftOS.Objects/ShiftOS.Objects.csproj
index adbe161..7013476 100644
--- a/ShiftOS.Objects/ShiftOS.Objects.csproj
+++ b/ShiftOS.Objects/ShiftOS.Objects.csproj
@@ -65,6 +65,7 @@
+
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 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;
+ }
+ }
+ }
+}
diff --git a/ShiftOS.Server/Program.cs b/ShiftOS.Server/Program.cs
index fde1655..3c2c604 100644
--- a/ShiftOS.Server/Program.cs
+++ b/ShiftOS.Server/Program.cs
@@ -281,6 +281,36 @@ Contents:
switch (msg.Name)
{
+ case "usr_givecp":
+ if (args["username"] != null && args["amount"] != null)
+ {
+ string userName = args["username"] as string;
+ int amount = (int)args["amount"];
+
+ if (Directory.Exists("saves"))
+ {
+ foreach(var saveFile in Directory.GetFiles("saves"))
+ {
+ var saveFileContents = JsonConvert.DeserializeObject(File.ReadAllText(saveFile));
+ if(saveFileContents.Username == userName)
+ {
+ saveFileContents.Codepoints += amount;
+ File.WriteAllText(saveFile, JsonConvert.SerializeObject(saveFileContents, Formatting.Indented));
+ server.DispatchAll(new NetObject("pikachu_use_thunderbolt_oh_yeah_and_if_you_happen_to_be_doing_backend_and_see_this_post_a_picture_of_ash_ketchum_from_the_unova_series_in_the_discord_dev_room_holy_crap_this_is_a_long_snake_case_thing_about_ash_ketchum_and_pikachu", new ServerMessage
+ {
+ Name = "update_your_cp",
+ GUID = "server",
+ Contents = $@"{{
+ username: ""{userName}"",
+ amount: {amount}
+}}"
+ }));
+ return;
+ }
+ }
+ }
+ }
+ break;
case "mud_login":
if (args["username"] != null && args["password"] != null)
{
diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs
index 85052fb..13c4ffa 100644
--- a/ShiftOS_TheReturn/ServerManager.cs
+++ b/ShiftOS_TheReturn/ServerManager.cs
@@ -126,6 +126,16 @@ namespace ShiftOS.Engine
thisGuid = new Guid(msg.Contents);
GUIDReceived?.Invoke(msg.Contents);
}
+ else if(msg.Name == "update_your_cp")
+ {
+ var args = JsonConvert.DeserializeObject>(msg.Contents);
+ if(args["username"] as string == SaveSystem.CurrentSave.Username)
+ {
+ SaveSystem.CurrentSave.Codepoints += (int)args["amount"];
+ Infobox.Show($"MUD Control Centre", $"Someone bought an item in your shop, and they have paid {args["amount"]}, and as such, you have been granted these Codepoints.");
+ SaveSystem.SaveGame();
+ }
+ }
else if(msg.Name =="broadcast")
{
Console.WriteLine(msg.Contents);